{"id":15100825,"url":"https://github.com/levjj/esverify","last_synced_at":"2025-09-26T22:31:28.157Z","repository":{"id":13894753,"uuid":"75248188","full_name":"levjj/esverify","owner":"levjj","description":"ECMAScript verification with SMT solvers","archived":false,"fork":false,"pushed_at":"2023-05-01T22:43:25.000Z","size":1212,"stargazers_count":121,"open_issues_count":11,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-25T05:22:09.307Z","etag":null,"topics":["javascript","verification"],"latest_commit_sha":null,"homepage":"https://esverify.org/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/levjj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-12-01T02:42:30.000Z","updated_at":"2024-04-07T20:35:38.000Z","dependencies_parsed_at":"2023-12-09T00:28:43.145Z","dependency_job_id":null,"html_url":"https://github.com/levjj/esverify","commit_stats":{"total_commits":338,"total_committers":6,"mean_commits":"56.333333333333336","dds":"0.15384615384615385","last_synced_commit":"183b077e0ecbf1904eb3b62a62ff73cf40b004c7"},"previous_names":[],"tags_count":54,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levjj%2Fesverify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levjj%2Fesverify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levjj%2Fesverify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levjj%2Fesverify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/levjj","download_url":"https://codeload.github.com/levjj/esverify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234356495,"owners_count":18819377,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","verification"],"created_at":"2024-09-25T18:01:06.002Z","updated_at":"2025-09-26T22:31:27.834Z","avatar_url":"https://github.com/levjj.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# esverify\n\n[![Build Status](https://api.travis-ci.com/levjj/esverify.svg?branch=master)](https://travis-ci.com/levjj/esverify)\n[![NPM Version](https://img.shields.io/npm/v/esverify.svg)](https://www.npmjs.com/package/esverify)\n\nProgram Verification for ECMAScript/JavaScript ([esverify.org](http://esverify.org/)).\n\n**Alpha: This is still a research prototype and not yet ready for production use.**\n\n## Documentation\n\nA detailed documentation of esverify and its theoretical foundations is\ncurrently work-in-progress and will be published soon.\n\n## Example\n\nGiven a simple JavaScript `max` function, we can add pre- and post-conditions\nusing special pseudo-calls to `requires` and `ensures` with boolean expressions.\n\n```js\nfunction max(a, b) {\n  requires(typeof a === \"number\");\n  requires(typeof b === \"number\");\n  ensures(res =\u003e res \u003e= a);\n\n  if (a \u003e= b) {\n    return a;\n  } else {\n    return b;\n  }\n}\n```\n\nThese expressions will then be statically verified with respect to the function\nbody with an SMT solver.\n\nMore examples can be found in the `tests` directory.\n\n## Supported Features\n\n* Expressions with boolean values, strings, integer and real number arithmetic\n* Function pre- and post conditions as well as inline assertions and invariants\n* Automatically generates counter-examples for failed assertions\n* Runs counter-example as JavaScript code to reproduce errors in dynamic context\n  and differentiate incorrect programs from false negatives\n* Mutable variables and limited temporal reasoning, e.g. `old(x) \u003e x`\n* Control flow including branching, returns and while loops with manually\n  specified invariants\n* Inductive reasoning with loop invariants and recursive functions\n* Automatic inlining of function body for external proofs of function properties\n  (restricted to one level of inlining)\n* Closures\n* Checking of function purity\n* Higher-order functions\n* Simple proof checking using Curry-Howard correspondence\n* Simple immutable classes with fields, methods and class invariant (no inheritance)\n* Immutable JavaScript objects using string keys\n* Immutable arrays (no sparse arrays)\n* Restricted verifier preamble for global objects such as `console` and `Math`\n\nIt is based on the [z3](https://github.com/Z3Prover/z3) SMT solver but avoids\ntrigger heuristics and thereby (most) timeouts and other unpredictable results by\nrequiring manual instantiation. Function definitions and class invariants correspond\nto universal quantifiers and function calls and field access act as triggers that\ninstantiate these quantifiers in a deterministic way.\n\n## To Do (see [GitHub issues](https://github.com/levjj/esverify/issues))\n\n* Termination checking\n* Mutable objects, arrays and classes\n* Modules with imports and exports\n* Prototype and subclass inheritance\n* Verifier-only \"ghost\" variables, arguments and functions/predicates\n* TypeScript as input language\n\n## Usage as Command Line Tool\n\nSimple usage without installation:\n\n```\n$ npx esverify file.js\n```\n\nInstallation:\n\n```\n$ npm install -g esverify\n```\n\nCommand Line Options:\n\n```\n$ esverify --help\nUsage: esverify [OPTIONS] FILE\n\nOptions:\n  --z3path PATH           Path to local z3 executable\n                          (default path is \"z3\")\n  -r, --remote            Invokes z3 remotely via HTTP request\n  --z3url URL             URL to remote z3 web server\n  --noqi                  Disables quantifier instantiations\n  -t, --timeout SECS      Sets timeout in seconds for z3\n                          (default timeout is 10s, 0 disables timeout)\n  -f, --logformat FORMAT  Format can be either \"simple\" or \"colored\"\n                          (default format is \"colored\")\n  -q, --quiet             Suppresses output\n  -v, --verbose           Prints SMT input, output and test code\n  --logsmt PATH           Path for logging SMT input in verbose mode\n                          (default path is \"/tmp/vc.smt\")\n  -h, --help              Prints this help text and exit\n  --version               Prints version information\n```\n\n## Usage as Library\n\nInstallation via npm:\n\n```\n$ npm install esverify --save\n```\n\nImport `verify` and invoke on source code to receive a promise of messages.\n\n```js\nimport { verify } from \"esverify\";\n\nconst opts = { };\nconst messages = await verify(\"assert(1 \u003e 2);\", opts);\nmessages.forEach(msg =\u003e console.log(msg.status));\n```\n\nThe options and returned messages have the following structure:\n\n```ts\ntype opts = {\n  filename: string,\n  logformat: \"simple\" | \"colored\" = \"colored\",\n  z3path: string = \"z3\",\n  z3url: string,\n  remote: boolean = false,\n  quiet: true,\n  verbose: false,\n  logsmt: '/tmp/vc.smt'\n  timeout: 5,\n  qi: true\n}\n\ntype msg = {\n  status: \"verified\" | \"unverified\" | \"timeout\" | \"error\",\n  loc: { file: string, start: { line: number, column: number },\n                       end:   { line: number, column: number }},\n  description: string\n}\n```\n\n## Interactive Tools\n\nA simple [web-based editor](https://github.com/levjj/esverify-editor)\nis available online at [esverify.org/try](http://esverify.org/try).\n\nAdditionally, there is a [Vim Plugin](https://github.com/levjj/esverify-vim)\nand an [Emacs Plugin](https://github.com/SohumB/flycheck-esverify)\nwhich display verification results inline.\n\nMore tool support will be coming soon.\n\n## License\n\n[MIT License](https://github.com/levjj/esverify/blob/master/LICENSE)\n\n## Issues\n\nPlease report bugs to the [GitHub Issue Tracker](https://github.com/levjj/esverify/issues). esverify is currently developed and maintained by [Christopher Schuster](https://livoris.net/).\n\n## Acknowledgements\n\nInspired by [Dafny](https://github.com/Microsoft/dafny) and\n[LiquidHaskell](https://github.com/ucsd-progsys/liquidhaskell).\n\nThis project is developed by the\n[Software and Languages Research Group at University of California, Santa Cruz](http://slang.soe.ucsc.edu/).\nThanks also to Tommy, Sohum and Cormac for support and advice.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevjj%2Fesverify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flevjj%2Fesverify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevjj%2Fesverify/lists"}