§ 5.3 · Rust · proptest + the type system
Rust
types make some properties unrepresentable; proptest hunts the rest.
Rust's type system is a theorem prover you already use: an enum State { Idle, Paid, Vend } is a proof that no fourth state exists — a property enforced by construction, no test needed.
proptest covers what types cannot: temporal behaviour across generated runs, same shape as Hypothesis. For concurrency specifically, loom exhaustively explores the interleavings — which is a model checker wearing a macro.
prop_assert!(owed >= 0) — with runs from proptest::collection::vec
G (coin -> F dispense)// tests/vend.rs — properties as macros; traces as generated Vecs.
use proptest::prelude::*;
proptest! {
#[test]
fn coins_are_answered(run in proptest::collection::vec(
"coin|dispense|timeout", 0..12)) {
let mut owed = 0i64;
for e in &run {
match e.as_str() {
"coin" => owed += 1,
"dispense" => owed -= 1,
_ => {}
}
prop_assert!(owed >= 0);
}
}
}check_ltlview the JSON-RPC body · POST to /api/mcp
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "check_ltl",
"arguments": {
"formula": "G (coin -> F dispense)",
"trace": [
[
"coin"
],
[
"timeout"
],
[
"timeout"
]
]
}
}
}read_skills_guideThe guide's Step 1 pattern table is how an agent turns a Rust comment like “the lock must be free before acquiring” into G (acquire -> free) — grammar and precedence, no translation guesswork.
model_checkloom explores interleavings; agents feed the explored schedule as a Kripke artifact to model_check and get the lasso counterexample — the exact interleaving that deadlocks — as a failing test.
explain_conceptWhen a proptest failure is temporal but the team speaks Rust, agents pull the matching chapter (model-checking, property-based-testing) for the vocabulary to file the issue precisely.
Model checking and proptest compose: loom is literally a bounded model checker for Send/Sync interleavings — verdicts labelled done/incomplete, same honesty as ours.
Rust convention: property tests live in tests/, types carry the invariants they can, comments cite the LTL clause for the rest.
field guide · Model checking · Property-based testing & falsification