-
-
Notifications
You must be signed in to change notification settings - Fork 0
Lean 4 Formalization
Two order-reversing twins and the duality connecting them, at the repository root.
Authoritative source doc:
docs/LEAN-FORMALIZATION.adoc.
- One Lake library, pinned to Lean 4.13.0 (
lean-toolchain), no Mathlib (import Initonly). -
TropicalSessionTypes.lean— the max-plus semiring (⊕ = max, ⊗ = +), grading speculative session types. -
TropicalAdapterPath.lean— the min-max (bottleneck) semiring (⊕ = min, ⊗ = max), grading adapter paths; home of thehub_ceilingno-go. - Connected by the order-reversing involution
g ↦ maxGrade − g, proved as a lattice anti-isomorphism (De Morgan: it swapsminandmax). -
lake buildis green; every headline theorem depends only onpropext(+Quot.sound) — nosorry, noClassical.choice.
lake build # toolchain auto-read from ./lean-toolchain; no network deps
# axiom audit
lake env lean /dev/stdin <<'EOF'
import TropicalSessionTypes
import TropicalAdapterPath
#print axioms Hyperpolymath.Tropical.soundness
#print axioms Hyperpolymath.ProtocolSquisher.Tropical.hub_ceiling
EOFCI (.github/workflows/lean.yml) runs lake build + this audit and fails on any
sorry/Classical.choice.
Namespace Hyperpolymath.Tropical. Grades speculative session types so the static
type-level cost equals the dynamic wall-clock cost.
| Construct | Meaning |
|---|---|
Tropical |
carrier val n | bot; bot = −∞ (identity of max) |
tAdd / tMul
|
⊕ = max, ⊗ = + |
CommSemiring Tropical |
all 13 laws wired |
Session / grade / Span
|
sessions; static grade; dynamic span |
soundness |
grade s = val (Span s) |
tropical_grade_le_sequentialTotal |
Span s ≤ sequentialTotal s (QTT refinement) |
Toolchain note: Lean 4.13.0 core ships
Zerobut notOne, so the file defines a minimal localOne+OfNat _ 1bridge to keep1notation working without Mathlib.
Namespace Hyperpolymath.ProtocolSquisher.Tropical. Grades adapter paths in Protocol
Squisher's 4-class transport semilattice (Concorde / Business / Economy / Wheelbarrow),
where path cost is the bottleneck (worst step).
| Construct | Meaning |
|---|---|
TransportClass / grade / maxGrade
|
4 classes embedded as 0..3 (0 = best) |
tcJoin + lemmas |
worst-of-two join semilattice |
AdapterPath (abbrev) / pathCost
|
path and its bottleneck cost |
min-max semiring (tcAdd/tcMul/…) |
⊕ = min, ⊗ = max (a dioid) |
minimax_path_optimal |
foldl-min over alternatives = optimal path |
hub_ceiling |
the no-go corollary (below) |
hub_ceiling : e ∈ path → grade e ≤ pathCost path. Any path through an edge of grade g
costs at least g, so one shared hub caps the fidelity of every format passing through
it: "universal" and "high fidelity" are contradictory the moment any format embeds at
grade > 0; universal low fidelity is the achievable point (that is what JSON already is).
This closes Protocol Squisher's universal-interoperability claim using its own algebra.
dualGrade n = maxGrade − min n maxGrade — the order-reversing involution on [0, maxGrade].
| Theorem | Statement |
|---|---|
dualGrade_invol |
dualGrade (dualGrade n) = n for n ≤ maxGrade
|
dual_tcAdd_is_max |
dual (min a b) = max (dual a) (dual b) |
dual_tcMul_is_min |
dual (max a b) = min (dual a) (dual b) |
dualGrade is a lattice anti-isomorphism that swaps min and max by De Morgan. It
is not a semiring homomorphism from (min,max) to (max,+).
Correction (2026-06-11). The inherited file contained
dual_tcMul_boundedassertingdual (max m n) = dual m + dual n − maxGrade, which is false (m=1, n=2: LHS 1, RHS 0). It is replaced by the true De Morgan dualdual_tcMul_is_min. The migration repaired theorems; it did not force-prove the false one.
The min-max file's source is the frozen provenance archive in the sibling repo,
protocol-squisher/provenance/proofs/tropical/TropicalAdapterPath.lean — that copy is
evidence and is left unchanged. As inherited, neither twin compiled on any installed
toolchain (the headers' "Verified" claims were never true — corroborating
protocol-squisher's PROVENANCE.adoc). Only pathCost_mono and hub_ceiling had
previously been machine-checked, in isolation.
| Theorem | File | Axioms |
|---|---|---|
soundness |
SessionTypes | propext |
tropical_grade_le_sequentialTotal |
SessionTypes | propext, Quot.sound |
grade_ne_bot |
SessionTypes | propext |
pathCost_mono |
AdapterPath | propext |
hub_ceiling |
AdapterPath | propext |
pathCost_append |
AdapterPath | propext, Quot.sound |
pathCost_le_sequential |
AdapterPath | propext, Quot.sound |
dualGrade_invol |
AdapterPath | propext, Quot.sound |
dual_tcAdd_is_max |
AdapterPath | propext, Quot.sound |
dual_tcMul_is_min |
AdapterPath | propext, Quot.sound |
See also: Formal Verification Status · Home