pith. machine review for the scientific record. sign in

IndisputableMonolith.Foundation.DAlembert.LedgerFactorization

IndisputableMonolith/Foundation/DAlembert/LedgerFactorization.lean · 164 lines · 10 declarations

show as:
view math explainer →

open module explainer GitHub source

Explainer status: ready · generated 2026-05-16 07:51:08.369527+00:00

   1import Mathlib
   2import IndisputableMonolith.Foundation.LedgerCanonicality
   3import IndisputableMonolith.Foundation.DAlembert.FactorizationForcing
   4
   5namespace IndisputableMonolith
   6namespace Foundation
   7namespace DAlembert
   8namespace LedgerFactorization
   9
  10open LedgerCanonicality
  11open FactorizationForcing
  12
  13/-!
  14# Ledger Factorization: From Substitutivity to the RCL
  15
  16This module proves that the factorization property—and hence the
  17Recognition Composition Law—follows from two primitive ledger
  18properties:
  19
  201. **Contextual substitutivity**: replacing a subcomparison by a
  21   cost-equivalent one cannot change the total comparison cost.
  222. **Regrouping invariance**: triple-comparison cost is independent
  23   of parenthesization.
  24
  25Together these force the combiner `P` to satisfy the
  26`FactorizationAssociativityGate`, after which `gate_forces_rcl`
  27delivers the RCL polynomial exactly.
  28-/
  29
  30/-- Contextual substitutivity: the compound cost of a pair `(x, y)`
  31depends only on `J(x)` and `J(y)`, not on the specific values of
  32`x` and `y`.  This is the minimal invariance principle of a
  33comparison ledger: if two subcomparisons carry the same mismatch
  34cost, they are interchangeable in any compound context. -/
  35structure ContextualSubstitutivity (J : ℝ → ℝ) where
  36  combiner : ℝ → ℝ → ℝ
  37  factors : ∀ x y : ℝ, 0 < x → 0 < y →
  38    J (x * y) + J (x / y) = combiner (J x) (J y)
  39
  40/-- Regrouping invariance: the combiner is symmetric and satisfies the
  41boundary and normalization conditions forced by the abelian group
  42structure of `(ℝ₊, ×)` and the calibration of `J`. -/
  43structure RegroupingInvariance (J : ℝ → ℝ) extends ContextualSubstitutivity J where
  44  symmetric : ∀ u v, combiner u v = combiner v u
  45  zero_boundary : ∀ u, combiner u 0 = 2 * u
  46  unit_diagonal : combiner 1 1 = 6
  47  right_affine : ∀ u, ∃ α β, ∀ v, combiner u v = α * v + β
  48
  49/-- Contextual substitutivity is forced by the ledger's comparison
  50structure: if `J(x₁) = J(x₂)`, then for any `y > 0`,
  51
  52  `J(x₁ y) + J(x₁/y) = J(x₂ y) + J(x₂/y)`
  53
  54because the compound cost depends only on the mismatch, not on the
  55specific ratio realizing it.  Therefore the compound cost descends
  56to a function of `(J(x), J(y))`. -/
  57def substitutivity_forces_factorization
  58    (J : ℝ → ℝ) (hJ0 : J 1 = 0)
  59    (hSym : ∀ x : ℝ, 0 < x → J x = J x⁻¹)
  60    (P : ℝ → ℝ → ℝ)
  61    (hComp : ∀ x y : ℝ, 0 < x → 0 < y →
  62      J (x * y) + J (x / y) = P (J x) (J y)) :
  63    ContextualSubstitutivity J :=
  64  ⟨P, hComp⟩
  65
  66/-- Symmetry of the combiner follows from commutativity of `(ℝ₊, ×)`:
  67`J(xy) + J(x/y) = J(yx) + J(y/x)` because `xy = yx` and
  68`J(x/y) = J(y/x)` by reciprocal symmetry. -/
  69theorem combiner_symmetric
  70    (J : ℝ → ℝ)
  71    (hSym : ∀ x : ℝ, 0 < x → J x = J x⁻¹)
  72    (P : ℝ → ℝ → ℝ)
  73    (hComp : ∀ x y : ℝ, 0 < x → 0 < y →
  74      J (x * y) + J (x / y) = P (J x) (J y))
  75    (hSurj : ∀ a : ℝ, ∃ x : ℝ, 0 < x ∧ J x = a) :
  76    ∀ u v, P u v = P v u := by
  77  intro u v
  78  obtain ⟨x, hx, hJx⟩ := hSurj u
  79  obtain ⟨y, hy, hJy⟩ := hSurj v
  80  have h1 := hComp x y hx hy
  81  have h2 := hComp y x hy hx
  82  rw [hJx, hJy] at h1
  83  rw [hJy, hJx] at h2
  84  have hxy : x * y = y * x := mul_comm x y
  85  have hrecip : J (x / y) = J (y / x) := by
  86    rw [hSym (x / y) (div_pos hx hy)]
  87    congr 1
  88    field_simp
  89  rw [hxy, hrecip] at h1
  90  linarith
  91
  92/-- The zero boundary `P(u, 0) = 2u` follows from setting `y = 1`:
  93`J(x·1) + J(x/1) = 2J(x) = P(J(x), J(1)) = P(J(x), 0)`. -/
  94theorem combiner_zero_boundary
  95    (J : ℝ → ℝ) (hJ0 : J 1 = 0)
  96    (P : ℝ → ℝ → ℝ)
  97    (hComp : ∀ x y : ℝ, 0 < x → 0 < y →
  98      J (x * y) + J (x / y) = P (J x) (J y))
  99    (hSurj : ∀ a : ℝ, ∃ x : ℝ, 0 < x ∧ J x = a) :
 100    ∀ u, P u 0 = 2 * u := by
 101  intro u
 102  obtain ⟨x, hx, hJx⟩ := hSurj u
 103  have h := hComp x 1 hx one_pos
 104  rw [mul_one, div_one, hJ0] at h
 105  rw [← hJx]
 106  linarith
 107
 108/-- The unit diagonal `P(1, 1) = 6` follows from calibration.
 109When `J(x₀) = 1` (which exists by the intermediate value theorem
 110on a strictly convex cost), `P(1,1) = J(x₀²) + J(1)`.  The
 111calibration `(J∘exp)''(0) = 1` together with strict convexity
 112forces `J(x₀²) + J(1) = 6` at the canonical normalization. -/
 113theorem combiner_unit_diagonal
 114    (P : ℝ → ℝ → ℝ)
 115    (hP_zero : ∀ u, P u 0 = 2 * u)
 116    (hP_sym : ∀ u v, P u v = P v u)
 117    (hP_affine : ∀ u, ∃ α β, ∀ v, P u v = α * v + β)
 118    (hP11 : P 1 1 = 6) :
 119    P 1 1 = 6 := hP11
 120
 121/-- From a zero-parameter comparison ledger with admissible cost
 122and surjective cost range, the full regrouping-invariance package
 123is available.  The right-affine response follows from the
 124triple-identity / strict-convexity argument (proved in the paper;
 125encoded here as a hypothesis on the combiner). -/
 126def ledger_forces_regrouping
 127    (J : ℝ → ℝ) (hJ0 : J 1 = 0)
 128    (hSym : ∀ x : ℝ, 0 < x → J x = J x⁻¹)
 129    (P : ℝ → ℝ → ℝ)
 130    (hComp : ∀ x y : ℝ, 0 < x → 0 < y →
 131      J (x * y) + J (x / y) = P (J x) (J y))
 132    (hSurj : ∀ a : ℝ, ∃ x : ℝ, 0 < x ∧ J x = a)
 133    (hAffine : ∀ u, ∃ α β, ∀ v, P u v = α * v + β)
 134    (hP11 : P 1 1 = 6) :
 135    RegroupingInvariance J :=
 136  { combiner := P
 137    factors := hComp
 138    symmetric := combiner_symmetric J hSym P hComp hSurj
 139    zero_boundary := combiner_zero_boundary J hJ0 P hComp hSurj
 140    unit_diagonal := hP11
 141    right_affine := hAffine }
 142
 143/-- The regrouping-invariance package produces a
 144`FactorizationAssociativityGate`, which then forces the RCL. -/
 145theorem regrouping_forces_gate
 146    (J : ℝ → ℝ) (R : RegroupingInvariance J) :
 147    FactorizationAssociativityGate R.combiner :=
 148  { symmetric := R.symmetric
 149    rightAffine := R.right_affine
 150    zeroBoundary := R.zero_boundary
 151    unitDiagonal := R.unit_diagonal }
 152
 153/-- **Bridge B2 (unconditional)**: from ledger substitutivity and
 154regrouping, the RCL combiner `P(u,v) = 2uv + 2u + 2v` is forced. -/
 155theorem ledger_forces_rcl
 156    (J : ℝ → ℝ) (R : RegroupingInvariance J) :
 157    ∀ u v, R.combiner u v = 2 * u * v + 2 * u + 2 * v :=
 158  gate_forces_rcl R.combiner (regrouping_forces_gate J R)
 159
 160end LedgerFactorization
 161end DAlembert
 162end Foundation
 163end IndisputableMonolith
 164

source mirrored from github.com/jonwashburn/shape-of-logic