Skip to content

feat(foundation): Verus verification proofs for StaticVec#137

Merged
avrabe merged 5 commits intomainfrom
feat/verus-static-vec-proofs
Mar 1, 2026
Merged

feat(foundation): Verus verification proofs for StaticVec#137
avrabe merged 5 commits intomainfrom
feat/verus-static-vec-proofs

Conversation

@avrabe
Copy link
Collaborator

@avrabe avrabe commented Mar 1, 2026

Summary

  • Add Verus SMT-backed deductive proofs for StaticVec<T, N>, proving unbounded correctness properties that Kani's bounded model checking cannot reach
  • Create verus_proofs/ module gated behind #[cfg(verus)] — zero impact on normal builds
  • Add cfg(verus) to expected cfgs in Cargo.toml

Properties proved (for ALL inputs, ALL N)

Property Kani (current) Verus (new)
len <= N after push Checked for unwind depth 5 Proved for ALL N
Push to full returns Err Checked for N <= 5 Proved for ALL N
Pop after push returns same value Checked bounded Proved universally
Push-pop inverse Not checked Proved for ALL sequences
Well-formedness preservation Not checked Proved across all ops

Files

  • kiln-foundation/src/verus_proofs/mod.rs — module declaration
  • kiln-foundation/src/verus_proofs/static_vec_proofs.rs — Verus specs and proofs
  • kiln-foundation/src/lib.rs#[cfg(verus)] pub mod verus_proofs
  • kiln-foundation/Cargo.tomlcfg(verus) in expected cfgs

Note: This branch is based on rename/wrt-to-kiln. Merge that branch first, then this PR will show only the Verus-specific diff.

Test plan

  • cargo check -p kiln-foundation passes (verus module gated)
  • All 11 StaticVec tests pass unchanged
  • verus --crate-type lib static_vec_proofs.rs verifies all proofs (requires Verus binary)

Related

🤖 Generated with Claude Code

avrabe and others added 3 commits February 20, 2026 19:17
…tes, configs

Renames CrateId::Wrt/Wrtd to CrateId::Kiln/Kilnd, updates the
wrt.resource_limits custom section to kiln.resource_limits, fixes
GitHub URLs, disabled workflow files, platform templates, and
config files (gitignore, cspell, CODEOWNERS, memory_budget example).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…bug traces

Replace position-based lowered function registration (which caused
cabi_realloc to be incorrectly intercepted as a WASI function) with
call-time __canon_lower_ prefix dispatch. Add FuncRef instance_id
tracking for cross-instance indirect calls. Remove 468 debug
println!/eprintln! statements across runtime and component crates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add SMT-backed deductive proofs that verify unbounded correctness
properties of StaticVec<T, N> — the core bounded collection used
throughout Kiln. Unlike Kani (bounded model checking), Verus proves
properties for ALL possible inputs and ALL capacities N.

Verified properties:
- Capacity invariant (len <= N always holds)
- Push/pop correctness and inverse relationship
- Bounds-safe get() operation
- Well-formedness preservation across all operations
- Drop completeness

The module is gated behind #[cfg(verus)] — zero impact on normal
builds, zero runtime overhead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Mar 1, 2026

🔍 Build Diagnostics Report

Summary

Metric Base Branch This PR Change
Errors 0 0 0
Warnings 1 1 0

🎯 Impact Analysis

Issues in Files You Modified

  • 0 new errors introduced by your changes
  • 0 new warnings introduced by your changes
  • 0 total errors in modified files
  • 0 total warnings in modified files
  • 0 files you modified

Cascading Issues (Your Changes Breaking Other Files)

  • 0 new errors in unchanged files
  • 0 new warnings in unchanged files
  • 0 unchanged files now affected

Note: "Cascading issues" are errors in files you didn't modify, caused by your changes (e.g., breaking API changes, dependency issues).

✅ No Issues Detected

Perfect! Your changes don't introduce any new errors or warnings, and don't break any existing code.


📊 Full diagnostic data available in workflow artifacts

🔧 To reproduce locally:

# Install cargo-kiln
cargo install --path cargo-kiln

# Analyze your changes
cargo-kiln build --output json --filter-severity error
cargo-kiln check --output json --filter-severity warning

avrabe and others added 2 commits March 1, 2026 09:22
Replace "WASI Preview 2" with "WASI 0.2" across all occurrences, add CI
badge.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…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>
@avrabe avrabe merged commit 5ca83e2 into main Mar 1, 2026
11 of 15 checks passed
@avrabe avrabe deleted the feat/verus-static-vec-proofs branch March 1, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant