Skip to content

lean: Bundle state and action types in transition systems - #8624

Merged
Heidi Howard (heidihoward) merged 3 commits into
microsoft:mainfrom
heidihoward:refactor-lean-transitions
Oct 22, 2026
Merged

Heidi Howard (heidihoward) merged 3 commits into
microsoft:mainfrom
heidihoward:refactor-lean-transitions

Conversation

@heidihoward

@heidihoward Heidi Howard (heidihoward) commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Summary

This change folds the state and action types into the definition of TransitionSystem, bringing it more in line with standard definitions of transition systems.

  • Make State and Action fields of the structure rather than external type parameters.
  • Update execution and reachability definitions, network composition, both protocol models, and their proofs to use system.State and system.Action, preserving existing transition behavior.
  • Add regression examples and document the updated API.

Concrete systems use abbrev so Lean can unfold the bundled types during typeclass inference.

Validation

  • Both Lean packages build with lake build --wfail --fail-fast.
  • Import coverage passes for both packages.
  • All 419 recovery replay cases pass.
  • Changed Lean files pass formatting; recovery declaration linting passes.
  • lake check --inadvisably-no-sandbox passes for all three packages: common (4m44s), disaster recovery (18m54s), and CCF-Raft (19m34s). Lean's kernel accepts each export; only the permitted axioms propext, Quot.sound, and Classical.choice are used. Earlier timeouts were too short for the export and kernel replay; no code changes were required.
  • Full repository checks were attempted but are blocked by missing uv/uvx and CMake; required CI checks remain necessary.

Update execution helpers, network composition, models, and proofs to use the bundled types, with regression coverage and migration documentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@heidihoward
Heidi Howard (heidihoward) requested a review from a team as a code owner October 22, 2026 14:59
Copilot AI balanced review requested due to automatic review settings October 22, 2026 14:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The shared formal-model interface affects both protocol packages, and whole-package kernel and axiom checks remain unverified.

No open issues 🎉

What changed in this PR

This PR updates CCF's shared Lean transition-system interface to bundle state and action types, then adapts the Raft and disaster-recovery models and proofs without changing transition behavior.

Changes:

  • Move State and Action into TransitionSystem and update execution, reachability, and network composition.
  • Adapt both protocol models and dependent proofs, using abbrev for concrete systems.
  • Add bundled-type regression examples and document the updated API.

Custom instructions used

Applied the CCF repository instructions supplied in the review context; no additional instruction files were loaded.

File Description
lean/​disaster-recovery/​DisasterRecovery/​Tests/​Trace.lean Update trace-validity argument order.
lean/​disaster-recovery/​DisasterRecovery/​Tests/​Network.lean Adapt simplification to the network abbreviation.
lean/​disaster-recovery/​DisasterRecovery/​Tests/​Execution.lean Add bundled-type examples and migrate validity checks.
lean/​disaster-recovery/​DisasterRecovery/​Tests/​CanonicalTests.lean Bundle local-machine types.
lean/​disaster-recovery/​DisasterRecovery/​Proofs/​Witnesses.lean Update trace-validity construction.
lean/​disaster-recovery/​DisasterRecovery/​Proofs/​Trace.lean Express paths using bundled state types.
lean/​disaster-recovery/​DisasterRecovery/​Proofs/​Quorum.lean Specify the bundled-system induction recursor.
lean/​disaster-recovery/​DisasterRecovery/​Proofs/​Observed.lean Adapt reachability induction.
lean/​disaster-recovery/​DisasterRecovery/​Proofs/​Lifting.lean Adapt lifting proofs and execution constructors.
lean/​disaster-recovery/​DisasterRecovery/​Proofs/​Invariants.lean Adapt invariant induction proofs.
lean/​disaster-recovery/​DisasterRecovery/​Proofs/​History.lean Specify the path induction recursor.
lean/​disaster-recovery/​DisasterRecovery/​Proofs/​Gossip.lean Adapt reachability and path induction.
lean/​disaster-recovery/​DisasterRecovery/​Proofs/​ExecutionLocal.lean Bundle local instrumentation types.
lean/​disaster-recovery/​DisasterRecovery/​Proofs/​Execution.lean Bundle decorated execution types.
lean/​disaster-recovery/​DisasterRecovery/​Model.lean Expose the recovery system as an abbreviation.
lean/​common/​README.md Document bundled types and API usage.
lean/​common/​CCF/​TransitionSystem.lean Bundle types and update reachability.
lean/​common/​CCF/​MultiNodeTransitionSystem.lean Bundle network types in lift.
lean/​common/​CCF/​Execution.lean Update runs, trace validity, and reachability proofs.
lean/​ccf-raft/​CCFRaft/​Proofs/​Witnesses.lean Migrate execution helpers and concrete witness systems.
lean/​ccf-raft/​CCFRaft/​Proofs/​Safety/​History.lean Adapt history reachability induction.
lean/​ccf-raft/​CCFRaft/​Proofs/​Direct/​Framework.lean Adapt invariant and node-uniqueness induction.
lean/​ccf-raft/​CCFRaft/​Model.lean Expose the Raft system as an abbreviation.

Review effort: Balanced

@heidihoward
Heidi Howard (heidihoward) merged commit 6bbfd3a into microsoft:main Oct 22, 2026
13 checks passed
cjen1-msft added a commit that referenced this pull request Oct 23, 2026
Follow #8624: TransitionSystem now bundles its State and Action types.
Generalize the witness run helper over the bundled system, make the
witness systems abbreviations, and name the Reachable recursor explicitly
when inducting over reachability of the Raft transition system.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants