{"id":47115446,"url":"https://github.com/pulseengine/rules_rocq_rust","last_synced_at":"2026-03-12T18:58:26.495Z","repository":{"id":331883450,"uuid":"1132149928","full_name":"pulseengine/rules_rocq_rust","owner":"pulseengine","description":"Bazel rules for Rocq theorem proving and rocq-of-rust integration with hermetic Nix toolchains","archived":false,"fork":false,"pushed_at":"2026-03-01T11:39:19.000Z","size":317,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-01T14:57:23.570Z","etag":null,"topics":["bazel","formal-verification","pulseengine","rocq","rust","theorem-proving","toolchain"],"latest_commit_sha":null,"homepage":"https://rules-rocq-rust.pulseengine.eu/","language":"Starlark","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pulseengine.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-11T12:30:35.000Z","updated_at":"2026-03-01T12:58:34.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/pulseengine/rules_rocq_rust","commit_stats":null,"previous_names":["pulseengine/rules_rocq_rust"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/pulseengine/rules_rocq_rust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pulseengine%2Frules_rocq_rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pulseengine%2Frules_rocq_rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pulseengine%2Frules_rocq_rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pulseengine%2Frules_rocq_rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pulseengine","download_url":"https://codeload.github.com/pulseengine/rules_rocq_rust/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pulseengine%2Frules_rocq_rust/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30439122,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T14:34:45.044Z","status":"ssl_error","status_checked_at":"2026-03-12T14:09:33.793Z","response_time":114,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["bazel","formal-verification","pulseengine","rocq","rust","theorem-proving","toolchain"],"created_at":"2026-03-12T18:58:25.909Z","updated_at":"2026-03-12T18:58:26.490Z","avatar_url":"https://github.com/pulseengine.png","language":"Starlark","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# rules_rocq_rust\n\n\u003csup\u003eBazel rules for Rocq theorem proving and Rust formal verification\u003c/sup\u003e\n\n\u0026nbsp;\n\n![Bazel](https://img.shields.io/badge/Bazel-43A047?style=flat-square\u0026logo=bazel\u0026logoColor=white\u0026labelColor=1a1b27)\n![Formally Verified](https://img.shields.io/badge/Formally_Verified-00C853?style=flat-square\u0026logoColor=white\u0026labelColor=1a1b27)\n![License: Apache-2.0](https://img.shields.io/badge/License-Apache--2.0-blue?style=flat-square\u0026labelColor=1a1b27)\n\n\u003c/div\u003e\n\n\u0026nbsp;\n\nBazel rules for Rocq theorem proving and Rust formal verification with hermetic toolchain support via [Nix](https://nixos.org/).\n\n\u003e [!NOTE]\n\u003e Part of the PulseEngine toolchain. Powers the mechanized proofs in Meld, Loom, and PulseEngine verification infrastructure.\n\n## Features\n\n- **Rust to Rocq to Proofs**: Complete pipeline from Rust code to verified proofs\n- **rocq-of-rust Integration**: Translate Rust to Rocq via [rocq-of-rust](https://github.com/formal-land/rocq-of-rust)\n- **Hermetic Toolchains**: Rocq 9.0, coqutil, Hammer, smpl via nixpkgs\n- **Cross-Platform**: Linux, macOS (Intel and Apple Silicon)\n- **Bazel 8 bzlmod**: Modern module system support\n\n## Prerequisites\n\n### Nix (Required)\n\n```bash\n# macOS\nsh \u003c(curl -L https://nixos.org/nix/install)\n. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh\n\n# Linux\nsh \u003c(curl -L https://nixos.org/nix/install) --daemon\n```\n\n### Rust Nightly (Linux only)\n\nOn Linux, rocq-of-rust requires Rust nightly with rustc internals:\n\n```bash\nrustup toolchain install nightly-2024-12-07\nrustup component add rustc-dev rust-src --toolchain nightly-2024-12-07\nexport LIBRARY_PATH=\"$(rustc +nightly-2024-12-07 --print sysroot)/lib:$LIBRARY_PATH\"\n```\n\nOn macOS, Nix provides the complete Rust toolchain automatically.\n\n## Quick Start\n\n### 1. Add to MODULE.bazel\n\n```starlark\nbazel_dep(name = \"rules_rocq_rust\", version = \"0.1.0\")\n\ngit_override(\n    module_name = \"rules_rocq_rust\",\n    remote = \"https://github.com/pulseengine/rules_rocq_rust.git\",\n    commit = \"\u003clatest-commit\u003e\",\n)\n\n# Configure Rocq toolchain\nrocq = use_extension(\"@rules_rocq_rust//rocq:extensions.bzl\", \"rocq\")\nrocq.toolchain()\nuse_repo(rocq, \"rocq_toolchains\", \"rocq_stdlib\", \"rocq_coqutil\", \"rocq_hammer\", \"rocq_hammer_tactics\", \"rocq_smpl\")\nregister_toolchains(\"@rocq_toolchains//:all\")\n\n# Configure rocq-of-rust\nrocq_of_rust = use_extension(\"@rules_rocq_rust//coq_of_rust:extensions.bzl\", \"rocq_of_rust\")\nrocq_of_rust.toolchain(use_real_library = True)\nuse_repo(rocq_of_rust, \"rocq_of_rust_toolchains\", \"rocq_of_rust_source\")\nregister_toolchains(\"@rocq_of_rust_toolchains//:all\")\n```\n\n### 2. Create a Rust file to verify\n\n```rust\n// point.rs\n#[derive(Debug, Clone, PartialEq, Eq)]\npub struct Point { pub x: i32, pub y: i32 }\n\nimpl Point {\n    pub fn origin() -\u003e Self { Point { x: 0, y: 0 } }\n    pub fn new(x: i32, y: i32) -\u003e Self { Point { x, y } }\n}\n```\n\n### 3. Add BUILD.bazel\n\n```starlark\nload(\"@rules_rocq_rust//coq_of_rust:defs.bzl\", \"rocq_rust_verified_library\")\nload(\"@rules_rocq_rust//rocq:defs.bzl\", \"rocq_library\")\n\nrocq_rust_verified_library(\n    name = \"point_verified\",\n    rust_sources = [\"point.rs\"],\n    extra_flags = [\"-impredicative-set\"],\n)\n\nrocq_library(\n    name = \"point_proofs\",\n    srcs = [\"point_proofs.v\"],\n    deps = [\":point_verified\"],\n    extra_flags = [\"-impredicative-set\"],\n)\n```\n\n### 4. Build and verify\n\n```bash\nbazel build //:point_proofs\n```\n\n## API Reference\n\n### rocq_library\n\nCompiles Rocq `.v` files to `.vo`.\n\n| Attribute | Description |\n|-----------|-------------|\n| `srcs` | Rocq source files (`.v`) |\n| `deps` | Dependencies on other `rocq_library` targets |\n| `include_path` | Logical path for this library (default: package path) |\n| `extra_flags` | Extra flags passed to coqc |\n\n### coq_of_rust_library\n\nTranslates Rust source files to Rocq.\n\n| Attribute | Description |\n|-----------|-------------|\n| `rust_sources` | Rust source files to translate |\n| `edition` | Rust edition (default: \"2021\") |\n\n### rocq_rust_verified_library\n\nConvenience macro: translates Rust to Rocq and compiles.\n\n### rocq_proof_test\n\nTest rule that verifies proofs compile successfully.\n\n## Toolchain Contents\n\n| Component | Description |\n|-----------|-------------|\n| Rocq 9.0.1 | Core theorem prover |\n| coqutil | Utility library |\n| Hammer | Automated proof tactics |\n| smpl | Simplification tactics |\n| rocq-of-rust | Rust-to-Rocq translator (pinned version) |\n\n## Supported Platforms\n\n| Platform | Status |\n|----------|--------|\n| Linux x86_64 | Supported |\n| Linux aarch64 | Supported |\n| macOS x86_64 | Supported |\n| macOS aarch64 | Supported |\n\n## Troubleshooting\n\n### \"unable to find library -lLLVM-19-rust-*\" (Linux)\n\n```bash\nexport LIBRARY_PATH=\"$(rustc +nightly-2024-12-07 --print sysroot)/lib:$LIBRARY_PATH\"\n```\n\n### \"rustc-dev component not found\"\n\n```bash\nrustup component add rustc-dev rust-src --toolchain nightly-2024-12-07\n```\n\n## Example\n\nSee `examples/rust_to_rocq/` for a complete working example:\n\n```bash\nbazel build //examples/rust_to_rocq:point_proofs\nbazel build //examples/rust_to_rocq:advanced_verified\nbazel test //examples/rust_to_rocq:point_proofs_test\n```\n\n## License\n\nApache-2.0 \u0026mdash; see [LICENSE](LICENSE).\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n\u003csub\u003ePart of \u003ca href=\"https://github.com/pulseengine\"\u003ePulseEngine\u003c/a\u003e \u0026mdash; formally verified WebAssembly toolchain for safety-critical systems\u003c/sub\u003e\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpulseengine%2Frules_rocq_rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpulseengine%2Frules_rocq_rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpulseengine%2Frules_rocq_rust/lists"}