M0.3: Implement Z3 verification backend #21
Labels
No labels
blocked
bug
design
docs
engineering
feature
infra
priority:high
priority:low
priority:medium
question
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: sscoble/speckl#21
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Implement Z3 verification backend so
speckl verifycan prove or disprove invariants stated in.speckfiles.Tasks
statedeclarations to Z3 sort declarations,initto constraints,actionguards to preconditions,invariantto assertion functionsspeckl verify <file>runs Z3 and reports: PASS, FAIL (with counterexample), or UNKNOWN (timeout)--depth)Exit Criteria
speckl verify examples/ToggleSwitch.speckproves invariants holdspeckl verify examples/Raft.speck --depth=5runs bounded verification and reports resultsDependencies
#20 (M0.2: Typed IR) must be complete. Z3 backend consumes IR, not AST.
Context
Part of M0.3 in
docs/PROVE-KAFKA-PLAN.md. This is the core differentiator — "prove your invariants, not just compile your code." Unlocks M1.1 (KRaft spec verification).✅ Z3 backend implemented.
compiler/src/generators/z3.ts(1,034 lines),--target=z3CLI option,--verify-depth=Nfor BMC unrolling. ToggleSwitch, TigerBeetleLedger, and KafkaKRaft all generate valid SMT-LIB2. Complex forall/set expressions emittrueplaceholders for now — will improve as expression translation matures. All 41 tests passing. Branch:feature/z3-backend.Design doc written at compiler/docs/z3-verification-backend.md (~10KB). Covers: architecture (SpeckIR → Z3 Backend → SMT-LIB2 → Z3), three verification modes (full, bounded N-depth, single-invariant), translation details (state→sorts, actions→transition relations, invariants→assertions), counterexample generation, bounded model checking unrolling, output format (PASS/FAIL/UNKNOWN with traces), implementation plan (7 steps), and exit criteria.
Key files:
verifysubcommandClosing as done. Depends on #20 (M0.2 typed IR) for compilation. Unlocks #22 (KRaft spec).