Skip to content

Challenge 4: Kani contracts for BTreeMap node - #641

Open
sankalpsthakur wants to merge 12 commits into
model-checking:mainfrom
sankalpsthakur:challenge/04-btree-node
Open

Challenge 4: Kani contracts for BTreeMap node#641
sankalpsthakur wants to merge 12 commits into
model-checking:mainfrom
sankalpsthakur:challenge/04-btree-node

Conversation

@sankalpsthakur

Copy link
Copy Markdown

Summary

Kani safety contracts and proof harnesses for this challenge. Runtime stdlib logic is unchanged; annotations are cfg(kani) / contract attributes.

Memory-safety contracts on btree::node.

Validation

  • Local worktree on challenge/04-btree-node
  • Kani CI on this PR is the authoritative run (scripts/run-kani.sh)

Fixes#77

AI/LLM disclosure

  • AI coding tools (including Grok and/or Codex agent-assisted editing) were used to help draft or modify code and this PR description.
  • I reviewed the complete change, understand the reasoning, and take responsibility for the contracts and harnesses.
  • This submission is original work of authorship under the project contributor terms; AI output was not pasted unreviewed.

Kani contracts and harnesses for verify-rust-std challenge.
Fixesrust-lang#77
@sankalpsthakur
sankalpsthakur requested a review from a team as a code ownerAugust 20, 2026 12:08
Drop the duplicate super imports that failed rustc fmt. Build
symbolic leaves without nested Handle::new_kv so the contract
proof has a single top-level call. Replace n+count in any_where
predicates with saturating_sub so Kani does not fail on usize
overflow.
Drop the weak loop_invariant that havocs SplitResult node pointers
into unconstrained values. Copy leaf occupancy with ptr::copy so
insert_recursing proofs can use unwind 3 instead of 13.
Partition 1 and autoharness ubuntu ended with runner shutdown, not a Kani counterexample.
Autoharness macos timed out (10m CBMC) on
check_insert_recursing_into_parent. Use a concrete edge index and
key so the Ok(parent) / split_root arms still run without a
symbolic idx.
@feliperodrifeliperodri added the Challenge Used to tag a challenge label Aug 20, 2026
Autoharness 5aca52c was 1411/1/1412: into_parent still hit the 10m
CBMC cap (17:53-18:03). split_root and fit passed. unwind(3) lets
CBMC havoc a second parent hop; one hop plus exit is unwind(2).
Autoharness both OS 0-fail on 86a25d9 (ubuntu 1413/0, macos 1412/0).
ubuntu partition 1 was shutdown-signal with 0 VERIFICATION FAILED.
gh run rerun --failed denied (no admin).
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ChallengeUsed to tag a challenge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Challenge 4: Memory safety of BTreeMap's btree::node module

2 participants

@sankalpsthakur@feliperodri