Repository navigation
State TLA+ LogInv and CommittedLogAppendOnlyProp in the Lean ccf-raft model - #8590
Draft
cjen1-msft wants to merge 11 commits into
Draft
cjen1-msft wants to merge 11 commits into
cjen1-msft wants to merge 11 commits into
Conversation
cjen1-msft
force-pushed
the
cjen1-msft-literate-chainsaw
branch
from
October 19, 2026 19:18
9789f5c to
1b1b4cb
Compare
cjen1-msft
force-pushed
the
cjen1-msft-literate-chainsaw
branch
3 times, most recently
from
October 20, 2026 15:53
b15bc9b to
9f04123
Compare
cjen1-msft
force-pushed
the
cjen1-msft-literate-chainsaw
branch
from
October 21, 2026 09:23
9f04123 to
6a3f65b
Compare
Add PropertiesTLA.lean with exact Lean statements of ccfraft.tla LogInv and CommittedLogAppendOnlyProp, and abs.tla AppendOnlyProp under MappingToAbs, proved by a self-contained ProofTLA closure. Add exactness and architecture/axiom tests, a README section, and a sandboxed kernel check for ccf-raft in CI. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Define LogInv and CommittedLogAppendOnlyProp directly over valid traces, matching the TLA+ semantically, and add non-vacuity witnesses. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
LogInv holds in every reachable state and CommittedLogAppendOnlyProp on every enabled step from a reachable state, which is what Spec => []P and Spec => [][A]_vars mean for these safety properties. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Port PropertiesTLA and the ProofTLA closure to the model at 1041157: concrete NodeID/ReqID, ModelConfig with a typed primary, the genesis configuration entry, three-way append-entries role outcomes and the new conflict index. LogInv's quorum-intersection argument now uses a Genesis invariant (every nonempty log starts with the genesis entry) to show each quorum log names a configuration. Statement meanings and the four theorem roots are unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adapt ProofTLA to the updated model: term-aware step-down, gated responses from unknown peers, signature-bounded commit quorums, strict prevIndex-0 matching, renamed vote messages and the active-free lift. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Model #8578 now takes the initial membership as a Finset NodeID, with the minimum member starting as primary, instead of ModelConfig. The TLA+ claims and witnesses quantify that membership; proofs carry it in a proof-only Initial class and derive primary membership from Finset.min. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The model now represents traces as Stream'.Seq. Add regression checks that the reachable-state LogInv and the step-wise CommittedLogAppendOnlyProp cover every state and adjacent step of any valid finite or infinite trace. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
nominateSuccessor now owns the primary-role guard and returns the unchanged node state; port the direct and summary proofs accordingly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Follow the presentation of the proved Properties.lean: each claim is a directly stated theorem with a separate witness lemma, both delegating to ProofTLA, which is now imported privately. Semantics are unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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>
Main rewrote the README; reapply the TLA+ section after it and refer to committed_logs_prefix, the current name of the cross-state property. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
cjen1-msft
force-pushed
the
cjen1-msft-literate-chainsaw
branch
from
October 23, 2026 10:43
4873cff to
2c23724
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
lean/ccf-raft/CCFRaft/PropertiesTLA.lean, which states Lean versions of the TLA+ safety propertiesLogInvandCommittedLogAppendOnlyPropas theorems, each paired with a non-vacuity witness lemma. They are proved in a self-containedCCFRaft/ProofTLA/closure. The aim is to measure how much Lean proof these TLA+ properties need, separately from the existing Lean safety proof work.Base. This PR targets
mainand is based onmainatafd42aa7e, which includes the model (#8578), the Lean safety proofs (#8583) and the bundled transition-system types (#8624). No GitHub stack is used. The head is2c2372466. The diff againstmaintouches onlyProofTLA/,PropertiesTLA.lean,Tests/ArchitectureTLA.lean,Tests/PropertiesTLA.lean, theCCFRaft.leanumbrella and the README.Statements. The presentation follows
Properties.lean. Each property is a directly statedtheoremwith explicit quantifiers, and each witness is a separatelemmawith explicit existentials. Both are proved byexactof aProofTLAtheorem, andProofTLAis imported privately.Model.transitionSystem. Each quantifies every initial membership (Finset NodeID) and node list.Spec => []PmeansPholds in every reachable state, andSpec => [][A]_varsmeansAholds on every enabled step from a reachable state; stuttering steps satisfy it trivially and fairness plays no part.log.take commitIndexover full entries (term and content), which matches TLA+Committed(i) == SubSeq(log[i], 1, commitIndex[i]).The theorems and witnesses:
log_inv(LogInv,ccfraft.tla~1400): in every reachable state, the committed logs of any two nodes are prefix-comparable. This is the same-state property, which is weaker thancommitted_logs_prefixinProperties.lean.committed_log_append_only_prop(ccfraft.tla~1639): on every enabled step from a reachable state, each node's committed log is a prefix of its committed log afterwards.abs.tlaAppendOnlyPropis not stated separately. UnderMappingToAbsit is the same property over entry terms only, socommitted_log_append_only_propimplies it.log_inv_witness: a reachable state in which two distinct nodes both have nonempty committed logs.committed_log_append_only_prop_witness: an enabled step from a reachable state that strictly extends a nonempty committed log.Tests/PropertiesTLA.leanchecks that both claims cover every state and adjacent step of any valid finite or infiniteStream'.Seqtrace.These are statements about the Lean model. That the Lean model is equivalent to the TLA+ model is not proved; it is a trust boundary.
Proof. The proofs were ported from a snapshot of #8583's safety proof into
ProofTLAand pruned to the declarations the theorems depend on. Nothing inProofTLAorPropertiesTLA.leanimportsCCFRaft.Proofs*orCCFRaft.Properties;Tests/ArchitectureTLA.leanenforces this.ProofTLAis 23 files and 7177 lines (6435 non-blank). The witness proofs inProofTLA/Witnesses.leanaccount for 267 of those lines.PropertiesTLA.leanis 87 lines (74 non-blank).CI.
CCFRaft.leanpublicly importsPropertiesTLAalongsideProperties, and privately imports the TLA tests, asmaindoes for its tests. The existing Lean workflow therefore covers the new modules withlake check --inadvisably-no-sandbox,lake exe check-imports, formatting andlake lint.Tests/ArchitectureTLA.leanrequires the four theorem roots to be theorems that use onlypropext,Classical.choiceandQuot.sound. This PR does not change the workflow.Manual testing. These checks passed locally on head
2c2372466:lake build --wfail(3200 jobs), which includes the canonical traces,Tests/Architecture.lean, and theTests/ArchitectureTLA.leanindependence and axiom auditlake exe check-importslake lintscripts/ascii-checks.shscripts/doc-newline-checks.shlake checkwas not run locally on this head; it runs in CI. An earlierlake check --inadvisably-no-sandboxon head4873cffab(based on8fb56b285) accepted the solution with onlypropext,Quot.soundandClassical.choice. No sandboxed kernel check has been run.Rebasing onto
afd42aa7eneeded two follow-up commits. The first portsProofTLAto the bundledTransitionSystemtypes from #8624, in the same way #8624 portedProofs. The second restores the README section aftermain's rewrite. Intermediate commits do not build againstafd42aa7e.