# BRiCk

> Prove concurrent C++ code correct in the Rocq proof assistant, using a separation logic for C++ built on Iris.

- Kind: toolchain
- Verifies: C++ (BRiCk reasons about Clang's syntax tree, and about templates only after they are instantiated.)
- Effort: Interactive — You write proofs step by step in a proof assistant.
- Stage: 0 (Research)
- Trust: Checker strong, Semantics partial, Frontend partial, Binary gap weak, Escape hatches partial
- Licence: open-source, LGPL-2.1 with the BedRock network-use addendum (LICENSE-BedRock)
- Latest release: main@5d7dacc (2026-11-26) https://github.com/SkyLabsAI/BRiCk/commits/main
- Links: [homepage](https://skylabsai.github.io/BRiCk/), [repo](https://github.com/SkyLabsAI/BRiCk), [docs](https://skylabsai.github.io/BRiCk/features.html), [tutorial](https://skylabsai.github.io/auto-docs/)

## Use it if
- You need full functional-correctness proofs of low-level or concurrent C++ (such as kernels or lock-free code).
- You can write Rocq proofs and separation-logic specifications, or work with people who can.

## Look elsewhere if
- Your code uses exceptions, coroutines, virtual inheritance or relaxed atomics; BRiCk does not cover them.
- You need a fully open toolchain; the proof automation that makes BRiCk practical on real code needs a commercial or academic license.
- You want push-button checking; every function needs a hand-written specification and a Rocq proof.

## How it works (pipeline)

| Step | Component | Assurance | Note |
|---|---|---|---|
| frontend | cpp2v | trusted | Uses Clang to parse and type-check C++, then prints Clang's syntax tree as Rocq terms. It is not verified. Generate the tree with the same Clang flags and target as your build. |
| semantics | BRiCk C++ program logic (`brick-cpp`) | trusted | The meaning of C++ is stated as about 450 Rocq axioms in weakest-precondition style. |
| automation | SkyLabs AI proof automation | checked | Builds proofs that Rocq then checks. Available under commercial and academic licenses, not in the public repository. |
| checker | Rocq (`rocq`) | trusted |  |
| compiler | Clang (or another C++ compiler) | trusted | Not verified. BRiCk assumes the compiler is correct, stated as axioms such as code_at_ok. |

## Trust

| Axis | Level | Summary | Note |
|---|---|---|---|
| Checker | Strong (green) | Rocq's kernel checks every proof, including those the automation builds. |  [source](https://rocq-prover.org/) |
| Semantics | Partial (amber) | C++ is modeled by BRiCk's own axioms; no published validation against compilers. | About 450 axioms. A model of parts of them still has 8 unproved (Admitted) lemmas. Documented caveats: calls are assumed not to throw, and the code Clang generates for defaulted functions is taken as their meaning. [source](https://skylabsai.github.io/BRiCk/features.html) |
| Frontend | Partial (amber) | cpp2v prints Clang's syntax tree into Rocq; cpp2v itself is not verified. |  [source](https://github.com/SkyLabsAI/BRiCk/tree/main/rocq-skylabs-cpp2v) |
| Binary gap | Weak (red) | An unverified compiler builds the binary; BRiCk assumes it is correct. | BRiCk connects C++ specifications to machine code only through axioms (code_at_ok and similar) that assume the compiled code behaves as the C++ rules say. [source](https://skylabsai.github.io/BRiCk/machine.html) |
| Escape hatches | Partial (amber) | Rocq Admitted and Axiom; Print Assumptions lists them, next to BRiCk's own axioms. | Real proofs use them: BlueRock's NOVA proofs assume the iRC11 rules as axioms and admit an open item about garbage collection. [source](https://bluerocksec.gitlab.io/formal-methods/blogs/2026-03-31-NOVA-relaxed-memory/) |

## What it can prove

| Property | Support |
|---|---|
| No undefined behavior | Supported — A proof shows the code is safe, which rules out undefined behavior, for the supported part of C++. A construct BRiCk does not support makes the proof get stuck, so it cannot be proved by mistake. ([source](https://skylabsai.github.io/BRiCk/evaluation.html)) |
| Functional correctness | Supported — Specifications are separation-logic pre- and postconditions; BlueRock's NOVA proofs go up to concurrent functional correctness. ([source](https://bluerocksec.gitlab.io/formal-methods/blogs/2025-11-18-NOVA-proof-spec/)) |
| Equivalence | Not supported — The logic reasons about one program at a time. The documentation describes no way to prove two programs equivalent. ([source](https://skylabsai.github.io/BRiCk/evaluation.html)) |
| Information flow | Not supported — The documentation describes no support for information-flow or constant-time proofs. ([source](https://skylabsai.github.io/BRiCk/features.html)) |
| Concurrency | Partial — Built for concurrent C++, but the logic requires every atomic access to be sequentially consistent. Weaker memory orders need extra axioms (BlueRock's NOVA proofs add the iRC11 relaxed-memory logic as axioms). ([source](https://skylabsai.github.io/BRiCk/features.html)) |
| Termination and liveness | Not supported — The rules are weakest liberal preconditions: they say what holds if the code finishes, not that it finishes. ([source](https://skylabsai.github.io/BRiCk/evaluation.html)) |

## Common features

| Feature | Support |
|---|---|
| Machine integers | Supported — All integer types are modeled by size and signedness; the sizes come from the Clang target used to generate the syntax tree. ([source](https://skylabsai.github.io/BRiCk/features.html)) |
| Floating point | Partial — IEEE-754 half, single, double and quad precision are supported (semantics from the Flocq library); x87 long double is not. ([source](https://skylabsai.github.io/BRiCk/features.html)) |
| Heap and pointers | Supported — new, delete, pointers and pointer provenance are modeled; reinterpret_cast has no rule yet. ([source](https://skylabsai.github.io/BRiCk/pointers.html)) |
| Arrays and buffers | Partial — Arrays are supported, but implicit copy assignment of byte arrays gets stuck. Variable-length arrays and flexible array members (compiler extensions) are not supported. ([source](https://skylabsai.github.io/BRiCk/features.html)) |
| Loops | Supported — You write loop invariants by hand. ([source](https://skylabsai.github.io/auto-docs/docs/control_flow/loop/)) |
| Recursion | Unknown — The documentation we found does not discuss recursive functions. |
| Higher-order code | Partial — Calls through function pointers are supported; calls through member function pointers have no rule. ([source](https://skylabsai.github.io/BRiCk/features.html)) |
| Threads and shared memory | Partial — Threads and atomics are supported, but every atomic access must be sequentially consistent. Compare-exchange works on integers, not pointers. ([source](https://skylabsai.github.io/BRiCk/features.html)) |
| I/O and system calls | Partial — No built-in model of I/O or system calls. You give specifications for the outside functions you call; brick-libcpp has some, for example for parts of iostream and pthread mutexes. ([source](https://github.com/SkyLabsAI/brick-libcpp)) |
| Standard library | Partial — brick-libcpp specifies parts of the standard library (mutexes, atomics, vector, string and others). It is work in progress, and building it needs SkyLabs AI's licensed automation. ([source](https://github.com/SkyLabsAI/brick-libcpp)) |

## C++-specific features

| Feature | Support |
|---|---|
| Classes and virtual calls | Partial — Classes, inheritance and virtual calls are supported. Virtual inheritance is not; classes with bit-fields are opaque; member pointer operators have no rule; dynamic_cast and typeid are partial. ([source](https://skylabsai.github.io/BRiCk/features.html)) |
| Templates | Partial — Only instantiated templates can be verified, one instantiation at a time. Template parameter packs and unresolved concepts are not supported. ([source](https://skylabsai.github.io/BRiCk/features.html)) |
| Constructors and destructors | Partial — Constructors, destructors and implicit destruction are modeled. Lifetime-extended temporaries are not supported, and initialization of globals and function-local statics is not covered. ([source](https://skylabsai.github.io/BRiCk/features.html)) |
| Exceptions | Not supported — throw and try are not supported, and every function call is assumed not to throw. ([source](https://skylabsai.github.io/BRiCk/features.html)) |
| Standard library (STL) | Partial — Specifications for parts of the standard library are in brick-libcpp, which is work in progress. ([source](https://github.com/SkyLabsAI/brick-libcpp)) |
| Lambdas | Partial — cpp2v translates lambdas, but the documentation does not describe their rules, and lambda types at global scope are dropped as unsupported. ([source](https://github.com/SkyLabsAI/BRiCk/blob/main/CHANGES.md)) |

## Stage

**Stage 0: Research.**

| Stage | Criterion | Met | Evidence / note |
|---|---|---|---|
| 0 | Publicly available | yes | [evidence](https://github.com/SkyLabsAI/BRiCk) |
| 0 | At least one published verification uses it | yes | [evidence](https://bluerocksec.gitlab.io/formal-methods/tech_reports/specifying-and-verifying-the-nova-microhypervisor-in-concurrent-separation-logic/) Verification of the NOVA microhypervisor (RocqPL 2026). |
| 1 | Released or updated in the last 12 months | yes | [evidence](https://github.com/SkyLabsAI/BRiCk/commits/main) Latest release: main@5d7dacc, 2026-11-26. |
| 1 | Installs and runs on current platforms | yes | [evidence](https://github.com/SkyLabsAI/BRiCk/tree/main/rocq-skylabs-cpp2v) The open-source logic and cpp2v build with dune and LLVM 20 to 23. The proof automation is not publicly installable. |
| 1 | User documentation or tutorial | yes | [evidence](https://skylabsai.github.io/auto-docs/) Language-support pages for the logic, and tutorials for the licensed automation. |
| 1 | Used by a group other than its authors | unknown | All published uses we found are by BRiCk's authors (BlueRock Security, SkyLabs AI). The one outside group, at the University of Illinois Chicago, published jointly with them (arXiv 2601.22557). |
| 2 | Verified code in production at two or more independent organizations | no | None recorded. |
| 2 | Checker axis is not red | yes |  |
| 2 | Semantics axis is not red | yes |  |
| 2 | Public channel for soundness bugs | yes | [evidence](https://github.com/SkyLabsAI/BRiCk/issues?q=label%3Asoundness) Public GitHub issues; known soundness bugs and their fixes carry the soundness label. |

Missing for Stage 1: Used by a group other than its authors.

## Projects
- [NOVA microhypervisor (BlueRock Security)](https://bluerocksec.gitlab.io/formal-methods/tech_reports/specifying-and-verifying-the-nova-microhypervisor-in-concurrent-separation-logic/) — Specification and ongoing verification of the hypercalls and kernel data structures.
- [Developing with Formal Methods at BedRock Systems (IEEE S&P 2022)](https://bluerocksec.gitlab.io/formal-methods/tech_reports/developing-with-formal-methods-at-bedrock-systems/)
- [Recursive mutexes in separation logic](https://arxiv.org/abs/2601.22557) — Part of an effort to verify the C++ standard library's concurrency parts.
- [brick-libcpp (C++ standard library specifications)](https://github.com/SkyLabsAI/brick-libcpp)

## Sources
- [BRiCk repository](https://github.com/SkyLabsAI/BRiCk)
- [The BRiCk C++ Program Logic (documentation)](https://skylabsai.github.io/BRiCk/)
- [BRiCk language support](https://skylabsai.github.io/BRiCk/features.html)
- [BRiCk assembly interoperation and compiler correctness](https://skylabsai.github.io/BRiCk/machine.html)
- [BRiCk evaluation rules](https://skylabsai.github.io/BRiCk/evaluation.html)
- [BRiCk changelog](https://github.com/SkyLabsAI/BRiCk/blob/main/CHANGES.md)
- [SkyLabs AI automation setup (licensing)](https://skylabsai.github.io/auto-docs/setup/)
- [BlueRock Security formal methods](https://bluerocksec.gitlab.io/formal-methods/)
- [NOVA is getting relaxed-memory ready](https://bluerocksec.gitlab.io/formal-methods/blogs/2026-03-31-NOVA-relaxed-memory/)
- [brick-libcpp](https://github.com/SkyLabsAI/brick-libcpp)
- [Recursive Mutexes in Separation Logic](https://arxiv.org/abs/2601.22557)

---
Last checked 2026-11-26. Data: [JSON](/toolchains/brick.json) · Page: [HTML](/toolchains/brick/) · Methodology v0.1: [/methodology/](/methodology/) · Corrections: [/contribute/](/contribute/)
