{"id":27214584,"url":"https://github.com/rocq-community/bits","last_synced_at":"2025-04-10T03:24:28.659Z","repository":{"id":39971824,"uuid":"43183138","full_name":"rocq-community/bits","owner":"rocq-community","description":"A formalization of bitset operations in Coq and the corresponding axiomatization and extraction to OCaml native integers [maintainer=@anton-trunov]","archived":false,"fork":false,"pushed_at":"2025-02-14T08:18:04.000Z","size":193,"stargazers_count":23,"open_issues_count":3,"forks_count":7,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-29T14:37:23.756Z","etag":null,"topics":["bitset","coq","coq-extraction","coq-library","mathcomp","paper-artifacts","ssreflect"],"latest_commit_sha":null,"homepage":"","language":"Coq","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/rocq-community.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":"2015-09-26T00:45:41.000Z","updated_at":"2025-03-04T00:30:08.000Z","dependencies_parsed_at":"2022-08-20T08:11:13.339Z","dependency_job_id":"e69c0de9-41c8-4eca-b6cd-5fdbe9703b22","html_url":"https://github.com/rocq-community/bits","commit_stats":null,"previous_names":["rocq-community/bits","coq-community/bits"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocq-community%2Fbits","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocq-community%2Fbits/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocq-community%2Fbits/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocq-community%2Fbits/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rocq-community","download_url":"https://codeload.github.com/rocq-community/bits/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248149598,"owners_count":21055790,"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":["bitset","coq","coq-extraction","coq-library","mathcomp","paper-artifacts","ssreflect"],"created_at":"2025-04-10T03:24:28.098Z","updated_at":"2025-04-10T03:24:28.632Z","avatar_url":"https://github.com/rocq-community.png","language":"Coq","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!---\nThis file was generated from `meta.yml`, please do not edit manually.\nFollow the instructions on https://github.com/coq-community/templates to regenerate.\n---\u003e\n# Bits\n\n[![Docker CI][docker-action-shield]][docker-action-link]\n[![Contributing][contributing-shield]][contributing-link]\n[![Code of Conduct][conduct-shield]][conduct-link]\n[![Zulip][zulip-shield]][zulip-link]\n[![DOI][doi-shield]][doi-link]\n\n[docker-action-shield]: https://github.com/coq-community/bits/actions/workflows/docker-action.yml/badge.svg?branch=master\n[docker-action-link]: https://github.com/coq-community/bits/actions/workflows/docker-action.yml\n\n[contributing-shield]: https://img.shields.io/badge/contributions-welcome-%23f7931e.svg\n[contributing-link]: https://github.com/coq-community/manifesto/blob/master/CONTRIBUTING.md\n\n[conduct-shield]: https://img.shields.io/badge/%E2%9D%A4-code%20of%20conduct-%23f15a24.svg\n[conduct-link]: https://github.com/coq-community/manifesto/blob/master/CODE_OF_CONDUCT.md\n\n[zulip-shield]: https://img.shields.io/badge/chat-on%20zulip-%23c1272d.svg\n[zulip-link]: https://coq.zulipchat.com/#narrow/stream/237663-coq-community-devs.20.26.20users\n\n\n[doi-shield]: https://zenodo.org/badge/DOI/10.1007/978-3-319-29604-3_2.svg\n[doi-link]: https://doi.org/10.1007/978-3-319-29604-3_2\n\nA formalization of bitset operations in Coq with a corresponding\naxiomatization and extraction to OCaml native integers.\n\n## Meta\n\n- Author(s):\n  - Andrew Kennedy (initial)\n  - Arthur Blot (initial)\n  - Pierre-Évariste Dagand (initial)\n- Coq-community maintainer(s):\n  - Anton Trunov ([**@anton-trunov**](https://github.com/anton-trunov))\n- License: [Apache License 2.0](LICENSE)\n- Compatible Coq versions: 8.16 or later (use releases for other Coq versions)\n- Additional dependencies:\n  - OCamlbuild\n  - [MathComp](https://math-comp.github.io) 2.0 or later (`algebra` suffices)\n  - [MathComp Algebra Tactics](https://github.com/math-comp/algebra-tactics)\n- Coq namespace: `Bits`\n- Related publication(s):\n  - [From Sets to Bits in Coq](https://hal.archives-ouvertes.fr/hal-01251943/document) doi:[10.1007/978-3-319-29604-3_2](https://doi.org/10.1007/978-3-319-29604-3_2)\n  - [Coq: The world's best macro assembler?](https://www.microsoft.com/en-us/research/wp-content/uploads/2016/12/coqasm.pdf) doi:[10.1145/2505879.2505897](https://doi.org/10.1145/2505879.2505897)\n\n## Building and installation instructions\n\nThe easiest way to install the latest released version of Bits\nis via [OPAM](https://opam.ocaml.org/doc/Install.html):\n\n```shell\nopam repo add coq-released https://coq.inria.fr/opam/released\nopam install coq-bits\n```\n\nTo instead build and install manually, do:\n\n``` shell\ngit clone https://github.com/coq-community/bits.git\ncd bits\nmake   # or make -j \u003cnumber-of-cores-on-your-machine\u003e \nmake install\n```\n\n\n## Origins\n\nThis library has been extracted from Andrew Kennedy et al. ['x86proved' fork][xprovedkennedy].\nThis link presently redirects to https://github.com/nbenton/x86proved repository.\n\nThe main paper for this project is [Coq: The world’s best macro assembler?][coqasm].\n\n## Using the library\n\nTo import the main library, do:\n```coq\nFrom Bits Require Import bits.\n```\n\nAn axiomatic interface supporting efficient extraction to OCaml can be\nloaded with:\n```coq\nFrom Bits Require Import extraction.axioms8.  (* or 16 or 32 *)\n```\n\n## Organization\n\nThis library, briefly described in the paper [From Sets to Bits in Coq][bitstosets],\nhelps to model operations on bitsets. It's a formalization of\nlogical and arithmetic operations on bit vectors. A bit vector is defined as an\nSSReflect tuple of bits, i.e. a list of booleans of fixed (word) size.\n\nThe key abstractions offered by this library are as follows:\n- `BITS n : Type` - vector of `n` bits\n- `getBit bs k` - test the `k`-th bit of `bs` bit vector\n- `andB xs ys` - bitwise \"and\"\n- `orB xs ys` - bitwise \"or\"\n- `xorB xs ys` - bitwise \"xor\"\n- `invB xs` - bitwise negation\n- `shrB xs k` - right shift by `k` bits\n- `shlB xs k` - left shift by `k` bits\n\nThe library characterizes the interactions between these elementary operations\nand provides embeddings to and from the additive group ℤ/(2ⁿ)ℤ.\n\nThe overall structure of the code is as follows:\n- [src/ssrextra](src/ssrextra): complements to the [Mathcomp][mathcomp] library\n- [src/spec](src/spec): specification of bit vectors\n- [src/extraction](src/extraction): axiomatic interface to OCaml, for extraction\n\nFor a specific formalization developed in a file `A.v`, one will find its\nassociated properties in the file `A/properties.v`. For example, bit-level\noperations are defined in [src/spec/operations.v](src/spec/operations.v),\ntherefore their properties can be found in\n[src/spec/operations/properties.v](src/spec/operations/properties.v).\n\n## Verification axioms\n\nAxioms can be verified for 8-bit and 16-bit (using only extracted code) using\nthe following command:\n```shell\nmake verify\n```\n\nFor 8bit, the verification process should finish in few seconds. However\nfor 16-bit, depending on your computer speed, it could take more than 6\nhours.\n\n[bitstosets]: https://hal.archives-ouvertes.fr/hal-01251943/document\n[coqasm]: https://www.microsoft.com/en-us/research/wp-content/uploads/2016/12/coqasm.pdf\n[xprovedkennedy]: https://x86proved.codeplex.com/SourceControl/network/forks/andrewjkennedy/x86proved/latest#src/bits.v\n[mathcomp]: https://github.com/math-comp/math-comp\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocq-community%2Fbits","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frocq-community%2Fbits","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocq-community%2Fbits/lists"}