Skip to content

formal(P2): make CeremonyStore actually TLC-checkable + model-check it green#240

Merged
hartsock merged 1 commit into
mainfrom
formal/p2-store-tlc-checked
Jul 17, 2026
Merged

formal(P2): make CeremonyStore actually TLC-checkable + model-check it green#240
hartsock merged 1 commit into
mainfrom
formal/p2-store-tlc-checked

Conversation

@hartsock

Copy link
Copy Markdown
Member

The P2 store gate had never actually run

Roadmap 1b requires the P2 store to be TLC model-checked first, before the pure Rust state machine refines it. That gate had never run: Next quantified \E e \in Nat, and TLC cannot enumerate the infinite Nat — it aborts at the initial state (non-enumerable quantifier bound Nat). So THEOREM Spec => []Inv was asserted but never machine-verified.

Fix

Bound the head-read to 0..len. Append fires only on expected = len, so every e > len is a disabled transition — restricting to 0..len keeps the transition relation faithful (a stale read e < len is the benign CAS loser) and finite. Add StateBound == len =< 4 and a committed CeremonyStore.cfg (RecordIds = 3 model values).

Result (TLC)

Model checking completed. No error has been found. — 2615 states generated, 547 distinct.

  • Inv = TypeOK ∧ SpineFunctional ∧ NoRollback holds (PO-2/2a/2c, OB-15/16).
  • Temporal CheckpointMono and LenMono hold.

The store model is now the genuinely-verified refinement target for the Phase-1b pure Rust state machine.

Test plan

  • java -cp tla2tools.jar tlc2.TLC -config CeremonyStore.cfg CeremonyStore.tla → no error.
  • Full pre-push gate passed on push.

Risk

Low — additive to formal/tla + one README row; no Rust, no CI/build config touched.

@hartsock hartsock added the documentation Improvements or additions to documentation label Jul 17, 2026
…t green

Roadmap 1b's gate is "TLA+/TLC model checked first" before the Rust store
refines it. That gate had never actually run: `Next` quantified
`\E e \in Nat`, and TLC cannot enumerate the infinite `Nat` -- it aborts at the
initial state with "non-enumerable quantifier bound Nat". So `THEOREM Spec =>
[]Inv` was asserted, never machine-checked.

Fix: bound the head-read to `0..len`. `Append` only fires on `expected = len`,
so every `e > len` is a disabled transition -- restricting to `0..len` keeps the
transition relation faithful (a stale read `e < len` is the benign CAS loser)
AND finite. Add `StateBound == len =< 4` and a committed `CeremonyStore.cfg`
(RecordIds = 3 model values).

TLC result: Model checking completed, NO error found. 2615 states generated,
547 distinct. `Inv` (TypeOK /\ SpineFunctional /\ NoRollback) holds; the
temporal `CheckpointMono` and `LenMono` hold. The P2 store invariants
(PO-2/2a/2c, OB-15/16) are now genuinely verified, and the model is the
refinement target for the Phase-1b pure Rust state machine.

formal/README updated to mark the store TLC-checked with the run command.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@hartsock
hartsock force-pushed the formal/p2-store-tlc-checked branch from c39db60 to 441ed51 Compare July 17, 2026 03:48
@hartsock
hartsock merged commit 6d684f0 into main Jul 17, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant