{"id":21882442,"url":"https://github.com/seahorn/crab","last_synced_at":"2025-05-16T18:06:32.282Z","repository":{"id":37580103,"uuid":"95927890","full_name":"seahorn/crab","owner":"seahorn","description":"A library for building abstract interpretation-based analyses. **Update**: crab is still actively maintained. Please use branch dev. ","archived":false,"fork":false,"pushed_at":"2024-10-23T04:45:58.000Z","size":7118,"stargazers_count":238,"open_issues_count":6,"forks_count":31,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-12T16:57:36.798Z","etag":null,"topics":["abstract-interpretation","invariants","program-analysis","static-analysis","verification"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seahorn.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-30T22:21:48.000Z","updated_at":"2025-03-15T20:53:00.000Z","dependencies_parsed_at":"2024-12-18T17:10:35.962Z","dependency_job_id":"e92d52fb-78cf-47b4-a754-8e28bdb52e1d","html_url":"https://github.com/seahorn/crab","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seahorn%2Fcrab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seahorn%2Fcrab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seahorn%2Fcrab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seahorn%2Fcrab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seahorn","download_url":"https://codeload.github.com/seahorn/crab/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254582904,"owners_count":22095518,"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":["abstract-interpretation","invariants","program-analysis","static-analysis","verification"],"created_at":"2024-11-28T09:29:46.680Z","updated_at":"2025-05-16T18:06:32.229Z","avatar_url":"https://github.com/seahorn.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Crab: A C++ Library for Building Program Static Analyses #\n\nCrab is a C++ library for building program static analyses based on\n[Abstract Interpretation](https://en.wikipedia.org/wiki/Abstract_interpretation). Crab provides\na rich set of abstract domains, Kleene-based fixpoint solvers, as well\nas different analyses such as dataflow, inter-procedural and\nbackward. The design of Crab is quite modular so that it is easy to\nplugin new abstract domains and solvers or build new analyses.\n\nCrab abstract domains can reason about memory contents, C-like arrays\nand numerical properties. Crab uses efficient implementations of\npopular numerical domains such as [Zones and\nOctagons](https://dl.acm.org/doi/abs/10.1145/3457885) and novel\ndomains to reason, for instance, about [symbolic\nterms](https://dl.acm.org/doi/10.1007/978-3-662-49122-5_4) (aka\nuninterpreted functions). Crab also implements popular non-relational\ndomains such as interval or congruences using [efficient environment\nmaps](https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.37.5452),\nand allows the combination of arbitrary domains via standard reduced\nproduct constructions. Crab also provides non-convex domains such as\nspecialized disjunctive intervals called\n[Boxes](https://link.springer.com/chapter/10.1007/978-3-642-15769-1_18)\nbased on linear decision diagrams and a more general value\npartitioning strategy that lifts an arbitrary domain to an\nover-approximation of its disjunction completion. In addition to these\ndomains, all developed by Crab authors, the Crab library integrates\npopular abstract domain libraries such as\n[Apron](https://github.com/antoinemine/apron),\n[Elina](http://elina.ethz.ch/), and [PPLite](https://github.com/ezaffanella/PPLite).\n\nCrab provides the state-of-the-art [interleaved fixpoint\nsolver](https://link.springer.com/chapter/10.1007/978-3-642-38856-9_4)\nthat uses Bourdoncle's [Weak Topological\nOrdering](https://link.springer.com/chapter/10.1007/BFb0039704) to\nselect the set of widening points. To mitigate precision losses during\nwidening, Crab implements some popular techniques such as widening\nwith thresholds and [lookahead\nwidening](https://link.springer.com/chapter/10.1007/11817963_41).\n\nCrab provides two different implementations of inter-procedural\nanalyses: a top-down with memoization inter-procedural analysis with\nsupport for recursive calls, and a hybrid of bottom-up + top down\nanalysis. Last but not least, Crab also implements a more experimental\nbackward analysis that can be used to compute necessary preconditions\nand/or reduce the number of false alarms.\n\nCrab does not analyze directly a mainstream programming language but\ninstead it analyzes its own CFG-based intermediate representation\ncalled\n[CrabIR](https://link.springer.com/chapter/10.1007/978-3-030-95561-8_8).\nCrabIR is three-address code and it is strongly typed. In CrabIR,\ncontrol flow is defined via non-deterministic goto instructions. Apart\nfrom standard boolean and arithmetic operations, CrabIR provides\nspecial assume and assert statements. The former can be used to refine\nthe control flow and the latter provides a simple mechanishm to check\nfor user-defined properties. In spite of its simple design, CrabIR is\nrich enough to represent languages such as\n[LLVM](https://github.com/seahorn/clam).\n\n**Crab is actively under development. If you find a bug please open an\nGithub issue. Pull requests with new features are very welcome.  The\navailable documentation can be found in our\n[wiki](https://github.com/seahorn/crab/wiki/Home). If you use this library please cite this [paper](https://dblp.uni-trier.de/rec/conf/vstte/GurfinkelN21.html).**\n\n\u003cbr/\u003e\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth\u003eWindows\u003c/th\u003e\u003cth\u003eUbuntu\u003c/th\u003e\u003cth\u003eOS X\u003c/th\u003e\u003cth\u003eCoverage\u003c/th\u003e\n  \u003c/tr\u003e\n    \u003ctd\u003eTBD\u003c/td\u003e\n    \u003ctd\u003e \u003ca href=\"https://github.com/seahorn/crab/actions\"\u003e\u003cimg src=\"https://github.com/seahorn/crab/workflows/CI/badge.svg?branch=master\" title=\"Ubuntu 18.04 LTS 64bit, g++-6.0\"/\u003e\u003c/a\u003e \u003c/td\u003e\n    \u003ctd\u003eTBD\u003c/td\u003e\n    \u003ctd\u003e\u003ca href=\"https://codecov.io/gh/seahorn/crab\"\u003e\u003cimg src=\"https://codecov.io/gh/seahorn/crab/branch/master/graph/badge.svg\" /\u003e\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n# Docker # \n\nA (nightly) pre-built version of Crab that runs all tests can be\nobtained using Docker:\n\n\n``` shell\ndocker pull seahorn/crab:bionic\ndocker run -v `pwd`:/host -it seahorn/crab:bionic\n```\n\n# Requirements #\n\nCrab is written in C++ and relies on the Boost library. The main\nrequirements are:\n\n- C++11 compiler \n- Boost \u003e= 1.65\n- GMP \n- MPFR (if `-DCRAB_USE_APRON=ON` or `-DCRAB_USE_ELINA=ON`)\n- FLINT (only if `-DCRAB_USE_PPLITE=ON`) \n\nIn linux, you can install requirements typing the commands:\n\n\tsudo apt-get install libboost-all-dev libboost-program-options-dev\n    sudo apt-get install libgmp-dev\n    sudo apt-get install libmpfr-dev\t\n\tsudo apt-get install libflint-dev\n\n# Compilation and Installation #\n\nTo install Crab, type:\n\n     1. mkdir build \u0026\u0026 cd build\n     2. cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR ../\n     3. cmake --build . --target install \n\nThe `tests` directory contains many examples of how to build programs\nwritten in CrabIR and compute invariants using different analyses and\nabstract domains. To compile these tests add option `-DCRAB_ENABLE_TESTS=ON` to line 2.\n\nand then, for instance, to run `test1`:\n\n    build/test-bin/test1\n    \n## Include third-party abstract domain libraries ##\n\nThe [Boxes](https://github.com/seahorn/ldd)/[Apron](https://github.com/antoinemine/apron)/[Elina](https://github.com/eth-sri/ELINA)/[PPLite](https://github.com/ezaffanella/PPLite) domains require third-party libraries. To avoid\nthe burden to users who are not interested in those domains, the\ninstallation of the libraries is optional.\n\n- If you want to use the Boxes domain then add `-DCRAB_USE_LDD=ON` option.\n\n- If you want to use the Apron library domains then add\n  `-DCRAB_USE_APRON=ON` option.\n\n- If you want to use the Elina library domains then add\n  `-DCRAB_USE_ELINA=ON` option.\n\n- If you want to use the PPLite library domains then add\n  `-DCRAB_USE_PPLITE=ON` option.\n\n\n**Important:** Apron and Elina are currently not compatible so you\ncannot enable `-DCRAB_USE_APRON=ON` and `-DCRAB_USE_ELINA=ON` at the same time. \n\t\nFor instance, to install Crab with Boxes and Apron, type:\n\n     1. mkdir build \u0026\u0026 cd build\n     2. cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DCRAB_USE_LDD=ON -DCRAB_USE_APRON=ON ../\n     3. cmake --build . --target ldd \u0026\u0026 cmake ..\n     4. cmake --build . --target apron \u0026\u0026 cmake ..\t\n     5. cmake --build . --target install \t\n\nLines 3 and 4 will download, compile and install the Boxes and Apron domains, respectively. Replace `apron` at line 4 with `elina` or `pplite` if you want to use Elina or PPLite instead. If you have already compiled and installed these libraries in your machine then skip commands at line 3 and 4 and add the following options at line 2.\n\n- For Apron: `-DAPRON_ROOT=$APRON_INSTALL_DIR`\n- For Elina: `-DELINA_ROOT=$ELINA_INSTALL_DIR`\n- For Boxes: `-DCUDD_ROOT=$CUDD_INSTALL_DIR -DLDD_ROOT=$LDD_INSTALL_DIR`\n- For PPLite: `-DPPLITE_ROOT=$PPLITE_INSTALL_DIR -DFLINT_ROOT=$FLINT_INSTALL_DIR`\n\n# Using Crab library in other C++ projects #\n\nTo include Crab in your C++ application you need to:\n\n- Include the C++ header files located at the\n`$INSTALL_DIR/crab/include`, and\n \n- Link your application with the Crab libraries installed in\n`$INSTALL_DIR/crab/lib`.\n\nIf you compile with Boxes/Apron/Elina/PPLite you need also to include\n`$INSTALL_DIR/EXT/include` and link with `$INSTALL_DIR/EXT/lib`\nwhere `EXT=apron|elina|ldd|pplite`.\n\n## CMake ## \n\nIf your project uses `cmake` then you just need to add in your project's `CMakeLists.txt`:\n\n```\nadd_subdirectory(crab)\ninclude_directories(${CRAB_INCLUDE_DIRS})\n```\n\nAnd then link your executable with `${CRAB_LIBS}`\n\n## Make ## \n\nIf your project uses `make`, read this\nsample [Makefile](https://github.com/seahorn/crab/blob/master/make/Makefile).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseahorn%2Fcrab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseahorn%2Fcrab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseahorn%2Fcrab/lists"}