feat(CCS): trace equivalence of Milner's vending machines #1263
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.40) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 314 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.344
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #1263"
general
weight: 0.35
thomaskwaring
The module doc of
Cslib/Algorithms/CCS/VendingMachine.leanended with "Future work on proving that the two vending machines are trace equivalent would be welcome." This PR proves it and updates the module doc.Main statement, placed after
vm_ltsD_ltsND_not_bisimand stated in the same shape, with the library's heterogeneousTraceEq:It is assembled from two inclusion lemmas, each proved by induction on the trace using
LTS.mem_traces_cons_iffand case analysis on the CCS transition:traces_ltsD_subset_traces_ltsND: a trace ofvminltsDis a trace ofvminltsND. The induction needs a statement about the state after the coin as well: a trace oftea.VM + coffee.VMinltsDis a trace oftea.VMor ofcoffee.VMinltsND. The disjunction is where the nondeterministic machine's early commitment shows up, and it is the reason this direction cannot be obtained from a simulation.traces_ltsND_subset_traces_ltsD: the converse, generalised to the two post-coin statestea.VMandcoffee.VMofltsND, each of whose traces are traces oftea.VM + coffee.VMinltsD. This direction also follows from a simulation viaIsSimulation.traces_subset; I kept it as an induction so that the two lemmas read the same way. Happy to switch if you prefer the simulation.No new imports and no changes to existing declarations. The two inclusion lemmas are
private, since their statements carry the induction generalisation; onlyvm_ltsD_ltsND_traceEqis new public API.Checked locally (Lean v4.36.0, Mathlib from cache):
lake build Cslib.Algorithms.CCS.VendingMachinesucceeds with no warnings.#print axioms vm_ltsD_ltsND_traceEqgives[propext, Classical.choice, Quot.sound], and the same for the two lemmas.#lint in Cslib.Algorithms.CCS.VendingMachinereports 0 errors in 20 declarations with 15 linters.lake exe mk_all --checkreports "No update necessary".Not run locally: a full
lake build,lake test,lake exe checkInitImportsandlake shake, since they need the whole library built. The imports of the file are unchanged.AI use. This PR was prepared with an AI agent (Claude). The agent read
VendingMachine.lean,LTS/TraceEq.lean, the trace definitions inLTS/Basic.leanandCCS/Semantics.lean, wrote the statements and proofs, and ran the build, axiom and lint checks listed above. The proof contains nosorry, nonative_decideand no new axioms.