{"id":20910165,"url":"https://github.com/viperproject/silicon","last_synced_at":"2025-04-04T23:07:26.606Z","repository":{"id":38240951,"uuid":"241860134","full_name":"viperproject/silicon","owner":"viperproject","description":"Symbolic-execution-based verifier for the Viper intermediate verification language.","archived":false,"fork":false,"pushed_at":"2025-03-23T17:14:45.000Z","size":40510,"stargazers_count":96,"open_issues_count":124,"forks_count":36,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-28T22:11:54.479Z","etag":null,"topics":["symbolic-execution","verification","viper"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/viperproject.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-20T10:50:48.000Z","updated_at":"2025-03-24T09:27:37.000Z","dependencies_parsed_at":"2023-10-15T15:05:41.141Z","dependency_job_id":"6a19268c-0c1d-481a-a55c-1fcb68fcd22b","html_url":"https://github.com/viperproject/silicon","commit_stats":null,"previous_names":[],"tags_count":200,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viperproject%2Fsilicon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viperproject%2Fsilicon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viperproject%2Fsilicon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viperproject%2Fsilicon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/viperproject","download_url":"https://codeload.github.com/viperproject/silicon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247261603,"owners_count":20910108,"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":["symbolic-execution","verification","viper"],"created_at":"2024-11-18T14:14:06.826Z","updated_at":"2025-04-04T23:07:26.591Z","avatar_url":"https://github.com/viperproject.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Silicon: A Viper Verifier Based on Symbolic Execution\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"512\" height=\"144\" alt=\"Silicon logo\" src=\"docs/logo_name.png\"\u003e\n\u003c/p\u003e\n\nSilicon is a state-of-the-art, automated verifier based on symbolic execution,\nand the default verifier of the\n[Viper verification infrastructure](http://www.pm.inf.ethz.ch/research/viper.html).\nSilicon's input language is the\n[Viper intermediate verification language](http://pm.inf.ethz.ch/publications/getpdf.php?bibname=Own\u0026id=MuellerSchwerhoffSummers16.pdf):\na language in the spirit of Microsoft's Boogie, but with a higher level of\nabstraction and a built-in notation of permissions, which makes Viper\nwell-suited for encoding and verifying properties of sequential and concurrent\nprograms with shared mutable state. Loads of details can (but don't need to) be\nfound in the\n[PhD thesis of Malte Schwerhoff](http://pm.inf.ethz.ch/publications/getpdf.php?bibname=Own\u0026id=Schwerhoff16.pdf).\n\nAs an example, consider the following simple C++ program, which runs two threads\nin parallel that increment a shared memory location and that uses a lock to\navoid race conditions:\n\n```c++\n#include \u003cthread\u003e\n#include \u003cmutex\u003e\n#include \u003cassert.h\u003e\n\nstruct Cell {\n  int val;\n};\n\nvoid inc(Cell* c, std::mutex* guard) {\n  guard-\u003elock();\n  \n  int t = c-\u003eval;\n  std::this_thread::sleep_for(std::chrono::seconds(1));\n  c-\u003eval = t + 1;\n  \n  guard-\u003eunlock();\n}\n\nint main() {\n  Cell* c = new Cell{0};\n  std::mutex* guard = new std::mutex();\n  \n  std::thread t1 = std::thread(inc, c, guard);\n  std::thread t2 = std::thread(inc, c, guard);\n\n  t1.join();\n  t2.join();\n  \n  guard-\u003e~mutex();\n  assert(c-\u003eval == 2);\n\n  return 0;\n}\n```\n\nSuch a program can be encoded in Viper, e.g. using an Owicki-Gries approach as\nshown below, and Silicon can be used to automatically verify that the shared\nmemory location is indeed modified in an orderly manner.\n\n```text\nfield val: Int\nfield t1: Int\nfield t2: Int\n\n// Monitor/lock invariant associated with the shared cell\n// Macro'ed for easy reuse\ndefine guard_INV(c)\n  acc(c.val) \u0026\u0026 acc(c.t1, 1/2) \u0026\u0026 acc(c.t2, 1/2) \u0026\u0026\n  c.val == c.t1 + c.t2\n\n// Precondition of inc\ndefine inc_PRE(c, tid)\n  (tid == 0 || tid == 1) \u0026\u0026\n  (tid == 0 ? acc(c.t1, 1/2) : acc(c.t2, 1/2))\n  \n// Postcondition of inc\ndefine inc_POST(c, tid, oldv)\n  tid == 0 ? (acc(c.t1, 1/2) \u0026\u0026 c.t1 == oldv + 1)\n            : (acc(c.t2, 1/2) \u0026\u0026 c.t2 == oldv + 1)\n\nmethod inc(c: Ref, tid: Int)\n  requires inc_PRE(c, tid)\n  ensures  inc_POST(c, tid, tid == 0 ? old(c.t1) : old(c.t2))\n{\n  inhale guard_INV(c) // models guard.lock()\n  \n  c.val := c.val + 1\n  \n  if (tid == 0) { c.t1 := c.t1 + 1 }\n  else { c.t2 := c.t2 + 1 }\n  \n  exhale guard_INV(c) // models guard.unlock()\n}\n\nmethod main() {\n  var c: Ref\n  c := new(val, t1, t2) // allocate real and ghost memory\n  c.val := 0\n  c.t1 := 0\n  c.t2 := 0\n  \n  exhale guard_INV(c) // share the cell, i.e. create the guarding mutex\n  \n  label pre_fork\n  exhale inc_PRE(c, 0) // fork thread 1\n  exhale inc_PRE(c, 1) // fork thread 2\n  \n  inhale inc_POST(c, 0, old[pre_fork](c.t1)) // join thread 1\n  inhale inc_POST(c, 1, old[pre_fork](c.t2)) // join thread 2\n  \n  inhale guard_INV(c) // unshare the cell, i.e. destroy the mutex\n  \n  assert c.val == 2;\n}\n```\n\n# Getting Started\n\n* Download the\n  [Viper IDE](http://www.pm.inf.ethz.ch/research/viper/downloads.html)\n  (based on Microsoft Visual Studio Code).\n\n* Experiment with Viper using the\n  [Viper online](http://viper.ethz.ch/examples/)\n  web interface.\n\n# Build Instructions\n\n\u003e See [the documentation wiki](https://github.com/viperproject/documentation/wiki) for instructions on how to try out or install the Viper tools.\n\n* You need recent installations of\n  1. the [sbt build tool](https://www.scala-sbt.org/)\n  2. the [Z3 SMT solver](https://github.com/Z3Prover/z3/releases)\n  3. (optional) the [cvc5 SMT solver](https://github.com/cvc5/cvc5/releases)\n* Clone this repository *recursively* by running:  \n`git clone --recursive https://github.com/viperproject/silicon`\n\nAnd then, from the cloned directory, with the `Z3_EXE` environment variable set appropriately;  \n* Compile and run with:  \n  `sbt \"run [options] \u003cpath to Viper file\u003e\"`  \n  Or run all tests via `sbt test`\n* Alternatively, for a faster startup without compilation each time, build a `.jar` file:  \n  `sbt assembly`  \n  And then run with:  \n  `java -jar ./target/scala-*/silicon.jar [options] \u003cpath to Viper file\u003e`\n\n\u003e We recommend IDEA IntelliJ for Scala development, but any IDE that supports sbt will do\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviperproject%2Fsilicon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fviperproject%2Fsilicon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviperproject%2Fsilicon/lists"}