Commit 480309d
Add TLAPS proof companions for example specifications
Each affected directory now has a `<Spec>_proof.tla` module that
mechanically checks the safety obligations of its TLA+ specification
(typically Spec => []TypeInvariant, plus any SafetyInvariant or
strengthened inductive invariant the spec defines). The original
specifications themselves are not modified by this commit; the prior
commit names a few previously-anonymous `ASSUME` blocks that the
proofs cite by reference.
Specifications covered:
- KeyValueStore
- MultiCarElevator/Elevator
- PaxosHowToWinATuringAward/Voting
- SpecifyingSystems chapters: AsynchronousInterface, FIFO,
HourClock, Composing, Liveness, RealTime, CachingMemory, TLC
- TwoPhase
- allocator (Simple, Scheduling, Implementation)
- byihive/VoucherLifeCycle
- ewd687a/EWD687a
- ewd998/EWD998PCal and EWD998 (TerminationDetection lifted to
Spec => []...)
- transaction_commit (TCommit, TwoPhase, PaxosCommit)
- CoffeeCan, DieHard, MissionariesAndCannibals, SpanTree
(TypeInvariant / TypeOK)
- spanning (SntMsg) and glowingRaccoon clean+stages (TypeOK +
primerPositive + preservationInvariant)
- ReadersWriters (TypeOK + Safety: mutex + at-most-one-writer)
- CigaretteSmokers (TypeOK + AtMostOne)
- LamportMutex (BoundedNetwork, via NetworkInv pigeonhole)
- TeachingConcurrency/Simple and SimpleRegular (TypeOK and Inv
exposed as named theorems matching the .cfg invariants)
Proof-only assumptions added in `*_proof.tla` (not in the spec):
- CigaretteSmokers_proof: IngredientsFinite (Cardinality is
already used inside the spec's own ASSUME, so finiteness is
implicit).
- ReadersWriters_proof: NumActorsIsNat (NumActors \in Nat).
- Elevator_proof: ElevatorFloorDisjoint (Floor \cap Elevator = {};
a TLC modelling convention not stated in the spec).
- SchedulingAllocator_proof, AllocatorImplementation_proof:
ClientsFinite (the spec only assumes Resources finite).
- EWD687a_proof: ProcsFinite (finite process set).
- glowingRaccoon clean_proof and stages_proof: ConstantsAreNat
(DNA, PRIMER \in Nat; without this Spec => []TypeOK is false).
Spec ASSUMEs restated under a name in the proof file (no new fact):
- CigaretteSmokers_proof: OffersAssumption.
- spanning_proof: NoPrntFact.
- SpanTree_proof: ConstantsAssumption.
- CoffeeCan_proof: MaxBeanFact.
Non-trivial proof obligations discharged:
- PaxosCommit_proof: MaximumProp -- the recursive `Maximum` operator
is shown to return the largest element of its (non-empty, finite,
integer >= -1) input via well-founded induction on the strict-subset
ordering, going through a hand-proved recursion equation for the
inner CHOOSE'd recursive function.
- SchedulingAllocator_proof: PermSeqsType -- analogous well-founded
structural induction over `PermSeqs(S)`, plus an explicit
finiteness assumption on `Clients` (added in the proof file only).
- AllocatorImplementation_proof: PermSeqsType -- the same proof
threaded through the `Sched!` instance. One sub-step
(`Sched!PermSeqs(S) = PermsFn(S)[S]`) remains OMITTED because
tlapm's INSTANCE expansion currently mangles the inner LET binding
inside the LET-bound recursive function.
- EWD687a_proof: TreeNodesNonNeutral, TreeStructure, TreeIsTree,
Inv2GivesTreeBody, SpecGivesAlwaysTreeBody -- the structural half
of TreeWithRoot (graph + non-neutral conjuncts) discharged from the
existing Inv1 / Inv2 / NoCycle invariants.
- CRDT_proof: the four previously OMITTED Sum lemmas (SumType,
SumIsZero, SumWeaklyMonotonic, SumStronglyMonotonic) are reduced
to SumFunctionNat, SumFunctionZero, SumFunctionMonotonic, and
SumFunctionStrictlyMonotonic in the community-modules
FunctionTheorems (strengthened and CI-verified in
tlaplus/CommunityModules#124) via the
trivial unfolding Sum(f) = SumFunction(f); FiniteSetTheorems is
dropped from EXTENDS accordingly. The downstream Measure*/Gossip*
lemmas and the OGLiveness / Convergence theorems that already cited
these now check end-to-end (280 obligations).
Remaining OMITTED obligations:
- Elevator_proof: Inv2Next (the inductive step for the strengthened
Inv2; each of its ~10 conjuncts is proven preserved per-action
individually, only the full assembly is left), and four narrow
function-evaluation lemmas (GetDirectionEval, GetDistanceEval,
CanServiceCallEval, PeopleWaitingEval) that unfold a multi-arg
`f[a, b]` definition -- a known tlapm/SMT/Zenon/Isabelle gap,
cf. https://discuss.tlapl.us/msg01519.html.
- EWD687a_proof: AreConnectedToLeader (constructing the path to
Leader by iterating upEdge needs SimplePath/Cardinality
reasoning), Thm_TreeWithRoot's QED (bridges TreeWithRoot's
`LET ... IN [](...)` shape and the equivalent
`[](LET ... IN ...)` that PTL would consume), and Thm_DT2
(Spec => DT2; needs an inductive invariant over
msgs/rcvdUnacked/acks/sentUnacked).
- AllocatorImplementation_proof: PermSeqsIsPermsFn, the equality
`Sched!PermSeqs(S) = PermsFn(S)[S]`, blocked by tlapm rendering
the INSTANCE-expanded inner LET binding as a self-recursive
CHOOSE.
- EWD998PCal_proof: Refinement (Spec => EWD998Spec); per-disjunct
step-simulation requires bag-level lemmas plus the EWD998-level
invariant `B = Sum(counter, Node)` for the token-pass disjunct.
Also, the unique-token preservation conjunct of NetworkOK is
deferred in PCalTypeOKInductive.
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Markus Alexander Kuppe <github.com@lemmster.de>1 parent 7e6b6f7 commit 480309d
41 files changed
Lines changed: 6625 additions & 7 deletions
File tree
- specifications
- CigaretteSmokers
- CoffeeCan
- DieHard
- FiniteMonotonic
- KeyValueStore
- MissionariesAndCannibals
- MultiCarElevator
- PaxosHowToWinATuringAward
- ReadersWriters
- SpanningTree
- SpecifyingSystems
- AsynchronousInterface
- CachingMemory
- Composing
- FIFO
- HourClock
- Liveness
- RealTime
- TLC
- TeachingConcurrency
- TwoPhase
- allocator
- byihive
- ewd687a
- ewd998
- glowingRaccoon
- lamport_mutex
- spanning
- transaction_commit
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 312 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
0 commit comments