Expand description
M10: Spec proof checker. Spec §14.
Specs are properties attached to a function signature. The checker tries to prove a spec holds for every input that satisfies the quantifier constraints, and reports one of:
proved— the property holds (by randomized search across N trials, or by an SMT prover when one is available).counterexample— concrete inputs that falsify the property.inconclusive— the search couldn’t decide one way or the other.
§Strategies
- Randomized (default, pure-Rust). Generates inputs from a
deterministic seed, checks the property by actually running the
target function in the Lex VM. Reports
provedafter surviving 1000 trials by default. This is honest about the method viaevidence.method = "randomized". - SMT-LIB export. The spec can be lowered to SMT-LIB text for
pasting into an external Z3 (
z3 -smt2 file.smt). We don’t link libz3 here to keep the dep surface light; that’s a follow-up feature flag.
§Spec DSL
spec clamp {
forall x :: Int, lo :: Int, hi :: Int where lo <= hi:
let r := clamp(x, lo, hi)
(r >= lo) and (r <= hi)
}Structs§
Enums§
- Gate
Verdict - Verdict returned by
evaluate_gate. - Proof
Status - Spec
Expr - SpecOp
- Spec
Type
Functions§
- check_
spec - Check a spec against a Lex program. The program must define the function the spec refers to (by name).
- evaluate_
gate - Evaluate every
specagainstbindingsand return the first non-Allow verdict (orAllowif all pass).lex_sourcesupplies the host program — anySpecExpr::Callin a spec’s body resolves to a function in this program. - evaluate_
gate_ compiled - Same as
evaluate_gatebut takes already-compiled bytecode. Use when gating at high frequency: compile the program once, evaluate many actions against it. - parse_
spec - to_
smtlib