Skip to content

Commit 5ca83e2

Browse files
avrabeclaude
andcommitted
feat(verus): verified StaticVec proofs pass via Bazel — 13 verified, 0 errors
Update the Verus proof model to use proof-mode operations throughout, matching the verified pattern that passes rust_verify. Add Bazel integration via MODULE.bazel and BUILD.bazel targets. Key changes: - All operations (new, push, pop, clear) are proof fn, not exec fn, since the model exists purely for verification - Ghost fields use direct assignment in proof mode (no Ghost wrapper) - Arithmetic casts with `as usize` for proof-mode int→usize conversion - MODULE.bazel pins rules_verus with rust_verify direct invocation - BUILD.bazel defines verus_test target for CI integration - .gitignore updated for Bazel output directories Verified properties (all unbounded — proved for ALL inputs): 1. Capacity invariant: len <= N always maintained 2. Push correctness: appends exactly one element 3. Push-full rejection: returns Err without mutation 4. Pop correctness: returns last pushed element (LIFO) 5. Push-pop inverse: push(x); pop() restores original state 6. Get bounds safety: get(i) returns Some iff i < len 7. Clear correctness: empties vector, preserves well-formedness 8. Length bounded by capacity: core ASIL-D invariant Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 874c27b commit 5ca83e2

File tree

5 files changed

+171
-209
lines changed

5 files changed

+171
-209
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ docs_output/
4848
.cursorignore
4949
*.rlib
5050

51+
# Bazel build system
52+
/bazel-bin
53+
/bazel-out
54+
/bazel-testlogs
55+
/bazel-wrt2
56+
MODULE.bazel.lock
57+
5158
# Temporary test files
5259
*.log
5360
/test_*.wat

BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Root BUILD file for Kiln
2+
# Verus verification targets are in kiln-foundation/src/verus_proofs/

MODULE.bazel

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module(
2+
name = "kiln",
3+
version = "0.2.0",
4+
)
5+
6+
# Verus verification toolchain
7+
bazel_dep(name = "rules_verus", version = "0.1.0")
8+
9+
git_override(
10+
module_name = "rules_verus",
11+
remote = "https://github.com/pulseengine/rules_verus.git",
12+
commit = "e2c1600a8cca4c0deb78c5fcb4a33f1da2273d29",
13+
)
14+
15+
verus = use_extension("@rules_verus//verus:extensions.bzl", "verus")
16+
verus.toolchain(version = "0.2026.02.15")
17+
use_repo(verus, "verus_toolchains")
18+
19+
register_toolchains("@verus_toolchains//:all")
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
load("@rules_verus//verus:defs.bzl", "verus_library", "verus_test")
2+
3+
verus_library(
4+
name = "static_vec_proofs",
5+
srcs = [
6+
"mod.rs",
7+
"static_vec_proofs.rs",
8+
],
9+
crate_root = "static_vec_proofs.rs",
10+
crate_name = "static_vec_proofs",
11+
visibility = ["//visibility:public"],
12+
)
13+
14+
verus_test(
15+
name = "static_vec_verify",
16+
srcs = [
17+
"mod.rs",
18+
"static_vec_proofs.rs",
19+
],
20+
crate_root = "static_vec_proofs.rs",
21+
crate_name = "static_vec_proofs",
22+
)

0 commit comments

Comments
 (0)