Verus Expert Skill
Purpose
Provides expert-level Verus assistance for deductive verification of Rust:
writing specifications, proving panic-freedom and arithmetic-overflow-freedom,
authoring loop invariants and proofs, debugging failed verification, and using
LLM proof synthesis (auto-verus) safely behind the verifier.
When This Skill Activates
- User asks to write or review Verus specifications (
requires, ensures,
invariant, decreases) for Rust code
- User wants to prove panic-freedom or arithmetic-overflow-freedom on a function
- User needs help authoring loop invariants, assertions, or
proof fn lemmas
- User is debugging a failed Verus verification (failed pre/postcondition,
overflow, timeout, quantifier trigger issues)
- User asks about Verus modes (
spec/proof/exec), ghost/tracked code, or
int/nat reasoning
- User wants to apply LLM proof synthesis (auto-verus / AutoVerus / VeruSAGE) as
a proposer behind the Verus checker
- User is deciding between Verus, Lean 4, and TLA+ for a Rust verification goal
How It Works
This skill delegates to the verus-expert agent, which has evidence-grounded
knowledge of:
- Verus specification language --
verus! { ... }, requires/ensures,
spec functions (open/closed/pub), and the modular verification protocol
- The three modes --
spec, proof, and exec; ghost code and its erasure
before compilation; ghost/tracked state
- Panic and overflow freedom -- automatic overflow checking on
exec
arithmetic; checked_* and CheckedU*; provable index bounds
- Loops, invariants, and termination -- loop invariants, modular loop
verification,
#[verifier::loop_isolation(...)], and decreases
- SMT/Z3 solving model -- reading Verus errors,
assert ... by, lemmas,
quantifier triggers, and diagnosing timeouts
- auto-verus -- AutoVerus (three-phase LLM proof construction) and VeruSAGE as LLM
proof-synthesis proposers, always checked by Verus
- LLM guardrails -- verifier is ground truth; provide
vstd and a Verus
binary; use a cheat checker; forbid assume/admit
Integration with Existing Infrastructure
This is Phase-1 of the formal-verification effort tracked in issue #4610: a
reusable skill plus a durable applicability assessment. It complements the
existing tla-plus-expert skill -- TLA+ verifies concurrent/distributed
designs, while Verus verifies the Rust implementation that realizes them.
No Verus toolchain or CI wiring is introduced in this phase. Whether and where to
adopt Verus in the build (annotating specific functions, adding a verification
gate) is a Phase-2 decision, gated on the assessment's recommendation. The
durable comparison and phased plan live in the formal-methods assessment:
Verus vs Lean 4 vs TLA+ for Rust.
Usage Examples
# Add a machine-checked contract to a function
/verus-expert Add requires/ensures to this ledger-append function and prove it cannot overflow
# Author a loop invariant
/verus-expert Help me write the loop invariant and decreases clause for this scan loop
# Debug a failed verification
/verus-expert Verus reports "possible arithmetic overflow" here -- how do I discharge it?
# Use auto-verus safely
/verus-expert Propose loop invariants with auto-verus, then confirm Verus accepts them
# Decide if Verus is the right tool
/verus-expert Should I use Verus, Lean 4, or TLA+ to verify this state-machine transition?
Key Resources
1---2name: verus-expert3description: Verus deductive-verification expert for proving Rust functional correctness, panic-freedom, and arithmetic-overflow-freedom with SMT-backed specs and LLM-assisted proof synthesis4---56# Verus Expert Skill78## Purpose910Provides expert-level Verus assistance for deductive verification of Rust:11writing specifications, proving panic-freedom and arithmetic-overflow-freedom,12authoring loop invariants and proofs, debugging failed verification, and using13LLM proof synthesis (auto-verus) safely behind the verifier.1415## When This Skill Activates1617- User asks to write or review Verus specifications (`requires`, `ensures`,18 `invariant`, `decreases`) for Rust code19- User wants to prove panic-freedom or arithmetic-overflow-freedom on a function20- User needs help authoring loop invariants, assertions, or `proof fn` lemmas21- User is debugging a failed Verus verification (failed pre/postcondition,22 overflow, timeout, quantifier trigger issues)23- User asks about Verus modes (`spec`/`proof`/`exec`), ghost/tracked code, or24 `int`/`nat` reasoning25- User wants to apply LLM proof synthesis (auto-verus / AutoVerus / VeruSAGE) as26 a proposer behind the Verus checker27- User is deciding between Verus, Lean 4, and TLA+ for a Rust verification goal2829## How It Works3031This skill delegates to the `verus-expert` agent, which has evidence-grounded32knowledge of:33341. **Verus specification language** -- `verus! { ... }`, `requires`/`ensures`,35 spec functions (`open`/`closed`/`pub`), and the modular verification protocol362. **The three modes** -- `spec`, `proof`, and `exec`; ghost code and its erasure37 before compilation; `ghost`/`tracked` state383. **Panic and overflow freedom** -- automatic overflow checking on `exec`39 arithmetic; `checked_*` and `CheckedU*`; provable index bounds404. **Loops, invariants, and termination** -- loop invariants, modular loop41 verification, `#[verifier::loop_isolation(...)]`, and `decreases`425. **SMT/Z3 solving model** -- reading Verus errors, `assert ... by`, lemmas,43 quantifier triggers, and diagnosing timeouts446. **auto-verus** -- AutoVerus (three-phase LLM proof construction) and VeruSAGE as LLM45 proof-synthesis proposers, always checked by Verus467. **LLM guardrails** -- verifier is ground truth; provide `vstd` and a Verus47 binary; use a cheat checker; forbid `assume`/`admit`4849## Integration with Existing Infrastructure5051This is Phase-1 of the formal-verification effort tracked in issue #4610: a52reusable skill plus a durable applicability assessment. It complements the53existing `tla-plus-expert` skill -- TLA+ verifies concurrent/distributed54*designs*, while Verus verifies the *Rust implementation* that realizes them.5556No Verus toolchain or CI wiring is introduced in this phase. Whether and where to57adopt Verus in the build (annotating specific functions, adding a verification58gate) is a Phase-2 decision, gated on the assessment's recommendation. The59durable comparison and phased plan live in the formal-methods assessment:60[Verus vs Lean 4 vs TLA+ for Rust](https://github.com/rysweet/amplihack-rs/blob/main/docs/formal-methods/verus-vs-lean-vs-tla-for-rust.md).6162## Usage Examples6364```65# Add a machine-checked contract to a function66/verus-expert Add requires/ensures to this ledger-append function and prove it cannot overflow6768# Author a loop invariant69/verus-expert Help me write the loop invariant and decreases clause for this scan loop7071# Debug a failed verification72/verus-expert Verus reports "possible arithmetic overflow" here -- how do I discharge it?7374# Use auto-verus safely75/verus-expert Propose loop invariants with auto-verus, then confirm Verus accepts them7677# Decide if Verus is the right tool78/verus-expert Should I use Verus, Lean 4, or TLA+ to verify this state-machine transition?79```8081## Key Resources8283- Verus repository: https://github.com/verus-lang/verus84- Verus Guide (tutorial and reference): https://verus-lang.github.io/verus/guide/85- Verus standard library (`vstd`): https://verus-lang.github.io/verus/verusdoc/vstd/86- auto-verus (proof synthesis): https://github.com/microsoft/verus-proof-synthesis87- Formal-methods assessment: [docs/formal-methods/verus-vs-lean-vs-tla-for-rust.md](https://github.com/rysweet/amplihack-rs/blob/main/docs/formal-methods/verus-vs-lean-vs-tla-for-rust.md)88- Issue #4610: formal verification for Simard's Rust (Verus / auto-verus / Lean 4 vs TLA+)