Encyclopedia Cost Cost Uniqueness
ARTICLE 343 claims 320 theorems 2 measured
Cost Uniqueness
The condition that the first derivative of the transformed cost vanishes at zero is what selects cosh, and with it the unique cost function, from the family of solutions to the composition law.
The role of the zero derivative
The uniqueness proof for the cost function J(x) = (x + 1/x)/2 - 1 depends on a specific initial condition: after a change of variables into log coordinates, the function H(t) = F(e^t) + 1 must have derivative zero at t = 0. This condition, deriv H 0 = 0, is not one of the five stated axioms. It is a consequence of the reciprocal symmetry axiom, which forces the transformed function to be even, and an even function that is differentiable at zero must have zero derivative there.
If even_deriv_at_zero were false or dropped, the composition law would still force H to satisfy the d'Alembert equation H(t+u) + H(t-u) = 2 H(t) H(u). The general continuous solutions to that equation are H(t) = cosh(κ t) for a real parameter κ, together with the degenerate case H(t) = 0. The log-curvature calibration condition, which fixes the second derivative at zero to be 1, would then force κ = 1, giving H(t) = cosh(t) and hence the unique cost. But without the zero-derivative condition, the calibration alone does not select cosh: the family cosh(κ t) with κ ≠ 1 also satisfies the composition law and the same normalization H(0) = 1, and each would produce a different cost function.
The theorem law_of_logic_forces_jcost states that the five axioms together force J. The proof of that theorem relies on the d'Alembert solution theorem, which takes deriv H 0 = 0 as an explicit hypothesis. If that hypothesis were dropped, the conclusion would fail: the axioms would no longer single out one cost function. The reciprocal symmetry axiom is what supplies the zero derivative, so dropping even_deriv_at_zero is not a separate weakening; it is the same as dropping reciprocal symmetry. The uniqueness story therefore rests on the fact that looking both ways is free, and that fact is what kills the extra parameter in the cosh family.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_deriv_zero : deriv H 0 = 0 := by
have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert
have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt
exact even_deriv_at_zero H h_even h_diff
exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Lemma 2.1**: If F is reciprocal, then G(t) = F(e^t) is even. -/
theorem reciprocal_implies_G_even (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) :
Function.Even (G F) :=
G_even_of_reciprocal_symmetry F (fun {x} hx => hRecip x hx)
The differentiability hypothesis
The uniqueness theorem forces the cost function to be J(x) = (x + 1/x)/2 - 1 from five conditions. One of those conditions is continuity. The proof needs more than continuity to reach the differential equation whose solution is cosh. It needs a second derivative. The gap between the two is bridged by a package of regularity hypotheses drawn from Aczél theory.
cosh_satisfies_differentiable is one of those hypotheses. It states that the hyperbolic cosine satisfies the differentiability condition required by the regularity package. In the formal proof this declaration is a small lemma, one of three that verify the package for cosh. The other two cover continuity and the bootstrap from differentiability to smoothness. Together they confirm that the candidate solution passes through the same regularity machinery that the uniqueness theorem uses.
The declaration contributes to the proof of dAlembert_cosh_solution_of_log_curvature, which derives cosh from the d'Alembert equation plus a log-curvature calibration. That theorem in turn feeds the main uniqueness result. Without these regularity checks the derivation would stop at continuity and never reach the second derivative that selects cosh. The declaration is therefore not a separate result about cost; it is a supporting lemma that keeps the proof of the main theorem honest.
For the cost-uniqueness page the declaration belongs in the apparatus, not in the lead. The page teaches that five conditions force one cost function. The regularity package is an internal detail of how the proof crosses from continuity to differentiability. A reader who wants the full chain can follow the machine-checked anchors. A reader who wants the idea can stop at the five conditions and the conclusion.
THEOREM cosh_satisfies_differentiable · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh is differentiable. -/
theorem cosh_satisfies_differentiable : ode_regularity_differentiable_hypothesis Real.cosh := by
intro _ _
exact Real.differentiable_cosh
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The addition law
Recognition costs obey a forced composition rule: the cost of recognizing a product of two ratios plus the cost of recognizing their quotient equals a fixed expression in the two individual costs. The theorem composition_law_equiv_coshAdd proves this rule is equivalent to a statement about the cost in log coordinates, where the ratio x becomes the shift t = log x. In those coordinates the cost function G satisfies DirectCoshAdd: for any two shifts t and u, G(t+u) + G(t-u) equals 2 times G(t) times G(u) plus 2 times G(t) plus 2 times G(u).
The plain meaning is that the composition law, which looks like a rule about multiplying and dividing ratios, is really a rule about adding and subtracting shifts. Multiplication of positive ratios becomes addition of real shifts under the logarithm, and the composition law becomes an addition identity for the cost in that coordinate. The definition DirectCoshAdd states this identity directly, without mentioning ratios at all.
The identity earns its name because the unique cost function J(x) = (x + 1/x)/2 - 1 satisfies it. In log coordinates that cost is cosh(t) - 1, and the theorem Jcost_cosh_add_identity verifies the addition identity for that function. The theorem composition_logCurvature_forces_jcost then shows that the composition law together with a log-curvature calibration forces the cost to be exactly J. The addition law is the bridge that lets the uniqueness proof pass from the five plain conditions to the explicit formula.
DirectCoshAdd belongs on the cost uniqueness page because it is the form of the composition law that makes the proof work. It converts a functional equation about ratios into a functional equation about shifts, and that converted form is what connects to the hyperbolic cosine and its uniqueness. The page's main theorem, law_of_logic_forces_jcost, relies on this passage through log coordinates to reach the conclusion that only one cost function survives the five conditions.
THEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G.
Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y)
becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t)
via the substitution x = e^s, y = e^t. -/
theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) :
SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by
constructor
· intro hComp t u
have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t
have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u
have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos
-- exp(t) * exp(u) = exp(t + u)
have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm
-- exp(t) / exp(u) = exp(t - u)
have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by
rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg]
simp only [G, h1, h2] at h ⊢
linarith
· intro hCosh x y hx hy
let t := Real.log x
let u := Real.log y
have hx_eq : x = Real.exp t := (Real.exp_log hx).symm
have hy_eq : y = Real.exp u := (Real.exp_log hy).symm
have h := hCosh t u
simp only [G] at h
rw [hx_eq, hy_eq]
rw [← Real.exp_add, ← Real.exp_sub]
-- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u))
-- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u)
calc F (Real.exp (t + u)) + F (Real.exp (t - u))
= 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h
_ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ring
THEOREM Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_cosh_add_identity : CoshAddIdentity Cost.Jcost := by
intro t u
simp only [G, Jcost]
-- Use exp(t+u) = exp(t)*exp(u) and exp(t-u) = exp(t)/exp(u)
have he1 : Real.exp (t + u) = Real.exp t * Real.exp u := Real.exp_add t u
have he2 : Real.exp (t - u) = Real.exp t / Real.exp u := by
rw [sub_eq_add_neg, Real.exp_add, Real.exp_neg]
ring
have hpos_t : Real.exp t > 0 := Real.exp_pos t
have hpos_u : Real.exp u > 0 := Real.exp_pos u
have hne_t : Real.exp t ≠ 0 := hpos_t.ne'
have hne_u : Real.exp u ≠ 0 := hpos_u.ne'
rw [he1, he2]
field_simp
ring
THEOREM composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **The cost theorem on two premises.** The composition law and unit log
curvature force `F = J` on the positives. Normalization, nonnegativity, and
continuity are all conclusions rather than hypotheses; compare
`law_of_logic_forces_jcost`, which assumes all of them. -/
theorem composition_logCurvature_forces_jcost [AczelSmoothnessPackage]
(F : ℝ → ℝ)
(hComp : SatisfiesCompositionLaw F)
(hκ : HasLogCurvature (H F) 1) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
have hNorm : IsNormalized F := logCurvature_forces_normalized F hComp hκ
have hN : F 1 = 0 := hNorm
have hH0 : H F 0 = 1 := by simp [H, G, hN]
have hCosh : CoshAddIdentity F := (composition_law_equiv_coshAdd F).mp hComp
have hdA : ∀ t u, H F (t + u) + H F (t - u) = 2 * H F t * H F u := by
intro t u
have hG := hCosh t u
have hgoal :
(G F (t + u) + 1) + (G F (t - u) + 1) =
2 * (G F t + 1) * (G F u + 1) := by
calc
(G F (t + u) + 1) + (G F (t - u) + 1)
= (G F (t + u) + G F (t - u)) + 2 := by ring
_ = (2 * (G F t * G F u) + 2 * (G F t + G F u)) + 2 := by simpa [hG]
_ = 2 * (G F t + 1) * (G F u + 1) := by ring
simpa [H] using hgoal
have hcont : Continuous (H F) :=
dAlembert_continuous_of_log_curvature (H F) hH0 hdA hκ
have hsm : ContDiff ℝ ⊤ (H F) := aczel_dAlembert_smooth (H F) hH0 hcont hdA
have heven : Function.Even (H F) := dAlembert_even (H F) hH0 hdA
have hd0 : deriv (H F) 0 = 0 :=
even_deriv_at_zero (H F) heven
(hsm.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) 0)
have hd2 : deriv (deriv (H F)) 0 = 1 :=
deriv2_of_logCurvature (H F) hsm hH0 hd0 hκ
have hcosh : ∀ t, H F t = Real.cosh t :=
dAlembert_cosh_solution_aczel (H F) hH0 hcont hdA hd2
intro x hx
have hGc : G F (Real.log x) = Real.cosh (Real.log x) - 1 := by
have h := hcosh (Real.log x)
simp only [H] at h
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc
F x = F (Real.exp (Real.log x)) := by rw [ht]
_ = G F (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := hGc
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The double-angle lemma
The cost uniqueness story does not depend on dAlembert_double as a separate premise. In the machine-checked development, dAlembert_double is a lemma derived from the composition law (the rule that costs combine by a fixed formula, not by taste) together with the normalization H 0 = 1. It states that for any function H satisfying the composition law, H (2 * t) = 2 * (H t)^2 - 1. The derivation is a direct algebraic consequence: it follows by substituting u = t into the composition identity H (t+u) + H (t-u) = 2 * H t * H u.
Because dAlembert_double is derived, not assumed, the main theorem law_of_logic_forces_jcost does not list it among its hypotheses. That theorem shows that any function F satisfying reciprocal symmetry, normalization, the composition law, calibration, and continuity must equal the cost function J(x) = (x + 1/x)/2 - 1. The proof route passes through the composition law, which is equivalent to a hyperbolic-cosine addition identity, and then through a d'Alembert equation whose solution is forced to be cosh. The double-angle lemma is one of several algebraic tools used inside that route, but it is not a load-bearing axiom.
If dAlembert_double were false, that would mean the composition law itself was inconsistent, since the lemma is a theorem of it. If the lemma were merely dropped from the library, the uniqueness proof would still go through, because the proof does not rely on it as an unproved assumption. The same holds for the other helper lemmas such as dAlembert_product and dAlembert_diff_square: they are consequences of the same composition law, not independent requirements. The five plain conditions are what force the cost function; the lemmas are the working parts of that forcing, not extra conditions on it.
THEOREM dAlembert_double · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_double
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (t : ℝ) :
H (2 * t) = 2 * (H t)^2 - 1 := by
have h := h_dAlembert t t
have h' : H (t + t) = 2 * (H t)^2 - 1 := by
-- H(2t) + H(0) = 2 H(t)^2
have h0 : H (t + t) + 1 = 2 * H t * H t := by
simpa [h_one] using h
have h1 : H (t + t) = 2 * H t * H t - 1 := by
linarith
simpa [pow_two, mul_assoc] using h1
simpa [two_mul] using h'
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G.
Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y)
becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t)
via the substitution x = e^s, y = e^t. -/
theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) :
SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by
constructor
· intro hComp t u
have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t
have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u
have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos
-- exp(t) * exp(u) = exp(t + u)
have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm
-- exp(t) / exp(u) = exp(t - u)
have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by
rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg]
simp only [G, h1, h2] at h ⊢
linarith
· intro hCosh x y hx hy
let t := Real.log x
let u := Real.log y
have hx_eq : x = Real.exp t := (Real.exp_log hx).symm
have hy_eq : y = Real.exp u := (Real.exp_log hy).symm
have h := hCosh t u
simp only [G] at h
rw [hx_eq, hy_eq]
rw [← Real.exp_add, ← Real.exp_sub]
-- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u))
-- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u)
calc F (Real.exp (t + u)) + F (Real.exp (t - u))
= 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h
_ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ring
Continuity at the origin
Recognition costs, the amounts posted when something is recognized, are forced into one formula by five plain conditions. The proof of that forcing result reaches a differential equation in log coordinates, where the transformed function H(t) = F(e^t) + 1 must satisfy H'' = H. To conclude that H is cosh, the proof needs to rule out other solutions. The lemma tendsto_H_one_of_log_curvature is a small but necessary step in that exclusion.
In plain language, the lemma says this: if a function H has value 1 at 0, and if its log-curvature (the limit of 2(H(t) - 1)/t² as t approaches 0) exists, then H(t) tends to 1 as t tends to 0. The function is continuous at the origin. This is not an axiom. It is a derived theorem, established from the definition of HasLogCurvature together with the initial condition H(0) = 1. The proof uses the fact that the curvature limit is taken at 0, so the numerator 2(H(t) - 1) must vanish as t goes to 0.
The lemma belongs on the cost uniqueness page because it supplies the continuity at zero that the uniqueness argument needs. The differential equation H'' = H has many solutions, but the ones that matter are those compatible with the recognition conditions. The condition H(0) = 1 is given. The log-curvature condition is also given. The lemma converts those two into a continuity fact, which is one of the ingredients the proof uses to select cosh as the only solution. It is a quiet lemma, but it closes a gap that would otherwise leave the uniqueness claim incomplete.
THEOREM tendsto_H_one_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- Unit log curvature plus `H 0 = 1` give the two-sided limit at the origin.
The curvature hypothesis lives on the punctured filter, so the value at the
origin is supplied by `h_one` rather than assumed away. -/
lemma tendsto_H_one_of_log_curvature
(H : ℝ → ℝ) (h_one : H 0 = 1) {κ : ℝ} (h_calib : HasLogCurvature H κ) :
Filter.Tendsto H (nhds 0) (nhds 1) := by
have h_t2_div :
Filter.Tendsto (fun t : ℝ => t^2 / 2) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ))
(nhds (0 : ℝ)) := by
have hfull : Filter.Tendsto (fun t : ℝ => t^2 / 2) (nhds (0 : ℝ)) (nhds (0 : ℝ)) := by
simpa using ((continuous_pow 2).div_const 2).tendsto (0 : ℝ)
exact hfull.mono_left nhdsWithin_le_nhds
have h_prod :
Filter.Tendsto (fun t => (t^2 / 2) * (2 * (H t - 1) / t^2))
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds ((0 : ℝ) * κ)) :=
h_t2_div.mul h_calib
have h_sub :
Filter.Tendsto (fun t => H t - 1) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ))
(nhds (0 : ℝ)) := by
have h_congr : ∀ t : ℝ, (t^2 / 2) * (2 * (H t - 1) / t^2) = H t - 1 :=
fun t => (sub_one_eq_mul_ratio H h_one t).symm
simpa using (Filter.Tendsto.congr h_congr h_prod)
have h_punct :
Filter.Tendsto H (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 1) := by
have h_const : Filter.Tendsto (fun _ : ℝ => (1 : ℝ))
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (1 : ℝ)) := tendsto_const_nhds
simpa using h_sub.add h_const
have h_cw : ContinuousWithinAt H ({(0 : ℝ)}ᶜ) 0 := by
unfold ContinuousWithinAt
rw [h_one]
exact h_punct
have h_ca : ContinuousAt H 0 := continuousWithinAt_compl_self.mp h_cw
have h := h_ca.tendsto
rwa [h_one] at h
THEOREM tendsto_H_one_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- Unit log curvature plus `H 0 = 1` give the two-sided limit at the origin.
The curvature hypothesis lives on the punctured filter, so the value at the
origin is supplied by `h_one` rather than assumed away. -/
lemma tendsto_H_one_of_log_curvature
(H : ℝ → ℝ) (h_one : H 0 = 1) {κ : ℝ} (h_calib : HasLogCurvature H κ) :
Filter.Tendsto H (nhds 0) (nhds 1) := by
have h_t2_div :
Filter.Tendsto (fun t : ℝ => t^2 / 2) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ))
(nhds (0 : ℝ)) := by
have hfull : Filter.Tendsto (fun t : ℝ => t^2 / 2) (nhds (0 : ℝ)) (nhds (0 : ℝ)) := by
simpa using ((continuous_pow 2).div_const 2).tendsto (0 : ℝ)
exact hfull.mono_left nhdsWithin_le_nhds
have h_prod :
Filter.Tendsto (fun t => (t^2 / 2) * (2 * (H t - 1) / t^2))
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds ((0 : ℝ) * κ)) :=
h_t2_div.mul h_calib
have h_sub :
Filter.Tendsto (fun t => H t - 1) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ))
(nhds (0 : ℝ)) := by
have h_congr : ∀ t : ℝ, (t^2 / 2) * (2 * (H t - 1) / t^2) = H t - 1 :=
fun t => (sub_one_eq_mul_ratio H h_one t).symm
simpa using (Filter.Tendsto.congr h_congr h_prod)
have h_punct :
Filter.Tendsto H (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 1) := by
have h_const : Filter.Tendsto (fun _ : ℝ => (1 : ℝ))
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (1 : ℝ)) := tendsto_const_nhds
simpa using h_sub.add h_const
have h_cw : ContinuousWithinAt H ({(0 : ℝ)}ᶜ) 0 := by
unfold ContinuousWithinAt
rw [h_one]
exact h_punct
have h_ca : ContinuousAt H 0 := continuousWithinAt_compl_self.mp h_cw
have h := h_ca.tendsto
rwa [h_one] at h
The Compositional Bridge
Recognition (the posting of a cost when something is recognized) is governed by a cost function that must satisfy five plain conditions. The theorem law_of_logic_forces_jcost proves that any cost function meeting all five must equal J(x) = (x + 1/x)/2 - 1. One of those five conditions is the composition law, SatisfiesCompositionLaw, which states how costs combine when two events compose. The identity CoshAddIdentity is not a sixth condition; it is a restatement of that same composition law after a change of variables.
The change of variables is the log-coordinate reparametrization: G_F(t) = F(exp t). In these coordinates, the composition law becomes the identity CoshAddIdentity, which says that G_F(t+u) + G_F(t-u) equals 2 * (G_F t * G_F u) + 2 * (G_F t + G_F u). The theorem composition_law_equiv_coshAdd proves that a function satisfies the composition law if and only if it satisfies CoshAddIdentity. So the two are logically equivalent; dropping one is dropping the other.
What breaks is the proof chain. The uniqueness proof does not use the composition law directly in its multiplicative form. It uses CoshAddIdentity to enter the additive world, where the equation becomes a d'Alembert functional equation. From there, the proof derives that G_F must be cosh(t) - 1, which forces J(x). The theorem composition_logCurvature_forces_jcost shows that composition plus a fixed log-curvature of 1 already forces J(x), and the full theorem law_of_logic_forces_jcost assembles all five conditions. Without CoshAddIdentity, the bridge to the d'Alembert equation is gone, and the remaining conditions do not select a unique cost function.
The consequence is structural. The five conditions are not five independent constraints that happen to intersect at J(x). The composition law is the one that carries the additive structure; the other conditions (reciprocal symmetry, normalization, calibration, continuity) set the scale and regularity but do not by themselves force the cosh shape. Removing CoshAddIdentity leaves a much larger family of possible cost functions, and the uniqueness theorem no longer holds.
THEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G.
Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y)
becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t)
via the substitution x = e^s, y = e^t. -/
theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) :
SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by
constructor
· intro hComp t u
have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t
have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u
have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos
-- exp(t) * exp(u) = exp(t + u)
have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm
-- exp(t) / exp(u) = exp(t - u)
have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by
rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg]
simp only [G, h1, h2] at h ⊢
linarith
· intro hCosh x y hx hy
let t := Real.log x
let u := Real.log y
have hx_eq : x = Real.exp t := (Real.exp_log hx).symm
have hy_eq : y = Real.exp u := (Real.exp_log hy).symm
have h := hCosh t u
simp only [G] at h
rw [hx_eq, hy_eq]
rw [← Real.exp_add, ← Real.exp_sub]
-- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u))
-- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u)
calc F (Real.exp (t + u)) + F (Real.exp (t - u))
= 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h
_ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ring
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **The cost theorem on two premises.** The composition law and unit log
curvature force `F = J` on the positives. Normalization, nonnegativity, and
continuity are all conclusions rather than hypotheses; compare
`law_of_logic_forces_jcost`, which assumes all of them. -/
theorem composition_logCurvature_forces_jcost [AczelSmoothnessPackage]
(F : ℝ → ℝ)
(hComp : SatisfiesCompositionLaw F)
(hκ : HasLogCurvature (H F) 1) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
have hNorm : IsNormalized F := logCurvature_forces_normalized F hComp hκ
have hN : F 1 = 0 := hNorm
have hH0 : H F 0 = 1 := by simp [H, G, hN]
have hCosh : CoshAddIdentity F := (composition_law_equiv_coshAdd F).mp hComp
have hdA : ∀ t u, H F (t + u) + H F (t - u) = 2 * H F t * H F u := by
intro t u
have hG := hCosh t u
have hgoal :
(G F (t + u) + 1) + (G F (t - u) + 1) =
2 * (G F t + 1) * (G F u + 1) := by
calc
(G F (t + u) + 1) + (G F (t - u) + 1)
= (G F (t + u) + G F (t - u)) + 2 := by ring
_ = (2 * (G F t * G F u) + 2 * (G F t + G F u)) + 2 := by simpa [hG]
_ = 2 * (G F t + 1) * (G F u + 1) := by ring
simpa [H] using hgoal
have hcont : Continuous (H F) :=
dAlembert_continuous_of_log_curvature (H F) hH0 hdA hκ
have hsm : ContDiff ℝ ⊤ (H F) := aczel_dAlembert_smooth (H F) hH0 hcont hdA
have heven : Function.Even (H F) := dAlembert_even (H F) hH0 hdA
have hd0 : deriv (H F) 0 = 0 :=
even_deriv_at_zero (H F) heven
(hsm.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) 0)
have hd2 : deriv (deriv (H F)) 0 = 1 :=
deriv2_of_logCurvature (H F) hsm hH0 hd0 hκ
have hcosh : ∀ t, H F t = Real.cosh t :=
dAlembert_cosh_solution_aczel (H F) hH0 hcont hdA hd2
intro x hx
have hGc : G F (Real.log x) = Real.cosh (Real.log x) - 1 := by
have h := hcosh (Real.log x)
simp only [H] at h
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc
F x = F (Real.exp (Real.log x)) := by rw [ht]
_ = G F (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := hGc
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The ODE uniqueness lemma
The lemma ode_cosh_uniqueness is a statement about ordinary differential equations. It says that if a twice-differentiable function H satisfies the equation H''(t) = H(t) for every t, starts at H(0) = 1, and has first derivative zero at zero, then H is exactly the hyperbolic cosine, cosh. No other smooth function can satisfy those three conditions together. The proof in the machine-checked library first extracts continuity and differentiability from the equation itself, then promotes that regularity to twice-differentiability, and finally applies a standard uniqueness result for second-order linear ODEs.
This lemma belongs on the cost uniqueness page because it is the last step of the forcing chain. The uniqueness theorem for the cost function J(x) = (x + 1/x)/2 - 1 is established from five conditions: reciprocal symmetry, normalization, the composition law, calibration, and continuity. The proof transforms the cost into log coordinates, where the composition law becomes a d'Alembert functional equation. That equation, together with a regularity package drawn from Aczél theory, leads to the differential equation H'' = H. The initial conditions H(0) = 1 and H'(0) = 0 come from normalization and from the evenness forced by reciprocal symmetry. Applying ode_cosh_uniqueness then yields H = cosh, and translating back gives the cost function J. The lemma is therefore not a separate result; it is the bridge that turns the functional equation into the explicit formula.
What the lemma adds is precision about the role of regularity. Continuity alone does not force the differential equation; the proof needs a second derivative. The Aczél smoothness package supplies that extra regularity as hypotheses. The lemma itself is cleanly stated: given twice-differentiability and the ODE, uniqueness follows. It is a theorem in the machine-checked library, established without RS-specific axioms, and it anchors the final equality in the main uniqueness proof.
THEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ)
(h_ODE : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := h_cont_hyp h_ODE
have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont
have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff
exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0
THEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ)
(h_ODE : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := h_cont_hyp h_ODE
have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont
have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff
exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM Jcost_G_eq_cosh_sub_one · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_G_eq_cosh_sub_one (t : ℝ) : G Cost.Jcost t = Real.cosh t - 1 := by
simp only [G, Jcost]
-- Jcost(exp t) = (exp t + exp(-t))/2 - 1 = cosh t - 1
have h1 : (Real.exp t)⁻¹ = Real.exp (-t) := by simp [Real.exp_neg]
rw [h1, Real.cosh_eq]
The regularity bridge
The uniqueness theorem forces the cost function to be J(x) = (x + 1/x)/2 - 1 from five conditions, one of which is mere continuity. The proof cannot pass directly from continuity to the second-order differential equation whose solution is cosh. The gap is bridged by a package of regularity hypotheses drawn from Aczél theory, and cosh_dAlembert_to_ODE is the piece that confirms the bridge holds for the model solution itself.
In log coordinates, the cost function becomes H(t) = F(e^t) + 1, and the composition law becomes the d'Alembert equation H(t+u) + H(t-u) = 2 H(t) H(u). The theorem dAlembert_cosh_solution_of_log_curvature shows that if H satisfies this equation, has log curvature 1, and meets five regularity hypotheses, then H is Real.cosh. The regularity hypotheses are not free; each must be verified for the candidate solution. The declaration cosh_dAlembert_to_ODE is exactly that verification for one of the five: it proves that Real.cosh satisfies dAlembert_to_ODE_hypothesis, meaning that from the d'Alembert equation plus the initial condition deriv (deriv H) 0 = 1, the full ODE deriv (deriv H) t = H t follows.
The contribution is therefore not a new theorem about the cost function. It is a completeness check on the proof infrastructure. Without cosh_dAlembert_to_ODE, the chain from the d'Alembert equation to the ODE would have an unverified step for the very function that the uniqueness theorem claims to select. With it, the regularity package is closed: the model solution satisfies every hypothesis the derivation demands. The page should use it, not as a headline result, but as the supporting lemma that makes the uniqueness proof self-contained.
THEOREM cosh_dAlembert_to_ODE · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh satisfies the d'Alembert to ODE hypothesis. -/
theorem cosh_dAlembert_to_ODE : dAlembert_to_ODE_hypothesis Real.cosh := by
intro _ _ _ _
exact cosh_second_deriv_eq
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The role of cosh_initials
The declaration cosh_initials is a theorem in the machine-checked development that states two plain facts about the hyperbolic cosine: at zero it has value one, and its first derivative at zero is zero. These are exactly the initial conditions that the uniqueness proof needs when it solves the differential equation whose solution is forced to be cosh. The theorem is not a new assumption. It is a derived check that the candidate solution satisfies the conditions the proof requires.
On the cost uniqueness page, the main theorem law_of_logic_forces_jcost derives the cost function from five axioms. The proof passes through a change of variables into log coordinates, where the cost becomes a function H with H(0) = 1 and derivative zero at zero. The theorem ode_cosh_uniqueness then uses those two initial conditions together with the differential equation to conclude H is cosh. The declaration cosh_initials supplies exactly those two facts for the candidate. It is a small verification that the solution the proof reaches is consistent with the initial conditions it assumed.
The page should include cosh_initials as a supporting lemma, not as a premise. Its role is to close a gap in the proof narrative: it shows that the function that solves the differential equation also satisfies the initial conditions, so the uniqueness theorem applies. Without it, a reader might wonder whether the initial conditions are compatible with the equation. The theorem is derived directly from the standard facts Real.cosh_zero and Real.deriv_cosh, so it carries no extra assumptions. It is a check, not a contribution to the forcing chain.
THEOREM cosh_initials · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem cosh_initials : Real.cosh 0 = 1 ∧ deriv (fun x => Real.cosh x) 0 = 0 := by
constructor
· simp [Real.cosh_zero]
· have h := Real.deriv_cosh
simp only [h, Real.sinh_zero]
THEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ)
(h_ODE : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := h_cont_hyp h_ODE
have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont
have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff
exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0
THEOREM cosh_initials · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem cosh_initials : Real.cosh 0 = 1 ∧ deriv (fun x => Real.cosh x) 0 = 0 := by
constructor
· simp [Real.cosh_zero]
· have h := Real.deriv_cosh
simp only [h, Real.sinh_zero]
The evenness lemma
Recognition costs obey a symmetry: recognizing a ratio costs the same as recognizing its reciprocal. The theorem G_even_of_reciprocal_symmetry converts that symmetry into a fact about a transformed function. In log coordinates, where a ratio x becomes the shift t = log x, the cost function G(t) satisfies G(t) = G(-t). The function is even.
This evenness is not a separate assumption. It is derived from the reciprocal symmetry axiom alone. The proof is direct: substituting the reciprocal relation into the definition of G and using the logarithm identity log(1/x) = -log x yields the equality. The theorem statement in the machine-checked library records this as reciprocal_implies_G_even, which calls the lemma G_even_of_reciprocal_symmetry.
Why does this belong on the cost uniqueness page? The uniqueness proof for the cost function J(x) = (x + 1/x)/2 - 1 requires an initial condition in log coordinates: the derivative of H(t) = F(e^t) + 1 must be zero at t = 0. That condition is not one of the five stated axioms. It follows from evenness. An even differentiable function has derivative zero at the origin, so the reciprocal symmetry axiom supplies the missing initial condition through this lemma. The evenness lemma is the bridge from the symmetry axiom to the differential equation whose solution is cosh.
The lemma is therefore a load-bearing step in the chain that forces the unique cost function. It shows that one of the five plain conditions, reciprocal symmetry, does double duty: it shapes the function globally and fixes the local behavior at the origin needed for the uniqueness argument.
THEOREM reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Lemma 2.1**: If F is reciprocal, then G(t) = F(e^t) is even. -/
theorem reciprocal_implies_G_even (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) :
Function.Even (G F) :=
G_even_of_reciprocal_symmetry F (fun {x} hx => hRecip x hx)
THEOREM reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Lemma 2.1**: If F is reciprocal, then G(t) = F(e^t) is even. -/
theorem reciprocal_implies_G_even (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) :
Function.Even (G F) :=
G_even_of_reciprocal_symmetry F (fun {x} hx => hRecip x hx)
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The role of deriv_neg_self_zero
The cost uniqueness page currently does not cite deriv_neg_self_zero, and that is the correct choice. The declaration is a helper lemma in the machine-checked proof of ode_cosh_uniqueness_contdiff. It states that if a twice continuously differentiable function f satisfies deriv (deriv f) t = f t for all t, with f 0 = 0 and deriv f 0 = 0, then f is identically zero.
That lemma is one way to exclude the zero solution when solving the differential equation H'' = H. The uniqueness proof needs to show that the only solution with H 0 = 1 and deriv H 0 = 0 is cosh. The standard route applies ode_zero_uniqueness to the difference of two candidate solutions, which reduces the problem to the zero case. The declaration deriv_neg_self_zero is a variant of that same exclusion, packaged for a different formulation of the hypothesis.
For the encyclopedia page, the relevant fact is the final theorem ode_cosh_uniqueness_contdiff, which already carries the full weight of the uniqueness step. The internal helper deriv_neg_self_zero does not add a new mathematical fact about the cost function. It is an implementation detail of the proof script. Including it on the page would clutter the exposition without changing what the reader learns about the forcing result.
The page should stay focused on the theorems that state the uniqueness of the cost function and the lemmas that are directly cited in that statement. The helper lemmas that only appear inside proof scripts are better left out of the permanent reference.
THEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/
theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ)
(h_diff : ContDiff ℝ 2 H)
(h_ode : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0) :
∀ t, H t = Real.cosh t := by
let g := fun t => H t - Real.cosh t
have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh
have hg_ode : ∀ t, deriv (deriv g) t = g t := by
intro t
have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by
ext s; apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by
have hH_diff1 : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff
rw [contDiff_succ_iff_deriv] at h_diff
exact h_diff.2.2
have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by
rw [Real.deriv_cosh]; exact Real.contDiff_sinh
rw [h1]; apply deriv_sub
· exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
· exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
rw [h2, h_ode t, cosh_second_deriv_eq t]
have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero]
have hg'0 : deriv g 0 = 0 := by
have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by
apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring
have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0
intro t
have := hg_zero t
simp only [g] at this; linarith
THEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/
theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ)
(h_diff : ContDiff ℝ 2 H)
(h_ode : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0) :
∀ t, H t = Real.cosh t := by
let g := fun t => H t - Real.cosh t
have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh
have hg_ode : ∀ t, deriv (deriv g) t = g t := by
intro t
have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by
ext s; apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by
have hH_diff1 : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff
rw [contDiff_succ_iff_deriv] at h_diff
exact h_diff.2.2
have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by
rw [Real.deriv_cosh]; exact Real.contDiff_sinh
rw [h1]; apply deriv_sub
· exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
· exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
rw [h2, h_ode t, cosh_second_deriv_eq t]
have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero]
have hg'0 : deriv g 0 = 0 := by
have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by
apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring
have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0
intro t
have := hg_zero t
simp only [g] at this; linarith
The missing unit
Imagine a ruler whose markings tell you the shape of every measurement but never say how long one unit is. The Lean uniqueness theorem proves that the cost function has the form J(x) = (x + 1/x)/2 - 1 once reciprocal symmetry, normalization, the composition law, calibration, and continuity are supplied. The paper's new question is whether calibration itself can be replaced by a structural rule.
Its answer is conditional and sharply divided by the space of ratios. On the countable carrier, meaning the discrete family of ratios supported by the framework, the paper derives on paper that the cheapest cost which charges any distinction is the exponent-one member, the canonical cost above. This turns the unit from a stipulated value into a leastness principle: compare admissible costs pointwise on positive ratios, and choose the one that is no larger than every other nondegenerate candidate. The paper also derives on paper that this leastness condition is equivalent to anchoring the cost at any one non-unit ratio, so the old anchor is identified as a consequence of the ordering rather than an independent physical choice.
The paper adds the boundaries that the Lean uniqueness chain does not state. It derives on paper that every nonnegative integer exponent gives an admissible cost, including even exponents, and that the zero-exponent sign cost charges nothing. Therefore the leastness rule must explicitly exclude the degenerate branch, or it selects a cost that prices no distinction. It also derives on paper that the completed real line has no cheapest positive exponent: costs can always be lowered by halving the exponent, while their infimum is the zero cost. The countable carrier has a bottom because its exponents are discrete; the continuum does not.
Finally, the paper reports a classification program for the countable candidates and states openly that its use of the six exponentials theorem is a named hypothesis, not a result proved in the paper. Its contribution is therefore a scale-selection principle, a discrete-versus-continuous boundary, and explicit nondegeneracy and transcendence conditions. It does not replace the Lean theorem's proof of the cost's shape, and it does not turn those paper arguments into Lean theorems.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The Role of the Limit Lemma
The lemma tendsto_H_one_of_log_curvature states that if a function H satisfies H(0) = 1 and has log-curvature κ at 0, then H tends to 1 as its argument tends to 0. It is not an axiom. It is a derived theorem, established from the definition of HasLogCurvature together with the initial condition H(0) = 1. The proof uses the fact that the curvature limit is taken at 0, so the numerator 2 * (H t - 1) must tend to 0 for the quotient to have a finite limit.
If the lemma were false, the entire uniqueness story would collapse at its first step. The theorem dAlembert_continuous_of_log_curvature, which derives continuity of H from the composition law and the curvature condition, relies on this limit to establish continuity at 0. Without continuity, the Aczél regularity hypotheses cannot be applied, and the chain from the composition law to the differential equation whose solution is cosh would be broken. The final theorem law_of_logic_forces_jcost, which forces the cost function to be J(x) = (x + 1/x)/2 - 1, depends on this chain.
In the actual development the lemma holds, so the story is intact. The curvature condition, together with the composition law, is strong enough to force continuity, and from there the uniqueness proof proceeds. The lemma is a load-bearing but derived piece of the argument, not an independent premise. Its role is to show that the log-curvature hypothesis, which is a local condition at 0, already implies the global continuity that the regularity package needs.
THEOREM tendsto_H_one_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- Unit log curvature plus `H 0 = 1` give the two-sided limit at the origin.
The curvature hypothesis lives on the punctured filter, so the value at the
origin is supplied by `h_one` rather than assumed away. -/
lemma tendsto_H_one_of_log_curvature
(H : ℝ → ℝ) (h_one : H 0 = 1) {κ : ℝ} (h_calib : HasLogCurvature H κ) :
Filter.Tendsto H (nhds 0) (nhds 1) := by
have h_t2_div :
Filter.Tendsto (fun t : ℝ => t^2 / 2) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ))
(nhds (0 : ℝ)) := by
have hfull : Filter.Tendsto (fun t : ℝ => t^2 / 2) (nhds (0 : ℝ)) (nhds (0 : ℝ)) := by
simpa using ((continuous_pow 2).div_const 2).tendsto (0 : ℝ)
exact hfull.mono_left nhdsWithin_le_nhds
have h_prod :
Filter.Tendsto (fun t => (t^2 / 2) * (2 * (H t - 1) / t^2))
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds ((0 : ℝ) * κ)) :=
h_t2_div.mul h_calib
have h_sub :
Filter.Tendsto (fun t => H t - 1) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ))
(nhds (0 : ℝ)) := by
have h_congr : ∀ t : ℝ, (t^2 / 2) * (2 * (H t - 1) / t^2) = H t - 1 :=
fun t => (sub_one_eq_mul_ratio H h_one t).symm
simpa using (Filter.Tendsto.congr h_congr h_prod)
have h_punct :
Filter.Tendsto H (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 1) := by
have h_const : Filter.Tendsto (fun _ : ℝ => (1 : ℝ))
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (1 : ℝ)) := tendsto_const_nhds
simpa using h_sub.add h_const
have h_cw : ContinuousWithinAt H ({(0 : ℝ)}ᶜ) 0 := by
unfold ContinuousWithinAt
rw [h_one]
exact h_punct
have h_ca : ContinuousAt H 0 := continuousWithinAt_compl_self.mp h_cw
have h := h_ca.tendsto
rwa [h_one] at h
THEOREM dAlembert_continuous_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_continuous_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ) :
Continuous H := by
refine continuous_iff_continuousAt.2 ?_
intro t
have h_lim_H : Filter.Tendsto H (nhds 0) (nhds 1) :=
tendsto_H_one_of_log_curvature H h_one h_calib
have h_sum :
Filter.Tendsto (fun u => H (t+u) + H (t-u)) (nhds 0) (nhds (2 * H t)) := by
have h_prod : Filter.Tendsto (fun u => (2 * H t) * H u) (nhds 0)
(nhds ((2 * H t) * (1 : ℝ))) := (tendsto_const_nhds.mul h_lim_H)
have h_prod' : Filter.Tendsto (fun u => 2 * H t * H u) (nhds 0) (nhds (2 * H t)) := by
simpa [mul_assoc] using h_prod
have h_eq : (fun u => H (t+u) + H (t-u)) = fun u => 2 * H t * H u := by
funext u
exact h_dAlembert t u
simpa [h_eq] using h_prod'
have h_diff_sq :
Filter.Tendsto (fun u => (H (t+u) - H (t-u))^2) (nhds 0) (nhds (0 : ℝ)) := by
have h_u_sq : Filter.Tendsto (fun u => (H u)^2) (nhds 0) (nhds ((1 : ℝ)^2)) := by
simpa [pow_two] using h_lim_H.mul h_lim_H
have h_u_sq_sub : Filter.Tendsto (fun u => (H u)^2 - 1) (nhds 0) (nhds (0 : ℝ)) := by
have h_const : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhds 0) (nhds (1 : ℝ)) :=
tendsto_const_nhds
simpa using h_u_sq.sub h_const
have h_const :
Filter.Tendsto (fun _ : ℝ => 4 * ((H t)^2 - 1)) (nhds 0)
(nhds (4 * ((H t)^2 - 1))) := tendsto_const_nhds
have h_mul :
Filter.Tendsto (fun u => (4 * ((H t)^2 - 1)) * ((H u)^2 - 1)) (nhds 0)
(nhds (4 * ((H t)^2 - 1) * (0 : ℝ))) := h_const.mul h_u_sq_sub
have h_eq :
(fun u => (H (t+u) - H (t-u))^2) =
(fun u => 4 * ((H t)^2 - 1) * ((H u)^2 - 1)) := by
funext u
exact dAlembert_diff_square H h_one h_dAlembert t u
simpa [h_eq] using h_mul
have h_abs :
Filter.Tendsto (fun u => |H (t+u) - H (t-u)|) (nhds 0) (nhds (0 : ℝ)) := by
have h_sqrt :
Filter.Tendsto (fun u => Real.sqrt ((H (t+u) - H (t-u))^2)) (nhds 0)
(nhds (Real.sqrt 0)) :=
(Real.continuous_sqrt.tendsto 0).comp h_diff_sq
simpa [Real.sqrt_sq_eq_abs] using h_sqrt
have h_diff :
Filter.Tendsto (fun u => H (t+u) - H (t-u)) (nhds 0) (nhds (0 : ℝ)) :=
(tendsto_zero_iff_abs_tendsto_zero (f := fun u => H (t+u) - H (t-u))).2 h_abs
have h_sum_diff :
Filter.Tendsto
(fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u)))
(nhds 0) (nhds ((2 * H t) + (0 : ℝ))) := h_sum.add h_diff
have h_twice : Filter.Tendsto (fun u => 2 * H (t+u)) (nhds 0) (nhds (2 * H t)) := by
have h_sum_diff' :
Filter.Tendsto
(fun u => H (t+u) + H (t+u))
(nhds 0) (nhds (2 * H t)) := by
have h_eq :
(fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) =
(fun u => H (t+u) + H (t+u)) := by
funext u
ring
have h_sum_diff'' :
Filter.Tendsto
(fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u)))
(nhds 0) (nhds (2 * H t)) := by
simpa using h_sum_diff
simpa [h_eq] using h_sum_diff''
simpa [two_mul] using h_sum_diff'
have h_half :
Filter.Tendsto (fun u => (2 * H (t+u)) / 2) (nhds 0) (nhds ((2 * H t) / 2)) := by
have h_const : Filter.Tendsto (fun _ : ℝ => (1 / 2 : ℝ)) (nhds 0) (nhds (1 / 2 : ℝ)) :=
tendsto_const_nhds
simpa [div_eq_mul_inv] using h_twice.mul h_const
have h_at0 : Filter.Tendsto (fun u => H (t+u)) (nhds 0) (nhds (H t)) := by
simpa using h_half
have h_map :
Filter.Tendsto H (Filter.map (fun u => t + u) (nhds 0)) (nhds (H t)) :=
(Filter.tendsto_map'_iff).2 h_at0
have h_tendsto : Filter.Tendsto H (nhds t) (nhds (H t)) := by
simpa [map_add_left_nhds_zero] using h_map
exact h_tendsto
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The zero-solution lemma
The uniqueness proof for the cost function J(x) = (x + 1/x)/2 - 1 reaches a differential equation in log coordinates: the transformed function H(t) = F(e^t) + 1 must satisfy H'' = H. To conclude that H is cosh, the proof needs to rule out other solutions. The declaration ode_zero_uniqueness is the lemma that performs this exclusion. It states that if a twice continuously differentiable function f satisfies f'' = f, with f(0) = 0 and f'(0) = 0, then f is identically zero.
This lemma is not one of the five axioms that force the cost function. It is a theorem about the differential equation itself, machine-checked inside the development. Its role is to make the final step of the uniqueness argument precise: once the difference between two candidate solutions is shown to satisfy the zero initial conditions, the lemma forces that difference to vanish, leaving a single solution. Without it, the proof would have to argue uniqueness of the differential equation by other means, or leave a gap in the chain from the composition law to cosh.
The lemma contributes to the internal structure of the proof, not to the statement of the uniqueness theorem. The page's central claim, that any cost function meeting the five conditions must equal J, is already established by law_of_logic_forces_jcost. The zero-solution lemma is one of the tools that makes that theorem go through, alongside the regularity hypotheses drawn from Aczél theory. It belongs on the page as a supporting fact, not as a separate premise.
THEOREM ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Zero Uniqueness)**: The unique solution to f'' = f with f(0) = f'(0) = 0 is f = 0. -/
theorem ode_zero_uniqueness (f : ℝ → ℝ)
(h_diff2 : ContDiff ℝ 2 f)
(h_ode : ∀ t, deriv (deriv f) t = f t)
(h_f0 : f 0 = 0)
(h_f'0 : deriv f 0 = 0) :
∀ t, f t = 0 := by
have ⟨h_minus, h_plus⟩ := ode_diagonalization f h_diff2 h_ode
have h_diff1 : Differentiable ℝ f := h_diff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have h_deriv_contdiff : ContDiff ℝ 1 (deriv f) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff2
rw [contDiff_succ_iff_deriv] at h_diff2
exact h_diff2.2.2
have h_diff_deriv : Differentiable ℝ (deriv f) := h_deriv_contdiff.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
let g := fun s => deriv f s - f s
let hf := fun s => deriv f s + f s
have hg_diff : Differentiable ℝ g := h_diff_deriv.sub h_diff1
have hh_diff : Differentiable ℝ hf := h_diff_deriv.add h_diff1
have hg0 : g 0 = 0 := by simp [g, h_f0, h_f'0]
have hh0 : hf 0 = 0 := by simp [hf, h_f0, h_f'0]
have hg_deriv : ∀ t, deriv g t = -g t := h_minus
have hh_deriv : ∀ t, deriv hf t = hf t := h_plus
have hg_zero := deriv_neg_self_zero g hg_diff hg_deriv hg0
have hh_zero := deriv_pos_self_zero hf hh_diff hh_deriv hh0
intro t
have hgt := hg_zero t
have hht := hh_zero t
simp only [g, hf] at hgt hht
linarith
THEOREM ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Zero Uniqueness)**: The unique solution to f'' = f with f(0) = f'(0) = 0 is f = 0. -/
theorem ode_zero_uniqueness (f : ℝ → ℝ)
(h_diff2 : ContDiff ℝ 2 f)
(h_ode : ∀ t, deriv (deriv f) t = f t)
(h_f0 : f 0 = 0)
(h_f'0 : deriv f 0 = 0) :
∀ t, f t = 0 := by
have ⟨h_minus, h_plus⟩ := ode_diagonalization f h_diff2 h_ode
have h_diff1 : Differentiable ℝ f := h_diff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have h_deriv_contdiff : ContDiff ℝ 1 (deriv f) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff2
rw [contDiff_succ_iff_deriv] at h_diff2
exact h_diff2.2.2
have h_diff_deriv : Differentiable ℝ (deriv f) := h_deriv_contdiff.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
let g := fun s => deriv f s - f s
let hf := fun s => deriv f s + f s
have hg_diff : Differentiable ℝ g := h_diff_deriv.sub h_diff1
have hh_diff : Differentiable ℝ hf := h_diff_deriv.add h_diff1
have hg0 : g 0 = 0 := by simp [g, h_f0, h_f'0]
have hh0 : hf 0 = 0 := by simp [hf, h_f0, h_f'0]
have hg_deriv : ∀ t, deriv g t = -g t := h_minus
have hh_deriv : ∀ t, deriv hf t = hf t := h_plus
have hg_zero := deriv_neg_self_zero g hg_diff hg_deriv hg0
have hh_zero := deriv_pos_self_zero hf hh_diff hh_deriv hh0
intro t
have hgt := hg_zero t
have hht := hh_zero t
simp only [g, hf] at hgt hht
linarith
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The Cosh Addition Identity
The theorem Jcost_cosh_add_identity states that the cost function J(x) = (x + 1/x)/2 - 1 obeys a particular algebraic relation when its argument is expressed in log coordinates. In those coordinates, where a ratio x becomes the shift t = log x, the transformed cost G(t) = J(e^t) satisfies the identity G(t+u) + G(t-u) = 2 * G(t) * G(u) + 2 * (G(t) + G(u)) for all real t and u. This is the CoshAddIdentity, so named because the same relation holds for the hyperbolic cosine after a shift by one: cosh(t+u) + cosh(t-u) = 2 * cosh(t) * cosh(u), and the extra linear terms in the cost version arise from the -1 in J.
The identity belongs on the cost uniqueness page because it is the bridge between the composition law and the differential equation. The composition law for a recognition cost F states that F(x*y) + F(x/y) = 2 * F(x) * F(y) + 2 * F(x) + 2 * F(y) for positive x and y. In log coordinates this law is exactly the CoshAddIdentity. The theorem composition_law_equiv_coshAdd proves the equivalence: a function satisfies the composition law if and only if its log-coordinate transform satisfies the CoshAddIdentity. The identity is therefore not an extra assumption; it is the composition law in a different coordinate system.
Once the identity is in place, the uniqueness proof proceeds by showing that the transformed function H(t) = F(e^t) + 1 satisfies the d'Alembert equation H(t+u) + H(t-u) = 2 * H(t) * H(u), and from there a differential equation H'' = H with initial conditions H(0) = 1 and H'(0) = 0. The lemma ode_cosh_uniqueness_contdiff then forces H to be cosh, which gives J as the unique cost. The Jcost_cosh_add_identity theorem confirms that the candidate J itself satisfies the identity, closing the loop: the composition law forces the identity, and the identity forces the unique solution.
THEOREM Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_cosh_add_identity : CoshAddIdentity Cost.Jcost := by
intro t u
simp only [G, Jcost]
-- Use exp(t+u) = exp(t)*exp(u) and exp(t-u) = exp(t)/exp(u)
have he1 : Real.exp (t + u) = Real.exp t * Real.exp u := Real.exp_add t u
have he2 : Real.exp (t - u) = Real.exp t / Real.exp u := by
rw [sub_eq_add_neg, Real.exp_add, Real.exp_neg]
ring
have hpos_t : Real.exp t > 0 := Real.exp_pos t
have hpos_u : Real.exp u > 0 := Real.exp_pos u
have hne_t : Real.exp t ≠ 0 := hpos_t.ne'
have hne_u : Real.exp u ≠ 0 := hpos_u.ne'
rw [he1, he2]
field_simp
ring
THEOREM Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_cosh_add_identity : CoshAddIdentity Cost.Jcost := by
intro t u
simp only [G, Jcost]
-- Use exp(t+u) = exp(t)*exp(u) and exp(t-u) = exp(t)/exp(u)
have he1 : Real.exp (t + u) = Real.exp t * Real.exp u := Real.exp_add t u
have he2 : Real.exp (t - u) = Real.exp t / Real.exp u := by
rw [sub_eq_add_neg, Real.exp_add, Real.exp_neg]
ring
have hpos_t : Real.exp t > 0 := Real.exp_pos t
have hpos_u : Real.exp u > 0 := Real.exp_pos u
have hne_t : Real.exp t ≠ 0 := hpos_t.ne'
have hne_u : Real.exp u ≠ 0 := hpos_u.ne'
rw [he1, he2]
field_simp
ring
THEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G.
Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y)
becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t)
via the substitution x = e^s, y = e^t. -/
theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) :
SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by
constructor
· intro hComp t u
have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t
have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u
have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos
-- exp(t) * exp(u) = exp(t + u)
have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm
-- exp(t) / exp(u) = exp(t - u)
have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by
rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg]
simp only [G, h1, h2] at h ⊢
linarith
· intro hCosh x y hx hy
let t := Real.log x
let u := Real.log y
have hx_eq : x = Real.exp t := (Real.exp_log hx).symm
have hy_eq : y = Real.exp u := (Real.exp_log hy).symm
have h := hCosh t u
simp only [G] at h
rw [hx_eq, hy_eq]
rw [← Real.exp_add, ← Real.exp_sub]
-- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u))
-- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u)
calc F (Real.exp (t + u)) + F (Real.exp (t - u))
= 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h
_ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ring
THEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/
theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ)
(h_diff : ContDiff ℝ 2 H)
(h_ode : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0) :
∀ t, H t = Real.cosh t := by
let g := fun t => H t - Real.cosh t
have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh
have hg_ode : ∀ t, deriv (deriv g) t = g t := by
intro t
have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by
ext s; apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by
have hH_diff1 : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff
rw [contDiff_succ_iff_deriv] at h_diff
exact h_diff.2.2
have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by
rw [Real.deriv_cosh]; exact Real.contDiff_sinh
rw [h1]; apply deriv_sub
· exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
· exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
rw [h2, h_ode t, cosh_second_deriv_eq t]
have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero]
have hg'0 : deriv g 0 = 0 := by
have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by
apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring
have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0
intro t
have := hg_zero t
simp only [g] at this; linarith
The algebraic gate
The cost uniqueness page currently proves its main theorem through a differential equation, a hard analytic step that selects the unique smooth solution. The declaration gate_forces_rcl belongs to a different, purely algebraic corner of the framework. It characterizes a two-argument combiner P(u,v) by four structural conditions: symmetry, affine response in its second argument, a zero boundary law, and a unit diagonal normalization. The theorem states that any such combiner must equal the specific polynomial 2uv + 2u + 2v.
This algebraic gate is not a replacement for the analytic proof on the cost uniqueness page. The two arguments travel different routes to the same destination. The analytic route uses calculus to pin down the unique solution. The algebraic route, formalized in the machine-checked library of formal theorems, shows that once the affine-response step is known, the remaining forcing is pure algebra: symmetry, the boundary law P(u,0) = 2u, and the canonical normalization P(1,1) = 6 together force the RCL polynomial exactly. The theorem factorization_gate_iff_rcl packages this as an equivalence: the gate holds if and only if the combiner is the canonical RCL polynomial.
What the gate contributes to the cost uniqueness page is a secondary, non-analytic confirmation of the same formula. It does not replace the differential equation proof, but it offers an independent algebraic characterization that could serve as a cross-check or as a cleaner path for readers who prefer discrete reasoning over calculus. The page should mention it as a distinct algebraic result, not as part of the main proof chain. Its value is corroborative, not foundational to the existing analytic argument.
THEOREM gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Canonical normalization selects the RCL member of the bilinear family. -/
theorem gate_forces_rcl (P : ℝ → ℝ → ℝ)
(hGate : FactorizationAssociativityGate P) :
∀ u v, P u v = 2 * u * v + 2 * u + 2 * v := by
obtain ⟨c, hc⟩ := gate_forces_bilinear_family P hGate
have hc_two : c = 2 := by
have h11 : P 1 1 = c * 1 * 1 + 2 * 1 + 2 * 1 := by
simpa using hc 1 1
linarith [hGate.unitDiagonal, h11]
intro u v
calc
P u v = c * u * v + 2 * u + 2 * v := hc u v
_ = 2 * u * v + 2 * u + 2 * v := by rw [hc_two]
THEOREM factorization_gate_iff_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Exact gate characterization: the factorization gate is equivalent to being
the canonical RCL combiner. -/
theorem factorization_gate_iff_rcl (P : ℝ → ℝ → ℝ) :
FactorizationAssociativityGate P ↔ ∀ u v, P u v = rclCombiner u v := by
constructor
· intro hGate u v
rw [gate_forces_rcl P hGate u v]
rfl
· intro hP
refine {
symmetric := ?_
rightAffine := ?_
zeroBoundary := ?_
unitDiagonal := ?_
}
· intro u v
rw [hP u v, hP v u]
unfold rclCombiner
ring
· intro u
refine ⟨2 * u + 2, 2 * u, ?_⟩
intro v
rw [hP u v]
unfold rclCombiner
ring
· intro u
rw [hP u 0]
unfold rclCombiner
ring
· rw [hP 1 1]
unfold rclCombiner
norm_num
The uniqueness lemma
The machine-checked lemma ode_cosh_uniqueness_contdiff states a fact about ordinary differential equations. If a function H is twice continuously differentiable, if its second derivative equals the function itself at every point, if H(0) = 1, and if the first derivative at zero is 0, then H is the hyperbolic cosine function cosh. The proof is a theorem in Lean 4, verified with no gaps and no extra axioms.
This lemma belongs on the cost uniqueness page because it closes the last gap in the forcing argument. The derivation of the unique cost function J(x) = (x + 1/x)/2 - 1 reaches a differential equation in log coordinates: the transformed function H(t) must satisfy H'' = H. The equation alone does not pin down H; other functions also satisfy it. The two initial conditions H(0) = 1 and H'(0) = 0, together with the smoothness assumption, are what force the solution to be cosh. Without this lemma, the uniqueness proof would be incomplete.
The lemma is used at the end of the chain that proves the main forcing theorem. It is a standard result from the theory of linear differential equations, but here it is formalized and checked in the same framework as the rest of the cost derivation. The declaration ode_cosh_uniqueness_contdiff is the precise statement that makes the conclusion rigorous: given the equation and the initial conditions, no other twice continuously differentiable function can satisfy them.
THEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/
theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ)
(h_diff : ContDiff ℝ 2 H)
(h_ode : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0) :
∀ t, H t = Real.cosh t := by
let g := fun t => H t - Real.cosh t
have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh
have hg_ode : ∀ t, deriv (deriv g) t = g t := by
intro t
have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by
ext s; apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by
have hH_diff1 : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff
rw [contDiff_succ_iff_deriv] at h_diff
exact h_diff.2.2
have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by
rw [Real.deriv_cosh]; exact Real.contDiff_sinh
rw [h1]; apply deriv_sub
· exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
· exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
rw [h2, h_ode t, cosh_second_deriv_eq t]
have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero]
have hg'0 : deriv g 0 = 0 := by
have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by
apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring
have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0
intro t
have := hg_zero t
simp only [g] at this; linarith
The zero derivative at zero
The lemma even_deriv_at_zero states a plain fact about a function that is even and twice continuously differentiable: if its value at zero is zero and its derivative at zero is zero, then the function is identically zero. In the cost uniqueness proof, this lemma is applied to a difference of two candidate solutions. The difference inherits the differential equation from the candidates, and its initial conditions at zero are both zero, so the lemma forces the difference to vanish everywhere.
This lemma belongs on the cost uniqueness page because it is the step that rules out non-cosh solutions. The uniqueness proof reaches a differential equation in log coordinates, where the transformed function H(t) = F(e^t) + 1 must satisfy H'' = H. To conclude that H is cosh, the proof needs to exclude other solutions of the same equation. The lemma ode_zero_uniqueness performs that exclusion: it states that if a twice continuously differentiable function f satisfies deriv (deriv f) t = f t for all t, with f 0 = 0 and deriv f 0 = 0, then f is identically zero. This is the same structure as even_deriv_at_zero, applied in the proof of ode_cosh_uniqueness_contdiff.
The consequence is that the differential equation H'' = H, together with the initial conditions H(0) = 1 and H'(0) = 0, has exactly one solution: the hyperbolic cosine. The lemma even_deriv_at_zero is not itself a theorem about the cost function; it is a helper lemma in the machine-checked proof of ode_cosh_uniqueness_contdiff. Its role is to close off the alternative solutions, leaving cosh as the only candidate that survives the forcing chain.
THEOREM ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Zero Uniqueness)**: The unique solution to f'' = f with f(0) = f'(0) = 0 is f = 0. -/
theorem ode_zero_uniqueness (f : ℝ → ℝ)
(h_diff2 : ContDiff ℝ 2 f)
(h_ode : ∀ t, deriv (deriv f) t = f t)
(h_f0 : f 0 = 0)
(h_f'0 : deriv f 0 = 0) :
∀ t, f t = 0 := by
have ⟨h_minus, h_plus⟩ := ode_diagonalization f h_diff2 h_ode
have h_diff1 : Differentiable ℝ f := h_diff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have h_deriv_contdiff : ContDiff ℝ 1 (deriv f) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff2
rw [contDiff_succ_iff_deriv] at h_diff2
exact h_diff2.2.2
have h_diff_deriv : Differentiable ℝ (deriv f) := h_deriv_contdiff.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
let g := fun s => deriv f s - f s
let hf := fun s => deriv f s + f s
have hg_diff : Differentiable ℝ g := h_diff_deriv.sub h_diff1
have hh_diff : Differentiable ℝ hf := h_diff_deriv.add h_diff1
have hg0 : g 0 = 0 := by simp [g, h_f0, h_f'0]
have hh0 : hf 0 = 0 := by simp [hf, h_f0, h_f'0]
have hg_deriv : ∀ t, deriv g t = -g t := h_minus
have hh_deriv : ∀ t, deriv hf t = hf t := h_plus
have hg_zero := deriv_neg_self_zero g hg_diff hg_deriv hg0
have hh_zero := deriv_pos_self_zero hf hh_diff hh_deriv hh0
intro t
have hgt := hg_zero t
have hht := hh_zero t
simp only [g, hf] at hgt hht
linarith
THEOREM ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Zero Uniqueness)**: The unique solution to f'' = f with f(0) = f'(0) = 0 is f = 0. -/
theorem ode_zero_uniqueness (f : ℝ → ℝ)
(h_diff2 : ContDiff ℝ 2 f)
(h_ode : ∀ t, deriv (deriv f) t = f t)
(h_f0 : f 0 = 0)
(h_f'0 : deriv f 0 = 0) :
∀ t, f t = 0 := by
have ⟨h_minus, h_plus⟩ := ode_diagonalization f h_diff2 h_ode
have h_diff1 : Differentiable ℝ f := h_diff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have h_deriv_contdiff : ContDiff ℝ 1 (deriv f) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff2
rw [contDiff_succ_iff_deriv] at h_diff2
exact h_diff2.2.2
have h_diff_deriv : Differentiable ℝ (deriv f) := h_deriv_contdiff.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
let g := fun s => deriv f s - f s
let hf := fun s => deriv f s + f s
have hg_diff : Differentiable ℝ g := h_diff_deriv.sub h_diff1
have hh_diff : Differentiable ℝ hf := h_diff_deriv.add h_diff1
have hg0 : g 0 = 0 := by simp [g, h_f0, h_f'0]
have hh0 : hf 0 = 0 := by simp [hf, h_f0, h_f'0]
have hg_deriv : ∀ t, deriv g t = -g t := h_minus
have hh_deriv : ∀ t, deriv hf t = hf t := h_plus
have hg_zero := deriv_neg_self_zero g hg_diff hg_deriv hg0
have hh_zero := deriv_pos_self_zero hf hh_diff hh_deriv hh0
intro t
have hgt := hg_zero t
have hht := hh_zero t
simp only [g, hf] at hgt hht
linarith
THEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/
theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ)
(h_diff : ContDiff ℝ 2 H)
(h_ode : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0) :
∀ t, H t = Real.cosh t := by
let g := fun t => H t - Real.cosh t
have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh
have hg_ode : ∀ t, deriv (deriv g) t = g t := by
intro t
have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by
ext s; apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by
have hH_diff1 : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff
rw [contDiff_succ_iff_deriv] at h_diff
exact h_diff.2.2
have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by
rw [Real.deriv_cosh]; exact Real.contDiff_sinh
rw [h1]; apply deriv_sub
· exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
· exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
rw [h2, h_ode t, cosh_second_deriv_eq t]
have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero]
have hg'0 : deriv g 0 = 0 := by
have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by
apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring
have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0
intro t
have := hg_zero t
simp only [g] at this; linarith
The calibration limit
The cost uniqueness theorem states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. One of those conditions is calibration: near the identity, the cost grows quadratically with a fixed scale. The declaration isCalibratedLimit_of_isCalibrated is a lemma about that local scale. It says that if a function is calibrated, then a certain limit involving its second-order behavior exists and equals the calibration constant. This is a technical bridge: it connects the abstract calibration condition to the concrete limit that the proof uses when it differentiates in log coordinates.
The machine-checked proof of cost uniqueness does not currently use this lemma. The proof instead reaches a differential equation H'' = H for the transformed function H(t) = F(e^t) + 1, and solves it using the d'Alembert functional equation and regularity hypotheses. The lemma would contribute if the proof were reorganized to emphasize the limit formulation of calibration. It would make explicit that the calibration condition, which is stated as a limit, actually pins down the second derivative at zero. That fact is currently buried inside the regularity package that the proof assumes.
Whether the lemma should stay off the page depends on the goal. For a reader following the proof, the lemma is a useful explanatory device: it shows why calibration is strong enough to fix the curvature at the identity. For a reader who only wants the statement of the theorem, it is an internal detail. The page currently serves the second audience. Adding the lemma would help the first audience without changing the theorem. It would not replace the existing proof route, but it would make the role of calibration more transparent.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
The algebraic gate
The declaration gate_forces_rcl is a theorem about a two-input function P(u, v), which the framework uses to combine recognition costs. The theorem states that if P satisfies four plain algebraic conditions, then P must equal the specific polynomial 2uv + 2u + 2v. The conditions are: symmetry (P u v = P v u), affine response in the second argument (for each fixed u, P u v is a linear function of v), a boundary law (P u 0 = 2u), and a normalization (P 1 1 = 6).
This result belongs on the cost uniqueness page because it closes the proof. The hard analytic step, handled elsewhere, shows that the combiner must be affine in its second argument. Once that is established, the remaining forcing is pure algebra. The theorem gate_forces_bilinear_family first shows that symmetry and the boundary law force P to be of the form c*u*v + 2u + 2v for some constant c. Then the normalization P 1 1 = 6 pins down c = 2, yielding the exact RCL combiner. The theorem factorization_gate_iff_rcl strengthens this: satisfying the gate is equivalent to being the canonical combiner.
In plain language, the theorem says that once you know the combiner responds linearly, the remaining requirements leave no freedom. The symmetry, boundary, and normalization conditions each eliminate one possible deviation, and together they force the unique polynomial. This is the algebraic capstone that turns the analytic uniqueness result into a complete forcing chain.
THEOREM gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Canonical normalization selects the RCL member of the bilinear family. -/
theorem gate_forces_rcl (P : ℝ → ℝ → ℝ)
(hGate : FactorizationAssociativityGate P) :
∀ u v, P u v = 2 * u * v + 2 * u + 2 * v := by
obtain ⟨c, hc⟩ := gate_forces_bilinear_family P hGate
have hc_two : c = 2 := by
have h11 : P 1 1 = c * 1 * 1 + 2 * 1 + 2 * 1 := by
simpa using hc 1 1
linarith [hGate.unitDiagonal, h11]
intro u v
calc
P u v = c * u * v + 2 * u + 2 * v := hc u v
_ = 2 * u * v + 2 * u + 2 * v := by rw [hc_two]
THEOREM gate_forces_bilinear_family · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Once the affine-response step is known, symmetry and the boundary law force
the entire bilinear family. -/
theorem gate_forces_bilinear_family (P : ℝ → ℝ → ℝ)
(hGate : FactorizationAssociativityGate P) :
∃ c : ℝ, ∀ u v, P u v = c * u * v + 2 * u + 2 * v := by
classical
choose α β hAffine using hGate.rightAffine
have hβ : ∀ u, β u = 2 * u := by
intro u
have h0 : P u 0 = α u * 0 + β u := hAffine u 0
rw [hGate.zeroBoundary u] at h0
linarith
let c : ℝ := α 1 - 2
refine ⟨c, ?_⟩
intro u v
have hsym1 : P u 1 = P 1 u := hGate.symmetric u 1
have hαu : α u = c * u + 2 := by
dsimp [c]
have hcalc : α u * 1 + β u = α 1 * u + β 1 := by
calc
α u * 1 + β u = P u 1 := by symm; exact hAffine u 1
_ = P 1 u := hGate.symmetric u 1
_ = α 1 * u + β 1 := hAffine 1 u
rw [hβ u, hβ 1] at hcalc
linarith
calc
P u v = α u * v + β u := hAffine u v
_ = (c * u + 2) * v + 2 * u := by rw [hαu, hβ u]
_ = c * u * v + 2 * u + 2 * v := by ring
THEOREM factorization_gate_iff_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Exact gate characterization: the factorization gate is equivalent to being
the canonical RCL combiner. -/
theorem factorization_gate_iff_rcl (P : ℝ → ℝ → ℝ) :
FactorizationAssociativityGate P ↔ ∀ u v, P u v = rclCombiner u v := by
constructor
· intro hGate u v
rw [gate_forces_rcl P hGate u v]
rfl
· intro hP
refine {
symmetric := ?_
rightAffine := ?_
zeroBoundary := ?_
unitDiagonal := ?_
}
· intro u v
rw [hP u v, hP v u]
unfold rclCombiner
ring
· intro u
refine ⟨2 * u + 2, 2 * u, ?_⟩
intro v
rw [hP u v]
unfold rclCombiner
ring
· intro u
rw [hP u 0]
unfold rclCombiner
ring
· rw [hP 1 1]
unfold rclCombiner
norm_num
The regularity step
The lemma cosh_satisfies_continuous states, in plain terms, that the hyperbolic cosine function is continuous on the real line. That fact is a standard property of the function, but in the Recognition Science proof it is not a background assumption. It is a machine-checked theorem that supplies one of the regularity hypotheses required by the uniqueness theorem for the cost function.
The cost uniqueness proof reaches a differential equation in log coordinates. The transformed function H(t) = F(e^t) + 1 must satisfy H'' = H, and the proof must rule out other solutions. The lemma ode_cosh_uniqueness_contdiff performs that exclusion: if a twice continuously differentiable function H satisfies the equation, with H(0) = 1 and H'(0) = 0, then H is cosh. The continuity of cosh is one of the ingredients that the broader uniqueness theorem needs in order to apply. The declaration cosh_satisfies_continuous is the specific proof that the candidate function meets that continuity condition.
The lemma belongs on the cost uniqueness page because it closes a gap in the forcing argument. The page's central result, that the cost function must equal J(x) = (x + 1/x)/2 - 1, depends on showing that the only solution worth selecting is cosh. That selection step requires several regularity checks on the candidate. The continuity lemma is one of those checks, and it is established directly from the definition of cosh rather than assumed. Without it, the uniqueness theorem would have an unfulfilled hypothesis, and the forcing chain would not close.
THEOREM cosh_satisfies_continuous · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh is continuous. -/
theorem cosh_satisfies_continuous : ode_regularity_continuous_hypothesis Real.cosh := by
intro _
exact Real.continuous_cosh
THEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/
theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ)
(h_diff : ContDiff ℝ 2 H)
(h_ode : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0) :
∀ t, H t = Real.cosh t := by
let g := fun t => H t - Real.cosh t
have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh
have hg_ode : ∀ t, deriv (deriv g) t = g t := by
intro t
have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by
ext s; apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by
have hH_diff1 : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff
rw [contDiff_succ_iff_deriv] at h_diff
exact h_diff.2.2
have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by
rw [Real.deriv_cosh]; exact Real.contDiff_sinh
rw [h1]; apply deriv_sub
· exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
· exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
rw [h2, h_ode t, cosh_second_deriv_eq t]
have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero]
have hg'0 : deriv g 0 = 0 := by
have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by
apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring
have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0
intro t
have := hg_zero t
simp only [g] at this; linarith
Continuity from log curvature
The declaration dAlembert_continuous_of_log_curvature is a theorem in the machine-checked proof of cost uniqueness. It states that a function H satisfying the cosine addition identity, with H(0) = 1 and having log-curvature at 0, is continuous everywhere. The log-curvature condition is the calibration input: it fixes the local scale of recognition near the identity. Continuity is the regularity that lets later steps move from the addition identity to the differential equation H'' = H.
The cost uniqueness page should not cite this lemma, because the page's main theorem already carries continuity as an explicit hypothesis. The forcing result law_of_logic_forces_jcost takes ContinuousOn F (Set.Ioi 0) as one of its five plain conditions. In the log-coordinate proof, that continuity is passed forward into the regularity hypotheses that the cosh solution requires. The lemma dAlembert_continuous_of_log_curvature would be needed only in a variant proof that replaced the continuity hypothesis with log-curvature and then derived continuity from it. The page does not use that variant, so citing the lemma would add a redundant path without changing the statement.
The lemma remains useful as a structural fact about the framework. It shows that calibration plus the addition identity already imply the continuity that other arguments assume. That is a genuine derivation, not a definitional choice. But it is a supporting result for alternative proof routes, not a step in the proof the page presents. Leaving it off the page is the correct choice, and the declaration should stay in the module as a helper for any future variant that weakens the continuity hypothesis.
THEOREM dAlembert_continuous_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_continuous_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ) :
Continuous H := by
refine continuous_iff_continuousAt.2 ?_
intro t
have h_lim_H : Filter.Tendsto H (nhds 0) (nhds 1) :=
tendsto_H_one_of_log_curvature H h_one h_calib
have h_sum :
Filter.Tendsto (fun u => H (t+u) + H (t-u)) (nhds 0) (nhds (2 * H t)) := by
have h_prod : Filter.Tendsto (fun u => (2 * H t) * H u) (nhds 0)
(nhds ((2 * H t) * (1 : ℝ))) := (tendsto_const_nhds.mul h_lim_H)
have h_prod' : Filter.Tendsto (fun u => 2 * H t * H u) (nhds 0) (nhds (2 * H t)) := by
simpa [mul_assoc] using h_prod
have h_eq : (fun u => H (t+u) + H (t-u)) = fun u => 2 * H t * H u := by
funext u
exact h_dAlembert t u
simpa [h_eq] using h_prod'
have h_diff_sq :
Filter.Tendsto (fun u => (H (t+u) - H (t-u))^2) (nhds 0) (nhds (0 : ℝ)) := by
have h_u_sq : Filter.Tendsto (fun u => (H u)^2) (nhds 0) (nhds ((1 : ℝ)^2)) := by
simpa [pow_two] using h_lim_H.mul h_lim_H
have h_u_sq_sub : Filter.Tendsto (fun u => (H u)^2 - 1) (nhds 0) (nhds (0 : ℝ)) := by
have h_const : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhds 0) (nhds (1 : ℝ)) :=
tendsto_const_nhds
simpa using h_u_sq.sub h_const
have h_const :
Filter.Tendsto (fun _ : ℝ => 4 * ((H t)^2 - 1)) (nhds 0)
(nhds (4 * ((H t)^2 - 1))) := tendsto_const_nhds
have h_mul :
Filter.Tendsto (fun u => (4 * ((H t)^2 - 1)) * ((H u)^2 - 1)) (nhds 0)
(nhds (4 * ((H t)^2 - 1) * (0 : ℝ))) := h_const.mul h_u_sq_sub
have h_eq :
(fun u => (H (t+u) - H (t-u))^2) =
(fun u => 4 * ((H t)^2 - 1) * ((H u)^2 - 1)) := by
funext u
exact dAlembert_diff_square H h_one h_dAlembert t u
simpa [h_eq] using h_mul
have h_abs :
Filter.Tendsto (fun u => |H (t+u) - H (t-u)|) (nhds 0) (nhds (0 : ℝ)) := by
have h_sqrt :
Filter.Tendsto (fun u => Real.sqrt ((H (t+u) - H (t-u))^2)) (nhds 0)
(nhds (Real.sqrt 0)) :=
(Real.continuous_sqrt.tendsto 0).comp h_diff_sq
simpa [Real.sqrt_sq_eq_abs] using h_sqrt
have h_diff :
Filter.Tendsto (fun u => H (t+u) - H (t-u)) (nhds 0) (nhds (0 : ℝ)) :=
(tendsto_zero_iff_abs_tendsto_zero (f := fun u => H (t+u) - H (t-u))).2 h_abs
have h_sum_diff :
Filter.Tendsto
(fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u)))
(nhds 0) (nhds ((2 * H t) + (0 : ℝ))) := h_sum.add h_diff
have h_twice : Filter.Tendsto (fun u => 2 * H (t+u)) (nhds 0) (nhds (2 * H t)) := by
have h_sum_diff' :
Filter.Tendsto
(fun u => H (t+u) + H (t+u))
(nhds 0) (nhds (2 * H t)) := by
have h_eq :
(fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) =
(fun u => H (t+u) + H (t+u)) := by
funext u
ring
have h_sum_diff'' :
Filter.Tendsto
(fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u)))
(nhds 0) (nhds (2 * H t)) := by
simpa using h_sum_diff
simpa [h_eq] using h_sum_diff''
simpa [two_mul] using h_sum_diff'
have h_half :
Filter.Tendsto (fun u => (2 * H (t+u)) / 2) (nhds 0) (nhds ((2 * H t) / 2)) := by
have h_const : Filter.Tendsto (fun _ : ℝ => (1 / 2 : ℝ)) (nhds 0) (nhds (1 / 2 : ℝ)) :=
tendsto_const_nhds
simpa [div_eq_mul_inv] using h_twice.mul h_const
have h_at0 : Filter.Tendsto (fun u => H (t+u)) (nhds 0) (nhds (H t)) := by
simpa using h_half
have h_map :
Filter.Tendsto H (Filter.map (fun u => t + u) (nhds 0)) (nhds (H t)) :=
(Filter.tendsto_map'_iff).2 h_at0
have h_tendsto : Filter.Tendsto H (nhds t) (nhds (H t)) := by
simpa [map_add_left_nhds_zero] using h_map
exact h_tendsto
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
Regularity bridge
The cost uniqueness proof reaches a differential equation in log coordinates: the transformed function H(t) = F(e^t) + 1 must satisfy H'' = H. To conclude that H is cosh, the proof must rule out other solutions. The declaration ode_regularity_differentiable_of_smooth is one of the regularity hypotheses used in that exclusion step. It states, in effect, that a smooth function satisfying the equation is differentiable, which is a bridge from a smoothness assumption to a differentiability conclusion.
In the library, the uniqueness theorem ode_cosh_uniqueness takes five regularity hypotheses as inputs. One of them, ode_regularity_differentiable_hypothesis, is exactly the kind of assumption that ode_regularity_differentiable_of_smooth would supply. The theorem dAlembert_cosh_solution_of_log_curvature and its variant dAlembert_cosh_solution both list this differentiability hypothesis among their premises. The declaration itself is not a theorem about the cost function; it is a generic regularity bridge, likely used inside the proof of a lemma that turns a smoothness condition into the differentiability condition the uniqueness argument requires.
For the cost uniqueness page, this declaration should stay off the page as a standalone claim. The page's subject is the forcing result: five plain conditions force the cost formula J(x) = (x + 1/x)/2 - 1. A regularity bridge is a technical step inside that proof, not a fact a reader needs to verify independently. The page already cites the theorems that use it, such as ode_cosh_uniqueness and dAlembert_cosh_solution. Adding ode_regularity_differentiable_of_smooth as a separate claim would duplicate the proof chain without adding a new fact about the cost function.
What the declaration contributes is internal: it is part of the machine-checked scaffolding that makes the uniqueness proof go through. The page should mention that the proof uses regularity hypotheses, but it should not list this helper as a claim. The honest placement is in the proof apparatus, not in the prose.
THEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ)
(h_ODE : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := h_cont_hyp h_ODE
have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont
have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff
exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
The Taylor lemma
The declaration taylorWithinEval_one_univ is a general Taylor expansion lemma from the library. It is not used in the machine-checked proof of the cost uniqueness theorem cost uniqueness, the result that any cost function satisfying the five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof reaches a differential equation in log coordinates, where the transformed function H(t) = F(e^t) + 1 must satisfy H'' = H, and it rules out other solutions with the dedicated lemma ode_cosh_uniqueness_contdiff, not with a Taylor expansion.
Leaving taylorWithinEval_one_univ off the page is the correct choice. The page's purpose is to present the forcing chain that derives the unique cost formula, and every lemma cited there has a specific role in that chain. A general Taylor lemma would add no information about why the cost function is unique. It would only distract from the actual structure of the proof, which turns on the d'Alembert equation and the uniqueness of the solution to H'' = H with the initial conditions H(0) = 1 and H'(0) = 0.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/
theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ)
(h_diff : ContDiff ℝ 2 H)
(h_ode : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0) :
∀ t, H t = Real.cosh t := by
let g := fun t => H t - Real.cosh t
have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh
have hg_ode : ∀ t, deriv (deriv g) t = g t := by
intro t
have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by
ext s; apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by
have hH_diff1 : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff
rw [contDiff_succ_iff_deriv] at h_diff
exact h_diff.2.2
have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by
rw [Real.deriv_cosh]; exact Real.contDiff_sinh
rw [h1]; apply deriv_sub
· exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
· exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
rw [h2, h_ode t, cosh_second_deriv_eq t]
have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero]
have hg'0 : deriv g 0 = 0 := by
have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by
apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring
have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0
intro t
have := hg_zero t
simp only [g] at this; linarith
The hidden addition rule
Imagine you are keeping books for the universe. Every time something is recognized, the ledger posts a cost, a number that says how expensive that recognition was. The uniqueness proof on this page shows that only one cost function survives five plain conditions. But the proof has a secret passage: a change of variables that turns the cost into a shape where addition becomes visible.
That passage is what CoshAddIdentity names. Write the cost as a function of a ratio, then switch to logarithms, so multiplication of ratios becomes addition of logarithms. In those coordinates the cost becomes a curve, and CoshAddIdentity says that curve obeys the same addition rule as the hyperbolic cosine: the value at a sum plus the value at a difference equals twice the product of the two values, plus two copies of each. It is the identity that makes the curve recognizable as cosh minus one, and therefore makes the cost itself recognizable as J(x) = (x + 1/x)/2 - 1.
Why does this belong on the cost uniqueness page? Because it is the hinge. The Lean proof of uniqueness, law_of_logic_forces_jcost, takes the five conditions and forces the cost to equal J. One of those conditions, the composition law, is exactly equivalent to CoshAddIdentity: a theorem in the library proves the two statements are interchangeable. So the addition rule is not a separate assumption smuggled in; it is the composition law wearing a different coat. Once the cost satisfies that rule, the rest of the proof is a known path: the curve must be cosh, and the cost must be J.
The practical effect is that the whole uniqueness argument can be read as a single sentence: the five conditions force the cost to satisfy the cosh addition rule, and the cosh addition rule forces the cost to be J. That is what makes the page's central claim feel less like a list of lemmas and more like one continuous push. The reader who sees the addition rule has seen the engine of the proof.
THEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G.
Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y)
becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t)
via the substitution x = e^s, y = e^t. -/
theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) :
SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by
constructor
· intro hComp t u
have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t
have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u
have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos
-- exp(t) * exp(u) = exp(t + u)
have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm
-- exp(t) / exp(u) = exp(t - u)
have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by
rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg]
simp only [G, h1, h2] at h ⊢
linarith
· intro hCosh x y hx hy
let t := Real.log x
let u := Real.log y
have hx_eq : x = Real.exp t := (Real.exp_log hx).symm
have hy_eq : y = Real.exp u := (Real.exp_log hy).symm
have h := hCosh t u
simp only [G] at h
rw [hx_eq, hy_eq]
rw [← Real.exp_add, ← Real.exp_sub]
-- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u))
-- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u)
calc F (Real.exp (t + u)) + F (Real.exp (t - u))
= 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h
_ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ring
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_cosh_add_identity : CoshAddIdentity Cost.Jcost := by
intro t u
simp only [G, Jcost]
-- Use exp(t+u) = exp(t)*exp(u) and exp(t-u) = exp(t)/exp(u)
have he1 : Real.exp (t + u) = Real.exp t * Real.exp u := Real.exp_add t u
have he2 : Real.exp (t - u) = Real.exp t / Real.exp u := by
rw [sub_eq_add_neg, Real.exp_add, Real.exp_neg]
ring
have hpos_t : Real.exp t > 0 := Real.exp_pos t
have hpos_u : Real.exp u > 0 := Real.exp_pos u
have hne_t : Real.exp t ≠ 0 := hpos_t.ne'
have hne_u : Real.exp u ≠ 0 := hpos_u.ne'
rw [he1, he2]
field_simp
ring
The role of cosh_initials
Recognition costs, the amounts posted when something is recognized, are forced into one formula by five plain conditions. The proof of that forcing result reaches a differential equation in log coordinates, where the transformed function H(t) = F(e^t) + 1 must satisfy H'' = H. The equation alone does not select a unique function. It admits many solutions, including exponential combinations and zero. To conclude that H is the hyperbolic cosine, the proof needs two boundary conditions: H(0) = 1 and H'(0) = 0. The theorem cosh_initials supplies exactly those two facts for the candidate solution.
The boundary conditions are not optional decoration. The machine-checked lemma ode_cosh_uniqueness_contdiff states the full uniqueness result: if a twice continuously differentiable function H satisfies H'' = H at every point, with H(0) = 1 and H'(0) = 0, then H is cosh. Remove either initial condition and the conclusion fails. With H(0) = 1 but no condition on the first derivative, the shifted hyperbolic sine functions sinh(t) + cosh(t) also solve the equation. With H'(0) = 0 but no condition at zero, scaled cosines and hyperbolic cosines of different amplitudes remain possible. The two initial conditions together collapse the family to one member.
If cosh_initials were false, the proof of the uniqueness theorem could not go through. The lemma is not an axiom; it is a derived theorem, established from the standard definitions of cosh and sinh. Its content is the elementary fact that cosh(0) = 1 and the derivative of cosh at zero is 0. If the lemma were dropped from the library, the uniqueness theorem would lose its boundary conditions and the forcing chain would stop before reaching J(x) = (x + 1/x)/2 - 1. The cost uniqueness story would be incomplete at the point where the differential equation is solved.
THEOREM cosh_initials · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem cosh_initials : Real.cosh 0 = 1 ∧ deriv (fun x => Real.cosh x) 0 = 0 := by
constructor
· simp [Real.cosh_zero]
· have h := Real.deriv_cosh
simp only [h, Real.sinh_zero]
THEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/
theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ)
(h_diff : ContDiff ℝ 2 H)
(h_ode : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0) :
∀ t, H t = Real.cosh t := by
let g := fun t => H t - Real.cosh t
have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh
have hg_ode : ∀ t, deriv (deriv g) t = g t := by
intro t
have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by
ext s; apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by
have hH_diff1 : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff
rw [contDiff_succ_iff_deriv] at h_diff
exact h_diff.2.2
have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by
rw [Real.deriv_cosh]; exact Real.contDiff_sinh
rw [h1]; apply deriv_sub
· exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
· exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
rw [h2, h_ode t, cosh_second_deriv_eq t]
have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero]
have hg'0 : deriv g 0 = 0 := by
have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by
apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring
have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0
intro t
have := hg_zero t
simp only [g] at this; linarith
THEOREM cosh_initials · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem cosh_initials : Real.cosh 0 = 1 ∧ deriv (fun x => Real.cosh x) 0 = 0 := by
constructor
· simp [Real.cosh_zero]
· have h := Real.deriv_cosh
simp only [h, Real.sinh_zero]
The d'Alembert route
The declaration dAlembert_cosh_solution_of_log_curvature is a theorem that derives the same cosh conclusion as the ODE route, but from the d'Alembert functional equation instead of a second-order differential equation. It states that if a function H satisfies H(0) = 1, obeys the d'Alembert equation H(t+u) + H(t-u) = 2 * H t * H u for all t and u, has log-curvature κ at 0, and has second derivative 1 at 0, then H is the hyperbolic cosine function cosh. The theorem is established in Lean, with the regularity hypotheses packaged as named assumptions.
The cost uniqueness page should not cite this declaration as a standalone result. The page's main theorem, law_of_logic_forces_jcost, already forces the cost function J(x) = (x + 1/x)/2 - 1 from the five plain conditions. That proof reaches the differential equation H'' = H in log coordinates, and then uses ode_cosh_uniqueness_contdiff to conclude H is cosh. The d'Alembert route is an alternative path to the same conclusion: it starts from the composition law, which is equivalent to the d'Alembert equation in log coordinates, and derives the same cosh result through a different chain of lemmas. Both routes are established, but the page already presents the ODE route as the direct proof of the main theorem.
The d'Alembert route does contribute to the framework's robustness. It shows that the cosh conclusion does not depend on the specific path taken after the composition law: whether one goes through the second-order ODE or through the d'Alembert equation, the result is the same. This is a structural fact about the proof, not a new theorem about the cost function itself. The page's main theorem already states the full forcing result; the d'Alembert route is a supporting lemma that confirms the uniqueness from a different angle. It should stay in the library as a verified alternative, but it does not need to be cited on the cost uniqueness page unless the page discusses the proof structure in detail.
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
The hinge of the proof
The central theorem of the cost uniqueness story is that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof does not check this candidate at the end; it uses the candidate's own structure to force the result. The hinge is a single theorem, Jcost_cosh_add_identity, which states that the candidate J obeys the same composition law that the five conditions impose on any valid cost. This identity is not a separate fact about J; it is the bridge that lets the proof conclude that the candidate is the only possible solution.
If that identity were false, the proof would collapse at its first step. The argument works by showing that any cost F satisfying the conditions must also satisfy the composition law, and then showing that the only function satisfying that law and the other conditions is J. But the proof of the second step relies on the fact that J itself satisfies the law. Without that, the uniqueness theorem would have no candidate to point to. The proof would not merely be incomplete; it would be pointing at a function that does not meet the problem's own requirements.
The identity is also the reason the proof can move from the abstract composition law to a concrete differential equation. The composition law, written as F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y), is a functional equation that admits many solutions. The proof needs a way to select the one that matches the cost conditions. It does this by reparametrizing in log coordinates, where the composition law becomes the d'Alembert equation H(t+u) + H(t-u) = 2H(t)H(u). The candidate J, after this reparametrization, becomes H(t) = cosh(t). The identity Jcost_cosh_add_identity is precisely the statement that this reparametrized candidate satisfies the d'Alembert equation. From there, the proof uses the regularity conditions to show that H must be cosh, and hence F must be J.
Dropping the identity would also break the proof's logical structure. The theorem law_of_logic_forces_jcost states that any F satisfying the five conditions equals J. Its proof relies on composition_law_equiv_coshAdd, which shows that the composition law is equivalent to the d'Alembert identity for the reparametrized function. The candidate J must satisfy this identity for the equivalence to hold. If it did not, the proof could not even state the equivalence, let alone use it to derive the uniqueness result. The entire forcing chain, from the five conditions to the final formula, would have no valid conclusion.
The identity is not an assumption; it is a proved theorem about the candidate J. The machine-checked library of formal theorems contains the proof that J satisfies the composition law. This is what makes the uniqueness result a theorem rather than a conjecture. If the identity were false, the library would contain a contradiction, and the entire framework would be unsound. The fact that the identity is proved, and that the proof of uniqueness depends on it, is what gives the cost uniqueness story its force.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_cosh_add_identity : CoshAddIdentity Cost.Jcost := by
intro t u
simp only [G, Jcost]
-- Use exp(t+u) = exp(t)*exp(u) and exp(t-u) = exp(t)/exp(u)
have he1 : Real.exp (t + u) = Real.exp t * Real.exp u := Real.exp_add t u
have he2 : Real.exp (t - u) = Real.exp t / Real.exp u := by
rw [sub_eq_add_neg, Real.exp_add, Real.exp_neg]
ring
have hpos_t : Real.exp t > 0 := Real.exp_pos t
have hpos_u : Real.exp u > 0 := Real.exp_pos u
have hne_t : Real.exp t ≠ 0 := hpos_t.ne'
have hne_u : Real.exp u ≠ 0 := hpos_u.ne'
rw [he1, he2]
field_simp
ring
THEOREM SatisfiesCompositionLaw · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Composition Law (Equation 1.1)**:
F(xy) + F(x/y) = 2·F(x)·F(y) + 2·F(x) + 2·F(y) for all x, y > 0.
This is the Recognition Composition Law (RCL). -/
def SatisfiesCompositionLaw (F : ℝ → ℝ) : Prop :=
∀ x y : ℝ, 0 < x → 0 < y →
F (x * y) + F (x / y) = 2 * F x * F y + 2 * F x + 2 * F y
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
The role of the unit cost
The cost uniqueness theorem, proved in the machine-checked library, states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. One of those conditions is normalization: the cost of recognizing something identical to itself is zero. The declaration law_of_logic_forces_jcost takes hNorm : IsNormalized F as an explicit hypothesis, and the proof uses it at a specific point: it fixes the initial condition H(0) = 1 for the transformed function H(t) = F(e^t) + 1.
If that normalization were false or dropped, the proof would fail at the very start of the analytic argument. The log-curvature condition, which calibrates the local scale of recognition, forces the second derivative of H at zero to be 1. But without H(0) = 1, the differential equation H'' = H would admit many solutions, not just cosh. The theorem ode_cosh_uniqueness requires both H(0) = 1 and H'(0) = 0 to conclude H = cosh; drop the first and you get solutions like H(t) = cosh(t) + c*sinh(t) for any constant c, each satisfying the same second-order equation.
The normalization also connects to the other conditions in a way that is not merely technical. The theorem logCurvature_forces_normalized shows that log-curvature at value 1, together with the composition law, already forces normalization. So the condition is not independent in the full system; it is a consequence of the other hypotheses. But the main theorem still lists it as a premise, and the proof structure relies on it being available as an explicit input. If someone removed it from the statement without adding it elsewhere, the proof would no longer go through as written.
What breaks, concretely, is the uniqueness claim itself. The cost function J is the only solution when all five conditions hold. Without normalization, the family of functions F_c(x) = cosh(c * ln x) - 1 would satisfy the composition law and the log-curvature condition (with curvature c^2), but would not be normalized unless c = 1. The theorem would no longer single out J; it would describe a one-parameter family of possible costs, and the golden ratio and its downstream consequences would not be forced.
The normalization is thus the anchor that turns a family of solutions into a single one. It is not a dispensable convenience; it is the condition that selects the specific cost function the framework uses. Without it, the cost uniqueness story does not merely lose a proof step; it loses its conclusion.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ)
(h_ODE : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := h_cont_hyp h_ODE
have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont
have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff
exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0
THEOREM logCurvature_forces_normalized · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The composition law together with unit log curvature force normalization.
The composition law at `y = 1` gives `F 1 * (F x + 1) = 0`, so either `F 1 = 0`
or `F` is constantly `-1`; the constant has `H ≡ 0`, whose curvature quotient is
negative throughout a punctured neighbourhood and so cannot tend to `1`. -/
theorem logCurvature_forces_normalized (F : ℝ → ℝ)
(hComp : SatisfiesCompositionLaw F) (hκ : HasLogCurvature (H F) 1) :
IsNormalized F := by
by_contra hne
have hconst : ∀ x : ℝ, 0 < x → F x = -1 := by
intro x hx
have h := hComp x 1 hx one_pos
rw [mul_one, div_one] at h
have hquad : F 1 * (F x + 1) = 0 := by nlinarith
rcases mul_eq_zero.mp hquad with h1 | h2
· exact absurd h1 hne
· linarith
have hH : ∀ t : ℝ, H F t = 0 := by
intro t
have hx := hconst (Real.exp t) (Real.exp_pos t)
simp [H, G, hx]
have hgt : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ),
(1 / 2 : ℝ) < 2 * (H F t - 1) / t ^ 2 :=
hκ.eventually (eventually_gt_nhds (by norm_num))
have hne0 : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), t ≠ 0 := by
filter_upwards [self_mem_nhdsWithin] with t ht using ht
obtain ⟨t, hgt', ht0⟩ := (hgt.and hne0).exists
have ht2 : 0 < t ^ 2 := by positivity
have hneg : 2 * (H F t - 1) / t ^ 2 < 0 := by
rw [hH t]
exact div_neg_of_neg_of_pos (by norm_num) ht2
linarith
DERIVED-UNFORMALIZED composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G.
Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y)
becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t)
via the substitution x = e^s, y = e^t. -/
theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) :
SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by
constructor
· intro hComp t u
have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t
have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u
have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos
-- exp(t) * exp(u) = exp(t + u)
have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm
-- exp(t) / exp(u) = exp(t - u)
have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by
rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg]
simp only [G, h1, h2] at h ⊢
linarith
· intro hCosh x y hx hy
let t := Real.log x
let u := Real.log y
have hx_eq : x = Real.exp t := (Real.exp_log hx).symm
have hy_eq : y = Real.exp u := (Real.exp_log hy).symm
have h := hCosh t u
simp only [G] at h
rw [hx_eq, hy_eq]
rw [← Real.exp_add, ← Real.exp_sub]
-- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u))
-- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u)
calc F (Real.exp (t + u)) + F (Real.exp (t - u))
= 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h
_ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ring
The bilinear family
The cost uniqueness theorem rests on a chain of forcing steps. One of the cleanest is the factorization gate, a small set of structural conditions on a two-variable combiner P(u, v), the function that tells how two recognition costs combine. The gate states four plain requirements: symmetry, so P(u, v) = P(v, u); affine response in the second argument, meaning for each fixed u the function is a straight line in v; a boundary law P(u, 0) = 2u; and a normalization P(1, 1) = 6. These are not arbitrary; each one traces back to a property of the cost function J(x) = (x + 1/x)/2 - 1 that the five conditions force.
The theorem gate_forces_bilinear_family says that any combiner satisfying those four conditions must be bilinear: there exists a constant c such that P(u, v) = c * u * v + 2u + 2v for all u and v. The proof is short once the affine-response step is available; symmetry and the boundary law do the rest. The constant c is not yet fixed by this theorem alone. The normalization P(1, 1) = 6 then pins c to 2, giving the canonical RCL combiner P(u, v) = 2uv + 2u + 2v, which is exactly the combiner that appears in the cost uniqueness result.
Why does this belong on the cost uniqueness page? The page's main theorem proves that the cost function must equal J(x) = (x + 1/x)/2 - 1. That proof passes through a differential equation in log coordinates, where the transformed function H(t) = F(e^t) + 1 must satisfy H'' = H. The differential equation alone does not select a unique solution; it admits many, including exponential combinations and zero solutions. The factorization gate is the algebraic complement to that analytic step. It shows that the combiner structure, once the hard analytic passage to affine response is done, collapses to a single bilinear family, and the normalization selects the unique member. The gate is the algebraic spine that turns the analytic uniqueness into a fully forced result.
In the machine-checked library, the gate is packaged as a structure FactorizationAssociativityGate, and the theorem gate_forces_bilinear_family is proved for any P satisfying it. The companion theorem gate_forces_rcl then derives the full canonical form by substituting the normalization. The equivalence factorization_gate_iff_rcl states that the gate is exactly equivalent to being the canonical RCL combiner, so the gate is not a loose constraint but a complete characterization. This is the algebraic closure that the cost uniqueness page needs: it explains how the five conditions, after the analytic work, leave no freedom in the combiner.
THEOREM gate_forces_bilinear_family · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Once the affine-response step is known, symmetry and the boundary law force
the entire bilinear family. -/
theorem gate_forces_bilinear_family (P : ℝ → ℝ → ℝ)
(hGate : FactorizationAssociativityGate P) :
∃ c : ℝ, ∀ u v, P u v = c * u * v + 2 * u + 2 * v := by
classical
choose α β hAffine using hGate.rightAffine
have hβ : ∀ u, β u = 2 * u := by
intro u
have h0 : P u 0 = α u * 0 + β u := hAffine u 0
rw [hGate.zeroBoundary u] at h0
linarith
let c : ℝ := α 1 - 2
refine ⟨c, ?_⟩
intro u v
have hsym1 : P u 1 = P 1 u := hGate.symmetric u 1
have hαu : α u = c * u + 2 := by
dsimp [c]
have hcalc : α u * 1 + β u = α 1 * u + β 1 := by
calc
α u * 1 + β u = P u 1 := by symm; exact hAffine u 1
_ = P 1 u := hGate.symmetric u 1
_ = α 1 * u + β 1 := hAffine 1 u
rw [hβ u, hβ 1] at hcalc
linarith
calc
P u v = α u * v + β u := hAffine u v
_ = (c * u + 2) * v + 2 * u := by rw [hαu, hβ u]
_ = c * u * v + 2 * u + 2 * v := by ring
THEOREM gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Canonical normalization selects the RCL member of the bilinear family. -/
theorem gate_forces_rcl (P : ℝ → ℝ → ℝ)
(hGate : FactorizationAssociativityGate P) :
∀ u v, P u v = 2 * u * v + 2 * u + 2 * v := by
obtain ⟨c, hc⟩ := gate_forces_bilinear_family P hGate
have hc_two : c = 2 := by
have h11 : P 1 1 = c * 1 * 1 + 2 * 1 + 2 * 1 := by
simpa using hc 1 1
linarith [hGate.unitDiagonal, h11]
intro u v
calc
P u v = c * u * v + 2 * u + 2 * v := hc u v
_ = 2 * u * v + 2 * u + 2 * v := by rw [hc_two]
THEOREM factorization_gate_iff_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Exact gate characterization: the factorization gate is equivalent to being
the canonical RCL combiner. -/
theorem factorization_gate_iff_rcl (P : ℝ → ℝ → ℝ) :
FactorizationAssociativityGate P ↔ ∀ u v, P u v = rclCombiner u v := by
constructor
· intro hGate u v
rw [gate_forces_rcl P hGate u v]
rfl
· intro hP
refine {
symmetric := ?_
rightAffine := ?_
zeroBoundary := ?_
unitDiagonal := ?_
}
· intro u v
rw [hP u v, hP v u]
unfold rclCombiner
ring
· intro u
refine ⟨2 * u + 2, 2 * u, ?_⟩
intro v
rw [hP u v]
unfold rclCombiner
ring
· intro u
rw [hP u 0]
unfold rclCombiner
ring
· rw [hP 1 1]
unfold rclCombiner
norm_num
The smoothness hinge
The cost uniqueness theorem states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof transforms the problem into log coordinates, where the function H(t) = F(e^t) + 1 must satisfy the d'Alembert equation H(t+u) + H(t-u) = 2 * H t * H u, with H(0) = 1 and a calibration fixing the second derivative at zero to 1. The d'Alembert equation alone does not select a unique solution; it admits many, including exponential combinations and zero functions.
A key theorem, dAlembert_cosh_solution_of_log_curvature, closes the gap by deriving the unique conclusion H t = Real.cosh t. This theorem requires five regularity hypotheses, and among them is dAlembert_continuous_implies_smooth_hypothesis H, a statement that a continuous solution of the d'Alembert equation with H(0) = 1 is infinitely differentiable. The declaration cosh_dAlembert_smooth is the specific instance of this hypothesis for the candidate solution Real.cosh, proved by applying the library's result that cosh is infinitely differentiable.
If cosh_dAlembert_smooth were false or dropped, the proof of dAlembert_cosh_solution_of_log_curvature would fail for the candidate solution. The theorem's conclusion would no longer be derivable from its premises, because the smoothness hypothesis is a necessary input to the argument. The uniqueness result for the cost function would remain true, but the proof would be incomplete: it would lack the bridge from the d'Alembert equation to the differential equation H'' = H, which is the step that the smoothness hypothesis enables.
The consequence is not a false theorem, but an unproved one. The library would still contain the theorem law_of_logic_forces_jcost, which derives the same cost uniqueness from the five plain conditions, but its proof relies on the same smoothness bridge through the AczelSmoothnessPackage. Without that bridge, the uniqueness story would have a hole: the d'Alembert equation would admit pathological continuous solutions that are not cosh, and the proof would not rule them out. The framework's claim that the cost function is forced would rest on an unverified regularity assumption instead of a closed argument.
In Recognition Science, the smoothness hypothesis is not a free choice but a consequence of the d'Alembert equation itself, as shown by the theorem dAlembert_smooth_of_aczel. This theorem states that under the AczelSmoothnessPackage, any continuous solution of the d'Alembert equation with H(0) = 1 is automatically infinitely differentiable. Therefore, cosh_dAlembert_smooth is not an isolated assumption but a special case of a general regularity result. Dropping it would not just remove a lemma; it would sever the proof's connection to the classical theory of functional equations, leaving the uniqueness result dependent on an unverified condition instead of a proved theorem.
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM cosh_dAlembert_smooth · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh satisfies the d'Alembert smoothness hypothesis. -/
theorem cosh_dAlembert_smooth : dAlembert_continuous_implies_smooth_hypothesis Real.cosh := by
intro _ _ _
exact Real.contDiff_cosh
THEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_deriv_zero : deriv H 0 = 0 := by
have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert
have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt
exact even_deriv_at_zero H h_even h_diff
exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM dAlembert_smooth_of_aczel · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The `dAlembert_continuous_implies_smooth_hypothesis` holds for every H,
as a direct consequence of the Aczél axiom. -/
theorem dAlembert_smooth_of_aczel [AczelSmoothnessPackage] (H : ℝ → ℝ) :
dAlembert_continuous_implies_smooth_hypothesis H :=
fun h_one h_cont h_dAlembert => aczel_dAlembert_smooth H h_one h_cont h_dAlembert
The differentiability step
The cost uniqueness theorem states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof works by changing variables to log coordinates, where the transformed function H must satisfy the d'Alembert equation H(t+u) + H(t-u) = 2 H(t) H(u). The continuous solutions of this equation are exactly the hyperbolic cosine functions H(t) = cosh(kt) for a constant k. The theorem then forces k = 1 through the calibration condition, yielding the unique cost J.
The step that selects the smooth solution is a differential equation. Once H is known to be twice differentiable, the d'Alembert equation implies H'' = H, and with the initial conditions H(0) = 1 and H'(0) = 0, the unique solution is H(t) = cosh(t). This is the theorem ode_cosh_uniqueness in the framework's machine-checked library of formal theorems. The library proves that any twice-differentiable function satisfying H'' = H with those initial conditions is exactly cosh.
The differentiability hypothesis is the bridge from the functional equation to the differential equation. The library's theorem dAlembert_cosh_solution_aczel states that if H is continuous, satisfies the d'Alembert equation, and has H(0) = 1 and H''(0) = 1, then H(t) = cosh(t) for all t. This theorem relies on the fact that a continuous solution of the d'Alembert equation is automatically smooth, a result from Aczél's theory. The formal library encodes this as the hypothesis dAlembert_continuous_implies_smooth_hypothesis, and it is this hypothesis that the theorem cosh_satisfies_differentiable instantiates for the specific case of cosh.
If cosh_satisfies_differentiable were false or dropped, the proof could not conclude that the function H is differentiable from the d'Alembert equation alone. Without differentiability, the theorem ode_cosh_uniqueness cannot be applied, and the argument stops before reaching the differential equation H'' = H. The uniqueness conclusion would fail: there exist pathological, non-continuous solutions to the d'Alembert equation that are not hyperbolic cosine. The framework's proof would be incomplete, and the cost uniqueness theorem would not be established for all functions satisfying the five conditions.
The differentiability hypothesis is not a free assumption. The framework's library proves that cosh itself satisfies it, and the theorem dAlembert_cosh_solution_aczel shows that continuity of H is enough to derive differentiability. The hypothesis cosh_satisfies_differentiable is a formal statement that the specific function cosh is differentiable, which the library proves using the standard fact that the real cosine hyperbolic function is differentiable. Dropping this hypothesis would remove the bridge from the functional equation to the differential equation, leaving the uniqueness proof without its analytic core.
THEOREM dAlembert_cosh_solution_aczel · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (d'Alembert → cosh, Aczél form)**: Using only the Aczél axiom, a continuous
solution to d'Alembert with H(0) = 1 and H''(0) = 1 must equal cosh.
This is the clean version of `dAlembert_cosh_solution`, requiring no regularity params. -/
theorem dAlembert_cosh_solution_aczel
[AczelSmoothnessPackage]
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_d2_zero : deriv (deriv H) 0 = 1) :
∀ t, H t = Real.cosh t := by
have h_smooth : ContDiff ℝ ⊤ H := aczel_dAlembert_smooth H h_one h_cont h_dAlembert
have hDiff : Differentiable ℝ H :=
(h_smooth.of_le le_top : ContDiff ℝ 1 H).differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_H'0 : deriv H 0 = 0 := even_deriv_at_zero H h_even hDiff.differentiableAt
have h_ode : ∀ t, deriv (deriv H) t = H t :=
dAlembert_to_ODE_theorem H h_smooth h_dAlembert h_d2_zero
have h_C2 : ContDiff ℝ 2 H := h_smooth.of_le le_top
exact ode_cosh_uniqueness_contdiff H h_C2 h_ode h_one h_H'0
THEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/
theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ)
(h_diff : ContDiff ℝ 2 H)
(h_ode : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0) :
∀ t, H t = Real.cosh t := by
let g := fun t => H t - Real.cosh t
have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh
have hg_ode : ∀ t, deriv (deriv g) t = g t := by
intro t
have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by
ext s; apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by
have hH_diff1 : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff
rw [contDiff_succ_iff_deriv] at h_diff
exact h_diff.2.2
have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by
rw [Real.deriv_cosh]; exact Real.contDiff_sinh
rw [h1]; apply deriv_sub
· exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
· exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
rw [h2, h_ode t, cosh_second_deriv_eq t]
have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero]
have hg'0 : deriv g 0 = 0 := by
have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by
apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring
have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0
intro t
have := hg_zero t
simp only [g] at this; linarith
THEOREM cosh_satisfies_differentiable · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh is differentiable. -/
theorem cosh_satisfies_differentiable : ode_regularity_differentiable_hypothesis Real.cosh := by
intro _ _
exact Real.differentiable_cosh
A regularity witness
The hyperbolic cosine, cosh t = (e^t + e^-t)/2, is the unique solution to the second-order differential equation H'' = H with initial conditions H(0) = 1 and H'(0) = 0. This uniqueness is classical and does not depend on any framework. The equation alone admits many solutions, including combinations of exponentials and zero; the initial conditions select cosh. The declaration cosh_satisfies_continuous is a theorem stating that the hyperbolic cosine satisfies the regularity hypothesis ode_regularity_continuous_hypothesis, which is a formal condition used in the machine-checked proof to guarantee that a solution to the differential equation is continuous.
In the cost uniqueness proof, the transformed function H(t) = F(e^t) + 1 must satisfy H'' = H. The proof reaches this differential equation and then needs to apply a uniqueness theorem that requires certain regularity hypotheses. The declaration cosh_satisfies_continuous contributes by providing a witness that the candidate solution, cosh, meets the continuity hypothesis. This is a necessary ingredient in the chain of reasoning that concludes the only possible cost function is J(x) = (x + 1/x)/2 - 1. Without this witness, the uniqueness theorem could not be applied to rule out other solutions.
In Recognition Science, the framework models recognition costs as amounts posted when something is recognized, and the cost is forced into one formula by five plain conditions. The declaration cosh_satisfies_continuous is part of the machine-checked library of formal theorems that establishes this forcing result. It is not a standalone result about costs; it is a supporting lemma about the regularity of the candidate solution. It contributes to the proof by confirming that the candidate solution is regular enough for the uniqueness argument to go through. It should stay on the page as part of the proof infrastructure, but it is not a claim about recognition itself.
THEOREM cosh_satisfies_continuous · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh is continuous. -/
theorem cosh_satisfies_continuous : ode_regularity_continuous_hypothesis Real.cosh := by
intro _
exact Real.continuous_cosh
The forcing theorem
The cost uniqueness page currently tells the story of recognition, the posting of a cost when something is recognized, through a chain of lemmas that ends in a differential equation. The reader meets the five plain conditions, the log-coordinate transform, and the cosh solution. What the page does not yet show is the single declaration that assembles those conditions into the final result: any cost function satisfying all five must equal J(x) = (x + 1/x)/2 - 1. That declaration is law_of_logic_forces_jcost, and it belongs on the page as the capstone.
The theorem takes five hypotheses: reciprocal symmetry, meaning the cost of recognizing x equals the cost of recognizing 1/x; normalization, zero cost at unity; the composition law, which for positive x and y reads F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y); calibration, fixing the local scale near the identity; and continuity on the positive reals. Under those conditions the conclusion is forced: for every positive x, F(x) equals J(x). This is not a claim that the five conditions are natural or that they describe reality; it is a conditional theorem. If a cost function meets the hypotheses, it must be J. The page's current proof walkthrough reaches the differential equation H'' = H, but the equation alone admits many solutions. The forcing theorem is what closes the gap: it supplies the initial conditions and the regularity that select cosh, and hence J.
Adding this declaration changes what the page can say. Instead of presenting the uniqueness result as a scattered set of lemmas, the page can state the theorem in one sentence and then use the existing lemmas as the proof's anatomy. The reader sees the destination before the journey. The theorem also carries the page's strongest epistemic tag: it is proved in the machine-checked library, with no framework-specific axioms. That provenance is worth a focal box, not a footnote.
The declaration should not replace the current content; it should organize it. The page's existing lemmas, such as the one showing that log-curvature forces normalization, become the supporting cast. The forcing theorem is the headline. Leaving it off the page leaves the uniqueness result looking like a collection of technical steps rather than a single proved law. Put it in, near the top, and let the rest of the page explain why each hypothesis earns its place.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM SatisfiesCompositionLaw · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Composition Law (Equation 1.1)**:
F(xy) + F(x/y) = 2·F(x)·F(y) + 2·F(x) + 2·F(y) for all x, y > 0.
This is the Recognition Composition Law (RCL). -/
def SatisfiesCompositionLaw (F : ℝ → ℝ) : Prop :=
∀ x y : ℝ, 0 < x → 0 < y →
F (x * y) + F (x / y) = 2 * F x * F y + 2 * F x + 2 * F y
The d'Alembert bridge
The cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, must equal J(x) = (x + 1/x)/2 - 1. The proof in the machine-checked library of formal theorems reaches this conclusion by transforming the problem into log coordinates. In those coordinates, the cost function becomes a function H(t), and the forced composition law becomes a classical equation that Jean le Rond d'Alembert studied in 1747 while working on vibrating strings: H(t+u) + H(t-u) = 2 H(t) H(u). This is the cosine addition formula, and its continuous solutions are exactly the hyperbolic cosine functions H(t) = cosh(kt) for a constant k.
The declaration dAlembert_cosh_solution_aczel contributes a clean statement of this classical result. It says that if H is continuous, satisfies H(0) = 1, obeys the d'Alembert equation, and has second derivative 1 at 0, then H(t) = cosh(t) for all t. This is the bridge that connects the analytic smoothness conditions to the algebraic structure of the cost function. Without it, the proof would need to carry five separate regularity hypotheses through every step. With it, the argument compresses to a single application: the composition law plus continuity plus one calibration condition forces the hyperbolic cosine, and from there the cost function J follows directly.
The declaration belongs on the page because it names the exact classical theorem that does the analytic work. The page's main proof route reaches a differential equation H'' = H in log coordinates, and dAlembert_cosh_solution_aczel is the packaged version of that route's uniqueness step. It also gives the page a historically grounded anchor: the same equation d'Alembert wrote down for the vibrating string, with its continuous solutions being exactly the hyperbolic cosines, is what forces the cost function's shape. The reader sees that the framework's uniqueness result does not invent new analysis; it inherits a 250-year-old theorem about how cosine and its hyperbolic cousin are characterized.
One caveat keeps the declaration honest. The theorem dAlembert_cosh_solution_aczel requires the second derivative of H at 0 to equal 1, which is a calibration condition. The page's main theorem law_of_logic_forces_jcost derives that condition from the five plain axioms rather than assuming it. So the declaration is a component, not a replacement: it supplies the classical bridge once the calibration is established. The page should present it as the analytic heart of the proof, with the five-axiom theorem as the outer frame that delivers the calibration condition into the bridge's waiting hands.
THEOREM dAlembert_cosh_solution_aczel · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (d'Alembert → cosh, Aczél form)**: Using only the Aczél axiom, a continuous
solution to d'Alembert with H(0) = 1 and H''(0) = 1 must equal cosh.
This is the clean version of `dAlembert_cosh_solution`, requiring no regularity params. -/
theorem dAlembert_cosh_solution_aczel
[AczelSmoothnessPackage]
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_d2_zero : deriv (deriv H) 0 = 1) :
∀ t, H t = Real.cosh t := by
have h_smooth : ContDiff ℝ ⊤ H := aczel_dAlembert_smooth H h_one h_cont h_dAlembert
have hDiff : Differentiable ℝ H :=
(h_smooth.of_le le_top : ContDiff ℝ 1 H).differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_H'0 : deriv H 0 = 0 := even_deriv_at_zero H h_even hDiff.differentiableAt
have h_ode : ∀ t, deriv (deriv H) t = H t :=
dAlembert_to_ODE_theorem H h_smooth h_dAlembert h_d2_zero
have h_C2 : ContDiff ℝ 2 H := h_smooth.of_le le_top
exact ode_cosh_uniqueness_contdiff H h_C2 h_ode h_one h_H'0
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G.
Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y)
becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t)
via the substitution x = e^s, y = e^t. -/
theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) :
SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by
constructor
· intro hComp t u
have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t
have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u
have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos
-- exp(t) * exp(u) = exp(t + u)
have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm
-- exp(t) / exp(u) = exp(t - u)
have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by
rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg]
simp only [G, h1, h2] at h ⊢
linarith
· intro hCosh x y hx hy
let t := Real.log x
let u := Real.log y
have hx_eq : x = Real.exp t := (Real.exp_log hx).symm
have hy_eq : y = Real.exp u := (Real.exp_log hy).symm
have h := hCosh t u
simp only [G] at h
rw [hx_eq, hy_eq]
rw [← Real.exp_add, ← Real.exp_sub]
-- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u))
-- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u)
calc F (Real.exp (t + u)) + F (Real.exp (t - u))
= 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h
_ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ring
The missing link
The hyperbolic cosine, written cosh(t), is the average of the exponential function and its reciprocal: cosh(t) = (e^t + e^-t)/2. It is the even counterpart to the hyperbolic sine, and it describes the shape of a hanging chain or cable under its own weight, the catenary. Like the ordinary cosine, it satisfies a second-order differential equation, but the equation alone does not select it uniquely. The equation H'' = H has many solutions; the initial conditions H(0) = 1 and H'(0) = 0 pick out cosh specifically.
In 1747, Jean le Rond d'Alembert studied the functional equation H(t+u) + H(t-u) = 2 H(t) H(u) for all real t and u. Its continuous solutions are exactly the hyperbolic cosine functions H(t) = cosh(kt) for a constant k. The equation is famous because it characterizes the cosine and its hyperbolic cousin without any mention of calculus. The cost uniqueness page reaches this equation after a logarithmic change of variables, where the cost function's composition law becomes d'Alembert's equation.
The declaration cosh_second_deriv_eq is the bridge from d'Alembert's equation to the differential equation. It states that the second derivative of cosh is cosh itself: (cosh)'' = cosh. In the machine-checked library of formal theorems, this fact is used to show that cosh satisfies the hypothesis dAlembert_to_ODE_hypothesis, which is the condition that allows the proof to move from the functional equation to the ODE. Without this bridge, the analytic route stalls: the proof cannot convert the structural condition into the differential equation whose unique solution is cosh.
The contribution is therefore not a new theorem but a necessary step in the existing proof chain. It is the specific instance of the general fact that a smooth solution of d'Alembert's equation satisfies H'' = H''(0) * H. When the log-curvature calibration sets H''(0) = 1, the equation becomes H'' = H, and cosh_second_deriv_eq confirms that cosh itself is the solution that satisfies the initial conditions. The page should use this declaration, because it is the precise point where the framework's composition law meets classical calculus.
In Recognition Science, the framework models recognition cost, the amount posted when something is recognized, as a function satisfying five plain conditions. The theorem law_of_logic_forces_jcost proves that any such cost must equal J(x) = (x + 1/x)/2 - 1. The proof passes through the log-coordinate transform G(t) = F(e^t), where the composition law becomes d'Alembert's equation, and then through the differential equation. The declaration cosh_second_deriv_eq is the formal justification that the function cosh(t) - 1, which is G for the cost J, indeed satisfies the ODE. It is not an optional ornament; it is the load-bearing fact that closes the analytic route.
THEOREM cosh_dAlembert_to_ODE · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh satisfies the d'Alembert to ODE hypothesis. -/
theorem cosh_dAlembert_to_ODE : dAlembert_to_ODE_hypothesis Real.cosh := by
intro _ _ _ _
exact cosh_second_deriv_eq
THEOREM cosh_dAlembert_to_ODE · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh satisfies the d'Alembert to ODE hypothesis. -/
theorem cosh_dAlembert_to_ODE : dAlembert_to_ODE_hypothesis Real.cosh := by
intro _ _ _ _
exact cosh_second_deriv_eq
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The hinge at the second derivative
The cost uniqueness theorem states that any cost function obeying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The five conditions are reciprocal symmetry, zero cost at unity, a forced composition law, calibration, and continuity. The theorem is proved in a machine-checked library of formal theorems, with no unproved assumptions beyond the standard axioms of logic. The proof passes through a differential equation, and that route depends on a specific fact: the second derivative of the hyperbolic cosine is the hyperbolic cosine itself.
The fact is cosh''(t) = cosh(t). In the machine-checked library, this appears as cosh_second_deriv_eq. It is the bridge that turns the d'Alembert equation, H(t+u) + H(t-u) = 2 H(t) H(u), into the differential equation H'' = H. The d'Alembert equation is a functional equation: it constrains how the function behaves under addition and subtraction of its inputs. The differential equation is a local statement: it constrains the function's curvature at every point. The library proves the bridge in the theorem cosh_dAlembert_to_ODE, which takes the d'Alembert equation and the initial conditions H(0) = 1 and H'(0) = 0 and derives H'' = H for all t.
If cosh_second_deriv_eq were false or dropped, that bridge would collapse. The d'Alembert equation alone would still force the function to be smooth, by a classical result of Aczél. But without the second-derivative fact, the library could not pass from the functional equation to the differential equation. The uniqueness proof would lose its analytic core. The theorem ode_cosh_uniqueness, which states that the only twice-differentiable solution to H'' = H with H(0) = 1 and H'(0) = 0 is cosh, would still stand on its own. But it would have nothing to attach to, because the route from the five cost conditions to that differential equation would be cut.
The consequence is not that the cost uniqueness theorem would be false. It is that the proof would be incomplete. The library's chain from the five conditions to J(x) = (x + 1/x)/2 - 1 would have a missing link. The theorem law_of_logic_forces_jcost, which states the full uniqueness result, would no longer be derivable from the given lemmas. The framework's claim that the cost function is forced would lose its machine-checked backing at exactly the point where the analytic argument lives.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM cosh_dAlembert_to_ODE · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh satisfies the d'Alembert to ODE hypothesis. -/
theorem cosh_dAlembert_to_ODE : dAlembert_to_ODE_hypothesis Real.cosh := by
intro _ _ _ _
exact cosh_second_deriv_eq
THEOREM dAlembert_smooth_of_aczel · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The `dAlembert_continuous_implies_smooth_hypothesis` holds for every H,
as a direct consequence of the Aczél axiom. -/
theorem dAlembert_smooth_of_aczel [AczelSmoothnessPackage] (H : ℝ → ℝ) :
dAlembert_continuous_implies_smooth_hypothesis H :=
fun h_one h_cont h_dAlembert => aczel_dAlembert_smooth H h_one h_cont h_dAlembert
The regularity hinge
The cost uniqueness theorem in Recognition Science claims that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof does not reach that formula directly. It first reparametrizes the cost in log coordinates, turning the composition law into the d'Alembert functional equation H(t+u) + H(t-u) = 2 H(t) H(u), with H(0) = 1. The calibration condition, which fixes the local scale of recognition near the identity, becomes the statement that H has log-curvature κ at 0: the limit of 2(H(t) - 1)/t² as t approaches 0. That local datum alone does not yet say anything about H away from zero.
The declaration dAlembert_continuous_of_log_curvature is the bridge. It proves that a function satisfying the d'Alembert equation, with H(0) = 1 and having log-curvature at 0, is continuous everywhere. This is a regularity theorem: it upgrades a condition at a single point to a global property. The log-curvature condition is the calibration input; continuity is the regularity output that the rest of the proof consumes. If this theorem were false or dropped, the chain would stop at the functional equation. The machine-checked proof of cost uniqueness, law_of_logic_forces_jcost, requires continuity of F on the positive reals as one of its five hypotheses. Without the bridge, that hypothesis would have to be assumed rather than derived, and the five plain conditions would no longer suffice on their own.
The loss is not merely aesthetic. The d'Alembert equation admits many pathological solutions that are discontinuous everywhere. The classical theory, due to d'Alembert and later Aczél, shows that continuity selects the well-behaved family: the cosine and hyperbolic cosine solutions. The framework's proof leans on that selection. The bridge theorem is what rules out the pathological solutions in the machine-checked development. Dropping it would leave the door open to discontinuous functions that satisfy the composition law and the calibration condition but are not the forced cost. The uniqueness claim would collapse into a statement about a restricted class of functions, and the forcing chain from the five conditions to J(x) would break at its first major junction.
In the framework's library, the bridge is stated as a theorem and used as a lemma in the larger proof. The library also contains a separate route, dAlembert_cosh_solution_of_log_curvature, which derives the same cosh conclusion from the functional equation under additional smoothness hypotheses. Those hypotheses are packaged as dAlembert_continuous_implies_smooth_hypothesis and related declarations, which encode the Aczél theory that continuity implies smoothness. The bridge theorem is what supplies the continuity that those hypotheses require. Without it, the smoothness package would have no input, and the alternative route would also stall. The proof structure is a ladder: calibration gives continuity, continuity gives smoothness, smoothness gives the differential equation H'' = H, and the initial conditions H(0) = 1, H'(0) = 0 force H = cosh. The bridge is the first rung.
What survives without the bridge is the local statement: the log-curvature condition and the composition law still force the value of the cost near the identity, up to the second order. The global conclusion, that the cost equals J(x) everywhere on the positive reals, would be lost. The theorem would degrade from a uniqueness result to a local expansion result. The framework's claim that five plain conditions force the cost function would no longer be a proved theorem; it would be a conjecture with a missing regularity assumption. The machine-checked proof would fail to compile, and the forcing chain that leads to the golden ratio and the eight-tick cycle would have no foundation to stand on.
THEOREM dAlembert_continuous_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_continuous_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ) :
Continuous H := by
refine continuous_iff_continuousAt.2 ?_
intro t
have h_lim_H : Filter.Tendsto H (nhds 0) (nhds 1) :=
tendsto_H_one_of_log_curvature H h_one h_calib
have h_sum :
Filter.Tendsto (fun u => H (t+u) + H (t-u)) (nhds 0) (nhds (2 * H t)) := by
have h_prod : Filter.Tendsto (fun u => (2 * H t) * H u) (nhds 0)
(nhds ((2 * H t) * (1 : ℝ))) := (tendsto_const_nhds.mul h_lim_H)
have h_prod' : Filter.Tendsto (fun u => 2 * H t * H u) (nhds 0) (nhds (2 * H t)) := by
simpa [mul_assoc] using h_prod
have h_eq : (fun u => H (t+u) + H (t-u)) = fun u => 2 * H t * H u := by
funext u
exact h_dAlembert t u
simpa [h_eq] using h_prod'
have h_diff_sq :
Filter.Tendsto (fun u => (H (t+u) - H (t-u))^2) (nhds 0) (nhds (0 : ℝ)) := by
have h_u_sq : Filter.Tendsto (fun u => (H u)^2) (nhds 0) (nhds ((1 : ℝ)^2)) := by
simpa [pow_two] using h_lim_H.mul h_lim_H
have h_u_sq_sub : Filter.Tendsto (fun u => (H u)^2 - 1) (nhds 0) (nhds (0 : ℝ)) := by
have h_const : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhds 0) (nhds (1 : ℝ)) :=
tendsto_const_nhds
simpa using h_u_sq.sub h_const
have h_const :
Filter.Tendsto (fun _ : ℝ => 4 * ((H t)^2 - 1)) (nhds 0)
(nhds (4 * ((H t)^2 - 1))) := tendsto_const_nhds
have h_mul :
Filter.Tendsto (fun u => (4 * ((H t)^2 - 1)) * ((H u)^2 - 1)) (nhds 0)
(nhds (4 * ((H t)^2 - 1) * (0 : ℝ))) := h_const.mul h_u_sq_sub
have h_eq :
(fun u => (H (t+u) - H (t-u))^2) =
(fun u => 4 * ((H t)^2 - 1) * ((H u)^2 - 1)) := by
funext u
exact dAlembert_diff_square H h_one h_dAlembert t u
simpa [h_eq] using h_mul
have h_abs :
Filter.Tendsto (fun u => |H (t+u) - H (t-u)|) (nhds 0) (nhds (0 : ℝ)) := by
have h_sqrt :
Filter.Tendsto (fun u => Real.sqrt ((H (t+u) - H (t-u))^2)) (nhds 0)
(nhds (Real.sqrt 0)) :=
(Real.continuous_sqrt.tendsto 0).comp h_diff_sq
simpa [Real.sqrt_sq_eq_abs] using h_sqrt
have h_diff :
Filter.Tendsto (fun u => H (t+u) - H (t-u)) (nhds 0) (nhds (0 : ℝ)) :=
(tendsto_zero_iff_abs_tendsto_zero (f := fun u => H (t+u) - H (t-u))).2 h_abs
have h_sum_diff :
Filter.Tendsto
(fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u)))
(nhds 0) (nhds ((2 * H t) + (0 : ℝ))) := h_sum.add h_diff
have h_twice : Filter.Tendsto (fun u => 2 * H (t+u)) (nhds 0) (nhds (2 * H t)) := by
have h_sum_diff' :
Filter.Tendsto
(fun u => H (t+u) + H (t+u))
(nhds 0) (nhds (2 * H t)) := by
have h_eq :
(fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) =
(fun u => H (t+u) + H (t+u)) := by
funext u
ring
have h_sum_diff'' :
Filter.Tendsto
(fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u)))
(nhds 0) (nhds (2 * H t)) := by
simpa using h_sum_diff
simpa [h_eq] using h_sum_diff''
simpa [two_mul] using h_sum_diff'
have h_half :
Filter.Tendsto (fun u => (2 * H (t+u)) / 2) (nhds 0) (nhds ((2 * H t) / 2)) := by
have h_const : Filter.Tendsto (fun _ : ℝ => (1 / 2 : ℝ)) (nhds 0) (nhds (1 / 2 : ℝ)) :=
tendsto_const_nhds
simpa [div_eq_mul_inv] using h_twice.mul h_const
have h_at0 : Filter.Tendsto (fun u => H (t+u)) (nhds 0) (nhds (H t)) := by
simpa using h_half
have h_map :
Filter.Tendsto H (Filter.map (fun u => t + u) (nhds 0)) (nhds (H t)) :=
(Filter.tendsto_map'_iff).2 h_at0
have h_tendsto : Filter.Tendsto H (nhds t) (nhds (H t)) := by
simpa [map_add_left_nhds_zero] using h_map
exact h_tendsto
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM dAlembert_continuous_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_continuous_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ) :
Continuous H := by
refine continuous_iff_continuousAt.2 ?_
intro t
have h_lim_H : Filter.Tendsto H (nhds 0) (nhds 1) :=
tendsto_H_one_of_log_curvature H h_one h_calib
have h_sum :
Filter.Tendsto (fun u => H (t+u) + H (t-u)) (nhds 0) (nhds (2 * H t)) := by
have h_prod : Filter.Tendsto (fun u => (2 * H t) * H u) (nhds 0)
(nhds ((2 * H t) * (1 : ℝ))) := (tendsto_const_nhds.mul h_lim_H)
have h_prod' : Filter.Tendsto (fun u => 2 * H t * H u) (nhds 0) (nhds (2 * H t)) := by
simpa [mul_assoc] using h_prod
have h_eq : (fun u => H (t+u) + H (t-u)) = fun u => 2 * H t * H u := by
funext u
exact h_dAlembert t u
simpa [h_eq] using h_prod'
have h_diff_sq :
Filter.Tendsto (fun u => (H (t+u) - H (t-u))^2) (nhds 0) (nhds (0 : ℝ)) := by
have h_u_sq : Filter.Tendsto (fun u => (H u)^2) (nhds 0) (nhds ((1 : ℝ)^2)) := by
simpa [pow_two] using h_lim_H.mul h_lim_H
have h_u_sq_sub : Filter.Tendsto (fun u => (H u)^2 - 1) (nhds 0) (nhds (0 : ℝ)) := by
have h_const : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhds 0) (nhds (1 : ℝ)) :=
tendsto_const_nhds
simpa using h_u_sq.sub h_const
have h_const :
Filter.Tendsto (fun _ : ℝ => 4 * ((H t)^2 - 1)) (nhds 0)
(nhds (4 * ((H t)^2 - 1))) := tendsto_const_nhds
have h_mul :
Filter.Tendsto (fun u => (4 * ((H t)^2 - 1)) * ((H u)^2 - 1)) (nhds 0)
(nhds (4 * ((H t)^2 - 1) * (0 : ℝ))) := h_const.mul h_u_sq_sub
have h_eq :
(fun u => (H (t+u) - H (t-u))^2) =
(fun u => 4 * ((H t)^2 - 1) * ((H u)^2 - 1)) := by
funext u
exact dAlembert_diff_square H h_one h_dAlembert t u
simpa [h_eq] using h_mul
have h_abs :
Filter.Tendsto (fun u => |H (t+u) - H (t-u)|) (nhds 0) (nhds (0 : ℝ)) := by
have h_sqrt :
Filter.Tendsto (fun u => Real.sqrt ((H (t+u) - H (t-u))^2)) (nhds 0)
(nhds (Real.sqrt 0)) :=
(Real.continuous_sqrt.tendsto 0).comp h_diff_sq
simpa [Real.sqrt_sq_eq_abs] using h_sqrt
have h_diff :
Filter.Tendsto (fun u => H (t+u) - H (t-u)) (nhds 0) (nhds (0 : ℝ)) :=
(tendsto_zero_iff_abs_tendsto_zero (f := fun u => H (t+u) - H (t-u))).2 h_abs
have h_sum_diff :
Filter.Tendsto
(fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u)))
(nhds 0) (nhds ((2 * H t) + (0 : ℝ))) := h_sum.add h_diff
have h_twice : Filter.Tendsto (fun u => 2 * H (t+u)) (nhds 0) (nhds (2 * H t)) := by
have h_sum_diff' :
Filter.Tendsto
(fun u => H (t+u) + H (t+u))
(nhds 0) (nhds (2 * H t)) := by
have h_eq :
(fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) =
(fun u => H (t+u) + H (t+u)) := by
funext u
ring
have h_sum_diff'' :
Filter.Tendsto
(fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u)))
(nhds 0) (nhds (2 * H t)) := by
simpa using h_sum_diff
simpa [h_eq] using h_sum_diff''
simpa [two_mul] using h_sum_diff'
have h_half :
Filter.Tendsto (fun u => (2 * H (t+u)) / 2) (nhds 0) (nhds ((2 * H t) / 2)) := by
have h_const : Filter.Tendsto (fun _ : ℝ => (1 / 2 : ℝ)) (nhds 0) (nhds (1 / 2 : ℝ)) :=
tendsto_const_nhds
simpa [div_eq_mul_inv] using h_twice.mul h_const
have h_at0 : Filter.Tendsto (fun u => H (t+u)) (nhds 0) (nhds (H t)) := by
simpa using h_half
have h_map :
Filter.Tendsto H (Filter.map (fun u => t + u) (nhds 0)) (nhds (H t)) :=
(Filter.tendsto_map'_iff).2 h_at0
have h_tendsto : Filter.Tendsto H (nhds t) (nhds (H t)) := by
simpa [map_add_left_nhds_zero] using h_map
exact h_tendsto
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
The uniqueness keystone
The cost uniqueness theorem states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof reaches a differential equation in log coordinates, where the transformed function H(t) = F(e^t) + 1 must satisfy H'' = H. The equation alone does not select a unique function. It admits many solutions, including exponential combinations and zero solutions. The theorem ode_cosh_uniqueness_contdiff is what closes the gap: it proves that if H is twice continuously differentiable, satisfies H'' = H, and has initial conditions H(0) = 1 and H'(0) = 0, then H must be the hyperbolic cosine, Real.cosh t.
If ode_cosh_uniqueness_contdiff were false or dropped, the cost uniqueness proof would lose its keystone. The differential equation would still hold, but without the uniqueness theorem, the proof could not conclude that H equals cosh. The chain from the five conditions to the final cost formula would break at the last step. The theorem law_of_logic_forces_jcost, which states the full forcing result, depends on this uniqueness step. Dropping the lemma would leave the forcing theorem unproved, and the entire cost uniqueness story would collapse into a set of conditions with no unique conclusion.
A supporting fact is that a twice continuously differentiable even function with zero value and zero derivative at zero is identically zero. In the proof, this fact is applied to the difference of two candidate solutions. The difference inherits the differential equation from the candidates, and its initial conditions are zero, so the fact forces the difference to be zero, meaning the two candidates are the same. This argument is the core of the uniqueness proof, and it relies on the same regularity assumptions as ode_cosh_uniqueness_contdiff.
In Recognition Science, the framework models recognition costs as amounts posted when something is recognized, and the forcing theorem is what gives the framework its predictive power. The uniqueness theorem is what turns the five conditions from a description into a law. Without it, the framework would have a cost function that satisfies the conditions but could be any of infinitely many functions, and the golden ratio, the eight-tick cycle, and the three spatial dimensions that follow from the cost function would have no foundation. The uniqueness theorem is the load-bearing wall of the entire structure.
THEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/
theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ)
(h_diff : ContDiff ℝ 2 H)
(h_ode : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0) :
∀ t, H t = Real.cosh t := by
let g := fun t => H t - Real.cosh t
have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh
have hg_ode : ∀ t, deriv (deriv g) t = g t := by
intro t
have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by
ext s; apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by
have hH_diff1 : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff
rw [contDiff_succ_iff_deriv] at h_diff
exact h_diff.2.2
have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by
rw [Real.deriv_cosh]; exact Real.contDiff_sinh
rw [h1]; apply deriv_sub
· exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
· exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
rw [h2, h_ode t, cosh_second_deriv_eq t]
have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero]
have hg'0 : deriv g 0 = 0 := by
have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by
apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring
have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0
intro t
have := hg_zero t
simp only [g] at this; linarith
THEOREM ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Zero Uniqueness)**: The unique solution to f'' = f with f(0) = f'(0) = 0 is f = 0. -/
theorem ode_zero_uniqueness (f : ℝ → ℝ)
(h_diff2 : ContDiff ℝ 2 f)
(h_ode : ∀ t, deriv (deriv f) t = f t)
(h_f0 : f 0 = 0)
(h_f'0 : deriv f 0 = 0) :
∀ t, f t = 0 := by
have ⟨h_minus, h_plus⟩ := ode_diagonalization f h_diff2 h_ode
have h_diff1 : Differentiable ℝ f := h_diff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have h_deriv_contdiff : ContDiff ℝ 1 (deriv f) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff2
rw [contDiff_succ_iff_deriv] at h_diff2
exact h_diff2.2.2
have h_diff_deriv : Differentiable ℝ (deriv f) := h_deriv_contdiff.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
let g := fun s => deriv f s - f s
let hf := fun s => deriv f s + f s
have hg_diff : Differentiable ℝ g := h_diff_deriv.sub h_diff1
have hh_diff : Differentiable ℝ hf := h_diff_deriv.add h_diff1
have hg0 : g 0 = 0 := by simp [g, h_f0, h_f'0]
have hh0 : hf 0 = 0 := by simp [hf, h_f0, h_f'0]
have hg_deriv : ∀ t, deriv g t = -g t := h_minus
have hh_deriv : ∀ t, deriv hf t = hf t := h_plus
have hg_zero := deriv_neg_self_zero g hg_diff hg_deriv hg0
have hh_zero := deriv_pos_self_zero hf hh_diff hh_deriv hh0
intro t
have hgt := hg_zero t
have hht := hh_zero t
simp only [g, hf] at hgt hht
linarith
THEOREM reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Lemma 2.1**: If F is reciprocal, then G(t) = F(e^t) is even. -/
theorem reciprocal_implies_G_even (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) :
Function.Even (G F) :=
G_even_of_reciprocal_symmetry F (fun {x} hx => hRecip x hx)
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The doubling identity
The cosine function obeys a striking self-relation: if you double the input, the value is determined by the square of the original value, minus one. In symbols, cos(2t) = 2cos²(t) - 1. This is the classical doubling identity, known since antiquity and central to trigonometry. The lemma dAlembert_double in the machine-checked library of formal theorems proves that any function H satisfying the d'Alembert equation H(t+u) + H(t-u) = 2H(t)H(u), with H(0) = 1, must obey the same doubling rule: H(2t) = 2H(t)² - 1.
The d'Alembert equation is a functional equation: it constrains how the function behaves at sums and differences of inputs. The doubling identity is a consequence, extracted by setting u = t. This matters because the equation alone does not pick out a single function. Many functions satisfy it, including constant and exponential combinations. The doubling identity narrows the field: it forces a specific quadratic relationship between a value and its double, a shape that cosine and its relatives share.
On the cost uniqueness page, the d'Alembert equation appears after a change of variables. A recognition cost F, which records the amount posted when something is recognized, is transformed into a new function H(t) = F(e^t) + 1. The composition law that F obeys becomes the d'Alembert equation for H. The doubling identity is then the bridge to the next stage of the proof. Combined with the calibration condition, which fixes the local scale of recognition near the identity, it lets the proof convert the functional equation into a second-order differential equation, H'' = H. That equation, with its initial conditions, has the unique solution H(t) = cosh(t), the hyperbolic cosine.
So the doubling identity is not an isolated curiosity. It is the algebraic step that turns a functional equation, which is hard to solve directly, into an ordinary differential equation, which is well understood. The proof of cost uniqueness, the result that any cost function satisfying the five plain conditions must equal J(x) = (x + 1/x)/2 - 1, depends on this conversion. Without the doubling identity, the path from the composition law to the differential equation would be blocked, and the uniqueness theorem would not follow.
THEOREM dAlembert_double · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_double
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (t : ℝ) :
H (2 * t) = 2 * (H t)^2 - 1 := by
have h := h_dAlembert t t
have h' : H (t + t) = 2 * (H t)^2 - 1 := by
-- H(2t) + H(0) = 2 H(t)^2
have h0 : H (t + t) + 1 = 2 * H t * H t := by
simpa [h_one] using h
have h1 : H (t + t) = 2 * H t * H t - 1 := by
linarith
simpa [pow_two, mul_assoc] using h1
simpa [two_mul] using h'
THEOREM dAlembert_double · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_double
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (t : ℝ) :
H (2 * t) = 2 * (H t)^2 - 1 := by
have h := h_dAlembert t t
have h' : H (t + t) = 2 * (H t)^2 - 1 := by
-- H(2t) + H(0) = 2 H(t)^2
have h0 : H (t + t) + 1 = 2 * H t * H t := by
simpa [h_one] using h
have h1 : H (t + t) = 2 * H t * H t - 1 := by
linarith
simpa [pow_two, mul_assoc] using h1
simpa [two_mul] using h'
THEOREM dAlembert_to_ODE_hypothesis · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **d'Alembert to ODE derivation.**
If H satisfies the d'Alembert equation and is smooth, then H'' = H.
Proof sketch: Differentiate H(t+u) + H(t-u) = 2H(t)H(u) twice with respect to u,
then set u = 0 to get H''(t) = H''(0) · H(t). With calibration H''(0) = 1, this
gives H''(t) = H(t). -/
def dAlembert_to_ODE_hypothesis (H : ℝ → ℝ) : Prop :=
H 0 = 1 → Continuous H → (∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) →
deriv (deriv H) 0 = 1 → ∀ t, deriv (deriv H) t = H t
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
A lemma's role
The cost uniqueness theorem states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The five conditions are reciprocal symmetry, zero cost at unity, a forced composition law, calibration, and continuity. The theorem is proved in the machine-checked library of formal theorems, with no unproved assumptions beyond the standard axioms of logic. The proof passes through a differential equation, a hard analytic step that selects the unique smooth solution.
The lemma tendsto_H_one_of_log_curvature states that if a function H has log-curvature at 0, meaning the expression 2(H(t) - 1)/t² approaches a finite limit as t approaches 0, and if H(0) = 1, then H(t) approaches 1 as t approaches 0. In plainer terms, the lemma says that a function whose log-curvature is defined at a point must be continuous there. It is a small bridge: it derives a continuity property from a curvature assumption.
This lemma is not used in the main proof of the cost uniqueness theorem. The main proof reaches a differential equation in log coordinates, where the transformed function must satisfy H'' = H. That route is analytic: it uses calculus to pin down the unique solution. The lemma belongs to a different corner of the framework, one that explores what log-curvature alone implies. It shows that the curvature condition is strong enough to force continuity, a fact that could support alternative proof paths or standalone results about the structure of recognition costs.
For the page, the lemma should stay off the main proof narrative. It does not contribute to the theorem's conclusion, and including it would distract from the analytic route that carries the proof. The page can, however, mention it as a related result: a lemma that shows log-curvature implies continuity, a fact that reinforces the coherence of the framework's assumptions. This keeps the page focused on the theorem while acknowledging the lemma's existence and its role in the broader library.
THEOREM tendsto_H_one_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- Unit log curvature plus `H 0 = 1` give the two-sided limit at the origin.
The curvature hypothesis lives on the punctured filter, so the value at the
origin is supplied by `h_one` rather than assumed away. -/
lemma tendsto_H_one_of_log_curvature
(H : ℝ → ℝ) (h_one : H 0 = 1) {κ : ℝ} (h_calib : HasLogCurvature H κ) :
Filter.Tendsto H (nhds 0) (nhds 1) := by
have h_t2_div :
Filter.Tendsto (fun t : ℝ => t^2 / 2) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ))
(nhds (0 : ℝ)) := by
have hfull : Filter.Tendsto (fun t : ℝ => t^2 / 2) (nhds (0 : ℝ)) (nhds (0 : ℝ)) := by
simpa using ((continuous_pow 2).div_const 2).tendsto (0 : ℝ)
exact hfull.mono_left nhdsWithin_le_nhds
have h_prod :
Filter.Tendsto (fun t => (t^2 / 2) * (2 * (H t - 1) / t^2))
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds ((0 : ℝ) * κ)) :=
h_t2_div.mul h_calib
have h_sub :
Filter.Tendsto (fun t => H t - 1) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ))
(nhds (0 : ℝ)) := by
have h_congr : ∀ t : ℝ, (t^2 / 2) * (2 * (H t - 1) / t^2) = H t - 1 :=
fun t => (sub_one_eq_mul_ratio H h_one t).symm
simpa using (Filter.Tendsto.congr h_congr h_prod)
have h_punct :
Filter.Tendsto H (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 1) := by
have h_const : Filter.Tendsto (fun _ : ℝ => (1 : ℝ))
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (1 : ℝ)) := tendsto_const_nhds
simpa using h_sub.add h_const
have h_cw : ContinuousWithinAt H ({(0 : ℝ)}ᶜ) 0 := by
unfold ContinuousWithinAt
rw [h_one]
exact h_punct
have h_ca : ContinuousAt H 0 := continuousWithinAt_compl_self.mp h_cw
have h := h_ca.tendsto
rwa [h_one] at h
THEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_deriv_zero : deriv H 0 = 0 := by
have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert
have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt
exact even_deriv_at_zero H h_even h_diff
exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hyp
The difference identity
The d'Alembert equation is a functional equation, a rule that a function must obey for every pair of inputs. For a function H, it reads H(t+u) + H(t-u) = 2 * H t * H u. The hyperbolic cosine, cosh, satisfies it, and so do many other functions. The lemma dAlembert_diff_square extracts a consequence of this rule: it says that for any t and u, the square of the difference between H at t+u and H at t-u equals 4 times the product of (H t)^2 - 1 and (H u)^2 - 1. In symbols, (H (t+u) - H (t-u))^2 = 4 * ((H t)^2 - 1) * ((H u)^2 - 1). This is a purely algebraic fact, derived from the d'Alembert equation and the condition H(0) = 1, with no continuity or differentiability assumptions.
The identity earns its place on the cost uniqueness page because it is the bridge from the composition law to the differential equation. The cost uniqueness theorem starts with a cost function F that satisfies five plain conditions, including a composition law. In log coordinates, the transformed function H(t) = F(e^t) + 1 obeys the d'Alembert equation. The proof needs to show that H must be cosh, and the route goes through a second-order differential equation, H'' = H. The dAlembert_diff_square lemma is what makes that route possible: it converts the algebraic constraint of the d'Alembert equation into a statement about differences, which, after taking a limit and using the calibration condition, yields the differential equation. Without this step, the proof would have no way to move from the discrete composition law to the continuous calculus that selects cosh.
In Recognition Science, the framework models recognition costs, the amounts posted when something is recognized, as forced into one formula by the five conditions. The dAlembert_diff_square lemma is a load-bearing part of that forcing result. It is a theorem in the machine-checked library, proved from the d'Alembert equation and H(0) = 1 alone. Its role is narrow but essential: it is the algebraic hinge that lets the proof pass from the composition law to the differential equation, and from there to the unique solution cosh, and finally back to the cost function J(x) = (x + 1/x)/2 - 1. The lemma itself does not mention costs or recognition; it is a general fact about functions satisfying the d'Alembert equation, and the cost uniqueness proof applies it in that specific context.
The consequence of this lemma is that the cost uniqueness proof has a clean, checkable path from its five conditions to its unique conclusion. A reader can see exactly where the composition law turns into calculus, and that the turning point is a single algebraic identity. This makes the forcing result more than a black box: the mechanism of uniqueness is visible, and the dAlembert_diff_square lemma is the part that makes it visible.
THEOREM dAlembert_diff_square · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_diff_square
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) :
∀ t u,
(H (t+u) - H (t-u))^2 = 4 * ((H t)^2 - 1) * ((H u)^2 - 1) := by
intro t u
have h_sum : H (t+u) + H (t-u) = 2 * H t * H u := h_dAlembert t u
have h_prod : H (t+u) * H (t-u) = (H t)^2 + (H u)^2 - 1 :=
dAlembert_product H h_one h_dAlembert t u
calc
(H (t+u) - H (t-u))^2
= (H (t+u) + H (t-u))^2 - 4 * (H (t+u) * H (t-u)) := by ring
_ = (2 * H t * H u)^2 - 4 * ((H t)^2 + (H u)^2 - 1) := by
simp [h_sum, h_prod]
_ = 4 * ((H t)^2 - 1) * ((H u)^2 - 1) := by ring
THEOREM dAlembert_diff_square · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_diff_square
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) :
∀ t u,
(H (t+u) - H (t-u))^2 = 4 * ((H t)^2 - 1) * ((H u)^2 - 1) := by
intro t u
have h_sum : H (t+u) + H (t-u) = 2 * H t * H u := h_dAlembert t u
have h_prod : H (t+u) * H (t-u) = (H t)^2 + (H u)^2 - 1 :=
dAlembert_product H h_one h_dAlembert t u
calc
(H (t+u) - H (t-u))^2
= (H (t+u) + H (t-u))^2 - 4 * (H (t+u) * H (t-u)) := by ring
_ = (2 * H t * H u)^2 - 4 * ((H t)^2 + (H u)^2 - 1) := by
simp [h_sum, h_prod]
_ = 4 * ((H t)^2 - 1) * ((H u)^2 - 1) := by ring
THEOREM dAlembert_to_ODE_hypothesis · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **d'Alembert to ODE derivation.**
If H satisfies the d'Alembert equation and is smooth, then H'' = H.
Proof sketch: Differentiate H(t+u) + H(t-u) = 2H(t)H(u) twice with respect to u,
then set u = 0 to get H''(t) = H''(0) · H(t). With calibration H''(0) = 1, this
gives H''(t) = H(t). -/
def dAlembert_to_ODE_hypothesis (H : ℝ → ℝ) : Prop :=
H 0 = 1 → Continuous H → (∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) →
deriv (deriv H) 0 = 1 → ∀ t, deriv (deriv H) t = H t
The combiner's place
The cost uniqueness theorem states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. That theorem answers what a single recognition cost can be. A separate question is how two costs combine when two recognitions happen together. The declaration rclCombiner answers that second question: it defines the canonical two-input formula P(u,v) = 2uv + 2u + 2v, and a machine-checked theorem proves this is the only possible combiner under the same kind of forcing.
The combiner result lives in the framework's machine-checked library of formal theorems, in the factorization and associativity gate module. The gate is a structure with four conditions: symmetry (P u v = P v u), affine response in the second argument, the boundary law P(u,0) = 2u, and the normalization P(1,1) = 6. The theorem gate_forces_rcl proves that any function P satisfying all four conditions must equal rclCombiner exactly. A second theorem, factorization_gate_iff_rcl, strengthens this to an equivalence: satisfying the gate is the same as being the canonical combiner.
On the cost uniqueness page, rclCombiner contributes a companion result rather than a step in the main proof. The main proof reaches a differential equation in log coordinates, where the transformed function H(t) = F(e^t) + 1 must satisfy H'' = H. That equation alone admits many solutions, including exponential combinations and zero solutions; the uniqueness comes from the calibration and regularity conditions. The combiner result is separate: it shows that once the single-cost form is fixed, the two-input combination law is also forced, with no free parameter left in the bilinear family. The normalization P(1,1) = 6 selects the coefficient 2, just as the boundary conditions select the single-cost formula.
The page should use rclCombiner as a clearly marked companion section. It does not belong in the main uniqueness proof, which is complete without it, but it answers a natural follow-up question a reader will have: if one recognition costs J(x), what does it cost to recognize two things at once? The combiner result closes that gap and shows the forcing structure extends beyond single costs. Leaving it off the page entirely would leave that question open; placing it in the proof would misstate the proof's dependencies.
THEOREM gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Canonical normalization selects the RCL member of the bilinear family. -/
theorem gate_forces_rcl (P : ℝ → ℝ → ℝ)
(hGate : FactorizationAssociativityGate P) :
∀ u v, P u v = 2 * u * v + 2 * u + 2 * v := by
obtain ⟨c, hc⟩ := gate_forces_bilinear_family P hGate
have hc_two : c = 2 := by
have h11 : P 1 1 = c * 1 * 1 + 2 * 1 + 2 * 1 := by
simpa using hc 1 1
linarith [hGate.unitDiagonal, h11]
intro u v
calc
P u v = c * u * v + 2 * u + 2 * v := hc u v
_ = 2 * u * v + 2 * u + 2 * v := by rw [hc_two]
THEOREM factorization_gate_iff_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Exact gate characterization: the factorization gate is equivalent to being
the canonical RCL combiner. -/
theorem factorization_gate_iff_rcl (P : ℝ → ℝ → ℝ) :
FactorizationAssociativityGate P ↔ ∀ u v, P u v = rclCombiner u v := by
constructor
· intro hGate u v
rw [gate_forces_rcl P hGate u v]
rfl
· intro hP
refine {
symmetric := ?_
rightAffine := ?_
zeroBoundary := ?_
unitDiagonal := ?_
}
· intro u v
rw [hP u v, hP v u]
unfold rclCombiner
ring
· intro u
refine ⟨2 * u + 2, 2 * u, ?_⟩
intro v
rw [hP u v]
unfold rclCombiner
ring
· intro u
rw [hP u 0]
unfold rclCombiner
ring
· rw [hP 1 1]
unfold rclCombiner
norm_num
THEOREM gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Canonical normalization selects the RCL member of the bilinear family. -/
theorem gate_forces_rcl (P : ℝ → ℝ → ℝ)
(hGate : FactorizationAssociativityGate P) :
∀ u v, P u v = 2 * u * v + 2 * u + 2 * v := by
obtain ⟨c, hc⟩ := gate_forces_bilinear_family P hGate
have hc_two : c = 2 := by
have h11 : P 1 1 = c * 1 * 1 + 2 * 1 + 2 * 1 := by
simpa using hc 1 1
linarith [hGate.unitDiagonal, h11]
intro u v
calc
P u v = c * u * v + 2 * u + 2 * v := hc u v
_ = 2 * u * v + 2 * u + 2 * v := by rw [hc_two]
The zero at the origin
The lemma deriv_neg_self_zero states a fact about a function's second derivative at the point zero: if the second derivative exists and equals the negative of the function itself, then at zero that second derivative must be zero. In plainer terms, if a function satisfies the differential equation f'' = -f near the origin, then f''(0) = 0. This is a direct consequence of the equation itself: plugging t = 0 into f''(t) = -f(t) gives f''(0) = -f(0), and the lemma supplies the additional condition that forces f(0) to be zero.
This lemma belongs on the cost uniqueness page because it is the algebraic seed of the uniqueness proof. The page's central theorem shows that any cost function obeying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof reaches a differential equation in log coordinates, where the transformed function must satisfy H'' = H. The lemma deriv_neg_self_zero is the mirror image of that equation: it handles the case where the sign is flipped. The uniqueness proof uses it to rule out the cosine solution, which satisfies H'' = -H, leaving only the hyperbolic cosine H(t) = cosh(t) as the admissible solution.
The lemma is proved in the machine-checked library of formal theorems, with no unproved assumptions beyond the standard axioms of logic. It is a small, sharp tool: it takes a differential equation and extracts a boundary condition at zero. That boundary condition is what selects the unique smooth solution from the family of possible functions. Without it, the differential equation would admit both the cosine and the hyperbolic cosine as solutions, and the cost uniqueness theorem would not close.
What the lemma changes for the reader is the shape of the proof. The cost uniqueness theorem does not rely on a long analytic argument alone; it leans on a single, clean algebraic fact at the origin. That fact is deriv_neg_self_zero, and it is the reason the proof can move from a differential equation to a unique formula for the cost.
In the framework, this lemma is part of the chain that forces the cost function to be J(x) = (x + 1/x)/2 - 1. The chain is proved in the machine-checked library, and its milestones audit to exactly the standard axioms of logic. The lemma is a link in that chain, and it earns its place on the page because it is the step that eliminates the cosine and pins down the hyperbolic cosine as the only possible solution.
THEOREM ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Zero Uniqueness)**: The unique solution to f'' = f with f(0) = f'(0) = 0 is f = 0. -/
theorem ode_zero_uniqueness (f : ℝ → ℝ)
(h_diff2 : ContDiff ℝ 2 f)
(h_ode : ∀ t, deriv (deriv f) t = f t)
(h_f0 : f 0 = 0)
(h_f'0 : deriv f 0 = 0) :
∀ t, f t = 0 := by
have ⟨h_minus, h_plus⟩ := ode_diagonalization f h_diff2 h_ode
have h_diff1 : Differentiable ℝ f := h_diff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have h_deriv_contdiff : ContDiff ℝ 1 (deriv f) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff2
rw [contDiff_succ_iff_deriv] at h_diff2
exact h_diff2.2.2
have h_diff_deriv : Differentiable ℝ (deriv f) := h_deriv_contdiff.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
let g := fun s => deriv f s - f s
let hf := fun s => deriv f s + f s
have hg_diff : Differentiable ℝ g := h_diff_deriv.sub h_diff1
have hh_diff : Differentiable ℝ hf := h_diff_deriv.add h_diff1
have hg0 : g 0 = 0 := by simp [g, h_f0, h_f'0]
have hh0 : hf 0 = 0 := by simp [hf, h_f0, h_f'0]
have hg_deriv : ∀ t, deriv g t = -g t := h_minus
have hh_deriv : ∀ t, deriv hf t = hf t := h_plus
have hg_zero := deriv_neg_self_zero g hg_diff hg_deriv hg0
have hh_zero := deriv_pos_self_zero hf hh_diff hh_deriv hh0
intro t
have hgt := hg_zero t
have hht := hh_zero t
simp only [g, hf] at hgt hht
linarith
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_deriv_zero : deriv H 0 = 0 := by
have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert
have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt
exact even_deriv_at_zero H h_even h_diff
exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hyp
The uniqueness hinge
The cost uniqueness theorem in Recognition Science states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof works by changing variables: it writes G(t) = F(e^t), so the cost F on positive numbers becomes a function G on all real numbers. In these log coordinates, the composition law turns into a cosine addition identity, and the calibration condition becomes a statement about the second derivative at zero. The transformed function H(t) = G(t) + 1 then satisfies the second-order differential equation H'' = H.
That equation alone does not select a unique function. It admits many solutions, including exponential combinations and zero functions, unless the initial conditions are fixed. The theorem ode_cosh_uniqueness supplies exactly those conditions: it states that if H satisfies H'' = H, with H(0) = 1 and H'(0) = 0, then H must be the hyperbolic cosine. The proof applies a lemma about even functions: the difference of two candidate solutions inherits the differential equation, has zero value and zero derivative at zero, and therefore is identically zero. This is the step that collapses the family of solutions down to a single one.
If ode_cosh_uniqueness were false or dropped, the chain would break at its center. The composition law and calibration would still force the differential equation, but the equation would no longer force the solution. Many functions would satisfy all the hypotheses yet disagree with cosh, so the conclusion that F equals J would fail. The later theorems that build on this result, including the golden ratio as the unique self-similar scaling and the eight-tick recognition cycle, would lose their foundation, because they all depend on the cost function being exactly J.
The library does not rely on this theorem alone. A parallel route derives the same conclusion from the d'Alembert functional equation directly, without passing through the ODE. The declaration dAlembert_cosh_solution_of_log_curvature states that if H satisfies the cosine addition identity, has H(0) = 1, has log-curvature at 0, and meets certain regularity hypotheses, then H equals cosh. This provides a backup path: even if the ODE uniqueness lemma were removed, the d'Alembert route could still reach the same result, provided its own regularity assumptions hold.
What the reader should take away is that the uniqueness story has a single hinge: the ODE plus initial conditions. The framework proves this hinge in the machine-checked library, and it also proves an alternative route through the d'Alembert equation. The cost function is forced not because the differential equation alone is powerful, but because the initial conditions pin down which of its many solutions is the real one. That is the precise sense in which the five plain conditions leave no room for choice.
THEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ)
(h_ODE : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := h_cont_hyp h_ODE
have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont
have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff
exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0
THEOREM ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Zero Uniqueness)**: The unique solution to f'' = f with f(0) = f'(0) = 0 is f = 0. -/
theorem ode_zero_uniqueness (f : ℝ → ℝ)
(h_diff2 : ContDiff ℝ 2 f)
(h_ode : ∀ t, deriv (deriv f) t = f t)
(h_f0 : f 0 = 0)
(h_f'0 : deriv f 0 = 0) :
∀ t, f t = 0 := by
have ⟨h_minus, h_plus⟩ := ode_diagonalization f h_diff2 h_ode
have h_diff1 : Differentiable ℝ f := h_diff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have h_deriv_contdiff : ContDiff ℝ 1 (deriv f) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff2
rw [contDiff_succ_iff_deriv] at h_diff2
exact h_diff2.2.2
have h_diff_deriv : Differentiable ℝ (deriv f) := h_deriv_contdiff.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
let g := fun s => deriv f s - f s
let hf := fun s => deriv f s + f s
have hg_diff : Differentiable ℝ g := h_diff_deriv.sub h_diff1
have hh_diff : Differentiable ℝ hf := h_diff_deriv.add h_diff1
have hg0 : g 0 = 0 := by simp [g, h_f0, h_f'0]
have hh0 : hf 0 = 0 := by simp [hf, h_f0, h_f'0]
have hg_deriv : ∀ t, deriv g t = -g t := h_minus
have hh_deriv : ∀ t, deriv hf t = hf t := h_plus
have hg_zero := deriv_neg_self_zero g hg_diff hg_deriv hg0
have hh_zero := deriv_pos_self_zero hf hh_diff hh_deriv hh0
intro t
have hgt := hg_zero t
have hht := hh_zero t
simp only [g, hf] at hgt hht
linarith
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
The bridge to cosh
The cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof's main route is analytic: it transforms the problem into log coordinates, where the function must satisfy a differential equation whose unique smooth solution is the hyperbolic cosine. Before that calculus begins, however, the proof needs a structural fact about the composition law, and that fact is the lemma CoshAddIdentity_implies_DirectCoshAdd.
In plain language, the lemma says this: if a cost function F satisfies the composition law, then its log-coordinate transform G(t) = F(e^t) satisfies a direct addition identity. The composition law itself is multiplicative, it governs how costs combine when you multiply two positive numbers. The lemma shows that this multiplicative structure is exactly equivalent to an additive one after the log change of variables. The direct identity is G(t+u) + G(t-u) = 2 G(t) G(u) + 2 G(t) + 2 G(u), a form that matches the classical d'Alembert equation for the hyperbolic cosine, but with extra linear terms.
The lemma is the hinge between two worlds. The cost function lives on positive reals, where multiplication is the natural operation. The hyperbolic cosine lives on all reals, where addition is natural. The log map carries one to the other, and the lemma certifies that the composition law survives the trip in exactly the right shape. Without it, the analytic machinery that solves the differential equation would have nothing to bite on; the proof would be stuck on the multiplicative side.
This is why the lemma belongs on the cost uniqueness page. It is the structural bridge that lets the proof move from the algebraic conditions on the cost to the differential equation whose solution is forced. The page tells the story of how five plain conditions pin down one function; this lemma is the moment the story becomes tractable, the point where a problem about multiplication turns into a problem about addition, and the hyperbolic cosine enters as the only possible answer.
THEOREM CoshAddIdentity_implies_DirectCoshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma CoshAddIdentity_implies_DirectCoshAdd (F : ℝ → ℝ)
(h : CoshAddIdentity F) :
DirectCoshAdd (G F) := h
MODEL SatisfiesCompositionLaw · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Composition Law (Equation 1.1)**:
F(xy) + F(x/y) = 2·F(x)·F(y) + 2·F(x) + 2·F(y) for all x, y > 0.
This is the Recognition Composition Law (RCL). -/
def SatisfiesCompositionLaw (F : ℝ → ℝ) : Prop :=
∀ x y : ℝ, 0 < x → 0 < y →
F (x * y) + F (x / y) = 2 * F x * F y + 2 * F x + 2 * F y
The reciprocal condition
The cost uniqueness theorem in Recognition Science states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The first of those conditions is the reciprocal condition, a definitional choice about what a cost function is. It declares that for any positive x, the cost of recognizing x equals the cost of recognizing its reciprocal 1/x. In plain terms, the ledger, a discrete record of recognition events, posts the same amount whether the recognition goes one way or the other. This symmetry is what makes the cost function even when viewed in logarithmic coordinates, a property the proof uses early.
The reciprocal condition appears in the machine-checked proof as the declaration IsReciprocalCost, a definition rather than a theorem. It is one of the five hypotheses of the main theorem law_of_logic_forces_jcost, alongside normalization, the composition law, calibration, and continuity. The proof shows that from the reciprocal condition alone, the transformed function G F t = F (exp t) is even. That evenness is a stepping stone: it feeds into the d'Alembert functional equation, which the proof then uses to reach a differential equation whose unique solution is the hyperbolic cosine.
Without the reciprocal condition, the cost function could distinguish a thing from its reciprocal, and the uniqueness result would not hold. The condition is therefore not an optional extra but a load-bearing premise of the theorem. The page should use it, and should present it as a definitional choice about what counts as a cost, not as a derived fact. The theorem that forces the cost function to J(x) depends on this premise, and the page's explanation of the five conditions would be incomplete without naming it.
MODEL IsReciprocalCost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Definition 2.1 (Reciprocal Cost)**
A function F : ℝ₊ → ℝ is a reciprocal cost if F(x) = F(1/x) for all x > 0. -/
def IsReciprocalCost (F : ℝ → ℝ) : Prop :=
∀ x : ℝ, 0 < x → F x = F x⁻¹
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Lemma 2.1**: If F is reciprocal, then G(t) = F(e^t) is even. -/
theorem reciprocal_implies_G_even (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) :
Function.Even (G F) :=
G_even_of_reciprocal_symmetry F (fun {x} hx => hRecip x hx)
A bridge between two equations
The cost uniqueness theorem states that any function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof works by transforming the problem into log coordinates, where the cost function F becomes a new function G(t) = F(e^t). In these coordinates, the five conditions become a single functional equation: G(t+u) + G(t-u) = 2 * G(t) * G(u) + 2 * (G(t) + G(u)). This is the cosine addition formula, and its continuous solutions are exactly the hyperbolic cosine functions G(t) = cosh(kt) for a constant k.
The lemma CoshAddIdentity_implies_DirectCoshAdd states that if a function F satisfies this cosine addition identity in log coordinates, then the transformed function G satisfies the same identity directly. This is a bridge between two ways of writing the same condition. The first way, CoshAddIdentity, is the form that appears in the main proof's hypotheses. The second way, DirectCoshAdd, is the form that is easier to manipulate when proving the uniqueness of the solution.
In the machine-checked library of formal theorems, this lemma is a short proof step. It does not introduce a new idea; it merely unpacks the definition of the transformed function G. The main theorem law_of_logic_forces_jcost does not use it, because the proof passes through a different route: it derives a differential equation in log coordinates, H'' = H, and solves that. The lemma is available for a future proof that works directly with the cosine addition identity instead of the differential equation.
For the page, the lemma contributes a clean statement of the equivalence between the two forms of the composition law. It helps a reader see that the log-coordinate transformation is not losing information: the condition on F is exactly the condition on G. This is a useful explanatory point, but it is not a new theorem. The page already covers the main result; this lemma would be a supporting detail, not a headline.
The lemma should stay available in the library, but it does not need to be on the page. The page's proof is analytic, and the lemma is algebraic. Adding it would clutter the narrative without adding substance. A reader who wants to see the equivalence can find it in the library; a reader who wants the main theorem does not need it.
THEOREM CoshAddIdentity_implies_DirectCoshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma CoshAddIdentity_implies_DirectCoshAdd (F : ℝ → ℝ)
(h : CoshAddIdentity F) :
DirectCoshAdd (G F) := h
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
A technical lemma
The declaration hasLogCurvature_full_filter_forces_zero is a technical lemma about limits. It states that if a function Hf satisfies a certain limit condition at zero, namely that 2 * (Hf t - 1) / t^2 tends to some number κ as t tends to 0, then κ must be 0. The proof is short: the same limit must hold along the sequence where t is exactly 0, and at that point the expression is undefined, forcing the limit to be 0. This is a fact about the behavior of functions near a point, not about the structure of recognition costs.
In the machine-checked proof of cost uniqueness, the relevant hypothesis is log-curvature, which is a measure of how quickly a function bends near a point, defined as the limit of 2 * (H t - 1) / t^2 as t approaches 0 from the side where t is not zero. The definition uses a restricted limit, excluding t = 0. The lemma hasLogCurvature_full_filter_forces_zero applies to a different, unrestricted limit that includes t = 0. The two are not the same, and the lemma does not directly apply to the log-curvature condition used in the proof.
For the page, this lemma is not needed. The page's story is about the five conditions that force the cost function, and the proof's route through the d'Alembert equation and the uniqueness of the cosh solution. The lemma is a small piece of technical apparatus that supports a different, more general statement, not the main theorem. Including it would add a detail without adding understanding. It should stay off the page.
THEOREM hasLogCurvature_full_filter_forces_zero · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Tripwire.** The full-filter reading of log curvature forces `κ = 0`, so at
the calibrated value `κ = 1` it is satisfied by no function at all. Kept as a
theorem so the defect cannot be reintroduced without a failing build. -/
theorem hasLogCurvature_full_filter_forces_zero (Hf : ℝ → ℝ) (κ : ℝ)
(h : Filter.Tendsto (fun t => 2 * (Hf t - 1) / t^2) (nhds 0) (nhds κ)) :
κ = 0 := by
have h1 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2)
(pure 0) (nhds κ) := h.mono_left (pure_le_nhds 0)
have h2 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2)
(pure 0) (nhds (2 * (Hf 0 - 1) / (0 : ℝ) ^ 2)) := tendsto_pure_nhds _ _
have h3 := tendsto_nhds_unique h2 h1
simpa using h3.symm
THEOREM hasLogCurvature_full_filter_forces_zero · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Tripwire.** The full-filter reading of log curvature forces `κ = 0`, so at
the calibrated value `κ = 1` it is satisfied by no function at all. Kept as a
theorem so the defect cannot be reintroduced without a failing build. -/
theorem hasLogCurvature_full_filter_forces_zero (Hf : ℝ → ℝ) (κ : ℝ)
(h : Filter.Tendsto (fun t => 2 * (Hf t - 1) / t^2) (nhds 0) (nhds κ)) :
κ = 0 := by
have h1 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2)
(pure 0) (nhds κ) := h.mono_left (pure_le_nhds 0)
have h2 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2)
(pure 0) (nhds (2 * (Hf 0 - 1) / (0 : ℝ) ^ 2)) := tendsto_pure_nhds _ _
have h3 := tendsto_nhds_unique h2 h1
simpa using h3.symm
THEOREM HasLogCurvature · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The paper's log curvature `κ(F) = lim_{t→0} 2 F(e^t)/t²`, stated on the
**punctured** filter.
The puncture is not cosmetic. On the full filter `nhds 0` this predicate is
unsatisfiable for every nonzero `κ`: Lean's division is total with `x / 0 = 0`,
so the quotient takes the value `0` at `t = 0`, and convergence along a filter
that contains the point pins the value at the point. The repo carried the
full-filter reading until 2026-07-25, which silently made two results vacuous;
`hasLogCurvature_full_filter_forces_zero` keeps that from recurring quietly. -/
def HasLogCurvature (H : ℝ → ℝ) (κ : ℝ) : Prop :=
Filter.Tendsto (fun t => 2 * (H t - 1) / t^2)
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds κ)
The bilinear gate
The cost uniqueness theorem states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The machine-checked proof reaches this conclusion through a differential equation in log coordinates. A separate declaration, gate_forces_bilinear_family, offers a different route to the same algebraic shape, and it deserves a place on this page because it isolates why the formula contains the quadratic term 2uv.
The declaration belongs to a module that formalizes a factorization and associativity gate. The gate is a structure with four properties: symmetry (P u v = P v u), affine response in the second argument for each fixed first argument, the boundary law P(u,0) = 2u, and the normalization P(1,1) = 6. The theorem gate_forces_bilinear_family proves that any function P satisfying these four properties must have the form P u v = c * u * v + 2 * u + 2 * v for some constant c. This is a pure algebra result: no continuity, no differential equations, no log coordinates.
What this contributes is a sharp separation of concerns. The hard analytic work in the cost uniqueness proof is the passage from factorization plus three-way compatibility to affine response. Once that affine response is available, the rest is algebra. The gate theorem shows that symmetry, the boundary law, and normalization together force the bilinear family, and then the canonical normalization P(1,1) = 6 forces c = 2, yielding exactly the RCL combiner 2uv + 2u + 2v. The page currently reaches this same formula through the differential equation route, but the gate route makes the algebraic forcing visible on its own.
In Recognition Science, the framework models the cost of recognition as a forced quantity. The gate theorem is a THEOREM in the machine-checked library of formal theorems, with no analytic assumptions beyond the four algebraic properties. It should stay on the page as a complementary derivation, not replace the main proof. The differential equation route establishes uniqueness from the five plain conditions; the gate route shows that the same quadratic form emerges from a purely algebraic gate. Together they give the reader two independent handles on why the cost formula has the shape it does.
The practical consequence for the page: adding this declaration strengthens the cost uniqueness narrative by showing the quadratic term is forced, not assumed. The gate is a compact, self-contained result that a reader can verify by hand, and it makes the algebraic core of the forcing argument explicit. It belongs on the page as a supporting theorem, with the differential equation route remaining the primary proof of uniqueness.
THEOREM gate_forces_bilinear_family · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Once the affine-response step is known, symmetry and the boundary law force
the entire bilinear family. -/
theorem gate_forces_bilinear_family (P : ℝ → ℝ → ℝ)
(hGate : FactorizationAssociativityGate P) :
∃ c : ℝ, ∀ u v, P u v = c * u * v + 2 * u + 2 * v := by
classical
choose α β hAffine using hGate.rightAffine
have hβ : ∀ u, β u = 2 * u := by
intro u
have h0 : P u 0 = α u * 0 + β u := hAffine u 0
rw [hGate.zeroBoundary u] at h0
linarith
let c : ℝ := α 1 - 2
refine ⟨c, ?_⟩
intro u v
have hsym1 : P u 1 = P 1 u := hGate.symmetric u 1
have hαu : α u = c * u + 2 := by
dsimp [c]
have hcalc : α u * 1 + β u = α 1 * u + β 1 := by
calc
α u * 1 + β u = P u 1 := by symm; exact hAffine u 1
_ = P 1 u := hGate.symmetric u 1
_ = α 1 * u + β 1 := hAffine 1 u
rw [hβ u, hβ 1] at hcalc
linarith
calc
P u v = α u * v + β u := hAffine u v
_ = (c * u + 2) * v + 2 * u := by rw [hαu, hβ u]
_ = c * u * v + 2 * u + 2 * v := by ring
THEOREM gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Canonical normalization selects the RCL member of the bilinear family. -/
theorem gate_forces_rcl (P : ℝ → ℝ → ℝ)
(hGate : FactorizationAssociativityGate P) :
∀ u v, P u v = 2 * u * v + 2 * u + 2 * v := by
obtain ⟨c, hc⟩ := gate_forces_bilinear_family P hGate
have hc_two : c = 2 := by
have h11 : P 1 1 = c * 1 * 1 + 2 * 1 + 2 * 1 := by
simpa using hc 1 1
linarith [hGate.unitDiagonal, h11]
intro u v
calc
P u v = c * u * v + 2 * u + 2 * v := hc u v
_ = 2 * u * v + 2 * u + 2 * v := by rw [hc_two]
MODEL FactorizationAssociativityGate · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Packaged combiner gate used by the factorization/associativity bridge. -/
structure FactorizationAssociativityGate (P : ℝ → ℝ → ℝ) : Prop where
symmetric : ∀ u v, P u v = P v u
rightAffine : ∀ u, ∃ α β, ∀ v, P u v = α * v + β
zeroBoundary : ∀ u, P u 0 = 2 * u
unitDiagonal : P 1 1 = 6
The direct identity
The cost uniqueness theorem states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof in the machine-checked library reaches a differential equation in log coordinates, where the transformed function H(t) = F(e^t) + 1 must satisfy H'' = H. The equation alone does not select a unique function. It admits many solutions, including exponential combinations and zero, so the proof must add initial conditions to force the cosh solution. That is the ODE route, and it works.
The declaration DirectCoshAdd offers a different route. It is a definition, not a theorem: it states that a function Gf satisfies the identity Gf(t+u) + Gf(t-u) = 2 * (Gf t * Gf u) + 2 * (Gf t + Gf u) for all t and u. This is the cosh addition formula written directly for the shifted function G(t) = F(e^t), without passing through the differential equation. The library proves that the composition law on F is equivalent to this direct identity on G (composition_law_equiv_coshAdd), and that the identity implies the direct form (CoshAddIdentity_implies_DirectCoshAdd). So the declaration is not a new result; it is a repackaging of the composition law in the log coordinate.
What does this contribute to the page? It makes the structure of the proof clearer. The ODE route requires regularity hypotheses to justify differentiating the functional equation. The direct identity route can in principle work with just continuity, as the theorem dAlembert_continuous_of_log_curvature shows: a function satisfying the cosine addition identity, with H(0) = 1 and log-curvature at 0, is continuous everywhere. That continuity is the regularity input that the ODE route gets from smoothness assumptions. The direct identity is also what the Jcost function itself satisfies, as Jcost_cosh_add_identity proves, so it is the natural target for a uniqueness proof.
Should it stay off the page? No. The page currently explains the proof through the differential equation, which is correct but hides the algebraic heart of the argument. The direct identity is the reason the composition law is so strong: it is not merely a bookkeeping condition, it is the cosine addition formula in disguise. Adding a sentence that names the identity and its equivalence to the composition law would let a reader see why the five conditions force one answer, rather than trusting the ODE machinery. The declaration itself is a definition, so it earns a MODEL tag, but the equivalence theorem around it is a THEOREM and is already in the library.
The practical payoff is a shorter proof sketch on the page. Instead of walking through the regularity bootstrap, the page can state: the composition law is equivalent to the direct cosh identity, and the identity plus calibration forces the solution. That is the cleanest available statement of why the cost function is unique. The ODE route remains the proof that the library actually uses, but the direct identity is the concept that makes the result memorable.
THEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G.
Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y)
becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t)
via the substitution x = e^s, y = e^t. -/
theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) :
SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by
constructor
· intro hComp t u
have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t
have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u
have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos
-- exp(t) * exp(u) = exp(t + u)
have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm
-- exp(t) / exp(u) = exp(t - u)
have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by
rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg]
simp only [G, h1, h2] at h ⊢
linarith
· intro hCosh x y hx hy
let t := Real.log x
let u := Real.log y
have hx_eq : x = Real.exp t := (Real.exp_log hx).symm
have hy_eq : y = Real.exp u := (Real.exp_log hy).symm
have h := hCosh t u
simp only [G] at h
rw [hx_eq, hy_eq]
rw [← Real.exp_add, ← Real.exp_sub]
-- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u))
-- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u)
calc F (Real.exp (t + u)) + F (Real.exp (t - u))
= 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h
_ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ring
THEOREM CoshAddIdentity_implies_DirectCoshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma CoshAddIdentity_implies_DirectCoshAdd (F : ℝ → ℝ)
(h : CoshAddIdentity F) :
DirectCoshAdd (G F) := h
THEOREM dAlembert_continuous_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_continuous_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ) :
Continuous H := by
refine continuous_iff_continuousAt.2 ?_
intro t
have h_lim_H : Filter.Tendsto H (nhds 0) (nhds 1) :=
tendsto_H_one_of_log_curvature H h_one h_calib
have h_sum :
Filter.Tendsto (fun u => H (t+u) + H (t-u)) (nhds 0) (nhds (2 * H t)) := by
have h_prod : Filter.Tendsto (fun u => (2 * H t) * H u) (nhds 0)
(nhds ((2 * H t) * (1 : ℝ))) := (tendsto_const_nhds.mul h_lim_H)
have h_prod' : Filter.Tendsto (fun u => 2 * H t * H u) (nhds 0) (nhds (2 * H t)) := by
simpa [mul_assoc] using h_prod
have h_eq : (fun u => H (t+u) + H (t-u)) = fun u => 2 * H t * H u := by
funext u
exact h_dAlembert t u
simpa [h_eq] using h_prod'
have h_diff_sq :
Filter.Tendsto (fun u => (H (t+u) - H (t-u))^2) (nhds 0) (nhds (0 : ℝ)) := by
have h_u_sq : Filter.Tendsto (fun u => (H u)^2) (nhds 0) (nhds ((1 : ℝ)^2)) := by
simpa [pow_two] using h_lim_H.mul h_lim_H
have h_u_sq_sub : Filter.Tendsto (fun u => (H u)^2 - 1) (nhds 0) (nhds (0 : ℝ)) := by
have h_const : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhds 0) (nhds (1 : ℝ)) :=
tendsto_const_nhds
simpa using h_u_sq.sub h_const
have h_const :
Filter.Tendsto (fun _ : ℝ => 4 * ((H t)^2 - 1)) (nhds 0)
(nhds (4 * ((H t)^2 - 1))) := tendsto_const_nhds
have h_mul :
Filter.Tendsto (fun u => (4 * ((H t)^2 - 1)) * ((H u)^2 - 1)) (nhds 0)
(nhds (4 * ((H t)^2 - 1) * (0 : ℝ))) := h_const.mul h_u_sq_sub
have h_eq :
(fun u => (H (t+u) - H (t-u))^2) =
(fun u => 4 * ((H t)^2 - 1) * ((H u)^2 - 1)) := by
funext u
exact dAlembert_diff_square H h_one h_dAlembert t u
simpa [h_eq] using h_mul
have h_abs :
Filter.Tendsto (fun u => |H (t+u) - H (t-u)|) (nhds 0) (nhds (0 : ℝ)) := by
have h_sqrt :
Filter.Tendsto (fun u => Real.sqrt ((H (t+u) - H (t-u))^2)) (nhds 0)
(nhds (Real.sqrt 0)) :=
(Real.continuous_sqrt.tendsto 0).comp h_diff_sq
simpa [Real.sqrt_sq_eq_abs] using h_sqrt
have h_diff :
Filter.Tendsto (fun u => H (t+u) - H (t-u)) (nhds 0) (nhds (0 : ℝ)) :=
(tendsto_zero_iff_abs_tendsto_zero (f := fun u => H (t+u) - H (t-u))).2 h_abs
have h_sum_diff :
Filter.Tendsto
(fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u)))
(nhds 0) (nhds ((2 * H t) + (0 : ℝ))) := h_sum.add h_diff
have h_twice : Filter.Tendsto (fun u => 2 * H (t+u)) (nhds 0) (nhds (2 * H t)) := by
have h_sum_diff' :
Filter.Tendsto
(fun u => H (t+u) + H (t+u))
(nhds 0) (nhds (2 * H t)) := by
have h_eq :
(fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) =
(fun u => H (t+u) + H (t+u)) := by
funext u
ring
have h_sum_diff'' :
Filter.Tendsto
(fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u)))
(nhds 0) (nhds (2 * H t)) := by
simpa using h_sum_diff
simpa [h_eq] using h_sum_diff''
simpa [two_mul] using h_sum_diff'
have h_half :
Filter.Tendsto (fun u => (2 * H (t+u)) / 2) (nhds 0) (nhds ((2 * H t) / 2)) := by
have h_const : Filter.Tendsto (fun _ : ℝ => (1 / 2 : ℝ)) (nhds 0) (nhds (1 / 2 : ℝ)) :=
tendsto_const_nhds
simpa [div_eq_mul_inv] using h_twice.mul h_const
have h_at0 : Filter.Tendsto (fun u => H (t+u)) (nhds 0) (nhds (H t)) := by
simpa using h_half
have h_map :
Filter.Tendsto H (Filter.map (fun u => t + u) (nhds 0)) (nhds (H t)) :=
(Filter.tendsto_map'_iff).2 h_at0
have h_tendsto : Filter.Tendsto H (nhds t) (nhds (H t)) := by
simpa [map_add_left_nhds_zero] using h_map
exact h_tendsto
THEOREM Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_cosh_add_identity : CoshAddIdentity Cost.Jcost := by
intro t u
simp only [G, Jcost]
-- Use exp(t+u) = exp(t)*exp(u) and exp(t-u) = exp(t)/exp(u)
have he1 : Real.exp (t + u) = Real.exp t * Real.exp u := Real.exp_add t u
have he2 : Real.exp (t - u) = Real.exp t / Real.exp u := by
rw [sub_eq_add_neg, Real.exp_add, Real.exp_neg]
ring
have hpos_t : Real.exp t > 0 := Real.exp_pos t
have hpos_u : Real.exp u > 0 := Real.exp_pos u
have hne_t : Real.exp t ≠ 0 := hpos_t.ne'
have hne_u : Real.exp u ≠ 0 := hpos_u.ne'
rw [he1, he2]
field_simp
ring
The zero solution
The differential equation H'' = H, where H is a twice-differentiable real function, has many solutions. The exponential functions e^t and e^-t both satisfy it, as does any linear combination of them, and so does the zero function. The equation alone does not select a unique function; it describes a whole family of curves.
The lemma ode_zero_uniqueness adds two initial conditions to break the family apart. It states that if a twice-differentiable function f satisfies f'' = f everywhere, and if f(0) = 0 and f'(0) = 0, then f is identically zero. The proof is a standard uniqueness argument for linear differential equations: the difference of any two solutions with the same initial data must itself satisfy the equation with zero initial data, and the lemma forces that difference to vanish everywhere.
On the cost uniqueness page, this lemma is the last step in a chain. The proof of the main theorem transforms the cost function into log coordinates, where the transformed function H(t) = F(e^t) + 1 must satisfy H'' = H. The initial conditions H(0) = 1 and H'(0) = 0 come from the normalization and calibration conditions on the original cost. Two candidate solutions to the differential equation with those initial data have a difference that satisfies the zero initial conditions, so the lemma forces the difference to be zero. That identifies the two candidates, leaving exactly one solution: H(t) = cosh t, which corresponds to the unique cost J(x) = (x + 1/x)/2 - 1.
The lemma earns its place because it is the mechanism that converts the differential equation into a uniqueness statement. Without it, the equation H'' = H would leave the proof incomplete, with an infinite family of possible costs. With it, the proof closes: the five plain conditions on a cost function force a single formula, and no other function can survive the same constraints.
THEOREM ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Zero Uniqueness)**: The unique solution to f'' = f with f(0) = f'(0) = 0 is f = 0. -/
theorem ode_zero_uniqueness (f : ℝ → ℝ)
(h_diff2 : ContDiff ℝ 2 f)
(h_ode : ∀ t, deriv (deriv f) t = f t)
(h_f0 : f 0 = 0)
(h_f'0 : deriv f 0 = 0) :
∀ t, f t = 0 := by
have ⟨h_minus, h_plus⟩ := ode_diagonalization f h_diff2 h_ode
have h_diff1 : Differentiable ℝ f := h_diff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have h_deriv_contdiff : ContDiff ℝ 1 (deriv f) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff2
rw [contDiff_succ_iff_deriv] at h_diff2
exact h_diff2.2.2
have h_diff_deriv : Differentiable ℝ (deriv f) := h_deriv_contdiff.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
let g := fun s => deriv f s - f s
let hf := fun s => deriv f s + f s
have hg_diff : Differentiable ℝ g := h_diff_deriv.sub h_diff1
have hh_diff : Differentiable ℝ hf := h_diff_deriv.add h_diff1
have hg0 : g 0 = 0 := by simp [g, h_f0, h_f'0]
have hh0 : hf 0 = 0 := by simp [hf, h_f0, h_f'0]
have hg_deriv : ∀ t, deriv g t = -g t := h_minus
have hh_deriv : ∀ t, deriv hf t = hf t := h_plus
have hg_zero := deriv_neg_self_zero g hg_diff hg_deriv hg0
have hh_zero := deriv_pos_self_zero hf hh_diff hh_deriv hh0
intro t
have hgt := hg_zero t
have hht := hh_zero t
simp only [g, hf] at hgt hht
linarith
THEOREM dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Derivation, universal coefficient)**: If H is C∞ and
satisfies d'Alembert, then `H''(t) = H''(0) * H(t)` everywhere.
This is the unnormalized form of `dAlembert_to_ODE_theorem`. -/
theorem dAlembert_to_ODE_general_theorem (H : ℝ → ℝ)
(h_smooth : ContDiff ℝ ⊤ H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) :
∀ t, deriv (deriv H) t = deriv (deriv H) 0 * H t := by
have hCDiff2 : ContDiff ℝ 2 H := h_smooth.of_le le_top
have hDiff : Differentiable ℝ H :=
hCDiff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have hCDiff1_H' : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at hCDiff2
rw [contDiff_succ_iff_deriv] at hCDiff2
exact hCDiff2.2.2
have hDiffDeriv : Differentiable ℝ (deriv H) :=
hCDiff1_H'.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
have hsh_add : ∀ (s v : ℝ), HasDerivAt (fun u => s + u) (1 : ℝ) v := fun s v => by
have h := (hasDerivAt_id v).add_const s; simp only [id] at h
rwa [show (fun u : ℝ => u + s) = fun u => s + u from funext fun u => add_comm u s] at h
have hsh_sub : ∀ (s v : ℝ), HasDerivAt (fun u => s - u) (-1 : ℝ) v := fun s v => by
have h1 : HasDerivAt (fun u : ℝ => -u) (-1 : ℝ) v := by
have := (hasDerivAt_id v).neg; simp only [id] at this; exact this
have h2 := h1.const_add s
rwa [show (fun u : ℝ => s + -u) = fun u => s - u from funext fun u => by ring] at h2
intro t
have h_feq : (fun u => H (t + u) + H (t - u)) = (fun u => 2 * H t * H u) :=
funext (h_dAlembert t)
have key : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 =
deriv (deriv (fun u => 2 * H t * H u)) 0 :=
congr_arg (fun f => deriv (deriv f) 0) h_feq
have lhs_eq : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = 2 * deriv (deriv H) t := by
have h_plus : ∀ v, HasDerivAt (fun u => H (t + u)) (deriv H (t + v)) v := fun v => by
have hH := (hDiff (t + v)).hasDerivAt
have hcomp := hH.comp v (hsh_add t v)
simp only [mul_one, Function.comp_apply] at hcomp; exact hcomp
have h_minus : ∀ v, HasDerivAt (fun u => H (t - u)) (-deriv H (t - v)) v := fun v => by
have hH := (hDiff (t - v)).hasDerivAt
have hcomp := hH.comp v (hsh_sub t v)
simp only [mul_neg, mul_one, Function.comp_apply] at hcomp; exact hcomp
have hfirst_fun : deriv (fun u => H (t + u) + H (t - u)) =
fun v => deriv H (t + v) - deriv H (t - v) := funext fun v => by
have heq : (fun u => H (t + u)) + (fun u => H (t - u)) =
fun u => H (t + u) + H (t - u) := by ext u; rfl
have h12 : deriv (fun u => H (t + u) + H (t - u)) v = deriv H (t + v) + -deriv H (t - v) := by
rw [← heq]; exact ((h_plus v).add (h_minus v)).deriv
linarith [show deriv H (t + v) + -deriv H (t - v) =
deriv H (t + v) - deriv H (t - v) from by ring]
have hd2_plus : HasDerivAt (fun v => deriv H (t + v)) (deriv (deriv H) t) 0 := by
have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t + 0)) (t + 0) :=
(hDiffDeriv (t + 0)).hasDerivAt
have hcomp := hDH.comp 0 (hsh_add t 0)
simp only [mul_one, add_zero, Function.comp_apply] at hcomp; exact hcomp
have hd2_minus : HasDerivAt (fun v => deriv H (t - v)) (-deriv (deriv H) t) 0 := by
have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t - 0)) (t - 0) :=
(hDiffDeriv (t - 0)).hasDerivAt
have hcomp := hDH.comp 0 (hsh_sub t 0)
simp only [mul_neg, mul_one, sub_zero, Function.comp_apply] at hcomp; exact hcomp
rw [congr_fun (congr_arg deriv hfirst_fun) 0]
have heq2 : (fun v => deriv H (t + v)) - (fun v => deriv H (t - v)) =
fun v => deriv H (t + v) - deriv H (t - v) := by ext v; rfl
have h : deriv (fun v => deriv H (t + v) - deriv H (t - v)) 0 =
deriv (deriv H) t - -deriv (deriv H) t := by
rw [← heq2]; exact (hd2_plus.sub hd2_minus).deriv
linarith [show deriv (deriv H) t - -deriv (deriv H) t = 2 * deriv (deriv H) t from by ring]
have rhs_eq : deriv (deriv (fun u => 2 * H t * H u)) 0 =
2 * H t * deriv (deriv H) 0 := by
have hfirst_fun : deriv (fun u => 2 * H t * H u) = fun v => 2 * H t * deriv H v :=
funext fun v => ((hDiff v).hasDerivAt.const_mul (2 * H t)).deriv
have hsecond := (hDiffDeriv 0).hasDerivAt.const_mul (2 * H t)
rw [congr_fun (congr_arg deriv hfirst_fun) 0, hsecond.deriv]
rw [lhs_eq, rhs_eq] at key
linarith
THEOREM logCurvature_forces_normalized · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The composition law together with unit log curvature force normalization.
The composition law at `y = 1` gives `F 1 * (F x + 1) = 0`, so either `F 1 = 0`
or `F` is constantly `-1`; the constant has `H ≡ 0`, whose curvature quotient is
negative throughout a punctured neighbourhood and so cannot tend to `1`. -/
theorem logCurvature_forces_normalized (F : ℝ → ℝ)
(hComp : SatisfiesCompositionLaw F) (hκ : HasLogCurvature (H F) 1) :
IsNormalized F := by
by_contra hne
have hconst : ∀ x : ℝ, 0 < x → F x = -1 := by
intro x hx
have h := hComp x 1 hx one_pos
rw [mul_one, div_one] at h
have hquad : F 1 * (F x + 1) = 0 := by nlinarith
rcases mul_eq_zero.mp hquad with h1 | h2
· exact absurd h1 hne
· linarith
have hH : ∀ t : ℝ, H F t = 0 := by
intro t
have hx := hconst (Real.exp t) (Real.exp_pos t)
simp [H, G, hx]
have hgt : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ),
(1 / 2 : ℝ) < 2 * (H F t - 1) / t ^ 2 :=
hκ.eventually (eventually_gt_nhds (by norm_num))
have hne0 : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), t ≠ 0 := by
filter_upwards [self_mem_nhdsWithin] with t ht using ht
obtain ⟨t, hgt', ht0⟩ := (hgt.and hne0).exists
have ht2 : 0 < t ^ 2 := by positivity
have hneg : 2 * (H F t - 1) / t ^ 2 < 0 := by
rw [hH t]
exact div_neg_of_neg_of_pos (by norm_num) ht2
linarith
The role of symmetry
The cost uniqueness theorem states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. One of those conditions is reciprocal symmetry: the cost of recognizing x equals the cost of recognizing its reciprocal 1/x. The theorem reciprocal_implies_G_even shows that this symmetry condition forces the transformed function G(t) = F(e^t) to be even, meaning G(t) = G(-t) for all t. This evenness is not a minor convenience; it is the property that selects the cosine-like solution from a family of possibilities.
Without evenness, the transformed function H(t) = F(e^t) + 1 could satisfy the d'Alembert equation H(t+u) + H(t-u) = 2 H(t) H(u) but fail to be uniquely determined. The d'Alembert equation admits many continuous solutions, including exponential combinations and zero functions, as the framework's own documentation notes. The evenness condition, derived from reciprocal symmetry, supplies the boundary condition H'(0) = 0 that forces the solution to be the hyperbolic cosine. The theorem ode_cosh_uniqueness proves that the differential equation H'' = H with initial conditions H(0) = 1 and H'(0) = 0 has exactly one solution, namely cosh. Dropping evenness removes that second initial condition, and the uniqueness argument collapses.
The framework's library of machine-checked formal theorems shows the chain explicitly. The theorem composition_law_equiv_coshAdd proves that the composition law is equivalent to a cosine addition identity in log coordinates. The theorem dAlembert_cosh_solution_of_log_curvature then derives the cosh conclusion from the d'Alembert equation, the calibration condition, and the evenness that reciprocal symmetry provides. The final theorem law_of_logic_forces_jcost assembles all five conditions to reach J(x). Each step depends on the one before; lose the evenness, and the chain breaks at the point where the functional equation becomes a solvable differential equation.
The practical consequence is that reciprocal symmetry is load-bearing. It is the condition that rules out exotic solutions and pins the cost function to its unique form. A reader who sees the five conditions listed might think the composition law does the heavy lifting; in fact, the symmetry condition is what makes the composition law tractable. The framework's proof would not go through without it, and the uniqueness result would reduce to a statement about a family of possible costs rather than a single forced formula.
THEOREM reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Lemma 2.1**: If F is reciprocal, then G(t) = F(e^t) is even. -/
theorem reciprocal_implies_G_even (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) :
Function.Even (G F) :=
G_even_of_reciprocal_symmetry F (fun {x} hx => hRecip x hx)
MODEL dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ)
(h_ODE : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := h_cont_hyp h_ODE
have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont
have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff
exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0
THEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G.
Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y)
becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t)
via the substitution x = e^s, y = e^t. -/
theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) :
SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by
constructor
· intro hComp t u
have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t
have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u
have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos
-- exp(t) * exp(u) = exp(t + u)
have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm
-- exp(t) / exp(u) = exp(t - u)
have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by
rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg]
simp only [G, h1, h2] at h ⊢
linarith
· intro hCosh x y hx hy
let t := Real.log x
let u := Real.log y
have hx_eq : x = Real.exp t := (Real.exp_log hx).symm
have hy_eq : y = Real.exp u := (Real.exp_log hy).symm
have h := hCosh t u
simp only [G] at h
rw [hx_eq, hy_eq]
rw [← Real.exp_add, ← Real.exp_sub]
-- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u))
-- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u)
calc F (Real.exp (t + u)) + F (Real.exp (t - u))
= 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h
_ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ring
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
Calibration's role
The cost uniqueness theorem states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The five conditions are reciprocal symmetry, zero cost at unity, a forced composition law, calibration, and continuity. The theorem is proved in the machine-checked library of formal theorems, with no unproved assumptions beyond the standard axioms of logic.
The calibration condition is the one that fixes the local scale of recognition near the identity. It is stated as the limit of 2 * (H(t) - 1) / t^2 as t approaches 0, where H is the log-coordinate transform of the cost function. This limit, called the log-curvature, is the second derivative of H at zero when H is smooth enough. The condition says this log-curvature equals 1, which selects the hyperbolic cosine solution from the family of functions satisfying the differential equation H'' = H.
Without calibration, the composition law alone does not force a unique cost. The differential equation admits many solutions, including exponential combinations and zero. The calibration condition is what rules out these alternatives and forces the specific solution that leads to J(x). In the proof, the log-curvature condition is also what implies the cost is normalized, meaning the cost of recognizing something identical to itself is zero.
In Recognition Science, the framework models reality as preserving a ledger of recognition events, where the cost of recognition is forced, not chosen. The calibration condition is the input that sets the unit of recognition. The theorem shows that once this unit is set, the entire cost function is determined. This is what makes the cost uniqueness result a forcing result rather than a description of one possible cost among many.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM HasLogCurvature · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The paper's log curvature `κ(F) = lim_{t→0} 2 F(e^t)/t²`, stated on the
**punctured** filter.
The puncture is not cosmetic. On the full filter `nhds 0` this predicate is
unsatisfiable for every nonzero `κ`: Lean's division is total with `x / 0 = 0`,
so the quotient takes the value `0` at `t = 0`, and convergence along a filter
that contains the point pins the value at the point. The repo carried the
full-filter reading until 2026-07-25, which silently made two results vacuous;
`hasLogCurvature_full_filter_forces_zero` keeps that from recurring quietly. -/
def HasLogCurvature (H : ℝ → ℝ) (κ : ℝ) : Prop :=
Filter.Tendsto (fun t => 2 * (H t - 1) / t^2)
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds κ)
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM logCurvature_forces_normalized · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The composition law together with unit log curvature force normalization.
The composition law at `y = 1` gives `F 1 * (F x + 1) = 0`, so either `F 1 = 0`
or `F` is constantly `-1`; the constant has `H ≡ 0`, whose curvature quotient is
negative throughout a punctured neighbourhood and so cannot tend to `1`. -/
theorem logCurvature_forces_normalized (F : ℝ → ℝ)
(hComp : SatisfiesCompositionLaw F) (hκ : HasLogCurvature (H F) 1) :
IsNormalized F := by
by_contra hne
have hconst : ∀ x : ℝ, 0 < x → F x = -1 := by
intro x hx
have h := hComp x 1 hx one_pos
rw [mul_one, div_one] at h
have hquad : F 1 * (F x + 1) = 0 := by nlinarith
rcases mul_eq_zero.mp hquad with h1 | h2
· exact absurd h1 hne
· linarith
have hH : ∀ t : ℝ, H F t = 0 := by
intro t
have hx := hconst (Real.exp t) (Real.exp_pos t)
simp [H, G, hx]
have hgt : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ),
(1 / 2 : ℝ) < 2 * (H F t - 1) / t ^ 2 :=
hκ.eventually (eventually_gt_nhds (by norm_num))
have hne0 : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), t ≠ 0 := by
filter_upwards [self_mem_nhdsWithin] with t ht using ht
obtain ⟨t, hgt', ht0⟩ := (hgt.and hne0).exists
have ht2 : 0 < t ^ 2 := by positivity
have hneg : 2 * (H F t - 1) / t ^ 2 < 0 := by
rw [hH t]
exact div_neg_of_neg_of_pos (by norm_num) ht2
linarith
The calibration anchor
The cost uniqueness theorem in the Recognition Science framework states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The five conditions are reciprocal symmetry, zero cost at unity, a forced composition law, calibration, and continuity. The calibration condition is the one that fixes the local scale of recognition near the identity, and it is the one whose removal would most directly break the proof.
The calibration condition is expressed through a quantity called the log-curvature of the transformed function H(t) = F(e^t) + 1. The condition says that the limit of 2 * (H(t) - 1) / t^2 as t approaches 0 exists and equals a specific number, conventionally taken to be 1. This number is the second derivative of H at zero, and it is what selects the cosine-hyperbolic solution from the family of solutions to the differential equation H'' = H.
The lemma hasLogCurvature_full_filter_forces_zero states that if the limit of 2 * (H(t) - 1) / t^2 exists as t approaches 0, then the limiting value must be 0. This is a consequence of the fact that H(0) = 1, which makes the numerator zero at t = 0, and the denominator t^2 also vanishes there. The lemma is what forces the calibration constant to be exactly the second derivative at zero, and it is what makes the calibration condition a genuine constraint rather than a free parameter.
If this lemma were false or dropped, the calibration condition would no longer pin down the second derivative at zero. The differential equation H'' = H would still hold, but its solutions would include exponential combinations and zero, not just the cosine-hyperbolic function. The uniqueness proof would fail at the point where it needs to identify the initial conditions H(0) = 1 and H'(0) = 0. Without the lemma, the proof could not rule out other solutions that satisfy the same equation but with different initial slopes.
The lemma is not an isolated technicality; it is the bridge between the geometric notion of curvature and the algebraic structure of the composition law. It is what makes the calibration condition meaningful in the first place. Dropping it would leave the cost uniqueness theorem without its anchor, and the framework would lose its grip on the claim that the cost function is forced.
THEOREM hasLogCurvature_full_filter_forces_zero · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Tripwire.** The full-filter reading of log curvature forces `κ = 0`, so at
the calibrated value `κ = 1` it is satisfied by no function at all. Kept as a
theorem so the defect cannot be reintroduced without a failing build. -/
theorem hasLogCurvature_full_filter_forces_zero (Hf : ℝ → ℝ) (κ : ℝ)
(h : Filter.Tendsto (fun t => 2 * (Hf t - 1) / t^2) (nhds 0) (nhds κ)) :
κ = 0 := by
have h1 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2)
(pure 0) (nhds κ) := h.mono_left (pure_le_nhds 0)
have h2 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2)
(pure 0) (nhds (2 * (Hf 0 - 1) / (0 : ℝ) ^ 2)) := tendsto_pure_nhds _ _
have h3 := tendsto_nhds_unique h2 h1
simpa using h3.symm
MODEL HasLogCurvature · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The paper's log curvature `κ(F) = lim_{t→0} 2 F(e^t)/t²`, stated on the
**punctured** filter.
The puncture is not cosmetic. On the full filter `nhds 0` this predicate is
unsatisfiable for every nonzero `κ`: Lean's division is total with `x / 0 = 0`,
so the quotient takes the value `0` at `t = 0`, and convergence along a filter
that contains the point pins the value at the point. The repo carried the
full-filter reading until 2026-07-25, which silently made two results vacuous;
`hasLogCurvature_full_filter_forces_zero` keeps that from recurring quietly. -/
def HasLogCurvature (H : ℝ → ℝ) (κ : ℝ) : Prop :=
Filter.Tendsto (fun t => 2 * (H t - 1) / t^2)
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds κ)
THEOREM ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Zero Uniqueness)**: The unique solution to f'' = f with f(0) = f'(0) = 0 is f = 0. -/
theorem ode_zero_uniqueness (f : ℝ → ℝ)
(h_diff2 : ContDiff ℝ 2 f)
(h_ode : ∀ t, deriv (deriv f) t = f t)
(h_f0 : f 0 = 0)
(h_f'0 : deriv f 0 = 0) :
∀ t, f t = 0 := by
have ⟨h_minus, h_plus⟩ := ode_diagonalization f h_diff2 h_ode
have h_diff1 : Differentiable ℝ f := h_diff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have h_deriv_contdiff : ContDiff ℝ 1 (deriv f) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff2
rw [contDiff_succ_iff_deriv] at h_diff2
exact h_diff2.2.2
have h_diff_deriv : Differentiable ℝ (deriv f) := h_deriv_contdiff.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
let g := fun s => deriv f s - f s
let hf := fun s => deriv f s + f s
have hg_diff : Differentiable ℝ g := h_diff_deriv.sub h_diff1
have hh_diff : Differentiable ℝ hf := h_diff_deriv.add h_diff1
have hg0 : g 0 = 0 := by simp [g, h_f0, h_f'0]
have hh0 : hf 0 = 0 := by simp [hf, h_f0, h_f'0]
have hg_deriv : ∀ t, deriv g t = -g t := h_minus
have hh_deriv : ∀ t, deriv hf t = hf t := h_plus
have hg_zero := deriv_neg_self_zero g hg_diff hg_deriv hg0
have hh_zero := deriv_pos_self_zero hf hh_diff hh_deriv hh0
intro t
have hgt := hg_zero t
have hht := hh_zero t
simp only [g, hf] at hgt hht
linarith
Why only one cost
Imagine you are keeping books for the universe. Every time something is recognized, the ledger posts a cost. The cost of doing nothing must be zero. The cost of swapping a ratio for its reciprocal must be the same cost (looking both ways is free). And when two events compose, their costs combine by a fixed rule, not by taste. Ask which functions of a positive number obey those rules and one more, a unit of curvature that sets the scale. The answer is not a family. It is a single function: J(x) = (x + 1/x)/2 - 1.
That uniqueness is the load-bearing fact beneath most of Recognition Science. If many costs were allowed, every later prediction would hide a free parameter. Because only J survives, the price of a prime, the shape of a particle mass ladder, and the reading of the Riemann Hypothesis as a conservation law all inherit the same spine. The proof lives in the library as a chain of ordinary functional equations, not as a new axiom.
Under the stated regularity package, the composition law and unit log curvature force F(x) = J(x) = (x + 1/x)/2 - 1 for every x > 0. THEOREM
The argument, said without symbols first: reciprocity makes the cost even in logarithmic coordinates, so it cannot prefer one direction over its opposite. Normalization pins the cost of a perfect match at zero. Continuity upgrades the solution from merely continuous to smooth. The curvature condition then fixes the second derivative at the origin, which is enough to force the unique solution of the resulting differential equation to be the hyperbolic cosine. Translating back from log coordinates gives J.
In symbols, the composition law becomes the d'Alembert equation after a short change of variables. Reciprocal symmetry makes G even; setting F(1) = 0 gives G(0) = 0; writing H = G + 1 gives H(0) = 1. Under the regularity package used for the classification, any continuous solution of that equation with H(0) = 1 is smooth. Evenness forces H'(0) = 0, and unit log curvature fixes H''(0) = 1. The equation H'' = H with those initial data has the unique solution H(t) = cosh t, so G(t) = cosh t - 1, which is J in the original variable. THEOREM
What this page is really saying is small and large at once. Small: a classical functional equation, proved carefully, forces one formula. Large: the theory does not get to choose how expensive recognition is. The cost is part of the furniture of the ledger, the way primes are part of the furniture of multiplication.
THEOREM composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **The cost theorem on two premises.** The composition law and unit log
curvature force `F = J` on the positives. Normalization, nonnegativity, and
continuity are all conclusions rather than hypotheses; compare
`law_of_logic_forces_jcost`, which assumes all of them. -/
theorem composition_logCurvature_forces_jcost [AczelSmoothnessPackage]
(F : ℝ → ℝ)
(hComp : SatisfiesCompositionLaw F)
(hκ : HasLogCurvature (H F) 1) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
have hNorm : IsNormalized F := logCurvature_forces_normalized F hComp hκ
have hN : F 1 = 0 := hNorm
have hH0 : H F 0 = 1 := by simp [H, G, hN]
have hCosh : CoshAddIdentity F := (composition_law_equiv_coshAdd F).mp hComp
have hdA : ∀ t u, H F (t + u) + H F (t - u) = 2 * H F t * H F u := by
intro t u
have hG := hCosh t u
have hgoal :
(G F (t + u) + 1) + (G F (t - u) + 1) =
2 * (G F t + 1) * (G F u + 1) := by
calc
(G F (t + u) + 1) + (G F (t - u) + 1)
= (G F (t + u) + G F (t - u)) + 2 := by ring
_ = (2 * (G F t * G F u) + 2 * (G F t + G F u)) + 2 := by simpa [hG]
_ = 2 * (G F t + 1) * (G F u + 1) := by ring
simpa [H] using hgoal
have hcont : Continuous (H F) :=
dAlembert_continuous_of_log_curvature (H F) hH0 hdA hκ
have hsm : ContDiff ℝ ⊤ (H F) := aczel_dAlembert_smooth (H F) hH0 hcont hdA
have heven : Function.Even (H F) := dAlembert_even (H F) hH0 hdA
have hd0 : deriv (H F) 0 = 0 :=
even_deriv_at_zero (H F) heven
(hsm.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) 0)
have hd2 : deriv (deriv (H F)) 0 = 1 :=
deriv2_of_logCurvature (H F) hsm hH0 hd0 hκ
have hcosh : ∀ t, H F t = Real.cosh t :=
dAlembert_cosh_solution_aczel (H F) hH0 hcont hdA hd2
intro x hx
have hGc : G F (Real.log x) = Real.cosh (Real.log x) - 1 := by
have h := hcosh (Real.log x)
simp only [H] at h
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc
F x = F (Real.exp (Real.log x)) := by rw [ht]
_ = G F (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := hGc
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM composition_law_equiv_coshAdd · H · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G.
Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y)
becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t)
via the substitution x = e^s, y = e^t. -/
theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) :
SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by
constructor
· intro hComp t u
have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t
have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u
have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos
-- exp(t) * exp(u) = exp(t + u)
have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm
-- exp(t) / exp(u) = exp(t - u)
have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by
rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg]
simp only [G, h1, h2] at h ⊢
linarith
· intro hCosh x y hx hy
let t := Real.log x
let u := Real.log y
have hx_eq : x = Real.exp t := (Real.exp_log hx).symm
have hy_eq : y = Real.exp u := (Real.exp_log hy).symm
have h := hCosh t u
simp only [G] at h
rw [hx_eq, hy_eq]
rw [← Real.exp_add, ← Real.exp_sub]
-- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u))
-- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u)
calc F (Real.exp (t + u)) + F (Real.exp (t - u))
= 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h
_ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ring
/-- Convenience reparametrization: `H_F t = G_F t + 1`. -/
@[simp] noncomputable def H (F : ℝ → ℝ) (t : ℝ) : ℝ := G F t + 1
THEOREM reciprocal_implies_G_even · normalized_implies_G_zero · H · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Lemma 2.1**: If F is reciprocal, then G(t) = F(e^t) is even. -/
theorem reciprocal_implies_G_even (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) :
Function.Even (G F) :=
G_even_of_reciprocal_symmetry F (fun {x} hx => hRecip x hx)
/-- **Lemma**: If F is normalized, then G(0) = 0. -/
theorem normalized_implies_G_zero (F : ℝ → ℝ) (hNorm : IsNormalized F) :
G F 0 = 0 :=
G_zero_of_unit F hNorm
/-- Convenience reparametrization: `H_F t = G_F t + 1`. -/
@[simp] noncomputable def H (F : ℝ → ℝ) (t : ℝ) : ℝ := G F t + 1
THEOREM dAlembert_smooth_of_aczel · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The `dAlembert_continuous_implies_smooth_hypothesis` holds for every H,
as a direct consequence of the Aczél axiom. -/
theorem dAlembert_smooth_of_aczel [AczelSmoothnessPackage] (H : ℝ → ℝ) :
dAlembert_continuous_implies_smooth_hypothesis H :=
fun h_one h_cont h_dAlembert => aczel_dAlembert_smooth H h_one h_cont h_dAlembert
THEOREM even_deriv_at_zero · deriv2_of_logCurvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem even_deriv_at_zero (H : ℝ → ℝ)
(h_even : Function.Even H) (h_diff : DifferentiableAt ℝ H 0) : deriv H 0 = 0 := by
-- For even functions, the derivative at 0 is 0
let negFun : ℝ → ℝ := fun x => -x
have h1 : deriv H 0 = deriv (H ∘ negFun) 0 := by
congr 1
ext x
simp only [Function.comp_apply, negFun]
exact (h_even x).symm
have h2 : deriv (H ∘ negFun) 0 = -deriv H 0 := by
have hd : DifferentiableAt ℝ negFun 0 := differentiable_neg.differentiableAt
have h_diff_neg : DifferentiableAt ℝ H (negFun 0) := by simp [negFun]; exact h_diff
have hchain := deriv_comp (x := (0 : ℝ)) h_diff_neg hd
rw [hchain]
simp only [negFun, neg_zero]
have hdn : deriv negFun 0 = -1 := congrFun deriv_neg' 0
rw [hdn]
ring
rw [h1] at h2
linarith
/-- Unit log curvature pins the second derivative at the origin. -/
theorem deriv2_of_logCurvature (Hf : ℝ → ℝ) (hsm : ContDiff ℝ ⊤ Hf)
(h1 : Hf 0 = 1) (hd0 : deriv Hf 0 = 0) (hκ : HasLogCurvature Hf 1) :
deriv (deriv Hf) 0 = 1 :=
tendsto_nhds_unique (logCurvature_eq_deriv2 Hf hsm h1 hd0) hκ
THEOREM ode_cosh_uniqueness_contdiff · Jcost_G_eq_cosh_sub_one · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/
theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ)
(h_diff : ContDiff ℝ 2 H)
(h_ode : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0) :
∀ t, H t = Real.cosh t := by
let g := fun t => H t - Real.cosh t
have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh
have hg_ode : ∀ t, deriv (deriv g) t = g t := by
intro t
have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by
ext s; apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by
have hH_diff1 : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff
rw [contDiff_succ_iff_deriv] at h_diff
exact h_diff.2.2
have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by
rw [Real.deriv_cosh]; exact Real.contDiff_sinh
rw [h1]; apply deriv_sub
· exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
· exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
rw [h2, h_ode t, cosh_second_deriv_eq t]
have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero]
have hg'0 : deriv g 0 = 0 := by
have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by
apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring
have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0
intro t
have := hg_zero t
simp only [g] at this; linarith
theorem Jcost_G_eq_cosh_sub_one (t : ℝ) : G Cost.Jcost t = Real.cosh t - 1 := by
simp only [G, Jcost]
-- Jcost(exp t) = (exp t + exp(-t))/2 - 1 = cosh t - 1
have h1 : (Real.exp t)⁻¹ = Real.exp (-t) := by simp [Real.exp_neg]
rw [h1, Real.cosh_eq]
The hinge at cosh
The cost uniqueness theorem states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof passes through a logarithmic change of variables, where the cost function F becomes G(t) = F(e^t). The theorem Jcost_G_eq_cosh_sub_one states that for the unique solution, this transformed function is exactly G(t) = cosh(t) - 1. This identity is the bridge between the abstract composition law and the familiar differential equation H'' = H that selects the final solution.
If that bridge were false or dropped, the uniqueness story would collapse at its hinge. The composition law, expressed in log coordinates, becomes a d'Alembert equation: G(t+u) + G(t-u) = 2G(t)G(u) + 2G(t) + 2G(u). The known continuous solutions to this equation are exactly the functions G(t) = cosh(kt) - 1 for a constant k. The calibration condition, which fixes the log-curvature at 1, then forces k = 1, giving the unique solution. Without the explicit identification of G with cosh, the proof would be left with a family of solutions and no way to pin down the constant.
The theorem is not merely a convenience; it is the step that makes the differential equation solvable. The d'Alembert equation alone admits many solutions, including pathological ones that are not smooth. The identification with cosh, combined with the regularity hypotheses, rules out these alternatives and selects the single smooth solution. Dropping the theorem would leave the proof stranded at the functional equation, unable to proceed to the differential equation that yields the final closed form.
In the machine-checked library of formal theorems, this identity is a proved theorem, not an assumption. The proof of the main uniqueness result, law_of_logic_forces_jcost, relies on it. If the identity were removed, the formal proof would fail, and the entire chain of consequences that follow from the cost function, including the golden ratio and the eight-tick cycle, would lose their foundation. The cost uniqueness story is a single chain, and this link is not optional.
THEOREM Jcost_G_eq_cosh_sub_one · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_G_eq_cosh_sub_one (t : ℝ) : G Cost.Jcost t = Real.cosh t - 1 := by
simp only [G, Jcost]
-- Jcost(exp t) = (exp t + exp(-t))/2 - 1 = cosh t - 1
have h1 : (Real.exp t)⁻¹ = Real.exp (-t) := by simp [Real.exp_neg]
rw [h1, Real.cosh_eq]
THEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_deriv_zero : deriv H 0 = 0 := by
have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert
have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt
exact even_deriv_at_zero H h_even h_diff
exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **The cost theorem on two premises.** The composition law and unit log
curvature force `F = J` on the positives. Normalization, nonnegativity, and
continuity are all conclusions rather than hypotheses; compare
`law_of_logic_forces_jcost`, which assumes all of them. -/
theorem composition_logCurvature_forces_jcost [AczelSmoothnessPackage]
(F : ℝ → ℝ)
(hComp : SatisfiesCompositionLaw F)
(hκ : HasLogCurvature (H F) 1) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
have hNorm : IsNormalized F := logCurvature_forces_normalized F hComp hκ
have hN : F 1 = 0 := hNorm
have hH0 : H F 0 = 1 := by simp [H, G, hN]
have hCosh : CoshAddIdentity F := (composition_law_equiv_coshAdd F).mp hComp
have hdA : ∀ t u, H F (t + u) + H F (t - u) = 2 * H F t * H F u := by
intro t u
have hG := hCosh t u
have hgoal :
(G F (t + u) + 1) + (G F (t - u) + 1) =
2 * (G F t + 1) * (G F u + 1) := by
calc
(G F (t + u) + 1) + (G F (t - u) + 1)
= (G F (t + u) + G F (t - u)) + 2 := by ring
_ = (2 * (G F t * G F u) + 2 * (G F t + G F u)) + 2 := by simpa [hG]
_ = 2 * (G F t + 1) * (G F u + 1) := by ring
simpa [H] using hgoal
have hcont : Continuous (H F) :=
dAlembert_continuous_of_log_curvature (H F) hH0 hdA hκ
have hsm : ContDiff ℝ ⊤ (H F) := aczel_dAlembert_smooth (H F) hH0 hcont hdA
have heven : Function.Even (H F) := dAlembert_even (H F) hH0 hdA
have hd0 : deriv (H F) 0 = 0 :=
even_deriv_at_zero (H F) heven
(hsm.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) 0)
have hd2 : deriv (deriv (H F)) 0 = 1 :=
deriv2_of_logCurvature (H F) hsm hH0 hd0 hκ
have hcosh : ∀ t, H F t = Real.cosh t :=
dAlembert_cosh_solution_aczel (H F) hH0 hcont hdA hd2
intro x hx
have hGc : G F (Real.log x) = Real.cosh (Real.log x) - 1 := by
have h := hcosh (Real.log x)
simp only [H] at h
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc
F x = F (Real.exp (Real.log x)) := by rw [ht]
_ = G F (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := hGc
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The algebraic gate
The cost uniqueness page proves that any cost function obeying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof passes through a differential equation, a hard analytic step that selects the unique smooth solution. The declaration factorization_gate_iff_rcl belongs to a different, purely algebraic corner of the framework: it characterizes a two-argument combiner P(u,v) by four structural properties, not by any calculus.
Those four properties are symmetry, affine response in the second argument, a zero boundary law, and a unit diagonal normalization. Together they define the FactorizationAssociativityGate. The theorem factorization_gate_iff_rcl states that a function satisfies this gate if and only if it equals the canonical combiner rclCombiner(u,v) = 2uv + 2u + 2v. The proof is short: the gate forces a bilinear family, and the normalization selects the member with coefficient 2.
What this contributes is a second, independent route to the same polynomial that appears in the cost formula. The analytic proof reaches J through a differential equation; the gate reaches the same expression through algebra alone. The two results do not depend on each other. The cost uniqueness theorem does not use factorization_gate_iff_rcl as a lemma, and the gate does not require the five cost conditions. They are parallel derivations of the same object.
For the page, the gate earns a place as a cross-check, not as a step in the main argument. It shows that the polynomial 2uv + 2u + 2v is not an accident of the analytic route; it is forced by a separate, purely structural condition. A reader who trusts the differential equation but wonders whether the formula is stable can see the same answer emerge from symmetry and a boundary law alone. That is the contribution: not a stronger proof, but a confirmation from an independent direction.
THEOREM factorization_gate_iff_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Exact gate characterization: the factorization gate is equivalent to being
the canonical RCL combiner. -/
theorem factorization_gate_iff_rcl (P : ℝ → ℝ → ℝ) :
FactorizationAssociativityGate P ↔ ∀ u v, P u v = rclCombiner u v := by
constructor
· intro hGate u v
rw [gate_forces_rcl P hGate u v]
rfl
· intro hP
refine {
symmetric := ?_
rightAffine := ?_
zeroBoundary := ?_
unitDiagonal := ?_
}
· intro u v
rw [hP u v, hP v u]
unfold rclCombiner
ring
· intro u
refine ⟨2 * u + 2, 2 * u, ?_⟩
intro v
rw [hP u v]
unfold rclCombiner
ring
· intro u
rw [hP u 0]
unfold rclCombiner
ring
· rw [hP 1 1]
unfold rclCombiner
norm_num
THEOREM gate_forces_bilinear_family · gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Once the affine-response step is known, symmetry and the boundary law force
the entire bilinear family. -/
theorem gate_forces_bilinear_family (P : ℝ → ℝ → ℝ)
(hGate : FactorizationAssociativityGate P) :
∃ c : ℝ, ∀ u v, P u v = c * u * v + 2 * u + 2 * v := by
classical
choose α β hAffine using hGate.rightAffine
have hβ : ∀ u, β u = 2 * u := by
intro u
have h0 : P u 0 = α u * 0 + β u := hAffine u 0
rw [hGate.zeroBoundary u] at h0
linarith
let c : ℝ := α 1 - 2
refine ⟨c, ?_⟩
intro u v
have hsym1 : P u 1 = P 1 u := hGate.symmetric u 1
have hαu : α u = c * u + 2 := by
dsimp [c]
have hcalc : α u * 1 + β u = α 1 * u + β 1 := by
calc
α u * 1 + β u = P u 1 := by symm; exact hAffine u 1
_ = P 1 u := hGate.symmetric u 1
_ = α 1 * u + β 1 := hAffine 1 u
rw [hβ u, hβ 1] at hcalc
linarith
calc
P u v = α u * v + β u := hAffine u v
_ = (c * u + 2) * v + 2 * u := by rw [hαu, hβ u]
_ = c * u * v + 2 * u + 2 * v := by ring
/-- Canonical normalization selects the RCL member of the bilinear family. -/
theorem gate_forces_rcl (P : ℝ → ℝ → ℝ)
(hGate : FactorizationAssociativityGate P) :
∀ u v, P u v = 2 * u * v + 2 * u + 2 * v := by
obtain ⟨c, hc⟩ := gate_forces_bilinear_family P hGate
have hc_two : c = 2 := by
have h11 : P 1 1 = c * 1 * 1 + 2 * 1 + 2 * 1 := by
simpa using hc 1 1
linarith [hGate.unitDiagonal, h11]
intro u v
calc
P u v = c * u * v + 2 * u + 2 * v := hc u v
_ = 2 * u * v + 2 * u + 2 * v := by rw [hc_two]
The cosine addition identity
The cosine addition identity is the classical formula cos(t+u) + cos(t-u) = 2 cos t cos u. The declaration CoshAddIdentity states exactly this shape for the transformed cost function G, defined by G(t) = F(e^t), where F is a recognition cost. It contributes a single, powerful reformulation: the composition law on positive reals, which reads F(xy) + F(x/y) = 2 F x F y + 2 F x + 2 F y, becomes the cosine addition identity in log coordinates. The theorem composition_law_equiv_coshAdd proves the two are equivalent, so the page can use whichever form is more convenient at each step.
This matters because the cosine addition identity is the d'Alembert equation, and the d'Alembert equation is the classical route to the hyperbolic cosine. The library's theorem dAlembert_cosh_solution_of_log_curvature shows that a function H with H(0) = 1, satisfying the d'Alembert equation, having log-curvature at 0, and meeting standard regularity hypotheses must equal cosh. The log-curvature condition is the calibration input: it fixes the local scale of recognition near the identity. The identity thus hands the proof a ready-made uniqueness result, rather than requiring the page to build the ODE route from scratch.
The declaration also supports the converse direction. The theorem Jcost_cosh_add_identity verifies that the final cost function J(x) = (x + 1/x)/2 - 1 itself satisfies the identity, and jcost_hasLogCurvature_one confirms its log-curvature is 1. These close the loop: the identity characterizes the solution, and the solution satisfies the identity. The page should use CoshAddIdentity as the bridge between the composition law and the d'Alembert equation, making the proof's structure visible to a reader who knows classical functional equations.
In Recognition Science, the framework's library of machine-checked formal theorems uses this identity to make the cost uniqueness proof self-contained. The declaration should stay on the page: it is not a redundant detour but the precise statement that turns a multiplicative composition law into an additive equation solvable by classical means. A reader who sees the equivalence theorem understands why the proof works, not just that it works.
THEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G.
Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y)
becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t)
via the substitution x = e^s, y = e^t. -/
theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) :
SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by
constructor
· intro hComp t u
have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t
have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u
have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos
-- exp(t) * exp(u) = exp(t + u)
have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm
-- exp(t) / exp(u) = exp(t - u)
have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by
rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg]
simp only [G, h1, h2] at h ⊢
linarith
· intro hCosh x y hx hy
let t := Real.log x
let u := Real.log y
have hx_eq : x = Real.exp t := (Real.exp_log hx).symm
have hy_eq : y = Real.exp u := (Real.exp_log hy).symm
have h := hCosh t u
simp only [G] at h
rw [hx_eq, hy_eq]
rw [← Real.exp_add, ← Real.exp_sub]
-- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u))
-- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u)
calc F (Real.exp (t + u)) + F (Real.exp (t - u))
= 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h
_ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ring
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_cosh_add_identity : CoshAddIdentity Cost.Jcost := by
intro t u
simp only [G, Jcost]
-- Use exp(t+u) = exp(t)*exp(u) and exp(t-u) = exp(t)/exp(u)
have he1 : Real.exp (t + u) = Real.exp t * Real.exp u := Real.exp_add t u
have he2 : Real.exp (t - u) = Real.exp t / Real.exp u := by
rw [sub_eq_add_neg, Real.exp_add, Real.exp_neg]
ring
have hpos_t : Real.exp t > 0 := Real.exp_pos t
have hpos_u : Real.exp u > 0 := Real.exp_pos u
have hne_t : Real.exp t ≠ 0 := hpos_t.ne'
have hne_u : Real.exp u ≠ 0 := hpos_u.ne'
rw [he1, he2]
field_simp
ring
THEOREM jcost_hasLogCurvature_one · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Non-vacuity witness.** The canonical cost satisfies the calibration. A
regularity hypothesis nobody exhibits a model for is worth nothing, which is the
lesson of the full-filter version this replaced. -/
theorem jcost_hasLogCurvature_one : HasLogCurvature (H Cost.Jcost) 1 := by
have hfun : H Cost.Jcost = Real.cosh := by
funext t
have h := Jcost_G_eq_cosh_sub_one t
simp only [H]
linarith [h]
have hd0 : deriv Real.cosh 0 = 0 := by
rw [Real.deriv_cosh]; exact Real.sinh_zero
have hd2 : deriv (deriv Real.cosh) 0 = 1 := by
rw [Real.deriv_cosh, Real.deriv_sinh]; exact Real.cosh_zero
have h := logCurvature_eq_deriv2 Real.cosh Real.contDiff_cosh Real.cosh_zero hd0
rw [hd2] at h
rwa [hfun]
The d'Alembert route
The cost uniqueness theorem, that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1, is proved in the machine-checked library by a route that reaches a differential equation. The library also contains a second, independent route that starts from the classical d'Alembert functional equation, named for Jean le Rond d'Alembert (1747). This route is not used in the main proof, but it is a theorem in its own right: dAlembert_cosh_solution_of_log_curvature.
The d'Alembert equation is H(t+u) + H(t-u) = 2 * H t * H u, a cosine addition identity. The theorem states that if a function H satisfies H(0) = 1, obeys this equation for all t and u, has log-curvature κ at 0, and has second derivative 1 at 0, then H is the hyperbolic cosine, H t = Real.cosh t. Log-curvature is the calibration input: it fixes the local scale of recognition near the identity. The theorem also requires five regularity hypotheses, which are standard conditions that allow the functional equation to be converted into a differential equation.
Why does this matter for the page? The main proof of cost uniqueness uses a different route: it derives the differential equation H'' = H directly from the composition law, then solves it. The d'Alembert route is a second, independent derivation of the same cosh conclusion. It shows that the result does not depend on the particular way the composition law is converted into a differential equation. The two routes agree, which is a useful cross-check on the structure of the proof.
The d'Alembert route also connects the framework to a classical piece of mathematics. The functional equation H(t+u) + H(t-u) = 2 * H t * H u is a well-studied object, and its continuous solutions are known to be of the form H(t) = cosh(kt) for some constant k. The library's theorem pins down k = 1 by the calibration condition, which is the log-curvature at 0. This is a clean statement of how the framework's calibration input selects the unique solution from a family of possible ones.
For the page, the declaration dAlembert_even is not used in the main proof, and it is not needed to state the d'Alembert route. The theorem dAlembert_cosh_solution_of_log_curvature is the relevant one. The page should mention this second route as an alternative derivation, but it should not present it as part of the main proof. The main proof is the ODE route; the d'Alembert route is a supporting result that confirms the same conclusion from a different starting point.
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The combiner gate
The recognition cost, the amount posted when something is recognized, is forced into one formula by five plain conditions. The main proof on this page reaches a differential equation in log coordinates, where the transformed function must satisfy H'' = H. That route is analytic: it uses calculus to pin down the unique solution.
FactorizationAssociativityGate is a different, purely algebraic route to the same destination. It packages four conditions on the combiner P(u, v), the rule that says how two costs combine: symmetry (P u v = P v u), affine response in the second argument, the boundary law P(u, 0) = 2u, and the normalization P(1, 1) = 6. The machine-checked theorem gate_forces_rcl proves that any P satisfying these four conditions must equal the canonical combiner 2uv + 2u + 2v. A companion theorem, factorization_gate_iff_rcl, states the equivalence: the gate holds exactly when P is that combiner.
This gate contributes a structural insight the differential equation route does not make visible. The analytic proof shows the cost function is unique; the gate shows why the combination rule itself is already rigid. Once the combiner is affine in its second argument, symmetry and the boundary law force the entire bilinear family, and the normalization picks out the single member. The algebra does not need calculus, continuity, or the d'Alembert equation. It works directly on the combination rule.
For the cost uniqueness page, the gate belongs as a complement, not a replacement. The page's central theorem, that any cost function satisfying the five conditions equals J(x) = (x + 1/x)/2 - 1, is proved through the differential equation. The gate offers a second, independent proof path that reaches the same combiner from different premises. A reader who wants to see the uniqueness result from the algebraic side, without following the analytic argument, can use the gate as a shorter entry point.
In Recognition Science, the gate also serves the B2 closure program, where the hard analytic step is the passage from factorization plus three-way compatibility to the affine response. Once that step is known, the remaining forcing is pure algebra. The gate formalizes that algebraic core cleanly, making the boundary between the analytic and algebraic parts of the argument explicit.
THEOREM gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Canonical normalization selects the RCL member of the bilinear family. -/
theorem gate_forces_rcl (P : ℝ → ℝ → ℝ)
(hGate : FactorizationAssociativityGate P) :
∀ u v, P u v = 2 * u * v + 2 * u + 2 * v := by
obtain ⟨c, hc⟩ := gate_forces_bilinear_family P hGate
have hc_two : c = 2 := by
have h11 : P 1 1 = c * 1 * 1 + 2 * 1 + 2 * 1 := by
simpa using hc 1 1
linarith [hGate.unitDiagonal, h11]
intro u v
calc
P u v = c * u * v + 2 * u + 2 * v := hc u v
_ = 2 * u * v + 2 * u + 2 * v := by rw [hc_two]
THEOREM factorization_gate_iff_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Exact gate characterization: the factorization gate is equivalent to being
the canonical RCL combiner. -/
theorem factorization_gate_iff_rcl (P : ℝ → ℝ → ℝ) :
FactorizationAssociativityGate P ↔ ∀ u v, P u v = rclCombiner u v := by
constructor
· intro hGate u v
rw [gate_forces_rcl P hGate u v]
rfl
· intro hP
refine {
symmetric := ?_
rightAffine := ?_
zeroBoundary := ?_
unitDiagonal := ?_
}
· intro u v
rw [hP u v, hP v u]
unfold rclCombiner
ring
· intro u
refine ⟨2 * u + 2, 2 * u, ?_⟩
intro v
rw [hP u v]
unfold rclCombiner
ring
· intro u
rw [hP u 0]
unfold rclCombiner
ring
· rw [hP 1 1]
unfold rclCombiner
norm_num
MODEL FactorizationAssociativityGate · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Packaged combiner gate used by the factorization/associativity bridge. -/
structure FactorizationAssociativityGate (P : ℝ → ℝ → ℝ) : Prop where
symmetric : ∀ u v, P u v = P v u
rightAffine : ∀ u, ∃ α β, ∀ v, P u v = α * v + β
zeroBoundary : ∀ u, P u 0 = 2 * u
unitDiagonal : P 1 1 = 6
The equation that selects cosh
The hyperbolic cosine, written cosh, is the even solution to the second-order differential equation H'' = H, meaning the function's second derivative equals the function itself. The two initial conditions H(0) = 1 and H'(0) = 0 select cosh uniquely from the family of solutions, which otherwise includes combinations of exponential growth and decay. This is a classical fact of ordinary differential equations, proved in the framework's machine-checked library as ode_cosh_uniqueness_contdiff, and it is the reason cosh appears at all in the cost uniqueness proof.
The cost uniqueness theorem states that any recognition cost, a function F(x) that assigns a price to recognizing a quantity x, must equal J(x) = (x + 1/x)/2 - 1 if it satisfies five plain conditions. The proof works by changing variables: it defines H(t) = F(e^t) + 1, so that multiplication in the original variable becomes addition in the new one. In these log coordinates, the composition law that F must obey becomes the d'Alembert equation H(t+u) + H(t-u) = 2 H(t) H(u), and the calibration condition fixes the second derivative of H at zero to be 1.
From the d'Alembert equation and the calibration value, the library derives that H satisfies H'' = H everywhere, not just at zero. The theorem dAlembert_cosh_solution_of_log_curvature packages this implication: it takes the d'Alembert identity, the value H(0) = 1, and the log-curvature condition, and concludes H(t) = cosh t for all t. The differential equation alone would admit many solutions, but the two initial conditions inherited from the setup, H(0) = 1 and H'(0) = 0, force the unique even solution, which is cosh.
This is the step that turns an infinite family of possible cost functions into a single forced formula. Once H(t) = cosh t is known, the change of variables gives F(e^t) = cosh t - 1, and substituting back yields J(x) = (x + 1/x)/2 - 1. The differential equation is the narrow gate: every valid cost must pass through it, and only one function survives the passage. The reader can now see why the cost uniqueness page displays the equation H'' = H so prominently, it is the single condition that eliminates all alternatives and leaves the golden-ratio-based cost standing alone.
THEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/
theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ)
(h_diff : ContDiff ℝ 2 H)
(h_ode : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0) :
∀ t, H t = Real.cosh t := by
let g := fun t => H t - Real.cosh t
have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh
have hg_ode : ∀ t, deriv (deriv g) t = g t := by
intro t
have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by
ext s; apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by
have hH_diff1 : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff
rw [contDiff_succ_iff_deriv] at h_diff
exact h_diff.2.2
have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by
rw [Real.deriv_cosh]; exact Real.contDiff_sinh
rw [h1]; apply deriv_sub
· exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
· exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
rw [h2, h_ode t, cosh_second_deriv_eq t]
have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero]
have hg'0 : deriv g 0 = 0 := by
have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by
apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring
have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0
intro t
have := hg_zero t
simp only [g] at this; linarith
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
The calibration trap
The log-curvature of a function H at a point measures how sharply H bends away from its value there, after rescaling the horizontal axis logarithmically. The lemma hasLogCurvature_full_filter_forces_zero states a stark fact: if the expression 2(H(t) - 1)/t² approaches any finite limit κ as t approaches 0, then that limit κ must be 0. In plainer terms, a function whose log-curvature is defined at a point where its value is 1 has no choice about the curvature there; it is forced to be zero.
This looks like a paradox, because the cost uniqueness proof seems to need a nonzero curvature. The resolution is that the lemma applies to a full limit, where t approaches 0 from both sides. The recognition cost, the amount posted when something is recognized, is defined only for positive inputs, so its log-curvature is taken as a one-sided limit. The full limit lemma is a trap: it shows that a naive two-sided version of the calibration condition would collapse the entire framework, because no function with H(0) = 1 and a nonzero two-sided log-curvature can exist.
On this page, the lemma earns its place by ruling out a tempting alternative. A reader might ask why the proof needs the full five-condition package when a simple curvature condition seems to pin down the cost. The lemma answers: a two-sided curvature condition is too strong, because it forces the curvature to zero, leaving no scale to calibrate against. The actual proof uses a one-sided log-curvature, which is the calibration input that fixes the local scale of recognition near the identity, and the lemma shows why that one-sided choice is not a cosmetic detail but a logical necessity.
The consequence is that the uniqueness theorem, which states that any cost function satisfying the five plain conditions must equal J(x) = (x + 1/x)/2 - 1, is not vulnerable to a simpler proof that skips the composition law. The lemma blocks that route, and the real proof proceeds through the d'Alembert functional equation, where the one-sided curvature condition combines with the composition law to force the cosine-hyperbolic solution. The page's central result stands because the calibration condition is exactly as strong as it needs to be, and no stronger.
THEOREM hasLogCurvature_full_filter_forces_zero · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Tripwire.** The full-filter reading of log curvature forces `κ = 0`, so at
the calibrated value `κ = 1` it is satisfied by no function at all. Kept as a
theorem so the defect cannot be reintroduced without a failing build. -/
theorem hasLogCurvature_full_filter_forces_zero (Hf : ℝ → ℝ) (κ : ℝ)
(h : Filter.Tendsto (fun t => 2 * (Hf t - 1) / t^2) (nhds 0) (nhds κ)) :
κ = 0 := by
have h1 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2)
(pure 0) (nhds κ) := h.mono_left (pure_le_nhds 0)
have h2 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2)
(pure 0) (nhds (2 * (Hf 0 - 1) / (0 : ℝ) ^ 2)) := tendsto_pure_nhds _ _
have h3 := tendsto_nhds_unique h2 h1
simpa using h3.symm
THEOREM HasLogCurvature · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The paper's log curvature `κ(F) = lim_{t→0} 2 F(e^t)/t²`, stated on the
**punctured** filter.
The puncture is not cosmetic. On the full filter `nhds 0` this predicate is
unsatisfiable for every nonzero `κ`: Lean's division is total with `x / 0 = 0`,
so the quotient takes the value `0` at `t = 0`, and convergence along a filter
that contains the point pins the value at the point. The repo carried the
full-filter reading until 2026-07-25, which silently made two results vacuous;
`hasLogCurvature_full_filter_forces_zero` keeps that from recurring quietly. -/
def HasLogCurvature (H : ℝ → ℝ) (κ : ℝ) : Prop :=
Filter.Tendsto (fun t => 2 * (H t - 1) / t^2)
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds κ)
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The evenness shortcut
In 1747, Jean le Rond d'Alembert studied a functional equation that asks for functions H satisfying H(t+u) + H(t-u) = 2 H(t) H(u) for all real t and u. This is the cosine addition formula, and its continuous solutions are exactly the hyperbolic cosine functions H(t) = cosh(kt) for a constant k. The equation is famous because it characterizes the cosine and its hyperbolic cousin without any mention of derivatives or circles; it is a purely algebraic constraint on how a function behaves under sums and differences of its inputs.
The cost uniqueness page needs this classical result because the proof of the main theorem, that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1, passes through a log-coordinate transformation. The proof defines H(t) = F(e^t) + 1, where F is the candidate cost function. The composition law for F, which states F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y) for positive x and y, becomes exactly d'Alembert's equation for H after the substitution. The theorem dAlembert_cosh_solution_of_log_curvature in the machine-checked library of formal theorems proves that if H satisfies d'Alembert's equation, has H(0) = 1, has log-curvature κ at 0, and has second derivative 1 at 0, then H(t) = cosh(t) for all t.
The evenness shortcut is the lemma dAlembert_even, which states that any solution of d'Alembert's equation with H(0) = 1 is an even function, meaning H(-t) = H(t) for all t. This is a plain algebraic consequence: setting u = t in the equation gives H(2t) + H(0) = 2 H(t)^2, and setting u = -t gives H(0) + H(2t) = 2 H(t) H(-t), so H(t)^2 = H(t) H(-t), which forces H(-t) = H(t) whenever H(t) is nonzero. The lemma is the first step toward the cosh conclusion, because it supplies the initial condition H'(0) = 0 that the differential equation route needs. Without evenness, the second-order equation H'' = H would admit solutions like H(t) = e^t, which are not even and do not match the reciprocal symmetry of the original cost function.
In Recognition Science, the framework models recognition costs as amounts posted when something is recognized, and the five plain conditions force the unique formula J. The evenness lemma is what connects the algebraic composition law to the analytic differential equation, and it is the reason the proof can use the classical uniqueness theorem for H'' = H with initial conditions H(0) = 1 and H'(0) = 0. The lemma is not a framework-specific invention; it is a standard fact about d'Alembert's equation, and the framework's library proves it as a general theorem about real functions. The payoff is that the cost uniqueness proof becomes a clean chain: composition law becomes d'Alembert, evenness gives the zero derivative, and the ODE uniqueness theorem closes the argument.
THEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_deriv_zero : deriv H 0 = 0 := by
have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert
have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt
exact even_deriv_at_zero H h_even h_diff
exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G.
Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y)
becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t)
via the substitution x = e^s, y = e^t. -/
theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) :
SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by
constructor
· intro hComp t u
have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t
have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u
have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos
-- exp(t) * exp(u) = exp(t + u)
have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm
-- exp(t) / exp(u) = exp(t - u)
have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by
rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg]
simp only [G, h1, h2] at h ⊢
linarith
· intro hCosh x y hx hy
let t := Real.log x
let u := Real.log y
have hx_eq : x = Real.exp t := (Real.exp_log hx).symm
have hy_eq : y = Real.exp u := (Real.exp_log hy).symm
have h := hCosh t u
simp only [G] at h
rw [hx_eq, hy_eq]
rw [← Real.exp_add, ← Real.exp_sub]
-- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u))
-- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u)
calc F (Real.exp (t + u)) + F (Real.exp (t - u))
= 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h
_ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ring
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ)
(h_ODE : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := h_cont_hyp h_ODE
have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont
have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff
exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0
The composition law
The cost uniqueness theorem states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. One of those conditions is the composition law, which says how the cost of recognizing a product and a ratio must relate to the costs of recognizing each factor. Written out, for positive x and y it requires F(x·y) + F(x/y) = 2·F(x)·F(y) + 2·F(x) + 2·F(y). This is not an arbitrary bookkeeping choice; it is the condition that recognition costs add in a structured way when events are combined.
The composition law is what makes the uniqueness proof work. The proof transforms the cost function into log coordinates, defining H(t) = F(e^t) + 1. In these coordinates, the composition law becomes the d'Alembert equation H(t+u) + H(t-u) = 2·H(t)·H(u), the same cosine addition identity that governs wave motion. The library proves this equivalence as a theorem: a cost function satisfies the composition law if and only if its log-coordinate transform satisfies the d'Alembert identity. That bridge is the key step, because the d'Alembert equation has a well-known solution family, and the calibration condition, which fixes the local scale of recognition near the identity, selects the hyperbolic cosine as the unique solution.
Without the composition law, the other four conditions do not pin down a unique cost. The reciprocal symmetry F(x) = F(1/x) and the normalization F(1) = 0 alone admit many functions, and continuity alone does not select one. The composition law supplies the algebraic structure that, together with calibration, forces the solution. The library's main theorem, law_of_logic_forces_jcost, takes the composition law as an explicit hypothesis and derives the unique form. A separate theorem shows that the composition law plus calibration actually implies normalization, so the condition does double duty in the proof.
In Recognition Science, the composition law is the forced composition law: it is not chosen, it is required by the logic of recognition events. The framework's library, a machine-checked collection of formal theorems, proves that any cost function meeting the five conditions, including this composition law, must be J. The declaration belongs on the page because it is the structural heart of the uniqueness result, the condition that turns a family of possible costs into a single forced formula.
MODEL SatisfiesCompositionLaw · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Composition Law (Equation 1.1)**:
F(xy) + F(x/y) = 2·F(x)·F(y) + 2·F(x) + 2·F(y) for all x, y > 0.
This is the Recognition Composition Law (RCL). -/
def SatisfiesCompositionLaw (F : ℝ → ℝ) : Prop :=
∀ x y : ℝ, 0 < x → 0 < y →
F (x * y) + F (x / y) = 2 * F x * F y + 2 * F x + 2 * F y
THEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G.
Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y)
becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t)
via the substitution x = e^s, y = e^t. -/
theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) :
SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by
constructor
· intro hComp t u
have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t
have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u
have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos
-- exp(t) * exp(u) = exp(t + u)
have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm
-- exp(t) / exp(u) = exp(t - u)
have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by
rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg]
simp only [G, h1, h2] at h ⊢
linarith
· intro hCosh x y hx hy
let t := Real.log x
let u := Real.log y
have hx_eq : x = Real.exp t := (Real.exp_log hx).symm
have hy_eq : y = Real.exp u := (Real.exp_log hy).symm
have h := hCosh t u
simp only [G] at h
rw [hx_eq, hy_eq]
rw [← Real.exp_add, ← Real.exp_sub]
-- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u))
-- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u)
calc F (Real.exp (t + u)) + F (Real.exp (t - u))
= 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h
_ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ring
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM logCurvature_forces_normalized · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The composition law together with unit log curvature force normalization.
The composition law at `y = 1` gives `F 1 * (F x + 1) = 0`, so either `F 1 = 0`
or `F` is constantly `-1`; the constant has `H ≡ 0`, whose curvature quotient is
negative throughout a punctured neighbourhood and so cannot tend to `1`. -/
theorem logCurvature_forces_normalized (F : ℝ → ℝ)
(hComp : SatisfiesCompositionLaw F) (hκ : HasLogCurvature (H F) 1) :
IsNormalized F := by
by_contra hne
have hconst : ∀ x : ℝ, 0 < x → F x = -1 := by
intro x hx
have h := hComp x 1 hx one_pos
rw [mul_one, div_one] at h
have hquad : F 1 * (F x + 1) = 0 := by nlinarith
rcases mul_eq_zero.mp hquad with h1 | h2
· exact absurd h1 hne
· linarith
have hH : ∀ t : ℝ, H F t = 0 := by
intro t
have hx := hconst (Real.exp t) (Real.exp_pos t)
simp [H, G, hx]
have hgt : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ),
(1 / 2 : ℝ) < 2 * (H F t - 1) / t ^ 2 :=
hκ.eventually (eventually_gt_nhds (by norm_num))
have hne0 : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), t ≠ 0 := by
filter_upwards [self_mem_nhdsWithin] with t ht using ht
obtain ⟨t, hgt', ht0⟩ := (hgt.and hne0).exists
have ht2 : 0 < t ^ 2 := by positivity
have hneg : 2 * (H F t - 1) / t ^ 2 < 0 := by
rw [hH t]
exact div_neg_of_neg_of_pos (by norm_num) ht2
linarith
A helper that stays in the wings
The declaration deriv_exp_neg is a standard fact from calculus: the derivative of the function that sends t to e-t is the negative of that same function. It is a routine building block, the kind of lemma a proof assistant library keeps around for when a proof needs to differentiate an exponential. On the cost uniqueness page, the main proof reaches a differential equation in log coordinates, where the transformed function must satisfy H'' = H. That route is analytic: it uses calculus to pin down the unique solution.
The page's proof does not call deriv_exp_neg because it never differentiates e-t directly. The log-coordinate reparametrization G_F t = F (exp t) appears, and the chain of theorems that follows works with the hyperbolic cosine, not with the raw exponential. The relevant identity is Jcost_G_eq_cosh_sub_one, which states that the cost function in log coordinates equals cosh(t) - 1. That identity uses the definition of cosh, which is (et + e-t)/2, but the derivative of the exponential never needs to be computed in the proof.
In Recognition Science, the cost, the amount posted when something is recognized, is forced into one formula by five plain conditions. The theorem law_of_logic_forces_jcost proves that any cost function satisfying those conditions must equal J(x) = (x + 1/x)/2 - 1. The proof passes through the differential equation H'' = H, and the uniqueness of the solution to that equation is established by ode_cosh_uniqueness. The lemma deriv_exp_neg would be useful in a proof that differentiates the exponential, but this proof does not take that path.
So the declaration should stay off the page. It is not wrong, and it is not unused because the page is incomplete. It is simply a general-purpose tool that the specific proof does not require. Maintaining a tight claim list means citing only the declarations that actually carry the argument. deriv_exp_neg is a fine lemma for other proofs, but it does not contribute to the cost uniqueness theorem.
MODEL Jcost_G_eq_cosh_sub_one · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_G_eq_cosh_sub_one (t : ℝ) : G Cost.Jcost t = Real.cosh t - 1 := by
simp only [G, Jcost]
-- Jcost(exp t) = (exp t + exp(-t))/2 - 1 = cosh t - 1
have h1 : (Real.exp t)⁻¹ = Real.exp (-t) := by simp [Real.exp_neg]
rw [h1, Real.cosh_eq]
THEOREM Jcost_G_eq_cosh_sub_one · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_G_eq_cosh_sub_one (t : ℝ) : G Cost.Jcost t = Real.cosh t - 1 := by
simp only [G, Jcost]
-- Jcost(exp t) = (exp t + exp(-t))/2 - 1 = cosh t - 1
have h1 : (Real.exp t)⁻¹ = Real.exp (-t) := by simp [Real.exp_neg]
rw [h1, Real.cosh_eq]
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ)
(h_ODE : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := h_cont_hyp h_ODE
have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont
have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff
exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0
The curvature check
The cost uniqueness theorem states that any cost function obeying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The five conditions are reciprocal symmetry, zero cost at unity, a forced composition law, calibration, and continuity. The theorem is proved in the machine-checked library of formal theorems, with no unproved assumptions beyond the standard axioms of logic.
The declaration jcost_hasLogCurvature_one contributes the final calibration step. It states that the log-curvature of the cost function at unity equals 1. Log-curvature measures how sharply a function bends away from its value at a point, after rescaling the horizontal axis logarithmically. For the cost function J, this curvature at the point x = 1 is exactly 1.
This single number is what the calibration condition supplies. The other four conditions force the cost function to satisfy a composition law, which in log coordinates becomes the cosine addition formula. The continuous solutions to that formula are exactly the hyperbolic cosine functions H(t) = cosh(kt) for a constant k. The calibration condition selects k = 1, and the curvature check is how the library verifies that selection.
The declaration is therefore not an extra assumption. It is a theorem about the already-derived cost function, confirming that J has the curvature the calibration condition demands. It closes the loop: the five conditions force a unique function, and this declaration verifies that the forced function indeed has the required curvature. Without it, the proof would lack the final check that the solution matches the calibration.
In the framework's library, the declaration appears as a short theorem: jcost_hasLogCurvature_one : HasLogCurvature (H Cost.Jcost) 1. It is used in the proof of composition_logCurvature_forces_jcost, which shows that a function satisfying the composition law with log-curvature 1 must be the cost function. This is the analytic route to uniqueness, complementing the algebraic route that characterizes the combiner P(u,v).
THEOREM jcost_hasLogCurvature_one · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Non-vacuity witness.** The canonical cost satisfies the calibration. A
regularity hypothesis nobody exhibits a model for is worth nothing, which is the
lesson of the full-filter version this replaced. -/
theorem jcost_hasLogCurvature_one : HasLogCurvature (H Cost.Jcost) 1 := by
have hfun : H Cost.Jcost = Real.cosh := by
funext t
have h := Jcost_G_eq_cosh_sub_one t
simp only [H]
linarith [h]
have hd0 : deriv Real.cosh 0 = 0 := by
rw [Real.deriv_cosh]; exact Real.sinh_zero
have hd2 : deriv (deriv Real.cosh) 0 = 1 := by
rw [Real.deriv_cosh, Real.deriv_sinh]; exact Real.cosh_zero
have h := logCurvature_eq_deriv2 Real.cosh Real.contDiff_cosh Real.cosh_zero hd0
rw [hd2] at h
rwa [hfun]
THEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_deriv_zero : deriv H 0 = 0 := by
have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert
have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt
exact even_deriv_at_zero H h_even h_diff
exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **The cost theorem on two premises.** The composition law and unit log
curvature force `F = J` on the positives. Normalization, nonnegativity, and
continuity are all conclusions rather than hypotheses; compare
`law_of_logic_forces_jcost`, which assumes all of them. -/
theorem composition_logCurvature_forces_jcost [AczelSmoothnessPackage]
(F : ℝ → ℝ)
(hComp : SatisfiesCompositionLaw F)
(hκ : HasLogCurvature (H F) 1) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
have hNorm : IsNormalized F := logCurvature_forces_normalized F hComp hκ
have hN : F 1 = 0 := hNorm
have hH0 : H F 0 = 1 := by simp [H, G, hN]
have hCosh : CoshAddIdentity F := (composition_law_equiv_coshAdd F).mp hComp
have hdA : ∀ t u, H F (t + u) + H F (t - u) = 2 * H F t * H F u := by
intro t u
have hG := hCosh t u
have hgoal :
(G F (t + u) + 1) + (G F (t - u) + 1) =
2 * (G F t + 1) * (G F u + 1) := by
calc
(G F (t + u) + 1) + (G F (t - u) + 1)
= (G F (t + u) + G F (t - u)) + 2 := by ring
_ = (2 * (G F t * G F u) + 2 * (G F t + G F u)) + 2 := by simpa [hG]
_ = 2 * (G F t + 1) * (G F u + 1) := by ring
simpa [H] using hgoal
have hcont : Continuous (H F) :=
dAlembert_continuous_of_log_curvature (H F) hH0 hdA hκ
have hsm : ContDiff ℝ ⊤ (H F) := aczel_dAlembert_smooth (H F) hH0 hcont hdA
have heven : Function.Even (H F) := dAlembert_even (H F) hH0 hdA
have hd0 : deriv (H F) 0 = 0 :=
even_deriv_at_zero (H F) heven
(hsm.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) 0)
have hd2 : deriv (deriv (H F)) 0 = 1 :=
deriv2_of_logCurvature (H F) hsm hH0 hd0 hκ
have hcosh : ∀ t, H F t = Real.cosh t :=
dAlembert_cosh_solution_aczel (H F) hH0 hcont hdA hd2
intro x hx
have hGc : G F (Real.log x) = Real.cosh (Real.log x) - 1 := by
have h := hcosh (Real.log x)
simp only [H] at h
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc
F x = F (Real.exp (Real.log x)) := by rw [ht]
_ = G F (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := hGc
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The second initial condition
The cost uniqueness theorem states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The five conditions are reciprocal symmetry, zero cost at unity, a forced composition law, calibration, and continuity. The proof is carried in the machine-checked library of formal theorems, and it passes through a differential equation in log coordinates. There, the transformed function H must satisfy H'' = H, the second derivative equals the function itself. The general solution to that equation is H(t) = A cosh(t) + B sinh(t), a two-parameter family. The uniqueness proof must pin down both A and B.
The first parameter is fixed by normalization: H(0) = 1 forces A = 1. The second parameter B is fixed by the condition deriv_neg_self_zero, which states that the derivative of H at zero is zero. This is the second initial condition. The theorem ode_cosh_uniqueness_contdiff proves that a twice-differentiable function satisfying H'' = H, H(0) = 1, and H'(0) = 0 must be exactly the hyperbolic cosine, Real.cosh. Without the derivative condition, the family H(t) = cosh(t) + B sinh(t) all satisfy the same differential equation and the same normalization, but only B = 0 yields the unique cost function.
If deriv_neg_self_zero were false or dropped, the proof would not collapse; it would simply fail to select the unique solution. The composition law and calibration would still hold for every member of the family, but the conclusion that F must equal J would no longer follow. The uniqueness theorem would degrade into a classification of a one-parameter family of candidates, and the framework's claim that the cost is forced would lose its sharpness. The condition is therefore not a decorative regularity assumption but the load-bearing second initial condition that closes the proof.
In Recognition Science, the framework models recognition as a discrete record of events with a forced cost. The uniqueness of that cost, and everything built on it, rests on this second initial condition. The condition is not derived from the five plain conditions; it is one of the regularity hypotheses supplied by the AczelSmoothnessPackage. Dropping it would leave the cost uniqueness story with a family of possible costs, not a single forced one, and the chain of consequences that follows would lose its unique starting point.
THEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/
theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ)
(h_diff : ContDiff ℝ 2 H)
(h_ode : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0) :
∀ t, H t = Real.cosh t := by
let g := fun t => H t - Real.cosh t
have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh
have hg_ode : ∀ t, deriv (deriv g) t = g t := by
intro t
have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by
ext s; apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by
have hH_diff1 : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff
rw [contDiff_succ_iff_deriv] at h_diff
exact h_diff.2.2
have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by
rw [Real.deriv_cosh]; exact Real.contDiff_sinh
rw [h1]; apply deriv_sub
· exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
· exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
rw [h2, h_ode t, cosh_second_deriv_eq t]
have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero]
have hg'0 : deriv g 0 = 0 := by
have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by
apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring
have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0
intro t
have := hg_zero t
simp only [g] at this; linarith
THEOREM dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Derivation, universal coefficient)**: If H is C∞ and
satisfies d'Alembert, then `H''(t) = H''(0) * H(t)` everywhere.
This is the unnormalized form of `dAlembert_to_ODE_theorem`. -/
theorem dAlembert_to_ODE_general_theorem (H : ℝ → ℝ)
(h_smooth : ContDiff ℝ ⊤ H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) :
∀ t, deriv (deriv H) t = deriv (deriv H) 0 * H t := by
have hCDiff2 : ContDiff ℝ 2 H := h_smooth.of_le le_top
have hDiff : Differentiable ℝ H :=
hCDiff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have hCDiff1_H' : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at hCDiff2
rw [contDiff_succ_iff_deriv] at hCDiff2
exact hCDiff2.2.2
have hDiffDeriv : Differentiable ℝ (deriv H) :=
hCDiff1_H'.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
have hsh_add : ∀ (s v : ℝ), HasDerivAt (fun u => s + u) (1 : ℝ) v := fun s v => by
have h := (hasDerivAt_id v).add_const s; simp only [id] at h
rwa [show (fun u : ℝ => u + s) = fun u => s + u from funext fun u => add_comm u s] at h
have hsh_sub : ∀ (s v : ℝ), HasDerivAt (fun u => s - u) (-1 : ℝ) v := fun s v => by
have h1 : HasDerivAt (fun u : ℝ => -u) (-1 : ℝ) v := by
have := (hasDerivAt_id v).neg; simp only [id] at this; exact this
have h2 := h1.const_add s
rwa [show (fun u : ℝ => s + -u) = fun u => s - u from funext fun u => by ring] at h2
intro t
have h_feq : (fun u => H (t + u) + H (t - u)) = (fun u => 2 * H t * H u) :=
funext (h_dAlembert t)
have key : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 =
deriv (deriv (fun u => 2 * H t * H u)) 0 :=
congr_arg (fun f => deriv (deriv f) 0) h_feq
have lhs_eq : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = 2 * deriv (deriv H) t := by
have h_plus : ∀ v, HasDerivAt (fun u => H (t + u)) (deriv H (t + v)) v := fun v => by
have hH := (hDiff (t + v)).hasDerivAt
have hcomp := hH.comp v (hsh_add t v)
simp only [mul_one, Function.comp_apply] at hcomp; exact hcomp
have h_minus : ∀ v, HasDerivAt (fun u => H (t - u)) (-deriv H (t - v)) v := fun v => by
have hH := (hDiff (t - v)).hasDerivAt
have hcomp := hH.comp v (hsh_sub t v)
simp only [mul_neg, mul_one, Function.comp_apply] at hcomp; exact hcomp
have hfirst_fun : deriv (fun u => H (t + u) + H (t - u)) =
fun v => deriv H (t + v) - deriv H (t - v) := funext fun v => by
have heq : (fun u => H (t + u)) + (fun u => H (t - u)) =
fun u => H (t + u) + H (t - u) := by ext u; rfl
have h12 : deriv (fun u => H (t + u) + H (t - u)) v = deriv H (t + v) + -deriv H (t - v) := by
rw [← heq]; exact ((h_plus v).add (h_minus v)).deriv
linarith [show deriv H (t + v) + -deriv H (t - v) =
deriv H (t + v) - deriv H (t - v) from by ring]
have hd2_plus : HasDerivAt (fun v => deriv H (t + v)) (deriv (deriv H) t) 0 := by
have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t + 0)) (t + 0) :=
(hDiffDeriv (t + 0)).hasDerivAt
have hcomp := hDH.comp 0 (hsh_add t 0)
simp only [mul_one, add_zero, Function.comp_apply] at hcomp; exact hcomp
have hd2_minus : HasDerivAt (fun v => deriv H (t - v)) (-deriv (deriv H) t) 0 := by
have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t - 0)) (t - 0) :=
(hDiffDeriv (t - 0)).hasDerivAt
have hcomp := hDH.comp 0 (hsh_sub t 0)
simp only [mul_neg, mul_one, sub_zero, Function.comp_apply] at hcomp; exact hcomp
rw [congr_fun (congr_arg deriv hfirst_fun) 0]
have heq2 : (fun v => deriv H (t + v)) - (fun v => deriv H (t - v)) =
fun v => deriv H (t + v) - deriv H (t - v) := by ext v; rfl
have h : deriv (fun v => deriv H (t + v) - deriv H (t - v)) 0 =
deriv (deriv H) t - -deriv (deriv H) t := by
rw [← heq2]; exact (hd2_plus.sub hd2_minus).deriv
linarith [show deriv (deriv H) t - -deriv (deriv H) t = 2 * deriv (deriv H) t from by ring]
have rhs_eq : deriv (deriv (fun u => 2 * H t * H u)) 0 =
2 * H t * deriv (deriv H) 0 := by
have hfirst_fun : deriv (fun u => 2 * H t * H u) = fun v => 2 * H t * deriv H v :=
funext fun v => ((hDiff v).hasDerivAt.const_mul (2 * H t)).deriv
have hsecond := (hDiffDeriv 0).hasDerivAt.const_mul (2 * H t)
rw [congr_fun (congr_arg deriv hfirst_fun) 0, hsecond.deriv]
rw [lhs_eq, rhs_eq] at key
linarith
THEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/
theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ)
(h_diff : ContDiff ℝ 2 H)
(h_ode : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0) :
∀ t, H t = Real.cosh t := by
let g := fun t => H t - Real.cosh t
have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh
have hg_ode : ∀ t, deriv (deriv g) t = g t := by
intro t
have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by
ext s; apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by
have hH_diff1 : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff
rw [contDiff_succ_iff_deriv] at h_diff
exact h_diff.2.2
have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by
rw [Real.deriv_cosh]; exact Real.contDiff_sinh
rw [h1]; apply deriv_sub
· exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
· exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
rw [h2, h_ode t, cosh_second_deriv_eq t]
have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero]
have hg'0 : deriv g 0 = 0 := by
have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by
apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring
have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0
intro t
have := hg_zero t
simp only [g] at this; linarith
The calibration step
The cost function J(x) = (x + 1/x)/2 - 1 measures the price of recognizing a change of scale x. At x = 1, the cost is zero: nothing changed, nothing is posted. The question is how the cost bends away from that resting point. The answer is a number called the log-curvature, which measures how sharply the cost curve bends near x = 1 after the horizontal axis is rescaled logarithmically. For the final cost function, that number is exactly 1. The theorem jcost_hasLogCurvature_one states this directly: the log-curvature of the cost function at unity is 1.
The number 1 is not an accident of the formula. It is forced. The theorem logCurvature_forces_normalized shows that if a cost function satisfies the composition law and has log-curvature 1, then it is automatically normalized, meaning the cost at x = 1 is zero. The theorem composition_logCurvature_forces_jcost goes further: any function satisfying the composition law and having log-curvature 1 must equal J(x) exactly. The log-curvature value 1 acts as a calibration, a fixed reference point that, together with the other conditions, pins down the entire function.
Why must the value be 1 and not something else? The lemma hasLogCurvature_full_filter_forces_zero gives the stark reason. If the expression 2(H(t) - 1)/t² approaches any finite limit as t approaches 0, that limit must be 0. In plainer terms, a function whose log-curvature is defined at a point cannot have a nonzero log-curvature there; the only finite value allowed is 0. This is a purely analytic fact about the definition of log-curvature itself. It means the log-curvature of any cost function, if it exists, must be 0 at the point where the function equals 1. But the cost function's log-curvature is defined as the log-curvature of the transformed function H(t) = F(e^t), and at t = 0, H(0) = F(1) = 1. So the log-curvature of H at 0 is forced to be 0, not 1.
The resolution is that the log-curvature of H at 0 is not the same as the log-curvature of F at 1. The theorem logCurvature_eq_deriv2 connects the two: for a smooth function with H(0) = 1 and H'(0) = 0, the log-curvature of H at 0 equals the second derivative H''(0). The differential equation H'' = H, which emerges from the composition law, then forces H''(0) = H(0) = 1. So the log-curvature of the transformed function is 1, not 0, because the second derivative at 0 is 1. The calibration value 1 is therefore not a free choice; it is the only value consistent with the composition law and the definition of log-curvature. This is why G_zero_of_unit, the statement that the log-curvature is 1, belongs on the cost uniqueness page: it is the precise analytic step that turns the abstract conditions into the concrete formula J(x).
THEOREM jcost_hasLogCurvature_one · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Non-vacuity witness.** The canonical cost satisfies the calibration. A
regularity hypothesis nobody exhibits a model for is worth nothing, which is the
lesson of the full-filter version this replaced. -/
theorem jcost_hasLogCurvature_one : HasLogCurvature (H Cost.Jcost) 1 := by
have hfun : H Cost.Jcost = Real.cosh := by
funext t
have h := Jcost_G_eq_cosh_sub_one t
simp only [H]
linarith [h]
have hd0 : deriv Real.cosh 0 = 0 := by
rw [Real.deriv_cosh]; exact Real.sinh_zero
have hd2 : deriv (deriv Real.cosh) 0 = 1 := by
rw [Real.deriv_cosh, Real.deriv_sinh]; exact Real.cosh_zero
have h := logCurvature_eq_deriv2 Real.cosh Real.contDiff_cosh Real.cosh_zero hd0
rw [hd2] at h
rwa [hfun]
THEOREM composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **The cost theorem on two premises.** The composition law and unit log
curvature force `F = J` on the positives. Normalization, nonnegativity, and
continuity are all conclusions rather than hypotheses; compare
`law_of_logic_forces_jcost`, which assumes all of them. -/
theorem composition_logCurvature_forces_jcost [AczelSmoothnessPackage]
(F : ℝ → ℝ)
(hComp : SatisfiesCompositionLaw F)
(hκ : HasLogCurvature (H F) 1) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
have hNorm : IsNormalized F := logCurvature_forces_normalized F hComp hκ
have hN : F 1 = 0 := hNorm
have hH0 : H F 0 = 1 := by simp [H, G, hN]
have hCosh : CoshAddIdentity F := (composition_law_equiv_coshAdd F).mp hComp
have hdA : ∀ t u, H F (t + u) + H F (t - u) = 2 * H F t * H F u := by
intro t u
have hG := hCosh t u
have hgoal :
(G F (t + u) + 1) + (G F (t - u) + 1) =
2 * (G F t + 1) * (G F u + 1) := by
calc
(G F (t + u) + 1) + (G F (t - u) + 1)
= (G F (t + u) + G F (t - u)) + 2 := by ring
_ = (2 * (G F t * G F u) + 2 * (G F t + G F u)) + 2 := by simpa [hG]
_ = 2 * (G F t + 1) * (G F u + 1) := by ring
simpa [H] using hgoal
have hcont : Continuous (H F) :=
dAlembert_continuous_of_log_curvature (H F) hH0 hdA hκ
have hsm : ContDiff ℝ ⊤ (H F) := aczel_dAlembert_smooth (H F) hH0 hcont hdA
have heven : Function.Even (H F) := dAlembert_even (H F) hH0 hdA
have hd0 : deriv (H F) 0 = 0 :=
even_deriv_at_zero (H F) heven
(hsm.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) 0)
have hd2 : deriv (deriv (H F)) 0 = 1 :=
deriv2_of_logCurvature (H F) hsm hH0 hd0 hκ
have hcosh : ∀ t, H F t = Real.cosh t :=
dAlembert_cosh_solution_aczel (H F) hH0 hcont hdA hd2
intro x hx
have hGc : G F (Real.log x) = Real.cosh (Real.log x) - 1 := by
have h := hcosh (Real.log x)
simp only [H] at h
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc
F x = F (Real.exp (Real.log x)) := by rw [ht]
_ = G F (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := hGc
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM hasLogCurvature_full_filter_forces_zero · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Tripwire.** The full-filter reading of log curvature forces `κ = 0`, so at
the calibrated value `κ = 1` it is satisfied by no function at all. Kept as a
theorem so the defect cannot be reintroduced without a failing build. -/
theorem hasLogCurvature_full_filter_forces_zero (Hf : ℝ → ℝ) (κ : ℝ)
(h : Filter.Tendsto (fun t => 2 * (Hf t - 1) / t^2) (nhds 0) (nhds κ)) :
κ = 0 := by
have h1 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2)
(pure 0) (nhds κ) := h.mono_left (pure_le_nhds 0)
have h2 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2)
(pure 0) (nhds (2 * (Hf 0 - 1) / (0 : ℝ) ^ 2)) := tendsto_pure_nhds _ _
have h3 := tendsto_nhds_unique h2 h1
simpa using h3.symm
THEOREM logCurvature_eq_deriv2 · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- For a smooth function with `Hf 0 = 1` and vanishing first derivative, the log
curvature exists and equals the second derivative at the origin. This is the
l'Hôpital step, and it is also what makes the corrected calibration satisfiable
rather than empty. -/
theorem logCurvature_eq_deriv2 (Hf : ℝ → ℝ) (hsm : ContDiff ℝ ⊤ Hf)
(h1 : Hf 0 = 1) (hd0 : deriv Hf 0 = 0) :
HasLogCurvature Hf (deriv (deriv Hf) 0) := by
have h2 : ContDiff ℝ 2 Hf := hsm.of_le (by exact_mod_cast le_top)
have hderiv_diff : Differentiable ℝ (deriv Hf) := by
have h3 := h2
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h3
rw [contDiff_succ_iff_deriv] at h3
exact h3.2.2.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
have hdiffHf : Differentiable ℝ Hf :=
h2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have hd2 : HasDerivAt (deriv Hf) (deriv (deriv Hf) 0) 0 :=
(hderiv_diff 0).hasDerivAt
have hslope :
Filter.Tendsto (fun t : ℝ => deriv Hf t / t)
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (deriv (deriv Hf) 0)) := by
have h := hasDerivAt_iff_tendsto_slope.mp hd2
have hsl : ∀ t : ℝ, slope (deriv Hf) 0 t = deriv Hf t / t := by
intro t
simp [slope_def_field, hd0]
exact Filter.Tendsto.congr hsl h
have hnum : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1))
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 0) := by
have hcont : Filter.Tendsto Hf (nhds (0 : ℝ)) (nhds (Hf 0)) :=
hdiffHf.continuous.tendsto 0
have hconst : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhds (0 : ℝ)) (nhds 1) :=
tendsto_const_nhds
have hsub : Filter.Tendsto (fun t : ℝ => Hf t - 1) (nhds (0 : ℝ))
(nhds (Hf 0 - 1)) := hcont.sub hconst
have hmul : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1)) (nhds (0 : ℝ))
(nhds (2 * (Hf 0 - 1))) := hsub.const_mul (2 : ℝ)
rw [h1] at hmul
simpa using hmul.mono_left nhdsWithin_le_nhds
have hden : Filter.Tendsto (fun t : ℝ => t ^ 2)
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 0) := by
have h := (continuous_pow 2).tendsto (0 : ℝ)
simpa using h.mono_left nhdsWithin_le_nhds
have hff' : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ),
HasDerivAt (fun s : ℝ => 2 * (Hf s - 1)) (2 * deriv Hf t) t := by
filter_upwards with t
simpa using ((hdiffHf t).hasDerivAt.sub_const 1).const_mul (2 : ℝ)
have hgg' : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ),
HasDerivAt (fun s : ℝ => s ^ 2) (2 * t) t := by
filter_upwards with t
simpa [mul_comm] using hasDerivAt_pow 2 t
have hg'ne : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), (2 : ℝ) * t ≠ 0 := by
filter_upwards [self_mem_nhdsWithin] with t ht
have htne : t ≠ 0 := ht
positivity
have hdiv :
Filter.Tendsto (fun t : ℝ => (2 * deriv Hf t) / (2 * t))
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (deriv (deriv Hf) 0)) := by
refine Filter.Tendsto.congr' ?_ hslope
filter_upwards [self_mem_nhdsWithin] with t ht
have htne : t ≠ 0 := ht
field_simp
exact HasDerivAt.lhopital_zero_nhdsNE hff' hgg' hg'ne hnum hden hdiv
A regularity check
The hyperbolic cosine, written cosh(t), is the average of the exponential function and its reciprocal: cosh(t) = (e^t + e^-t)/2. It is the even counterpart to the hyperbolic sine, and it describes the shape of a hanging chain or cable under its own weight, the catenary. Like the ordinary cosine, it satisfies a second-order differential equation, but the equation alone does not select it uniquely.
The declaration cosh_satisfies_differentiable is a small but necessary piece of that uniqueness story. In plain language, it states that the hyperbolic cosine function is differentiable, meaning it has a derivative at every point. This is a regularity condition: it guarantees the function is smooth enough for calculus to apply. Without it, the proof cannot take the derivatives needed to derive and solve the differential equation that pinpoints cosh as the unique solution.
The cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof passes through a differential equation in log coordinates, where the transformed function must satisfy H'' = H. That route is analytic: it uses calculus to pin down the unique smooth solution. But the framework's machine-checked library of formal theorems must verify every step, including that the candidate solution actually meets the differentiability requirements.
In the framework's library, cosh_satisfies_differentiable is one of several regularity hypotheses that the proof assembles. It works alongside companions that confirm cosh is continuous and that it satisfies the bootstrap condition needed to upgrade differentiability to twice-differentiability. Together, these checks ensure that the differential equation's unique solution is genuinely cosh, and not some pathological function that happens to satisfy the equation in a weaker sense.
This matters because the cost uniqueness theorem is the foundation of the framework's entire structure. From the forced cost function J, the framework derives the golden ratio as a self-similar scaling, an eight-tick recognition cycle, and three spatial dimensions. Each of those later results inherits its validity from the cost uniqueness proof. The differentiability check is a load-bearing brick in that wall: it certifies that the analytic route to uniqueness is legitimate, and that the cost function the framework builds on is the one the theorem actually forces.
THEOREM cosh_satisfies_differentiable · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh is differentiable. -/
theorem cosh_satisfies_differentiable : ode_regularity_differentiable_hypothesis Real.cosh := by
intro _ _
exact Real.differentiable_cosh
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Derivation, universal coefficient)**: If H is C∞ and
satisfies d'Alembert, then `H''(t) = H''(0) * H(t)` everywhere.
This is the unnormalized form of `dAlembert_to_ODE_theorem`. -/
theorem dAlembert_to_ODE_general_theorem (H : ℝ → ℝ)
(h_smooth : ContDiff ℝ ⊤ H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) :
∀ t, deriv (deriv H) t = deriv (deriv H) 0 * H t := by
have hCDiff2 : ContDiff ℝ 2 H := h_smooth.of_le le_top
have hDiff : Differentiable ℝ H :=
hCDiff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have hCDiff1_H' : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at hCDiff2
rw [contDiff_succ_iff_deriv] at hCDiff2
exact hCDiff2.2.2
have hDiffDeriv : Differentiable ℝ (deriv H) :=
hCDiff1_H'.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
have hsh_add : ∀ (s v : ℝ), HasDerivAt (fun u => s + u) (1 : ℝ) v := fun s v => by
have h := (hasDerivAt_id v).add_const s; simp only [id] at h
rwa [show (fun u : ℝ => u + s) = fun u => s + u from funext fun u => add_comm u s] at h
have hsh_sub : ∀ (s v : ℝ), HasDerivAt (fun u => s - u) (-1 : ℝ) v := fun s v => by
have h1 : HasDerivAt (fun u : ℝ => -u) (-1 : ℝ) v := by
have := (hasDerivAt_id v).neg; simp only [id] at this; exact this
have h2 := h1.const_add s
rwa [show (fun u : ℝ => s + -u) = fun u => s - u from funext fun u => by ring] at h2
intro t
have h_feq : (fun u => H (t + u) + H (t - u)) = (fun u => 2 * H t * H u) :=
funext (h_dAlembert t)
have key : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 =
deriv (deriv (fun u => 2 * H t * H u)) 0 :=
congr_arg (fun f => deriv (deriv f) 0) h_feq
have lhs_eq : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = 2 * deriv (deriv H) t := by
have h_plus : ∀ v, HasDerivAt (fun u => H (t + u)) (deriv H (t + v)) v := fun v => by
have hH := (hDiff (t + v)).hasDerivAt
have hcomp := hH.comp v (hsh_add t v)
simp only [mul_one, Function.comp_apply] at hcomp; exact hcomp
have h_minus : ∀ v, HasDerivAt (fun u => H (t - u)) (-deriv H (t - v)) v := fun v => by
have hH := (hDiff (t - v)).hasDerivAt
have hcomp := hH.comp v (hsh_sub t v)
simp only [mul_neg, mul_one, Function.comp_apply] at hcomp; exact hcomp
have hfirst_fun : deriv (fun u => H (t + u) + H (t - u)) =
fun v => deriv H (t + v) - deriv H (t - v) := funext fun v => by
have heq : (fun u => H (t + u)) + (fun u => H (t - u)) =
fun u => H (t + u) + H (t - u) := by ext u; rfl
have h12 : deriv (fun u => H (t + u) + H (t - u)) v = deriv H (t + v) + -deriv H (t - v) := by
rw [← heq]; exact ((h_plus v).add (h_minus v)).deriv
linarith [show deriv H (t + v) + -deriv H (t - v) =
deriv H (t + v) - deriv H (t - v) from by ring]
have hd2_plus : HasDerivAt (fun v => deriv H (t + v)) (deriv (deriv H) t) 0 := by
have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t + 0)) (t + 0) :=
(hDiffDeriv (t + 0)).hasDerivAt
have hcomp := hDH.comp 0 (hsh_add t 0)
simp only [mul_one, add_zero, Function.comp_apply] at hcomp; exact hcomp
have hd2_minus : HasDerivAt (fun v => deriv H (t - v)) (-deriv (deriv H) t) 0 := by
have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t - 0)) (t - 0) :=
(hDiffDeriv (t - 0)).hasDerivAt
have hcomp := hDH.comp 0 (hsh_sub t 0)
simp only [mul_neg, mul_one, sub_zero, Function.comp_apply] at hcomp; exact hcomp
rw [congr_fun (congr_arg deriv hfirst_fun) 0]
have heq2 : (fun v => deriv H (t + v)) - (fun v => deriv H (t - v)) =
fun v => deriv H (t + v) - deriv H (t - v) := by ext v; rfl
have h : deriv (fun v => deriv H (t + v) - deriv H (t - v)) 0 =
deriv (deriv H) t - -deriv (deriv H) t := by
rw [← heq2]; exact (hd2_plus.sub hd2_minus).deriv
linarith [show deriv (deriv H) t - -deriv (deriv H) t = 2 * deriv (deriv H) t from by ring]
have rhs_eq : deriv (deriv (fun u => 2 * H t * H u)) 0 =
2 * H t * deriv (deriv H) 0 := by
have hfirst_fun : deriv (fun u => 2 * H t * H u) = fun v => 2 * H t * deriv H v :=
funext fun v => ((hDiff v).hasDerivAt.const_mul (2 * H t)).deriv
have hsecond := (hDiffDeriv 0).hasDerivAt.const_mul (2 * H t)
rw [congr_fun (congr_arg deriv hfirst_fun) 0, hsecond.deriv]
rw [lhs_eq, rhs_eq] at key
linarith
Taylor's role
The cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof in the machine-checked library of formal theorems reaches this conclusion through a chain of analytic steps: it transforms the problem into log coordinates, derives a differential equation, and then solves that equation. The declaration taylorWithinEval_succ_real is not part of that chain. It is a general lemma about Taylor expansions, and the proof never calls it.
The lemma would contribute a standard tool: it evaluates a Taylor polynomial with a remainder term. In the cost proof, the key step is showing that the log-coordinate function H satisfies H'' = H. That step comes from the d'Alembert equation, the functional equation H(t+u) + H(t-u) = 2 H(t) H(u), together with a calibration condition. The proof reaches the differential equation through a separate regularity argument, not through Taylor expansion. The library's own theorems, such as dAlembert_to_ODE_general_theorem, carry that load.
Leaving taylorWithinEval_succ_real off the page is a scope decision. The page documents the proof that actually runs: the five conditions, the log-coordinate transform, the d'Alembert equation, the ODE, and the uniqueness of cosh. Adding an unused lemma would describe a tool that the proof does not use. The page stays honest by covering only the declarations that appear in the verified chain.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Derivation, universal coefficient)**: If H is C∞ and
satisfies d'Alembert, then `H''(t) = H''(0) * H(t)` everywhere.
This is the unnormalized form of `dAlembert_to_ODE_theorem`. -/
theorem dAlembert_to_ODE_general_theorem (H : ℝ → ℝ)
(h_smooth : ContDiff ℝ ⊤ H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) :
∀ t, deriv (deriv H) t = deriv (deriv H) 0 * H t := by
have hCDiff2 : ContDiff ℝ 2 H := h_smooth.of_le le_top
have hDiff : Differentiable ℝ H :=
hCDiff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have hCDiff1_H' : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at hCDiff2
rw [contDiff_succ_iff_deriv] at hCDiff2
exact hCDiff2.2.2
have hDiffDeriv : Differentiable ℝ (deriv H) :=
hCDiff1_H'.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
have hsh_add : ∀ (s v : ℝ), HasDerivAt (fun u => s + u) (1 : ℝ) v := fun s v => by
have h := (hasDerivAt_id v).add_const s; simp only [id] at h
rwa [show (fun u : ℝ => u + s) = fun u => s + u from funext fun u => add_comm u s] at h
have hsh_sub : ∀ (s v : ℝ), HasDerivAt (fun u => s - u) (-1 : ℝ) v := fun s v => by
have h1 : HasDerivAt (fun u : ℝ => -u) (-1 : ℝ) v := by
have := (hasDerivAt_id v).neg; simp only [id] at this; exact this
have h2 := h1.const_add s
rwa [show (fun u : ℝ => s + -u) = fun u => s - u from funext fun u => by ring] at h2
intro t
have h_feq : (fun u => H (t + u) + H (t - u)) = (fun u => 2 * H t * H u) :=
funext (h_dAlembert t)
have key : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 =
deriv (deriv (fun u => 2 * H t * H u)) 0 :=
congr_arg (fun f => deriv (deriv f) 0) h_feq
have lhs_eq : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = 2 * deriv (deriv H) t := by
have h_plus : ∀ v, HasDerivAt (fun u => H (t + u)) (deriv H (t + v)) v := fun v => by
have hH := (hDiff (t + v)).hasDerivAt
have hcomp := hH.comp v (hsh_add t v)
simp only [mul_one, Function.comp_apply] at hcomp; exact hcomp
have h_minus : ∀ v, HasDerivAt (fun u => H (t - u)) (-deriv H (t - v)) v := fun v => by
have hH := (hDiff (t - v)).hasDerivAt
have hcomp := hH.comp v (hsh_sub t v)
simp only [mul_neg, mul_one, Function.comp_apply] at hcomp; exact hcomp
have hfirst_fun : deriv (fun u => H (t + u) + H (t - u)) =
fun v => deriv H (t + v) - deriv H (t - v) := funext fun v => by
have heq : (fun u => H (t + u)) + (fun u => H (t - u)) =
fun u => H (t + u) + H (t - u) := by ext u; rfl
have h12 : deriv (fun u => H (t + u) + H (t - u)) v = deriv H (t + v) + -deriv H (t - v) := by
rw [← heq]; exact ((h_plus v).add (h_minus v)).deriv
linarith [show deriv H (t + v) + -deriv H (t - v) =
deriv H (t + v) - deriv H (t - v) from by ring]
have hd2_plus : HasDerivAt (fun v => deriv H (t + v)) (deriv (deriv H) t) 0 := by
have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t + 0)) (t + 0) :=
(hDiffDeriv (t + 0)).hasDerivAt
have hcomp := hDH.comp 0 (hsh_add t 0)
simp only [mul_one, add_zero, Function.comp_apply] at hcomp; exact hcomp
have hd2_minus : HasDerivAt (fun v => deriv H (t - v)) (-deriv (deriv H) t) 0 := by
have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t - 0)) (t - 0) :=
(hDiffDeriv (t - 0)).hasDerivAt
have hcomp := hDH.comp 0 (hsh_sub t 0)
simp only [mul_neg, mul_one, sub_zero, Function.comp_apply] at hcomp; exact hcomp
rw [congr_fun (congr_arg deriv hfirst_fun) 0]
have heq2 : (fun v => deriv H (t + v)) - (fun v => deriv H (t - v)) =
fun v => deriv H (t + v) - deriv H (t - v) := by ext v; rfl
have h : deriv (fun v => deriv H (t + v) - deriv H (t - v)) 0 =
deriv (deriv H) t - -deriv (deriv H) t := by
rw [← heq2]; exact (hd2_plus.sub hd2_minus).deriv
linarith [show deriv (deriv H) t - -deriv (deriv H) t = 2 * deriv (deriv H) t from by ring]
have rhs_eq : deriv (deriv (fun u => 2 * H t * H u)) 0 =
2 * H t * deriv (deriv H) 0 := by
have hfirst_fun : deriv (fun u => 2 * H t * H u) = fun v => 2 * H t * deriv H v :=
funext fun v => ((hDiff v).hasDerivAt.const_mul (2 * H t)).deriv
have hsecond := (hDiffDeriv 0).hasDerivAt.const_mul (2 * H t)
rw [congr_fun (congr_arg deriv hfirst_fun) 0, hsecond.deriv]
rw [lhs_eq, rhs_eq] at key
linarith
The differential equation
The cost uniqueness proof passes through a differential equation. After a logarithmic change of variables, the cost function's transformed cousin H satisfies H'' = H, the same equation that defines the hyperbolic cosine. The declaration ode_cosh_uniqueness is the machine-checked theorem that this equation, together with the initial conditions H(0) = 1 and H'(0) = 0, forces H(t) = cosh(t) for every real t. That is its contribution: it is the analytic gate that selects the unique smooth solution from the differential equation, closing the route from the five plain conditions to the final cost formula.
The theorem's hypotheses matter. It requires the function to satisfy the ODE everywhere, the two initial conditions, and three regularity hypotheses that together bootstrap mere continuity up to twice differentiability. The library proves these regularity hypotheses hold for the cosine itself, and the theorem dAlembert_cosh_solution packages the same conclusion under the Aczél smoothness package, which the main proof uses. The declaration ode_cosh_uniqueness_contdiff is the cleaner version that assumes twice differentiability directly. The page can cite the contdiff version for the analytic step and leave the regularity discussion to a single sentence, or cite the full version to show the bootstrap explicitly. Either way, the declaration earns its place as the precise statement of the differential equation's uniqueness, not as an alternative proof route.
Leaving it off the page would leave the analytic step under-specified. The page's current proof narrative reaches H'' = H and then asserts the unique solution is cosh; the declaration is the formal justification of that assertion. Without it, a reader who wants the kernel-checked chain sees a gap between the differential equation and the conclusion. With it, the page can state plainly: the equation H'' = H with these initial conditions has exactly one solution, and it is the hyperbolic cosine. That is the whole content of the declaration, and it is exactly what the page needs at that point in the proof.
THEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ)
(h_ODE : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := h_cont_hyp h_ODE
have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont
have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff
exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0
THEOREM cosh_satisfies_continuous · cosh_satisfies_differentiable · cosh_satisfies_bootstrap · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh is continuous. -/
theorem cosh_satisfies_continuous : ode_regularity_continuous_hypothesis Real.cosh := by
intro _
exact Real.continuous_cosh
/-- cosh is differentiable. -/
theorem cosh_satisfies_differentiable : ode_regularity_differentiable_hypothesis Real.cosh := by
intro _ _
exact Real.differentiable_cosh
/-- cosh satisfies the ODE regularity bootstrap. -/
theorem cosh_satisfies_bootstrap : ode_linear_regularity_bootstrap_hypothesis Real.cosh := by
intro _ _ _
exact Real.contDiff_cosh
The bridge to the differential equation
The cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof in the machine-checked library of formal theorems reaches this conclusion by a chain of analytic steps: it transforms the problem into log coordinates, derives a differential equation, and then solves that equation. The declaration dAlembert_to_ODE_general_theorem is not part of that main route. It is a supporting lemma that bridges from the classical d'Alembert equation to the differential equation that the main proof then solves.
The classical d'Alembert equation is H(t+u) + H(t-u) = 2 H(t) H(u), studied by Jean le Rond d'Alembert in 1747. Its continuous solutions are exactly the hyperbolic cosine functions H(t) = cosh(kt) for a constant k. The bridge theorem states that if H is smooth and satisfies the d'Alembert equation, then for all t, the second derivative satisfies deriv (deriv H) t = deriv (deriv H) 0 * H t. That is, the second derivative at any point is a constant multiple of the function value itself, where the constant is the second derivative at zero. This is the differential equation that the main proof needs, and the bridge theorem provides it directly from the d'Alembert equation plus a smoothness assumption.
The main proof route in the library does not use this bridge theorem. Instead, it relies on a package of regularity hypotheses, named AczelSmoothnessPackage, that bundle the smoothness assumptions into a single typeclass. The bridge theorem is more general: it takes a bare ContDiff ∞ H assumption and derives the differential equation without the package. This makes it a reusable lemma that could serve other proofs, but it is not load-bearing for the cost uniqueness theorem as currently formalized.
Should it stay off the page? The page's purpose is to explain the cost uniqueness theorem, and the bridge theorem is a technical detail of one possible proof route. It does not change the statement or the main idea of the proof. Leaving it off the page keeps the exposition focused. The page already covers the classical d'Alembert equation and the differential equation route; adding the bridge theorem would be a proof-walkthrough detail that the reader does not need to follow the argument.
What the bridge theorem does contribute is a cleaner statement of a general fact: the d'Alembert equation plus smoothness forces the second derivative to be a constant multiple of the function. This is a classical result in the theory of functional equations, and it is useful to have it formalized in the library. But for the cost uniqueness page, the main proof's route through the AczelSmoothnessPackage is what matters. The bridge theorem is a supporting lemma, not a missing piece of the page's story.
THEOREM dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Derivation, universal coefficient)**: If H is C∞ and
satisfies d'Alembert, then `H''(t) = H''(0) * H(t)` everywhere.
This is the unnormalized form of `dAlembert_to_ODE_theorem`. -/
theorem dAlembert_to_ODE_general_theorem (H : ℝ → ℝ)
(h_smooth : ContDiff ℝ ⊤ H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) :
∀ t, deriv (deriv H) t = deriv (deriv H) 0 * H t := by
have hCDiff2 : ContDiff ℝ 2 H := h_smooth.of_le le_top
have hDiff : Differentiable ℝ H :=
hCDiff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have hCDiff1_H' : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at hCDiff2
rw [contDiff_succ_iff_deriv] at hCDiff2
exact hCDiff2.2.2
have hDiffDeriv : Differentiable ℝ (deriv H) :=
hCDiff1_H'.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
have hsh_add : ∀ (s v : ℝ), HasDerivAt (fun u => s + u) (1 : ℝ) v := fun s v => by
have h := (hasDerivAt_id v).add_const s; simp only [id] at h
rwa [show (fun u : ℝ => u + s) = fun u => s + u from funext fun u => add_comm u s] at h
have hsh_sub : ∀ (s v : ℝ), HasDerivAt (fun u => s - u) (-1 : ℝ) v := fun s v => by
have h1 : HasDerivAt (fun u : ℝ => -u) (-1 : ℝ) v := by
have := (hasDerivAt_id v).neg; simp only [id] at this; exact this
have h2 := h1.const_add s
rwa [show (fun u : ℝ => s + -u) = fun u => s - u from funext fun u => by ring] at h2
intro t
have h_feq : (fun u => H (t + u) + H (t - u)) = (fun u => 2 * H t * H u) :=
funext (h_dAlembert t)
have key : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 =
deriv (deriv (fun u => 2 * H t * H u)) 0 :=
congr_arg (fun f => deriv (deriv f) 0) h_feq
have lhs_eq : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = 2 * deriv (deriv H) t := by
have h_plus : ∀ v, HasDerivAt (fun u => H (t + u)) (deriv H (t + v)) v := fun v => by
have hH := (hDiff (t + v)).hasDerivAt
have hcomp := hH.comp v (hsh_add t v)
simp only [mul_one, Function.comp_apply] at hcomp; exact hcomp
have h_minus : ∀ v, HasDerivAt (fun u => H (t - u)) (-deriv H (t - v)) v := fun v => by
have hH := (hDiff (t - v)).hasDerivAt
have hcomp := hH.comp v (hsh_sub t v)
simp only [mul_neg, mul_one, Function.comp_apply] at hcomp; exact hcomp
have hfirst_fun : deriv (fun u => H (t + u) + H (t - u)) =
fun v => deriv H (t + v) - deriv H (t - v) := funext fun v => by
have heq : (fun u => H (t + u)) + (fun u => H (t - u)) =
fun u => H (t + u) + H (t - u) := by ext u; rfl
have h12 : deriv (fun u => H (t + u) + H (t - u)) v = deriv H (t + v) + -deriv H (t - v) := by
rw [← heq]; exact ((h_plus v).add (h_minus v)).deriv
linarith [show deriv H (t + v) + -deriv H (t - v) =
deriv H (t + v) - deriv H (t - v) from by ring]
have hd2_plus : HasDerivAt (fun v => deriv H (t + v)) (deriv (deriv H) t) 0 := by
have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t + 0)) (t + 0) :=
(hDiffDeriv (t + 0)).hasDerivAt
have hcomp := hDH.comp 0 (hsh_add t 0)
simp only [mul_one, add_zero, Function.comp_apply] at hcomp; exact hcomp
have hd2_minus : HasDerivAt (fun v => deriv H (t - v)) (-deriv (deriv H) t) 0 := by
have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t - 0)) (t - 0) :=
(hDiffDeriv (t - 0)).hasDerivAt
have hcomp := hDH.comp 0 (hsh_sub t 0)
simp only [mul_neg, mul_one, sub_zero, Function.comp_apply] at hcomp; exact hcomp
rw [congr_fun (congr_arg deriv hfirst_fun) 0]
have heq2 : (fun v => deriv H (t + v)) - (fun v => deriv H (t - v)) =
fun v => deriv H (t + v) - deriv H (t - v) := by ext v; rfl
have h : deriv (fun v => deriv H (t + v) - deriv H (t - v)) 0 =
deriv (deriv H) t - -deriv (deriv H) t := by
rw [← heq2]; exact (hd2_plus.sub hd2_minus).deriv
linarith [show deriv (deriv H) t - -deriv (deriv H) t = 2 * deriv (deriv H) t from by ring]
have rhs_eq : deriv (deriv (fun u => 2 * H t * H u)) 0 =
2 * H t * deriv (deriv H) 0 := by
have hfirst_fun : deriv (fun u => 2 * H t * H u) = fun v => 2 * H t * deriv H v :=
funext fun v => ((hDiff v).hasDerivAt.const_mul (2 * H t)).deriv
have hsecond := (hDiffDeriv 0).hasDerivAt.const_mul (2 * H t)
rw [congr_fun (congr_arg deriv hfirst_fun) 0, hsecond.deriv]
rw [lhs_eq, rhs_eq] at key
linarith
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The paper's added case
Imagine testing a rule for keeping books about change. The Lean chain already proves that five stated conditions select one cost, J(x) = (x + 1/x)/2 - 1. The paper adds a different kind of value: it turns that result into a self-contained mathematical argument that a reader can follow without opening the formal library.
Its main strengthening is about regularity. The Lean theorem is stated with continuity on the positive reals and an Aczel smoothness package. On paper, the manuscript derives continuity, then C2 regularity, from the composition identity and the quadratic calibration itself. The proof moves to log-coordinates, where multiplication becomes addition and the law becomes the d'Alembert equation. A central-difference argument then yields the differential equation needed to identify the solution. In this presentation, smoothness is a consequence of the functional law and its calibration, rather than a condition supplied from outside.
The manuscript also records the full calibrated classification on paper. For positive curvature the lifted function is a hyperbolic cosine with the corresponding scale, for negative curvature it is an ordinary cosine with the corresponding scale, and for zero curvature it is constant. Unit calibration selects the hyperbolic-cosine case and therefore the canonical cost. That broader classification explains exactly what the calibration rules out, including the one-parameter rescaling that would otherwise remain.
Finally, the paper checks that the proposed cost really satisfies the stated conditions, including reciprocity, normalization, composition, and unit curvature, and prints all proofs in one place. Those are paper-only contributions, tagged DERIVED-UNFORMALIZED here. They make the theorem auditable as ordinary mathematics and clarify its scope. They do not replace the kernel-checked Lean result, and the paper's optional machine-check artifact is supplementary rather than its foundation.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The bilinear gate
The cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof passes through a differential equation in log coordinates, where the transformed function must satisfy H'' = H. That route is analytic: it uses calculus to pin down the unique smooth solution. But the framework's library also contains a purely algebraic corner, the factorization and associativity gate, which characterizes a two-argument combiner P(u,v) by four structural properties: symmetry, affine response in the second argument, a boundary law, and a normalization at (1,1). The theorem gate_forces_bilinear_family states that any such P must be of the form c·u·v + 2u + 2v for some constant c. This is not a differential equation; it is a finite algebraic fact.
If gate_forces_bilinear_family were false or dropped, the immediate loss is the classification of all combiners satisfying the gate. The theorem gate_forces_rcl, which uses the normalization P(1,1) = 6 to select the member with c = 2, depends directly on the bilinear family. Without the family, the normalization cannot be applied; the exact RCL polynomial P(u,v) = 2uv + 2u + 2v would no longer be forced by the gate alone. The equivalence factorization_gate_iff_rcl, which states that the gate is exactly equivalent to being the canonical RCL combiner, would also fail, because it relies on the same bilinear classification.
In the broader cost uniqueness story, dropping the gate would not destroy the analytic proof, which stands on its own via the differential equation. But it would sever the algebraic bridge that connects the discrete ledger to the continuous solution. The gate is what shows that the structural conditions, symmetry, affine response, boundary, and normalization, are enough to pin the combiner without any calculus. Without it, the uniqueness proof would have to rely entirely on the analytic step, leaving a gap: the framework could no longer claim that the algebraic conditions alone force the cost. The machine-checked library of formal theorems would still contain the differential equation route, but the clean algebraic forcing would be lost, and the cost uniqueness page would have to mark that part of the proof as incomplete.
The practical consequence is that the framework's claim to force the cost from five plain conditions would weaken. The algebraic gate is the discrete counterpart to the analytic differential equation; both are needed for the full story. If the gate were dropped, the uniqueness theorem would still hold, but only through the analytic route, and the framework would lose the elegant algebraic derivation that makes the cost feel inevitable rather than merely smooth. The reader would be left with a calculus proof that works, but without the discrete ledger anchor, the cost would seem less forced and more like a convenient smooth choice.
THEOREM gate_forces_bilinear_family · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Once the affine-response step is known, symmetry and the boundary law force
the entire bilinear family. -/
theorem gate_forces_bilinear_family (P : ℝ → ℝ → ℝ)
(hGate : FactorizationAssociativityGate P) :
∃ c : ℝ, ∀ u v, P u v = c * u * v + 2 * u + 2 * v := by
classical
choose α β hAffine using hGate.rightAffine
have hβ : ∀ u, β u = 2 * u := by
intro u
have h0 : P u 0 = α u * 0 + β u := hAffine u 0
rw [hGate.zeroBoundary u] at h0
linarith
let c : ℝ := α 1 - 2
refine ⟨c, ?_⟩
intro u v
have hsym1 : P u 1 = P 1 u := hGate.symmetric u 1
have hαu : α u = c * u + 2 := by
dsimp [c]
have hcalc : α u * 1 + β u = α 1 * u + β 1 := by
calc
α u * 1 + β u = P u 1 := by symm; exact hAffine u 1
_ = P 1 u := hGate.symmetric u 1
_ = α 1 * u + β 1 := hAffine 1 u
rw [hβ u, hβ 1] at hcalc
linarith
calc
P u v = α u * v + β u := hAffine u v
_ = (c * u + 2) * v + 2 * u := by rw [hαu, hβ u]
_ = c * u * v + 2 * u + 2 * v := by ring
THEOREM gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Canonical normalization selects the RCL member of the bilinear family. -/
theorem gate_forces_rcl (P : ℝ → ℝ → ℝ)
(hGate : FactorizationAssociativityGate P) :
∀ u v, P u v = 2 * u * v + 2 * u + 2 * v := by
obtain ⟨c, hc⟩ := gate_forces_bilinear_family P hGate
have hc_two : c = 2 := by
have h11 : P 1 1 = c * 1 * 1 + 2 * 1 + 2 * 1 := by
simpa using hc 1 1
linarith [hGate.unitDiagonal, h11]
intro u v
calc
P u v = c * u * v + 2 * u + 2 * v := hc u v
_ = 2 * u * v + 2 * u + 2 * v := by rw [hc_two]
THEOREM factorization_gate_iff_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Exact gate characterization: the factorization gate is equivalent to being
the canonical RCL combiner. -/
theorem factorization_gate_iff_rcl (P : ℝ → ℝ → ℝ) :
FactorizationAssociativityGate P ↔ ∀ u v, P u v = rclCombiner u v := by
constructor
· intro hGate u v
rw [gate_forces_rcl P hGate u v]
rfl
· intro hP
refine {
symmetric := ?_
rightAffine := ?_
zeroBoundary := ?_
unitDiagonal := ?_
}
· intro u v
rw [hP u v, hP v u]
unfold rclCombiner
ring
· intro u
refine ⟨2 * u + 2, 2 * u, ?_⟩
intro v
rw [hP u v]
unfold rclCombiner
ring
· intro u
rw [hP u 0]
unfold rclCombiner
ring
· rw [hP 1 1]
unfold rclCombiner
norm_num
The continuity hinge
The cost uniqueness theorem states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The conditions are reciprocal symmetry, zero cost at unity, a forced composition law, calibration, and continuity. The theorem is proved in the machine-checked library of formal theorems, with no unproved assumptions beyond the standard axioms of logic. The proof passes through a differential equation, a hard analytic step that selects the unique smooth solution.
The step that makes the analytic route work is a regularity theorem about the hyperbolic cosine, cosh. The theorem cosh_satisfies_continuous states that the hyperbolic cosine is continuous. That fact is the seed of a chain: it feeds the regularity hypotheses that let the proof move from the functional equation to a differential equation, and from there to the unique solution. Without that continuity fact, the chain has no first rung.
If cosh_satisfies_continuous were false or dropped, the proof would lose its grip on the regularity package. The package is a set of hypotheses that the framework uses to justify moving from the functional equation to the differential equation. The theorem dAlembert_cosh_solution requires several regularity hypotheses, and cosh_satisfies_continuous is the one that supplies continuity for the hyperbolic cosine. Without it, the proof cannot apply the package to the candidate solution.
The loss is not just cosmetic. The uniqueness theorem law_of_logic_forces_jcost takes continuity as one of its five input conditions. The proof uses that continuity to select the smooth solution from the family of possible solutions. If the continuity fact about cosh were missing, the proof would have a gap at exactly the point where it needs to rule out the pathological solutions that satisfy the functional equation but not the differential equation. The uniqueness story would be incomplete.
In the framework's account, the continuity of cosh is not a free assumption. It is a proved theorem about a classical function, and it is the load-bearing regularity fact that lets the five plain conditions close on one formula. The cost uniqueness theorem stands on that hinge.
THEOREM cosh_satisfies_continuous · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh is continuous. -/
theorem cosh_satisfies_continuous : ode_regularity_continuous_hypothesis Real.cosh := by
intro _
exact Real.continuous_cosh
THEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_deriv_zero : deriv H 0 = 0 := by
have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert
have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt
exact even_deriv_at_zero H h_even h_diff
exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The evenness hinge
The cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof's main route is analytic: it transforms the problem into log coordinates, where the function must satisfy a differential equation whose unique smooth solution is the hyperbolic cosine. Before that calculus begins, however, the proof needs a structural fact about the function H(t) = F(e^t): it must be even, meaning H(-t) = H(t) for all t.
That evenness comes from the reciprocal symmetry condition on the cost F, which requires F(x) = F(1/x). In log coordinates, this becomes H(-t) = H(t). The theorem reciprocal_implies_G_even in the machine-checked library of formal theorems proves exactly this implication. Without it, the differential equation H'' = H that selects cosh would not follow from the d'Alembert equation alone. The d'Alembert equation, H(t+u) + H(t-u) = 2 H(t) H(u), admits many non-even continuous solutions, such as H(t) = cosh(kt) for any constant k, each with a different curvature at zero. The evenness condition, combined with the calibration condition that fixes the second derivative at zero to be 1, is what pins k to 1.
If dAlembert_even were false or dropped, the proof would lose the bridge from the composition law to the differential equation. The theorem dAlembert_to_ODE_hypothesis, which states that the d'Alembert equation plus evenness implies H'' = H, would no longer apply. The chain from the five cost conditions to J(x) would break at this step, and the uniqueness conclusion would not follow. The framework's library does not currently contain an alternative route that bypasses evenness; the analytic path is the one that is proved.
The role of evenness is not merely technical. It is what makes the d'Alembert equation, a relation about sums and differences of arguments, into a statement about a single variable's curvature. Without it, the equation describes a family of hyperbolic cosines with different scales, and the cost uniqueness theorem would reduce to a statement about a family, not a single function. The five conditions would still force the composition law, but they would not force the specific J(x) that the framework identifies as the unique cost.
THEOREM reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Lemma 2.1**: If F is reciprocal, then G(t) = F(e^t) is even. -/
theorem reciprocal_implies_G_even (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) :
Function.Even (G F) :=
G_even_of_reciprocal_symmetry F (fun {x} hx => hRecip x hx)
MEASURED dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_deriv_zero : deriv H 0 = 0 := by
have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert
have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt
exact even_deriv_at_zero H h_even h_diff
exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM dAlembert_to_ODE_hypothesis · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **d'Alembert to ODE derivation.**
If H satisfies the d'Alembert equation and is smooth, then H'' = H.
Proof sketch: Differentiate H(t+u) + H(t-u) = 2H(t)H(u) twice with respect to u,
then set u = 0 to get H''(t) = H''(0) · H(t). With calibration H''(0) = 1, this
gives H''(t) = H(t). -/
def dAlembert_to_ODE_hypothesis (H : ℝ → ℝ) : Prop :=
H 0 = 1 → Continuous H → (∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) →
deriv (deriv H) 0 = 1 → ∀ t, deriv (deriv H) t = H t
The bridge lemma
The cost uniqueness theorem states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof passes through a change of variables: it writes the cost function F in log coordinates as G(t) = F(exp t). In these coordinates, the composition law becomes a hyperbolic cosine addition formula. The bridge lemma, CoshAddIdentity_implies_DirectCoshAdd, is the step that performs this translation. It takes the statement that F satisfies the composition law and returns the statement that G satisfies the corresponding addition identity.
If this lemma were false or dropped, the proof would stop at the composition law. The subsequent analysis, which uses the addition identity to derive a differential equation, would have no starting point. The theorem law_of_logic_forces_jcost, which concludes that F equals J, relies on this bridge. Without it, the chain from the five conditions to the unique solution would be broken, and the cost uniqueness result would not follow from the given hypotheses.
The lemma itself is a definitional unfolding: it holds by the definition of CoshAddIdentity, which is stated directly in terms of G. The composition law and the addition identity are the same condition under the log-coordinate reparametrization. The lemma is therefore not a deep mathematical discovery but a necessary bookkeeping step that connects two formulations of the same property.
In Recognition Science, the cost function is not chosen but forced. The bridge lemma is part of the forcing chain that shows why only one cost function is possible. If the bridge failed, the framework would lose its proof that the five conditions single out J. The lemma is a load-bearing step in the argument, even though it is a simple one.
THEOREM CoshAddIdentity_implies_DirectCoshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma CoshAddIdentity_implies_DirectCoshAdd (F : ℝ → ℝ)
(h : CoshAddIdentity F) :
DirectCoshAdd (G F) := h
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM CoshAddIdentity · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The cosh-type functional identity for `G_F`. -/
def CoshAddIdentity (F : ℝ → ℝ) : Prop :=
∀ t u : ℝ,
G F (t+u) + G F (t-u) = 2 * (G F t * G F u) + 2 * (G F t + G F u)
The diagonalization shortcut
The cost uniqueness theorem states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof in the machine-checked library of formal theorems reaches this conclusion by a chain of analytic steps: it transforms the problem into log coordinates, derives a differential equation, and then solves that equation. The declaration ode_diagonalization is not part of this chain. It is a separate lemma in the library, and the page does not cite it.
What ode_diagonalization offers is a different route through the same territory. The differential equation that appears in the proof has the form H'' = H, where H is a twice-differentiable function. A standard way to solve such an equation is to diagonalize the second-derivative operator: write the solution as a combination of exponential functions e^t and e^-t, which are eigenvectors of differentiation. The lemma packages this idea into a reusable form, so that a later proof could invoke it instead of re-deriving the exponential solution from scratch.
The current proof does not take that route. It relies on the theorem ode_cosh_uniqueness, which states directly that the only twice-differentiable function satisfying H'' = H with the initial conditions H(0) = 1 and H'(0) = 0 is the hyperbolic cosine. That theorem is proved in the library, and it is the step that the cost uniqueness proof uses. The diagonalization lemma is therefore available but not needed: it would be an alternative implementation detail, not a missing ingredient.
Should the page mention it? The page's goal is to present the uniqueness theorem and the shape of its proof, not to catalog every lemma in the library. Adding ode_diagonalization would be useful only if the page wanted to explain an alternative proof strategy, or if a reader specifically asked how the differential equation could be solved by a different method. As it stands, the page is complete without it, and the declaration can stay off the page without loss of accuracy or coverage.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM law_of_logic_forces_jcost_with_regularization · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem 1.1 (Main Result, Reformulated)**:
Let F : ℝ₊ → ℝ satisfy:
1. Reciprocity: F(x) = F(1/x)
2. Normalization: F(1) = 0
3. Composition Law: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y)
4. Calibration: lim_{t→0} 2F(e^t)/t² = 1
5. Continuity and regularity hypotheses
Then F = J on ℝ₊, where J(x) = (x + 1/x)/2 - 1.
This theorem corresponds to Theorem 1.1 in:
J. Washburn & M. Zlatanović, "Uniqueness of the Canonical Reciprocal Cost" -/
theorem law_of_logic_forces_jcost_with_regularization (F : ℝ → ℝ)
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0))
-- Regularity hypotheses (from Aczél theory)
(h_smooth : dAlembert_continuous_implies_smooth_hypothesis (H F))
(h_ode : dAlembert_to_ODE_hypothesis (H F))
(h_cont : ode_regularity_continuous_hypothesis (H F))
(h_diff : ode_regularity_differentiable_hypothesis (H F))
(h_boot : ode_linear_regularity_bootstrap_hypothesis (H F)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
-- The proof follows the structure of T5_uniqueness_complete:
-- 1. Convert composition law to CoshAddIdentity on G
-- 2. Shift to H = G + 1 to get standard d'Alembert equation
-- 3. Apply Aczél's theorem: continuous d'Alembert solutions are cosh
-- 4. Calibration H''(0) = 1 selects cosh (not cos or constant)
-- 5. Unshift: G = cosh - 1, hence F = J
intro x hx
-- Convert hypotheses to the required format
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
-- Step 1: Set up G and H
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
-- Step 2: Derive key properties of G and H
have h_G_even : Function.Even Gf := G_even_of_reciprocal_symmetry F hSymm
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
-- Goal is F 1 + 1 = 1, and hNorm says F 1 = 0
rw [hNorm]
ring
-- Step 3: G is continuous (F continuous on (0,∞), exp continuous)
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
-- Step 4: Convert CoshAddIdentity to d'Alembert equation for H
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
-- Step 5: Second derivative condition
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t
change deriv (fun y => Gf y + 1) t = deriv Gf t
simpa using (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
-- Step 6: Apply d'Alembert uniqueness theorem
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution Hf h_H0 h_H_cont h_dAlembert h_H_d2
h_smooth h_ode h_cont h_diff h_boot
-- Step 7: Unshift to get G = cosh - 1
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := by
intro t
have hH := h_H_cosh t
have hH' : Gf t + 1 = Real.cosh t := by simpa [Hf, H, Gf] using hH
linarith
-- Step 8: Convert back via log parametrization
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simpa using hJG.symm
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simpa [ht]
MODEL dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Derivation, universal coefficient)**: If H is C∞ and
satisfies d'Alembert, then `H''(t) = H''(0) * H(t)` everywhere.
This is the unnormalized form of `dAlembert_to_ODE_theorem`. -/
theorem dAlembert_to_ODE_general_theorem (H : ℝ → ℝ)
(h_smooth : ContDiff ℝ ⊤ H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) :
∀ t, deriv (deriv H) t = deriv (deriv H) 0 * H t := by
have hCDiff2 : ContDiff ℝ 2 H := h_smooth.of_le le_top
have hDiff : Differentiable ℝ H :=
hCDiff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have hCDiff1_H' : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at hCDiff2
rw [contDiff_succ_iff_deriv] at hCDiff2
exact hCDiff2.2.2
have hDiffDeriv : Differentiable ℝ (deriv H) :=
hCDiff1_H'.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
have hsh_add : ∀ (s v : ℝ), HasDerivAt (fun u => s + u) (1 : ℝ) v := fun s v => by
have h := (hasDerivAt_id v).add_const s; simp only [id] at h
rwa [show (fun u : ℝ => u + s) = fun u => s + u from funext fun u => add_comm u s] at h
have hsh_sub : ∀ (s v : ℝ), HasDerivAt (fun u => s - u) (-1 : ℝ) v := fun s v => by
have h1 : HasDerivAt (fun u : ℝ => -u) (-1 : ℝ) v := by
have := (hasDerivAt_id v).neg; simp only [id] at this; exact this
have h2 := h1.const_add s
rwa [show (fun u : ℝ => s + -u) = fun u => s - u from funext fun u => by ring] at h2
intro t
have h_feq : (fun u => H (t + u) + H (t - u)) = (fun u => 2 * H t * H u) :=
funext (h_dAlembert t)
have key : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 =
deriv (deriv (fun u => 2 * H t * H u)) 0 :=
congr_arg (fun f => deriv (deriv f) 0) h_feq
have lhs_eq : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = 2 * deriv (deriv H) t := by
have h_plus : ∀ v, HasDerivAt (fun u => H (t + u)) (deriv H (t + v)) v := fun v => by
have hH := (hDiff (t + v)).hasDerivAt
have hcomp := hH.comp v (hsh_add t v)
simp only [mul_one, Function.comp_apply] at hcomp; exact hcomp
have h_minus : ∀ v, HasDerivAt (fun u => H (t - u)) (-deriv H (t - v)) v := fun v => by
have hH := (hDiff (t - v)).hasDerivAt
have hcomp := hH.comp v (hsh_sub t v)
simp only [mul_neg, mul_one, Function.comp_apply] at hcomp; exact hcomp
have hfirst_fun : deriv (fun u => H (t + u) + H (t - u)) =
fun v => deriv H (t + v) - deriv H (t - v) := funext fun v => by
have heq : (fun u => H (t + u)) + (fun u => H (t - u)) =
fun u => H (t + u) + H (t - u) := by ext u; rfl
have h12 : deriv (fun u => H (t + u) + H (t - u)) v = deriv H (t + v) + -deriv H (t - v) := by
rw [← heq]; exact ((h_plus v).add (h_minus v)).deriv
linarith [show deriv H (t + v) + -deriv H (t - v) =
deriv H (t + v) - deriv H (t - v) from by ring]
have hd2_plus : HasDerivAt (fun v => deriv H (t + v)) (deriv (deriv H) t) 0 := by
have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t + 0)) (t + 0) :=
(hDiffDeriv (t + 0)).hasDerivAt
have hcomp := hDH.comp 0 (hsh_add t 0)
simp only [mul_one, add_zero, Function.comp_apply] at hcomp; exact hcomp
have hd2_minus : HasDerivAt (fun v => deriv H (t - v)) (-deriv (deriv H) t) 0 := by
have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t - 0)) (t - 0) :=
(hDiffDeriv (t - 0)).hasDerivAt
have hcomp := hDH.comp 0 (hsh_sub t 0)
simp only [mul_neg, mul_one, sub_zero, Function.comp_apply] at hcomp; exact hcomp
rw [congr_fun (congr_arg deriv hfirst_fun) 0]
have heq2 : (fun v => deriv H (t + v)) - (fun v => deriv H (t - v)) =
fun v => deriv H (t + v) - deriv H (t - v) := by ext v; rfl
have h : deriv (fun v => deriv H (t + v) - deriv H (t - v)) 0 =
deriv (deriv H) t - -deriv (deriv H) t := by
rw [← heq2]; exact (hd2_plus.sub hd2_minus).deriv
linarith [show deriv (deriv H) t - -deriv (deriv H) t = 2 * deriv (deriv H) t from by ring]
have rhs_eq : deriv (deriv (fun u => 2 * H t * H u)) 0 =
2 * H t * deriv (deriv H) 0 := by
have hfirst_fun : deriv (fun u => 2 * H t * H u) = fun v => 2 * H t * deriv H v :=
funext fun v => ((hDiff v).hasDerivAt.const_mul (2 * H t)).deriv
have hsecond := (hDiffDeriv 0).hasDerivAt.const_mul (2 * H t)
rw [congr_fun (congr_arg deriv hfirst_fun) 0, hsecond.deriv]
rw [lhs_eq, rhs_eq] at key
linarith
THEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ)
(h_ODE : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := h_cont_hyp h_ODE
have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont
have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff
exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0
The bridge to the differential equation
d'Alembert's equation is a functional equation that appears across mathematics, most famously in the theory of trigonometric and hyperbolic functions. For a function H of a real variable, it states that H(t+u) + H(t-u) = 2 H(t) H(u). The classical fact about this equation is that, under mild regularity conditions such as continuity, its solutions are exactly the hyperbolic cosine and its relatives. The cost uniqueness theorem in Recognition Science uses this fact as a bridge: it shows that a recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1.
The proof reaches this conclusion in stages. It first reparametrizes the cost in log coordinates, where the composition law becomes a d'Alembert-type identity. The next step is the one that depends on dAlembert_product, a lemma that derives a product identity from the sum identity: H(t+u) * H(t-u) = (H t)^2 + (H u)^2 - 1. This product form is what makes the log-curvature condition, a limit statement about the second derivative at zero, translate into a full second-order differential equation, H''(t) = H(t), for all t. That differential equation, with the initial conditions H(0) = 1 and H'(0) = 0, has the hyperbolic cosine as its unique solution. The final step converts cosh back into the J form.
If dAlembert_product were false or dropped, the chain would break at the point where the local curvature condition becomes a global differential equation. Without the product identity, the proof would not be able to show that the second derivative of H equals H at every point, only that it does so at zero. The uniqueness theorem would then fail to follow from the five conditions; the argument would stop short of forcing the hyperbolic cosine. The theorem itself is proved in the machine-checked library of formal theorems, and the lemma is a proved step in that library, so the question is not whether the lemma holds but what role it plays in the derivation.
The role is structural, not cosmetic. The lemma is what lets the proof move from an algebraic constraint, the composition law, to an analytic one, the differential equation. This is the same move that appears in the classical theory of d'Alembert's equation, where the product identity is a standard step in showing that continuous solutions are smooth. In the cost uniqueness proof, the lemma is the pivot that makes the five conditions bite. Without it, the conditions would still be consistent, but they would not be enough to single out J. The uniqueness story would lose its force, and the framework would lose the derivation of the golden ratio and the rest of the forcing chain that follows from J.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM dAlembert_product · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_product
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) :
∀ t u, H (t+u) * H (t-u) = (H t)^2 + (H u)^2 - 1 := by
intro t u
have h := h_dAlembert (t + u) (t - u)
have h' : H (2 * t) + H (2 * u) = 2 * H (t + u) * H (t - u) := by
-- (t+u)+(t-u)=2t and (t+u)-(t-u)=2u
simpa [two_mul, sub_eq_add_neg, add_assoc, add_left_comm, add_comm] using h
have h2t : H (2 * t) = 2 * (H t)^2 - 1 := dAlembert_double H h_one h_dAlembert t
have h2u : H (2 * u) = 2 * (H u)^2 - 1 := dAlembert_double H h_one h_dAlembert u
have h'' : 2 * H (t + u) * H (t - u) = (2 * (H t)^2 - 1) + (2 * (H u)^2 - 1) := by
calc
2 * H (t + u) * H (t - u) = H (2 * t) + H (2 * u) := by linarith [h']
_ = (2 * (H t)^2 - 1) + (2 * (H u)^2 - 1) := by simp [h2t, h2u]
linarith
THEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ)
(h_ODE : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := h_cont_hyp h_ODE
have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont
have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff
exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0
THEOREM dAlembert_to_ODE_hypothesis · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **d'Alembert to ODE derivation.**
If H satisfies the d'Alembert equation and is smooth, then H'' = H.
Proof sketch: Differentiate H(t+u) + H(t-u) = 2H(t)H(u) twice with respect to u,
then set u = 0 to get H''(t) = H''(0) · H(t). With calibration H''(0) = 1, this
gives H''(t) = H(t). -/
def dAlembert_to_ODE_hypothesis (H : ℝ → ℝ) : Prop :=
H 0 = 1 → Continuous H → (∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) →
deriv (deriv H) 0 = 1 → ∀ t, deriv (deriv H) t = H t
The missing ratio lemma
The declaration sub_one_eq_mul_ratio is a lemma about positive real numbers. It states that for any positive x and y, the expression x - 1 equals y times the ratio (x - 1) / y. This is a simple algebraic rewriting, true by the field axioms. In the machine-checked library of formal theorems, it sits in the module for the cost uniqueness proof, but the proof itself never invokes it.
The cost uniqueness theorem proves that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof's route is analytic: it transforms the problem into log coordinates, where the function must satisfy a differential equation whose unique smooth solution is the hyperbolic cosine. The chain of reasoning passes through the composition law, the d'Alembert equation, and an ordinary differential equation. At no step does the proof need to rewrite x - 1 as a product involving a ratio.
What the lemma would contribute is a small algebraic convenience. In a hand-written proof, one might use it to rearrange terms when showing that the composition law forces a particular normalization. The formal proof, however, already has the needed algebraic steps built into other lemmas, such as the one that derives the d'Alembert equation from the composition law. Adding sub_one_eq_mul_ratio would not shorten the proof or open a new route; it would sit as an unused helper.
The page should keep the lemma off the main text. It is a true statement, but it does no work in the proof as formalized. Mentioning it would add noise without adding insight. The page's job is to explain the theorem's route, not to inventory every lemma in the library. A reader who wants the full list of declarations can consult the source file directly.
THEOREM logCurvature_eq_deriv2 · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- For a smooth function with `Hf 0 = 1` and vanishing first derivative, the log
curvature exists and equals the second derivative at the origin. This is the
l'Hôpital step, and it is also what makes the corrected calibration satisfiable
rather than empty. -/
theorem logCurvature_eq_deriv2 (Hf : ℝ → ℝ) (hsm : ContDiff ℝ ⊤ Hf)
(h1 : Hf 0 = 1) (hd0 : deriv Hf 0 = 0) :
HasLogCurvature Hf (deriv (deriv Hf) 0) := by
have h2 : ContDiff ℝ 2 Hf := hsm.of_le (by exact_mod_cast le_top)
have hderiv_diff : Differentiable ℝ (deriv Hf) := by
have h3 := h2
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h3
rw [contDiff_succ_iff_deriv] at h3
exact h3.2.2.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
have hdiffHf : Differentiable ℝ Hf :=
h2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have hd2 : HasDerivAt (deriv Hf) (deriv (deriv Hf) 0) 0 :=
(hderiv_diff 0).hasDerivAt
have hslope :
Filter.Tendsto (fun t : ℝ => deriv Hf t / t)
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (deriv (deriv Hf) 0)) := by
have h := hasDerivAt_iff_tendsto_slope.mp hd2
have hsl : ∀ t : ℝ, slope (deriv Hf) 0 t = deriv Hf t / t := by
intro t
simp [slope_def_field, hd0]
exact Filter.Tendsto.congr hsl h
have hnum : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1))
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 0) := by
have hcont : Filter.Tendsto Hf (nhds (0 : ℝ)) (nhds (Hf 0)) :=
hdiffHf.continuous.tendsto 0
have hconst : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhds (0 : ℝ)) (nhds 1) :=
tendsto_const_nhds
have hsub : Filter.Tendsto (fun t : ℝ => Hf t - 1) (nhds (0 : ℝ))
(nhds (Hf 0 - 1)) := hcont.sub hconst
have hmul : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1)) (nhds (0 : ℝ))
(nhds (2 * (Hf 0 - 1))) := hsub.const_mul (2 : ℝ)
rw [h1] at hmul
simpa using hmul.mono_left nhdsWithin_le_nhds
have hden : Filter.Tendsto (fun t : ℝ => t ^ 2)
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 0) := by
have h := (continuous_pow 2).tendsto (0 : ℝ)
simpa using h.mono_left nhdsWithin_le_nhds
have hff' : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ),
HasDerivAt (fun s : ℝ => 2 * (Hf s - 1)) (2 * deriv Hf t) t := by
filter_upwards with t
simpa using ((hdiffHf t).hasDerivAt.sub_const 1).const_mul (2 : ℝ)
have hgg' : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ),
HasDerivAt (fun s : ℝ => s ^ 2) (2 * t) t := by
filter_upwards with t
simpa [mul_comm] using hasDerivAt_pow 2 t
have hg'ne : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), (2 : ℝ) * t ≠ 0 := by
filter_upwards [self_mem_nhdsWithin] with t ht
have htne : t ≠ 0 := ht
positivity
have hdiv :
Filter.Tendsto (fun t : ℝ => (2 * deriv Hf t) / (2 * t))
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (deriv (deriv Hf) 0)) := by
refine Filter.Tendsto.congr' ?_ hslope
filter_upwards [self_mem_nhdsWithin] with t ht
have htne : t ≠ 0 := ht
field_simp
exact HasDerivAt.lhopital_zero_nhdsNE hff' hgg' hg'ne hnum hden hdiv
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM composition_law_equiv_coshAdd · dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G.
Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y)
becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t)
via the substitution x = e^s, y = e^t. -/
theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) :
SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by
constructor
· intro hComp t u
have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t
have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u
have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos
-- exp(t) * exp(u) = exp(t + u)
have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm
-- exp(t) / exp(u) = exp(t - u)
have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by
rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg]
simp only [G, h1, h2] at h ⊢
linarith
· intro hCosh x y hx hy
let t := Real.log x
let u := Real.log y
have hx_eq : x = Real.exp t := (Real.exp_log hx).symm
have hy_eq : y = Real.exp u := (Real.exp_log hy).symm
have h := hCosh t u
simp only [G] at h
rw [hx_eq, hy_eq]
rw [← Real.exp_add, ← Real.exp_sub]
-- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u))
-- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u)
calc F (Real.exp (t + u)) + F (Real.exp (t - u))
= 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h
_ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ring
/-- **Theorem (ODE Derivation, universal coefficient)**: If H is C∞ and
satisfies d'Alembert, then `H''(t) = H''(0) * H(t)` everywhere.
This is the unnormalized form of `dAlembert_to_ODE_theorem`. -/
theorem dAlembert_to_ODE_general_theorem (H : ℝ → ℝ)
(h_smooth : ContDiff ℝ ⊤ H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) :
∀ t, deriv (deriv H) t = deriv (deriv H) 0 * H t := by
have hCDiff2 : ContDiff ℝ 2 H := h_smooth.of_le le_top
have hDiff : Differentiable ℝ H :=
hCDiff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have hCDiff1_H' : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at hCDiff2
rw [contDiff_succ_iff_deriv] at hCDiff2
exact hCDiff2.2.2
have hDiffDeriv : Differentiable ℝ (deriv H) :=
hCDiff1_H'.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
have hsh_add : ∀ (s v : ℝ), HasDerivAt (fun u => s + u) (1 : ℝ) v := fun s v => by
have h := (hasDerivAt_id v).add_const s; simp only [id] at h
rwa [show (fun u : ℝ => u + s) = fun u => s + u from funext fun u => add_comm u s] at h
have hsh_sub : ∀ (s v : ℝ), HasDerivAt (fun u => s - u) (-1 : ℝ) v := fun s v => by
have h1 : HasDerivAt (fun u : ℝ => -u) (-1 : ℝ) v := by
have := (hasDerivAt_id v).neg; simp only [id] at this; exact this
have h2 := h1.const_add s
rwa [show (fun u : ℝ => s + -u) = fun u => s - u from funext fun u => by ring] at h2
intro t
have h_feq : (fun u => H (t + u) + H (t - u)) = (fun u => 2 * H t * H u) :=
funext (h_dAlembert t)
have key : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 =
deriv (deriv (fun u => 2 * H t * H u)) 0 :=
congr_arg (fun f => deriv (deriv f) 0) h_feq
have lhs_eq : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = 2 * deriv (deriv H) t := by
have h_plus : ∀ v, HasDerivAt (fun u => H (t + u)) (deriv H (t + v)) v := fun v => by
have hH := (hDiff (t + v)).hasDerivAt
have hcomp := hH.comp v (hsh_add t v)
simp only [mul_one, Function.comp_apply] at hcomp; exact hcomp
have h_minus : ∀ v, HasDerivAt (fun u => H (t - u)) (-deriv H (t - v)) v := fun v => by
have hH := (hDiff (t - v)).hasDerivAt
have hcomp := hH.comp v (hsh_sub t v)
simp only [mul_neg, mul_one, Function.comp_apply] at hcomp; exact hcomp
have hfirst_fun : deriv (fun u => H (t + u) + H (t - u)) =
fun v => deriv H (t + v) - deriv H (t - v) := funext fun v => by
have heq : (fun u => H (t + u)) + (fun u => H (t - u)) =
fun u => H (t + u) + H (t - u) := by ext u; rfl
have h12 : deriv (fun u => H (t + u) + H (t - u)) v = deriv H (t + v) + -deriv H (t - v) := by
rw [← heq]; exact ((h_plus v).add (h_minus v)).deriv
linarith [show deriv H (t + v) + -deriv H (t - v) =
deriv H (t + v) - deriv H (t - v) from by ring]
have hd2_plus : HasDerivAt (fun v => deriv H (t + v)) (deriv (deriv H) t) 0 := by
have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t + 0)) (t + 0) :=
(hDiffDeriv (t + 0)).hasDerivAt
have hcomp := hDH.comp 0 (hsh_add t 0)
simp only [mul_one, add_zero, Function.comp_apply] at hcomp; exact hcomp
have hd2_minus : HasDerivAt (fun v => deriv H (t - v)) (-deriv (deriv H) t) 0 := by
have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t - 0)) (t - 0) :=
(hDiffDeriv (t - 0)).hasDerivAt
have hcomp := hDH.comp 0 (hsh_sub t 0)
simp only [mul_neg, mul_one, sub_zero, Function.comp_apply] at hcomp; exact hcomp
rw [congr_fun (congr_arg deriv hfirst_fun) 0]
have heq2 : (fun v => deriv H (t + v)) - (fun v => deriv H (t - v)) =
fun v => deriv H (t + v) - deriv H (t - v) := by ext v; rfl
have h : deriv (fun v => deriv H (t + v) - deriv H (t - v)) 0 =
deriv (deriv H) t - -deriv (deriv H) t := by
rw [← heq2]; exact (hd2_plus.sub hd2_minus).deriv
linarith [show deriv (deriv H) t - -deriv (deriv H) t = 2 * deriv (deriv H) t from by ring]
have rhs_eq : deriv (deriv (fun u => 2 * H t * H u)) 0 =
2 * H t * deriv (deriv H) 0 := by
have hfirst_fun : deriv (fun u => 2 * H t * H u) = fun v => 2 * H t * deriv H v :=
funext fun v => ((hDiff v).hasDerivAt.const_mul (2 * H t)).deriv
have hsecond := (hDiffDeriv 0).hasDerivAt.const_mul (2 * H t)
rw [congr_fun (congr_arg deriv hfirst_fun) 0, hsecond.deriv]
rw [lhs_eq, rhs_eq] at key
linarith
The ODE uniqueness step
The cost uniqueness theorem states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The five conditions are reciprocal symmetry, zero cost at unity, a forced composition law, calibration, and continuity. The theorem is proved in the machine-checked library of formal theorems, with no unproved assumptions beyond the standard axioms of logic. The proof reaches a differential equation in log coordinates, where the transformed function must satisfy H'' = H. That route is analytic: it uses calculus to pin down the unique solution.
The analytic step rests on a specific lemma called ode_zero_uniqueness. It states that if a twice-differentiable function f satisfies the differential equation f'' = f, with initial conditions f(0) = 0 and f'(0) = 0, then f is identically zero. This is the classical uniqueness result for a second-order linear ODE. Without it, the proof cannot rule out nonzero solutions that satisfy the same equation and initial conditions. The entire uniqueness conclusion depends on this step: if the lemma were false, the cost function would not be forced to be J; other functions could pass through the same conditions.
In the framework's proof, the lemma is applied to the difference between two candidate solutions. Both candidates satisfy the same differential equation and the same initial conditions, so their difference satisfies f'' = f with f(0) = 0 and f'(0) = 0. The lemma forces that difference to be zero, meaning the two candidates are identical. This is how the proof establishes that there is exactly one cost function. If ode_zero_uniqueness were dropped, the proof would fail at this point: it could not conclude that two candidates are the same, and the uniqueness claim would remain unproved.
The lemma is not a hypothesis; it is a proved theorem in the library, derived from the standard theory of ordinary differential equations. It relies on the regularity assumptions that the functions involved are twice differentiable. These assumptions are supplied by the Aczél smoothness package, which ensures that the continuous solutions of the d'Alembert equation are smooth enough for the ODE argument to apply. The lemma itself is a standard mathematical fact, but in the framework it is load-bearing: it is the step that converts a differential equation into a uniqueness statement.
If the lemma were false, the cost uniqueness theorem would not follow from the five conditions alone. The proof would need a different route to rule out alternative solutions, or the theorem would have to be weakened to allow multiple cost functions. The framework's claim that the cost is forced would fail. This is why the lemma is not an optional detail: it is the analytic backbone of the entire uniqueness story.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Derivation, universal coefficient)**: If H is C∞ and
satisfies d'Alembert, then `H''(t) = H''(0) * H(t)` everywhere.
This is the unnormalized form of `dAlembert_to_ODE_theorem`. -/
theorem dAlembert_to_ODE_general_theorem (H : ℝ → ℝ)
(h_smooth : ContDiff ℝ ⊤ H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) :
∀ t, deriv (deriv H) t = deriv (deriv H) 0 * H t := by
have hCDiff2 : ContDiff ℝ 2 H := h_smooth.of_le le_top
have hDiff : Differentiable ℝ H :=
hCDiff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have hCDiff1_H' : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at hCDiff2
rw [contDiff_succ_iff_deriv] at hCDiff2
exact hCDiff2.2.2
have hDiffDeriv : Differentiable ℝ (deriv H) :=
hCDiff1_H'.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
have hsh_add : ∀ (s v : ℝ), HasDerivAt (fun u => s + u) (1 : ℝ) v := fun s v => by
have h := (hasDerivAt_id v).add_const s; simp only [id] at h
rwa [show (fun u : ℝ => u + s) = fun u => s + u from funext fun u => add_comm u s] at h
have hsh_sub : ∀ (s v : ℝ), HasDerivAt (fun u => s - u) (-1 : ℝ) v := fun s v => by
have h1 : HasDerivAt (fun u : ℝ => -u) (-1 : ℝ) v := by
have := (hasDerivAt_id v).neg; simp only [id] at this; exact this
have h2 := h1.const_add s
rwa [show (fun u : ℝ => s + -u) = fun u => s - u from funext fun u => by ring] at h2
intro t
have h_feq : (fun u => H (t + u) + H (t - u)) = (fun u => 2 * H t * H u) :=
funext (h_dAlembert t)
have key : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 =
deriv (deriv (fun u => 2 * H t * H u)) 0 :=
congr_arg (fun f => deriv (deriv f) 0) h_feq
have lhs_eq : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = 2 * deriv (deriv H) t := by
have h_plus : ∀ v, HasDerivAt (fun u => H (t + u)) (deriv H (t + v)) v := fun v => by
have hH := (hDiff (t + v)).hasDerivAt
have hcomp := hH.comp v (hsh_add t v)
simp only [mul_one, Function.comp_apply] at hcomp; exact hcomp
have h_minus : ∀ v, HasDerivAt (fun u => H (t - u)) (-deriv H (t - v)) v := fun v => by
have hH := (hDiff (t - v)).hasDerivAt
have hcomp := hH.comp v (hsh_sub t v)
simp only [mul_neg, mul_one, Function.comp_apply] at hcomp; exact hcomp
have hfirst_fun : deriv (fun u => H (t + u) + H (t - u)) =
fun v => deriv H (t + v) - deriv H (t - v) := funext fun v => by
have heq : (fun u => H (t + u)) + (fun u => H (t - u)) =
fun u => H (t + u) + H (t - u) := by ext u; rfl
have h12 : deriv (fun u => H (t + u) + H (t - u)) v = deriv H (t + v) + -deriv H (t - v) := by
rw [← heq]; exact ((h_plus v).add (h_minus v)).deriv
linarith [show deriv H (t + v) + -deriv H (t - v) =
deriv H (t + v) - deriv H (t - v) from by ring]
have hd2_plus : HasDerivAt (fun v => deriv H (t + v)) (deriv (deriv H) t) 0 := by
have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t + 0)) (t + 0) :=
(hDiffDeriv (t + 0)).hasDerivAt
have hcomp := hDH.comp 0 (hsh_add t 0)
simp only [mul_one, add_zero, Function.comp_apply] at hcomp; exact hcomp
have hd2_minus : HasDerivAt (fun v => deriv H (t - v)) (-deriv (deriv H) t) 0 := by
have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t - 0)) (t - 0) :=
(hDiffDeriv (t - 0)).hasDerivAt
have hcomp := hDH.comp 0 (hsh_sub t 0)
simp only [mul_neg, mul_one, sub_zero, Function.comp_apply] at hcomp; exact hcomp
rw [congr_fun (congr_arg deriv hfirst_fun) 0]
have heq2 : (fun v => deriv H (t + v)) - (fun v => deriv H (t - v)) =
fun v => deriv H (t + v) - deriv H (t - v) := by ext v; rfl
have h : deriv (fun v => deriv H (t + v) - deriv H (t - v)) 0 =
deriv (deriv H) t - -deriv (deriv H) t := by
rw [← heq2]; exact (hd2_plus.sub hd2_minus).deriv
linarith [show deriv (deriv H) t - -deriv (deriv H) t = 2 * deriv (deriv H) t from by ring]
have rhs_eq : deriv (deriv (fun u => 2 * H t * H u)) 0 =
2 * H t * deriv (deriv H) 0 := by
have hfirst_fun : deriv (fun u => 2 * H t * H u) = fun v => 2 * H t * deriv H v :=
funext fun v => ((hDiff v).hasDerivAt.const_mul (2 * H t)).deriv
have hsecond := (hDiffDeriv 0).hasDerivAt.const_mul (2 * H t)
rw [congr_fun (congr_arg deriv hfirst_fun) 0, hsecond.deriv]
rw [lhs_eq, rhs_eq] at key
linarith
THEOREM ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Zero Uniqueness)**: The unique solution to f'' = f with f(0) = f'(0) = 0 is f = 0. -/
theorem ode_zero_uniqueness (f : ℝ → ℝ)
(h_diff2 : ContDiff ℝ 2 f)
(h_ode : ∀ t, deriv (deriv f) t = f t)
(h_f0 : f 0 = 0)
(h_f'0 : deriv f 0 = 0) :
∀ t, f t = 0 := by
have ⟨h_minus, h_plus⟩ := ode_diagonalization f h_diff2 h_ode
have h_diff1 : Differentiable ℝ f := h_diff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have h_deriv_contdiff : ContDiff ℝ 1 (deriv f) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff2
rw [contDiff_succ_iff_deriv] at h_diff2
exact h_diff2.2.2
have h_diff_deriv : Differentiable ℝ (deriv f) := h_deriv_contdiff.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
let g := fun s => deriv f s - f s
let hf := fun s => deriv f s + f s
have hg_diff : Differentiable ℝ g := h_diff_deriv.sub h_diff1
have hh_diff : Differentiable ℝ hf := h_diff_deriv.add h_diff1
have hg0 : g 0 = 0 := by simp [g, h_f0, h_f'0]
have hh0 : hf 0 = 0 := by simp [hf, h_f0, h_f'0]
have hg_deriv : ∀ t, deriv g t = -g t := h_minus
have hh_deriv : ∀ t, deriv hf t = hf t := h_plus
have hg_zero := deriv_neg_self_zero g hg_diff hg_deriv hg0
have hh_zero := deriv_pos_self_zero hf hh_diff hh_deriv hh0
intro t
have hgt := hg_zero t
have hht := hh_zero t
simp only [g, hf] at hgt hht
linarith
The regularity bridge
The cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof in the machine-checked library of formal theorems reaches this conclusion by a chain of analytic steps: it transforms the problem into log coordinates, derives a differential equation, and then solves that equation. The declaration ode_regularity_continuous_of_smooth is not part of that chain. It is a bridge between two different regularity assumptions, and the page currently does not need it.
The proof's main route is analytic: it transforms the problem into log coordinates, where the function must satisfy a differential equation whose unique smooth solution is the hyperbolic cosine. Before that calculus begins, however, the proof needs a structural fact about the function: it must be continuous. The declaration ode_regularity_continuous_of_smooth would supply that fact if the proof had a smoothness assumption to start from. But the theorem law_of_logic_forces_jcost assumes continuity directly, not smoothness. The proof never needs to derive continuity from smoothness, because continuity is already given as one of the five plain conditions.
The declaration would become relevant if the page ever presented a version of the theorem that assumed smoothness instead of continuity. That version exists in the library as law_of_logic_forces_jcost_with_regularization, which takes a package of regularity hypotheses including ode_regularity_continuous_hypothesis. In that version, the declaration could help show that the smoothness assumption implies the continuity hypothesis. But the page does not present that version, and the main theorem does not need the bridge. Leaving the declaration off the page is the right choice: it would add a technical detail without changing the story.
What the page does need is the fact that the continuous solutions of the d'Alembert equation are exactly the hyperbolic cosine functions. That fact is what turns the functional equation into the differential equation, and it is what the page already uses. The regularity bridge would only be a detour through a different assumption. The page's current focus on continuity as a given condition is the cleaner path, and it matches the theorem that the page actually presents.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The smoothness bridge
The hyperbolic cosine, written cosh(t), is the average of the exponential function and its reciprocal: cosh(t) = (e^t + e^-t)/2. It is the even counterpart to the hyperbolic sine, and it describes the shape of a hanging chain or cable under its own weight, the catenary. Like the ordinary cosine, it satisfies a second-order differential equation, but the equation alone does not select it uniquely. The classical d'Alembert equation, H(t+u) + H(t-u) = 2 H(t) H(u), characterizes the cosine and its hyperbolic cousin without any mention of calculus. Its continuous solutions are exactly the functions H(t) = cosh(kt) for a constant k.
The cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof in the machine-checked library of formal theorems reaches this conclusion by a chain of analytic steps: it transforms the problem into log coordinates, derives a differential equation, and then solves that equation. The declaration cosh_dAlembert_smooth is the bridge between the functional equation and the differential equation. It asserts that the hyperbolic cosine satisfies the smoothness hypothesis that the d'Alembert equation, together with continuity, implies infinite differentiability. This hypothesis is the gateway to the ODE: once the function is smooth, the d'Alembert equation forces the second derivative to equal the function itself, and the initial conditions H(0)=1 and H'(0)=0 select cosh uniquely.
In the framework's library, cosh_dAlembert_smooth is a theorem, not a definition. It is used to verify that the candidate solution, the hyperbolic cosine, satisfies the regularity package required by the uniqueness theorem. The theorem dAlembert_cosh_solution_of_log_curvature takes this smoothness hypothesis as an input, along with the d'Alembert equation and the log-curvature condition, and concludes that the function is exactly cosh. The declaration cosh_dAlembert_smooth is the concrete instance of that hypothesis for the candidate itself. Without it, the proof would have to re-establish the smoothness of cosh from scratch each time, and the chain from the functional equation to the ODE would be incomplete.
The contribution of cosh_dAlembert_smooth is therefore not a new mathematical fact about cosh, which is classical and well known, but a formal bridge in the machine-checked proof. It packages the smoothness of cosh in the exact form the uniqueness theorem expects, making the library's chain from the five cost conditions to J(x) fully explicit. The page should use it, not as a headline, but as the quiet hinge that lets the analytic proof close. The reader who wants to see why the cost function must be exactly J(x), and not some other smooth solution of the same equation, will find the answer in this bridge.
THEOREM cosh_dAlembert_smooth · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh satisfies the d'Alembert smoothness hypothesis. -/
theorem cosh_dAlembert_smooth : dAlembert_continuous_implies_smooth_hypothesis Real.cosh := by
intro _ _ _
exact Real.contDiff_cosh
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The diff-square lemma
The cost uniqueness proof in Recognition Science reaches its conclusion through a chain of lemmas. One of the most load-bearing is the diff-square lemma, which takes the cosine addition formula and extracts from it a purely algebraic identity. If H(t+u) + H(t-u) = 2 H(t) H(u) holds for all real t and u, then the lemma states that (H(t+u) - H(t-u))² = 4 ((H t)² - 1) ((H u)² - 1). This is not a differential statement; it is a consequence of the functional equation alone, and it is proved in the machine-checked library as dAlembert_diff_square.
The lemma matters because it is the step that converts the functional equation into a differential equation. From the diff-square identity, the proof derives a second-order ODE, H'' = H, which then selects the unique smooth solution: the hyperbolic cosine. The chain from the five cost conditions to the functional equation to the ODE to the final formula J(x) = (x + 1/x)/2 - 1 depends on this bridge. If the lemma were false, the proof could not pass from the algebraic world of the functional equation to the analytic world of the ODE, and the uniqueness theorem would lose its force.
In the framework's library, the diff-square lemma is not an isolated curiosity. It feeds directly into the theorem dAlembert_cosh_solution, which states that a continuous solution of the cosine addition formula with H(0) = 1 and second derivative 1 at 0 must be cosh. That theorem in turn supports the main cost uniqueness result, law_of_logic_forces_jcost. Dropping the lemma would sever this chain, leaving the cost uniqueness theorem without its analytic core.
What would break is not just a single proof step but the entire route from the five plain conditions to the forced cost formula. The diff-square lemma is the algebraic hinge that makes the analytic argument possible. Without it, the framework would still have the functional equation, but no bridge to the differential equation that pins down the unique solution. The uniqueness story would remain open, and the cost formula would lose its proved status.
THEOREM dAlembert_diff_square · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_diff_square
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) :
∀ t u,
(H (t+u) - H (t-u))^2 = 4 * ((H t)^2 - 1) * ((H u)^2 - 1) := by
intro t u
have h_sum : H (t+u) + H (t-u) = 2 * H t * H u := h_dAlembert t u
have h_prod : H (t+u) * H (t-u) = (H t)^2 + (H u)^2 - 1 :=
dAlembert_product H h_one h_dAlembert t u
calc
(H (t+u) - H (t-u))^2
= (H (t+u) + H (t-u))^2 - 4 * (H (t+u) * H (t-u)) := by ring
_ = (2 * H t * H u)^2 - 4 * ((H t)^2 + (H u)^2 - 1) := by
simp [h_sum, h_prod]
_ = 4 * ((H t)^2 - 1) * ((H u)^2 - 1) := by ring
THEOREM dAlembert_to_ODE_hypothesis · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **d'Alembert to ODE derivation.**
If H satisfies the d'Alembert equation and is smooth, then H'' = H.
Proof sketch: Differentiate H(t+u) + H(t-u) = 2H(t)H(u) twice with respect to u,
then set u = 0 to get H''(t) = H''(0) · H(t). With calibration H''(0) = 1, this
gives H''(t) = H(t). -/
def dAlembert_to_ODE_hypothesis (H : ℝ → ℝ) : Prop :=
H 0 = 1 → Continuous H → (∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) →
deriv (deriv H) 0 = 1 → ∀ t, deriv (deriv H) t = H t
THEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_deriv_zero : deriv H 0 = 0 := by
have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert
have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt
exact even_deriv_at_zero H h_even h_diff
exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hyp
The doubling lemma
The cosine addition formula, studied by Jean le Rond d'Alembert in 1747, asks for functions H satisfying H(t+u) + H(t-u) = 2 H(t) H(u) for all real t and u. Its continuous solutions are exactly the hyperbolic cosine functions H(t) = cosh(kt) for a constant k. A simple consequence, the doubling identity H(2t) = 2 H(t)^2 - 1, follows by setting u = t in the addition formula. This identity is proved as the lemma dAlembert_double in the framework's machine-checked library of formal theorems.
The cost uniqueness page proves that any cost function obeying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof transforms the problem into log coordinates, where the composition law becomes the cosine addition formula, and then reaches a differential equation H'' = H. The unique smooth solution with the right initial conditions is cosh, and translating back gives J. The page's main theorem, law_of_logic_forces_jcost, relies on this analytic route through the differential equation, not on the doubling identity.
What would dAlembert_double contribute? It offers a purely algebraic check on the solution. Once a candidate H is known to satisfy the cosine addition formula, the doubling identity gives a necessary condition: H(2t) must equal 2 H(t)^2 - 1. For the actual solution H(t) = cosh(t), this is the familiar double-angle formula cosh(2t) = 2 cosh(t)^2 - 1, a fact the library also records. The identity could serve as a sanity check or as a step in an alternative, more algebraic proof that avoids calculus.
In Recognition Science, the framework models recognition as a forced cost, and the uniqueness theorem is its central result. The doubling lemma is a supporting algebraic fact, not a load-bearing part of the main proof. It belongs on the page as a classical property of the cosine addition formula, useful for verification and for understanding the structure of the solution, but it does not replace the analytic step that selects the unique smooth solution. The page should keep it as a lemma in the background, not as a headline.
THEOREM dAlembert_double · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_double
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (t : ℝ) :
H (2 * t) = 2 * (H t)^2 - 1 := by
have h := h_dAlembert t t
have h' : H (t + t) = 2 * (H t)^2 - 1 := by
-- H(2t) + H(0) = 2 H(t)^2
have h0 : H (t + t) + 1 = 2 * H t * H t := by
simpa [h_one] using h
have h1 : H (t + t) = 2 * H t * H t - 1 := by
linarith
simpa [pow_two, mul_assoc] using h1
simpa [two_mul] using h'
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM Jcost_G_eq_cosh_sub_one · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_G_eq_cosh_sub_one (t : ℝ) : G Cost.Jcost t = Real.cosh t - 1 := by
simp only [G, Jcost]
-- Jcost(exp t) = (exp t + exp(-t))/2 - 1 = cosh t - 1
have h1 : (Real.exp t)⁻¹ = Real.exp (-t) := by simp [Real.exp_neg]
rw [h1, Real.cosh_eq]
The hidden cosine
The hyperbolic cosine, written cosh(t), is the average of the exponential function and its reciprocal: cosh(t) = (e^t + e^-t)/2. It is the even counterpart to the hyperbolic sine, and it describes the shape of a hanging chain or cable under its own weight, the catenary. Like the ordinary cosine, it satisfies a second-order differential equation, but the equation alone does not select it uniquely. In 1747, Jean le Rond d'Alembert studied a functional equation whose continuous solutions are exactly the hyperbolic cosine functions H(t) = cosh(kt) for a constant k. The equation is famous because it characterizes the cosine and its hyperbolic cousin without any mention of calculus.
The cost uniqueness page reaches this equation after a logarithmic change of variables. The cost function J(x) = (x + 1/x)/2 - 1, which the framework's theorem proves is the only possible cost, is defined for positive x. If one writes x = e^t, the cost becomes J(e^t) = (e^t + e^-t)/2 - 1 = cosh(t) - 1. This is the content of the theorem Jcost_G_eq_cosh_sub_one: after the logarithmic reparametrization, the cost function is exactly the hyperbolic cosine shifted down by one. The statement is a small lemma in the machine-checked library of formal theorems, but it is the hinge of the uniqueness proof.
In Recognition Science, the framework models recognition as a ledger, a discrete record of events where the cost of each recognition is forced, not chosen. The five plain conditions on the cost function lead to a functional equation in log coordinates. That equation is d'Alembert's: H(t+u) + H(t-u) = 2 H(t) H(u). The theorem Jcost_G_eq_cosh_sub_one shows that the cost function, after the change of variables, satisfies this equation with the specific solution cosh(t) - 1. The framework's library proves that any cost function satisfying the five conditions must equal J(x), and the path goes through this hidden cosine.
Why does this matter for the page? The cost uniqueness theorem is a structural result: it says that a few plain conditions force a single formula. The appearance of cosh is not an accident of the proof. It is the reason the proof works. The functional equation has many solutions if one allows pathological functions, but the continuity condition selects the smooth family. The hyperbolic cosine is the unique smooth solution with the right initial conditions, and the cost function is that solution shifted down by one. The theorem Jcost_G_eq_cosh_sub_one makes the connection explicit: the cost function is not just some arbitrary formula, it is the hyperbolic cosine in disguise.
The consequence is that the cost uniqueness page can tell a complete story. The reader sees the classical d'Alembert equation, the hyperbolic cosine as its smooth solution, and then the logarithmic change of variables that reveals the cost function as cosh(t) - 1. The framework's contribution is to show that the five conditions on the cost function lead to this equation, and the theorem Jcost_G_eq_cosh_sub_one is the bridge between the abstract cost and the familiar curve. The page gains a concrete picture: the cost function, when plotted in log coordinates, is the shape of a hanging chain, shifted down by one.
THEOREM Jcost_G_eq_cosh_sub_one · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_G_eq_cosh_sub_one (t : ℝ) : G Cost.Jcost t = Real.cosh t - 1 := by
simp only [G, Jcost]
-- Jcost(exp t) = (exp t + exp(-t))/2 - 1 = cosh t - 1
have h1 : (Real.exp t)⁻¹ = Real.exp (-t) := by simp [Real.exp_neg]
rw [h1, Real.cosh_eq]
THEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_deriv_zero : deriv H 0 = 0 := by
have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert
have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt
exact even_deriv_at_zero H h_even h_diff
exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The algebraic keystone
The proof that any cost function obeying five plain conditions must equal J(x) = (x + 1/x)/2 - 1 passes through a differential equation in log coordinates, a hard analytic step that selects the unique smooth solution. But that step alone does not finish the job. After it, the framework must still show that a certain two-argument combiner P(u,v), which records how costs combine when two recognitions are posted together, is forced into one specific polynomial. That forcing is the purely algebraic half of the story, and it is exactly what gate_forces_rcl provides.
In the framework's machine-checked library of formal theorems, gate_forces_rcl is a theorem about a structure called FactorizationAssociativityGate. The structure imposes four plain conditions on a combiner P: symmetry (P u v = P v u), affine response in its second argument (for each u, P u v = αv + β for some α and β), a zero boundary law (P u 0 = 2u), and a unit diagonal normalization (P 1 1 = 6). The theorem proves that any combiner satisfying all four conditions must be the RCL polynomial: P u v = 2uv + 2u + 2v. The proof runs through an intermediate lemma, gate_forces_bilinear_family, which shows the conditions force P into the family c·uv + 2u + 2v, and then the unit diagonal pins down c = 2.
If gate_forces_rcl were false, the algebraic half of the uniqueness story would collapse. The analytic step could still select a smooth solution, but the framework could not conclude that the combiner is the RCL polynomial. Without that conclusion, the chain of theorems that derives the golden ratio, the eight-tick recognition cycle, and three spatial dimensions would lose its algebraic keystone. The framework's own docstring says it plainly: once the affine-response step is known, symmetry and the boundary law together force the entire bilinear family, and the canonical normalization selects the RCL member. Remove gate_forces_rcl, and that selection never happens.
If the theorem were merely dropped from the library rather than false, the story would still break, but in a different way. The framework's forcing chain is a sequence of proved implications; each link depends on the ones before it. A missing link does not contradict anything, but it leaves a gap. The cost uniqueness page would still prove its main theorem through the analytic route, but the algebraic route to the same conclusion would be unavailable. The framework's claim that the cost function is forced, not chosen, would rest on only one of its two supporting pillars.
In Recognition Science, the cost function is not a free parameter; it is a proved consequence of five plain conditions. The analytic step and the algebraic step are two halves of that proof. gate_forces_rcl is the algebraic half. Its truth is what lets the framework say the combiner is not merely constrained but fully determined. Its absence would leave the uniqueness story incomplete, and its falsity would break the chain that leads from cost to the golden ratio and beyond.
THEOREM gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Canonical normalization selects the RCL member of the bilinear family. -/
theorem gate_forces_rcl (P : ℝ → ℝ → ℝ)
(hGate : FactorizationAssociativityGate P) :
∀ u v, P u v = 2 * u * v + 2 * u + 2 * v := by
obtain ⟨c, hc⟩ := gate_forces_bilinear_family P hGate
have hc_two : c = 2 := by
have h11 : P 1 1 = c * 1 * 1 + 2 * 1 + 2 * 1 := by
simpa using hc 1 1
linarith [hGate.unitDiagonal, h11]
intro u v
calc
P u v = c * u * v + 2 * u + 2 * v := hc u v
_ = 2 * u * v + 2 * u + 2 * v := by rw [hc_two]
THEOREM FactorizationAssociativityGate · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Packaged combiner gate used by the factorization/associativity bridge. -/
structure FactorizationAssociativityGate (P : ℝ → ℝ → ℝ) : Prop where
symmetric : ∀ u v, P u v = P v u
rightAffine : ∀ u, ∃ α β, ∀ v, P u v = α * v + β
zeroBoundary : ∀ u, P u 0 = 2 * u
unitDiagonal : P 1 1 = 6
THEOREM gate_forces_bilinear_family · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Once the affine-response step is known, symmetry and the boundary law force
the entire bilinear family. -/
theorem gate_forces_bilinear_family (P : ℝ → ℝ → ℝ)
(hGate : FactorizationAssociativityGate P) :
∃ c : ℝ, ∀ u v, P u v = c * u * v + 2 * u + 2 * v := by
classical
choose α β hAffine using hGate.rightAffine
have hβ : ∀ u, β u = 2 * u := by
intro u
have h0 : P u 0 = α u * 0 + β u := hAffine u 0
rw [hGate.zeroBoundary u] at h0
linarith
let c : ℝ := α 1 - 2
refine ⟨c, ?_⟩
intro u v
have hsym1 : P u 1 = P 1 u := hGate.symmetric u 1
have hαu : α u = c * u + 2 := by
dsimp [c]
have hcalc : α u * 1 + β u = α 1 * u + β 1 := by
calc
α u * 1 + β u = P u 1 := by symm; exact hAffine u 1
_ = P 1 u := hGate.symmetric u 1
_ = α 1 * u + β 1 := hAffine 1 u
rw [hβ u, hβ 1] at hcalc
linarith
calc
P u v = α u * v + β u := hAffine u v
_ = (c * u + 2) * v + 2 * u := by rw [hαu, hβ u]
_ = c * u * v + 2 * u + 2 * v := by ring
The zero boundary law
The cost uniqueness page proves that any cost function obeying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof passes through a differential equation, a hard analytic step that selects the unique smooth solution. The declaration G_zero_of_unit belongs to a different, purely algebraic corner of the framework: it characterizes a two-argument combiner P(u,v) by four structural conditions: symmetry, affine response in its second argument, a zero boundary law, and a composition rule. This lemma is not part of the main proof chain; it is a separate result about a simpler object.
The zero boundary law states that P(u, 0) = 0 for all u. This is a normalization condition: when the second input is zero, the combiner outputs zero. The lemma G_zero_of_unit proves that this law holds for the specific combiner that the framework uses. It is a small, self-contained fact that does not depend on the differential equation or the smoothness package. It could be used to verify that the combiner satisfies a basic sanity check, but it does not contribute to the uniqueness theorem itself.
In Recognition Science, the cost function J(x) = (x + 1/x)/2 - 1 is forced by five conditions: reciprocal symmetry, zero cost at unity, a forced composition law, calibration, and continuity. The proof of this forcing is the main event on the cost uniqueness page. The declaration G_zero_of_unit is a supporting lemma about a different algebraic structure, not a step in that proof. It is a fact that the combiner satisfies a zero boundary condition, but it does not enter the chain of reasoning that leads to J.
The page should not use G_zero_of_unit to prove the main theorem. It is not a premise of the uniqueness result, and adding it would obscure the actual proof structure. The lemma is correct and useful in its own corner, but it belongs on a page about the combiner, not on the cost uniqueness page. The page already has a clear proof path through the differential equation; adding this algebraic lemma would be a distraction, not an improvement.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
MODEL SatisfiesCompositionLaw · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Composition Law (Equation 1.1)**:
F(xy) + F(x/y) = 2·F(x)·F(y) + 2·F(x) + 2·F(y) for all x, y > 0.
This is the Recognition Composition Law (RCL). -/
def SatisfiesCompositionLaw (F : ℝ → ℝ) : Prop :=
∀ x y : ℝ, 0 < x → 0 < y →
F (x * y) + F (x / y) = 2 * F x * F y + 2 * F x + 2 * F y
THEOREM Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_cosh_add_identity : CoshAddIdentity Cost.Jcost := by
intro t u
simp only [G, Jcost]
-- Use exp(t+u) = exp(t)*exp(u) and exp(t-u) = exp(t)/exp(u)
have he1 : Real.exp (t + u) = Real.exp t * Real.exp u := Real.exp_add t u
have he2 : Real.exp (t - u) = Real.exp t / Real.exp u := by
rw [sub_eq_add_neg, Real.exp_add, Real.exp_neg]
ring
have hpos_t : Real.exp t > 0 := Real.exp_pos t
have hpos_u : Real.exp u > 0 := Real.exp_pos u
have hne_t : Real.exp t ≠ 0 := hpos_t.ne'
have hne_u : Real.exp u ≠ 0 := hpos_u.ne'
rw [he1, he2]
field_simp
ring
A missing lemma
The cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof in the machine-checked library of formal theorems reaches this conclusion by a chain of analytic steps: it transforms the problem into log coordinates, derives a differential equation, and then solves that equation. The declaration taylorWithinEval_two_univ is not part of that chain. It is a lemma about Taylor polynomials, and the page can stand without it.
What the lemma does, in the language of the library, is relate the second derivative of a function at a point to the second-order Taylor expansion of that function evaluated nearby. That is a standard fact from calculus, and it is the kind of bridge that a formal proof might use when passing from a differential equation to a statement about the function's values. The cost uniqueness proof, however, does not need that bridge. The chain that the page documents uses the d'Alembert equation, the functional equation H(t+u) + H(t-u) = 2 H(t) H(u), and a regularity bootstrap to reach the same conclusion without invoking Taylor's theorem directly.
In Recognition Science, the framework models recognition events as entries in a ledger, a discrete record of events, and the cost of each recognition is forced by the five conditions. The theorem law_of_logic_forces_jcost proves that any function satisfying those conditions must equal J(x). The proof's route is analytic: it shows the transformed function must satisfy H'' = H, and then uses the uniqueness of the solution to that differential equation with the given initial conditions. The taylorWithinEval_two_univ lemma is a tool that could serve such a proof, but it is not the tool the library chose.
For the page, the question is whether to include the lemma as a curiosity or to leave it out. The page's purpose is to explain the theorem and its proof chain, not to catalog every declaration in the library. Including a lemma that is not used would add noise without adding understanding. The honest treatment is to note that the lemma exists, that it is a standard calculus fact, and that the proof does not use it. That is a complete answer, and it keeps the page focused on the chain that actually forces the cost.
The consequence for the reader is a clearer picture of the proof's architecture. The cost uniqueness theorem does not rest on a general Taylor expansion principle; it rests on the specific structure of the d'Alembert equation and the regularity bootstrap. Knowing what the proof does not use is as informative as knowing what it does use. The lemma stays off the page, and the page is better for it.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The smoothness step
The hyperbolic cosine, written cosh(t), is the average of the exponential function and its reciprocal: cosh(t) = (e^t + e^-t)/2. It is the even counterpart to the hyperbolic sine, and it describes the shape of a hanging chain or cable under its own weight, the catenary. Like the ordinary cosine, it satisfies a second-order differential equation, but the equation alone does not select it uniquely. The function cosh(t) is also infinitely differentiable, meaning all its derivatives exist and are continuous.
In 1747, Jean le Rond d'Alembert studied the functional equation H(t+u) + H(t-u) = 2 H(t) H(u) for all real t and u. Its continuous solutions are exactly the hyperbolic cosine functions H(t) = cosh(kt) for a constant k. The equation is famous because it characterizes the cosine and its hyperbolic cousin without any mention of calculus. The cost uniqueness page reaches this equation after a logarithmic change of variables, where the cost function's composition law becomes this d'Alembert form.
In Recognition Science, the cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof's main route is analytic: it transforms the problem into log coordinates, where the function must satisfy a differential equation whose unique smooth solution is the hyperbolic cosine. Before that calculus begins, however, the proof needs a structural fact about the smoothness of the solution.
The machine-checked library of formal theorems proves a lemma named cosh_dAlembert_smooth. In plain language, it says that the hyperbolic cosine function is smooth enough to justify the passage from d'Alembert's functional equation to the differential equation. Specifically, it confirms that cosh satisfies the hypothesis that continuity, together with the d'Alembert equation, implies infinite differentiability. This is the regularity step that lets the proof move from a purely algebraic equation to the domain of calculus, where the unique solution can be pinned down.
This lemma belongs on the cost uniqueness page because it is the exact bridge between two worlds. The cost function's defining conditions are algebraic, but the proof of uniqueness uses the tools of analysis. The lemma cosh_dAlembert_smooth certifies that the solution function has the required smoothness, making the analytic route legitimate. Without this step, the proof would be stuck in the algebraic formulation, unable to apply the differential equation that ultimately forces the unique form of the cost function.
MODEL cosh_initials · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem cosh_initials : Real.cosh 0 = 1 ∧ deriv (fun x => Real.cosh x) 0 = 0 := by
constructor
· simp [Real.cosh_zero]
· have h := Real.deriv_cosh
simp only [h, Real.sinh_zero]
THEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_deriv_zero : deriv H 0 = 0 := by
have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert
have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt
exact even_deriv_at_zero H h_even h_diff
exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM cosh_dAlembert_smooth · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh satisfies the d'Alembert smoothness hypothesis. -/
theorem cosh_dAlembert_smooth : dAlembert_continuous_implies_smooth_hypothesis Real.cosh := by
intro _ _ _
exact Real.contDiff_cosh
THEOREM cosh_dAlembert_smooth · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh satisfies the d'Alembert smoothness hypothesis. -/
theorem cosh_dAlembert_smooth : dAlembert_continuous_implies_smooth_hypothesis Real.cosh := by
intro _ _ _
exact Real.contDiff_cosh
A missing initial condition
The cost uniqueness theorem states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof in the machine-checked library of formal theorems reaches this conclusion by a chain of analytic steps: it transforms the problem into log coordinates, derives a differential equation, and then solves that equation. The declaration deriv_pos_self_zero is not part of that chain. It contributes nothing to the proof as it stands, and the page should not cite it.
The library's actual route is visible in its theorem statements. The central result, law_of_logic_forces_jcost, takes the five conditions and concludes the cost is J. The route passes through a log-coordinate reparametrization, where the transformed function must satisfy a d'Alembert equation, H(t+u) + H(t-u) = 2 H(t) H(u). A separate theorem, dAlembert_cosh_solution_aczel, shows that a continuous solution of that equation with H(0) = 1 and the second derivative at zero equal to 1 must be the hyperbolic cosine. The uniqueness of the solution to the differential equation H'' = H with initial conditions H(0) = 1 and H'(0) = 0 is proved in ode_cosh_uniqueness_contdiff. The initial condition on the first derivative, not the second, is what selects cosh over the other solution, sinh. The declaration deriv_pos_self_zero, whatever it states, is not among the hypotheses of any of these theorems, and no theorem in the pack is shown to depend on it.
In Recognition Science, the cost is the amount posted when something is recognized, and the framework's library is the machine-checked collection of formal theorems that derives physical structure from the forced nature of that cost. The cost uniqueness proof is a landmark because it shows the cost function is not chosen but forced. But the forcing is achieved through the d'Alembert equation and the ODE uniqueness theorem, not through deriv_pos_self_zero. Adding the declaration to the page would misrepresent the proof's structure. The page should stay as it is, describing the analytic chain that actually closes.
The practical lesson is that a declaration's absence from a proof is not a gap. The proof is complete without it. The page's job is to reflect the proof that exists, not to collect every declaration in the module. A reader who wants to verify the proof can follow the named theorems in the library; deriv_pos_self_zero would only add noise.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **The cost theorem on two premises.** The composition law and unit log
curvature force `F = J` on the positives. Normalization, nonnegativity, and
continuity are all conclusions rather than hypotheses; compare
`law_of_logic_forces_jcost`, which assumes all of them. -/
theorem composition_logCurvature_forces_jcost [AczelSmoothnessPackage]
(F : ℝ → ℝ)
(hComp : SatisfiesCompositionLaw F)
(hκ : HasLogCurvature (H F) 1) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
have hNorm : IsNormalized F := logCurvature_forces_normalized F hComp hκ
have hN : F 1 = 0 := hNorm
have hH0 : H F 0 = 1 := by simp [H, G, hN]
have hCosh : CoshAddIdentity F := (composition_law_equiv_coshAdd F).mp hComp
have hdA : ∀ t u, H F (t + u) + H F (t - u) = 2 * H F t * H F u := by
intro t u
have hG := hCosh t u
have hgoal :
(G F (t + u) + 1) + (G F (t - u) + 1) =
2 * (G F t + 1) * (G F u + 1) := by
calc
(G F (t + u) + 1) + (G F (t - u) + 1)
= (G F (t + u) + G F (t - u)) + 2 := by ring
_ = (2 * (G F t * G F u) + 2 * (G F t + G F u)) + 2 := by simpa [hG]
_ = 2 * (G F t + 1) * (G F u + 1) := by ring
simpa [H] using hgoal
have hcont : Continuous (H F) :=
dAlembert_continuous_of_log_curvature (H F) hH0 hdA hκ
have hsm : ContDiff ℝ ⊤ (H F) := aczel_dAlembert_smooth (H F) hH0 hcont hdA
have heven : Function.Even (H F) := dAlembert_even (H F) hH0 hdA
have hd0 : deriv (H F) 0 = 0 :=
even_deriv_at_zero (H F) heven
(hsm.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) 0)
have hd2 : deriv (deriv (H F)) 0 = 1 :=
deriv2_of_logCurvature (H F) hsm hH0 hd0 hκ
have hcosh : ∀ t, H F t = Real.cosh t :=
dAlembert_cosh_solution_aczel (H F) hH0 hcont hdA hd2
intro x hx
have hGc : G F (Real.log x) = Real.cosh (Real.log x) - 1 := by
have h := hcosh (Real.log x)
simp only [H] at h
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc
F x = F (Real.exp (Real.log x)) := by rw [ht]
_ = G F (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := hGc
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM dAlembert_cosh_solution_aczel · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (d'Alembert → cosh, Aczél form)**: Using only the Aczél axiom, a continuous
solution to d'Alembert with H(0) = 1 and H''(0) = 1 must equal cosh.
This is the clean version of `dAlembert_cosh_solution`, requiring no regularity params. -/
theorem dAlembert_cosh_solution_aczel
[AczelSmoothnessPackage]
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_d2_zero : deriv (deriv H) 0 = 1) :
∀ t, H t = Real.cosh t := by
have h_smooth : ContDiff ℝ ⊤ H := aczel_dAlembert_smooth H h_one h_cont h_dAlembert
have hDiff : Differentiable ℝ H :=
(h_smooth.of_le le_top : ContDiff ℝ 1 H).differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_H'0 : deriv H 0 = 0 := even_deriv_at_zero H h_even hDiff.differentiableAt
have h_ode : ∀ t, deriv (deriv H) t = H t :=
dAlembert_to_ODE_theorem H h_smooth h_dAlembert h_d2_zero
have h_C2 : ContDiff ℝ 2 H := h_smooth.of_le le_top
exact ode_cosh_uniqueness_contdiff H h_C2 h_ode h_one h_H'0
THEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/
theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ)
(h_diff : ContDiff ℝ 2 H)
(h_ode : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0) :
∀ t, H t = Real.cosh t := by
let g := fun t => H t - Real.cosh t
have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh
have hg_ode : ∀ t, deriv (deriv g) t = g t := by
intro t
have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by
ext s; apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by
have hH_diff1 : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff
rw [contDiff_succ_iff_deriv] at h_diff
exact h_diff.2.2
have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by
rw [Real.deriv_cosh]; exact Real.contDiff_sinh
rw [h1]; apply deriv_sub
· exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
· exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
rw [h2, h_ode t, cosh_second_deriv_eq t]
have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero]
have hg'0 : deriv g 0 = 0 := by
have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by
apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring
have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0
intro t
have := hg_zero t
simp only [g] at this; linarith
The evenness lemma
The cost uniqueness theorem states that any cost function obeying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof's main route is analytic: it transforms the problem into log coordinates, where the function must satisfy a differential equation whose unique smooth solution is the hyperbolic cosine. Before that calculus begins, however, the proof needs a structural fact about the transformed function: it must be even, meaning it takes the same value at t and at -t.
That fact is exactly what the declaration G_even_of_reciprocal_symmetry provides. In the framework's library, the log-coordinate transform sends a cost function F to G F t = F (exp t). The reciprocal symmetry condition, which says F(x) = F(1/x) for every positive x, becomes the statement that G F is even: G F t = G F (-t). The lemma proves this implication directly, without any calculus. It is a small algebraic bridge between two of the five conditions.
Why does this matter for the page? The differential equation route needs initial conditions to pin down the unique solution. One of those conditions is that the derivative of G F at zero is zero, which follows immediately from evenness. Without the lemma, the proof would either have to re-derive this symmetry inside the analytic argument or state it as an extra hypothesis. The lemma preserves the five conditions as sufficient: it shows that the reciprocal symmetry alone already supplies the needed initial condition.
The declaration is therefore not a competing proof of the main theorem. It is a supporting lemma that the analytic proof relies on at its starting point. Including it on the page makes the dependency explicit and lets a reader see exactly where the reciprocal condition enters the argument. Removing it would leave the proof's initial conditions unexplained.
THEOREM reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Lemma 2.1**: If F is reciprocal, then G(t) = F(e^t) is even. -/
theorem reciprocal_implies_G_even (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) :
Function.Even (G F) :=
G_even_of_reciprocal_symmetry F (fun {x} hx => hRecip x hx)
THEOREM reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Lemma 2.1**: If F is reciprocal, then G(t) = F(e^t) is even. -/
theorem reciprocal_implies_G_even (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) :
Function.Even (G F) :=
G_even_of_reciprocal_symmetry F (fun {x} hx => hRecip x hx)
THEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ)
(h_ODE : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := h_cont_hyp h_ODE
have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont
have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff
exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0
A product identity in the proof
In 1747, Jean le Rond d'Alembert studied the functional equation H(t+u) + H(t-u) = 2 H(t) H(u) for all real t and u. Its continuous solutions are exactly the hyperbolic cosine functions H(t) = cosh(kt) for a constant k. The equation is famous because it characterizes the cosine and its hyperbolic cousin without any mention of calculus. The cost uniqueness page reaches this equation after a logarithmic change of variables: the composition law on positive reals becomes d'Alembert's addition formula on the real line.
From the addition formula alone, one can derive a companion identity: H(t+u) H(t-u) = H(t)^2 + H(u)^2 - 1. This is the product version of the addition law. It is not a new assumption; it is a consequence of the same equation, and it holds for every solution, continuous or not. The declaration dAlembert_product in the framework's library of formal theorems proves exactly this identity. It is a lemma, not a theorem about the cost function itself.
The page's main proof does not currently use this product identity. Its route goes through a differential equation: after the logarithmic change, the transformed function must satisfy H'' = H, and the unique solution with the right initial conditions is H(t) = cosh(t). The product identity is available as an alternative tool. It could help derive the differential equation from the functional equation, or it could support a purely algebraic path that avoids calculus altogether. The analytic route already works, so the product identity is not needed for the proof to close.
In Recognition Science, the framework's library proves the cost uniqueness theorem through the analytic route. The product identity remains a derived consequence of the same structural condition. It is not a separate discovery; it is a rearrangement of the same information. A reader who wants to see the full algebraic setting around d'Alembert's equation will find the product identity useful. A reader who only wants the cost theorem can skip it without loss.
The product identity earns its place on the page as a supporting lemma, not as a new proof strategy. It shows that the addition formula carries more structure than the page currently exploits. If the page later adds a section on alternative derivations, the product identity belongs there. For the main proof, it stays in the background, a proved consequence waiting for a use that the current argument does not require.
THEOREM dAlembert_product · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_product
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) :
∀ t u, H (t+u) * H (t-u) = (H t)^2 + (H u)^2 - 1 := by
intro t u
have h := h_dAlembert (t + u) (t - u)
have h' : H (2 * t) + H (2 * u) = 2 * H (t + u) * H (t - u) := by
-- (t+u)+(t-u)=2t and (t+u)-(t-u)=2u
simpa [two_mul, sub_eq_add_neg, add_assoc, add_left_comm, add_comm] using h
have h2t : H (2 * t) = 2 * (H t)^2 - 1 := dAlembert_double H h_one h_dAlembert t
have h2u : H (2 * u) = 2 * (H u)^2 - 1 := dAlembert_double H h_one h_dAlembert u
have h'' : 2 * H (t + u) * H (t - u) = (2 * (H t)^2 - 1) + (2 * (H u)^2 - 1) := by
calc
2 * H (t + u) * H (t - u) = H (2 * t) + H (2 * u) := by linarith [h']
_ = (2 * (H t)^2 - 1) + (2 * (H u)^2 - 1) := by simp [h2t, h2u]
linarith
THEOREM dAlembert_product · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_product
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) :
∀ t u, H (t+u) * H (t-u) = (H t)^2 + (H u)^2 - 1 := by
intro t u
have h := h_dAlembert (t + u) (t - u)
have h' : H (2 * t) + H (2 * u) = 2 * H (t + u) * H (t - u) := by
-- (t+u)+(t-u)=2t and (t+u)-(t-u)=2u
simpa [two_mul, sub_eq_add_neg, add_assoc, add_left_comm, add_comm] using h
have h2t : H (2 * t) = 2 * (H t)^2 - 1 := dAlembert_double H h_one h_dAlembert t
have h2u : H (2 * u) = 2 * (H u)^2 - 1 := dAlembert_double H h_one h_dAlembert u
have h'' : 2 * H (t + u) * H (t - u) = (2 * (H t)^2 - 1) + (2 * (H u)^2 - 1) := by
calc
2 * H (t + u) * H (t - u) = H (2 * t) + H (2 * u) := by linarith [h']
_ = (2 * (H t)^2 - 1) + (2 * (H u)^2 - 1) := by simp [h2t, h2u]
linarith
The calibration condition
The cost uniqueness theorem in the framework's machine-checked library of formal theorems starts from five plain conditions on a function F that measures the cost of recognition, a discrete record of events. Four of them are structural: F is symmetric under swapping x and 1/x, F(1) = 0, F obeys a composition law, and F is continuous on positive inputs. Alone, those four admit a whole family of solutions. The fifth condition, calibration, is what selects a single member of that family.
Calibration is a statement about the function's behavior near the point x = 1, where the cost is zero. In log coordinates, writing H(t) = F(e^t), the condition says that the limit of 2(H(t) - 1)/t² as t approaches 0 exists and equals a specific number. That number is the log-curvature, a measure of how sharply the function bends away from its value at t = 0 after rescaling the horizontal axis logarithmically. The theorem law_of_logic_forces_jcost takes calibration as one of its hypotheses and concludes that F must equal J(x) = (x + 1/x)/2 - 1 everywhere on positive inputs.
Without calibration, the composition law and continuity leave a free parameter. The proof route passes through the d'Alembert equation H(t+u) + H(t-u) = 2 H(t) H(u), whose continuous solutions are exactly H(t) = cosh(kt) for a constant k. Each k gives a different cost function, all satisfying the structural conditions. Calibration forces k = 1, and with it the unique J. The declaration IsCalibrated is therefore not a decorative extra; it is the hypothesis that makes the conclusion a uniqueness statement rather than a classification of a family.
The page should use it. The current proof on the page reaches the differential equation H'' = H through an analytic route, but that route still needs an initial condition to pick cosh over its scaled cousins. Calibration supplies that condition cleanly. It also connects to a separate lemma, hasLogCurvature_full_filter_forces_zero, which shows that if the log-curvature limit exists at all, it must be 0; the calibrated value is the second derivative at 0, and the theorem logCurvature_eq_deriv2 identifies the two for smooth functions. Adding IsCalibrated to the page makes the five-condition story complete and matches the statement of the main theorem exactly.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_deriv_zero : deriv H 0 = 0 := by
have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert
have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt
exact even_deriv_at_zero H h_even h_diff
exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **The cost theorem on two premises.** The composition law and unit log
curvature force `F = J` on the positives. Normalization, nonnegativity, and
continuity are all conclusions rather than hypotheses; compare
`law_of_logic_forces_jcost`, which assumes all of them. -/
theorem composition_logCurvature_forces_jcost [AczelSmoothnessPackage]
(F : ℝ → ℝ)
(hComp : SatisfiesCompositionLaw F)
(hκ : HasLogCurvature (H F) 1) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
have hNorm : IsNormalized F := logCurvature_forces_normalized F hComp hκ
have hN : F 1 = 0 := hNorm
have hH0 : H F 0 = 1 := by simp [H, G, hN]
have hCosh : CoshAddIdentity F := (composition_law_equiv_coshAdd F).mp hComp
have hdA : ∀ t u, H F (t + u) + H F (t - u) = 2 * H F t * H F u := by
intro t u
have hG := hCosh t u
have hgoal :
(G F (t + u) + 1) + (G F (t - u) + 1) =
2 * (G F t + 1) * (G F u + 1) := by
calc
(G F (t + u) + 1) + (G F (t - u) + 1)
= (G F (t + u) + G F (t - u)) + 2 := by ring
_ = (2 * (G F t * G F u) + 2 * (G F t + G F u)) + 2 := by simpa [hG]
_ = 2 * (G F t + 1) * (G F u + 1) := by ring
simpa [H] using hgoal
have hcont : Continuous (H F) :=
dAlembert_continuous_of_log_curvature (H F) hH0 hdA hκ
have hsm : ContDiff ℝ ⊤ (H F) := aczel_dAlembert_smooth (H F) hH0 hcont hdA
have heven : Function.Even (H F) := dAlembert_even (H F) hH0 hdA
have hd0 : deriv (H F) 0 = 0 :=
even_deriv_at_zero (H F) heven
(hsm.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) 0)
have hd2 : deriv (deriv (H F)) 0 = 1 :=
deriv2_of_logCurvature (H F) hsm hH0 hd0 hκ
have hcosh : ∀ t, H F t = Real.cosh t :=
dAlembert_cosh_solution_aczel (H F) hH0 hcont hdA hd2
intro x hx
have hGc : G F (Real.log x) = Real.cosh (Real.log x) - 1 := by
have h := hcosh (Real.log x)
simp only [H] at h
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc
F x = F (Real.exp (Real.log x)) := by rw [ht]
_ = G F (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := hGc
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM hasLogCurvature_full_filter_forces_zero · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Tripwire.** The full-filter reading of log curvature forces `κ = 0`, so at
the calibrated value `κ = 1` it is satisfied by no function at all. Kept as a
theorem so the defect cannot be reintroduced without a failing build. -/
theorem hasLogCurvature_full_filter_forces_zero (Hf : ℝ → ℝ) (κ : ℝ)
(h : Filter.Tendsto (fun t => 2 * (Hf t - 1) / t^2) (nhds 0) (nhds κ)) :
κ = 0 := by
have h1 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2)
(pure 0) (nhds κ) := h.mono_left (pure_le_nhds 0)
have h2 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2)
(pure 0) (nhds (2 * (Hf 0 - 1) / (0 : ℝ) ^ 2)) := tendsto_pure_nhds _ _
have h3 := tendsto_nhds_unique h2 h1
simpa using h3.symm
The initial conditions
The hyperbolic cosine, written cosh(t), is the average of the exponential function and its reciprocal: cosh(t) = (e^t + e^-t)/2. It is the even counterpart to the hyperbolic sine, and it describes the shape of a hanging chain or cable under its own weight, the catenary. Like the ordinary cosine, it satisfies a second-order differential equation, but the equation alone does not select it uniquely. The equation H'' = H has many solutions, for example H(t) = 2e^t - e^-t. What picks out cosh specifically is a pair of initial conditions: its value at zero is 1, and its slope at zero is 0. The theorem cosh_initials states exactly these two facts: cosh(0) = 1 and the derivative of cosh at 0 is 0. These are the standard starting values that, together with the differential equation, force the unique solution H(t) = cosh(t).
In 1747, Jean le Rond d'Alembert studied a functional equation that asks for functions H satisfying H(t+u) + H(t-u) = 2 H(t) H(u) for all real t and u. This is the cosine addition formula, and its continuous solutions are exactly the hyperbolic cosine functions H(t) = cosh(kt) for a constant k. The equation is famous because it characterizes the cosine and its hyperbolic cousin without any mention of calculus. On the cost uniqueness page, the proof of the main theorem passes through this d'Alembert equation in log coordinates. The transformed function G(t) = F(e^t) satisfies a shifted version of the d'Alembert identity, and the proof then needs to know which solution is the right one.
The initial conditions from cosh_initials are the missing anchor. The d'Alembert equation alone leaves a free parameter k, the scaling of the horizontal axis. The cost uniqueness proof supplies a calibration condition, the log-curvature at zero, which sets that parameter to 1. Once the parameter is fixed, the initial conditions cosh(0) = 1 and cosh'(0) = 0 are exactly what the uniqueness theorem for the differential equation requires. The theorem dAlembert_cosh_solution uses precisely these two values along with the d'Alembert equation to conclude H(t) = cosh(t) for all t. So cosh_initials is not a separate curiosity; it is the final piece that closes the proof from the functional equation to the unique cost function J(x) = (x + 1/x)/2 - 1.
In Recognition Science, the framework models recognition as a discrete record of events with a forced cost. The cost uniqueness page proves that any cost function obeying five plain conditions must equal that J. The route passes through the d'Alembert equation and the differential equation H'' = H. The initial conditions cosh(0) = 1 and cosh'(0) = 0 are what make the solution unique. Without them, the differential equation admits a family of solutions, and the cost function would not be forced. With them, the proof closes: the cost is unique, and the framework's central claim stands on a fully specified mathematical foundation.
THEOREM cosh_initials · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem cosh_initials : Real.cosh 0 = 1 ∧ deriv (fun x => Real.cosh x) 0 = 0 := by
constructor
· simp [Real.cosh_zero]
· have h := Real.deriv_cosh
simp only [h, Real.sinh_zero]
THEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_deriv_zero : deriv H 0 = 0 := by
have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert
have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt
exact even_deriv_at_zero H h_even h_diff
exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_deriv_zero : deriv H 0 = 0 := by
have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert
have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt
exact even_deriv_at_zero H h_even h_diff
exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hyp
The d'Alembert bridge
The cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof in the machine-checked library of formal theorems reaches this conclusion by a chain of analytic steps: it transforms the problem into log coordinates, derives a differential equation, and then solves that equation. The declaration dAlembert_cosh_solution is not part of that main route. It contributes a different, older bridge: it shows that a continuous function satisfying the d'Alembert equation H(t+u) + H(t-u) = 2 H(t) H(u), with H(0) = 1 and a second-derivative condition at zero, must be exactly the hyperbolic cosine H(t) = cosh(t).
That equation is the classical heart of the page. In 1747, Jean le Rond d'Alembert studied it while modeling a vibrating string, and it has a famous property: among continuous functions, its solutions are precisely the hyperbolic cosine functions H(t) = cosh(kt) for a constant k, with no calculus needed to state the equation itself. The declaration dAlembert_cosh_solution packages this classical result in the framework's own language, adding the regularity hypotheses that the machine-checked proof requires. It is the bridge that lets the framework move from the structural composition law, which the cost function satisfies by definition, to the differential equation H'' = H whose unique smooth solution is the hyperbolic cosine.
In the framework's library, the declaration dAlembert_cosh_solution_of_log_curvature is the sharper version used in the main proof: it assumes the log-curvature condition directly and derives the d'Alembert equation from it. The plainer dAlembert_cosh_solution, by contrast, takes the d'Alembert equation as its starting point and adds the regularity hypotheses as explicit assumptions rather than bundling them into a package. That makes it a reusable lemma: it states the classical bridge in a form that does not depend on the framework's specific cost axioms, so it can serve any future proof that reaches the d'Alembert equation from a different route.
The page should include it, but as a supporting lemma, not as a headline. Its value is historical and architectural: it names the 1747 equation that the framework's proof rediscovers, and it shows the bridge in its cleanest form before the framework-specific machinery of log curvature and composition laws is added. A reader who meets the d'Alembert equation here first will recognize it later when the cost proof reaches the same shape, and the page gains a classical anchor that the analytic route alone does not provide. The declaration earns its place by making the framework's debt to d'Alembert explicit, without pretending to be the main engine of the proof.
THEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_deriv_zero : deriv H 0 = 0 := by
have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert
have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt
exact even_deriv_at_zero H h_even h_diff
exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
MEASURED dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_deriv_zero : deriv H 0 = 0 := by
have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert
have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt
exact even_deriv_at_zero H h_even h_diff
exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hyp
The smoothness bridge
In the classical theory of functional equations, a function H that satisfies the d'Alembert equation, H(t+u) + H(t-u) = 2 H(t) H(u), is already highly constrained. The equation is named after Jean le Rond d'Alembert, who studied it in the 1740s while working on the vibrating string problem. Its continuous solutions are exactly the hyperbolic cosine, cosh(t) = (e^t + e^-t)/2, and the ordinary cosine, cos(t), along with their hyperbolic and trigonometric variants. A famous theorem, often attributed to d'Alembert and later sharpened by János Aczél, states that if such a function is continuous at a single point, then it is in fact smooth everywhere, and it must satisfy a second-order differential equation: its second derivative equals a constant times the function itself.
The theorem named dAlembert_continuous_of_log_curvature is the machine-checked version of a key step in that classical story. It states that if H satisfies the d'Alembert equation, has H(0) = 1, and has a finite log-curvature at zero, meaning the limit of 2(H(t) - 1)/t² as t approaches 0 exists, then H is continuous everywhere. The log-curvature condition is a precise way of saying the function bends like a parabola near the origin, with a specific curvature constant κ. This single hypothesis, that the bend at zero is finite, is enough to rule out the discontinuous and pathological solutions that otherwise plague the d'Alembert equation. Without it, one can construct wild functions that satisfy the equation almost nowhere in a usable sense; with it, the function is forced to be continuous, and from continuity the classical theory takes over.
On the cost uniqueness page, this theorem is the bridge that connects the abstract composition law to the concrete differential equation. The cost function F, which records the amount posted when something is recognized, satisfies a composition law that, after a logarithmic change of coordinates, becomes exactly the d'Alembert equation for the associated function H. The log-curvature condition is the fifth of the five plain conditions in the cost uniqueness theorem. The theorem dAlembert_continuous_of_log_curvature shows that this condition is not just a technical convenience; it is the regularity assumption that makes the entire analytic machinery work. It guarantees that H is continuous, which then allows the proof to invoke the classical result that a continuous d'Alembert solution is smooth and satisfies the differential equation H'' = κ H.
Once the differential equation is in hand, the uniqueness proof is short. The equation H'' = κ H, together with the initial conditions H(0) = 1 and H'(0) = 0, has a unique solution for each κ. The log-curvature condition pins κ to be 1, and the unique solution is the hyperbolic cosine. The cost function J(x) = (x + 1/x)/2 - 1 then follows by undoing the logarithmic change of coordinates. The theorem dAlembert_continuous_of_log_curvature is therefore not a side lemma; it is the load-bearing step that turns a purely algebraic constraint into a solvable calculus problem. It is what makes the five conditions sufficient to force the unique cost function, and it is why the page can state the result as a theorem rather than as a conjecture.
THEOREM dAlembert_continuous_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_continuous_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ) :
Continuous H := by
refine continuous_iff_continuousAt.2 ?_
intro t
have h_lim_H : Filter.Tendsto H (nhds 0) (nhds 1) :=
tendsto_H_one_of_log_curvature H h_one h_calib
have h_sum :
Filter.Tendsto (fun u => H (t+u) + H (t-u)) (nhds 0) (nhds (2 * H t)) := by
have h_prod : Filter.Tendsto (fun u => (2 * H t) * H u) (nhds 0)
(nhds ((2 * H t) * (1 : ℝ))) := (tendsto_const_nhds.mul h_lim_H)
have h_prod' : Filter.Tendsto (fun u => 2 * H t * H u) (nhds 0) (nhds (2 * H t)) := by
simpa [mul_assoc] using h_prod
have h_eq : (fun u => H (t+u) + H (t-u)) = fun u => 2 * H t * H u := by
funext u
exact h_dAlembert t u
simpa [h_eq] using h_prod'
have h_diff_sq :
Filter.Tendsto (fun u => (H (t+u) - H (t-u))^2) (nhds 0) (nhds (0 : ℝ)) := by
have h_u_sq : Filter.Tendsto (fun u => (H u)^2) (nhds 0) (nhds ((1 : ℝ)^2)) := by
simpa [pow_two] using h_lim_H.mul h_lim_H
have h_u_sq_sub : Filter.Tendsto (fun u => (H u)^2 - 1) (nhds 0) (nhds (0 : ℝ)) := by
have h_const : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhds 0) (nhds (1 : ℝ)) :=
tendsto_const_nhds
simpa using h_u_sq.sub h_const
have h_const :
Filter.Tendsto (fun _ : ℝ => 4 * ((H t)^2 - 1)) (nhds 0)
(nhds (4 * ((H t)^2 - 1))) := tendsto_const_nhds
have h_mul :
Filter.Tendsto (fun u => (4 * ((H t)^2 - 1)) * ((H u)^2 - 1)) (nhds 0)
(nhds (4 * ((H t)^2 - 1) * (0 : ℝ))) := h_const.mul h_u_sq_sub
have h_eq :
(fun u => (H (t+u) - H (t-u))^2) =
(fun u => 4 * ((H t)^2 - 1) * ((H u)^2 - 1)) := by
funext u
exact dAlembert_diff_square H h_one h_dAlembert t u
simpa [h_eq] using h_mul
have h_abs :
Filter.Tendsto (fun u => |H (t+u) - H (t-u)|) (nhds 0) (nhds (0 : ℝ)) := by
have h_sqrt :
Filter.Tendsto (fun u => Real.sqrt ((H (t+u) - H (t-u))^2)) (nhds 0)
(nhds (Real.sqrt 0)) :=
(Real.continuous_sqrt.tendsto 0).comp h_diff_sq
simpa [Real.sqrt_sq_eq_abs] using h_sqrt
have h_diff :
Filter.Tendsto (fun u => H (t+u) - H (t-u)) (nhds 0) (nhds (0 : ℝ)) :=
(tendsto_zero_iff_abs_tendsto_zero (f := fun u => H (t+u) - H (t-u))).2 h_abs
have h_sum_diff :
Filter.Tendsto
(fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u)))
(nhds 0) (nhds ((2 * H t) + (0 : ℝ))) := h_sum.add h_diff
have h_twice : Filter.Tendsto (fun u => 2 * H (t+u)) (nhds 0) (nhds (2 * H t)) := by
have h_sum_diff' :
Filter.Tendsto
(fun u => H (t+u) + H (t+u))
(nhds 0) (nhds (2 * H t)) := by
have h_eq :
(fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) =
(fun u => H (t+u) + H (t+u)) := by
funext u
ring
have h_sum_diff'' :
Filter.Tendsto
(fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u)))
(nhds 0) (nhds (2 * H t)) := by
simpa using h_sum_diff
simpa [h_eq] using h_sum_diff''
simpa [two_mul] using h_sum_diff'
have h_half :
Filter.Tendsto (fun u => (2 * H (t+u)) / 2) (nhds 0) (nhds ((2 * H t) / 2)) := by
have h_const : Filter.Tendsto (fun _ : ℝ => (1 / 2 : ℝ)) (nhds 0) (nhds (1 / 2 : ℝ)) :=
tendsto_const_nhds
simpa [div_eq_mul_inv] using h_twice.mul h_const
have h_at0 : Filter.Tendsto (fun u => H (t+u)) (nhds 0) (nhds (H t)) := by
simpa using h_half
have h_map :
Filter.Tendsto H (Filter.map (fun u => t + u) (nhds 0)) (nhds (H t)) :=
(Filter.tendsto_map'_iff).2 h_at0
have h_tendsto : Filter.Tendsto H (nhds t) (nhds (H t)) := by
simpa [map_add_left_nhds_zero] using h_map
exact h_tendsto
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Derivation, universal coefficient)**: If H is C∞ and
satisfies d'Alembert, then `H''(t) = H''(0) * H(t)` everywhere.
This is the unnormalized form of `dAlembert_to_ODE_theorem`. -/
theorem dAlembert_to_ODE_general_theorem (H : ℝ → ℝ)
(h_smooth : ContDiff ℝ ⊤ H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) :
∀ t, deriv (deriv H) t = deriv (deriv H) 0 * H t := by
have hCDiff2 : ContDiff ℝ 2 H := h_smooth.of_le le_top
have hDiff : Differentiable ℝ H :=
hCDiff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have hCDiff1_H' : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at hCDiff2
rw [contDiff_succ_iff_deriv] at hCDiff2
exact hCDiff2.2.2
have hDiffDeriv : Differentiable ℝ (deriv H) :=
hCDiff1_H'.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
have hsh_add : ∀ (s v : ℝ), HasDerivAt (fun u => s + u) (1 : ℝ) v := fun s v => by
have h := (hasDerivAt_id v).add_const s; simp only [id] at h
rwa [show (fun u : ℝ => u + s) = fun u => s + u from funext fun u => add_comm u s] at h
have hsh_sub : ∀ (s v : ℝ), HasDerivAt (fun u => s - u) (-1 : ℝ) v := fun s v => by
have h1 : HasDerivAt (fun u : ℝ => -u) (-1 : ℝ) v := by
have := (hasDerivAt_id v).neg; simp only [id] at this; exact this
have h2 := h1.const_add s
rwa [show (fun u : ℝ => s + -u) = fun u => s - u from funext fun u => by ring] at h2
intro t
have h_feq : (fun u => H (t + u) + H (t - u)) = (fun u => 2 * H t * H u) :=
funext (h_dAlembert t)
have key : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 =
deriv (deriv (fun u => 2 * H t * H u)) 0 :=
congr_arg (fun f => deriv (deriv f) 0) h_feq
have lhs_eq : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = 2 * deriv (deriv H) t := by
have h_plus : ∀ v, HasDerivAt (fun u => H (t + u)) (deriv H (t + v)) v := fun v => by
have hH := (hDiff (t + v)).hasDerivAt
have hcomp := hH.comp v (hsh_add t v)
simp only [mul_one, Function.comp_apply] at hcomp; exact hcomp
have h_minus : ∀ v, HasDerivAt (fun u => H (t - u)) (-deriv H (t - v)) v := fun v => by
have hH := (hDiff (t - v)).hasDerivAt
have hcomp := hH.comp v (hsh_sub t v)
simp only [mul_neg, mul_one, Function.comp_apply] at hcomp; exact hcomp
have hfirst_fun : deriv (fun u => H (t + u) + H (t - u)) =
fun v => deriv H (t + v) - deriv H (t - v) := funext fun v => by
have heq : (fun u => H (t + u)) + (fun u => H (t - u)) =
fun u => H (t + u) + H (t - u) := by ext u; rfl
have h12 : deriv (fun u => H (t + u) + H (t - u)) v = deriv H (t + v) + -deriv H (t - v) := by
rw [← heq]; exact ((h_plus v).add (h_minus v)).deriv
linarith [show deriv H (t + v) + -deriv H (t - v) =
deriv H (t + v) - deriv H (t - v) from by ring]
have hd2_plus : HasDerivAt (fun v => deriv H (t + v)) (deriv (deriv H) t) 0 := by
have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t + 0)) (t + 0) :=
(hDiffDeriv (t + 0)).hasDerivAt
have hcomp := hDH.comp 0 (hsh_add t 0)
simp only [mul_one, add_zero, Function.comp_apply] at hcomp; exact hcomp
have hd2_minus : HasDerivAt (fun v => deriv H (t - v)) (-deriv (deriv H) t) 0 := by
have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t - 0)) (t - 0) :=
(hDiffDeriv (t - 0)).hasDerivAt
have hcomp := hDH.comp 0 (hsh_sub t 0)
simp only [mul_neg, mul_one, sub_zero, Function.comp_apply] at hcomp; exact hcomp
rw [congr_fun (congr_arg deriv hfirst_fun) 0]
have heq2 : (fun v => deriv H (t + v)) - (fun v => deriv H (t - v)) =
fun v => deriv H (t + v) - deriv H (t - v) := by ext v; rfl
have h : deriv (fun v => deriv H (t + v) - deriv H (t - v)) 0 =
deriv (deriv H) t - -deriv (deriv H) t := by
rw [← heq2]; exact (hd2_plus.sub hd2_minus).deriv
linarith [show deriv (deriv H) t - -deriv (deriv H) t = 2 * deriv (deriv H) t from by ring]
have rhs_eq : deriv (deriv (fun u => 2 * H t * H u)) 0 =
2 * H t * deriv (deriv H) 0 := by
have hfirst_fun : deriv (fun u => 2 * H t * H u) = fun v => 2 * H t * deriv H v :=
funext fun v => ((hDiff v).hasDerivAt.const_mul (2 * H t)).deriv
have hsecond := (hDiffDeriv 0).hasDerivAt.const_mul (2 * H t)
rw [congr_fun (congr_arg deriv hfirst_fun) 0, hsecond.deriv]
rw [lhs_eq, rhs_eq] at key
linarith
The bridge to calculus
The cost uniqueness page proves that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof's main route is analytic: it transforms the problem into log coordinates, where a function H must satisfy a differential equation whose unique smooth solution is the hyperbolic cosine. Before that calculus begins, however, the proof needs a structural fact about the equation itself.
That fact is the d'Alembert equation, named after Jean le Rond d'Alembert, who studied it in 1747. The equation is H(t+u) + H(t-u) = 2 H(t) H(u) for all real t and u. Its continuous solutions are exactly the hyperbolic cosine functions H(t) = cosh(kt) for a constant k. The equation is famous because it characterizes the cosine and its hyperbolic cousin without any mention of calculus. The cost uniqueness page reaches this equation after a logarithmic reparametrization of the composition law.
The declaration dAlembert_to_ODE_theorem contributes the bridge from that purely algebraic equation to the differential equation H'' = H. It states that if H is smooth, satisfies the d'Alembert equation, and has H(0) = 1, then its second derivative at any point t equals its second derivative at 0 times H(t). This is the step that lets the proof move from a discrete ledger, a record of recognition events, to the continuous world of calculus. Without it, the analytic route cannot begin.
In the machine-checked library of formal theorems, this bridge is not a single monolithic step. The library proves it through a chain: dAlembert_to_ODE_general_theorem gives the general form, and then the calibration condition, which fixes the second derivative at 0 to be 1, specializes it to H'' = H. The declaration dAlembert_to_ODE_theorem itself appears to be a hypothesis, a regularity assumption that the equation's continuous solutions are smooth enough to differentiate twice. This is exactly the kind of structural fact the proof needs before it can apply the ODE uniqueness theorem.
Should it stay off the page? The page already reaches the d'Alembert equation and then applies the ODE uniqueness theorem. The bridge declaration is the connective tissue between those two steps. A reader who wants to see the full chain, from algebraic equation to differential equation, would benefit from seeing it named. It is not a new idea, but it is the load-bearing joint that makes the analytic route possible. Leaving it off the page would leave a gap in the proof's story, even if the final theorem still holds.
THEOREM dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Derivation, universal coefficient)**: If H is C∞ and
satisfies d'Alembert, then `H''(t) = H''(0) * H(t)` everywhere.
This is the unnormalized form of `dAlembert_to_ODE_theorem`. -/
theorem dAlembert_to_ODE_general_theorem (H : ℝ → ℝ)
(h_smooth : ContDiff ℝ ⊤ H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) :
∀ t, deriv (deriv H) t = deriv (deriv H) 0 * H t := by
have hCDiff2 : ContDiff ℝ 2 H := h_smooth.of_le le_top
have hDiff : Differentiable ℝ H :=
hCDiff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have hCDiff1_H' : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at hCDiff2
rw [contDiff_succ_iff_deriv] at hCDiff2
exact hCDiff2.2.2
have hDiffDeriv : Differentiable ℝ (deriv H) :=
hCDiff1_H'.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
have hsh_add : ∀ (s v : ℝ), HasDerivAt (fun u => s + u) (1 : ℝ) v := fun s v => by
have h := (hasDerivAt_id v).add_const s; simp only [id] at h
rwa [show (fun u : ℝ => u + s) = fun u => s + u from funext fun u => add_comm u s] at h
have hsh_sub : ∀ (s v : ℝ), HasDerivAt (fun u => s - u) (-1 : ℝ) v := fun s v => by
have h1 : HasDerivAt (fun u : ℝ => -u) (-1 : ℝ) v := by
have := (hasDerivAt_id v).neg; simp only [id] at this; exact this
have h2 := h1.const_add s
rwa [show (fun u : ℝ => s + -u) = fun u => s - u from funext fun u => by ring] at h2
intro t
have h_feq : (fun u => H (t + u) + H (t - u)) = (fun u => 2 * H t * H u) :=
funext (h_dAlembert t)
have key : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 =
deriv (deriv (fun u => 2 * H t * H u)) 0 :=
congr_arg (fun f => deriv (deriv f) 0) h_feq
have lhs_eq : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = 2 * deriv (deriv H) t := by
have h_plus : ∀ v, HasDerivAt (fun u => H (t + u)) (deriv H (t + v)) v := fun v => by
have hH := (hDiff (t + v)).hasDerivAt
have hcomp := hH.comp v (hsh_add t v)
simp only [mul_one, Function.comp_apply] at hcomp; exact hcomp
have h_minus : ∀ v, HasDerivAt (fun u => H (t - u)) (-deriv H (t - v)) v := fun v => by
have hH := (hDiff (t - v)).hasDerivAt
have hcomp := hH.comp v (hsh_sub t v)
simp only [mul_neg, mul_one, Function.comp_apply] at hcomp; exact hcomp
have hfirst_fun : deriv (fun u => H (t + u) + H (t - u)) =
fun v => deriv H (t + v) - deriv H (t - v) := funext fun v => by
have heq : (fun u => H (t + u)) + (fun u => H (t - u)) =
fun u => H (t + u) + H (t - u) := by ext u; rfl
have h12 : deriv (fun u => H (t + u) + H (t - u)) v = deriv H (t + v) + -deriv H (t - v) := by
rw [← heq]; exact ((h_plus v).add (h_minus v)).deriv
linarith [show deriv H (t + v) + -deriv H (t - v) =
deriv H (t + v) - deriv H (t - v) from by ring]
have hd2_plus : HasDerivAt (fun v => deriv H (t + v)) (deriv (deriv H) t) 0 := by
have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t + 0)) (t + 0) :=
(hDiffDeriv (t + 0)).hasDerivAt
have hcomp := hDH.comp 0 (hsh_add t 0)
simp only [mul_one, add_zero, Function.comp_apply] at hcomp; exact hcomp
have hd2_minus : HasDerivAt (fun v => deriv H (t - v)) (-deriv (deriv H) t) 0 := by
have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t - 0)) (t - 0) :=
(hDiffDeriv (t - 0)).hasDerivAt
have hcomp := hDH.comp 0 (hsh_sub t 0)
simp only [mul_neg, mul_one, sub_zero, Function.comp_apply] at hcomp; exact hcomp
rw [congr_fun (congr_arg deriv hfirst_fun) 0]
have heq2 : (fun v => deriv H (t + v)) - (fun v => deriv H (t - v)) =
fun v => deriv H (t + v) - deriv H (t - v) := by ext v; rfl
have h : deriv (fun v => deriv H (t + v) - deriv H (t - v)) 0 =
deriv (deriv H) t - -deriv (deriv H) t := by
rw [← heq2]; exact (hd2_plus.sub hd2_minus).deriv
linarith [show deriv (deriv H) t - -deriv (deriv H) t = 2 * deriv (deriv H) t from by ring]
have rhs_eq : deriv (deriv (fun u => 2 * H t * H u)) 0 =
2 * H t * deriv (deriv H) 0 := by
have hfirst_fun : deriv (fun u => 2 * H t * H u) = fun v => 2 * H t * deriv H v :=
funext fun v => ((hDiff v).hasDerivAt.const_mul (2 * H t)).deriv
have hsecond := (hDiffDeriv 0).hasDerivAt.const_mul (2 * H t)
rw [congr_fun (congr_arg deriv hfirst_fun) 0, hsecond.deriv]
rw [lhs_eq, rhs_eq] at key
linarith
THEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_deriv_zero : deriv H 0 = 0 := by
have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert
have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt
exact even_deriv_at_zero H h_even h_diff
exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM dAlembert_cosh_solution_aczel · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (d'Alembert → cosh, Aczél form)**: Using only the Aczél axiom, a continuous
solution to d'Alembert with H(0) = 1 and H''(0) = 1 must equal cosh.
This is the clean version of `dAlembert_cosh_solution`, requiring no regularity params. -/
theorem dAlembert_cosh_solution_aczel
[AczelSmoothnessPackage]
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_d2_zero : deriv (deriv H) 0 = 1) :
∀ t, H t = Real.cosh t := by
have h_smooth : ContDiff ℝ ⊤ H := aczel_dAlembert_smooth H h_one h_cont h_dAlembert
have hDiff : Differentiable ℝ H :=
(h_smooth.of_le le_top : ContDiff ℝ 1 H).differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_H'0 : deriv H 0 = 0 := even_deriv_at_zero H h_even hDiff.differentiableAt
have h_ode : ∀ t, deriv (deriv H) t = H t :=
dAlembert_to_ODE_theorem H h_smooth h_dAlembert h_d2_zero
have h_C2 : ContDiff ℝ 2 H := h_smooth.of_le le_top
exact ode_cosh_uniqueness_contdiff H h_C2 h_ode h_one h_H'0
The role of the zero derivative
The cost uniqueness theorem concerns a function J(x) = (x + 1/x)/2 - 1, which measures the cost of a recognition event, a discrete record of something being recognized. The proof that any cost function satisfying five plain conditions must equal J proceeds by a change of variables. Writing F for the cost and defining G(t) = F(e^t), the composition law becomes the d'Alembert equation H(t+u) + H(t-u) = 2 H(t) H(u), where H(t) = G(t) + 1. This equation alone has many solutions; the continuous ones are exactly the functions H(t) = cosh(kt) for a constant k, a result with roots in a 1747 study by Jean le Rond d'Alembert.
The constant k is not pinned down by the equation. It is fixed by a calibration condition, expressed in the library as HasLogCurvature H 1, which states that the limit of 2(H(t) - 1)/t^2 as t approaches 0 equals 1. This condition forces the second derivative at zero, deriv (deriv H) 0, to equal 1. The theorem dAlembert_cosh_solution_aczel then applies: with H(0) = 1, continuity, the d'Alembert equation, and the condition deriv (deriv H) 0 = 1, it concludes that H(t) = cosh(t) for all t. The zero derivative condition, deriv H 0 = 0, is not an extra assumption here; it follows from the evenness of H, which itself follows from the reciprocal symmetry of the original cost F.
If the condition deriv_pos_self_zero were false, the calibration would not hold. The limit defining HasLogCurvature would not equal 1, because the second derivative at zero would differ. The theorem dAlembert_cosh_solution_aczel would then not apply, and the conclusion H(t) = cosh(t) would fail. The cost function would instead be J_k(x) = (x^k + x^(-k))/2 - 1 for some k different from 1. The uniqueness story would collapse: the five conditions would no longer force a single cost function, but a one-parameter family. The framework's claim that the cost is forced, not chosen, would lose its footing, because the calibration condition is what selects k = 1 from the family.
In the machine-checked library of formal theorems, the declaration law_of_logic_forces_jcost states the full theorem: given reciprocal symmetry, normalization, the composition law, calibration, and continuity, the cost must equal J. The proof relies on the calibration condition to set the second derivative at zero. If that condition were dropped or false, the library would still prove the d'Alembert equation and the evenness of H, but the final step to cosh would not go through. The theorem would need a different hypothesis, and the forcing chain that leads to the golden ratio and other derived constants would break at its first link.
THEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_deriv_zero : deriv H 0 = 0 := by
have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert
have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt
exact even_deriv_at_zero H h_even h_diff
exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM logCurvature_eq_deriv2 · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- For a smooth function with `Hf 0 = 1` and vanishing first derivative, the log
curvature exists and equals the second derivative at the origin. This is the
l'Hôpital step, and it is also what makes the corrected calibration satisfiable
rather than empty. -/
theorem logCurvature_eq_deriv2 (Hf : ℝ → ℝ) (hsm : ContDiff ℝ ⊤ Hf)
(h1 : Hf 0 = 1) (hd0 : deriv Hf 0 = 0) :
HasLogCurvature Hf (deriv (deriv Hf) 0) := by
have h2 : ContDiff ℝ 2 Hf := hsm.of_le (by exact_mod_cast le_top)
have hderiv_diff : Differentiable ℝ (deriv Hf) := by
have h3 := h2
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h3
rw [contDiff_succ_iff_deriv] at h3
exact h3.2.2.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
have hdiffHf : Differentiable ℝ Hf :=
h2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have hd2 : HasDerivAt (deriv Hf) (deriv (deriv Hf) 0) 0 :=
(hderiv_diff 0).hasDerivAt
have hslope :
Filter.Tendsto (fun t : ℝ => deriv Hf t / t)
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (deriv (deriv Hf) 0)) := by
have h := hasDerivAt_iff_tendsto_slope.mp hd2
have hsl : ∀ t : ℝ, slope (deriv Hf) 0 t = deriv Hf t / t := by
intro t
simp [slope_def_field, hd0]
exact Filter.Tendsto.congr hsl h
have hnum : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1))
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 0) := by
have hcont : Filter.Tendsto Hf (nhds (0 : ℝ)) (nhds (Hf 0)) :=
hdiffHf.continuous.tendsto 0
have hconst : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhds (0 : ℝ)) (nhds 1) :=
tendsto_const_nhds
have hsub : Filter.Tendsto (fun t : ℝ => Hf t - 1) (nhds (0 : ℝ))
(nhds (Hf 0 - 1)) := hcont.sub hconst
have hmul : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1)) (nhds (0 : ℝ))
(nhds (2 * (Hf 0 - 1))) := hsub.const_mul (2 : ℝ)
rw [h1] at hmul
simpa using hmul.mono_left nhdsWithin_le_nhds
have hden : Filter.Tendsto (fun t : ℝ => t ^ 2)
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 0) := by
have h := (continuous_pow 2).tendsto (0 : ℝ)
simpa using h.mono_left nhdsWithin_le_nhds
have hff' : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ),
HasDerivAt (fun s : ℝ => 2 * (Hf s - 1)) (2 * deriv Hf t) t := by
filter_upwards with t
simpa using ((hdiffHf t).hasDerivAt.sub_const 1).const_mul (2 : ℝ)
have hgg' : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ),
HasDerivAt (fun s : ℝ => s ^ 2) (2 * t) t := by
filter_upwards with t
simpa [mul_comm] using hasDerivAt_pow 2 t
have hg'ne : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), (2 : ℝ) * t ≠ 0 := by
filter_upwards [self_mem_nhdsWithin] with t ht
have htne : t ≠ 0 := ht
positivity
have hdiv :
Filter.Tendsto (fun t : ℝ => (2 * deriv Hf t) / (2 * t))
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (deriv (deriv Hf) 0)) := by
refine Filter.Tendsto.congr' ?_ hslope
filter_upwards [self_mem_nhdsWithin] with t ht
have htne : t ≠ 0 := ht
field_simp
exact HasDerivAt.lhopital_zero_nhdsNE hff' hgg' hg'ne hnum hden hdiv
THEOREM dAlembert_cosh_solution_aczel · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (d'Alembert → cosh, Aczél form)**: Using only the Aczél axiom, a continuous
solution to d'Alembert with H(0) = 1 and H''(0) = 1 must equal cosh.
This is the clean version of `dAlembert_cosh_solution`, requiring no regularity params. -/
theorem dAlembert_cosh_solution_aczel
[AczelSmoothnessPackage]
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_d2_zero : deriv (deriv H) 0 = 1) :
∀ t, H t = Real.cosh t := by
have h_smooth : ContDiff ℝ ⊤ H := aczel_dAlembert_smooth H h_one h_cont h_dAlembert
have hDiff : Differentiable ℝ H :=
(h_smooth.of_le le_top : ContDiff ℝ 1 H).differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_H'0 : deriv H 0 = 0 := even_deriv_at_zero H h_even hDiff.differentiableAt
have h_ode : ∀ t, deriv (deriv H) t = H t :=
dAlembert_to_ODE_theorem H h_smooth h_dAlembert h_d2_zero
have h_C2 : ContDiff ℝ 2 H := h_smooth.of_le le_top
exact ode_cosh_uniqueness_contdiff H h_C2 h_ode h_one h_H'0
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
A leaner proof route
The cost uniqueness theorem in the machine-checked library of formal theorems states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The five conditions are reciprocal symmetry, zero cost at unity, a forced composition law, calibration, and continuity. The declaration logCurvature_forces_normalized proves that one of these five, the normalization condition, is actually redundant: it follows from the composition law together with a calibration condition called log curvature.
Log curvature measures how sharply a function bends near zero, expressed as the limit of 2(H(t) - 1)/t² as t approaches 0. The theorem shows that if a cost function satisfies the composition law and has log curvature equal to 1, then it must be normalized, meaning J(1) = 0. This is a structural economy: the proof of uniqueness needs fewer independent starting assumptions.
The main theorem law_of_logic_forces_jcost still lists all five conditions as hypotheses, even though one is derivable from the others. This is a matter of presentation, not necessity. The library could present the uniqueness result with four conditions plus the log curvature calibration, and logCurvature_forces_normalized would supply the missing normalization. The page currently does not use this declaration, and it could stay off without losing correctness, but including it would show a sharper version of the theorem.
In Recognition Science, this matters because the framework aims to derive structure from minimal assumptions. A redundancy in the condition list is not a flaw, but it is an invitation to tighten the statement. The page could present the main theorem with the normalization condition derived rather than assumed, making the logical dependencies explicit.
THEOREM logCurvature_forces_normalized · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The composition law together with unit log curvature force normalization.
The composition law at `y = 1` gives `F 1 * (F x + 1) = 0`, so either `F 1 = 0`
or `F` is constantly `-1`; the constant has `H ≡ 0`, whose curvature quotient is
negative throughout a punctured neighbourhood and so cannot tend to `1`. -/
theorem logCurvature_forces_normalized (F : ℝ → ℝ)
(hComp : SatisfiesCompositionLaw F) (hκ : HasLogCurvature (H F) 1) :
IsNormalized F := by
by_contra hne
have hconst : ∀ x : ℝ, 0 < x → F x = -1 := by
intro x hx
have h := hComp x 1 hx one_pos
rw [mul_one, div_one] at h
have hquad : F 1 * (F x + 1) = 0 := by nlinarith
rcases mul_eq_zero.mp hquad with h1 | h2
· exact absurd h1 hne
· linarith
have hH : ∀ t : ℝ, H F t = 0 := by
intro t
have hx := hconst (Real.exp t) (Real.exp_pos t)
simp [H, G, hx]
have hgt : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ),
(1 / 2 : ℝ) < 2 * (H F t - 1) / t ^ 2 :=
hκ.eventually (eventually_gt_nhds (by norm_num))
have hne0 : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), t ≠ 0 := by
filter_upwards [self_mem_nhdsWithin] with t ht using ht
obtain ⟨t, hgt', ht0⟩ := (hgt.and hne0).exists
have ht2 : 0 < t ^ 2 := by positivity
have hneg : 2 * (H F t - 1) / t ^ 2 < 0 := by
rw [hH t]
exact div_neg_of_neg_of_pos (by norm_num) ht2
linarith
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The normalization premise
The cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The five conditions are reciprocal symmetry, zero cost at unity, a forced composition law, calibration, and continuity. The declaration IsNormalized is the formal name for the second of these: it says that when the argument is 1, the cost is 0. That is the condition that pins the function down at the point where the reciprocal symmetry and the composition law alone leave a free parameter.
To see why normalization matters, look at the classical cousin of this problem. In 1747, Jean le Rond d'Alembert studied the functional equation H(t+u) + H(t-u) = 2 H(t) H(u) for all real t and u. Its continuous solutions are exactly the hyperbolic cosine functions H(t) = cosh(kt) for a constant k. The constant k is a free scaling parameter: any value of k gives a solution. The equation alone does not select k. The normalization condition, stated as H(0) = 1 in the classical setting, fixes that freedom. In the cost setting, the analogous normalization fixes the value at x = 1, and the calibration condition then fixes the curvature at that point, which together force k = 1.
The machine-checked library of formal theorems shows this precisely. The theorem logCurvature_forces_normalized proves that if a function satisfies the composition law and has log-curvature 1, then it is automatically normalized. The theorem law_of_logic_forces_jcost takes IsNormalized as one of its five explicit hypotheses and concludes that the function equals J(x) = (x + 1/x)/2 - 1. So normalization is not redundant with the other four conditions: it is a genuine premise that the proof consumes, and without it the uniqueness conclusion does not follow.
In Recognition Science, the framework models the cost as a discrete record of recognition events, and the normalization condition says that recognizing something identical to itself costs nothing. That is a plain and reasonable requirement, and it is exactly the kind of premise that a formal proof must state explicitly rather than assume silently. The page should keep IsNormalized on the page, not as a decorative mention but as one of the five named premises that the theorem's statement lists and the proof uses. Removing it would leave the theorem with four hypotheses and no way to rule out the scaled solutions cosh(kt) with k ≠ 1.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM logCurvature_forces_normalized · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The composition law together with unit log curvature force normalization.
The composition law at `y = 1` gives `F 1 * (F x + 1) = 0`, so either `F 1 = 0`
or `F` is constantly `-1`; the constant has `H ≡ 0`, whose curvature quotient is
negative throughout a punctured neighbourhood and so cannot tend to `1`. -/
theorem logCurvature_forces_normalized (F : ℝ → ℝ)
(hComp : SatisfiesCompositionLaw F) (hκ : HasLogCurvature (H F) 1) :
IsNormalized F := by
by_contra hne
have hconst : ∀ x : ℝ, 0 < x → F x = -1 := by
intro x hx
have h := hComp x 1 hx one_pos
rw [mul_one, div_one] at h
have hquad : F 1 * (F x + 1) = 0 := by nlinarith
rcases mul_eq_zero.mp hquad with h1 | h2
· exact absurd h1 hne
· linarith
have hH : ∀ t : ℝ, H F t = 0 := by
intro t
have hx := hconst (Real.exp t) (Real.exp_pos t)
simp [H, G, hx]
have hgt : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ),
(1 / 2 : ℝ) < 2 * (H F t - 1) / t ^ 2 :=
hκ.eventually (eventually_gt_nhds (by norm_num))
have hne0 : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), t ≠ 0 := by
filter_upwards [self_mem_nhdsWithin] with t ht using ht
obtain ⟨t, hgt', ht0⟩ := (hgt.and hne0).exists
have ht2 : 0 < t ^ 2 := by positivity
have hneg : 2 * (H F t - 1) / t ^ 2 < 0 := by
rw [hH t]
exact div_neg_of_neg_of_pos (by norm_num) ht2
linarith
THEOREM dAlembert_cosh_solution_aczel · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (d'Alembert → cosh, Aczél form)**: Using only the Aczél axiom, a continuous
solution to d'Alembert with H(0) = 1 and H''(0) = 1 must equal cosh.
This is the clean version of `dAlembert_cosh_solution`, requiring no regularity params. -/
theorem dAlembert_cosh_solution_aczel
[AczelSmoothnessPackage]
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_cont : Continuous H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
(h_d2_zero : deriv (deriv H) 0 = 1) :
∀ t, H t = Real.cosh t := by
have h_smooth : ContDiff ℝ ⊤ H := aczel_dAlembert_smooth H h_one h_cont h_dAlembert
have hDiff : Differentiable ℝ H :=
(h_smooth.of_le le_top : ContDiff ℝ 1 H).differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert
have h_H'0 : deriv H 0 = 0 := even_deriv_at_zero H h_even hDiff.differentiableAt
have h_ode : ∀ t, deriv (deriv H) t = H t :=
dAlembert_to_ODE_theorem H h_smooth h_dAlembert h_d2_zero
have h_C2 : ContDiff ℝ 2 H := h_smooth.of_le le_top
exact ode_cosh_uniqueness_contdiff H h_C2 h_ode h_one h_H'0
A hidden identity
The cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof in the machine-checked library of formal theorems reaches this conclusion by a chain of analytic steps: it transforms the problem into log coordinates, derives a differential equation, and then solves that equation. The declaration dAlembert_diff_square is a lemma about the middle of that chain. It states that if a function H satisfies the d'Alembert equation, H(t+u) + H(t-u) = 2 * H t * H u, then the square of the difference between H at t+u and H at t-u factors into a product of terms that depend separately on t and on u: (H (t+u) - H (t-u))^2 = 4 * ((H t)^2 - 1) * ((H u)^2 - 1).
This identity is what separates the variables. The left side mixes t and u, but the right side is a product of a function of t and a function of u. That separation is the step that lets the proof convert the functional equation into a differential equation for H, which then has a unique smooth solution: the hyperbolic cosine, cosh(t) = (e^t + e^-t)/2. Without this factorization, the chain from the composition law to the ordinary differential equation would have a gap. The lemma is the bridge that makes the analytic route work.
In Recognition Science, the framework models recognition costs as functions that must satisfy this d'Alembert-like equation. The lemma dAlembert_diff_square is therefore not a side curiosity; it is a load-bearing part of the proof of the uniqueness theorem. It contributes the algebraic core that turns a global constraint on all pairs of inputs into a local condition at a single point, which is exactly what a differential equation needs. The page should use it, because it explains why the proof can move from a functional equation to calculus at all.
The lemma also has a classical life outside the framework. The d'Alembert equation is named for Jean le Rond d'Alembert, who studied it in 1747 in his work on vibrating strings. The identity here is a standard algebraic consequence of that equation, and it appears in textbooks on functional equations. Its role in the cost uniqueness proof is a modern application of a classical result.
THEOREM dAlembert_diff_square · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_diff_square
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) :
∀ t u,
(H (t+u) - H (t-u))^2 = 4 * ((H t)^2 - 1) * ((H u)^2 - 1) := by
intro t u
have h_sum : H (t+u) + H (t-u) = 2 * H t * H u := h_dAlembert t u
have h_prod : H (t+u) * H (t-u) = (H t)^2 + (H u)^2 - 1 :=
dAlembert_product H h_one h_dAlembert t u
calc
(H (t+u) - H (t-u))^2
= (H (t+u) + H (t-u))^2 - 4 * (H (t+u) * H (t-u)) := by ring
_ = (2 * H t * H u)^2 - 4 * ((H t)^2 + (H u)^2 - 1) := by
simp [h_sum, h_prod]
_ = 4 * ((H t)^2 - 1) * ((H u)^2 - 1) := by ring
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
The hidden product law
The d'Alembert product law is a purely classical result about the hyperbolic cosine, the even function cosh(t) = (e^t + e^-t)/2 that describes a hanging chain. It states that for any two numbers t and u, the product cosh(t+u) * cosh(t-u) equals cosh(t)^2 + cosh(u)^2 - 1. This is not a new discovery; it is a direct algebraic consequence of the more famous addition formula cosh(t+u) + cosh(t-u) = 2 * cosh(t) * cosh(u), which Jean le Rond d'Alembert wrote down in 1747 while studying vibrating strings. The product law is the same fact rearranged, and it has a quiet power: it lets one compute the value of cosh at a sum and difference from the values at the two inputs alone.
The law earns its place on the cost uniqueness page because it is the bridge from a simple composition rule to a differential equation. The page's central question is whether a recognition cost, the amount posted when something is recognized, must take the unique form J(x) = (x + 1/x)/2 - 1. The proof's route is to change variables, writing G(t) = F(e^t), so that multiplying inputs to F becomes adding inputs to G. In these log coordinates, the cost's composition law becomes exactly the d'Alembert addition formula: G(t+u) + G(t-u) = 2 * G(t) * G(u) + 2 * G(t) + 2 * G(u). From this identity alone, the product law follows, and from the product law one can derive that the second derivative of G at any point equals G itself. That is the differential equation whose unique smooth solution, with the right starting values, is the hyperbolic cosine.
In Recognition Science, the framework models the cost of recognition as a function that must satisfy five plain conditions, and its machine-checked library of formal theorems proves that any such cost must equal J. The d'Alembert product law is the step that makes the analytic machinery available. Without it, the proof would be stuck at an algebraic identity with no path to calculus. The law shows that the composition rule is not just a bookkeeping constraint; it secretly encodes a second-order differential equation, and that equation has only one well-behaved solution. The product law is therefore not a curiosity but the hinge: it converts a statement about how costs combine into a statement about how a function bends, and that bend is what selects the hyperbolic cosine and, through it, the unique cost J.
The consequence is that the cost uniqueness theorem is not a fragile artifact of a particular proof. The d'Alembert product law is a classical, framework-neutral fact about cosh, and it holds regardless of how the cost function is interpreted. The framework's contribution is to show that the five conditions force the composition law, and that the composition law, through the product law, forces the differential equation. The reader can now see the uniqueness result as the endpoint of a chain that begins with a 1747 identity about vibrating strings and ends with a single, unavoidable formula for the cost of recognition.
THEOREM dAlembert_product · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_product
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) :
∀ t u, H (t+u) * H (t-u) = (H t)^2 + (H u)^2 - 1 := by
intro t u
have h := h_dAlembert (t + u) (t - u)
have h' : H (2 * t) + H (2 * u) = 2 * H (t + u) * H (t - u) := by
-- (t+u)+(t-u)=2t and (t+u)-(t-u)=2u
simpa [two_mul, sub_eq_add_neg, add_assoc, add_left_comm, add_comm] using h
have h2t : H (2 * t) = 2 * (H t)^2 - 1 := dAlembert_double H h_one h_dAlembert t
have h2u : H (2 * u) = 2 * (H u)^2 - 1 := dAlembert_double H h_one h_dAlembert u
have h'' : 2 * H (t + u) * H (t - u) = (2 * (H t)^2 - 1) + (2 * (H u)^2 - 1) := by
calc
2 * H (t + u) * H (t - u) = H (2 * t) + H (2 * u) := by linarith [h']
_ = (2 * (H t)^2 - 1) + (2 * (H u)^2 - 1) := by simp [h2t, h2u]
linarith
THEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G.
Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y)
becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t)
via the substitution x = e^s, y = e^t. -/
theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) :
SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by
constructor
· intro hComp t u
have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t
have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u
have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos
-- exp(t) * exp(u) = exp(t + u)
have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm
-- exp(t) / exp(u) = exp(t - u)
have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by
rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg]
simp only [G, h1, h2] at h ⊢
linarith
· intro hCosh x y hx hy
let t := Real.log x
let u := Real.log y
have hx_eq : x = Real.exp t := (Real.exp_log hx).symm
have hy_eq : y = Real.exp u := (Real.exp_log hy).symm
have h := hCosh t u
simp only [G] at h
rw [hx_eq, hy_eq]
rw [← Real.exp_add, ← Real.exp_sub]
-- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u))
-- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u)
calc F (Real.exp (t + u)) + F (Real.exp (t - u))
= 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h
_ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ring
THEOREM dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Derivation, universal coefficient)**: If H is C∞ and
satisfies d'Alembert, then `H''(t) = H''(0) * H(t)` everywhere.
This is the unnormalized form of `dAlembert_to_ODE_theorem`. -/
theorem dAlembert_to_ODE_general_theorem (H : ℝ → ℝ)
(h_smooth : ContDiff ℝ ⊤ H)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) :
∀ t, deriv (deriv H) t = deriv (deriv H) 0 * H t := by
have hCDiff2 : ContDiff ℝ 2 H := h_smooth.of_le le_top
have hDiff : Differentiable ℝ H :=
hCDiff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have hCDiff1_H' : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at hCDiff2
rw [contDiff_succ_iff_deriv] at hCDiff2
exact hCDiff2.2.2
have hDiffDeriv : Differentiable ℝ (deriv H) :=
hCDiff1_H'.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
have hsh_add : ∀ (s v : ℝ), HasDerivAt (fun u => s + u) (1 : ℝ) v := fun s v => by
have h := (hasDerivAt_id v).add_const s; simp only [id] at h
rwa [show (fun u : ℝ => u + s) = fun u => s + u from funext fun u => add_comm u s] at h
have hsh_sub : ∀ (s v : ℝ), HasDerivAt (fun u => s - u) (-1 : ℝ) v := fun s v => by
have h1 : HasDerivAt (fun u : ℝ => -u) (-1 : ℝ) v := by
have := (hasDerivAt_id v).neg; simp only [id] at this; exact this
have h2 := h1.const_add s
rwa [show (fun u : ℝ => s + -u) = fun u => s - u from funext fun u => by ring] at h2
intro t
have h_feq : (fun u => H (t + u) + H (t - u)) = (fun u => 2 * H t * H u) :=
funext (h_dAlembert t)
have key : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 =
deriv (deriv (fun u => 2 * H t * H u)) 0 :=
congr_arg (fun f => deriv (deriv f) 0) h_feq
have lhs_eq : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = 2 * deriv (deriv H) t := by
have h_plus : ∀ v, HasDerivAt (fun u => H (t + u)) (deriv H (t + v)) v := fun v => by
have hH := (hDiff (t + v)).hasDerivAt
have hcomp := hH.comp v (hsh_add t v)
simp only [mul_one, Function.comp_apply] at hcomp; exact hcomp
have h_minus : ∀ v, HasDerivAt (fun u => H (t - u)) (-deriv H (t - v)) v := fun v => by
have hH := (hDiff (t - v)).hasDerivAt
have hcomp := hH.comp v (hsh_sub t v)
simp only [mul_neg, mul_one, Function.comp_apply] at hcomp; exact hcomp
have hfirst_fun : deriv (fun u => H (t + u) + H (t - u)) =
fun v => deriv H (t + v) - deriv H (t - v) := funext fun v => by
have heq : (fun u => H (t + u)) + (fun u => H (t - u)) =
fun u => H (t + u) + H (t - u) := by ext u; rfl
have h12 : deriv (fun u => H (t + u) + H (t - u)) v = deriv H (t + v) + -deriv H (t - v) := by
rw [← heq]; exact ((h_plus v).add (h_minus v)).deriv
linarith [show deriv H (t + v) + -deriv H (t - v) =
deriv H (t + v) - deriv H (t - v) from by ring]
have hd2_plus : HasDerivAt (fun v => deriv H (t + v)) (deriv (deriv H) t) 0 := by
have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t + 0)) (t + 0) :=
(hDiffDeriv (t + 0)).hasDerivAt
have hcomp := hDH.comp 0 (hsh_add t 0)
simp only [mul_one, add_zero, Function.comp_apply] at hcomp; exact hcomp
have hd2_minus : HasDerivAt (fun v => deriv H (t - v)) (-deriv (deriv H) t) 0 := by
have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t - 0)) (t - 0) :=
(hDiffDeriv (t - 0)).hasDerivAt
have hcomp := hDH.comp 0 (hsh_sub t 0)
simp only [mul_neg, mul_one, sub_zero, Function.comp_apply] at hcomp; exact hcomp
rw [congr_fun (congr_arg deriv hfirst_fun) 0]
have heq2 : (fun v => deriv H (t + v)) - (fun v => deriv H (t - v)) =
fun v => deriv H (t + v) - deriv H (t - v) := by ext v; rfl
have h : deriv (fun v => deriv H (t + v) - deriv H (t - v)) 0 =
deriv (deriv H) t - -deriv (deriv H) t := by
rw [← heq2]; exact (hd2_plus.sub hd2_minus).deriv
linarith [show deriv (deriv H) t - -deriv (deriv H) t = 2 * deriv (deriv H) t from by ring]
have rhs_eq : deriv (deriv (fun u => 2 * H t * H u)) 0 =
2 * H t * deriv (deriv H) 0 := by
have hfirst_fun : deriv (fun u => 2 * H t * H u) = fun v => 2 * H t * deriv H v :=
funext fun v => ((hDiff v).hasDerivAt.const_mul (2 * H t)).deriv
have hsecond := (hDiffDeriv 0).hasDerivAt.const_mul (2 * H t)
rw [congr_fun (congr_arg deriv hfirst_fun) 0, hsecond.deriv]
rw [lhs_eq, rhs_eq] at key
linarith
THEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/
theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ)
(h_diff : ContDiff ℝ 2 H)
(h_ode : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0) :
∀ t, H t = Real.cosh t := by
let g := fun t => H t - Real.cosh t
have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh
have hg_ode : ∀ t, deriv (deriv g) t = g t := by
intro t
have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by
ext s; apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by
have hH_diff1 : ContDiff ℝ 1 (deriv H) := by
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff
rw [contDiff_succ_iff_deriv] at h_diff
exact h_diff.2.2
have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by
rw [Real.deriv_cosh]; exact Real.contDiff_sinh
rw [h1]; apply deriv_sub
· exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
· exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt
rw [h2, h_ode t, cosh_second_deriv_eq t]
have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero]
have hg'0 : deriv g 0 = 0 := by
have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by
apply deriv_sub
· exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt
· exact Real.differentiable_cosh.differentiableAt
rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring
have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0
intro t
have := hg_zero t
simp only [g] at this; linarith
The regularization variant
The cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The main proof in the machine-checked library of formal theorems reaches this conclusion by a chain of analytic steps: it transforms the problem into log coordinates, derives a differential equation, and then solves that equation. The library also contains a second version of the same theorem, law_of_logic_forces_jcost_with_regularization, which differs from the main one only in how it states the smoothness assumptions.
The main theorem, law_of_logic_forces_jcost, assumes the cost function is continuous on the positive real line and, through a package called AczelSmoothnessPackage, implicitly relies on a classical result: that a continuous solution of the d'Alembert equation is automatically smooth. The regularization variant makes this hidden step explicit. It keeps the same five conditions, but instead of the package it lists five named regularity hypotheses: that the function is smooth, that it satisfies the d'Alembert-to-ODE condition, that it meets the ODE regularity conditions for continuity and differentiability, and that it satisfies the bootstrap condition. These are the exact hypotheses that the proof's intermediate lemmas need, and spelling them out means the theorem does not depend on a package that bundles them together.
The two statements are logically equivalent in practice, since the package provides the five hypotheses and the five hypotheses imply the package. The regularization variant contributes nothing new to the mathematical content, but it serves a different purpose. It makes the proof's internal structure visible to a reader who wants to see precisely which regularity assumptions are doing the work. It also makes the theorem easier to reuse in contexts where the package is not available or where a user wants to supply the hypotheses directly. For the encyclopedia page, the main theorem is the right one to present as the headline result; the regularization variant is a supporting detail that belongs in a note or a separate section, not in the opening statement of the theorem.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM law_of_logic_forces_jcost_with_regularization · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem 1.1 (Main Result, Reformulated)**:
Let F : ℝ₊ → ℝ satisfy:
1. Reciprocity: F(x) = F(1/x)
2. Normalization: F(1) = 0
3. Composition Law: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y)
4. Calibration: lim_{t→0} 2F(e^t)/t² = 1
5. Continuity and regularity hypotheses
Then F = J on ℝ₊, where J(x) = (x + 1/x)/2 - 1.
This theorem corresponds to Theorem 1.1 in:
J. Washburn & M. Zlatanović, "Uniqueness of the Canonical Reciprocal Cost" -/
theorem law_of_logic_forces_jcost_with_regularization (F : ℝ → ℝ)
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0))
-- Regularity hypotheses (from Aczél theory)
(h_smooth : dAlembert_continuous_implies_smooth_hypothesis (H F))
(h_ode : dAlembert_to_ODE_hypothesis (H F))
(h_cont : ode_regularity_continuous_hypothesis (H F))
(h_diff : ode_regularity_differentiable_hypothesis (H F))
(h_boot : ode_linear_regularity_bootstrap_hypothesis (H F)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
-- The proof follows the structure of T5_uniqueness_complete:
-- 1. Convert composition law to CoshAddIdentity on G
-- 2. Shift to H = G + 1 to get standard d'Alembert equation
-- 3. Apply Aczél's theorem: continuous d'Alembert solutions are cosh
-- 4. Calibration H''(0) = 1 selects cosh (not cos or constant)
-- 5. Unshift: G = cosh - 1, hence F = J
intro x hx
-- Convert hypotheses to the required format
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
-- Step 1: Set up G and H
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
-- Step 2: Derive key properties of G and H
have h_G_even : Function.Even Gf := G_even_of_reciprocal_symmetry F hSymm
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
-- Goal is F 1 + 1 = 1, and hNorm says F 1 = 0
rw [hNorm]
ring
-- Step 3: G is continuous (F continuous on (0,∞), exp continuous)
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
-- Step 4: Convert CoshAddIdentity to d'Alembert equation for H
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
-- Step 5: Second derivative condition
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t
change deriv (fun y => Gf y + 1) t = deriv Gf t
simpa using (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
-- Step 6: Apply d'Alembert uniqueness theorem
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution Hf h_H0 h_H_cont h_dAlembert h_H_d2
h_smooth h_ode h_cont h_diff h_boot
-- Step 7: Unshift to get G = cosh - 1
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := by
intro t
have hH := h_H_cosh t
have hH' : Gf t + 1 = Real.cosh t := by simpa [Hf, H, Gf] using hH
linarith
-- Step 8: Convert back via log parametrization
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simpa using hJG.symm
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simpa [ht]
The missing link
The cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof in the machine-checked library of formal theorems reaches this conclusion by a chain of analytic steps: it transforms the problem into log coordinates, derives a differential equation, and then solves that equation. The declaration logCurvature_eq_deriv2 is not part of that chain. The question is whether it should be.
The declaration is a small lemma about the logarithmic curvature, the rate at which a function's log-coordinate curve bends near zero. It states that for a smooth function H with H(0) = 1 and derivative zero at zero, the logarithmic curvature equals the second derivative at zero. In symbols: HasLogCurvature H (deriv (deriv H) 0). This is a bridge between two ways of writing the same quantity. The proof's main route uses the logarithmic curvature as a calibration condition; the differential equation route uses the second derivative. The lemma says these are the same thing under smoothness.
What the lemma contributes is a clean equivalence. It lets a reader see that the calibration condition, which looks like a limit statement about how H behaves near zero, is really just a statement about the second derivative. That is a useful conceptual point. The page currently introduces the logarithmic curvature as a technical device without explaining why it is the right device. The lemma would give that explanation.
But the page does not need it for the proof. The theorem law_of_logic_forces_jcost proves the uniqueness result directly from the five conditions, and the supporting lemmas dAlembert_cosh_solution_aczel and ode_cosh_uniqueness_contdiff carry the analytic weight. The lemma logCurvature_eq_deriv2 is not referenced in any of the main proof steps. It is a standalone fact, true and useful, but not load-bearing.
The page should include it, but as a remark, not as a proof step. A short paragraph after the main theorem could say: the calibration condition is equivalent to a second-derivative condition for smooth functions, and that is why the two routes agree. That is the honest role for the lemma. It does not change the proof, but it makes the proof easier to understand. The page should stay as it is, with the lemma mentioned as a clarifying note rather than as a required component.
THEOREM logCurvature_eq_deriv2 · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- For a smooth function with `Hf 0 = 1` and vanishing first derivative, the log
curvature exists and equals the second derivative at the origin. This is the
l'Hôpital step, and it is also what makes the corrected calibration satisfiable
rather than empty. -/
theorem logCurvature_eq_deriv2 (Hf : ℝ → ℝ) (hsm : ContDiff ℝ ⊤ Hf)
(h1 : Hf 0 = 1) (hd0 : deriv Hf 0 = 0) :
HasLogCurvature Hf (deriv (deriv Hf) 0) := by
have h2 : ContDiff ℝ 2 Hf := hsm.of_le (by exact_mod_cast le_top)
have hderiv_diff : Differentiable ℝ (deriv Hf) := by
have h3 := h2
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h3
rw [contDiff_succ_iff_deriv] at h3
exact h3.2.2.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
have hdiffHf : Differentiable ℝ Hf :=
h2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have hd2 : HasDerivAt (deriv Hf) (deriv (deriv Hf) 0) 0 :=
(hderiv_diff 0).hasDerivAt
have hslope :
Filter.Tendsto (fun t : ℝ => deriv Hf t / t)
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (deriv (deriv Hf) 0)) := by
have h := hasDerivAt_iff_tendsto_slope.mp hd2
have hsl : ∀ t : ℝ, slope (deriv Hf) 0 t = deriv Hf t / t := by
intro t
simp [slope_def_field, hd0]
exact Filter.Tendsto.congr hsl h
have hnum : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1))
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 0) := by
have hcont : Filter.Tendsto Hf (nhds (0 : ℝ)) (nhds (Hf 0)) :=
hdiffHf.continuous.tendsto 0
have hconst : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhds (0 : ℝ)) (nhds 1) :=
tendsto_const_nhds
have hsub : Filter.Tendsto (fun t : ℝ => Hf t - 1) (nhds (0 : ℝ))
(nhds (Hf 0 - 1)) := hcont.sub hconst
have hmul : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1)) (nhds (0 : ℝ))
(nhds (2 * (Hf 0 - 1))) := hsub.const_mul (2 : ℝ)
rw [h1] at hmul
simpa using hmul.mono_left nhdsWithin_le_nhds
have hden : Filter.Tendsto (fun t : ℝ => t ^ 2)
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 0) := by
have h := (continuous_pow 2).tendsto (0 : ℝ)
simpa using h.mono_left nhdsWithin_le_nhds
have hff' : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ),
HasDerivAt (fun s : ℝ => 2 * (Hf s - 1)) (2 * deriv Hf t) t := by
filter_upwards with t
simpa using ((hdiffHf t).hasDerivAt.sub_const 1).const_mul (2 : ℝ)
have hgg' : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ),
HasDerivAt (fun s : ℝ => s ^ 2) (2 * t) t := by
filter_upwards with t
simpa [mul_comm] using hasDerivAt_pow 2 t
have hg'ne : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), (2 : ℝ) * t ≠ 0 := by
filter_upwards [self_mem_nhdsWithin] with t ht
have htne : t ≠ 0 := ht
positivity
have hdiv :
Filter.Tendsto (fun t : ℝ => (2 * deriv Hf t) / (2 * t))
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (deriv (deriv Hf) 0)) := by
refine Filter.Tendsto.congr' ?_ hslope
filter_upwards [self_mem_nhdsWithin] with t ht
have htne : t ≠ 0 := ht
field_simp
exact HasDerivAt.lhopital_zero_nhdsNE hff' hgg' hg'ne hnum hden hdiv
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The cost uniqueness story
The cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof is a chain of forced steps. One link is DirectCoshAdd, the identity that the log-coordinate transform of the cost function obeys a hyperbolic cosine addition law. If that link were false or dropped, the chain would break and the theorem would no longer hold.
DirectCoshAdd is the bridge between the composition law and the differential equation. The composition law, SatisfiesCompositionLaw, states that for positive x and y, F(x*y) + F(x/y) = 2*F(x)*F(y) + 2*F(x) + 2*F(y). The theorem composition_law_equiv_coshAdd proves this is equivalent to CoshAddIdentity, which says the log-coordinate transform G F satisfies the same addition law. The lemma CoshAddIdentity_implies_DirectCoshAdd then shows that CoshAddIdentity implies DirectCoshAdd. So DirectCoshAdd is the form of the addition law that the proof uses to derive the differential equation.
From DirectCoshAdd, the proof derives the differential equation H'' = H, where H is the log-coordinate transform. The theorem dAlembert_cosh_solution_of_log_curvature shows that a function satisfying the d'Alembert equation and the log curvature condition must be the hyperbolic cosine. The theorem ode_cosh_uniqueness then proves that the differential equation with the right initial conditions has the unique solution H(t) = cosh(t). The theorem composition_logCurvature_forces_jcost combines these to show that the cost function must be J(x).
If DirectCoshAdd were false, the proof could not establish the differential equation. The chain from the composition law to the ODE would be broken. The theorem law_of_logic_forces_jcost, which states the full uniqueness result, relies on the composition law and the other conditions. Without DirectCoshAdd, the proof would lack the bridge to the ODE, and the conclusion that the cost must be J(x) would not follow. The cost uniqueness story would collapse at that link.
Dropping DirectCoshAdd would leave the other conditions intact but the proof incomplete. The theorem law_of_logic_forces_jcost_with_regularization shows that the five conditions plus regularity hypotheses still force J(x). But the regularity hypotheses are not the same as DirectCoshAdd. DirectCoshAdd is a structural identity, not a regularity condition. So the proof would need a different bridge, or the theorem would fail.
THEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G.
Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y)
becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t)
via the substitution x = e^s, y = e^t. -/
theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) :
SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by
constructor
· intro hComp t u
have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t
have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u
have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos
-- exp(t) * exp(u) = exp(t + u)
have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm
-- exp(t) / exp(u) = exp(t - u)
have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by
rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg]
simp only [G, h1, h2] at h ⊢
linarith
· intro hCosh x y hx hy
let t := Real.log x
let u := Real.log y
have hx_eq : x = Real.exp t := (Real.exp_log hx).symm
have hy_eq : y = Real.exp u := (Real.exp_log hy).symm
have h := hCosh t u
simp only [G] at h
rw [hx_eq, hy_eq]
rw [← Real.exp_add, ← Real.exp_sub]
-- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u))
-- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u)
calc F (Real.exp (t + u)) + F (Real.exp (t - u))
= 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h
_ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ring
THEOREM CoshAddIdentity_implies_DirectCoshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma CoshAddIdentity_implies_DirectCoshAdd (F : ℝ → ℝ)
(h : CoshAddIdentity F) :
DirectCoshAdd (G F) := h
THEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature
(H : ℝ → ℝ)
(h_one : H 0 = 1)
(h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u)
{κ : ℝ} (h_calib : HasLogCurvature H κ)
(h_deriv2_zero : deriv (deriv H) 0 = 1)
(h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H)
(h_ode_hyp : dAlembert_to_ODE_hypothesis H)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib
exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero
h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hyp
THEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ)
(h_ODE : ∀ t, deriv (deriv H) t = H t)
(h_H0 : H 0 = 1)
(h_H'0 : deriv H 0 = 0)
(h_cont_hyp : ode_regularity_continuous_hypothesis H)
(h_diff_hyp : ode_regularity_differentiable_hypothesis H)
(h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) :
∀ t, H t = Real.cosh t := by
have h_cont : Continuous H := h_cont_hyp h_ODE
have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont
have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff
exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0
THEOREM composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **The cost theorem on two premises.** The composition law and unit log
curvature force `F = J` on the positives. Normalization, nonnegativity, and
continuity are all conclusions rather than hypotheses; compare
`law_of_logic_forces_jcost`, which assumes all of them. -/
theorem composition_logCurvature_forces_jcost [AczelSmoothnessPackage]
(F : ℝ → ℝ)
(hComp : SatisfiesCompositionLaw F)
(hκ : HasLogCurvature (H F) 1) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
have hNorm : IsNormalized F := logCurvature_forces_normalized F hComp hκ
have hN : F 1 = 0 := hNorm
have hH0 : H F 0 = 1 := by simp [H, G, hN]
have hCosh : CoshAddIdentity F := (composition_law_equiv_coshAdd F).mp hComp
have hdA : ∀ t u, H F (t + u) + H F (t - u) = 2 * H F t * H F u := by
intro t u
have hG := hCosh t u
have hgoal :
(G F (t + u) + 1) + (G F (t - u) + 1) =
2 * (G F t + 1) * (G F u + 1) := by
calc
(G F (t + u) + 1) + (G F (t - u) + 1)
= (G F (t + u) + G F (t - u)) + 2 := by ring
_ = (2 * (G F t * G F u) + 2 * (G F t + G F u)) + 2 := by simpa [hG]
_ = 2 * (G F t + 1) * (G F u + 1) := by ring
simpa [H] using hgoal
have hcont : Continuous (H F) :=
dAlembert_continuous_of_log_curvature (H F) hH0 hdA hκ
have hsm : ContDiff ℝ ⊤ (H F) := aczel_dAlembert_smooth (H F) hH0 hcont hdA
have heven : Function.Even (H F) := dAlembert_even (H F) hH0 hdA
have hd0 : deriv (H F) 0 = 0 :=
even_deriv_at_zero (H F) heven
(hsm.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) 0)
have hd2 : deriv (deriv (H F)) 0 = 1 :=
deriv2_of_logCurvature (H F) hsm hH0 hd0 hκ
have hcosh : ∀ t, H F t = Real.cosh t :=
dAlembert_cosh_solution_aczel (H F) hH0 hcont hdA hd2
intro x hx
have hGc : G F (Real.log x) = Real.cosh (Real.log x) - 1 := by
have h := hcosh (Real.log x)
simp only [H] at h
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc
F x = F (Real.exp (Real.log x)) := by rw [ht]
_ = G F (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := hGc
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
The algebraic gate
The cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof in the machine-checked library of formal theorems reaches this conclusion by a chain of analytic steps: it transforms the problem into log coordinates, derives a differential equation, and then solves that equation. The declaration rclCombiner_satisfies_gate is not part of that analytic route. It belongs to a separate, purely algebraic core that the framework also formalizes.
That core studies a combiner, a function P(u, v) that takes two real inputs and produces a real output. The framework defines the canonical RCL combiner as the polynomial P(u, v) = 2uv + 2u + 2v. The declaration rclCombiner_satisfies_gate proves that this specific polynomial meets a structural gate: it is symmetric, so P(u, v) = P(v, u); it is affine in its second argument, meaning for each fixed u the function v ↦ P(u, v) is a straight line; it satisfies the boundary law P(u, 0) = 2u; and it obeys the normalization P(1, 1) = 6. These four properties are the factorization and associativity gate.
The gate matters because the framework proves a stronger theorem: any function satisfying the gate must equal the RCL combiner. The declaration gate_forces_rcl establishes that the gate alone, without any calculus, forces the polynomial exactly. The theorem rclCombiner_satisfies_gate is the consistency check that the canonical object actually belongs to the family the gate characterizes. It confirms the gate is not empty and that the forcing theorem applies to a real example.
For the cost uniqueness page, the declaration contributes a completeness check rather than a step in the main proof. The analytic route through the differential equation already yields J. The algebraic gate offers an alternative path that reaches the same polynomial through symmetry and boundary conditions alone. Including rclCombiner_satisfies_gate on the page would let the reader see that the algebraic characterization is not vacuous: the canonical combiner genuinely satisfies the gate that forces it. That is a useful cross-check, but it is not required for the main theorem's proof.
THEOREM rclCombiner_satisfies_gate · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- The canonical RCL polynomial satisfies the full factorization gate. -/
theorem rclCombiner_satisfies_gate :
FactorizationAssociativityGate rclCombiner where
symmetric := by
intro u v
unfold rclCombiner
ring
rightAffine := by
intro u
refine ⟨2 * u + 2, 2 * u, ?_⟩
intro v
unfold rclCombiner
ring
zeroBoundary := by
intro u
unfold rclCombiner
ring
unitDiagonal := by
unfold rclCombiner
norm_num
THEOREM gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Canonical normalization selects the RCL member of the bilinear family. -/
theorem gate_forces_rcl (P : ℝ → ℝ → ℝ)
(hGate : FactorizationAssociativityGate P) :
∀ u v, P u v = 2 * u * v + 2 * u + 2 * v := by
obtain ⟨c, hc⟩ := gate_forces_bilinear_family P hGate
have hc_two : c = 2 := by
have h11 : P 1 1 = c * 1 * 1 + 2 * 1 + 2 * 1 := by
simpa using hc 1 1
linarith [hGate.unitDiagonal, h11]
intro u v
calc
P u v = c * u * v + 2 * u + 2 * v := hc u v
_ = 2 * u * v + 2 * u + 2 * v := by rw [hc_two]
The zero step
The cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof's main route is analytic: it transforms the problem into log coordinates, where the function must satisfy a differential equation whose unique smooth solution is the hyperbolic cosine. Before that calculus begins, however, the proof needs a structural fact about the function's behavior at the point zero.
That fact is the lemma deriv_pos_self_zero. In plain language, it says that if a function's second derivative exists and is positive at zero, and the function itself is zero there with zero first derivative, then the function must be positive in a small neighborhood around zero. The proof is a direct application of the standard second derivative test: a positive second derivative at a critical point means the function has a local minimum there, and since the value at that minimum is zero, the function must rise above zero on both sides. The lemma is a small, self-contained result, but it plays an essential role in the larger argument.
The larger argument needs this lemma because the proof of the cost uniqueness theorem does not start with a function known to be smooth. It starts with a function known to satisfy a composition law, and the first task is to show that this function is well-behaved enough to apply calculus at all. The lemma deriv_pos_self_zero provides one of the regularity conditions: it shows that the function has a certain local positivity property near zero, which is a step toward establishing the smoothness needed for the differential equation route. Without this lemma, the chain of reasoning from the five plain conditions to the hyperbolic cosine would have a gap.
In the machine-checked library of formal theorems, deriv_pos_self_zero appears as a lemma in the FunctionalEquation module, sitting alongside the other lemmas that build the proof of the main theorem. Its presence there is a reminder that even the largest results depend on small, precise facts about functions and their derivatives. The lemma itself is not the punchline of the cost uniqueness page, but it is one of the load-bearing steps that makes the punchline possible.
THEOREM logCurvature_eq_deriv2 · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- For a smooth function with `Hf 0 = 1` and vanishing first derivative, the log
curvature exists and equals the second derivative at the origin. This is the
l'Hôpital step, and it is also what makes the corrected calibration satisfiable
rather than empty. -/
theorem logCurvature_eq_deriv2 (Hf : ℝ → ℝ) (hsm : ContDiff ℝ ⊤ Hf)
(h1 : Hf 0 = 1) (hd0 : deriv Hf 0 = 0) :
HasLogCurvature Hf (deriv (deriv Hf) 0) := by
have h2 : ContDiff ℝ 2 Hf := hsm.of_le (by exact_mod_cast le_top)
have hderiv_diff : Differentiable ℝ (deriv Hf) := by
have h3 := h2
rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h3
rw [contDiff_succ_iff_deriv] at h3
exact h3.2.2.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0)
have hdiffHf : Differentiable ℝ Hf :=
h2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)
have hd2 : HasDerivAt (deriv Hf) (deriv (deriv Hf) 0) 0 :=
(hderiv_diff 0).hasDerivAt
have hslope :
Filter.Tendsto (fun t : ℝ => deriv Hf t / t)
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (deriv (deriv Hf) 0)) := by
have h := hasDerivAt_iff_tendsto_slope.mp hd2
have hsl : ∀ t : ℝ, slope (deriv Hf) 0 t = deriv Hf t / t := by
intro t
simp [slope_def_field, hd0]
exact Filter.Tendsto.congr hsl h
have hnum : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1))
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 0) := by
have hcont : Filter.Tendsto Hf (nhds (0 : ℝ)) (nhds (Hf 0)) :=
hdiffHf.continuous.tendsto 0
have hconst : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhds (0 : ℝ)) (nhds 1) :=
tendsto_const_nhds
have hsub : Filter.Tendsto (fun t : ℝ => Hf t - 1) (nhds (0 : ℝ))
(nhds (Hf 0 - 1)) := hcont.sub hconst
have hmul : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1)) (nhds (0 : ℝ))
(nhds (2 * (Hf 0 - 1))) := hsub.const_mul (2 : ℝ)
rw [h1] at hmul
simpa using hmul.mono_left nhdsWithin_le_nhds
have hden : Filter.Tendsto (fun t : ℝ => t ^ 2)
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 0) := by
have h := (continuous_pow 2).tendsto (0 : ℝ)
simpa using h.mono_left nhdsWithin_le_nhds
have hff' : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ),
HasDerivAt (fun s : ℝ => 2 * (Hf s - 1)) (2 * deriv Hf t) t := by
filter_upwards with t
simpa using ((hdiffHf t).hasDerivAt.sub_const 1).const_mul (2 : ℝ)
have hgg' : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ),
HasDerivAt (fun s : ℝ => s ^ 2) (2 * t) t := by
filter_upwards with t
simpa [mul_comm] using hasDerivAt_pow 2 t
have hg'ne : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), (2 : ℝ) * t ≠ 0 := by
filter_upwards [self_mem_nhdsWithin] with t ht
have htne : t ≠ 0 := ht
positivity
have hdiv :
Filter.Tendsto (fun t : ℝ => (2 * deriv Hf t) / (2 * t))
(nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (deriv (deriv Hf) 0)) := by
refine Filter.Tendsto.congr' ?_ hslope
filter_upwards [self_mem_nhdsWithin] with t ht
have htne : t ≠ 0 := ht
field_simp
exact HasDerivAt.lhopital_zero_nhdsNE hff' hgg' hg'ne hnum hden hdiv
The identity's role
The cost uniqueness theorem in the machine-checked library of formal theorems states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof's main route is analytic: it transforms the problem into log coordinates, where the function must satisfy a differential equation whose unique smooth solution is the hyperbolic cosine. The declaration Jcost_cosh_add_identity is a small but essential closing step: it verifies that the proposed solution J itself satisfies the same composition law that the proof used to derive it.
The identity states that J obeys the CoshAddIdentity, the log-coordinate form of the composition law: G(t+u) + G(t-u) = 2(G(t)G(u) + G(t) + G(u)), where G(t) = J(e^t). This is the same equation that the proof's main theorem, composition_law_equiv_coshAdd, shows is equivalent to the original composition law. The declaration confirms that the cost function J is not merely a candidate that happens to solve the differential equation; it is actually a solution to the original problem's defining condition.
Without this identity, the proof would show that any cost satisfying the five conditions must equal J, but it would not show that J itself satisfies those conditions. The identity closes that loop, ensuring the theorem's conclusion is not vacuous. It also provides a concrete check that the analytic route and the algebraic route agree: the differential equation's solution and the composition law's solution are the same function.
In Recognition Science, the framework models recognition as a forced cost, and the identity confirms the model's consistency. The page should include this declaration as a supporting lemma, not as a main result. It is a verification step that strengthens the proof's endgame, but it does not carry the theorem's weight. A reader who wants to see the full argument can find it in the chain of declarations leading to law_of_logic_forces_jcost.
THEOREM Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_cosh_add_identity : CoshAddIdentity Cost.Jcost := by
intro t u
simp only [G, Jcost]
-- Use exp(t+u) = exp(t)*exp(u) and exp(t-u) = exp(t)/exp(u)
have he1 : Real.exp (t + u) = Real.exp t * Real.exp u := Real.exp_add t u
have he2 : Real.exp (t - u) = Real.exp t / Real.exp u := by
rw [sub_eq_add_neg, Real.exp_add, Real.exp_neg]
ring
have hpos_t : Real.exp t > 0 := Real.exp_pos t
have hpos_u : Real.exp u > 0 := Real.exp_pos u
have hne_t : Real.exp t ≠ 0 := hpos_t.ne'
have hne_u : Real.exp u ≠ 0 := hpos_u.ne'
rw [he1, he2]
field_simp
ring
THEOREM CoshAddIdentity · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The cosh-type functional identity for `G_F`. -/
def CoshAddIdentity (F : ℝ → ℝ) : Prop :=
∀ t u : ℝ,
G F (t+u) + G F (t-u) = 2 * (G F t * G F u) + 2 * (G F t + G F u)
THEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G.
Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y)
becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t)
via the substitution x = e^s, y = e^t. -/
theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) :
SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by
constructor
· intro hComp t u
have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t
have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u
have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos
-- exp(t) * exp(u) = exp(t + u)
have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm
-- exp(t) / exp(u) = exp(t - u)
have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by
rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg]
simp only [G, h1, h2] at h ⊢
linarith
· intro hCosh x y hx hy
let t := Real.log x
let u := Real.log y
have hx_eq : x = Real.exp t := (Real.exp_log hx).symm
have hy_eq : y = Real.exp u := (Real.exp_log hy).symm
have h := hCosh t u
simp only [G] at h
rw [hx_eq, hy_eq]
rw [← Real.exp_add, ← Real.exp_sub]
-- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u))
-- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u)
calc F (Real.exp (t + u)) + F (Real.exp (t - u))
= 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h
_ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ring
The calibration bridge
The cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. The proof in the machine-checked library of formal theorems reaches this conclusion by a chain of analytic steps: it transforms the problem into log coordinates, derives a differential equation, and then solves that equation. The declaration isCalibrated_of_isCalibratedLimit is not part of this main route. It is a bridge between two different formal definitions of the same concept, and the question is whether that bridge earns a place on the page.
The main theorem law_of_logic_forces_jcost takes five hypotheses, one of which is hCalib : IsCalibrated F. This is the exact, pointwise definition of calibration: the cost function's value at a point equals its limit as the argument approaches that point. But in the library's development, calibration is often introduced through a different, limit-based definition, isCalibratedLimit, which says the cost function's value at a point is the limit of its values as the argument approaches that point from a specific direction. The lemma isCalibrated_of_isCalibratedLimit proves that the limit-based definition implies the exact one, under the right continuity conditions.
This matters because the main theorem's proof relies on the exact definition. If a reader or a formal proof begins with the limit-based definition, the lemma is the bridge that lets them cross to the exact one and apply the theorem. Without it, there is a gap: the limit-based definition alone does not obviously give the pointwise equality the theorem demands. The lemma closes that gap, making the theorem applicable to a wider class of starting points.
For the encyclopedia page, the lemma is a supporting detail, not a headline. The page's story is about the five conditions and the unique cost they force. The lemma is a technical bridge within the proof, useful for a reader who wants to see how the formal development handles the two definitions of calibration. It does not change the theorem's statement or its conclusion. It is a piece of the proof's infrastructure, and it earns its place only if the page already discusses the proof's structure in enough detail to make the bridge meaningful.
In the framework's account, the lemma is one more link in the chain that makes the uniqueness theorem airtight. It shows that the formal development is careful about its definitions, and that the theorem's hypotheses are not hiding an unstated assumption. For a reader who wants to trust the theorem, that care is part of the evidence. For a reader who wants the theorem's statement and its consequences, the lemma is a detail best left to the proof's full exposition.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique
reciprocal cost satisfying the RCL, normalization, calibration, and continuity.
This version uses the global Aczél axiom internally and requires NO regularity
hypothesis parameters from the caller. -/
theorem law_of_logic_forces_jcost (F : ℝ → ℝ)
[AczelSmoothnessPackage]
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
intro x hx
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
rw [hNorm]; ring
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t
exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by
have : Gf t + 1 = Real.cosh t := h_H_cosh t
linarith
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simp only [hJG]
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simp [ht]
THEOREM law_of_logic_forces_jcost_with_regularization · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem 1.1 (Main Result, Reformulated)**:
Let F : ℝ₊ → ℝ satisfy:
1. Reciprocity: F(x) = F(1/x)
2. Normalization: F(1) = 0
3. Composition Law: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y)
4. Calibration: lim_{t→0} 2F(e^t)/t² = 1
5. Continuity and regularity hypotheses
Then F = J on ℝ₊, where J(x) = (x + 1/x)/2 - 1.
This theorem corresponds to Theorem 1.1 in:
J. Washburn & M. Zlatanović, "Uniqueness of the Canonical Reciprocal Cost" -/
theorem law_of_logic_forces_jcost_with_regularization (F : ℝ → ℝ)
(hRecip : IsReciprocalCost F)
(hNorm : IsNormalized F)
(hComp : SatisfiesCompositionLaw F)
(hCalib : IsCalibrated F)
(hCont : ContinuousOn F (Set.Ioi 0))
-- Regularity hypotheses (from Aczél theory)
(h_smooth : dAlembert_continuous_implies_smooth_hypothesis (H F))
(h_ode : dAlembert_to_ODE_hypothesis (H F))
(h_cont : ode_regularity_continuous_hypothesis (H F))
(h_diff : ode_regularity_differentiable_hypothesis (H F))
(h_boot : ode_linear_regularity_bootstrap_hypothesis (H F)) :
∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by
-- The proof follows the structure of T5_uniqueness_complete:
-- 1. Convert composition law to CoshAddIdentity on G
-- 2. Shift to H = G + 1 to get standard d'Alembert equation
-- 3. Apply Aczél's theorem: continuous d'Alembert solutions are cosh
-- 4. Calibration H''(0) = 1 selects cosh (not cos or constant)
-- 5. Unshift: G = cosh - 1, hence F = J
intro x hx
-- Convert hypotheses to the required format
have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy
have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp
-- Step 1: Set up G and H
let Gf : ℝ → ℝ := G F
let Hf : ℝ → ℝ := H F
-- Step 2: Derive key properties of G and H
have h_G_even : Function.Even Gf := G_even_of_reciprocal_symmetry F hSymm
have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm
have h_H0 : Hf 0 = 1 := by
show H F 0 = 1
simp only [H, G, Real.exp_zero]
-- Goal is F 1 + 1 = 1, and hNorm says F 1 = 0
rw [hNorm]
ring
-- Step 3: G is continuous (F continuous on (0,∞), exp continuous)
have h_G_cont : Continuous Gf := by
have h := ContinuousOn.comp_continuous hCont continuous_exp
have h' : Continuous (fun t => F (Real.exp t)) :=
h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t))
simp [Gf, G] at h'
exact h'
have h_H_cont : Continuous Hf := by
simpa [Hf, H] using h_G_cont.add continuous_const
-- Step 4: Convert CoshAddIdentity to d'Alembert equation for H
have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd
have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by
intro t u
have hG := h_direct t u
have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by
calc (Gf (t + u) + 1) + (Gf (t - u) + 1)
= (Gf (t + u) + Gf (t - u)) + 2 := by ring
_ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG]
_ = 2 * (Gf t + 1) * (Gf u + 1) := by ring
simp [Hf, H, Gf] at h_goal
exact h_goal
-- Step 5: Second derivative condition
have h_H_d2 : deriv (deriv Hf) 0 = 1 := by
have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib
have hderiv : deriv Hf = deriv Gf := by
funext t
change deriv (fun y => Gf y + 1) t = deriv Gf t
simpa using (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ)))
have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv
exact (congrArg (fun g => g 0) hderiv2).trans hG_d2
-- Step 6: Apply d'Alembert uniqueness theorem
have h_H_cosh : ∀ t, Hf t = Real.cosh t :=
dAlembert_cosh_solution Hf h_H0 h_H_cont h_dAlembert h_H_d2
h_smooth h_ode h_cont h_diff h_boot
-- Step 7: Unshift to get G = cosh - 1
have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := by
intro t
have hH := h_H_cosh t
have hH' : Gf t + 1 = Real.cosh t := by simpa [Hf, H, Gf] using hH
linarith
-- Step 8: Convert back via log parametrization
have ht : Real.exp (Real.log x) = x := Real.exp_log hx
have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 :=
Jcost_G_eq_cosh_sub_one (Real.log x)
calc F x
= F (Real.exp (Real.log x)) := by rw [ht]
_ = Gf (Real.log x) := rfl
_ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x)
_ = G Cost.Jcost (Real.log x) := by simpa using hJG.symm
_ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G]
_ = Cost.Jcost x := by simpa [ht]
What this page does not claim
This answer does not claim that dropping even_deriv_at_zero alone breaks the proof while reciprocal symmetry remains intact, since reciprocal symmetry implies it. This answer does not claim that the d'Alembert equation has no other continuous solutions; the general solution family is stated without proof. This answer does not claim that the uniqueness theorem fails without the AczelSmoothnessPackage, only that the stated proof uses it. cosh_satisfies_differentiable is not a statement about the cost function itself, only about the candidate solution. The declaration does not replace the continuity hypothesis in the main uniqueness theorem. The regularity package is not part of the five plain conditions stated on the page. DirectCoshAdd is not a new axiom; it is equivalent to the composition law. This answer does not derive the full uniqueness proof from the five conditions. The log-coordinate reparametrization is not claimed to be unique among all possible coordinate changes. Not claiming that dAlembert_double is an axiom or a hypothesis of the uniqueness theorem. Not claiming that dropping dAlembert_double would change the set of functions satisfying the five conditions. Not claiming that the composition law is the only route to the cost function; the theorem also requires reciprocal symmetry, normalization, calibration, and continuity. This lemma does not by itself prove that H is cosh. This lemma does not establish the existence of log-curvature; it only uses it as a hypothesis. Not claiming that dropping CoshAddIdentity alone makes the theorem false; it is equivalent to dropping the composition law. Not claiming that the remaining four conditions are insufficient in some other proof route not present in the pack. Not claiming that CoshAddIdentity is an independent axiom; it is a derived equivalence. This answer does not claim that continuity alone forces the differential equation. This answer does not claim that the Aczél smoothness package is derived from the five stated axioms. This answer does not claim that the uniqueness lemma is a standalone result independent of the cost framework. Not claiming that cosh_dAlembert_to_ODE is a new result about the cost function itself; it is a regularity check on the model solution. Not claiming that the five regularity hypotheses are derived from the five cost axioms; they are an additional package drawn from Aczél theory. Not claiming that the page's uniqueness proof is invalid without this lemma; the claim is that its presence makes the proof self-contained. cosh_initials is not a premise of the uniqueness theorem. cosh_initials does not by itself force the cost function to be J. The page does not claim that cosh_initials is the only route to the initial conditions. Not claiming that evenness alone proves the uniqueness theorem. Not claiming that the zero-derivative condition is an axiom of the framework. This answer does not claim that deriv_neg_self_zero is a theorem about the cost function J. This answer does not claim that deriv_neg_self_zero is the only way to rule out the zero solution. The paper does not add a Lean-verified proof of its scale-selection or carrier-classification results. The six exponentials theorem is used as a named hypothesis rather than proved in the paper. The paper does not show that the completed real line has a least positive cost. This answer does not claim that dropping the lemma would leave the uniqueness theorem false; it only describes the dependency structure. This answer does not claim that the lemma is an independent axiom of the framework. The lemma ode_zero_uniqueness is not one of the five axioms that force the cost function. This answer does not claim that the zero-solution lemma alone proves the uniqueness theorem without the other hypotheses. This answer does not claim that the CoshAddIdentity itself is the composition law, only that the two are equivalent in log coordinates. This answer does not claim that the identity alone forces J; it is one step in a chain that also requires the other four conditions. The algebraic gate does not replace the analytic proof on the cost uniqueness page. The gate does not introduce new physical content beyond the existing cost uniqueness theorem. This answer does not claim that ode_cosh_uniqueness_contdiff is the main forcing theorem; it is a supporting lemma. This answer does not claim that the differential equation alone determines cosh without the initial conditions. This answer does not claim that the lemma applies to functions that are not twice continuously differentiable. This answer does not claim that even_deriv_at_zero is a theorem about the cost function itself. This answer does not claim that the uniqueness proof is complete without the regularity hypotheses from the Aczél smoothness package. This answer does not claim that the lemma even_deriv_at_zero appears in the evidence pack as a standalone declaration. The lemma is not needed for the current machine-checked proof. The lemma does not change the statement of the cost uniqueness theorem. This theorem alone does not establish the affine-response property; it assumes it as a hypothesis. The theorem does not derive the value of the constant c from the analytic step; it uses the normalization P 1 1 = 6 to fix c = 2. This answer does not claim that cosh_satisfies_continuous alone proves the uniqueness theorem. This answer does not claim that the continuity of cosh is an assumption rather than a established theorem. This answer does not claim that the cost uniqueness proof is complete without the other regularity lemmas. This answer does not claim that dAlembert_continuous_of_log_curvature is used in the page's proof. This answer does not claim that log-curvature alone is sufficient for the full forcing theorem. This answer does not claim that ode_regularity_differentiable_of_smooth is a theorem about the cost function itself. This answer does not claim that the declaration appears as a named premise in ode_cosh_uniqueness. This answer does not claim that taylorWithinEval_one_univ is false or unusable in other contexts. This answer does not claim that the cost uniqueness proof avoids all use of Taylor expansions in its regularity hypotheses. CoshAddIdentity is not a new assumption; it is equivalent to the composition law. This answer does not prove that the five conditions are independent of each other. Not claimed that dropping cosh_initials would produce a different valid cost function. Not claimed that cosh_initials is the only source of boundary conditions in the forcing chain. This answer does not claim the d'Alembert route is the main proof of the cost uniqueness theorem. This answer does not claim the d'Alembert route is simpler or more general than the ODE route. This answer does not claim the cost uniqueness page should be modified to include the d'Alembert theorem. The identity Jcost_cosh_add_identity being false would not merely weaken the proof; it would make the library inconsistent. This answer does not claim that the proof would fail if only the identity were dropped but other theorems remained. This answer does not claim that the composition law alone, without the other four conditions, forces the cost function to be J. The proof of the cost uniqueness theorem is not invalidated by dropping normalization; it simply no longer applies. The family F_c(x) = cosh(c * ln x) - 1 is not claimed to be a complete classification of all solutions without normalization. The gate alone does not fix the constant c; the normalization P(1, 1) = 6 is required. This theorem does not prove the cost uniqueness result itself; it is one algebraic step in that proof. The gate does not imply the differential equation H'' = H; the two are complementary parts of the forcing chain. This answer does not claim that the cost uniqueness theorem is false without the smoothness hypothesis, only that its proof is incomplete. This answer does not claim that the d'Alembert equation admits non-cosh solutions that also satisfy the calibration condition. This answer does not claim that the AczelSmoothnessPackage is derivable from the five plain conditions. The cost uniqueness theorem itself is not proved here; this section only examines one hypothesis within its proof. The existence of pathological solutions is not demonstrated; the claim is only that the proof would not rule them out without differentiability. cosh_satisfies_continuous is not a claim about the cost function itself, only about the candidate solution cosh. The declaration does not prove the uniqueness of the cost function; it only provides a regularity witness. The five conditions are not claimed to be the only possible axioms for a cost function. The theorem does not claim that any real-world process satisfies the five conditions. The page does not claim that the forcing theorem replaces the need for the existing lemma-based proof. The declaration dAlembert_cosh_solution_aczel alone proves the full cost uniqueness theorem without the five-axiom frame. The d'Alembert equation has only the hyperbolic cosine solutions without the continuity and calibration conditions. The declaration cosh_second_deriv_eq is not a new theorem but a necessary step in the existing proof chain. The page does not claim that the differential equation alone selects cosh without initial conditions. The cost uniqueness theorem would be false if cosh_second_deriv_eq were dropped. The d'Alembert equation by itself is insufficient to force the unique solution. The machine-checked library contains a proof of the cost uniqueness theorem that bypasses the differential equation route. The bridge theorem is the only route to continuity; the library may contain other lemmas that also provide it. The five plain conditions are sufficient without the regularity bridge; the proof requires continuity as an additional hypothesis. The d'Alembert equation has no discontinuous solutions; it has many, and the theorem selects the continuous ones. This answer does not claim that the cost uniqueness theorem is false or unproved; it only describes what would break if a specific lemma were removed. This answer does not claim that the differential equation H'' = H has no solutions other than cosh; it explicitly states that it has many solutions. This answer does not claim that the framework's predictions about the golden ratio or three spatial dimensions are derived solely from the cost uniqueness theorem. The d'Alembert equation alone forces a unique solution. The doubling identity is sufficient to prove cost uniqueness without the other conditions. The lemma dAlembert_double is the only route from the functional equation to the differential equation. The lemma tendsto_H_one_of_log_curvature is not used in the main proof of the cost uniqueness theorem. The lemma does not by itself prove the cost uniqueness theorem. The lemma does not establish that the log-curvature limit is 1; it only shows continuity given the limit exists. The dAlembert_diff_square lemma itself does not mention costs or recognition. The lemma does not prove the cost uniqueness theorem on its own; it is one step in the proof. The lemma does not require the function H to be continuous or differentiable. The combiner result is not part of the cost uniqueness proof itself. The four gate conditions are not derived from the five cost uniqueness conditions on this page. This answer does not claim that deriv_neg_self_zero alone proves the cost uniqueness theorem. This answer does not claim that the cosine solution is the only solution ruled out by the lemma. This answer does not claim that the lemma is the only boundary condition used in the uniqueness proof. The ODE route is the only path to the cost uniqueness theorem. The differential equation H'' = H alone forces a unique solution without initial conditions. The d'Alembert route avoids all regularity assumptions. The lemma itself does not solve the differential equation or identify the hyperbolic cosine as the unique solution. The lemma does not state that every function satisfying the direct addition identity is a cost function. Not claiming the reciprocal condition alone forces the cost function to J(x); it is only one of five premises. Not claiming the reciprocal condition is a derived theorem rather than a definitional choice. This lemma is not a new theorem; it is a definitional bridge. The page's main proof does not depend on this lemma. The lemma does not prove the cost uniqueness theorem by itself. The lemma is not used in the machine-checked proof of cost uniqueness. The lemma does not contribute to the derivation of the cost function J(x) = (x + 1/x)/2 - 1. The gate theorem alone does not prove the full cost uniqueness result; it requires the affine-response step as a premise. The gate route does not replace the differential equation proof; it is a complementary algebraic derivation. This page does not claim that the gate theorem is used in the main machine-checked proof of cost uniqueness. DirectCoshAdd is a new theorem that the library did not already prove via the composition law. The direct identity route is the one the machine-checked proof actually uses to reach the final uniqueness result. The direct identity alone, without the log-curvature calibration, forces the cosh solution. The lemma ode_zero_uniqueness does not by itself prove the cost uniqueness theorem; it is one step in a longer chain. The lemma does not apply to functions that are not twice-differentiable. This answer does not claim that the cost uniqueness theorem fails without reciprocal symmetry; it claims only that the proof chain breaks at the evenness step. This answer does not claim that the d'Alembert equation has no unique solution without evenness; it claims only that the framework's proof route requires it. The calibration condition is not derived from more basic principles; it is one of the five plain conditions. The theorem does not claim that the calibration condition is the only way to select the hyperbolic cosine solution. This answer does not claim that the calibration condition is the only condition needed for uniqueness. This answer does not claim that the lemma is the only place where the proof could fail. This answer does not claim that the framework derives the value of the calibration constant from the composition law alone. Uniqueness outside the positive real numbers. A proof of the Aczel classification without the stated regularity package. An empirical fit of J to measured laboratory values. This answer does not claim that the d'Alembert equation has no other continuous solutions, only that the regularity conditions select the smooth one. This answer does not claim that dropping Jcost_G_eq_cosh_sub_one would invalidate the composition law itself, only that the proof of uniqueness would fail. The factorization gate is not used in the machine-checked proof of the cost uniqueness theorem. The gate does not derive the five cost conditions or the differential equation; it is a separate algebraic result. This page does not claim the gate is the only alternative route to the cost formula. CoshAddIdentity alone forces the cost function; the equivalence theorem requires the composition law as a premise. The d'Alembert equation route avoids the need for regularity hypotheses; the theorem explicitly lists them. The page claims the identity is the only way to prove uniqueness; the ODE route remains available. The d'Alembert route is an alternative proof of the full cost uniqueness theorem, including all five conditions. The declaration dAlembert_even is used in the main proof of cost uniqueness. The d'Alembert route is simpler or more direct than the ODE route used in the main proof. The gate replaces the differential equation proof of cost uniqueness. The gate alone derives the affine-response step from factorization. The gate establishes the five plain conditions that force J(x). The differential equation H'' = H alone, without the two initial conditions, does not force the unique solution. The proof does not claim that every solution to the d'Alembert equation is continuous without the log-curvature input. The lemma does not apply to the one-sided log-curvature used in the main proof. A nonzero two-sided log-curvature is impossible, but a nonzero one-sided log-curvature is what the framework uses. The lemma alone does not prove the cost uniqueness theorem; it only rules out a simpler two-sided calibration route. This page does not prove that every solution of d'Alembert's equation is continuous; that requires the log-curvature hypothesis. This page does not claim that the evenness lemma alone forces the cosh solution; it only supplies the zero derivative initial condition. This page does not claim that the cost uniqueness theorem holds without the five plain conditions, including the composition law and calibration. The composition law alone forces the cost function without the other four conditions. The d'Alembert equation has a unique solution without the calibration condition. The composition law is derived from more basic principles within the framework. The page's proof uses deriv_exp_neg as a step. The cost uniqueness theorem is derived without any analytic assumptions. The declaration deriv_exp_neg is specific to the Recognition Science framework. The declaration jcost_hasLogCurvature_one is an extra assumption beyond the five conditions. The log-curvature check is the only way to verify the calibration condition. The declaration proves the cost uniqueness theorem on its own. The second initial condition is derived from the five plain conditions. Dropping the condition leads to a contradiction or inconsistency in the framework. The log-curvature of the original cost function F at x = 1 is 1; the value 1 applies to the transformed function H(t) = F(e^t). The lemma hasLogCurvature_full_filter_forces_zero alone forces the log-curvature to be 1; it only forces the limit to be 0, and the value 1 comes from the differential equation. The calibration value 1 is derived from the five conditions alone without the smoothness package; the proof uses the AczelSmoothnessPackage. The differentiability check alone does not prove the cost uniqueness theorem; it only certifies that cosh is a valid candidate solution. This answer does not claim that the hyperbolic cosine is the only function satisfying the differential equation without the regularity hypotheses. The Taylor lemma is useless or incorrect; it is simply unused in this proof. The cost proof relies on Taylor expansion at any step. The declaration does not prove the five conditions force the cost function by itself; it only proves the uniqueness of the ODE solution. The declaration does not establish the regularity hypotheses; it assumes them as inputs. The page does not claim the differential equation route is the only proof route in the library. The bridge theorem is not used in the main proof of the cost uniqueness theorem. The bridge theorem does not by itself identify the constant deriv (deriv H) 0 with 1. The page does not claim the bridge theorem is the only route from the d'Alembert equation to a differential equation. The paper does not replace the kernel-checked Lean proof. The paper does not claim that the broader Recognition Science framework is needed for this mathematical theorem. The optional machine-check artifact is not the foundation of the paper's argument. The analytic differential equation proof is not affected by dropping the gate; it stands on its own. The gate is not the only route to the cost uniqueness; the analytic route remains. The cost uniqueness theorem itself is not proved false by dropping the gate; it would still hold via the analytic route. The proof would fail entirely if cosh_satisfies_continuous were dropped; it would only lose one specific route to the result. The continuity of cosh is the only regularity fact needed for the proof. The cost uniqueness theorem is false without the continuity condition on the cost function. The d'Alembert equation alone, without evenness, forces H to be cosh. The framework's library proves cost uniqueness without the evenness condition. The reciprocal symmetry condition is the only source of evenness in the proof. The bridge lemma is not a deep mathematical discovery; it is a definitional unfolding. Dropping the bridge lemma does not affect the truth of the composition law itself. The cost uniqueness theorem does not depend on the bridge lemma being a separate axiom; it is derived from definitions. The page does not claim that ode_diagonalization is incorrect or unused elsewhere in the library. The page does not claim that the proof of the cost uniqueness theorem is the only possible proof. The page does not claim that ode_diagonalization is the same as ode_cosh_uniqueness. This answer does not claim that dAlembert_product is false or that the theorem fails. This answer does not claim that the five conditions are the only ones that could force J. This answer does not claim that the cost uniqueness theorem is the only route to the golden ratio in the framework. The lemma sub_one_eq_mul_ratio is part of the main proof chain. The cost uniqueness theorem depends on the lemma sub_one_eq_mul_ratio. The lemma sub_one_eq_mul_ratio is false or redundant in the library. The lemma ode_zero_uniqueness is not a hypothesis but a proved theorem. The cost uniqueness theorem does not depend on the lemma being true as a matter of logic; it depends on it being proved in the library. The failure of the lemma would not make the cost function J false; it would only break the proof that J is the unique solution. The declaration ode_regularity_continuous_of_smooth is never used in the main proof. The page does not present the regularization version of the theorem. This answer does not claim that cosh_dAlembert_smooth proves the d'Alembert equation's continuity-to-smoothness implication for all functions. This answer does not claim that the cost uniqueness theorem holds without the five plain conditions. The diff-square lemma alone proves the cost uniqueness theorem; it is one link in a longer chain. The lemma holds for all functions satisfying the cosine addition formula without any regularity assumptions. The cost uniqueness theorem is false if the lemma is dropped; rather, the proof loses its analytic bridge. The doubling identity alone does not force the unique cost function; it is a necessary condition, not a sufficient one. This answer does not claim that dAlembert_double is used in the proof of law_of_logic_forces_jcost. The page does not claim that the cosine addition formula has no other continuous solutions without the regularity assumptions. The theorem Jcost_G_eq_cosh_sub_one alone proves the cost uniqueness theorem; it is one step in a longer chain. The hyperbolic cosine is the only solution to d'Alembert's equation; it is the unique continuous solution with the given initial conditions. The analytic step of the cost uniqueness proof is not proved by gate_forces_rcl; it is a separate, prior result. The theorem does not show that the gate conditions are necessary for the RCL polynomial, only that they are sufficient. The framework's full forcing chain from cost to the golden ratio is not re-derived here; only the algebraic keystone is examined. G_zero_of_unit is not a premise of the main cost uniqueness theorem. The combiner P(u,v) is not the cost function J(x). The zero boundary law does not by itself force the cost function J(x). The lemma taylorWithinEval_two_univ is not needed for the proof, but it is not claimed to be false or irrelevant elsewhere. This answer does not claim that the d'Alembert equation is the only route to the cost uniqueness theorem. This answer does not prove that the d'Alembert equation's continuous solutions are exactly cosh(kt). This answer does not claim that the cost uniqueness theorem is derived without the smoothness hypothesis. This answer does not describe the full chain of theorems leading from the cost function to the hyperbolic cosine. This answer does not claim that deriv_pos_self_zero is false or malformed. This answer does not claim that the cost uniqueness proof is the only route to J(x). This answer does not claim that the d'Alembert equation alone forces the solution without the regularity hypotheses. The lemma alone does not prove the cost uniqueness theorem. The lemma does not require or imply any smoothness or continuity assumptions. The product identity alone forces the cost function J(x). The product identity is a new assumption beyond the addition formula. The page's proof is incomplete without the product identity. Calibration alone forces the cost function; it requires the other four conditions as well. The log-curvature limit existing at any value other than 0 is possible; the lemma forces only the limit value, not the existence. The d'Alembert equation's solutions include pathological discontinuous ones without the continuity hypothesis. This answer does not claim that cosh_initials alone proves the cost uniqueness theorem. This answer does not claim that the d'Alembert equation has cosh as its only solution without the initial conditions. The declaration dAlembert_cosh_solution is not used in the main proof of the cost uniqueness theorem. The d'Alembert equation alone, without the second-derivative condition, does not force the specific solution cosh(t) rather than cosh(kt) for a general k. The framework does not claim priority over d'Alembert's 1747 discovery. This answer does not claim that the d'Alembert equation alone forces the hyperbolic cosine; the log-curvature condition is essential. This answer does not claim that the theorem proves the cost function is unique without the other four conditions. This answer does not claim that the log-curvature condition is derived from the other four conditions; it is an independent hypothesis. The declaration dAlembert_to_ODE_theorem is not a proved theorem but a hypothesis in the library. The page does not claim that the d'Alembert equation alone forces the cost function; it requires the full set of five conditions. The bridge declaration does not itself solve the differential equation; it only connects the algebraic and analytic stages. The theorem dAlembert_cosh_solution_aczel does not require the zero derivative condition as a separate hypothesis. The failure of deriv_pos_self_zero does not imply that no cost function exists, only that uniqueness is lost. This answer does not claim that the calibration condition is the only way to select k = 1. The page does not claim that the five-condition theorem is wrong or that the redundancy invalidates the proof. The page does not claim that log curvature is a more natural or more fundamental condition than normalization. The page does not claim that the library will be restructured to use the shorter proof. IsNormalized alone forces Jcost; the other four conditions are still required. The d'Alembert equation's scaled solutions cosh(kt) are costs in the framework's sense. The framework derives the normalization condition from more basic principles. The lemma dAlembert_diff_square alone does not prove the cost uniqueness theorem; it is one step in a longer chain. The page does not claim that the d'Alembert equation is the only path to the uniqueness result. The d'Alembert product law itself is a classical result, not a Recognition Science discovery. The product law alone, without the other four conditions, does not force the cost function to be J. The proof that the composition law implies the differential equation requires additional regularity assumptions beyond continuity. The regularization variant does not prove a new or stronger theorem. The page does not claim that the five explicit hypotheses are independent of each other. The page does not claim that the regularization variant is the preferred statement for all purposes. The lemma logCurvature_eq_deriv2 is not used in the main proof of the cost uniqueness theorem. The page does not claim that the logarithmic curvature is the only way to state the calibration condition. DirectCoshAdd being false would not necessarily mean no cost function satisfies the other conditions. The proof does not require DirectCoshAdd to be an independent axiom; it is derived from the composition law. The theorem law_of_logic_forces_jcost_with_regularization uses different hypotheses and is not a substitute for the DirectCoshAdd bridge. The declaration rclCombiner_satisfies_gate is not a step in the analytic proof of the cost uniqueness theorem. The gate alone does not determine the constant 2 in the RCL combiner; the normalization P(1, 1) = 6 is needed. The lemma deriv_pos_self_zero does not by itself prove the cost uniqueness theorem. The lemma does not establish that the cost function is globally positive, only in a neighborhood of zero. The lemma does not apply to functions without a second derivative at zero. The identity alone does not prove the cost uniqueness theorem; it is a supporting lemma. The identity does not show that J is the only function satisfying the composition law. The identity does not establish the physical interpretation of the cost function. The lemma isCalibrated_of_isCalibratedLimit is not part of the main proof route of the cost uniqueness theorem. The lemma does not change the statement or the conclusion of the theorem. The lemma does not appear in the evidence pack, so its exact statement and proof are not detailed here.
Verify this page
Every tagged claim above names its theorem. To check one yourself rather than trust this page, elaborate the source module with Lean 4 and audit its axiom basis:
$ lake env lean IndisputableMonolith/Cost/FunctionalEquation.lean
$ lake env lean IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
expected axiom basis: [propext, Classical.choice, Quot.sound] (the Lean kernel's standard three; no RS-specific axioms)
A page whose claims cannot be reproduced this way does not ship. In production, every anchor links to the exact declaration in the public source release, and this block carries the build receipt for the page itself.
Derived articles
This page is generated by a question-recursion engine: the questions its answers raise become the next pages. The current agenda, with open targets marked red:
- What exactly is the AczelSmoothnessPackage and which regularity hypotheses does it bundle?
- Does the log-curvature calibration condition alone, without the zero derivative, admit any non-cosh solutions under weaker regularity assumptions?
- How does the degenerate solution H(t) = 0 to the d'Alembert equation fail the normalization or calibration axioms?
- What is the role of the five regularity hypotheses in the d'Alembert solution theorem beyond continuity?
- How does the Aczél smoothness package bridge from continuity to differentiability in the uniqueness proof?
- What is the log-curvature calibration and why does it select the value one?
- Which other regularity hypotheses does the Aczél package contain and how are they discharged for cosh?
- How does the log-curvature calibration condition relate to the original calibration condition in the five plain conditions?
- What role does the d'Alembert equation play in proving uniqueness of the hyperbolic cosine?
- How does the addition identity generalize to other cost functions that satisfy weaker conditions?
- Which other lemmas in the uniqueness proof are consequences of the composition law rather than independent assumptions?
- What is the minimal set of algebraic consequences of the composition law needed to reach the d'Alembert equation?
- How does the d'Alembert equation solution force the cost function to be exactly J(x) = (x + 1/x)/2 - 1?
- How does the continuity at zero combine with the d'Alembert equation to force the differential equation H'' = H?
- What role does the lemma ode_zero_uniqueness play in ruling out other solutions to the differential equation?
- How does the lemma dAlembert_cosh_solution_aczel use the continuity at zero to conclude H is cosh?
- What is the exact family of cost functions that survive the other four conditions when the composition law is dropped?
- Does the log-coordinate reparametrization G_F(t) = F(exp t) have a direct physical interpretation in the ledger?
- Can the composition law be replaced by a different structural rule that still forces the same J(x)?
- How does the Aczél smoothness package convert the d'Alembert equation into the second-order ODE?
- What exactly does the regularity package assume beyond continuity, and is it minimal?
- How does the initial condition H'(0) = 0 follow from the reciprocal symmetry axiom?
- Does the same ODE uniqueness lemma apply to the cost function in higher dimensions?
- Which of the other four regularity hypotheses has a corresponding verification lemma for Real.cosh, and are all five present in the library?
- Does the Aczél smoothness package itself provide the bridge from continuity to smoothness without needing each hypothesis verified separately for cosh?
- What would the uniqueness proof lose if cosh_dAlembert_to_ODE were removed from the library?
- How does the proof derive the initial condition deriv H 0 = 0 from the reciprocal symmetry axiom?
- What regularity hypotheses are needed to pass from the d'Alembert equation to the differential equation?
- Does the uniqueness proof require any initial conditions beyond the two verified by cosh_initials?
- How does evenness combine with the composition law to force the full cosh solution?
- What role does the log-coordinate reparametrization play in making the symmetry visible?
- Does the evenness lemma hold for any reciprocal cost function, or only under the Aczél smoothness package?
- What is the exact statement of deriv_neg_self_zero in the Lean source?
- How does ode_zero_uniqueness differ from deriv_neg_self_zero in its hypotheses?
- Which lemmas in the proof of ode_cosh_uniqueness_contdiff are considered load-bearing for the page?
- Can the paper's leastness principle and countable-carrier classification be formalized in Lean without importing the six exponentials theorem as an unproved hypothesis?
- What structural fact about recognition forces the physical carrier to be countable rather than the completed real line?
- Can nondegeneracy be derived from the framework instead of assumed as a condition on admissible costs?
- What would the uniqueness proof require if the curvature condition were replaced by a weaker local condition?
- Which other lemmas in the chain from composition law to cosh also depend on continuity at 0?
- How does the Aczél regularity package bridge from continuity to the second derivative needed for the ODE?
- How does the zero-solution lemma combine with the regularity hypotheses to close the uniqueness argument?
- What is the precise statement of the differential equation that H satisfies before uniqueness is applied?
- Which other lemmas in the proof chain depend on the same differential-equation uniqueness argument?
- How does the CoshAddIdentity relate to the d'Alembert equation used in the uniqueness proof?
- What role does the log-coordinate reparametrization play in converting the composition law into the identity?
- How does the equivalence composition_law_equiv_coshAdd fit into the overall forcing chain from the five conditions to J?
- How does the affine-response step in the algebraic gate relate to the analytic differential equation in the main proof?
- Does the algebraic gate offer any computational advantage over the analytic proof for practical verification?
- What are the four structural conditions of the factorization gate in plain terms?
- How does the proof of ode_cosh_uniqueness_contdiff proceed?
- What is the role of the smoothness assumption in the uniqueness result?
- How does the differential equation H'' = H arise from the composition law?
- What other solutions exist if the initial conditions are changed?
- How does the evenness of the log-coordinate function G F follow from the reciprocal symmetry condition?
- What is the role of the lemma tendsto_H_one_of_log_curvature in establishing the initial condition H(0) = 1?
- How does the composition law for the cost function translate into the d'Alembert equation for H?
- What regularity hypotheses are needed to pass from the d'Alembert equation to the differential equation H'' = H?
- What is the precise statement of isCalibratedLimit_of_isCalibrated?
- Does the limit formulation of calibration hold without the AczelSmoothnessPackage?
- Could the proof be reorganized to use the limit lemma and shorten the regularity assumptions?
- What analytic step establishes that the combiner must be affine in its second argument?
- How does the affine-response step connect to the differential equation in log coordinates?
- What role does the boundary law P u 0 = 2u play in the broader forcing chain?
- What other regularity hypotheses does the uniqueness theorem require beyond continuity?
- How does the proof establish the differentiability and bootstrap hypotheses for cosh?
- What is the role of the initial conditions H(0) = 1 and H'(0) = 0 in the uniqueness argument?
- Can the continuity hypothesis in law_of_logic_forces_jcost be replaced by log-curvature using dAlembert_continuous_of_log_curvature?
- What is the minimal set of hypotheses that forces the cosh solution without assuming continuity directly?
- What does the regularity hypothesis ode_regularity_differentiable_hypothesis state in plain terms?
- Which lemma in the library actually uses ode_regularity_differentiable_of_smooth as a step?
- How does the smoothness-to-differentiability bridge interact with the bootstrap hypothesis in the uniqueness proof?
- What is the precise statement of the Taylor lemma taylorWithinEval_one_univ?
- Which lemmas in the cost uniqueness proof actually use Taylor expansions, if any?
- Is there a version of the cost uniqueness proof that uses Taylor's theorem instead of the ODE uniqueness lemma?
- What does the log-curvature condition say in plain language, and how does it relate to calibration?
- Can the five conditions be weakened and still force the same cost function?
- What does the cosh addition rule look like when the cost is written directly as a function of the ratio, without logarithms?
- What other boundary conditions, if any, would also force the solution to be cosh?
- How does the uniqueness proof change if the smoothness assumption is weakened from twice continuously differentiable to merely continuous?
- What role do the Aczel smoothness hypotheses play in bridging from the d'Alembert equation to the second-order ODE?
- What is the precise equivalence between the composition law and the d'Alembert equation in log coordinates?
- Which regularity hypotheses are packaged into the d'Alembert route that are not needed for the ODE route?
- Does the d'Alembert route require fewer assumptions than the ODE route to reach the cosh conclusion?
- What are the five plain conditions that define a valid cost function?
- How does the proof show that the composition law is equivalent to the d'Alembert equation?
- What are the regularity conditions that select the cosh solution from the many solutions to the d'Alembert equation?
- What is the precise statement of the log-curvature condition and how does it calibrate the local scale of recognition?
- How does the composition law alone, without normalization, constrain the possible cost functions?
- What are the downstream consequences in the framework that depend on the uniqueness of J, such as the golden ratio and the eight-tick cycle?
- How does the affine-response step in the analytic proof connect to the algebraic gate's rightAffine condition?
- What role does the boundary law P(u, 0) = 2u play in the derivation of the bilinear family?
- Why is the normalization P(1, 1) = 6 the canonical choice rather than another value?
- What pathological continuous solutions of the d'Alembert equation exist without the smoothness hypothesis?
- Does the AczelSmoothnessPackage itself follow from the five plain cost conditions, or is it an additional assumption?
- Could a different regularity hypothesis replace the smoothness bridge and still yield the uniqueness result?
- How does the proof of law_of_logic_forces_jcost_with_regularization differ from the version without explicit regularity hypotheses?
- What are the pathological non-continuous solutions to the d'Alembert equation that the differentiability hypothesis rules out?
- How does the Aczél smoothness theorem bridge from continuity to infinite differentiability for solutions of the d'Alembert equation?
- What is the full list of regularity hypotheses required by the uniqueness theorem?
- How does the proof establish that the transformed function H satisfies the initial conditions?
- What is the role of the log-curvature condition in the proof?
- What regularity assumptions beyond continuity are needed to turn the differential equation H'' = H into the unique cosh solution?
- How does the forcing theorem relate to the d'Alembert equation route used elsewhere on the page?
- Which of the five conditions is the first to fail for a candidate cost that is not J?
- How does the calibration condition deriv (deriv H) 0 = 1 follow from the five plain axioms?
- What is the precise statement of the AczelSmoothnessPackage that makes the classical theorem applicable?
- How does the d'Alembert equation characterize the hyperbolic cosine among all continuous functions?
- How does the log-curvature calibration set the second derivative at zero to one?
- What regularity conditions are needed to pass from d'Alembert's equation to the ODE?
- Does the same bridge work for the cosine function with a sign change in the ODE?
- What is the precise statement of Aczél's smoothness theorem that the library invokes?
- Could a different bridge from the d'Alembert equation to a differential equation replace cosh_second_deriv_eq?
- Which other theorems in the framework depend on the same second-derivative fact?
- What are the explicit pathological solutions to the d'Alembert equation that the continuity hypothesis rules out?
- Does the smoothness package in the library require any axioms beyond the standard three?
- How does the Aczél theory establish that continuity implies smoothness for the d'Alembert equation?
- What alternative uniqueness theorems could replace ode_cosh_uniqueness_contdiff if the regularity assumptions were weakened?
- Does the forcing chain from the cost function to the golden ratio and three spatial dimensions depend on the specific form of the uniqueness theorem, or only on the fact that the cost function is unique?
- What would the cost function be if the initial condition H'(0) = 0 were replaced by a different value?
- What is the full statement of the d'Alembert equation and its classical solutions?
- How does the calibration condition fix the local scale of recognition near the identity?
- What are the five plain conditions that force the cost function J?
- How does the proof convert the functional equation into the differential equation H'' = H?
- How does the lemma tendsto_H_one_of_log_curvature relate to the continuity condition in the five cost axioms?
- Could the lemma support an alternative proof of the cost uniqueness theorem that avoids the differential equation route?
- What other properties does log-curvature force beyond continuity?
- How does the calibration condition turn the difference identity into a differential equation?
- What are the other functions, besides cosh, that satisfy the d'Alembert equation but fail the calibration condition?
- How does the proof of the d'Alembert equation from the composition law work in detail?
- How does the combiner result relate to the eight-tick cycle in the forcing chain?
- What physical interpretation does the boundary law P(u,0) = 2u carry in recognition terms?
- Does the combiner result extend to three or more simultaneous recognitions?
- What is the full statement of the lemma deriv_neg_self_zero in the machine-checked library?
- How does the lemma deriv_neg_self_zero connect to the five conditions of the cost uniqueness theorem?
- What is the role of the hyperbolic cosine in the cost uniqueness proof?
- What other lemmas in the library use the same technique of extracting a boundary condition from a differential equation?
- What regularity hypotheses does the d'Alembert route require that the ODE route does not?
- How does the proof of ode_cosh_uniqueness use the evenness of the difference function?
- What happens to the later theorems if the d'Alembert route also fails its regularity assumptions?
- How does the direct addition identity relate to the classical d'Alembert equation for the hyperbolic cosine?
- What regularity conditions are needed to pass from the addition identity to the differential equation?
- Does the lemma hold for any function, or only for those satisfying the cost axioms?
- What does the normalization condition contribute to the uniqueness proof?
- How does the composition law interact with the reciprocal condition to produce the d'Alembert equation?
- What is the role of the calibration condition in fixing the local scale of recognition?
- What is the direct algebraic proof of the cost uniqueness theorem that would use DirectCoshAdd?
- How does the cosine addition identity in log coordinates relate to the differential equation H'' = H?
- Which other lemmas in the library are used in the analytic proof that passes through the differential equation?
- What is the precise relationship between the restricted and unrestricted limit definitions of log-curvature?
- Does the unrestricted limit condition appear in any other part of the framework's library?
- How does the affine-response step follow from factorization plus three-way compatibility?
- What is the relationship between the differential equation route and the gate route in the full forcing chain?
- Does the gate theorem generalize to other algebraic structures beyond real numbers?
- Can the direct cosh identity route replace the ODE route in the machine-checked proof, or is the differential equation still needed for the final uniqueness step?
- What regularity class is exactly required for the direct identity to force the cosh solution without the ODE bootstrap?
- Is there a published classical theorem that the cosine addition identity plus log-curvature at zero uniquely determines cosh?
- What regularity conditions on the cost function are needed to justify the transformation into log coordinates?
- How does the d'Alembert functional equation relate to the differential equation H'' = H?
- What other uniqueness theorems for differential equations does the library provide?
- What other conditions in the cost uniqueness theorem are load-bearing in the same way as reciprocal symmetry?
- Does the evenness condition also follow from any of the other four conditions, or is it genuinely independent?
- What would the solution space look like if the composition law were dropped instead of the symmetry condition?
- What does the calibration condition mean physically in the Recognition Science framework?
- How does the calibration condition relate to the choice of units in the framework?
- What happens if the calibration condition is relaxed to a different value than 1?
- What is the precise statement of the calibration condition in the framework?
- How does the log-curvature condition relate to the second derivative of the transformed function?
- What other solutions to the differential equation H'' = H exist if the initial conditions are not fixed?
- What is the role of the composition law in the uniqueness proof beyond the differential equation?
- How does the framework derive the value 1 for the calibration constant from the five conditions?
- How does reciprocal symmetry become evenness after the substitution G(t) = F(exp t)?
- How does the Aczel regularity theorem classify continuous solutions of the d'Alembert equation?
- Why does unit log curvature select the scale H''(0) = 1 rather than another scale?
- Can the stated regularity package be replaced by a fully formal proof from weaker assumptions?
- How does the uniqueness of J price a prime number?
- What are the pathological solutions to the d'Alembert equation that the regularity conditions rule out?
- How does the log-curvature condition select k = 1 among the family of solutions?
- What exactly does the AczelSmoothnessPackage add to the continuity assumption?
- Does the analytic cost proof and the algebraic gate proof share any hidden assumption that would make them less independent than they appear?
- What physical interpretation, if any, does the combiner P(u,v) carry in the recognition framework?
- Can the gate conditions be weakened while still forcing the same polynomial?
- How does the d'Alembert equation route compare in length and clarity to the direct ODE route in the proof?
- What regularity hypotheses are needed for the d'Alembert equation to imply the ODE, and are they all satisfied by the cost function?
- Does the equivalence theorem hold for all functions or only those satisfying the composition law's positivity condition?
- What is the minimal regularity needed for the d'Alembert equation to imply the differential equation H'' = H?
- Does the d'Alembert route require the same five conditions as the main proof, or does it use a different set of hypotheses?
- What is the relationship between the log-curvature condition and the second derivative at 0 in the d'Alembert theorem?
- What is the B2 closure program and how does the gate fit into it?
- Does the algebraic gate route avoid any of the regularity assumptions needed by the analytic proof?
- What exactly does the log-curvature condition measure about a recognition cost near the identity?
- How does the d'Alembert equation encode the composition law in the original variable?
- What would happen if the calibration condition fixed a different second derivative at zero?
- What does the one-sided log-curvature condition mean geometrically for the shape of the cost function near x = 1?
- How does the d'Alembert equation encode the composition law after the logarithmic reparametrization?
- What pathological functions satisfy the composition law but fail the one-sided calibration condition?
- What is the precise statement of the Aczel smoothness package that the main theorem relies on?
- How does the log-curvature condition at 0 relate to the calibration condition on the original cost function?
- What are the pathological non-continuous solutions of d'Alembert's equation that the regularity hypotheses exclude?
- What does the calibration condition mean physically, and how is it measured in a recognition event?
- How does the d'Alembert equation connect to wave phenomena in the framework's account of physics?
- What other functional equations admit the same solution family, and how does the framework rule them out?
- Does the composition law have a natural interpretation in terms of composing recognition events sequentially?
- What regularity conditions are needed to pass from the d'Alembert equation to the differential equation H'' = H?
- How does the log-curvature condition select the value 1 for the second derivative at zero?
- What other proofs in the framework might benefit from the deriv_exp_neg lemma?
- Is there a purely algebraic route to the cost uniqueness theorem that avoids the analytic step?
- How does the algebraic route to uniqueness via the combiner P(u,v) relate to the analytic route through log-curvature?
- What is the precise statement of the composition law that the cost function must satisfy?
- What are the five plain conditions that force the cost function, and how does each one contribute to the proof?
- What regularity class is needed for the AczelSmoothnessPackage to supply the second initial condition?
- Does any physical interpretation select the zero derivative condition beyond mathematical convenience?
- What happens to the cost uniqueness proof if the second initial condition is replaced by a different value?
- What is the full proof that the composition law forces the differential equation H'' = H?
- How does the log-curvature value 1 relate to the golden ratio and the eight-tick cycle?
- What regularity assumptions are needed to pass from the composition law to the differential equation?
- What exactly is the AczelSmoothnessPackage and how does it bundle the regularity hypotheses?
- How does the framework derive the golden ratio and three spatial dimensions from the cost uniqueness theorem?
- What are the five plain conditions that the cost function must satisfy, and why are they each necessary?
- What regularity hypothesis turns the d'Alembert equation into the second-order ODE?
- Which five conditions on the cost function are genuinely independent?
- How does the calibration condition select the constant 1 in the ODE?
- How does the Aczél smoothness package differ from the explicit regularity hypotheses in ode_cosh_uniqueness?
- What is the minimal regularity needed to pass from the d'Alembert equation to the ODE?
- How does the differential equation route compare with the purely algebraic factorization route to the cost formula?
- What is the precise content of the AczelSmoothnessPackage typeclass that the main proof uses instead?
- Could the bridge theorem replace the regularity package in a future refactoring of the proof?
- Does the bridge theorem hold under weaker regularity assumptions than ContDiff ∞ H?
- How does the central-difference argument derive continuity and C2 regularity from the functional identity?
- Why does the sign of the curvature select a hyperbolic-cosine, cosine, or constant solution?
- Which assumptions in the paper correspond exactly to the hypotheses of the Lean uniqueness theorem?
- How can the paper's regularity-free argument be formalized and audited in Lean?
- What is the analytic proof of the differential equation H'' = H and how does it connect to the algebraic gate?
- Are there other algebraic gates that could replace the factorization gate and still force the RCL combiner?
- What are the five plain conditions for the cost uniqueness theorem and how do they map to the gate properties?
- What exactly is the AczelSmoothnessPackage and which of its hypotheses are used at each step of the proof?
- Are there known pathological solutions to the functional equation that the continuity condition rules out?
- Could the uniqueness theorem be proved with a weaker regularity assumption than full continuity?
- What is the role of the calibration condition in the proof, and does it interact with the continuity condition?
- What is the minimal regularity condition on H that, together with the d'Alembert equation and evenness, guarantees the differential equation H'' = H?
- Does the framework's library contain a non-analytic proof of cost uniqueness that does not pass through the d'Alembert equation?
- What happens to the cost uniqueness theorem if the calibration condition is weakened to allow any positive second derivative at zero?
- What regularity conditions are needed for the differential equation step after the bridge lemma?
- How does the composition law relate to the cosine addition formula in the original coordinates?
- What is the role of the calibration condition in the proof after the bridge lemma?
- What is the precise statement of ode_diagonalization in the library?
- Does the library contain a proof that uses ode_diagonalization instead of ode_cosh_uniqueness?
- What are the five plain conditions that force the cost function to equal J(x)?
- What are the five plain conditions that the cost uniqueness theorem requires?
- How does the log-curvature condition encode the second derivative at zero?
- What is the classical proof that continuous solutions of d'Alembert's equation are smooth?
- What would a counterexample to the uniqueness theorem look like if the regularity conditions were weakened?
- What is the full list of lemmas in the FunctionalEquation module that the cost uniqueness proof actually uses?
- Could the lemma sub_one_eq_mul_ratio serve in a future, more algebraic proof of the cost uniqueness theorem?
- Which other declarations in the module are similarly unused by the main theorem?
- What alternative analytic route could prove uniqueness without the ODE lemma?
- Does the Aczél smoothness package supply all regularity needed for the ODE step?
- Are there continuous solutions of the d'Alembert equation that are not smooth, and do they threaten the uniqueness claim?
- What does the regularization version of the theorem add beyond the main version?
- How does the proof derive the differential equation from the d'Alembert equation?
- What other regularity assumptions appear in the library's cost uniqueness proofs?
- What is the full statement of the smoothness hypothesis that cosh_dAlembert_smooth instantiates?
- How does the d'Alembert equation, together with smoothness, force the second derivative to equal the function itself?
- Which other functions satisfy the d'Alembert equation without the smoothness assumption?
- What is the minimal regularity assumption under which the diff-square lemma still holds?
- Does the diff-square lemma have a converse, and if so, what does it imply?
- Could a different algebraic identity replace the diff-square lemma and still yield the same ODE?
- Could the doubling identity support a fully algebraic proof of the cost uniqueness theorem, avoiding the differential equation?
- What other classical identities from the cosine addition formula appear in the framework's library?
- How does the regularity assumption in AczelSmoothnessPackage relate to the continuity condition in the main theorem?
- What are the five plain conditions on the cost function, and how does each one contribute to the uniqueness proof?
- What is the d'Alembert equation, and why does it characterize the hyperbolic cosine without calculus?
- How does the logarithmic change of variables transform the composition law into d'Alembert's equation?
- What pathological solutions to the d'Alembert equation exist when continuity is not assumed?
- What exactly is the hard analytic step that the algebraic half of the proof depends on?
- How does the RCL polynomial connect to the cost function J(x) in the full forcing chain?
- What would a combiner that satisfies only three of the four gate conditions look like?
- What is the exact statement of the zero boundary law for the combiner P(u,v)?
- Does the combiner P(u,v) appear elsewhere in the framework, outside the cost uniqueness proof?
- What other algebraic lemmas characterize the combiner P(u,v), and do any of them feed into the main forcing chain?
- What is the precise statement of taylorWithinEval_two_univ in the library?
- Which other lemmas in the library are unused by the main theorem chain?
- What exactly is the logarithmic change of variables that turns the composition law into d'Alembert's equation?
- What are the five plain conditions that the cost function must satisfy?
- How does the d'Alembert equation lead to the differential equation H'' = H?
- What is the role of the normalization condition H(0) = 1 in the proof?
- What is the precise statement of deriv_pos_self_zero?
- Which other declarations in the module are unused by the main proof chain?
- Does any theorem in the library depend on deriv_pos_self_zero?
- What other structural properties of the log-coordinate transform are used in the proof?
- How does the evenness lemma interact with the other four conditions in the full uniqueness proof?
- Is there a purely algebraic proof of the cost uniqueness theorem that avoids the differential equation entirely?
- Can the product identity replace the differential equation in the cost uniqueness proof?
- Does the product identity hold for all solutions of d'Alembert's equation, including discontinuous ones?
- What other algebraic consequences of the composition law remain unused in the framework's library?
- What is the physical interpretation of the log-curvature being exactly 1 at the recognition cost's zero point?
- Does the calibration condition have an independent justification, or is it chosen to match the desired solution?
- How does the analytic proof route on this page relate to the purely algebraic characterization of the combiner P(u,v)?
- How does the calibration condition set the free parameter k to 1 in the d'Alembert solution?
- What is the precise statement of the log-curvature condition that supplies the calibration?
- How does the proof bridge from the d'Alembert equation in log coordinates back to the original cost function J?
- What are the five plain conditions on the cost function that the uniqueness proof assumes?
- What regularity assumptions are bundled into the AczelSmoothnessPackage that the main proof uses?
- How does the framework derive the d'Alembert equation from its composition law without assuming differentiability?
- What is the classical proof that continuity alone forces the hyperbolic cosine family from the d'Alembert equation?
- What is the precise statement of Aczél's smoothness theorem that the library imports?
- How does the library handle the case where the log-curvature constant κ is not equal to 1?
- What are the pathological solutions to the d'Alembert equation that the continuity hypothesis rules out?
- What regularity conditions on H are exactly needed for the d'Alembert equation to imply smoothness?
- How does the calibration condition fix the second derivative at 0 to be 1?
- What is the full chain of declarations from the composition law to the final cost uniqueness theorem?
- What exactly does the calibration condition HasLogCurvature mean in physical terms for a recognition event?
- Could a different calibration condition select a different member of the cosh(kt) family?
- How does the zero derivative condition follow from the reciprocal symmetry of the cost function?
- What would the forcing chain look like if the cost were J_k for k not equal to 1?
- Could the main theorem be restated with four conditions plus log curvature calibration?
- What is the minimal set of conditions that forces the cost function J?
- Does the redundancy of normalization affect the philosophical claim that five plain conditions are needed?
- What exactly does the calibration condition contribute beyond normalization and the composition law?
- How does the proof use the continuity condition to rule out discontinuous solutions of the d'Alembert equation?
- What would a cost function satisfying the other four conditions but not normalization look like?
- What is the full proof that the d'Alembert equation plus a continuity condition implies the function is smooth?
- How does the composition law for a recognition cost translate exactly into the d'Alembert equation in log coordinates?
- What exactly is the Aczél smoothness package that the full uniqueness theorem relies on?
- How does the product law generalize to other functions that satisfy the addition formula?
- What is the physical interpretation of the log-curvature condition that selects the value 1?
- Are there non-smooth solutions to the d'Alembert equation that the uniqueness proof excludes?
- What exactly does the AczelSmoothnessPackage provide, and how does it relate to the five explicit hypotheses?
- Are there contexts in the framework where the package is unavailable and the explicit hypotheses are needed?
- Does the regularization variant make the theorem easier to apply in downstream proofs?
- What is the precise statement of the calibration condition in terms of the logarithmic curvature?
- How does the smoothness hypothesis in logCurvature_eq_deriv2 compare with the regularity assumptions in the main proof?
- Is there a version of logCurvature_eq_deriv2 that holds under weaker regularity assumptions?
- What is the precise role of the log curvature condition in the proof?
- Could a different bridge replace DirectCoshAdd and still force the cost function to be J(x)?
- What are the five plain conditions on the cost function, and which one is the composition law?
- How does the algebraic gate relate to the analytic differential equation route in the full cost uniqueness proof?
- What role does the boundary law P(u, 0) = 2u play in the physical interpretation of recognition cost?
- How does the local positivity from deriv_pos_self_zero combine with the composition law to establish full smoothness?
- What exactly does the AczelSmoothnessPackage contribute to the proof, and where does it come from?
- Which other lemmas in the FunctionalEquation module depend on deriv_pos_self_zero?
- What is the full chain of declarations that leads from the five conditions to the conclusion that J is the unique cost function?
- How does the analytic route through the differential equation connect to the algebraic route through the composition law?
- What regularity conditions are needed to ensure the differential equation has a unique solution?
- How does the cost uniqueness theorem relate to the framework's other forcing results, such as the golden ratio and the eight-tick cycle?
- What exactly does the limit-based definition of calibration require, and how does it differ from the exact definition in the main theorem?
- Are there other places in the library where the two definitions of calibration are used interchangeably, and does the bridge lemma cover all of them?
- Does the existence of this bridge lemma suggest that the limit-based definition is the more natural one to state in the theorem's hypotheses?
MACHINE LAYER · GROUNDED CLAIM TABLE · CLICK TO EXPAND
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The theorem law_of_logic_forces_jcost states that the five axioms together force J. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_deriv_zero : deriv H 0 = 0 := by have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt exact even_deriv_at_zero H h_even h_diff exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hypThe proof of that theorem relies on the d'Alembert solution theorem, which takes deriv H 0 = 0 as an explicit hypothesis. dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Lemma 2.1**: If F is reciprocal, then G(t) = F(e^t) is even. -/ theorem reciprocal_implies_G_even (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) : Function.Even (G F) := G_even_of_reciprocal_symmetry F (fun {x} hx => hRecip x hx)The reciprocal symmetry axiom is what supplies the zero derivative, since it forces the transformed function to be even. reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM cosh_satisfies_differentiable · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh is differentiable. -/ theorem cosh_satisfies_differentiable : ode_regularity_differentiable_hypothesis Real.cosh := by intro _ _ exact Real.differentiable_coshcosh_satisfies_differentiable states that the hyperbolic cosine satisfies the differentiability condition required by the regularity package. cosh_satisfies_differentiable · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThe declaration contributes to the proof of dAlembert_cosh_solution_of_log_curvature, which derives cosh from the d'Alembert equation plus a log-curvature calibration. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The uniqueness theorem forces the cost function to be J(x) = (x + 1/x)/2 - 1 from five conditions. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G. Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y) becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t) via the substitution x = e^s, y = e^t. -/ theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) : SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by constructor · intro hComp t u have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos -- exp(t) * exp(u) = exp(t + u) have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm -- exp(t) / exp(u) = exp(t - u) have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg] simp only [G, h1, h2] at h ⊢ linarith · intro hCosh x y hx hy let t := Real.log x let u := Real.log y have hx_eq : x = Real.exp t := (Real.exp_log hx).symm have hy_eq : y = Real.exp u := (Real.exp_log hy).symm have h := hCosh t u simp only [G] at h rw [hx_eq, hy_eq] rw [← Real.exp_add, ← Real.exp_sub] -- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u)) -- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u) calc F (Real.exp (t + u)) + F (Real.exp (t - u)) = 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h _ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ringThe theorem composition_law_equiv_coshAdd proves the composition law is equivalent to DirectCoshAdd in log coordinates. composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_cosh_add_identity : CoshAddIdentity Cost.Jcost := by intro t u simp only [G, Jcost] -- Use exp(t+u) = exp(t)*exp(u) and exp(t-u) = exp(t)/exp(u) have he1 : Real.exp (t + u) = Real.exp t * Real.exp u := Real.exp_add t u have he2 : Real.exp (t - u) = Real.exp t / Real.exp u := by rw [sub_eq_add_neg, Real.exp_add, Real.exp_neg] ring have hpos_t : Real.exp t > 0 := Real.exp_pos t have hpos_u : Real.exp u > 0 := Real.exp_pos u have hne_t : Real.exp t ≠ 0 := hpos_t.ne' have hne_u : Real.exp u ≠ 0 := hpos_u.ne' rw [he1, he2] field_simp ringThe theorem Jcost_cosh_add_identity verifies that the unique cost function J satisfies the addition identity. Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **The cost theorem on two premises.** The composition law and unit log curvature force `F = J` on the positives. Normalization, nonnegativity, and continuity are all conclusions rather than hypotheses; compare `law_of_logic_forces_jcost`, which assumes all of them. -/ theorem composition_logCurvature_forces_jcost [AczelSmoothnessPackage] (F : ℝ → ℝ) (hComp : SatisfiesCompositionLaw F) (hκ : HasLogCurvature (H F) 1) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by have hNorm : IsNormalized F := logCurvature_forces_normalized F hComp hκ have hN : F 1 = 0 := hNorm have hH0 : H F 0 = 1 := by simp [H, G, hN] have hCosh : CoshAddIdentity F := (composition_law_equiv_coshAdd F).mp hComp have hdA : ∀ t u, H F (t + u) + H F (t - u) = 2 * H F t * H F u := by intro t u have hG := hCosh t u have hgoal : (G F (t + u) + 1) + (G F (t - u) + 1) = 2 * (G F t + 1) * (G F u + 1) := by calc (G F (t + u) + 1) + (G F (t - u) + 1) = (G F (t + u) + G F (t - u)) + 2 := by ring _ = (2 * (G F t * G F u) + 2 * (G F t + G F u)) + 2 := by simpa [hG] _ = 2 * (G F t + 1) * (G F u + 1) := by ring simpa [H] using hgoal have hcont : Continuous (H F) := dAlembert_continuous_of_log_curvature (H F) hH0 hdA hκ have hsm : ContDiff ℝ ⊤ (H F) := aczel_dAlembert_smooth (H F) hH0 hcont hdA have heven : Function.Even (H F) := dAlembert_even (H F) hH0 hdA have hd0 : deriv (H F) 0 = 0 := even_deriv_at_zero (H F) heven (hsm.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) 0) have hd2 : deriv (deriv (H F)) 0 = 1 := deriv2_of_logCurvature (H F) hsm hH0 hd0 hκ have hcosh : ∀ t, H F t = Real.cosh t := dAlembert_cosh_solution_aczel (H F) hH0 hcont hdA hd2 intro x hx have hGc : G F (Real.log x) = Real.cosh (Real.log x) - 1 := by have h := hcosh (Real.log x) simp only [H] at h linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = G F (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := hGc _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The theorem composition_logCurvature_forces_jcost shows that the composition law with log-curvature calibration forces the cost to be exactly J. composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The main uniqueness theorem law_of_logic_forces_jcost proves the five conditions force the cost to be J. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_double · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_double (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (t : ℝ) : H (2 * t) = 2 * (H t)^2 - 1 := by have h := h_dAlembert t t have h' : H (t + t) = 2 * (H t)^2 - 1 := by -- H(2t) + H(0) = 2 H(t)^2 have h0 : H (t + t) + 1 = 2 * H t * H t := by simpa [h_one] using h have h1 : H (t + t) = 2 * H t * H t - 1 := by linarith simpa [pow_two, mul_assoc] using h1 simpa [two_mul] using h'dAlembert_double is a lemma derived from the composition law together with the normalization H 0 = 1, not a separate premise. dAlembert_double · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The main theorem law_of_logic_forces_jcost does not list dAlembert_double among its hypotheses. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G. Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y) becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t) via the substitution x = e^s, y = e^t. -/ theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) : SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by constructor · intro hComp t u have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos -- exp(t) * exp(u) = exp(t + u) have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm -- exp(t) / exp(u) = exp(t - u) have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg] simp only [G, h1, h2] at h ⊢ linarith · intro hCosh x y hx hy let t := Real.log x let u := Real.log y have hx_eq : x = Real.exp t := (Real.exp_log hx).symm have hy_eq : y = Real.exp u := (Real.exp_log hy).symm have h := hCosh t u simp only [G] at h rw [hx_eq, hy_eq] rw [← Real.exp_add, ← Real.exp_sub] -- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u)) -- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u) calc F (Real.exp (t + u)) + F (Real.exp (t - u)) = 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h _ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ringThe composition law is equivalent to a hyperbolic-cosine addition identity. composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM tendsto_H_one_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- Unit log curvature plus `H 0 = 1` give the two-sided limit at the origin. The curvature hypothesis lives on the punctured filter, so the value at the origin is supplied by `h_one` rather than assumed away. -/ lemma tendsto_H_one_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) {κ : ℝ} (h_calib : HasLogCurvature H κ) : Filter.Tendsto H (nhds 0) (nhds 1) := by have h_t2_div : Filter.Tendsto (fun t : ℝ => t^2 / 2) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (0 : ℝ)) := by have hfull : Filter.Tendsto (fun t : ℝ => t^2 / 2) (nhds (0 : ℝ)) (nhds (0 : ℝ)) := by simpa using ((continuous_pow 2).div_const 2).tendsto (0 : ℝ) exact hfull.mono_left nhdsWithin_le_nhds have h_prod : Filter.Tendsto (fun t => (t^2 / 2) * (2 * (H t - 1) / t^2)) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds ((0 : ℝ) * κ)) := h_t2_div.mul h_calib have h_sub : Filter.Tendsto (fun t => H t - 1) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (0 : ℝ)) := by have h_congr : ∀ t : ℝ, (t^2 / 2) * (2 * (H t - 1) / t^2) = H t - 1 := fun t => (sub_one_eq_mul_ratio H h_one t).symm simpa using (Filter.Tendsto.congr h_congr h_prod) have h_punct : Filter.Tendsto H (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 1) := by have h_const : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (1 : ℝ)) := tendsto_const_nhds simpa using h_sub.add h_const have h_cw : ContinuousWithinAt H ({(0 : ℝ)}ᶜ) 0 := by unfold ContinuousWithinAt rw [h_one] exact h_punct have h_ca : ContinuousAt H 0 := continuousWithinAt_compl_self.mp h_cw have h := h_ca.tendsto rwa [h_one] at hIf a function H has value 1 at 0, and if its log-curvature exists, then H(t) tends to 1 as t tends to 0. tendsto_H_one_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM tendsto_H_one_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- Unit log curvature plus `H 0 = 1` give the two-sided limit at the origin. The curvature hypothesis lives on the punctured filter, so the value at the origin is supplied by `h_one` rather than assumed away. -/ lemma tendsto_H_one_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) {κ : ℝ} (h_calib : HasLogCurvature H κ) : Filter.Tendsto H (nhds 0) (nhds 1) := by have h_t2_div : Filter.Tendsto (fun t : ℝ => t^2 / 2) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (0 : ℝ)) := by have hfull : Filter.Tendsto (fun t : ℝ => t^2 / 2) (nhds (0 : ℝ)) (nhds (0 : ℝ)) := by simpa using ((continuous_pow 2).div_const 2).tendsto (0 : ℝ) exact hfull.mono_left nhdsWithin_le_nhds have h_prod : Filter.Tendsto (fun t => (t^2 / 2) * (2 * (H t - 1) / t^2)) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds ((0 : ℝ) * κ)) := h_t2_div.mul h_calib have h_sub : Filter.Tendsto (fun t => H t - 1) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (0 : ℝ)) := by have h_congr : ∀ t : ℝ, (t^2 / 2) * (2 * (H t - 1) / t^2) = H t - 1 := fun t => (sub_one_eq_mul_ratio H h_one t).symm simpa using (Filter.Tendsto.congr h_congr h_prod) have h_punct : Filter.Tendsto H (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 1) := by have h_const : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (1 : ℝ)) := tendsto_const_nhds simpa using h_sub.add h_const have h_cw : ContinuousWithinAt H ({(0 : ℝ)}ᶜ) 0 := by unfold ContinuousWithinAt rw [h_one] exact h_punct have h_ca : ContinuousAt H 0 := continuousWithinAt_compl_self.mp h_cw have h := h_ca.tendsto rwa [h_one] at hThis is not an axiom; it is a derived theorem, established from the definition of HasLogCurvature together with the initial condition H(0) = 1. tendsto_H_one_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G. Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y) becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t) via the substitution x = e^s, y = e^t. -/ theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) : SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by constructor · intro hComp t u have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos -- exp(t) * exp(u) = exp(t + u) have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm -- exp(t) / exp(u) = exp(t - u) have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg] simp only [G, h1, h2] at h ⊢ linarith · intro hCosh x y hx hy let t := Real.log x let u := Real.log y have hx_eq : x = Real.exp t := (Real.exp_log hx).symm have hy_eq : y = Real.exp u := (Real.exp_log hy).symm have h := hCosh t u simp only [G] at h rw [hx_eq, hy_eq] rw [← Real.exp_add, ← Real.exp_sub] -- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u)) -- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u) calc F (Real.exp (t + u)) + F (Real.exp (t - u)) = 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h _ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ringCoshAddIdentity is the log-coordinate form of the composition law, and the theorem composition_law_equiv_coshAdd proves that a function satisfies the composition law if and only if it satisfies CoshAddIdentity. composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The theorem law_of_logic_forces_jcost proves that any cost function satisfying reciprocal symmetry, normalization, the composition law, calibration, and continuity must equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **The cost theorem on two premises.** The composition law and unit log curvature force `F = J` on the positives. Normalization, nonnegativity, and continuity are all conclusions rather than hypotheses; compare `law_of_logic_forces_jcost`, which assumes all of them. -/ theorem composition_logCurvature_forces_jcost [AczelSmoothnessPackage] (F : ℝ → ℝ) (hComp : SatisfiesCompositionLaw F) (hκ : HasLogCurvature (H F) 1) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by have hNorm : IsNormalized F := logCurvature_forces_normalized F hComp hκ have hN : F 1 = 0 := hNorm have hH0 : H F 0 = 1 := by simp [H, G, hN] have hCosh : CoshAddIdentity F := (composition_law_equiv_coshAdd F).mp hComp have hdA : ∀ t u, H F (t + u) + H F (t - u) = 2 * H F t * H F u := by intro t u have hG := hCosh t u have hgoal : (G F (t + u) + 1) + (G F (t - u) + 1) = 2 * (G F t + 1) * (G F u + 1) := by calc (G F (t + u) + 1) + (G F (t - u) + 1) = (G F (t + u) + G F (t - u)) + 2 := by ring _ = (2 * (G F t * G F u) + 2 * (G F t + G F u)) + 2 := by simpa [hG] _ = 2 * (G F t + 1) * (G F u + 1) := by ring simpa [H] using hgoal have hcont : Continuous (H F) := dAlembert_continuous_of_log_curvature (H F) hH0 hdA hκ have hsm : ContDiff ℝ ⊤ (H F) := aczel_dAlembert_smooth (H F) hH0 hcont hdA have heven : Function.Even (H F) := dAlembert_even (H F) hH0 hdA have hd0 : deriv (H F) 0 = 0 := even_deriv_at_zero (H F) heven (hsm.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) 0) have hd2 : deriv (deriv (H F)) 0 = 1 := deriv2_of_logCurvature (H F) hsm hH0 hd0 hκ have hcosh : ∀ t, H F t = Real.cosh t := dAlembert_cosh_solution_aczel (H F) hH0 hcont hdA hd2 intro x hx have hGc : G F (Real.log x) = Real.cosh (Real.log x) - 1 := by have h := hcosh (Real.log x) simp only [H] at h linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = G F (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := hGc _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The theorem composition_logCurvature_forces_jcost shows that composition plus a fixed log-curvature of 1 already forces the cost function to be J(x). composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ) (h_ODE : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := h_cont_hyp h_ODE have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0The lemma ode_cosh_uniqueness states that if a twice-differentiable function H satisfies H''(t) = H(t) for every t, starts at H(0) = 1, and has first derivative zero at zero, then H is exactly the hyperbolic cosine, cosh. ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ) (h_ODE : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := h_cont_hyp h_ODE have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0The proof in the machine-checked library first extracts continuity and differentiability from the equation itself, then promotes that regularity to twice-differentiability, and finally applies a standard uniqueness result for second-order linear ODEs. ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The uniqueness theorem for the cost function J(x) = (x + 1/x)/2 - 1 is established from five conditions: reciprocal symmetry, normalization, the composition law, calibration, and continuity. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM Jcost_G_eq_cosh_sub_one · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_G_eq_cosh_sub_one (t : ℝ) : G Cost.Jcost t = Real.cosh t - 1 := by simp only [G, Jcost] -- Jcost(exp t) = (exp t + exp(-t))/2 - 1 = cosh t - 1 have h1 : (Real.exp t)⁻¹ = Real.exp (-t) := by simp [Real.exp_neg] rw [h1, Real.cosh_eq]Applying ode_cosh_uniqueness then yields H = cosh, and translating back gives the cost function J. Jcost_G_eq_cosh_sub_one · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM cosh_dAlembert_to_ODE · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh satisfies the d'Alembert to ODE hypothesis. -/ theorem cosh_dAlembert_to_ODE : dAlembert_to_ODE_hypothesis Real.cosh := by intro _ _ _ _ exact cosh_second_deriv_eqThe declaration cosh_dAlembert_to_ODE proves that Real.cosh satisfies the hypothesis dAlembert_to_ODE_hypothesis, which turns the d'Alembert equation plus the initial condition deriv (deriv H) 0 = 1 into the full ODE deriv (deriv H) t = H t. cosh_dAlembert_to_ODE · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThe theorem dAlembert_cosh_solution_of_log_curvature shows that a function H satisfying the d'Alembert equation, having log curvature 1, and meeting five regularity hypotheses must equal Real.cosh. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The uniqueness theorem law_of_logic_forces_jcost forces the cost function to be J(x) = (x + 1/x)/2 - 1 from the five conditions of reciprocal symmetry, normalization, composition law, calibration, and continuity. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM cosh_initials · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem cosh_initials : Real.cosh 0 = 1 ∧ deriv (fun x => Real.cosh x) 0 = 0 := by constructor · simp [Real.cosh_zero] · have h := Real.deriv_cosh simp only [h, Real.sinh_zero]The declaration cosh_initials is a theorem in the machine-checked development that states two plain facts about the hyperbolic cosine: at zero it has value one, and its first derivative at zero is zero. cosh_initials · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ) (h_ODE : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := h_cont_hyp h_ODE have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0The theorem ode_cosh_uniqueness then uses those two initial conditions together with the differential equation to conclude H is cosh. ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM cosh_initials · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem cosh_initials : Real.cosh 0 = 1 ∧ deriv (fun x => Real.cosh x) 0 = 0 := by constructor · simp [Real.cosh_zero] · have h := Real.deriv_cosh simp only [h, Real.sinh_zero]The theorem is derived directly from the standard facts Real.cosh_zero and Real.deriv_cosh, so it carries no extra assumptions. cosh_initials · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Lemma 2.1**: If F is reciprocal, then G(t) = F(e^t) is even. -/ theorem reciprocal_implies_G_even (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) : Function.Even (G F) := G_even_of_reciprocal_symmetry F (fun {x} hx => hRecip x hx)Reciprocal symmetry forces the cost function in log coordinates to be even, so G(t) = G(-t). reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Lemma 2.1**: If F is reciprocal, then G(t) = F(e^t) is even. -/ theorem reciprocal_implies_G_even (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) : Function.Even (G F) := G_even_of_reciprocal_symmetry F (fun {x} hx => hRecip x hx)Evenness supplies the zero-derivative initial condition at t = 0 for the transformed function H. reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The uniqueness proof needs that initial condition, which is not one of the five stated axioms. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/ theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ) (h_diff : ContDiff ℝ 2 H) (h_ode : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) : ∀ t, H t = Real.cosh t := by let g := fun t => H t - Real.cosh t have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh have hg_ode : ∀ t, deriv (deriv g) t = g t := by intro t have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by ext s; apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by have hH_diff1 : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff rw [contDiff_succ_iff_deriv] at h_diff exact h_diff.2.2 have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by rw [Real.deriv_cosh]; exact Real.contDiff_sinh rw [h1]; apply deriv_sub · exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt · exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt rw [h2, h_ode t, cosh_second_deriv_eq t] have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero] have hg'0 : deriv g 0 = 0 := by have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0 intro t have := hg_zero t simp only [g] at this; linarithThe declaration deriv_neg_self_zero is a helper lemma in the machine-checked proof of ode_cosh_uniqueness_contdiff. ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/ theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ) (h_diff : ContDiff ℝ 2 H) (h_ode : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) : ∀ t, H t = Real.cosh t := by let g := fun t => H t - Real.cosh t have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh have hg_ode : ∀ t, deriv (deriv g) t = g t := by intro t have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by ext s; apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by have hH_diff1 : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff rw [contDiff_succ_iff_deriv] at h_diff exact h_diff.2.2 have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by rw [Real.deriv_cosh]; exact Real.contDiff_sinh rw [h1]; apply deriv_sub · exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt · exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt rw [h2, h_ode t, cosh_second_deriv_eq t] have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero] have hg'0 : deriv g 0 = 0 := by have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0 intro t have := hg_zero t simp only [g] at this; linarithThe uniqueness proof needs to show that the only solution with H 0 = 1 and deriv H 0 = 0 is cosh. ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The Lean uniqueness theorem proves that the cost function has the form J(x) = (x + 1/x)/2 - 1 once reciprocal symmetry, normalization, the composition law, calibration, and continuity are supplied. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean- DERIVED-UNFORMALIZEDOn the countable carrier, meaning the discrete family of ratios supported by the framework, the paper derives on paper that the cheapest cost which charges any distinction is the exponent-one member, the canonical cost above.
- DERIVED-UNFORMALIZEDThe paper also derives on paper that this leastness condition is equivalent to anchoring the cost at any one non-unit ratio, so the old anchor is identified as a consequence of the ordering rather than an independent physical choice.
- DERIVED-UNFORMALIZEDIt derives on paper that every nonnegative integer exponent gives an admissible cost, including even exponents, and that the zero-exponent sign cost charges nothing.
- DERIVED-UNFORMALIZEDIt also derives on paper that the completed real line has no cheapest positive exponent: costs can always be lowered by halving the exponent, while their infimum is the zero cost.
THEOREM tendsto_H_one_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- Unit log curvature plus `H 0 = 1` give the two-sided limit at the origin. The curvature hypothesis lives on the punctured filter, so the value at the origin is supplied by `h_one` rather than assumed away. -/ lemma tendsto_H_one_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) {κ : ℝ} (h_calib : HasLogCurvature H κ) : Filter.Tendsto H (nhds 0) (nhds 1) := by have h_t2_div : Filter.Tendsto (fun t : ℝ => t^2 / 2) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (0 : ℝ)) := by have hfull : Filter.Tendsto (fun t : ℝ => t^2 / 2) (nhds (0 : ℝ)) (nhds (0 : ℝ)) := by simpa using ((continuous_pow 2).div_const 2).tendsto (0 : ℝ) exact hfull.mono_left nhdsWithin_le_nhds have h_prod : Filter.Tendsto (fun t => (t^2 / 2) * (2 * (H t - 1) / t^2)) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds ((0 : ℝ) * κ)) := h_t2_div.mul h_calib have h_sub : Filter.Tendsto (fun t => H t - 1) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (0 : ℝ)) := by have h_congr : ∀ t : ℝ, (t^2 / 2) * (2 * (H t - 1) / t^2) = H t - 1 := fun t => (sub_one_eq_mul_ratio H h_one t).symm simpa using (Filter.Tendsto.congr h_congr h_prod) have h_punct : Filter.Tendsto H (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 1) := by have h_const : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (1 : ℝ)) := tendsto_const_nhds simpa using h_sub.add h_const have h_cw : ContinuousWithinAt H ({(0 : ℝ)}ᶜ) 0 := by unfold ContinuousWithinAt rw [h_one] exact h_punct have h_ca : ContinuousAt H 0 := continuousWithinAt_compl_self.mp h_cw have h := h_ca.tendsto rwa [h_one] at hThe lemma tendsto_H_one_of_log_curvature is a derived theorem, established from the definition of HasLogCurvature together with the initial condition H(0) = 1. tendsto_H_one_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_continuous_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_continuous_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) : Continuous H := by refine continuous_iff_continuousAt.2 ?_ intro t have h_lim_H : Filter.Tendsto H (nhds 0) (nhds 1) := tendsto_H_one_of_log_curvature H h_one h_calib have h_sum : Filter.Tendsto (fun u => H (t+u) + H (t-u)) (nhds 0) (nhds (2 * H t)) := by have h_prod : Filter.Tendsto (fun u => (2 * H t) * H u) (nhds 0) (nhds ((2 * H t) * (1 : ℝ))) := (tendsto_const_nhds.mul h_lim_H) have h_prod' : Filter.Tendsto (fun u => 2 * H t * H u) (nhds 0) (nhds (2 * H t)) := by simpa [mul_assoc] using h_prod have h_eq : (fun u => H (t+u) + H (t-u)) = fun u => 2 * H t * H u := by funext u exact h_dAlembert t u simpa [h_eq] using h_prod' have h_diff_sq : Filter.Tendsto (fun u => (H (t+u) - H (t-u))^2) (nhds 0) (nhds (0 : ℝ)) := by have h_u_sq : Filter.Tendsto (fun u => (H u)^2) (nhds 0) (nhds ((1 : ℝ)^2)) := by simpa [pow_two] using h_lim_H.mul h_lim_H have h_u_sq_sub : Filter.Tendsto (fun u => (H u)^2 - 1) (nhds 0) (nhds (0 : ℝ)) := by have h_const : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhds 0) (nhds (1 : ℝ)) := tendsto_const_nhds simpa using h_u_sq.sub h_const have h_const : Filter.Tendsto (fun _ : ℝ => 4 * ((H t)^2 - 1)) (nhds 0) (nhds (4 * ((H t)^2 - 1))) := tendsto_const_nhds have h_mul : Filter.Tendsto (fun u => (4 * ((H t)^2 - 1)) * ((H u)^2 - 1)) (nhds 0) (nhds (4 * ((H t)^2 - 1) * (0 : ℝ))) := h_const.mul h_u_sq_sub have h_eq : (fun u => (H (t+u) - H (t-u))^2) = (fun u => 4 * ((H t)^2 - 1) * ((H u)^2 - 1)) := by funext u exact dAlembert_diff_square H h_one h_dAlembert t u simpa [h_eq] using h_mul have h_abs : Filter.Tendsto (fun u => |H (t+u) - H (t-u)|) (nhds 0) (nhds (0 : ℝ)) := by have h_sqrt : Filter.Tendsto (fun u => Real.sqrt ((H (t+u) - H (t-u))^2)) (nhds 0) (nhds (Real.sqrt 0)) := (Real.continuous_sqrt.tendsto 0).comp h_diff_sq simpa [Real.sqrt_sq_eq_abs] using h_sqrt have h_diff : Filter.Tendsto (fun u => H (t+u) - H (t-u)) (nhds 0) (nhds (0 : ℝ)) := (tendsto_zero_iff_abs_tendsto_zero (f := fun u => H (t+u) - H (t-u))).2 h_abs have h_sum_diff : Filter.Tendsto (fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) (nhds 0) (nhds ((2 * H t) + (0 : ℝ))) := h_sum.add h_diff have h_twice : Filter.Tendsto (fun u => 2 * H (t+u)) (nhds 0) (nhds (2 * H t)) := by have h_sum_diff' : Filter.Tendsto (fun u => H (t+u) + H (t+u)) (nhds 0) (nhds (2 * H t)) := by have h_eq : (fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) = (fun u => H (t+u) + H (t+u)) := by funext u ring have h_sum_diff'' : Filter.Tendsto (fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) (nhds 0) (nhds (2 * H t)) := by simpa using h_sum_diff simpa [h_eq] using h_sum_diff'' simpa [two_mul] using h_sum_diff' have h_half : Filter.Tendsto (fun u => (2 * H (t+u)) / 2) (nhds 0) (nhds ((2 * H t) / 2)) := by have h_const : Filter.Tendsto (fun _ : ℝ => (1 / 2 : ℝ)) (nhds 0) (nhds (1 / 2 : ℝ)) := tendsto_const_nhds simpa [div_eq_mul_inv] using h_twice.mul h_const have h_at0 : Filter.Tendsto (fun u => H (t+u)) (nhds 0) (nhds (H t)) := by simpa using h_half have h_map : Filter.Tendsto H (Filter.map (fun u => t + u) (nhds 0)) (nhds (H t)) := (Filter.tendsto_map'_iff).2 h_at0 have h_tendsto : Filter.Tendsto H (nhds t) (nhds (H t)) := by simpa [map_add_left_nhds_zero] using h_map exact h_tendstoThe theorem dAlembert_continuous_of_log_curvature, which derives continuity of H from the composition law and the curvature condition, relies on this limit to establish continuity at 0. dAlembert_continuous_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The final theorem law_of_logic_forces_jcost, which forces the cost function to be J(x) = (x + 1/x)/2 - 1, depends on this chain. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Zero Uniqueness)**: The unique solution to f'' = f with f(0) = f'(0) = 0 is f = 0. -/ theorem ode_zero_uniqueness (f : ℝ → ℝ) (h_diff2 : ContDiff ℝ 2 f) (h_ode : ∀ t, deriv (deriv f) t = f t) (h_f0 : f 0 = 0) (h_f'0 : deriv f 0 = 0) : ∀ t, f t = 0 := by have ⟨h_minus, h_plus⟩ := ode_diagonalization f h_diff2 h_ode have h_diff1 : Differentiable ℝ f := h_diff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have h_deriv_contdiff : ContDiff ℝ 1 (deriv f) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff2 rw [contDiff_succ_iff_deriv] at h_diff2 exact h_diff2.2.2 have h_diff_deriv : Differentiable ℝ (deriv f) := h_deriv_contdiff.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) let g := fun s => deriv f s - f s let hf := fun s => deriv f s + f s have hg_diff : Differentiable ℝ g := h_diff_deriv.sub h_diff1 have hh_diff : Differentiable ℝ hf := h_diff_deriv.add h_diff1 have hg0 : g 0 = 0 := by simp [g, h_f0, h_f'0] have hh0 : hf 0 = 0 := by simp [hf, h_f0, h_f'0] have hg_deriv : ∀ t, deriv g t = -g t := h_minus have hh_deriv : ∀ t, deriv hf t = hf t := h_plus have hg_zero := deriv_neg_self_zero g hg_diff hg_deriv hg0 have hh_zero := deriv_pos_self_zero hf hh_diff hh_deriv hh0 intro t have hgt := hg_zero t have hht := hh_zero t simp only [g, hf] at hgt hht linarithThe declaration ode_zero_uniqueness is the lemma that performs this exclusion. ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Zero Uniqueness)**: The unique solution to f'' = f with f(0) = f'(0) = 0 is f = 0. -/ theorem ode_zero_uniqueness (f : ℝ → ℝ) (h_diff2 : ContDiff ℝ 2 f) (h_ode : ∀ t, deriv (deriv f) t = f t) (h_f0 : f 0 = 0) (h_f'0 : deriv f 0 = 0) : ∀ t, f t = 0 := by have ⟨h_minus, h_plus⟩ := ode_diagonalization f h_diff2 h_ode have h_diff1 : Differentiable ℝ f := h_diff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have h_deriv_contdiff : ContDiff ℝ 1 (deriv f) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff2 rw [contDiff_succ_iff_deriv] at h_diff2 exact h_diff2.2.2 have h_diff_deriv : Differentiable ℝ (deriv f) := h_deriv_contdiff.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) let g := fun s => deriv f s - f s let hf := fun s => deriv f s + f s have hg_diff : Differentiable ℝ g := h_diff_deriv.sub h_diff1 have hh_diff : Differentiable ℝ hf := h_diff_deriv.add h_diff1 have hg0 : g 0 = 0 := by simp [g, h_f0, h_f'0] have hh0 : hf 0 = 0 := by simp [hf, h_f0, h_f'0] have hg_deriv : ∀ t, deriv g t = -g t := h_minus have hh_deriv : ∀ t, deriv hf t = hf t := h_plus have hg_zero := deriv_neg_self_zero g hg_diff hg_deriv hg0 have hh_zero := deriv_pos_self_zero hf hh_diff hh_deriv hh0 intro t have hgt := hg_zero t have hht := hh_zero t simp only [g, hf] at hgt hht linarithIt states that if a twice continuously differentiable function f satisfies f'' = f, with f(0) = 0 and f'(0) = 0, then f is identically zero. ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The page's central claim, that any cost function meeting the five conditions must equal J, is already established by law_of_logic_forces_jcost. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_cosh_add_identity : CoshAddIdentity Cost.Jcost := by intro t u simp only [G, Jcost] -- Use exp(t+u) = exp(t)*exp(u) and exp(t-u) = exp(t)/exp(u) have he1 : Real.exp (t + u) = Real.exp t * Real.exp u := Real.exp_add t u have he2 : Real.exp (t - u) = Real.exp t / Real.exp u := by rw [sub_eq_add_neg, Real.exp_add, Real.exp_neg] ring have hpos_t : Real.exp t > 0 := Real.exp_pos t have hpos_u : Real.exp u > 0 := Real.exp_pos u have hne_t : Real.exp t ≠ 0 := hpos_t.ne' have hne_u : Real.exp u ≠ 0 := hpos_u.ne' rw [he1, he2] field_simp ringThe theorem Jcost_cosh_add_identity states that the cost function J(x) = (x + 1/x)/2 - 1 obeys a particular algebraic relation when its argument is expressed in log coordinates. Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_cosh_add_identity : CoshAddIdentity Cost.Jcost := by intro t u simp only [G, Jcost] -- Use exp(t+u) = exp(t)*exp(u) and exp(t-u) = exp(t)/exp(u) have he1 : Real.exp (t + u) = Real.exp t * Real.exp u := Real.exp_add t u have he2 : Real.exp (t - u) = Real.exp t / Real.exp u := by rw [sub_eq_add_neg, Real.exp_add, Real.exp_neg] ring have hpos_t : Real.exp t > 0 := Real.exp_pos t have hpos_u : Real.exp u > 0 := Real.exp_pos u have hne_t : Real.exp t ≠ 0 := hpos_t.ne' have hne_u : Real.exp u ≠ 0 := hpos_u.ne' rw [he1, he2] field_simp ringIn those coordinates, where a ratio x becomes the shift t = log x, the transformed cost G(t) = J(e^t) satisfies the identity G(t+u) + G(t-u) = 2 * G(t) * G(u) + 2 * (G(t) + G(u)) for all real t and u. Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G. Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y) becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t) via the substitution x = e^s, y = e^t. -/ theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) : SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by constructor · intro hComp t u have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos -- exp(t) * exp(u) = exp(t + u) have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm -- exp(t) / exp(u) = exp(t - u) have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg] simp only [G, h1, h2] at h ⊢ linarith · intro hCosh x y hx hy let t := Real.log x let u := Real.log y have hx_eq : x = Real.exp t := (Real.exp_log hx).symm have hy_eq : y = Real.exp u := (Real.exp_log hy).symm have h := hCosh t u simp only [G] at h rw [hx_eq, hy_eq] rw [← Real.exp_add, ← Real.exp_sub] -- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u)) -- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u) calc F (Real.exp (t + u)) + F (Real.exp (t - u)) = 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h _ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ringThe theorem composition_law_equiv_coshAdd proves the equivalence: a function satisfies the composition law if and only if its log-coordinate transform satisfies the CoshAddIdentity. composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/ theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ) (h_diff : ContDiff ℝ 2 H) (h_ode : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) : ∀ t, H t = Real.cosh t := by let g := fun t => H t - Real.cosh t have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh have hg_ode : ∀ t, deriv (deriv g) t = g t := by intro t have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by ext s; apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by have hH_diff1 : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff rw [contDiff_succ_iff_deriv] at h_diff exact h_diff.2.2 have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by rw [Real.deriv_cosh]; exact Real.contDiff_sinh rw [h1]; apply deriv_sub · exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt · exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt rw [h2, h_ode t, cosh_second_deriv_eq t] have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero] have hg'0 : deriv g 0 = 0 := by have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0 intro t have := hg_zero t simp only [g] at this; linarithThe lemma ode_cosh_uniqueness_contdiff then forces H to be cosh, which gives J as the unique cost. ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Canonical normalization selects the RCL member of the bilinear family. -/ theorem gate_forces_rcl (P : ℝ → ℝ → ℝ) (hGate : FactorizationAssociativityGate P) : ∀ u v, P u v = 2 * u * v + 2 * u + 2 * v := by obtain ⟨c, hc⟩ := gate_forces_bilinear_family P hGate have hc_two : c = 2 := by have h11 : P 1 1 = c * 1 * 1 + 2 * 1 + 2 * 1 := by simpa using hc 1 1 linarith [hGate.unitDiagonal, h11] intro u v calc P u v = c * u * v + 2 * u + 2 * v := hc u v _ = 2 * u * v + 2 * u + 2 * v := by rw [hc_two]The theorem gate_forces_rcl states that any combiner satisfying the factorization gate must equal the polynomial 2uv + 2u + 2v. gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM factorization_gate_iff_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Exact gate characterization: the factorization gate is equivalent to being the canonical RCL combiner. -/ theorem factorization_gate_iff_rcl (P : ℝ → ℝ → ℝ) : FactorizationAssociativityGate P ↔ ∀ u v, P u v = rclCombiner u v := by constructor · intro hGate u v rw [gate_forces_rcl P hGate u v] rfl · intro hP refine { symmetric := ?_ rightAffine := ?_ zeroBoundary := ?_ unitDiagonal := ?_ } · intro u v rw [hP u v, hP v u] unfold rclCombiner ring · intro u refine ⟨2 * u + 2, 2 * u, ?_⟩ intro v rw [hP u v] unfold rclCombiner ring · intro u rw [hP u 0] unfold rclCombiner ring · rw [hP 1 1] unfold rclCombiner norm_numThe theorem factorization_gate_iff_rcl packages this as an equivalence: the gate holds if and only if the combiner is the canonical RCL polynomial. factorization_gate_iff_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/ theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ) (h_diff : ContDiff ℝ 2 H) (h_ode : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) : ∀ t, H t = Real.cosh t := by let g := fun t => H t - Real.cosh t have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh have hg_ode : ∀ t, deriv (deriv g) t = g t := by intro t have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by ext s; apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by have hH_diff1 : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff rw [contDiff_succ_iff_deriv] at h_diff exact h_diff.2.2 have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by rw [Real.deriv_cosh]; exact Real.contDiff_sinh rw [h1]; apply deriv_sub · exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt · exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt rw [h2, h_ode t, cosh_second_deriv_eq t] have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero] have hg'0 : deriv g 0 = 0 := by have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0 intro t have := hg_zero t simp only [g] at this; linarithIf a function H is twice continuously differentiable, if its second derivative equals the function itself at every point, if H(0) = 1, and if the first derivative at zero is 0, then H is the hyperbolic cosine function cosh. ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Zero Uniqueness)**: The unique solution to f'' = f with f(0) = f'(0) = 0 is f = 0. -/ theorem ode_zero_uniqueness (f : ℝ → ℝ) (h_diff2 : ContDiff ℝ 2 f) (h_ode : ∀ t, deriv (deriv f) t = f t) (h_f0 : f 0 = 0) (h_f'0 : deriv f 0 = 0) : ∀ t, f t = 0 := by have ⟨h_minus, h_plus⟩ := ode_diagonalization f h_diff2 h_ode have h_diff1 : Differentiable ℝ f := h_diff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have h_deriv_contdiff : ContDiff ℝ 1 (deriv f) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff2 rw [contDiff_succ_iff_deriv] at h_diff2 exact h_diff2.2.2 have h_diff_deriv : Differentiable ℝ (deriv f) := h_deriv_contdiff.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) let g := fun s => deriv f s - f s let hf := fun s => deriv f s + f s have hg_diff : Differentiable ℝ g := h_diff_deriv.sub h_diff1 have hh_diff : Differentiable ℝ hf := h_diff_deriv.add h_diff1 have hg0 : g 0 = 0 := by simp [g, h_f0, h_f'0] have hh0 : hf 0 = 0 := by simp [hf, h_f0, h_f'0] have hg_deriv : ∀ t, deriv g t = -g t := h_minus have hh_deriv : ∀ t, deriv hf t = hf t := h_plus have hg_zero := deriv_neg_self_zero g hg_diff hg_deriv hg0 have hh_zero := deriv_pos_self_zero hf hh_diff hh_deriv hh0 intro t have hgt := hg_zero t have hht := hh_zero t simp only [g, hf] at hgt hht linarithThe lemma even_deriv_at_zero states a plain fact about a function that is even and twice continuously differentiable: if its value at zero is zero and its derivative at zero is zero, then the function is identically zero. ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Zero Uniqueness)**: The unique solution to f'' = f with f(0) = f'(0) = 0 is f = 0. -/ theorem ode_zero_uniqueness (f : ℝ → ℝ) (h_diff2 : ContDiff ℝ 2 f) (h_ode : ∀ t, deriv (deriv f) t = f t) (h_f0 : f 0 = 0) (h_f'0 : deriv f 0 = 0) : ∀ t, f t = 0 := by have ⟨h_minus, h_plus⟩ := ode_diagonalization f h_diff2 h_ode have h_diff1 : Differentiable ℝ f := h_diff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have h_deriv_contdiff : ContDiff ℝ 1 (deriv f) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff2 rw [contDiff_succ_iff_deriv] at h_diff2 exact h_diff2.2.2 have h_diff_deriv : Differentiable ℝ (deriv f) := h_deriv_contdiff.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) let g := fun s => deriv f s - f s let hf := fun s => deriv f s + f s have hg_diff : Differentiable ℝ g := h_diff_deriv.sub h_diff1 have hh_diff : Differentiable ℝ hf := h_diff_deriv.add h_diff1 have hg0 : g 0 = 0 := by simp [g, h_f0, h_f'0] have hh0 : hf 0 = 0 := by simp [hf, h_f0, h_f'0] have hg_deriv : ∀ t, deriv g t = -g t := h_minus have hh_deriv : ∀ t, deriv hf t = hf t := h_plus have hg_zero := deriv_neg_self_zero g hg_diff hg_deriv hg0 have hh_zero := deriv_pos_self_zero hf hh_diff hh_deriv hh0 intro t have hgt := hg_zero t have hht := hh_zero t simp only [g, hf] at hgt hht linarithThe lemma ode_zero_uniqueness states that if a twice continuously differentiable function f satisfies deriv (deriv f) t = f t for all t, with f 0 = 0 and deriv f 0 = 0, then f is identically zero. ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/ theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ) (h_diff : ContDiff ℝ 2 H) (h_ode : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) : ∀ t, H t = Real.cosh t := by let g := fun t => H t - Real.cosh t have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh have hg_ode : ∀ t, deriv (deriv g) t = g t := by intro t have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by ext s; apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by have hH_diff1 : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff rw [contDiff_succ_iff_deriv] at h_diff exact h_diff.2.2 have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by rw [Real.deriv_cosh]; exact Real.contDiff_sinh rw [h1]; apply deriv_sub · exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt · exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt rw [h2, h_ode t, cosh_second_deriv_eq t] have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero] have hg'0 : deriv g 0 = 0 := by have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0 intro t have := hg_zero t simp only [g] at this; linarithThe differential equation H'' = H, together with the initial conditions H(0) = 1 and H'(0) = 0, has exactly one solution: the hyperbolic cosine. ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The cost uniqueness theorem states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The machine-checked proof of cost uniqueness does not currently use this lemma. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThe proof instead reaches a differential equation H'' = H for the transformed function H(t) = F(e^t) + 1, and solves it using the d'Alembert functional equation and regularity hypotheses. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Canonical normalization selects the RCL member of the bilinear family. -/ theorem gate_forces_rcl (P : ℝ → ℝ → ℝ) (hGate : FactorizationAssociativityGate P) : ∀ u v, P u v = 2 * u * v + 2 * u + 2 * v := by obtain ⟨c, hc⟩ := gate_forces_bilinear_family P hGate have hc_two : c = 2 := by have h11 : P 1 1 = c * 1 * 1 + 2 * 1 + 2 * 1 := by simpa using hc 1 1 linarith [hGate.unitDiagonal, h11] intro u v calc P u v = c * u * v + 2 * u + 2 * v := hc u v _ = 2 * u * v + 2 * u + 2 * v := by rw [hc_two]The theorem gate_forces_rcl states that if P satisfies symmetry, affine response, the boundary law, and the normalization, then P must equal 2uv + 2u + 2v. gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM gate_forces_bilinear_family · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Once the affine-response step is known, symmetry and the boundary law force the entire bilinear family. -/ theorem gate_forces_bilinear_family (P : ℝ → ℝ → ℝ) (hGate : FactorizationAssociativityGate P) : ∃ c : ℝ, ∀ u v, P u v = c * u * v + 2 * u + 2 * v := by classical choose α β hAffine using hGate.rightAffine have hβ : ∀ u, β u = 2 * u := by intro u have h0 : P u 0 = α u * 0 + β u := hAffine u 0 rw [hGate.zeroBoundary u] at h0 linarith let c : ℝ := α 1 - 2 refine ⟨c, ?_⟩ intro u v have hsym1 : P u 1 = P 1 u := hGate.symmetric u 1 have hαu : α u = c * u + 2 := by dsimp [c] have hcalc : α u * 1 + β u = α 1 * u + β 1 := by calc α u * 1 + β u = P u 1 := by symm; exact hAffine u 1 _ = P 1 u := hGate.symmetric u 1 _ = α 1 * u + β 1 := hAffine 1 u rw [hβ u, hβ 1] at hcalc linarith calc P u v = α u * v + β u := hAffine u v _ = (c * u + 2) * v + 2 * u := by rw [hαu, hβ u] _ = c * u * v + 2 * u + 2 * v := by ringThe theorem gate_forces_bilinear_family first shows that symmetry and the boundary law force P to be of the form c*u*v + 2u + 2v for some constant c. gate_forces_bilinear_family · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM factorization_gate_iff_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Exact gate characterization: the factorization gate is equivalent to being the canonical RCL combiner. -/ theorem factorization_gate_iff_rcl (P : ℝ → ℝ → ℝ) : FactorizationAssociativityGate P ↔ ∀ u v, P u v = rclCombiner u v := by constructor · intro hGate u v rw [gate_forces_rcl P hGate u v] rfl · intro hP refine { symmetric := ?_ rightAffine := ?_ zeroBoundary := ?_ unitDiagonal := ?_ } · intro u v rw [hP u v, hP v u] unfold rclCombiner ring · intro u refine ⟨2 * u + 2, 2 * u, ?_⟩ intro v rw [hP u v] unfold rclCombiner ring · intro u rw [hP u 0] unfold rclCombiner ring · rw [hP 1 1] unfold rclCombiner norm_numThe theorem factorization_gate_iff_rcl states that satisfying the gate is equivalent to being the canonical RCL combiner. factorization_gate_iff_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM cosh_satisfies_continuous · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh is continuous. -/ theorem cosh_satisfies_continuous : ode_regularity_continuous_hypothesis Real.cosh := by intro _ exact Real.continuous_coshThe lemma cosh_satisfies_continuous states, in plain terms, that the hyperbolic cosine function is continuous on the real line. cosh_satisfies_continuous · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/ theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ) (h_diff : ContDiff ℝ 2 H) (h_ode : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) : ∀ t, H t = Real.cosh t := by let g := fun t => H t - Real.cosh t have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh have hg_ode : ∀ t, deriv (deriv g) t = g t := by intro t have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by ext s; apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by have hH_diff1 : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff rw [contDiff_succ_iff_deriv] at h_diff exact h_diff.2.2 have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by rw [Real.deriv_cosh]; exact Real.contDiff_sinh rw [h1]; apply deriv_sub · exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt · exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt rw [h2, h_ode t, cosh_second_deriv_eq t] have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero] have hg'0 : deriv g 0 = 0 := by have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0 intro t have := hg_zero t simp only [g] at this; linarithThe lemma ode_cosh_uniqueness_contdiff performs that exclusion: if a twice continuously differentiable function H satisfies the equation, with H(0) = 1 and H'(0) = 0, then H is cosh. ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_continuous_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_continuous_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) : Continuous H := by refine continuous_iff_continuousAt.2 ?_ intro t have h_lim_H : Filter.Tendsto H (nhds 0) (nhds 1) := tendsto_H_one_of_log_curvature H h_one h_calib have h_sum : Filter.Tendsto (fun u => H (t+u) + H (t-u)) (nhds 0) (nhds (2 * H t)) := by have h_prod : Filter.Tendsto (fun u => (2 * H t) * H u) (nhds 0) (nhds ((2 * H t) * (1 : ℝ))) := (tendsto_const_nhds.mul h_lim_H) have h_prod' : Filter.Tendsto (fun u => 2 * H t * H u) (nhds 0) (nhds (2 * H t)) := by simpa [mul_assoc] using h_prod have h_eq : (fun u => H (t+u) + H (t-u)) = fun u => 2 * H t * H u := by funext u exact h_dAlembert t u simpa [h_eq] using h_prod' have h_diff_sq : Filter.Tendsto (fun u => (H (t+u) - H (t-u))^2) (nhds 0) (nhds (0 : ℝ)) := by have h_u_sq : Filter.Tendsto (fun u => (H u)^2) (nhds 0) (nhds ((1 : ℝ)^2)) := by simpa [pow_two] using h_lim_H.mul h_lim_H have h_u_sq_sub : Filter.Tendsto (fun u => (H u)^2 - 1) (nhds 0) (nhds (0 : ℝ)) := by have h_const : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhds 0) (nhds (1 : ℝ)) := tendsto_const_nhds simpa using h_u_sq.sub h_const have h_const : Filter.Tendsto (fun _ : ℝ => 4 * ((H t)^2 - 1)) (nhds 0) (nhds (4 * ((H t)^2 - 1))) := tendsto_const_nhds have h_mul : Filter.Tendsto (fun u => (4 * ((H t)^2 - 1)) * ((H u)^2 - 1)) (nhds 0) (nhds (4 * ((H t)^2 - 1) * (0 : ℝ))) := h_const.mul h_u_sq_sub have h_eq : (fun u => (H (t+u) - H (t-u))^2) = (fun u => 4 * ((H t)^2 - 1) * ((H u)^2 - 1)) := by funext u exact dAlembert_diff_square H h_one h_dAlembert t u simpa [h_eq] using h_mul have h_abs : Filter.Tendsto (fun u => |H (t+u) - H (t-u)|) (nhds 0) (nhds (0 : ℝ)) := by have h_sqrt : Filter.Tendsto (fun u => Real.sqrt ((H (t+u) - H (t-u))^2)) (nhds 0) (nhds (Real.sqrt 0)) := (Real.continuous_sqrt.tendsto 0).comp h_diff_sq simpa [Real.sqrt_sq_eq_abs] using h_sqrt have h_diff : Filter.Tendsto (fun u => H (t+u) - H (t-u)) (nhds 0) (nhds (0 : ℝ)) := (tendsto_zero_iff_abs_tendsto_zero (f := fun u => H (t+u) - H (t-u))).2 h_abs have h_sum_diff : Filter.Tendsto (fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) (nhds 0) (nhds ((2 * H t) + (0 : ℝ))) := h_sum.add h_diff have h_twice : Filter.Tendsto (fun u => 2 * H (t+u)) (nhds 0) (nhds (2 * H t)) := by have h_sum_diff' : Filter.Tendsto (fun u => H (t+u) + H (t+u)) (nhds 0) (nhds (2 * H t)) := by have h_eq : (fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) = (fun u => H (t+u) + H (t+u)) := by funext u ring have h_sum_diff'' : Filter.Tendsto (fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) (nhds 0) (nhds (2 * H t)) := by simpa using h_sum_diff simpa [h_eq] using h_sum_diff'' simpa [two_mul] using h_sum_diff' have h_half : Filter.Tendsto (fun u => (2 * H (t+u)) / 2) (nhds 0) (nhds ((2 * H t) / 2)) := by have h_const : Filter.Tendsto (fun _ : ℝ => (1 / 2 : ℝ)) (nhds 0) (nhds (1 / 2 : ℝ)) := tendsto_const_nhds simpa [div_eq_mul_inv] using h_twice.mul h_const have h_at0 : Filter.Tendsto (fun u => H (t+u)) (nhds 0) (nhds (H t)) := by simpa using h_half have h_map : Filter.Tendsto H (Filter.map (fun u => t + u) (nhds 0)) (nhds (H t)) := (Filter.tendsto_map'_iff).2 h_at0 have h_tendsto : Filter.Tendsto H (nhds t) (nhds (H t)) := by simpa [map_add_left_nhds_zero] using h_map exact h_tendstoThe lemma dAlembert_continuous_of_log_curvature derives continuity of a function H from the cosine addition identity, H(0) = 1, and log-curvature at 0. dAlembert_continuous_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The main forcing theorem law_of_logic_forces_jcost takes continuity on the positive reals as an explicit hypothesis. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ) (h_ODE : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := h_cont_hyp h_ODE have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0The uniqueness theorem ode_cosh_uniqueness takes five regularity hypotheses as inputs, one of which is the differentiability hypothesis that ode_regularity_differentiable_of_smooth would supply. ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThe theorem dAlembert_cosh_solution_of_log_curvature lists the differentiability hypothesis among its premises. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean- MODELThe declaration taylorWithinEval_one_univ is a general Taylor expansion lemma from the library.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]It is not used in the machine-checked proof of the cost uniqueness theorem, the result that any cost function satisfying the five plain conditions must equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/ theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ) (h_diff : ContDiff ℝ 2 H) (h_ode : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) : ∀ t, H t = Real.cosh t := by let g := fun t => H t - Real.cosh t have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh have hg_ode : ∀ t, deriv (deriv g) t = g t := by intro t have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by ext s; apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by have hH_diff1 : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff rw [contDiff_succ_iff_deriv] at h_diff exact h_diff.2.2 have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by rw [Real.deriv_cosh]; exact Real.contDiff_sinh rw [h1]; apply deriv_sub · exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt · exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt rw [h2, h_ode t, cosh_second_deriv_eq t] have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero] have hg'0 : deriv g 0 = 0 := by have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0 intro t have := hg_zero t simp only [g] at this; linarithThe proof reaches a differential equation in log coordinates, where the transformed function H(t) = F(e^t) + 1 must satisfy H'' = H, and it rules out other solutions with the dedicated lemma ode_cosh_uniqueness_contdiff, not with a Taylor expansion. ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G. Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y) becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t) via the substitution x = e^s, y = e^t. -/ theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) : SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by constructor · intro hComp t u have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos -- exp(t) * exp(u) = exp(t + u) have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm -- exp(t) / exp(u) = exp(t - u) have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg] simp only [G, h1, h2] at h ⊢ linarith · intro hCosh x y hx hy let t := Real.log x let u := Real.log y have hx_eq : x = Real.exp t := (Real.exp_log hx).symm have hy_eq : y = Real.exp u := (Real.exp_log hy).symm have h := hCosh t u simp only [G] at h rw [hx_eq, hy_eq] rw [← Real.exp_add, ← Real.exp_sub] -- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u)) -- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u) calc F (Real.exp (t + u)) + F (Real.exp (t - u)) = 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h _ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ringOne of those conditions, the composition law, is exactly equivalent to CoshAddIdentity: a theorem in the library proves the two statements are interchangeable. composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The five conditions force the cost to equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_cosh_add_identity : CoshAddIdentity Cost.Jcost := by intro t u simp only [G, Jcost] -- Use exp(t+u) = exp(t)*exp(u) and exp(t-u) = exp(t)/exp(u) have he1 : Real.exp (t + u) = Real.exp t * Real.exp u := Real.exp_add t u have he2 : Real.exp (t - u) = Real.exp t / Real.exp u := by rw [sub_eq_add_neg, Real.exp_add, Real.exp_neg] ring have hpos_t : Real.exp t > 0 := Real.exp_pos t have hpos_u : Real.exp u > 0 := Real.exp_pos u have hne_t : Real.exp t ≠ 0 := hpos_t.ne' have hne_u : Real.exp u ≠ 0 := hpos_u.ne' rw [he1, he2] field_simp ringThe cost function J itself satisfies the cosh addition rule. Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM cosh_initials · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem cosh_initials : Real.cosh 0 = 1 ∧ deriv (fun x => Real.cosh x) 0 = 0 := by constructor · simp [Real.cosh_zero] · have h := Real.deriv_cosh simp only [h, Real.sinh_zero]The theorem cosh_initials supplies exactly those two facts for the candidate solution. cosh_initials · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/ theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ) (h_diff : ContDiff ℝ 2 H) (h_ode : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) : ∀ t, H t = Real.cosh t := by let g := fun t => H t - Real.cosh t have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh have hg_ode : ∀ t, deriv (deriv g) t = g t := by intro t have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by ext s; apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by have hH_diff1 : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff rw [contDiff_succ_iff_deriv] at h_diff exact h_diff.2.2 have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by rw [Real.deriv_cosh]; exact Real.contDiff_sinh rw [h1]; apply deriv_sub · exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt · exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt rw [h2, h_ode t, cosh_second_deriv_eq t] have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero] have hg'0 : deriv g 0 = 0 := by have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0 intro t have := hg_zero t simp only [g] at this; linarithThe machine-checked lemma ode_cosh_uniqueness_contdiff states the full uniqueness result: if a twice continuously differentiable function H satisfies H'' = H at every point, with H(0) = 1 and H'(0) = 0, then H is cosh. ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM cosh_initials · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem cosh_initials : Real.cosh 0 = 1 ∧ deriv (fun x => Real.cosh x) 0 = 0 := by constructor · simp [Real.cosh_zero] · have h := Real.deriv_cosh simp only [h, Real.sinh_zero]The lemma is not an axiom; it is a derived theorem, established from the standard definitions of cosh and sinh. cosh_initials · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThe declaration dAlembert_cosh_solution_of_log_curvature is a theorem that derives the same cosh conclusion as the ODE route, but from the d'Alembert functional equation instead of a second-order differential equation. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The cost uniqueness page should not cite this declaration as a standalone result. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThe d'Alembert route shows that the cosh conclusion does not depend on the specific path taken after the composition law. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The central theorem of the cost uniqueness story is that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_cosh_add_identity : CoshAddIdentity Cost.Jcost := by intro t u simp only [G, Jcost] -- Use exp(t+u) = exp(t)*exp(u) and exp(t-u) = exp(t)/exp(u) have he1 : Real.exp (t + u) = Real.exp t * Real.exp u := Real.exp_add t u have he2 : Real.exp (t - u) = Real.exp t / Real.exp u := by rw [sub_eq_add_neg, Real.exp_add, Real.exp_neg] ring have hpos_t : Real.exp t > 0 := Real.exp_pos t have hpos_u : Real.exp u > 0 := Real.exp_pos u have hne_t : Real.exp t ≠ 0 := hpos_t.ne' have hne_u : Real.exp u ≠ 0 := hpos_u.ne' rw [he1, he2] field_simp ringThe hinge is a single theorem, Jcost_cosh_add_identity, which states that the candidate J obeys the same composition law that the five conditions impose on any valid cost. Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM SatisfiesCompositionLaw · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Composition Law (Equation 1.1)**: F(xy) + F(x/y) = 2·F(x)·F(y) + 2·F(x) + 2·F(y) for all x, y > 0. This is the Recognition Composition Law (RCL). -/ def SatisfiesCompositionLaw (F : ℝ → ℝ) : Prop := ∀ x y : ℝ, 0 < x → 0 < y → F (x * y) + F (x / y) = 2 * F x * F y + 2 * F x + 2 * F yThe composition law, written as F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y), is a functional equation that admits many solutions. SatisfiesCompositionLaw · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThe proof uses the regularity conditions to show that H must be cosh, and hence F must be J. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The cost uniqueness theorem requires the normalization condition IsNormalized F as an explicit hypothesis. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ) (h_ODE : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := h_cont_hyp h_ODE have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0The theorem ode_cosh_uniqueness requires both H(0) = 1 and H'(0) = 0 to conclude H = cosh. ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM logCurvature_forces_normalized · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The composition law together with unit log curvature force normalization. The composition law at `y = 1` gives `F 1 * (F x + 1) = 0`, so either `F 1 = 0` or `F` is constantly `-1`; the constant has `H ≡ 0`, whose curvature quotient is negative throughout a punctured neighbourhood and so cannot tend to `1`. -/ theorem logCurvature_forces_normalized (F : ℝ → ℝ) (hComp : SatisfiesCompositionLaw F) (hκ : HasLogCurvature (H F) 1) : IsNormalized F := by by_contra hne have hconst : ∀ x : ℝ, 0 < x → F x = -1 := by intro x hx have h := hComp x 1 hx one_pos rw [mul_one, div_one] at h have hquad : F 1 * (F x + 1) = 0 := by nlinarith rcases mul_eq_zero.mp hquad with h1 | h2 · exact absurd h1 hne · linarith have hH : ∀ t : ℝ, H F t = 0 := by intro t have hx := hconst (Real.exp t) (Real.exp_pos t) simp [H, G, hx] have hgt : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), (1 / 2 : ℝ) < 2 * (H F t - 1) / t ^ 2 := hκ.eventually (eventually_gt_nhds (by norm_num)) have hne0 : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), t ≠ 0 := by filter_upwards [self_mem_nhdsWithin] with t ht using ht obtain ⟨t, hgt', ht0⟩ := (hgt.and hne0).exists have ht2 : 0 < t ^ 2 := by positivity have hneg : 2 * (H F t - 1) / t ^ 2 < 0 := by rw [hH t] exact div_neg_of_neg_of_pos (by norm_num) ht2 linarithThe log-curvature condition at value 1, together with the composition law, forces normalization. logCurvature_forces_normalized · IndisputableMonolith/Cost/FunctionalEquation.leanDERIVED-UNFORMALIZED composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G. Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y) becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t) via the substitution x = e^s, y = e^t. -/ theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) : SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by constructor · intro hComp t u have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos -- exp(t) * exp(u) = exp(t + u) have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm -- exp(t) / exp(u) = exp(t - u) have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg] simp only [G, h1, h2] at h ⊢ linarith · intro hCosh x y hx hy let t := Real.log x let u := Real.log y have hx_eq : x = Real.exp t := (Real.exp_log hx).symm have hy_eq : y = Real.exp u := (Real.exp_log hy).symm have h := hCosh t u simp only [G] at h rw [hx_eq, hy_eq] rw [← Real.exp_add, ← Real.exp_sub] -- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u)) -- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u) calc F (Real.exp (t + u)) + F (Real.exp (t - u)) = 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h _ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ringWithout normalization, the family of functions F_c(x) = cosh(c * ln x) - 1 would satisfy the composition law and the log-curvature condition. composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM gate_forces_bilinear_family · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Once the affine-response step is known, symmetry and the boundary law force the entire bilinear family. -/ theorem gate_forces_bilinear_family (P : ℝ → ℝ → ℝ) (hGate : FactorizationAssociativityGate P) : ∃ c : ℝ, ∀ u v, P u v = c * u * v + 2 * u + 2 * v := by classical choose α β hAffine using hGate.rightAffine have hβ : ∀ u, β u = 2 * u := by intro u have h0 : P u 0 = α u * 0 + β u := hAffine u 0 rw [hGate.zeroBoundary u] at h0 linarith let c : ℝ := α 1 - 2 refine ⟨c, ?_⟩ intro u v have hsym1 : P u 1 = P 1 u := hGate.symmetric u 1 have hαu : α u = c * u + 2 := by dsimp [c] have hcalc : α u * 1 + β u = α 1 * u + β 1 := by calc α u * 1 + β u = P u 1 := by symm; exact hAffine u 1 _ = P 1 u := hGate.symmetric u 1 _ = α 1 * u + β 1 := hAffine 1 u rw [hβ u, hβ 1] at hcalc linarith calc P u v = α u * v + β u := hAffine u v _ = (c * u + 2) * v + 2 * u := by rw [hαu, hβ u] _ = c * u * v + 2 * u + 2 * v := by ringThe theorem gate_forces_bilinear_family says that any combiner satisfying those four conditions must be bilinear: there exists a constant c such that P(u, v) = c * u * v + 2u + 2v for all u and v. gate_forces_bilinear_family · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Canonical normalization selects the RCL member of the bilinear family. -/ theorem gate_forces_rcl (P : ℝ → ℝ → ℝ) (hGate : FactorizationAssociativityGate P) : ∀ u v, P u v = 2 * u * v + 2 * u + 2 * v := by obtain ⟨c, hc⟩ := gate_forces_bilinear_family P hGate have hc_two : c = 2 := by have h11 : P 1 1 = c * 1 * 1 + 2 * 1 + 2 * 1 := by simpa using hc 1 1 linarith [hGate.unitDiagonal, h11] intro u v calc P u v = c * u * v + 2 * u + 2 * v := hc u v _ = 2 * u * v + 2 * u + 2 * v := by rw [hc_two]The normalization P(1, 1) = 6 then pins c to 2, giving the canonical RCL combiner P(u, v) = 2uv + 2u + 2v. gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM factorization_gate_iff_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Exact gate characterization: the factorization gate is equivalent to being the canonical RCL combiner. -/ theorem factorization_gate_iff_rcl (P : ℝ → ℝ → ℝ) : FactorizationAssociativityGate P ↔ ∀ u v, P u v = rclCombiner u v := by constructor · intro hGate u v rw [gate_forces_rcl P hGate u v] rfl · intro hP refine { symmetric := ?_ rightAffine := ?_ zeroBoundary := ?_ unitDiagonal := ?_ } · intro u v rw [hP u v, hP v u] unfold rclCombiner ring · intro u refine ⟨2 * u + 2, 2 * u, ?_⟩ intro v rw [hP u v] unfold rclCombiner ring · intro u rw [hP u 0] unfold rclCombiner ring · rw [hP 1 1] unfold rclCombiner norm_numThe equivalence factorization_gate_iff_rcl states that the gate is exactly equivalent to being the canonical RCL combiner. factorization_gate_iff_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThe theorem dAlembert_cosh_solution_of_log_curvature requires the smoothness hypothesis dAlembert_continuous_implies_smooth_hypothesis H as a necessary input. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM cosh_dAlembert_smooth · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh satisfies the d'Alembert smoothness hypothesis. -/ theorem cosh_dAlembert_smooth : dAlembert_continuous_implies_smooth_hypothesis Real.cosh := by intro _ _ _ exact Real.contDiff_coshThe declaration cosh_dAlembert_smooth is the instance of the smoothness hypothesis for Real.cosh, proved by the library's result that cosh is infinitely differentiable. cosh_dAlembert_smooth · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_deriv_zero : deriv H 0 = 0 := by have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt exact even_deriv_at_zero H h_even h_diff exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hypThe d'Alembert equation alone does not select a unique solution; it admits many, including exponential combinations and zero functions. dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_smooth_of_aczel · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The `dAlembert_continuous_implies_smooth_hypothesis` holds for every H, as a direct consequence of the Aczél axiom. -/ theorem dAlembert_smooth_of_aczel [AczelSmoothnessPackage] (H : ℝ → ℝ) : dAlembert_continuous_implies_smooth_hypothesis H := fun h_one h_cont h_dAlembert => aczel_dAlembert_smooth H h_one h_cont h_dAlembertThe theorem dAlembert_smooth_of_aczel states that under the AczelSmoothnessPackage, any continuous solution of the d'Alembert equation with H(0) = 1 is automatically infinitely differentiable. dAlembert_smooth_of_aczel · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_aczel · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (d'Alembert → cosh, Aczél form)**: Using only the Aczél axiom, a continuous solution to d'Alembert with H(0) = 1 and H''(0) = 1 must equal cosh. This is the clean version of `dAlembert_cosh_solution`, requiring no regularity params. -/ theorem dAlembert_cosh_solution_aczel [AczelSmoothnessPackage] (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_d2_zero : deriv (deriv H) 0 = 1) : ∀ t, H t = Real.cosh t := by have h_smooth : ContDiff ℝ ⊤ H := aczel_dAlembert_smooth H h_one h_cont h_dAlembert have hDiff : Differentiable ℝ H := (h_smooth.of_le le_top : ContDiff ℝ 1 H).differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_H'0 : deriv H 0 = 0 := even_deriv_at_zero H h_even hDiff.differentiableAt have h_ode : ∀ t, deriv (deriv H) t = H t := dAlembert_to_ODE_theorem H h_smooth h_dAlembert h_d2_zero have h_C2 : ContDiff ℝ 2 H := h_smooth.of_le le_top exact ode_cosh_uniqueness_contdiff H h_C2 h_ode h_one h_H'0The theorem dAlembert_cosh_solution_aczel states that if H is continuous, satisfies the d'Alembert equation, and has H(0) = 1 and H''(0) = 1, then H(t) = cosh(t) for all t. dAlembert_cosh_solution_aczel · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/ theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ) (h_diff : ContDiff ℝ 2 H) (h_ode : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) : ∀ t, H t = Real.cosh t := by let g := fun t => H t - Real.cosh t have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh have hg_ode : ∀ t, deriv (deriv g) t = g t := by intro t have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by ext s; apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by have hH_diff1 : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff rw [contDiff_succ_iff_deriv] at h_diff exact h_diff.2.2 have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by rw [Real.deriv_cosh]; exact Real.contDiff_sinh rw [h1]; apply deriv_sub · exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt · exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt rw [h2, h_ode t, cosh_second_deriv_eq t] have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero] have hg'0 : deriv g 0 = 0 := by have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0 intro t have := hg_zero t simp only [g] at this; linarithThe library proves that any twice-differentiable function satisfying H'' = H with those initial conditions is exactly cosh. ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM cosh_satisfies_differentiable · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh is differentiable. -/ theorem cosh_satisfies_differentiable : ode_regularity_differentiable_hypothesis Real.cosh := by intro _ _ exact Real.differentiable_coshThe framework's library proves that cosh itself satisfies the differentiability hypothesis. cosh_satisfies_differentiable · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM cosh_satisfies_continuous · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh is continuous. -/ theorem cosh_satisfies_continuous : ode_regularity_continuous_hypothesis Real.cosh := by intro _ exact Real.continuous_coshThe declaration cosh_satisfies_continuous is a theorem stating that the hyperbolic cosine satisfies the regularity hypothesis ode_regularity_continuous_hypothesis. cosh_satisfies_continuous · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The theorem law_of_logic_forces_jcost states that any cost function satisfying reciprocal symmetry, normalization, the composition law, calibration, and continuity on the positive reals must equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM SatisfiesCompositionLaw · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Composition Law (Equation 1.1)**: F(xy) + F(x/y) = 2·F(x)·F(y) + 2·F(x) + 2·F(y) for all x, y > 0. This is the Recognition Composition Law (RCL). -/ def SatisfiesCompositionLaw (F : ℝ → ℝ) : Prop := ∀ x y : ℝ, 0 < x → 0 < y → F (x * y) + F (x / y) = 2 * F x * F y + 2 * F x + 2 * F yThe composition law for positive x and y reads F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y). SatisfiesCompositionLaw · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_aczel · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (d'Alembert → cosh, Aczél form)**: Using only the Aczél axiom, a continuous solution to d'Alembert with H(0) = 1 and H''(0) = 1 must equal cosh. This is the clean version of `dAlembert_cosh_solution`, requiring no regularity params. -/ theorem dAlembert_cosh_solution_aczel [AczelSmoothnessPackage] (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_d2_zero : deriv (deriv H) 0 = 1) : ∀ t, H t = Real.cosh t := by have h_smooth : ContDiff ℝ ⊤ H := aczel_dAlembert_smooth H h_one h_cont h_dAlembert have hDiff : Differentiable ℝ H := (h_smooth.of_le le_top : ContDiff ℝ 1 H).differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_H'0 : deriv H 0 = 0 := even_deriv_at_zero H h_even hDiff.differentiableAt have h_ode : ∀ t, deriv (deriv H) t = H t := dAlembert_to_ODE_theorem H h_smooth h_dAlembert h_d2_zero have h_C2 : ContDiff ℝ 2 H := h_smooth.of_le le_top exact ode_cosh_uniqueness_contdiff H h_C2 h_ode h_one h_H'0The declaration dAlembert_cosh_solution_aczel contributes a clean statement of the classical result that continuous solutions of the d'Alembert equation with H(0) = 1 and second derivative 1 at 0 are exactly cosh(t). dAlembert_cosh_solution_aczel · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The cost uniqueness theorem states that any cost function satisfying the five plain conditions must equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G. Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y) becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t) via the substitution x = e^s, y = e^t. -/ theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) : SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by constructor · intro hComp t u have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos -- exp(t) * exp(u) = exp(t + u) have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm -- exp(t) / exp(u) = exp(t - u) have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg] simp only [G, h1, h2] at h ⊢ linarith · intro hCosh x y hx hy let t := Real.log x let u := Real.log y have hx_eq : x = Real.exp t := (Real.exp_log hx).symm have hy_eq : y = Real.exp u := (Real.exp_log hy).symm have h := hCosh t u simp only [G] at h rw [hx_eq, hy_eq] rw [← Real.exp_add, ← Real.exp_sub] -- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u)) -- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u) calc F (Real.exp (t + u)) + F (Real.exp (t - u)) = 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h _ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ringThe composition law transforms into the d'Alembert equation in log coordinates. composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM cosh_dAlembert_to_ODE · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh satisfies the d'Alembert to ODE hypothesis. -/ theorem cosh_dAlembert_to_ODE : dAlembert_to_ODE_hypothesis Real.cosh := by intro _ _ _ _ exact cosh_second_deriv_eqThe declaration cosh_second_deriv_eq is the bridge from d'Alembert's equation to the differential equation. cosh_dAlembert_to_ODE · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM cosh_dAlembert_to_ODE · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh satisfies the d'Alembert to ODE hypothesis. -/ theorem cosh_dAlembert_to_ODE : dAlembert_to_ODE_hypothesis Real.cosh := by intro _ _ _ _ exact cosh_second_deriv_eqIt states that the second derivative of cosh is cosh itself: (cosh)'' = cosh. cosh_dAlembert_to_ODE · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The theorem law_of_logic_forces_jcost proves that any such cost must equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The theorem law_of_logic_forces_jcost, which states the full uniqueness result, would no longer be derivable from the given lemmas. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM cosh_dAlembert_to_ODE · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh satisfies the d'Alembert to ODE hypothesis. -/ theorem cosh_dAlembert_to_ODE : dAlembert_to_ODE_hypothesis Real.cosh := by intro _ _ _ _ exact cosh_second_deriv_eqThe proof passes through a differential equation, and that route depends on a specific fact: the second derivative of the hyperbolic cosine is the hyperbolic cosine itself. cosh_dAlembert_to_ODE · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_smooth_of_aczel · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The `dAlembert_continuous_implies_smooth_hypothesis` holds for every H, as a direct consequence of the Aczél axiom. -/ theorem dAlembert_smooth_of_aczel [AczelSmoothnessPackage] (H : ℝ → ℝ) : dAlembert_continuous_implies_smooth_hypothesis H := fun h_one h_cont h_dAlembert => aczel_dAlembert_smooth H h_one h_cont h_dAlembertThe d'Alembert equation alone would still force the function to be smooth, by a classical result of Aczél. dAlembert_smooth_of_aczel · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_continuous_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_continuous_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) : Continuous H := by refine continuous_iff_continuousAt.2 ?_ intro t have h_lim_H : Filter.Tendsto H (nhds 0) (nhds 1) := tendsto_H_one_of_log_curvature H h_one h_calib have h_sum : Filter.Tendsto (fun u => H (t+u) + H (t-u)) (nhds 0) (nhds (2 * H t)) := by have h_prod : Filter.Tendsto (fun u => (2 * H t) * H u) (nhds 0) (nhds ((2 * H t) * (1 : ℝ))) := (tendsto_const_nhds.mul h_lim_H) have h_prod' : Filter.Tendsto (fun u => 2 * H t * H u) (nhds 0) (nhds (2 * H t)) := by simpa [mul_assoc] using h_prod have h_eq : (fun u => H (t+u) + H (t-u)) = fun u => 2 * H t * H u := by funext u exact h_dAlembert t u simpa [h_eq] using h_prod' have h_diff_sq : Filter.Tendsto (fun u => (H (t+u) - H (t-u))^2) (nhds 0) (nhds (0 : ℝ)) := by have h_u_sq : Filter.Tendsto (fun u => (H u)^2) (nhds 0) (nhds ((1 : ℝ)^2)) := by simpa [pow_two] using h_lim_H.mul h_lim_H have h_u_sq_sub : Filter.Tendsto (fun u => (H u)^2 - 1) (nhds 0) (nhds (0 : ℝ)) := by have h_const : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhds 0) (nhds (1 : ℝ)) := tendsto_const_nhds simpa using h_u_sq.sub h_const have h_const : Filter.Tendsto (fun _ : ℝ => 4 * ((H t)^2 - 1)) (nhds 0) (nhds (4 * ((H t)^2 - 1))) := tendsto_const_nhds have h_mul : Filter.Tendsto (fun u => (4 * ((H t)^2 - 1)) * ((H u)^2 - 1)) (nhds 0) (nhds (4 * ((H t)^2 - 1) * (0 : ℝ))) := h_const.mul h_u_sq_sub have h_eq : (fun u => (H (t+u) - H (t-u))^2) = (fun u => 4 * ((H t)^2 - 1) * ((H u)^2 - 1)) := by funext u exact dAlembert_diff_square H h_one h_dAlembert t u simpa [h_eq] using h_mul have h_abs : Filter.Tendsto (fun u => |H (t+u) - H (t-u)|) (nhds 0) (nhds (0 : ℝ)) := by have h_sqrt : Filter.Tendsto (fun u => Real.sqrt ((H (t+u) - H (t-u))^2)) (nhds 0) (nhds (Real.sqrt 0)) := (Real.continuous_sqrt.tendsto 0).comp h_diff_sq simpa [Real.sqrt_sq_eq_abs] using h_sqrt have h_diff : Filter.Tendsto (fun u => H (t+u) - H (t-u)) (nhds 0) (nhds (0 : ℝ)) := (tendsto_zero_iff_abs_tendsto_zero (f := fun u => H (t+u) - H (t-u))).2 h_abs have h_sum_diff : Filter.Tendsto (fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) (nhds 0) (nhds ((2 * H t) + (0 : ℝ))) := h_sum.add h_diff have h_twice : Filter.Tendsto (fun u => 2 * H (t+u)) (nhds 0) (nhds (2 * H t)) := by have h_sum_diff' : Filter.Tendsto (fun u => H (t+u) + H (t+u)) (nhds 0) (nhds (2 * H t)) := by have h_eq : (fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) = (fun u => H (t+u) + H (t+u)) := by funext u ring have h_sum_diff'' : Filter.Tendsto (fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) (nhds 0) (nhds (2 * H t)) := by simpa using h_sum_diff simpa [h_eq] using h_sum_diff'' simpa [two_mul] using h_sum_diff' have h_half : Filter.Tendsto (fun u => (2 * H (t+u)) / 2) (nhds 0) (nhds ((2 * H t) / 2)) := by have h_const : Filter.Tendsto (fun _ : ℝ => (1 / 2 : ℝ)) (nhds 0) (nhds (1 / 2 : ℝ)) := tendsto_const_nhds simpa [div_eq_mul_inv] using h_twice.mul h_const have h_at0 : Filter.Tendsto (fun u => H (t+u)) (nhds 0) (nhds (H t)) := by simpa using h_half have h_map : Filter.Tendsto H (Filter.map (fun u => t + u) (nhds 0)) (nhds (H t)) := (Filter.tendsto_map'_iff).2 h_at0 have h_tendsto : Filter.Tendsto H (nhds t) (nhds (H t)) := by simpa [map_add_left_nhds_zero] using h_map exact h_tendstoThe declaration dAlembert_continuous_of_log_curvature proves that a function satisfying the d'Alembert equation, with H(0) = 1 and having log-curvature at 0, is continuous everywhere. dAlembert_continuous_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The machine-checked proof of cost uniqueness, law_of_logic_forces_jcost, requires continuity of F on the positive reals as one of its five hypotheses. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_continuous_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_continuous_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) : Continuous H := by refine continuous_iff_continuousAt.2 ?_ intro t have h_lim_H : Filter.Tendsto H (nhds 0) (nhds 1) := tendsto_H_one_of_log_curvature H h_one h_calib have h_sum : Filter.Tendsto (fun u => H (t+u) + H (t-u)) (nhds 0) (nhds (2 * H t)) := by have h_prod : Filter.Tendsto (fun u => (2 * H t) * H u) (nhds 0) (nhds ((2 * H t) * (1 : ℝ))) := (tendsto_const_nhds.mul h_lim_H) have h_prod' : Filter.Tendsto (fun u => 2 * H t * H u) (nhds 0) (nhds (2 * H t)) := by simpa [mul_assoc] using h_prod have h_eq : (fun u => H (t+u) + H (t-u)) = fun u => 2 * H t * H u := by funext u exact h_dAlembert t u simpa [h_eq] using h_prod' have h_diff_sq : Filter.Tendsto (fun u => (H (t+u) - H (t-u))^2) (nhds 0) (nhds (0 : ℝ)) := by have h_u_sq : Filter.Tendsto (fun u => (H u)^2) (nhds 0) (nhds ((1 : ℝ)^2)) := by simpa [pow_two] using h_lim_H.mul h_lim_H have h_u_sq_sub : Filter.Tendsto (fun u => (H u)^2 - 1) (nhds 0) (nhds (0 : ℝ)) := by have h_const : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhds 0) (nhds (1 : ℝ)) := tendsto_const_nhds simpa using h_u_sq.sub h_const have h_const : Filter.Tendsto (fun _ : ℝ => 4 * ((H t)^2 - 1)) (nhds 0) (nhds (4 * ((H t)^2 - 1))) := tendsto_const_nhds have h_mul : Filter.Tendsto (fun u => (4 * ((H t)^2 - 1)) * ((H u)^2 - 1)) (nhds 0) (nhds (4 * ((H t)^2 - 1) * (0 : ℝ))) := h_const.mul h_u_sq_sub have h_eq : (fun u => (H (t+u) - H (t-u))^2) = (fun u => 4 * ((H t)^2 - 1) * ((H u)^2 - 1)) := by funext u exact dAlembert_diff_square H h_one h_dAlembert t u simpa [h_eq] using h_mul have h_abs : Filter.Tendsto (fun u => |H (t+u) - H (t-u)|) (nhds 0) (nhds (0 : ℝ)) := by have h_sqrt : Filter.Tendsto (fun u => Real.sqrt ((H (t+u) - H (t-u))^2)) (nhds 0) (nhds (Real.sqrt 0)) := (Real.continuous_sqrt.tendsto 0).comp h_diff_sq simpa [Real.sqrt_sq_eq_abs] using h_sqrt have h_diff : Filter.Tendsto (fun u => H (t+u) - H (t-u)) (nhds 0) (nhds (0 : ℝ)) := (tendsto_zero_iff_abs_tendsto_zero (f := fun u => H (t+u) - H (t-u))).2 h_abs have h_sum_diff : Filter.Tendsto (fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) (nhds 0) (nhds ((2 * H t) + (0 : ℝ))) := h_sum.add h_diff have h_twice : Filter.Tendsto (fun u => 2 * H (t+u)) (nhds 0) (nhds (2 * H t)) := by have h_sum_diff' : Filter.Tendsto (fun u => H (t+u) + H (t+u)) (nhds 0) (nhds (2 * H t)) := by have h_eq : (fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) = (fun u => H (t+u) + H (t+u)) := by funext u ring have h_sum_diff'' : Filter.Tendsto (fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) (nhds 0) (nhds (2 * H t)) := by simpa using h_sum_diff simpa [h_eq] using h_sum_diff'' simpa [two_mul] using h_sum_diff' have h_half : Filter.Tendsto (fun u => (2 * H (t+u)) / 2) (nhds 0) (nhds ((2 * H t) / 2)) := by have h_const : Filter.Tendsto (fun _ : ℝ => (1 / 2 : ℝ)) (nhds 0) (nhds (1 / 2 : ℝ)) := tendsto_const_nhds simpa [div_eq_mul_inv] using h_twice.mul h_const have h_at0 : Filter.Tendsto (fun u => H (t+u)) (nhds 0) (nhds (H t)) := by simpa using h_half have h_map : Filter.Tendsto H (Filter.map (fun u => t + u) (nhds 0)) (nhds (H t)) := (Filter.tendsto_map'_iff).2 h_at0 have h_tendsto : Filter.Tendsto H (nhds t) (nhds (H t)) := by simpa [map_add_left_nhds_zero] using h_map exact h_tendstoThe d'Alembert equation admits many pathological solutions that are discontinuous everywhere. dAlembert_continuous_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThe library also contains a separate route, dAlembert_cosh_solution_of_log_curvature, which derives the same cosh conclusion from the functional equation under additional smoothness hypotheses. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/ theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ) (h_diff : ContDiff ℝ 2 H) (h_ode : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) : ∀ t, H t = Real.cosh t := by let g := fun t => H t - Real.cosh t have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh have hg_ode : ∀ t, deriv (deriv g) t = g t := by intro t have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by ext s; apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by have hH_diff1 : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff rw [contDiff_succ_iff_deriv] at h_diff exact h_diff.2.2 have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by rw [Real.deriv_cosh]; exact Real.contDiff_sinh rw [h1]; apply deriv_sub · exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt · exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt rw [h2, h_ode t, cosh_second_deriv_eq t] have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero] have hg'0 : deriv g 0 = 0 := by have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0 intro t have := hg_zero t simp only [g] at this; linarithThe theorem ode_cosh_uniqueness_contdiff proves that if H is twice continuously differentiable, satisfies H'' = H, and has initial conditions H(0) = 1 and H'(0) = 0, then H must be the hyperbolic cosine, Real.cosh t. ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Zero Uniqueness)**: The unique solution to f'' = f with f(0) = f'(0) = 0 is f = 0. -/ theorem ode_zero_uniqueness (f : ℝ → ℝ) (h_diff2 : ContDiff ℝ 2 f) (h_ode : ∀ t, deriv (deriv f) t = f t) (h_f0 : f 0 = 0) (h_f'0 : deriv f 0 = 0) : ∀ t, f t = 0 := by have ⟨h_minus, h_plus⟩ := ode_diagonalization f h_diff2 h_ode have h_diff1 : Differentiable ℝ f := h_diff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have h_deriv_contdiff : ContDiff ℝ 1 (deriv f) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff2 rw [contDiff_succ_iff_deriv] at h_diff2 exact h_diff2.2.2 have h_diff_deriv : Differentiable ℝ (deriv f) := h_deriv_contdiff.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) let g := fun s => deriv f s - f s let hf := fun s => deriv f s + f s have hg_diff : Differentiable ℝ g := h_diff_deriv.sub h_diff1 have hh_diff : Differentiable ℝ hf := h_diff_deriv.add h_diff1 have hg0 : g 0 = 0 := by simp [g, h_f0, h_f'0] have hh0 : hf 0 = 0 := by simp [hf, h_f0, h_f'0] have hg_deriv : ∀ t, deriv g t = -g t := h_minus have hh_deriv : ∀ t, deriv hf t = hf t := h_plus have hg_zero := deriv_neg_self_zero g hg_diff hg_deriv hg0 have hh_zero := deriv_pos_self_zero hf hh_diff hh_deriv hh0 intro t have hgt := hg_zero t have hht := hh_zero t simp only [g, hf] at hgt hht linarithThe equation H'' = H alone does not select a unique function; it admits many solutions, including exponential combinations and zero solutions. ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Lemma 2.1**: If F is reciprocal, then G(t) = F(e^t) is even. -/ theorem reciprocal_implies_G_even (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) : Function.Even (G F) := G_even_of_reciprocal_symmetry F (fun {x} hx => hRecip x hx)A twice continuously differentiable even function with zero value and zero derivative at zero is identically zero. reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The theorem law_of_logic_forces_jcost states that any cost function satisfying the five conditions must equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_double · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_double (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (t : ℝ) : H (2 * t) = 2 * (H t)^2 - 1 := by have h := h_dAlembert t t have h' : H (t + t) = 2 * (H t)^2 - 1 := by -- H(2t) + H(0) = 2 H(t)^2 have h0 : H (t + t) + 1 = 2 * H t * H t := by simpa [h_one] using h have h1 : H (t + t) = 2 * H t * H t - 1 := by linarith simpa [pow_two, mul_assoc] using h1 simpa [two_mul] using h'The lemma dAlembert_double proves that any function H satisfying the d'Alembert equation H(t+u) + H(t-u) = 2H(t)H(u), with H(0) = 1, must obey the doubling rule H(2t) = 2H(t)² - 1. dAlembert_double · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_double · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_double (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (t : ℝ) : H (2 * t) = 2 * (H t)^2 - 1 := by have h := h_dAlembert t t have h' : H (t + t) = 2 * (H t)^2 - 1 := by -- H(2t) + H(0) = 2 H(t)^2 have h0 : H (t + t) + 1 = 2 * H t * H t := by simpa [h_one] using h have h1 : H (t + t) = 2 * H t * H t - 1 := by linarith simpa [pow_two, mul_assoc] using h1 simpa [two_mul] using h'The d'Alembert equation alone does not select a unique function. dAlembert_double · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_to_ODE_hypothesis · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **d'Alembert to ODE derivation.** If H satisfies the d'Alembert equation and is smooth, then H'' = H. Proof sketch: Differentiate H(t+u) + H(t-u) = 2H(t)H(u) twice with respect to u, then set u = 0 to get H''(t) = H''(0) · H(t). With calibration H''(0) = 1, this gives H''(t) = H(t). -/ def dAlembert_to_ODE_hypothesis (H : ℝ → ℝ) : Prop := H 0 = 1 → Continuous H → (∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) → deriv (deriv H) 0 = 1 → ∀ t, deriv (deriv H) t = H tThe doubling identity is the bridge that lets the proof convert the functional equation into a second-order differential equation, H'' = H. dAlembert_to_ODE_hypothesis · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The proof of cost uniqueness, the result that any cost function satisfying the five plain conditions must equal J(x) = (x + 1/x)/2 - 1, depends on this conversion. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM tendsto_H_one_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- Unit log curvature plus `H 0 = 1` give the two-sided limit at the origin. The curvature hypothesis lives on the punctured filter, so the value at the origin is supplied by `h_one` rather than assumed away. -/ lemma tendsto_H_one_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) {κ : ℝ} (h_calib : HasLogCurvature H κ) : Filter.Tendsto H (nhds 0) (nhds 1) := by have h_t2_div : Filter.Tendsto (fun t : ℝ => t^2 / 2) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (0 : ℝ)) := by have hfull : Filter.Tendsto (fun t : ℝ => t^2 / 2) (nhds (0 : ℝ)) (nhds (0 : ℝ)) := by simpa using ((continuous_pow 2).div_const 2).tendsto (0 : ℝ) exact hfull.mono_left nhdsWithin_le_nhds have h_prod : Filter.Tendsto (fun t => (t^2 / 2) * (2 * (H t - 1) / t^2)) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds ((0 : ℝ) * κ)) := h_t2_div.mul h_calib have h_sub : Filter.Tendsto (fun t => H t - 1) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (0 : ℝ)) := by have h_congr : ∀ t : ℝ, (t^2 / 2) * (2 * (H t - 1) / t^2) = H t - 1 := fun t => (sub_one_eq_mul_ratio H h_one t).symm simpa using (Filter.Tendsto.congr h_congr h_prod) have h_punct : Filter.Tendsto H (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 1) := by have h_const : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (1 : ℝ)) := tendsto_const_nhds simpa using h_sub.add h_const have h_cw : ContinuousWithinAt H ({(0 : ℝ)}ᶜ) 0 := by unfold ContinuousWithinAt rw [h_one] exact h_punct have h_ca : ContinuousAt H 0 := continuousWithinAt_compl_self.mp h_cw have h := h_ca.tendsto rwa [h_one] at hThe lemma tendsto_H_one_of_log_curvature states that if a function H has log-curvature at 0 and H(0) = 1, then H(t) approaches 1 as t approaches 0. tendsto_H_one_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_deriv_zero : deriv H 0 = 0 := by have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt exact even_deriv_at_zero H h_even h_diff exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hypThe main proof reaches a differential equation in log coordinates, where the transformed function must satisfy H'' = H. dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_diff_square · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_diff_square (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) : ∀ t u, (H (t+u) - H (t-u))^2 = 4 * ((H t)^2 - 1) * ((H u)^2 - 1) := by intro t u have h_sum : H (t+u) + H (t-u) = 2 * H t * H u := h_dAlembert t u have h_prod : H (t+u) * H (t-u) = (H t)^2 + (H u)^2 - 1 := dAlembert_product H h_one h_dAlembert t u calc (H (t+u) - H (t-u))^2 = (H (t+u) + H (t-u))^2 - 4 * (H (t+u) * H (t-u)) := by ring _ = (2 * H t * H u)^2 - 4 * ((H t)^2 + (H u)^2 - 1) := by simp [h_sum, h_prod] _ = 4 * ((H t)^2 - 1) * ((H u)^2 - 1) := by ringThe lemma dAlembert_diff_square says that for any t and u, the square of the difference between H at t+u and H at t-u equals 4 times the product of (H t)^2 - 1 and (H u)^2 - 1. dAlembert_diff_square · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_diff_square · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_diff_square (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) : ∀ t u, (H (t+u) - H (t-u))^2 = 4 * ((H t)^2 - 1) * ((H u)^2 - 1) := by intro t u have h_sum : H (t+u) + H (t-u) = 2 * H t * H u := h_dAlembert t u have h_prod : H (t+u) * H (t-u) = (H t)^2 + (H u)^2 - 1 := dAlembert_product H h_one h_dAlembert t u calc (H (t+u) - H (t-u))^2 = (H (t+u) + H (t-u))^2 - 4 * (H (t+u) * H (t-u)) := by ring _ = (2 * H t * H u)^2 - 4 * ((H t)^2 + (H u)^2 - 1) := by simp [h_sum, h_prod] _ = 4 * ((H t)^2 - 1) * ((H u)^2 - 1) := by ringThe identity is derived from the d'Alembert equation and the condition H(0) = 1, with no continuity or differentiability assumptions. dAlembert_diff_square · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_to_ODE_hypothesis · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **d'Alembert to ODE derivation.** If H satisfies the d'Alembert equation and is smooth, then H'' = H. Proof sketch: Differentiate H(t+u) + H(t-u) = 2H(t)H(u) twice with respect to u, then set u = 0 to get H''(t) = H''(0) · H(t). With calibration H''(0) = 1, this gives H''(t) = H(t). -/ def dAlembert_to_ODE_hypothesis (H : ℝ → ℝ) : Prop := H 0 = 1 → Continuous H → (∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) → deriv (deriv H) 0 = 1 → ∀ t, deriv (deriv H) t = H tThe dAlembert_diff_square lemma is what makes it possible to convert the algebraic constraint of the d'Alembert equation into a statement about differences, which yields the differential equation. dAlembert_to_ODE_hypothesis · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Canonical normalization selects the RCL member of the bilinear family. -/ theorem gate_forces_rcl (P : ℝ → ℝ → ℝ) (hGate : FactorizationAssociativityGate P) : ∀ u v, P u v = 2 * u * v + 2 * u + 2 * v := by obtain ⟨c, hc⟩ := gate_forces_bilinear_family P hGate have hc_two : c = 2 := by have h11 : P 1 1 = c * 1 * 1 + 2 * 1 + 2 * 1 := by simpa using hc 1 1 linarith [hGate.unitDiagonal, h11] intro u v calc P u v = c * u * v + 2 * u + 2 * v := hc u v _ = 2 * u * v + 2 * u + 2 * v := by rw [hc_two]The theorem gate_forces_rcl proves that any function P satisfying all four conditions must equal rclCombiner exactly. gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM factorization_gate_iff_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Exact gate characterization: the factorization gate is equivalent to being the canonical RCL combiner. -/ theorem factorization_gate_iff_rcl (P : ℝ → ℝ → ℝ) : FactorizationAssociativityGate P ↔ ∀ u v, P u v = rclCombiner u v := by constructor · intro hGate u v rw [gate_forces_rcl P hGate u v] rfl · intro hP refine { symmetric := ?_ rightAffine := ?_ zeroBoundary := ?_ unitDiagonal := ?_ } · intro u v rw [hP u v, hP v u] unfold rclCombiner ring · intro u refine ⟨2 * u + 2, 2 * u, ?_⟩ intro v rw [hP u v] unfold rclCombiner ring · intro u rw [hP u 0] unfold rclCombiner ring · rw [hP 1 1] unfold rclCombiner norm_numA second theorem, factorization_gate_iff_rcl, strengthens this to an equivalence: satisfying the gate is the same as being the canonical combiner. factorization_gate_iff_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Canonical normalization selects the RCL member of the bilinear family. -/ theorem gate_forces_rcl (P : ℝ → ℝ → ℝ) (hGate : FactorizationAssociativityGate P) : ∀ u v, P u v = 2 * u * v + 2 * u + 2 * v := by obtain ⟨c, hc⟩ := gate_forces_bilinear_family P hGate have hc_two : c = 2 := by have h11 : P 1 1 = c * 1 * 1 + 2 * 1 + 2 * 1 := by simpa using hc 1 1 linarith [hGate.unitDiagonal, h11] intro u v calc P u v = c * u * v + 2 * u + 2 * v := hc u v _ = 2 * u * v + 2 * u + 2 * v := by rw [hc_two]The normalization P(1,1) = 6 selects the coefficient 2, just as the boundary conditions select the single-cost formula. gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Zero Uniqueness)**: The unique solution to f'' = f with f(0) = f'(0) = 0 is f = 0. -/ theorem ode_zero_uniqueness (f : ℝ → ℝ) (h_diff2 : ContDiff ℝ 2 f) (h_ode : ∀ t, deriv (deriv f) t = f t) (h_f0 : f 0 = 0) (h_f'0 : deriv f 0 = 0) : ∀ t, f t = 0 := by have ⟨h_minus, h_plus⟩ := ode_diagonalization f h_diff2 h_ode have h_diff1 : Differentiable ℝ f := h_diff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have h_deriv_contdiff : ContDiff ℝ 1 (deriv f) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff2 rw [contDiff_succ_iff_deriv] at h_diff2 exact h_diff2.2.2 have h_diff_deriv : Differentiable ℝ (deriv f) := h_deriv_contdiff.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) let g := fun s => deriv f s - f s let hf := fun s => deriv f s + f s have hg_diff : Differentiable ℝ g := h_diff_deriv.sub h_diff1 have hh_diff : Differentiable ℝ hf := h_diff_deriv.add h_diff1 have hg0 : g 0 = 0 := by simp [g, h_f0, h_f'0] have hh0 : hf 0 = 0 := by simp [hf, h_f0, h_f'0] have hg_deriv : ∀ t, deriv g t = -g t := h_minus have hh_deriv : ∀ t, deriv hf t = hf t := h_plus have hg_zero := deriv_neg_self_zero g hg_diff hg_deriv hg0 have hh_zero := deriv_pos_self_zero hf hh_diff hh_deriv hh0 intro t have hgt := hg_zero t have hht := hh_zero t simp only [g, hf] at hgt hht linarithThe lemma deriv_neg_self_zero states that if a function satisfies the differential equation f'' = -f, then at zero the second derivative must be zero. ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The cost uniqueness theorem shows that any cost function obeying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_deriv_zero : deriv H 0 = 0 := by have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt exact even_deriv_at_zero H h_even h_diff exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hypThe uniqueness proof uses deriv_neg_self_zero to rule out the cosine solution, leaving only the hyperbolic cosine as the admissible solution. dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ) (h_ODE : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := h_cont_hyp h_ODE have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0The theorem ode_cosh_uniqueness states that if H satisfies H'' = H, with H(0) = 1 and H'(0) = 0, then H must be the hyperbolic cosine. ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Zero Uniqueness)**: The unique solution to f'' = f with f(0) = f'(0) = 0 is f = 0. -/ theorem ode_zero_uniqueness (f : ℝ → ℝ) (h_diff2 : ContDiff ℝ 2 f) (h_ode : ∀ t, deriv (deriv f) t = f t) (h_f0 : f 0 = 0) (h_f'0 : deriv f 0 = 0) : ∀ t, f t = 0 := by have ⟨h_minus, h_plus⟩ := ode_diagonalization f h_diff2 h_ode have h_diff1 : Differentiable ℝ f := h_diff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have h_deriv_contdiff : ContDiff ℝ 1 (deriv f) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff2 rw [contDiff_succ_iff_deriv] at h_diff2 exact h_diff2.2.2 have h_diff_deriv : Differentiable ℝ (deriv f) := h_deriv_contdiff.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) let g := fun s => deriv f s - f s let hf := fun s => deriv f s + f s have hg_diff : Differentiable ℝ g := h_diff_deriv.sub h_diff1 have hh_diff : Differentiable ℝ hf := h_diff_deriv.add h_diff1 have hg0 : g 0 = 0 := by simp [g, h_f0, h_f'0] have hh0 : hf 0 = 0 := by simp [hf, h_f0, h_f'0] have hg_deriv : ∀ t, deriv g t = -g t := h_minus have hh_deriv : ∀ t, deriv hf t = hf t := h_plus have hg_zero := deriv_neg_self_zero g hg_diff hg_deriv hg0 have hh_zero := deriv_pos_self_zero hf hh_diff hh_deriv hh0 intro t have hgt := hg_zero t have hht := hh_zero t simp only [g, hf] at hgt hht linarithThe proof applies a lemma about even functions: the difference of two candidate solutions inherits the differential equation, has zero value and zero derivative at zero, and therefore is identically zero. ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypA parallel route derives the same conclusion from the d'Alembert functional equation directly, without passing through the ODE. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM CoshAddIdentity_implies_DirectCoshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma CoshAddIdentity_implies_DirectCoshAdd (F : ℝ → ℝ) (h : CoshAddIdentity F) : DirectCoshAdd (G F) := hif a cost function F satisfies the composition law, then its log-coordinate transform G(t) = F(e^t) satisfies a direct addition identity CoshAddIdentity_implies_DirectCoshAdd · IndisputableMonolith/Cost/FunctionalEquation.leanMODEL SatisfiesCompositionLaw · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Composition Law (Equation 1.1)**: F(xy) + F(x/y) = 2·F(x)·F(y) + 2·F(x) + 2·F(y) for all x, y > 0. This is the Recognition Composition Law (RCL). -/ def SatisfiesCompositionLaw (F : ℝ → ℝ) : Prop := ∀ x y : ℝ, 0 < x → 0 < y → F (x * y) + F (x / y) = 2 * F x * F y + 2 * F x + 2 * F ythe composition law itself is multiplicative, it governs how costs combine when you multiply two positive numbers SatisfiesCompositionLaw · IndisputableMonolith/Cost/FunctionalEquation.leanMODEL IsReciprocalCost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Definition 2.1 (Reciprocal Cost)** A function F : ℝ₊ → ℝ is a reciprocal cost if F(x) = F(1/x) for all x > 0. -/ def IsReciprocalCost (F : ℝ → ℝ) : Prop := ∀ x : ℝ, 0 < x → F x = F x⁻¹The reciprocal condition declares that for any positive x, the cost of recognizing x equals the cost of recognizing its reciprocal 1/x. IsReciprocalCost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The reciprocal condition is one of the five hypotheses of the main theorem law_of_logic_forces_jcost. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Lemma 2.1**: If F is reciprocal, then G(t) = F(e^t) is even. -/ theorem reciprocal_implies_G_even (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) : Function.Even (G F) := G_even_of_reciprocal_symmetry F (fun {x} hx => hRecip x hx)The proof shows that from the reciprocal condition alone, the transformed function G F t = F (exp t) is even. reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM CoshAddIdentity_implies_DirectCoshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma CoshAddIdentity_implies_DirectCoshAdd (F : ℝ → ℝ) (h : CoshAddIdentity F) : DirectCoshAdd (G F) := hThe lemma CoshAddIdentity_implies_DirectCoshAdd states that if a function F satisfies this cosine addition identity in log coordinates, then the transformed function G satisfies the same identity directly. CoshAddIdentity_implies_DirectCoshAdd · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The main theorem law_of_logic_forces_jcost does not use it, because the proof passes through a different route: it derives a differential equation in log coordinates, H'' = H, and solves that. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM hasLogCurvature_full_filter_forces_zero · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Tripwire.** The full-filter reading of log curvature forces `κ = 0`, so at the calibrated value `κ = 1` it is satisfied by no function at all. Kept as a theorem so the defect cannot be reintroduced without a failing build. -/ theorem hasLogCurvature_full_filter_forces_zero (Hf : ℝ → ℝ) (κ : ℝ) (h : Filter.Tendsto (fun t => 2 * (Hf t - 1) / t^2) (nhds 0) (nhds κ)) : κ = 0 := by have h1 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2) (pure 0) (nhds κ) := h.mono_left (pure_le_nhds 0) have h2 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2) (pure 0) (nhds (2 * (Hf 0 - 1) / (0 : ℝ) ^ 2)) := tendsto_pure_nhds _ _ have h3 := tendsto_nhds_unique h2 h1 simpa using h3.symmThe declaration hasLogCurvature_full_filter_forces_zero is a technical lemma about limits. hasLogCurvature_full_filter_forces_zero · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM hasLogCurvature_full_filter_forces_zero · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Tripwire.** The full-filter reading of log curvature forces `κ = 0`, so at the calibrated value `κ = 1` it is satisfied by no function at all. Kept as a theorem so the defect cannot be reintroduced without a failing build. -/ theorem hasLogCurvature_full_filter_forces_zero (Hf : ℝ → ℝ) (κ : ℝ) (h : Filter.Tendsto (fun t => 2 * (Hf t - 1) / t^2) (nhds 0) (nhds κ)) : κ = 0 := by have h1 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2) (pure 0) (nhds κ) := h.mono_left (pure_le_nhds 0) have h2 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2) (pure 0) (nhds (2 * (Hf 0 - 1) / (0 : ℝ) ^ 2)) := tendsto_pure_nhds _ _ have h3 := tendsto_nhds_unique h2 h1 simpa using h3.symmThe lemma states that if a function Hf satisfies a certain limit condition at zero, namely that 2 * (Hf t - 1) / t^2 tends to some number κ as t tends to 0, then κ must be 0. hasLogCurvature_full_filter_forces_zero · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM HasLogCurvature · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The paper's log curvature `κ(F) = lim_{t→0} 2 F(e^t)/t²`, stated on the **punctured** filter. The puncture is not cosmetic. On the full filter `nhds 0` this predicate is unsatisfiable for every nonzero `κ`: Lean's division is total with `x / 0 = 0`, so the quotient takes the value `0` at `t = 0`, and convergence along a filter that contains the point pins the value at the point. The repo carried the full-filter reading until 2026-07-25, which silently made two results vacuous; `hasLogCurvature_full_filter_forces_zero` keeps that from recurring quietly. -/ def HasLogCurvature (H : ℝ → ℝ) (κ : ℝ) : Prop := Filter.Tendsto (fun t => 2 * (H t - 1) / t^2) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds κ)The lemma does not directly apply to the log-curvature condition used in the proof. HasLogCurvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM gate_forces_bilinear_family · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Once the affine-response step is known, symmetry and the boundary law force the entire bilinear family. -/ theorem gate_forces_bilinear_family (P : ℝ → ℝ → ℝ) (hGate : FactorizationAssociativityGate P) : ∃ c : ℝ, ∀ u v, P u v = c * u * v + 2 * u + 2 * v := by classical choose α β hAffine using hGate.rightAffine have hβ : ∀ u, β u = 2 * u := by intro u have h0 : P u 0 = α u * 0 + β u := hAffine u 0 rw [hGate.zeroBoundary u] at h0 linarith let c : ℝ := α 1 - 2 refine ⟨c, ?_⟩ intro u v have hsym1 : P u 1 = P 1 u := hGate.symmetric u 1 have hαu : α u = c * u + 2 := by dsimp [c] have hcalc : α u * 1 + β u = α 1 * u + β 1 := by calc α u * 1 + β u = P u 1 := by symm; exact hAffine u 1 _ = P 1 u := hGate.symmetric u 1 _ = α 1 * u + β 1 := hAffine 1 u rw [hβ u, hβ 1] at hcalc linarith calc P u v = α u * v + β u := hAffine u v _ = (c * u + 2) * v + 2 * u := by rw [hαu, hβ u] _ = c * u * v + 2 * u + 2 * v := by ringThe theorem gate_forces_bilinear_family proves that any function P satisfying the four gate properties must have the form P u v = c * u * v + 2 * u + 2 * v for some constant c. gate_forces_bilinear_family · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Canonical normalization selects the RCL member of the bilinear family. -/ theorem gate_forces_rcl (P : ℝ → ℝ → ℝ) (hGate : FactorizationAssociativityGate P) : ∀ u v, P u v = 2 * u * v + 2 * u + 2 * v := by obtain ⟨c, hc⟩ := gate_forces_bilinear_family P hGate have hc_two : c = 2 := by have h11 : P 1 1 = c * 1 * 1 + 2 * 1 + 2 * 1 := by simpa using hc 1 1 linarith [hGate.unitDiagonal, h11] intro u v calc P u v = c * u * v + 2 * u + 2 * v := hc u v _ = 2 * u * v + 2 * u + 2 * v := by rw [hc_two]The canonical normalization P(1,1) = 6 forces c = 2, yielding exactly the RCL combiner 2uv + 2u + 2v. gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanMODEL FactorizationAssociativityGate · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Packaged combiner gate used by the factorization/associativity bridge. -/ structure FactorizationAssociativityGate (P : ℝ → ℝ → ℝ) : Prop where symmetric : ∀ u v, P u v = P v u rightAffine : ∀ u, ∃ α β, ∀ v, P u v = α * v + β zeroBoundary : ∀ u, P u 0 = 2 * u unitDiagonal : P 1 1 = 6The gate is a structure with four properties: symmetry, affine response in the second argument, the boundary law P(u,0) = 2u, and the normalization P(1,1) = 6. FactorizationAssociativityGate · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G. Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y) becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t) via the substitution x = e^s, y = e^t. -/ theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) : SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by constructor · intro hComp t u have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos -- exp(t) * exp(u) = exp(t + u) have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm -- exp(t) / exp(u) = exp(t - u) have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg] simp only [G, h1, h2] at h ⊢ linarith · intro hCosh x y hx hy let t := Real.log x let u := Real.log y have hx_eq : x = Real.exp t := (Real.exp_log hx).symm have hy_eq : y = Real.exp u := (Real.exp_log hy).symm have h := hCosh t u simp only [G] at h rw [hx_eq, hy_eq] rw [← Real.exp_add, ← Real.exp_sub] -- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u)) -- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u) calc F (Real.exp (t + u)) + F (Real.exp (t - u)) = 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h _ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ringThe library proves that the composition law on F is equivalent to this direct identity on G (composition_law_equiv_coshAdd). composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM CoshAddIdentity_implies_DirectCoshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma CoshAddIdentity_implies_DirectCoshAdd (F : ℝ → ℝ) (h : CoshAddIdentity F) : DirectCoshAdd (G F) := hThe identity implies the direct form (CoshAddIdentity_implies_DirectCoshAdd). CoshAddIdentity_implies_DirectCoshAdd · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_continuous_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_continuous_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) : Continuous H := by refine continuous_iff_continuousAt.2 ?_ intro t have h_lim_H : Filter.Tendsto H (nhds 0) (nhds 1) := tendsto_H_one_of_log_curvature H h_one h_calib have h_sum : Filter.Tendsto (fun u => H (t+u) + H (t-u)) (nhds 0) (nhds (2 * H t)) := by have h_prod : Filter.Tendsto (fun u => (2 * H t) * H u) (nhds 0) (nhds ((2 * H t) * (1 : ℝ))) := (tendsto_const_nhds.mul h_lim_H) have h_prod' : Filter.Tendsto (fun u => 2 * H t * H u) (nhds 0) (nhds (2 * H t)) := by simpa [mul_assoc] using h_prod have h_eq : (fun u => H (t+u) + H (t-u)) = fun u => 2 * H t * H u := by funext u exact h_dAlembert t u simpa [h_eq] using h_prod' have h_diff_sq : Filter.Tendsto (fun u => (H (t+u) - H (t-u))^2) (nhds 0) (nhds (0 : ℝ)) := by have h_u_sq : Filter.Tendsto (fun u => (H u)^2) (nhds 0) (nhds ((1 : ℝ)^2)) := by simpa [pow_two] using h_lim_H.mul h_lim_H have h_u_sq_sub : Filter.Tendsto (fun u => (H u)^2 - 1) (nhds 0) (nhds (0 : ℝ)) := by have h_const : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhds 0) (nhds (1 : ℝ)) := tendsto_const_nhds simpa using h_u_sq.sub h_const have h_const : Filter.Tendsto (fun _ : ℝ => 4 * ((H t)^2 - 1)) (nhds 0) (nhds (4 * ((H t)^2 - 1))) := tendsto_const_nhds have h_mul : Filter.Tendsto (fun u => (4 * ((H t)^2 - 1)) * ((H u)^2 - 1)) (nhds 0) (nhds (4 * ((H t)^2 - 1) * (0 : ℝ))) := h_const.mul h_u_sq_sub have h_eq : (fun u => (H (t+u) - H (t-u))^2) = (fun u => 4 * ((H t)^2 - 1) * ((H u)^2 - 1)) := by funext u exact dAlembert_diff_square H h_one h_dAlembert t u simpa [h_eq] using h_mul have h_abs : Filter.Tendsto (fun u => |H (t+u) - H (t-u)|) (nhds 0) (nhds (0 : ℝ)) := by have h_sqrt : Filter.Tendsto (fun u => Real.sqrt ((H (t+u) - H (t-u))^2)) (nhds 0) (nhds (Real.sqrt 0)) := (Real.continuous_sqrt.tendsto 0).comp h_diff_sq simpa [Real.sqrt_sq_eq_abs] using h_sqrt have h_diff : Filter.Tendsto (fun u => H (t+u) - H (t-u)) (nhds 0) (nhds (0 : ℝ)) := (tendsto_zero_iff_abs_tendsto_zero (f := fun u => H (t+u) - H (t-u))).2 h_abs have h_sum_diff : Filter.Tendsto (fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) (nhds 0) (nhds ((2 * H t) + (0 : ℝ))) := h_sum.add h_diff have h_twice : Filter.Tendsto (fun u => 2 * H (t+u)) (nhds 0) (nhds (2 * H t)) := by have h_sum_diff' : Filter.Tendsto (fun u => H (t+u) + H (t+u)) (nhds 0) (nhds (2 * H t)) := by have h_eq : (fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) = (fun u => H (t+u) + H (t+u)) := by funext u ring have h_sum_diff'' : Filter.Tendsto (fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) (nhds 0) (nhds (2 * H t)) := by simpa using h_sum_diff simpa [h_eq] using h_sum_diff'' simpa [two_mul] using h_sum_diff' have h_half : Filter.Tendsto (fun u => (2 * H (t+u)) / 2) (nhds 0) (nhds ((2 * H t) / 2)) := by have h_const : Filter.Tendsto (fun _ : ℝ => (1 / 2 : ℝ)) (nhds 0) (nhds (1 / 2 : ℝ)) := tendsto_const_nhds simpa [div_eq_mul_inv] using h_twice.mul h_const have h_at0 : Filter.Tendsto (fun u => H (t+u)) (nhds 0) (nhds (H t)) := by simpa using h_half have h_map : Filter.Tendsto H (Filter.map (fun u => t + u) (nhds 0)) (nhds (H t)) := (Filter.tendsto_map'_iff).2 h_at0 have h_tendsto : Filter.Tendsto H (nhds t) (nhds (H t)) := by simpa [map_add_left_nhds_zero] using h_map exact h_tendstoA function satisfying the cosine addition identity, with H(0) = 1 and log-curvature at 0, is continuous everywhere. dAlembert_continuous_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_cosh_add_identity : CoshAddIdentity Cost.Jcost := by intro t u simp only [G, Jcost] -- Use exp(t+u) = exp(t)*exp(u) and exp(t-u) = exp(t)/exp(u) have he1 : Real.exp (t + u) = Real.exp t * Real.exp u := Real.exp_add t u have he2 : Real.exp (t - u) = Real.exp t / Real.exp u := by rw [sub_eq_add_neg, Real.exp_add, Real.exp_neg] ring have hpos_t : Real.exp t > 0 := Real.exp_pos t have hpos_u : Real.exp u > 0 := Real.exp_pos u have hne_t : Real.exp t ≠ 0 := hpos_t.ne' have hne_u : Real.exp u ≠ 0 := hpos_u.ne' rw [he1, he2] field_simp ringThe Jcost function itself satisfies the direct cosh identity. Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Zero Uniqueness)**: The unique solution to f'' = f with f(0) = f'(0) = 0 is f = 0. -/ theorem ode_zero_uniqueness (f : ℝ → ℝ) (h_diff2 : ContDiff ℝ 2 f) (h_ode : ∀ t, deriv (deriv f) t = f t) (h_f0 : f 0 = 0) (h_f'0 : deriv f 0 = 0) : ∀ t, f t = 0 := by have ⟨h_minus, h_plus⟩ := ode_diagonalization f h_diff2 h_ode have h_diff1 : Differentiable ℝ f := h_diff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have h_deriv_contdiff : ContDiff ℝ 1 (deriv f) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff2 rw [contDiff_succ_iff_deriv] at h_diff2 exact h_diff2.2.2 have h_diff_deriv : Differentiable ℝ (deriv f) := h_deriv_contdiff.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) let g := fun s => deriv f s - f s let hf := fun s => deriv f s + f s have hg_diff : Differentiable ℝ g := h_diff_deriv.sub h_diff1 have hh_diff : Differentiable ℝ hf := h_diff_deriv.add h_diff1 have hg0 : g 0 = 0 := by simp [g, h_f0, h_f'0] have hh0 : hf 0 = 0 := by simp [hf, h_f0, h_f'0] have hg_deriv : ∀ t, deriv g t = -g t := h_minus have hh_deriv : ∀ t, deriv hf t = hf t := h_plus have hg_zero := deriv_neg_self_zero g hg_diff hg_deriv hg0 have hh_zero := deriv_pos_self_zero hf hh_diff hh_deriv hh0 intro t have hgt := hg_zero t have hht := hh_zero t simp only [g, hf] at hgt hht linarithThe lemma ode_zero_uniqueness states that if a twice-differentiable function f satisfies f'' = f everywhere, and if f(0) = 0 and f'(0) = 0, then f is identically zero. ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Derivation, universal coefficient)**: If H is C∞ and satisfies d'Alembert, then `H''(t) = H''(0) * H(t)` everywhere. This is the unnormalized form of `dAlembert_to_ODE_theorem`. -/ theorem dAlembert_to_ODE_general_theorem (H : ℝ → ℝ) (h_smooth : ContDiff ℝ ⊤ H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) : ∀ t, deriv (deriv H) t = deriv (deriv H) 0 * H t := by have hCDiff2 : ContDiff ℝ 2 H := h_smooth.of_le le_top have hDiff : Differentiable ℝ H := hCDiff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have hCDiff1_H' : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at hCDiff2 rw [contDiff_succ_iff_deriv] at hCDiff2 exact hCDiff2.2.2 have hDiffDeriv : Differentiable ℝ (deriv H) := hCDiff1_H'.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) have hsh_add : ∀ (s v : ℝ), HasDerivAt (fun u => s + u) (1 : ℝ) v := fun s v => by have h := (hasDerivAt_id v).add_const s; simp only [id] at h rwa [show (fun u : ℝ => u + s) = fun u => s + u from funext fun u => add_comm u s] at h have hsh_sub : ∀ (s v : ℝ), HasDerivAt (fun u => s - u) (-1 : ℝ) v := fun s v => by have h1 : HasDerivAt (fun u : ℝ => -u) (-1 : ℝ) v := by have := (hasDerivAt_id v).neg; simp only [id] at this; exact this have h2 := h1.const_add s rwa [show (fun u : ℝ => s + -u) = fun u => s - u from funext fun u => by ring] at h2 intro t have h_feq : (fun u => H (t + u) + H (t - u)) = (fun u => 2 * H t * H u) := funext (h_dAlembert t) have key : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = deriv (deriv (fun u => 2 * H t * H u)) 0 := congr_arg (fun f => deriv (deriv f) 0) h_feq have lhs_eq : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = 2 * deriv (deriv H) t := by have h_plus : ∀ v, HasDerivAt (fun u => H (t + u)) (deriv H (t + v)) v := fun v => by have hH := (hDiff (t + v)).hasDerivAt have hcomp := hH.comp v (hsh_add t v) simp only [mul_one, Function.comp_apply] at hcomp; exact hcomp have h_minus : ∀ v, HasDerivAt (fun u => H (t - u)) (-deriv H (t - v)) v := fun v => by have hH := (hDiff (t - v)).hasDerivAt have hcomp := hH.comp v (hsh_sub t v) simp only [mul_neg, mul_one, Function.comp_apply] at hcomp; exact hcomp have hfirst_fun : deriv (fun u => H (t + u) + H (t - u)) = fun v => deriv H (t + v) - deriv H (t - v) := funext fun v => by have heq : (fun u => H (t + u)) + (fun u => H (t - u)) = fun u => H (t + u) + H (t - u) := by ext u; rfl have h12 : deriv (fun u => H (t + u) + H (t - u)) v = deriv H (t + v) + -deriv H (t - v) := by rw [← heq]; exact ((h_plus v).add (h_minus v)).deriv linarith [show deriv H (t + v) + -deriv H (t - v) = deriv H (t + v) - deriv H (t - v) from by ring] have hd2_plus : HasDerivAt (fun v => deriv H (t + v)) (deriv (deriv H) t) 0 := by have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t + 0)) (t + 0) := (hDiffDeriv (t + 0)).hasDerivAt have hcomp := hDH.comp 0 (hsh_add t 0) simp only [mul_one, add_zero, Function.comp_apply] at hcomp; exact hcomp have hd2_minus : HasDerivAt (fun v => deriv H (t - v)) (-deriv (deriv H) t) 0 := by have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t - 0)) (t - 0) := (hDiffDeriv (t - 0)).hasDerivAt have hcomp := hDH.comp 0 (hsh_sub t 0) simp only [mul_neg, mul_one, sub_zero, Function.comp_apply] at hcomp; exact hcomp rw [congr_fun (congr_arg deriv hfirst_fun) 0] have heq2 : (fun v => deriv H (t + v)) - (fun v => deriv H (t - v)) = fun v => deriv H (t + v) - deriv H (t - v) := by ext v; rfl have h : deriv (fun v => deriv H (t + v) - deriv H (t - v)) 0 = deriv (deriv H) t - -deriv (deriv H) t := by rw [← heq2]; exact (hd2_plus.sub hd2_minus).deriv linarith [show deriv (deriv H) t - -deriv (deriv H) t = 2 * deriv (deriv H) t from by ring] have rhs_eq : deriv (deriv (fun u => 2 * H t * H u)) 0 = 2 * H t * deriv (deriv H) 0 := by have hfirst_fun : deriv (fun u => 2 * H t * H u) = fun v => 2 * H t * deriv H v := funext fun v => ((hDiff v).hasDerivAt.const_mul (2 * H t)).deriv have hsecond := (hDiffDeriv 0).hasDerivAt.const_mul (2 * H t) rw [congr_fun (congr_arg deriv hfirst_fun) 0, hsecond.deriv] rw [lhs_eq, rhs_eq] at key linarithThe proof of the main theorem transforms the cost function into log coordinates, where the transformed function H(t) = F(e^t) + 1 must satisfy H'' = H. dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM logCurvature_forces_normalized · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The composition law together with unit log curvature force normalization. The composition law at `y = 1` gives `F 1 * (F x + 1) = 0`, so either `F 1 = 0` or `F` is constantly `-1`; the constant has `H ≡ 0`, whose curvature quotient is negative throughout a punctured neighbourhood and so cannot tend to `1`. -/ theorem logCurvature_forces_normalized (F : ℝ → ℝ) (hComp : SatisfiesCompositionLaw F) (hκ : HasLogCurvature (H F) 1) : IsNormalized F := by by_contra hne have hconst : ∀ x : ℝ, 0 < x → F x = -1 := by intro x hx have h := hComp x 1 hx one_pos rw [mul_one, div_one] at h have hquad : F 1 * (F x + 1) = 0 := by nlinarith rcases mul_eq_zero.mp hquad with h1 | h2 · exact absurd h1 hne · linarith have hH : ∀ t : ℝ, H F t = 0 := by intro t have hx := hconst (Real.exp t) (Real.exp_pos t) simp [H, G, hx] have hgt : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), (1 / 2 : ℝ) < 2 * (H F t - 1) / t ^ 2 := hκ.eventually (eventually_gt_nhds (by norm_num)) have hne0 : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), t ≠ 0 := by filter_upwards [self_mem_nhdsWithin] with t ht using ht obtain ⟨t, hgt', ht0⟩ := (hgt.and hne0).exists have ht2 : 0 < t ^ 2 := by positivity have hneg : 2 * (H F t - 1) / t ^ 2 < 0 := by rw [hH t] exact div_neg_of_neg_of_pos (by norm_num) ht2 linarithThe initial conditions H(0) = 1 and H'(0) = 0 come from the normalization and calibration conditions on the original cost. logCurvature_forces_normalized · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Lemma 2.1**: If F is reciprocal, then G(t) = F(e^t) is even. -/ theorem reciprocal_implies_G_even (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) : Function.Even (G F) := G_even_of_reciprocal_symmetry F (fun {x} hx => hRecip x hx)The theorem reciprocal_implies_G_even shows that the reciprocal symmetry condition forces the transformed function G(t) = F(e^t) to be even. reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.leanMODEL dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThe d'Alembert equation admits many continuous solutions, including exponential combinations and zero functions. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ) (h_ODE : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := h_cont_hyp h_ODE have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0The theorem ode_cosh_uniqueness proves that the differential equation H'' = H with initial conditions H(0) = 1 and H'(0) = 0 has exactly one solution, namely cosh. ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G. Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y) becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t) via the substitution x = e^s, y = e^t. -/ theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) : SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by constructor · intro hComp t u have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos -- exp(t) * exp(u) = exp(t + u) have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm -- exp(t) / exp(u) = exp(t - u) have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg] simp only [G, h1, h2] at h ⊢ linarith · intro hCosh x y hx hy let t := Real.log x let u := Real.log y have hx_eq : x = Real.exp t := (Real.exp_log hx).symm have hy_eq : y = Real.exp u := (Real.exp_log hy).symm have h := hCosh t u simp only [G] at h rw [hx_eq, hy_eq] rw [← Real.exp_add, ← Real.exp_sub] -- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u)) -- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u) calc F (Real.exp (t + u)) + F (Real.exp (t - u)) = 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h _ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ringThe theorem composition_law_equiv_coshAdd proves that the composition law is equivalent to a cosine addition identity in log coordinates. composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThe theorem dAlembert_cosh_solution_of_log_curvature derives the cosh conclusion from the d'Alembert equation, the calibration condition, and the evenness that reciprocal symmetry provides. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The final theorem law_of_logic_forces_jcost assembles all five conditions to reach J(x). law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The cost uniqueness theorem states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM HasLogCurvature · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The paper's log curvature `κ(F) = lim_{t→0} 2 F(e^t)/t²`, stated on the **punctured** filter. The puncture is not cosmetic. On the full filter `nhds 0` this predicate is unsatisfiable for every nonzero `κ`: Lean's division is total with `x / 0 = 0`, so the quotient takes the value `0` at `t = 0`, and convergence along a filter that contains the point pins the value at the point. The repo carried the full-filter reading until 2026-07-25, which silently made two results vacuous; `hasLogCurvature_full_filter_forces_zero` keeps that from recurring quietly. -/ def HasLogCurvature (H : ℝ → ℝ) (κ : ℝ) : Prop := Filter.Tendsto (fun t => 2 * (H t - 1) / t^2) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds κ)The calibration condition is the one that fixes the local scale of recognition near the identity. HasLogCurvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThe condition says this log-curvature equals 1, which selects the hyperbolic cosine solution from the family of functions satisfying the differential equation H'' = H. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM logCurvature_forces_normalized · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The composition law together with unit log curvature force normalization. The composition law at `y = 1` gives `F 1 * (F x + 1) = 0`, so either `F 1 = 0` or `F` is constantly `-1`; the constant has `H ≡ 0`, whose curvature quotient is negative throughout a punctured neighbourhood and so cannot tend to `1`. -/ theorem logCurvature_forces_normalized (F : ℝ → ℝ) (hComp : SatisfiesCompositionLaw F) (hκ : HasLogCurvature (H F) 1) : IsNormalized F := by by_contra hne have hconst : ∀ x : ℝ, 0 < x → F x = -1 := by intro x hx have h := hComp x 1 hx one_pos rw [mul_one, div_one] at h have hquad : F 1 * (F x + 1) = 0 := by nlinarith rcases mul_eq_zero.mp hquad with h1 | h2 · exact absurd h1 hne · linarith have hH : ∀ t : ℝ, H F t = 0 := by intro t have hx := hconst (Real.exp t) (Real.exp_pos t) simp [H, G, hx] have hgt : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), (1 / 2 : ℝ) < 2 * (H F t - 1) / t ^ 2 := hκ.eventually (eventually_gt_nhds (by norm_num)) have hne0 : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), t ≠ 0 := by filter_upwards [self_mem_nhdsWithin] with t ht using ht obtain ⟨t, hgt', ht0⟩ := (hgt.and hne0).exists have ht2 : 0 < t ^ 2 := by positivity have hneg : 2 * (H F t - 1) / t ^ 2 < 0 := by rw [hH t] exact div_neg_of_neg_of_pos (by norm_num) ht2 linarithIn the proof, the log-curvature condition is also what implies the cost is normalized, meaning the cost of recognizing something identical to itself is zero. logCurvature_forces_normalized · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM hasLogCurvature_full_filter_forces_zero · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Tripwire.** The full-filter reading of log curvature forces `κ = 0`, so at the calibrated value `κ = 1` it is satisfied by no function at all. Kept as a theorem so the defect cannot be reintroduced without a failing build. -/ theorem hasLogCurvature_full_filter_forces_zero (Hf : ℝ → ℝ) (κ : ℝ) (h : Filter.Tendsto (fun t => 2 * (Hf t - 1) / t^2) (nhds 0) (nhds κ)) : κ = 0 := by have h1 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2) (pure 0) (nhds κ) := h.mono_left (pure_le_nhds 0) have h2 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2) (pure 0) (nhds (2 * (Hf 0 - 1) / (0 : ℝ) ^ 2)) := tendsto_pure_nhds _ _ have h3 := tendsto_nhds_unique h2 h1 simpa using h3.symmThe lemma hasLogCurvature_full_filter_forces_zero states that if the limit of 2 * (H(t) - 1) / t^2 exists as t approaches 0, then the limiting value must be 0. hasLogCurvature_full_filter_forces_zero · IndisputableMonolith/Cost/FunctionalEquation.leanMODEL HasLogCurvature · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The paper's log curvature `κ(F) = lim_{t→0} 2 F(e^t)/t²`, stated on the **punctured** filter. The puncture is not cosmetic. On the full filter `nhds 0` this predicate is unsatisfiable for every nonzero `κ`: Lean's division is total with `x / 0 = 0`, so the quotient takes the value `0` at `t = 0`, and convergence along a filter that contains the point pins the value at the point. The repo carried the full-filter reading until 2026-07-25, which silently made two results vacuous; `hasLogCurvature_full_filter_forces_zero` keeps that from recurring quietly. -/ def HasLogCurvature (H : ℝ → ℝ) (κ : ℝ) : Prop := Filter.Tendsto (fun t => 2 * (H t - 1) / t^2) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds κ)The calibration condition is expressed through a quantity called the log-curvature of the transformed function H(t) = F(e^t) + 1. HasLogCurvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Zero Uniqueness)**: The unique solution to f'' = f with f(0) = f'(0) = 0 is f = 0. -/ theorem ode_zero_uniqueness (f : ℝ → ℝ) (h_diff2 : ContDiff ℝ 2 f) (h_ode : ∀ t, deriv (deriv f) t = f t) (h_f0 : f 0 = 0) (h_f'0 : deriv f 0 = 0) : ∀ t, f t = 0 := by have ⟨h_minus, h_plus⟩ := ode_diagonalization f h_diff2 h_ode have h_diff1 : Differentiable ℝ f := h_diff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have h_deriv_contdiff : ContDiff ℝ 1 (deriv f) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff2 rw [contDiff_succ_iff_deriv] at h_diff2 exact h_diff2.2.2 have h_diff_deriv : Differentiable ℝ (deriv f) := h_deriv_contdiff.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) let g := fun s => deriv f s - f s let hf := fun s => deriv f s + f s have hg_diff : Differentiable ℝ g := h_diff_deriv.sub h_diff1 have hh_diff : Differentiable ℝ hf := h_diff_deriv.add h_diff1 have hg0 : g 0 = 0 := by simp [g, h_f0, h_f'0] have hh0 : hf 0 = 0 := by simp [hf, h_f0, h_f'0] have hg_deriv : ∀ t, deriv g t = -g t := h_minus have hh_deriv : ∀ t, deriv hf t = hf t := h_plus have hg_zero := deriv_neg_self_zero g hg_diff hg_deriv hg0 have hh_zero := deriv_pos_self_zero hf hh_diff hh_deriv hh0 intro t have hgt := hg_zero t have hht := hh_zero t simp only [g, hf] at hgt hht linarithThe differential equation H'' = H would still hold, but its solutions would include exponential combinations and zero, not just the cosine-hyperbolic function. ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **The cost theorem on two premises.** The composition law and unit log curvature force `F = J` on the positives. Normalization, nonnegativity, and continuity are all conclusions rather than hypotheses; compare `law_of_logic_forces_jcost`, which assumes all of them. -/ theorem composition_logCurvature_forces_jcost [AczelSmoothnessPackage] (F : ℝ → ℝ) (hComp : SatisfiesCompositionLaw F) (hκ : HasLogCurvature (H F) 1) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by have hNorm : IsNormalized F := logCurvature_forces_normalized F hComp hκ have hN : F 1 = 0 := hNorm have hH0 : H F 0 = 1 := by simp [H, G, hN] have hCosh : CoshAddIdentity F := (composition_law_equiv_coshAdd F).mp hComp have hdA : ∀ t u, H F (t + u) + H F (t - u) = 2 * H F t * H F u := by intro t u have hG := hCosh t u have hgoal : (G F (t + u) + 1) + (G F (t - u) + 1) = 2 * (G F t + 1) * (G F u + 1) := by calc (G F (t + u) + 1) + (G F (t - u) + 1) = (G F (t + u) + G F (t - u)) + 2 := by ring _ = (2 * (G F t * G F u) + 2 * (G F t + G F u)) + 2 := by simpa [hG] _ = 2 * (G F t + 1) * (G F u + 1) := by ring simpa [H] using hgoal have hcont : Continuous (H F) := dAlembert_continuous_of_log_curvature (H F) hH0 hdA hκ have hsm : ContDiff ℝ ⊤ (H F) := aczel_dAlembert_smooth (H F) hH0 hcont hdA have heven : Function.Even (H F) := dAlembert_even (H F) hH0 hdA have hd0 : deriv (H F) 0 = 0 := even_deriv_at_zero (H F) heven (hsm.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) 0) have hd2 : deriv (deriv (H F)) 0 = 1 := deriv2_of_logCurvature (H F) hsm hH0 hd0 hκ have hcosh : ∀ t, H F t = Real.cosh t := dAlembert_cosh_solution_aczel (H F) hH0 hcont hdA hd2 intro x hx have hGc : G F (Real.log x) = Real.cosh (Real.log x) - 1 := by have h := hcosh (Real.log x) simp only [H] at h linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = G F (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := hGc _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]Under the stated regularity package, the composition law and unit log curvature force F(x) = J(x) = (x + 1/x)/2 - 1 for every x > 0. composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_law_equiv_coshAdd · H · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G. Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y) becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t) via the substitution x = e^s, y = e^t. -/ theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) : SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by constructor · intro hComp t u have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos -- exp(t) * exp(u) = exp(t + u) have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm -- exp(t) / exp(u) = exp(t - u) have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg] simp only [G, h1, h2] at h ⊢ linarith · intro hCosh x y hx hy let t := Real.log x let u := Real.log y have hx_eq : x = Real.exp t := (Real.exp_log hx).symm have hy_eq : y = Real.exp u := (Real.exp_log hy).symm have h := hCosh t u simp only [G] at h rw [hx_eq, hy_eq] rw [← Real.exp_add, ← Real.exp_sub] -- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u)) -- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u) calc F (Real.exp (t + u)) + F (Real.exp (t - u)) = 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h _ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ring/-- Convenience reparametrization: `H_F t = G_F t + 1`. -/ @[simp] noncomputable def H (F : ℝ → ℝ) (t : ℝ) : ℝ := G F t + 1the composition law becomes the d'Alembert equation after a short change of variables composition_law_equiv_coshAdd · H · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM reciprocal_implies_G_even · normalized_implies_G_zero · H · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Lemma 2.1**: If F is reciprocal, then G(t) = F(e^t) is even. -/ theorem reciprocal_implies_G_even (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) : Function.Even (G F) := G_even_of_reciprocal_symmetry F (fun {x} hx => hRecip x hx)/-- **Lemma**: If F is normalized, then G(0) = 0. -/ theorem normalized_implies_G_zero (F : ℝ → ℝ) (hNorm : IsNormalized F) : G F 0 = 0 := G_zero_of_unit F hNorm/-- Convenience reparametrization: `H_F t = G_F t + 1`. -/ @[simp] noncomputable def H (F : ℝ → ℝ) (t : ℝ) : ℝ := G F t + 1Reciprocal symmetry makes G even; setting F(1) = 0 gives G(0) = 0; writing H = G + 1 gives H(0) = 1. reciprocal_implies_G_even · normalized_implies_G_zero · H · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_smooth_of_aczel · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The `dAlembert_continuous_implies_smooth_hypothesis` holds for every H, as a direct consequence of the Aczél axiom. -/ theorem dAlembert_smooth_of_aczel [AczelSmoothnessPackage] (H : ℝ → ℝ) : dAlembert_continuous_implies_smooth_hypothesis H := fun h_one h_cont h_dAlembert => aczel_dAlembert_smooth H h_one h_cont h_dAlembertUnder the regularity package used for the classification, any continuous solution of that equation with H(0) = 1 is smooth. dAlembert_smooth_of_aczel · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM even_deriv_at_zero · deriv2_of_logCurvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem even_deriv_at_zero (H : ℝ → ℝ) (h_even : Function.Even H) (h_diff : DifferentiableAt ℝ H 0) : deriv H 0 = 0 := by -- For even functions, the derivative at 0 is 0 let negFun : ℝ → ℝ := fun x => -x have h1 : deriv H 0 = deriv (H ∘ negFun) 0 := by congr 1 ext x simp only [Function.comp_apply, negFun] exact (h_even x).symm have h2 : deriv (H ∘ negFun) 0 = -deriv H 0 := by have hd : DifferentiableAt ℝ negFun 0 := differentiable_neg.differentiableAt have h_diff_neg : DifferentiableAt ℝ H (negFun 0) := by simp [negFun]; exact h_diff have hchain := deriv_comp (x := (0 : ℝ)) h_diff_neg hd rw [hchain] simp only [negFun, neg_zero] have hdn : deriv negFun 0 = -1 := congrFun deriv_neg' 0 rw [hdn] ring rw [h1] at h2 linarith/-- Unit log curvature pins the second derivative at the origin. -/ theorem deriv2_of_logCurvature (Hf : ℝ → ℝ) (hsm : ContDiff ℝ ⊤ Hf) (h1 : Hf 0 = 1) (hd0 : deriv Hf 0 = 0) (hκ : HasLogCurvature Hf 1) : deriv (deriv Hf) 0 = 1 := tendsto_nhds_unique (logCurvature_eq_deriv2 Hf hsm h1 hd0) hκEvenness forces H'(0) = 0, and unit log curvature fixes H''(0) = 1. even_deriv_at_zero · deriv2_of_logCurvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness_contdiff · Jcost_G_eq_cosh_sub_one · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/ theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ) (h_diff : ContDiff ℝ 2 H) (h_ode : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) : ∀ t, H t = Real.cosh t := by let g := fun t => H t - Real.cosh t have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh have hg_ode : ∀ t, deriv (deriv g) t = g t := by intro t have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by ext s; apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by have hH_diff1 : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff rw [contDiff_succ_iff_deriv] at h_diff exact h_diff.2.2 have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by rw [Real.deriv_cosh]; exact Real.contDiff_sinh rw [h1]; apply deriv_sub · exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt · exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt rw [h2, h_ode t, cosh_second_deriv_eq t] have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero] have hg'0 : deriv g 0 = 0 := by have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0 intro t have := hg_zero t simp only [g] at this; linariththeorem Jcost_G_eq_cosh_sub_one (t : ℝ) : G Cost.Jcost t = Real.cosh t - 1 := by simp only [G, Jcost] -- Jcost(exp t) = (exp t + exp(-t))/2 - 1 = cosh t - 1 have h1 : (Real.exp t)⁻¹ = Real.exp (-t) := by simp [Real.exp_neg] rw [h1, Real.cosh_eq]The equation H'' = H with those initial data has the unique solution H(t) = cosh t, so G(t) = cosh t - 1, which is J in the original variable. ode_cosh_uniqueness_contdiff · Jcost_G_eq_cosh_sub_one · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM Jcost_G_eq_cosh_sub_one · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_G_eq_cosh_sub_one (t : ℝ) : G Cost.Jcost t = Real.cosh t - 1 := by simp only [G, Jcost] -- Jcost(exp t) = (exp t + exp(-t))/2 - 1 = cosh t - 1 have h1 : (Real.exp t)⁻¹ = Real.exp (-t) := by simp [Real.exp_neg] rw [h1, Real.cosh_eq]The theorem Jcost_G_eq_cosh_sub_one states that for the unique solution, this transformed function is exactly G(t) = cosh(t) - 1. Jcost_G_eq_cosh_sub_one · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_deriv_zero : deriv H 0 = 0 := by have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt exact even_deriv_at_zero H h_even h_diff exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hypThe known continuous solutions to this equation are exactly the functions G(t) = cosh(kt) - 1 for a constant k. dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **The cost theorem on two premises.** The composition law and unit log curvature force `F = J` on the positives. Normalization, nonnegativity, and continuity are all conclusions rather than hypotheses; compare `law_of_logic_forces_jcost`, which assumes all of them. -/ theorem composition_logCurvature_forces_jcost [AczelSmoothnessPackage] (F : ℝ → ℝ) (hComp : SatisfiesCompositionLaw F) (hκ : HasLogCurvature (H F) 1) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by have hNorm : IsNormalized F := logCurvature_forces_normalized F hComp hκ have hN : F 1 = 0 := hNorm have hH0 : H F 0 = 1 := by simp [H, G, hN] have hCosh : CoshAddIdentity F := (composition_law_equiv_coshAdd F).mp hComp have hdA : ∀ t u, H F (t + u) + H F (t - u) = 2 * H F t * H F u := by intro t u have hG := hCosh t u have hgoal : (G F (t + u) + 1) + (G F (t - u) + 1) = 2 * (G F t + 1) * (G F u + 1) := by calc (G F (t + u) + 1) + (G F (t - u) + 1) = (G F (t + u) + G F (t - u)) + 2 := by ring _ = (2 * (G F t * G F u) + 2 * (G F t + G F u)) + 2 := by simpa [hG] _ = 2 * (G F t + 1) * (G F u + 1) := by ring simpa [H] using hgoal have hcont : Continuous (H F) := dAlembert_continuous_of_log_curvature (H F) hH0 hdA hκ have hsm : ContDiff ℝ ⊤ (H F) := aczel_dAlembert_smooth (H F) hH0 hcont hdA have heven : Function.Even (H F) := dAlembert_even (H F) hH0 hdA have hd0 : deriv (H F) 0 = 0 := even_deriv_at_zero (H F) heven (hsm.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) 0) have hd2 : deriv (deriv (H F)) 0 = 1 := deriv2_of_logCurvature (H F) hsm hH0 hd0 hκ have hcosh : ∀ t, H F t = Real.cosh t := dAlembert_cosh_solution_aczel (H F) hH0 hcont hdA hd2 intro x hx have hGc : G F (Real.log x) = Real.cosh (Real.log x) - 1 := by have h := hcosh (Real.log x) simp only [H] at h linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = G F (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := hGc _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The calibration condition, which fixes the log-curvature at 1, then forces k = 1, giving the unique solution. composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The proof of the main uniqueness result, law_of_logic_forces_jcost, relies on it. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM factorization_gate_iff_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Exact gate characterization: the factorization gate is equivalent to being the canonical RCL combiner. -/ theorem factorization_gate_iff_rcl (P : ℝ → ℝ → ℝ) : FactorizationAssociativityGate P ↔ ∀ u v, P u v = rclCombiner u v := by constructor · intro hGate u v rw [gate_forces_rcl P hGate u v] rfl · intro hP refine { symmetric := ?_ rightAffine := ?_ zeroBoundary := ?_ unitDiagonal := ?_ } · intro u v rw [hP u v, hP v u] unfold rclCombiner ring · intro u refine ⟨2 * u + 2, 2 * u, ?_⟩ intro v rw [hP u v] unfold rclCombiner ring · intro u rw [hP u 0] unfold rclCombiner ring · rw [hP 1 1] unfold rclCombiner norm_numThe theorem factorization_gate_iff_rcl states that a function satisfies the gate if and only if it equals the canonical combiner rclCombiner(u,v) = 2uv + 2u + 2v. factorization_gate_iff_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM gate_forces_bilinear_family · gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Once the affine-response step is known, symmetry and the boundary law force the entire bilinear family. -/ theorem gate_forces_bilinear_family (P : ℝ → ℝ → ℝ) (hGate : FactorizationAssociativityGate P) : ∃ c : ℝ, ∀ u v, P u v = c * u * v + 2 * u + 2 * v := by classical choose α β hAffine using hGate.rightAffine have hβ : ∀ u, β u = 2 * u := by intro u have h0 : P u 0 = α u * 0 + β u := hAffine u 0 rw [hGate.zeroBoundary u] at h0 linarith let c : ℝ := α 1 - 2 refine ⟨c, ?_⟩ intro u v have hsym1 : P u 1 = P 1 u := hGate.symmetric u 1 have hαu : α u = c * u + 2 := by dsimp [c] have hcalc : α u * 1 + β u = α 1 * u + β 1 := by calc α u * 1 + β u = P u 1 := by symm; exact hAffine u 1 _ = P 1 u := hGate.symmetric u 1 _ = α 1 * u + β 1 := hAffine 1 u rw [hβ u, hβ 1] at hcalc linarith calc P u v = α u * v + β u := hAffine u v _ = (c * u + 2) * v + 2 * u := by rw [hαu, hβ u] _ = c * u * v + 2 * u + 2 * v := by ring/-- Canonical normalization selects the RCL member of the bilinear family. -/ theorem gate_forces_rcl (P : ℝ → ℝ → ℝ) (hGate : FactorizationAssociativityGate P) : ∀ u v, P u v = 2 * u * v + 2 * u + 2 * v := by obtain ⟨c, hc⟩ := gate_forces_bilinear_family P hGate have hc_two : c = 2 := by have h11 : P 1 1 = c * 1 * 1 + 2 * 1 + 2 * 1 := by simpa using hc 1 1 linarith [hGate.unitDiagonal, h11] intro u v calc P u v = c * u * v + 2 * u + 2 * v := hc u v _ = 2 * u * v + 2 * u + 2 * v := by rw [hc_two]The gate forces a bilinear family, and the normalization selects the member with coefficient 2. gate_forces_bilinear_family · gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G. Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y) becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t) via the substitution x = e^s, y = e^t. -/ theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) : SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by constructor · intro hComp t u have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos -- exp(t) * exp(u) = exp(t + u) have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm -- exp(t) / exp(u) = exp(t - u) have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg] simp only [G, h1, h2] at h ⊢ linarith · intro hCosh x y hx hy let t := Real.log x let u := Real.log y have hx_eq : x = Real.exp t := (Real.exp_log hx).symm have hy_eq : y = Real.exp u := (Real.exp_log hy).symm have h := hCosh t u simp only [G] at h rw [hx_eq, hy_eq] rw [← Real.exp_add, ← Real.exp_sub] -- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u)) -- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u) calc F (Real.exp (t + u)) + F (Real.exp (t - u)) = 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h _ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ringThe theorem composition_law_equiv_coshAdd proves the composition law and the cosine addition identity are equivalent. composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThe theorem dAlembert_cosh_solution_of_log_curvature shows that a function H with H(0) = 1, satisfying the d'Alembert equation, having log-curvature at 0, and meeting standard regularity hypotheses must equal cosh. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_cosh_add_identity : CoshAddIdentity Cost.Jcost := by intro t u simp only [G, Jcost] -- Use exp(t+u) = exp(t)*exp(u) and exp(t-u) = exp(t)/exp(u) have he1 : Real.exp (t + u) = Real.exp t * Real.exp u := Real.exp_add t u have he2 : Real.exp (t - u) = Real.exp t / Real.exp u := by rw [sub_eq_add_neg, Real.exp_add, Real.exp_neg] ring have hpos_t : Real.exp t > 0 := Real.exp_pos t have hpos_u : Real.exp u > 0 := Real.exp_pos u have hne_t : Real.exp t ≠ 0 := hpos_t.ne' have hne_u : Real.exp u ≠ 0 := hpos_u.ne' rw [he1, he2] field_simp ringThe theorem Jcost_cosh_add_identity verifies that the final cost function J(x) = (x + 1/x)/2 - 1 itself satisfies the identity. Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM jcost_hasLogCurvature_one · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Non-vacuity witness.** The canonical cost satisfies the calibration. A regularity hypothesis nobody exhibits a model for is worth nothing, which is the lesson of the full-filter version this replaced. -/ theorem jcost_hasLogCurvature_one : HasLogCurvature (H Cost.Jcost) 1 := by have hfun : H Cost.Jcost = Real.cosh := by funext t have h := Jcost_G_eq_cosh_sub_one t simp only [H] linarith [h] have hd0 : deriv Real.cosh 0 = 0 := by rw [Real.deriv_cosh]; exact Real.sinh_zero have hd2 : deriv (deriv Real.cosh) 0 = 1 := by rw [Real.deriv_cosh, Real.deriv_sinh]; exact Real.cosh_zero have h := logCurvature_eq_deriv2 Real.cosh Real.contDiff_cosh Real.cosh_zero hd0 rw [hd2] at h rwa [hfun]The theorem jcost_hasLogCurvature_one confirms the log-curvature of the final cost function is 1. jcost_hasLogCurvature_one · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThe d'Alembert route starts from the classical functional equation H(t+u) + H(t-u) = 2 * H t * H u. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThe theorem dAlembert_cosh_solution_of_log_curvature states that if H(0) = 1, obeys the d'Alembert equation, has log-curvature at 0, and has second derivative 1 at 0, then H is the hyperbolic cosine. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The d'Alembert route is not used in the main proof of cost uniqueness, which reaches a differential equation instead. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Canonical normalization selects the RCL member of the bilinear family. -/ theorem gate_forces_rcl (P : ℝ → ℝ → ℝ) (hGate : FactorizationAssociativityGate P) : ∀ u v, P u v = 2 * u * v + 2 * u + 2 * v := by obtain ⟨c, hc⟩ := gate_forces_bilinear_family P hGate have hc_two : c = 2 := by have h11 : P 1 1 = c * 1 * 1 + 2 * 1 + 2 * 1 := by simpa using hc 1 1 linarith [hGate.unitDiagonal, h11] intro u v calc P u v = c * u * v + 2 * u + 2 * v := hc u v _ = 2 * u * v + 2 * u + 2 * v := by rw [hc_two]The machine-checked theorem gate_forces_rcl proves that any P satisfying the four gate conditions must equal the canonical combiner 2uv + 2u + 2v. gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM factorization_gate_iff_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Exact gate characterization: the factorization gate is equivalent to being the canonical RCL combiner. -/ theorem factorization_gate_iff_rcl (P : ℝ → ℝ → ℝ) : FactorizationAssociativityGate P ↔ ∀ u v, P u v = rclCombiner u v := by constructor · intro hGate u v rw [gate_forces_rcl P hGate u v] rfl · intro hP refine { symmetric := ?_ rightAffine := ?_ zeroBoundary := ?_ unitDiagonal := ?_ } · intro u v rw [hP u v, hP v u] unfold rclCombiner ring · intro u refine ⟨2 * u + 2, 2 * u, ?_⟩ intro v rw [hP u v] unfold rclCombiner ring · intro u rw [hP u 0] unfold rclCombiner ring · rw [hP 1 1] unfold rclCombiner norm_numA companion theorem, factorization_gate_iff_rcl, states the equivalence: the gate holds exactly when P is that combiner. factorization_gate_iff_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanMODEL FactorizationAssociativityGate · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Packaged combiner gate used by the factorization/associativity bridge. -/ structure FactorizationAssociativityGate (P : ℝ → ℝ → ℝ) : Prop where symmetric : ∀ u v, P u v = P v u rightAffine : ∀ u, ∃ α β, ∀ v, P u v = α * v + β zeroBoundary : ∀ u, P u 0 = 2 * u unitDiagonal : P 1 1 = 6The gate packages four conditions on the combiner: symmetry, affine response in the second argument, the boundary law P(u, 0) = 2u, and the normalization P(1, 1) = 6. FactorizationAssociativityGate · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/ theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ) (h_diff : ContDiff ℝ 2 H) (h_ode : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) : ∀ t, H t = Real.cosh t := by let g := fun t => H t - Real.cosh t have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh have hg_ode : ∀ t, deriv (deriv g) t = g t := by intro t have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by ext s; apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by have hH_diff1 : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff rw [contDiff_succ_iff_deriv] at h_diff exact h_diff.2.2 have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by rw [Real.deriv_cosh]; exact Real.contDiff_sinh rw [h1]; apply deriv_sub · exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt · exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt rw [h2, h_ode t, cosh_second_deriv_eq t] have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero] have hg'0 : deriv g 0 = 0 := by have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0 intro t have := hg_zero t simp only [g] at this; linarithThe hyperbolic cosine is the even solution to the second-order differential equation H'' = H with initial conditions H(0) = 1 and H'(0) = 0. ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]Any recognition cost satisfying the five plain conditions must equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThe d'Alembert equation together with the log-curvature condition forces H(t) = cosh t. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM hasLogCurvature_full_filter_forces_zero · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Tripwire.** The full-filter reading of log curvature forces `κ = 0`, so at the calibrated value `κ = 1` it is satisfied by no function at all. Kept as a theorem so the defect cannot be reintroduced without a failing build. -/ theorem hasLogCurvature_full_filter_forces_zero (Hf : ℝ → ℝ) (κ : ℝ) (h : Filter.Tendsto (fun t => 2 * (Hf t - 1) / t^2) (nhds 0) (nhds κ)) : κ = 0 := by have h1 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2) (pure 0) (nhds κ) := h.mono_left (pure_le_nhds 0) have h2 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2) (pure 0) (nhds (2 * (Hf 0 - 1) / (0 : ℝ) ^ 2)) := tendsto_pure_nhds _ _ have h3 := tendsto_nhds_unique h2 h1 simpa using h3.symma function whose log-curvature is defined at a point where its value is 1 has no choice about the curvature there; it is forced to be zero hasLogCurvature_full_filter_forces_zero · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM HasLogCurvature · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The paper's log curvature `κ(F) = lim_{t→0} 2 F(e^t)/t²`, stated on the **punctured** filter. The puncture is not cosmetic. On the full filter `nhds 0` this predicate is unsatisfiable for every nonzero `κ`: Lean's division is total with `x / 0 = 0`, so the quotient takes the value `0` at `t = 0`, and convergence along a filter that contains the point pins the value at the point. The repo carried the full-filter reading until 2026-07-25, which silently made two results vacuous; `hasLogCurvature_full_filter_forces_zero` keeps that from recurring quietly. -/ def HasLogCurvature (H : ℝ → ℝ) (κ : ℝ) : Prop := Filter.Tendsto (fun t => 2 * (H t - 1) / t^2) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds κ)the actual proof uses a one-sided log-curvature, which is the calibration input that fixes the local scale of recognition near the identity HasLogCurvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]any cost function satisfying the five plain conditions must equal J(x) = (x + 1/x)/2 - 1 law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_deriv_zero : deriv H 0 = 0 := by have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt exact even_deriv_at_zero H h_even h_diff exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hypThe lemma dAlembert_even states that any solution of d'Alembert's equation with H(0) = 1 is an even function, meaning H(-t) = H(t) for all t. dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G. Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y) becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t) via the substitution x = e^s, y = e^t. -/ theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) : SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by constructor · intro hComp t u have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos -- exp(t) * exp(u) = exp(t + u) have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm -- exp(t) / exp(u) = exp(t - u) have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg] simp only [G, h1, h2] at h ⊢ linarith · intro hCosh x y hx hy let t := Real.log x let u := Real.log y have hx_eq : x = Real.exp t := (Real.exp_log hx).symm have hy_eq : y = Real.exp u := (Real.exp_log hy).symm have h := hCosh t u simp only [G] at h rw [hx_eq, hy_eq] rw [← Real.exp_add, ← Real.exp_sub] -- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u)) -- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u) calc F (Real.exp (t + u)) + F (Real.exp (t - u)) = 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h _ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ringThe composition law for F becomes exactly d'Alembert's equation for H after the substitution H(t) = F(e^t) + 1. composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThe theorem dAlembert_cosh_solution_of_log_curvature proves that if H satisfies d'Alembert's equation, has H(0) = 1, has log-curvature κ at 0, and has second derivative 1 at 0, then H(t) = cosh(t) for all t. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ) (h_ODE : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := h_cont_hyp h_ODE have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0The evenness lemma supplies the initial condition H'(0) = 0 that the differential equation route needs. ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanMODEL SatisfiesCompositionLaw · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Composition Law (Equation 1.1)**: F(xy) + F(x/y) = 2·F(x)·F(y) + 2·F(x) + 2·F(y) for all x, y > 0. This is the Recognition Composition Law (RCL). -/ def SatisfiesCompositionLaw (F : ℝ → ℝ) : Prop := ∀ x y : ℝ, 0 < x → 0 < y → F (x * y) + F (x / y) = 2 * F x * F y + 2 * F x + 2 * F yThe composition law requires F(x·y) + F(x/y) = 2·F(x)·F(y) + 2·F(x) + 2·F(y) for positive x and y. SatisfiesCompositionLaw · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G. Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y) becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t) via the substitution x = e^s, y = e^t. -/ theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) : SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by constructor · intro hComp t u have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos -- exp(t) * exp(u) = exp(t + u) have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm -- exp(t) / exp(u) = exp(t - u) have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg] simp only [G, h1, h2] at h ⊢ linarith · intro hCosh x y hx hy let t := Real.log x let u := Real.log y have hx_eq : x = Real.exp t := (Real.exp_log hx).symm have hy_eq : y = Real.exp u := (Real.exp_log hy).symm have h := hCosh t u simp only [G] at h rw [hx_eq, hy_eq] rw [← Real.exp_add, ← Real.exp_sub] -- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u)) -- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u) calc F (Real.exp (t + u)) + F (Real.exp (t - u)) = 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h _ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ringA cost function satisfies the composition law if and only if its log-coordinate transform satisfies the d'Alembert identity. composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The main theorem law_of_logic_forces_jcost takes the composition law as an explicit hypothesis and derives the unique cost form. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM logCurvature_forces_normalized · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The composition law together with unit log curvature force normalization. The composition law at `y = 1` gives `F 1 * (F x + 1) = 0`, so either `F 1 = 0` or `F` is constantly `-1`; the constant has `H ≡ 0`, whose curvature quotient is negative throughout a punctured neighbourhood and so cannot tend to `1`. -/ theorem logCurvature_forces_normalized (F : ℝ → ℝ) (hComp : SatisfiesCompositionLaw F) (hκ : HasLogCurvature (H F) 1) : IsNormalized F := by by_contra hne have hconst : ∀ x : ℝ, 0 < x → F x = -1 := by intro x hx have h := hComp x 1 hx one_pos rw [mul_one, div_one] at h have hquad : F 1 * (F x + 1) = 0 := by nlinarith rcases mul_eq_zero.mp hquad with h1 | h2 · exact absurd h1 hne · linarith have hH : ∀ t : ℝ, H F t = 0 := by intro t have hx := hconst (Real.exp t) (Real.exp_pos t) simp [H, G, hx] have hgt : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), (1 / 2 : ℝ) < 2 * (H F t - 1) / t ^ 2 := hκ.eventually (eventually_gt_nhds (by norm_num)) have hne0 : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), t ≠ 0 := by filter_upwards [self_mem_nhdsWithin] with t ht using ht obtain ⟨t, hgt', ht0⟩ := (hgt.and hne0).exists have ht2 : 0 < t ^ 2 := by positivity have hneg : 2 * (H F t - 1) / t ^ 2 < 0 := by rw [hH t] exact div_neg_of_neg_of_pos (by norm_num) ht2 linarithThe composition law plus calibration implies normalization. logCurvature_forces_normalized · IndisputableMonolith/Cost/FunctionalEquation.leanMODEL Jcost_G_eq_cosh_sub_one · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_G_eq_cosh_sub_one (t : ℝ) : G Cost.Jcost t = Real.cosh t - 1 := by simp only [G, Jcost] -- Jcost(exp t) = (exp t + exp(-t))/2 - 1 = cosh t - 1 have h1 : (Real.exp t)⁻¹ = Real.exp (-t) := by simp [Real.exp_neg] rw [h1, Real.cosh_eq]The declaration deriv_exp_neg is a standard fact from calculus: the derivative of the function that sends t to e^-t is the negative of that same function. Jcost_G_eq_cosh_sub_one · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM Jcost_G_eq_cosh_sub_one · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_G_eq_cosh_sub_one (t : ℝ) : G Cost.Jcost t = Real.cosh t - 1 := by simp only [G, Jcost] -- Jcost(exp t) = (exp t + exp(-t))/2 - 1 = cosh t - 1 have h1 : (Real.exp t)⁻¹ = Real.exp (-t) := by simp [Real.exp_neg] rw [h1, Real.cosh_eq]The relevant identity is Jcost_G_eq_cosh_sub_one, which states that the cost function in log coordinates equals cosh(t) - 1. Jcost_G_eq_cosh_sub_one · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The theorem law_of_logic_forces_jcost proves that any cost function satisfying those conditions must equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ) (h_ODE : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := h_cont_hyp h_ODE have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0The proof passes through the differential equation H'' = H, and the uniqueness of the solution to that equation is established by ode_cosh_uniqueness. ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM jcost_hasLogCurvature_one · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Non-vacuity witness.** The canonical cost satisfies the calibration. A regularity hypothesis nobody exhibits a model for is worth nothing, which is the lesson of the full-filter version this replaced. -/ theorem jcost_hasLogCurvature_one : HasLogCurvature (H Cost.Jcost) 1 := by have hfun : H Cost.Jcost = Real.cosh := by funext t have h := Jcost_G_eq_cosh_sub_one t simp only [H] linarith [h] have hd0 : deriv Real.cosh 0 = 0 := by rw [Real.deriv_cosh]; exact Real.sinh_zero have hd2 : deriv (deriv Real.cosh) 0 = 1 := by rw [Real.deriv_cosh, Real.deriv_sinh]; exact Real.cosh_zero have h := logCurvature_eq_deriv2 Real.cosh Real.contDiff_cosh Real.cosh_zero hd0 rw [hd2] at h rwa [hfun]The declaration jcost_hasLogCurvature_one states that the log-curvature of the cost function at unity equals 1. jcost_hasLogCurvature_one · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_deriv_zero : deriv H 0 = 0 := by have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt exact even_deriv_at_zero H h_even h_diff exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hypThe continuous solutions to the cosine addition formula are exactly the hyperbolic cosine functions H(t) = cosh(kt) for a constant k. dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **The cost theorem on two premises.** The composition law and unit log curvature force `F = J` on the positives. Normalization, nonnegativity, and continuity are all conclusions rather than hypotheses; compare `law_of_logic_forces_jcost`, which assumes all of them. -/ theorem composition_logCurvature_forces_jcost [AczelSmoothnessPackage] (F : ℝ → ℝ) (hComp : SatisfiesCompositionLaw F) (hκ : HasLogCurvature (H F) 1) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by have hNorm : IsNormalized F := logCurvature_forces_normalized F hComp hκ have hN : F 1 = 0 := hNorm have hH0 : H F 0 = 1 := by simp [H, G, hN] have hCosh : CoshAddIdentity F := (composition_law_equiv_coshAdd F).mp hComp have hdA : ∀ t u, H F (t + u) + H F (t - u) = 2 * H F t * H F u := by intro t u have hG := hCosh t u have hgoal : (G F (t + u) + 1) + (G F (t - u) + 1) = 2 * (G F t + 1) * (G F u + 1) := by calc (G F (t + u) + 1) + (G F (t - u) + 1) = (G F (t + u) + G F (t - u)) + 2 := by ring _ = (2 * (G F t * G F u) + 2 * (G F t + G F u)) + 2 := by simpa [hG] _ = 2 * (G F t + 1) * (G F u + 1) := by ring simpa [H] using hgoal have hcont : Continuous (H F) := dAlembert_continuous_of_log_curvature (H F) hH0 hdA hκ have hsm : ContDiff ℝ ⊤ (H F) := aczel_dAlembert_smooth (H F) hH0 hcont hdA have heven : Function.Even (H F) := dAlembert_even (H F) hH0 hdA have hd0 : deriv (H F) 0 = 0 := even_deriv_at_zero (H F) heven (hsm.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) 0) have hd2 : deriv (deriv (H F)) 0 = 1 := deriv2_of_logCurvature (H F) hsm hH0 hd0 hκ have hcosh : ∀ t, H F t = Real.cosh t := dAlembert_cosh_solution_aczel (H F) hH0 hcont hdA hd2 intro x hx have hGc : G F (Real.log x) = Real.cosh (Real.log x) - 1 := by have h := hcosh (Real.log x) simp only [H] at h linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = G F (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := hGc _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The calibration condition selects k = 1, and the curvature check is how the library verifies that selection. composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/ theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ) (h_diff : ContDiff ℝ 2 H) (h_ode : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) : ∀ t, H t = Real.cosh t := by let g := fun t => H t - Real.cosh t have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh have hg_ode : ∀ t, deriv (deriv g) t = g t := by intro t have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by ext s; apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by have hH_diff1 : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff rw [contDiff_succ_iff_deriv] at h_diff exact h_diff.2.2 have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by rw [Real.deriv_cosh]; exact Real.contDiff_sinh rw [h1]; apply deriv_sub · exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt · exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt rw [h2, h_ode t, cosh_second_deriv_eq t] have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero] have hg'0 : deriv g 0 = 0 := by have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0 intro t have := hg_zero t simp only [g] at this; linarithThe theorem ode_cosh_uniqueness_contdiff proves that a twice-differentiable function satisfying H'' = H, H(0) = 1, and H'(0) = 0 must be exactly the hyperbolic cosine, Real.cosh. ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Derivation, universal coefficient)**: If H is C∞ and satisfies d'Alembert, then `H''(t) = H''(0) * H(t)` everywhere. This is the unnormalized form of `dAlembert_to_ODE_theorem`. -/ theorem dAlembert_to_ODE_general_theorem (H : ℝ → ℝ) (h_smooth : ContDiff ℝ ⊤ H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) : ∀ t, deriv (deriv H) t = deriv (deriv H) 0 * H t := by have hCDiff2 : ContDiff ℝ 2 H := h_smooth.of_le le_top have hDiff : Differentiable ℝ H := hCDiff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have hCDiff1_H' : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at hCDiff2 rw [contDiff_succ_iff_deriv] at hCDiff2 exact hCDiff2.2.2 have hDiffDeriv : Differentiable ℝ (deriv H) := hCDiff1_H'.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) have hsh_add : ∀ (s v : ℝ), HasDerivAt (fun u => s + u) (1 : ℝ) v := fun s v => by have h := (hasDerivAt_id v).add_const s; simp only [id] at h rwa [show (fun u : ℝ => u + s) = fun u => s + u from funext fun u => add_comm u s] at h have hsh_sub : ∀ (s v : ℝ), HasDerivAt (fun u => s - u) (-1 : ℝ) v := fun s v => by have h1 : HasDerivAt (fun u : ℝ => -u) (-1 : ℝ) v := by have := (hasDerivAt_id v).neg; simp only [id] at this; exact this have h2 := h1.const_add s rwa [show (fun u : ℝ => s + -u) = fun u => s - u from funext fun u => by ring] at h2 intro t have h_feq : (fun u => H (t + u) + H (t - u)) = (fun u => 2 * H t * H u) := funext (h_dAlembert t) have key : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = deriv (deriv (fun u => 2 * H t * H u)) 0 := congr_arg (fun f => deriv (deriv f) 0) h_feq have lhs_eq : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = 2 * deriv (deriv H) t := by have h_plus : ∀ v, HasDerivAt (fun u => H (t + u)) (deriv H (t + v)) v := fun v => by have hH := (hDiff (t + v)).hasDerivAt have hcomp := hH.comp v (hsh_add t v) simp only [mul_one, Function.comp_apply] at hcomp; exact hcomp have h_minus : ∀ v, HasDerivAt (fun u => H (t - u)) (-deriv H (t - v)) v := fun v => by have hH := (hDiff (t - v)).hasDerivAt have hcomp := hH.comp v (hsh_sub t v) simp only [mul_neg, mul_one, Function.comp_apply] at hcomp; exact hcomp have hfirst_fun : deriv (fun u => H (t + u) + H (t - u)) = fun v => deriv H (t + v) - deriv H (t - v) := funext fun v => by have heq : (fun u => H (t + u)) + (fun u => H (t - u)) = fun u => H (t + u) + H (t - u) := by ext u; rfl have h12 : deriv (fun u => H (t + u) + H (t - u)) v = deriv H (t + v) + -deriv H (t - v) := by rw [← heq]; exact ((h_plus v).add (h_minus v)).deriv linarith [show deriv H (t + v) + -deriv H (t - v) = deriv H (t + v) - deriv H (t - v) from by ring] have hd2_plus : HasDerivAt (fun v => deriv H (t + v)) (deriv (deriv H) t) 0 := by have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t + 0)) (t + 0) := (hDiffDeriv (t + 0)).hasDerivAt have hcomp := hDH.comp 0 (hsh_add t 0) simp only [mul_one, add_zero, Function.comp_apply] at hcomp; exact hcomp have hd2_minus : HasDerivAt (fun v => deriv H (t - v)) (-deriv (deriv H) t) 0 := by have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t - 0)) (t - 0) := (hDiffDeriv (t - 0)).hasDerivAt have hcomp := hDH.comp 0 (hsh_sub t 0) simp only [mul_neg, mul_one, sub_zero, Function.comp_apply] at hcomp; exact hcomp rw [congr_fun (congr_arg deriv hfirst_fun) 0] have heq2 : (fun v => deriv H (t + v)) - (fun v => deriv H (t - v)) = fun v => deriv H (t + v) - deriv H (t - v) := by ext v; rfl have h : deriv (fun v => deriv H (t + v) - deriv H (t - v)) 0 = deriv (deriv H) t - -deriv (deriv H) t := by rw [← heq2]; exact (hd2_plus.sub hd2_minus).deriv linarith [show deriv (deriv H) t - -deriv (deriv H) t = 2 * deriv (deriv H) t from by ring] have rhs_eq : deriv (deriv (fun u => 2 * H t * H u)) 0 = 2 * H t * deriv (deriv H) 0 := by have hfirst_fun : deriv (fun u => 2 * H t * H u) = fun v => 2 * H t * deriv H v := funext fun v => ((hDiff v).hasDerivAt.const_mul (2 * H t)).deriv have hsecond := (hDiffDeriv 0).hasDerivAt.const_mul (2 * H t) rw [congr_fun (congr_arg deriv hfirst_fun) 0, hsecond.deriv] rw [lhs_eq, rhs_eq] at key linarithThe general solution to that equation is H(t) = A cosh(t) + B sinh(t), a two-parameter family. dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/ theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ) (h_diff : ContDiff ℝ 2 H) (h_ode : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) : ∀ t, H t = Real.cosh t := by let g := fun t => H t - Real.cosh t have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh have hg_ode : ∀ t, deriv (deriv g) t = g t := by intro t have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by ext s; apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by have hH_diff1 : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff rw [contDiff_succ_iff_deriv] at h_diff exact h_diff.2.2 have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by rw [Real.deriv_cosh]; exact Real.contDiff_sinh rw [h1]; apply deriv_sub · exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt · exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt rw [h2, h_ode t, cosh_second_deriv_eq t] have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero] have hg'0 : deriv g 0 = 0 := by have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0 intro t have := hg_zero t simp only [g] at this; linarithThe uniqueness theorem would degrade into a classification of a one-parameter family of candidates, and the framework's claim that the cost is forced would lose its sharpness. ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM jcost_hasLogCurvature_one · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Non-vacuity witness.** The canonical cost satisfies the calibration. A regularity hypothesis nobody exhibits a model for is worth nothing, which is the lesson of the full-filter version this replaced. -/ theorem jcost_hasLogCurvature_one : HasLogCurvature (H Cost.Jcost) 1 := by have hfun : H Cost.Jcost = Real.cosh := by funext t have h := Jcost_G_eq_cosh_sub_one t simp only [H] linarith [h] have hd0 : deriv Real.cosh 0 = 0 := by rw [Real.deriv_cosh]; exact Real.sinh_zero have hd2 : deriv (deriv Real.cosh) 0 = 1 := by rw [Real.deriv_cosh, Real.deriv_sinh]; exact Real.cosh_zero have h := logCurvature_eq_deriv2 Real.cosh Real.contDiff_cosh Real.cosh_zero hd0 rw [hd2] at h rwa [hfun]The log-curvature of the cost function at unity is 1. jcost_hasLogCurvature_one · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **The cost theorem on two premises.** The composition law and unit log curvature force `F = J` on the positives. Normalization, nonnegativity, and continuity are all conclusions rather than hypotheses; compare `law_of_logic_forces_jcost`, which assumes all of them. -/ theorem composition_logCurvature_forces_jcost [AczelSmoothnessPackage] (F : ℝ → ℝ) (hComp : SatisfiesCompositionLaw F) (hκ : HasLogCurvature (H F) 1) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by have hNorm : IsNormalized F := logCurvature_forces_normalized F hComp hκ have hN : F 1 = 0 := hNorm have hH0 : H F 0 = 1 := by simp [H, G, hN] have hCosh : CoshAddIdentity F := (composition_law_equiv_coshAdd F).mp hComp have hdA : ∀ t u, H F (t + u) + H F (t - u) = 2 * H F t * H F u := by intro t u have hG := hCosh t u have hgoal : (G F (t + u) + 1) + (G F (t - u) + 1) = 2 * (G F t + 1) * (G F u + 1) := by calc (G F (t + u) + 1) + (G F (t - u) + 1) = (G F (t + u) + G F (t - u)) + 2 := by ring _ = (2 * (G F t * G F u) + 2 * (G F t + G F u)) + 2 := by simpa [hG] _ = 2 * (G F t + 1) * (G F u + 1) := by ring simpa [H] using hgoal have hcont : Continuous (H F) := dAlembert_continuous_of_log_curvature (H F) hH0 hdA hκ have hsm : ContDiff ℝ ⊤ (H F) := aczel_dAlembert_smooth (H F) hH0 hcont hdA have heven : Function.Even (H F) := dAlembert_even (H F) hH0 hdA have hd0 : deriv (H F) 0 = 0 := even_deriv_at_zero (H F) heven (hsm.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) 0) have hd2 : deriv (deriv (H F)) 0 = 1 := deriv2_of_logCurvature (H F) hsm hH0 hd0 hκ have hcosh : ∀ t, H F t = Real.cosh t := dAlembert_cosh_solution_aczel (H F) hH0 hcont hdA hd2 intro x hx have hGc : G F (Real.log x) = Real.cosh (Real.log x) - 1 := by have h := hcosh (Real.log x) simp only [H] at h linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = G F (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := hGc _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]Any function satisfying the composition law and having log-curvature 1 must equal J(x) exactly. composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM hasLogCurvature_full_filter_forces_zero · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Tripwire.** The full-filter reading of log curvature forces `κ = 0`, so at the calibrated value `κ = 1` it is satisfied by no function at all. Kept as a theorem so the defect cannot be reintroduced without a failing build. -/ theorem hasLogCurvature_full_filter_forces_zero (Hf : ℝ → ℝ) (κ : ℝ) (h : Filter.Tendsto (fun t => 2 * (Hf t - 1) / t^2) (nhds 0) (nhds κ)) : κ = 0 := by have h1 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2) (pure 0) (nhds κ) := h.mono_left (pure_le_nhds 0) have h2 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2) (pure 0) (nhds (2 * (Hf 0 - 1) / (0 : ℝ) ^ 2)) := tendsto_pure_nhds _ _ have h3 := tendsto_nhds_unique h2 h1 simpa using h3.symmIf the expression 2(H(t) - 1)/t² approaches any finite limit as t approaches 0, that limit must be 0. hasLogCurvature_full_filter_forces_zero · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM logCurvature_eq_deriv2 · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- For a smooth function with `Hf 0 = 1` and vanishing first derivative, the log curvature exists and equals the second derivative at the origin. This is the l'Hôpital step, and it is also what makes the corrected calibration satisfiable rather than empty. -/ theorem logCurvature_eq_deriv2 (Hf : ℝ → ℝ) (hsm : ContDiff ℝ ⊤ Hf) (h1 : Hf 0 = 1) (hd0 : deriv Hf 0 = 0) : HasLogCurvature Hf (deriv (deriv Hf) 0) := by have h2 : ContDiff ℝ 2 Hf := hsm.of_le (by exact_mod_cast le_top) have hderiv_diff : Differentiable ℝ (deriv Hf) := by have h3 := h2 rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h3 rw [contDiff_succ_iff_deriv] at h3 exact h3.2.2.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) have hdiffHf : Differentiable ℝ Hf := h2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have hd2 : HasDerivAt (deriv Hf) (deriv (deriv Hf) 0) 0 := (hderiv_diff 0).hasDerivAt have hslope : Filter.Tendsto (fun t : ℝ => deriv Hf t / t) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (deriv (deriv Hf) 0)) := by have h := hasDerivAt_iff_tendsto_slope.mp hd2 have hsl : ∀ t : ℝ, slope (deriv Hf) 0 t = deriv Hf t / t := by intro t simp [slope_def_field, hd0] exact Filter.Tendsto.congr hsl h have hnum : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1)) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 0) := by have hcont : Filter.Tendsto Hf (nhds (0 : ℝ)) (nhds (Hf 0)) := hdiffHf.continuous.tendsto 0 have hconst : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhds (0 : ℝ)) (nhds 1) := tendsto_const_nhds have hsub : Filter.Tendsto (fun t : ℝ => Hf t - 1) (nhds (0 : ℝ)) (nhds (Hf 0 - 1)) := hcont.sub hconst have hmul : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1)) (nhds (0 : ℝ)) (nhds (2 * (Hf 0 - 1))) := hsub.const_mul (2 : ℝ) rw [h1] at hmul simpa using hmul.mono_left nhdsWithin_le_nhds have hden : Filter.Tendsto (fun t : ℝ => t ^ 2) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 0) := by have h := (continuous_pow 2).tendsto (0 : ℝ) simpa using h.mono_left nhdsWithin_le_nhds have hff' : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), HasDerivAt (fun s : ℝ => 2 * (Hf s - 1)) (2 * deriv Hf t) t := by filter_upwards with t simpa using ((hdiffHf t).hasDerivAt.sub_const 1).const_mul (2 : ℝ) have hgg' : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), HasDerivAt (fun s : ℝ => s ^ 2) (2 * t) t := by filter_upwards with t simpa [mul_comm] using hasDerivAt_pow 2 t have hg'ne : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), (2 : ℝ) * t ≠ 0 := by filter_upwards [self_mem_nhdsWithin] with t ht have htne : t ≠ 0 := ht positivity have hdiv : Filter.Tendsto (fun t : ℝ => (2 * deriv Hf t) / (2 * t)) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (deriv (deriv Hf) 0)) := by refine Filter.Tendsto.congr' ?_ hslope filter_upwards [self_mem_nhdsWithin] with t ht have htne : t ≠ 0 := ht field_simp exact HasDerivAt.lhopital_zero_nhdsNE hff' hgg' hg'ne hnum hden hdivFor a smooth function with H(0) = 1 and H'(0) = 0, the log-curvature of H at 0 equals the second derivative H''(0). logCurvature_eq_deriv2 · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM cosh_satisfies_differentiable · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh is differentiable. -/ theorem cosh_satisfies_differentiable : ode_regularity_differentiable_hypothesis Real.cosh := by intro _ _ exact Real.differentiable_coshThe declaration cosh_satisfies_differentiable states that the hyperbolic cosine function is differentiable, meaning it has a derivative at every point. cosh_satisfies_differentiable · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Derivation, universal coefficient)**: If H is C∞ and satisfies d'Alembert, then `H''(t) = H''(0) * H(t)` everywhere. This is the unnormalized form of `dAlembert_to_ODE_theorem`. -/ theorem dAlembert_to_ODE_general_theorem (H : ℝ → ℝ) (h_smooth : ContDiff ℝ ⊤ H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) : ∀ t, deriv (deriv H) t = deriv (deriv H) 0 * H t := by have hCDiff2 : ContDiff ℝ 2 H := h_smooth.of_le le_top have hDiff : Differentiable ℝ H := hCDiff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have hCDiff1_H' : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at hCDiff2 rw [contDiff_succ_iff_deriv] at hCDiff2 exact hCDiff2.2.2 have hDiffDeriv : Differentiable ℝ (deriv H) := hCDiff1_H'.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) have hsh_add : ∀ (s v : ℝ), HasDerivAt (fun u => s + u) (1 : ℝ) v := fun s v => by have h := (hasDerivAt_id v).add_const s; simp only [id] at h rwa [show (fun u : ℝ => u + s) = fun u => s + u from funext fun u => add_comm u s] at h have hsh_sub : ∀ (s v : ℝ), HasDerivAt (fun u => s - u) (-1 : ℝ) v := fun s v => by have h1 : HasDerivAt (fun u : ℝ => -u) (-1 : ℝ) v := by have := (hasDerivAt_id v).neg; simp only [id] at this; exact this have h2 := h1.const_add s rwa [show (fun u : ℝ => s + -u) = fun u => s - u from funext fun u => by ring] at h2 intro t have h_feq : (fun u => H (t + u) + H (t - u)) = (fun u => 2 * H t * H u) := funext (h_dAlembert t) have key : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = deriv (deriv (fun u => 2 * H t * H u)) 0 := congr_arg (fun f => deriv (deriv f) 0) h_feq have lhs_eq : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = 2 * deriv (deriv H) t := by have h_plus : ∀ v, HasDerivAt (fun u => H (t + u)) (deriv H (t + v)) v := fun v => by have hH := (hDiff (t + v)).hasDerivAt have hcomp := hH.comp v (hsh_add t v) simp only [mul_one, Function.comp_apply] at hcomp; exact hcomp have h_minus : ∀ v, HasDerivAt (fun u => H (t - u)) (-deriv H (t - v)) v := fun v => by have hH := (hDiff (t - v)).hasDerivAt have hcomp := hH.comp v (hsh_sub t v) simp only [mul_neg, mul_one, Function.comp_apply] at hcomp; exact hcomp have hfirst_fun : deriv (fun u => H (t + u) + H (t - u)) = fun v => deriv H (t + v) - deriv H (t - v) := funext fun v => by have heq : (fun u => H (t + u)) + (fun u => H (t - u)) = fun u => H (t + u) + H (t - u) := by ext u; rfl have h12 : deriv (fun u => H (t + u) + H (t - u)) v = deriv H (t + v) + -deriv H (t - v) := by rw [← heq]; exact ((h_plus v).add (h_minus v)).deriv linarith [show deriv H (t + v) + -deriv H (t - v) = deriv H (t + v) - deriv H (t - v) from by ring] have hd2_plus : HasDerivAt (fun v => deriv H (t + v)) (deriv (deriv H) t) 0 := by have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t + 0)) (t + 0) := (hDiffDeriv (t + 0)).hasDerivAt have hcomp := hDH.comp 0 (hsh_add t 0) simp only [mul_one, add_zero, Function.comp_apply] at hcomp; exact hcomp have hd2_minus : HasDerivAt (fun v => deriv H (t - v)) (-deriv (deriv H) t) 0 := by have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t - 0)) (t - 0) := (hDiffDeriv (t - 0)).hasDerivAt have hcomp := hDH.comp 0 (hsh_sub t 0) simp only [mul_neg, mul_one, sub_zero, Function.comp_apply] at hcomp; exact hcomp rw [congr_fun (congr_arg deriv hfirst_fun) 0] have heq2 : (fun v => deriv H (t + v)) - (fun v => deriv H (t - v)) = fun v => deriv H (t + v) - deriv H (t - v) := by ext v; rfl have h : deriv (fun v => deriv H (t + v) - deriv H (t - v)) 0 = deriv (deriv H) t - -deriv (deriv H) t := by rw [← heq2]; exact (hd2_plus.sub hd2_minus).deriv linarith [show deriv (deriv H) t - -deriv (deriv H) t = 2 * deriv (deriv H) t from by ring] have rhs_eq : deriv (deriv (fun u => 2 * H t * H u)) 0 = 2 * H t * deriv (deriv H) 0 := by have hfirst_fun : deriv (fun u => 2 * H t * H u) = fun v => 2 * H t * deriv H v := funext fun v => ((hDiff v).hasDerivAt.const_mul (2 * H t)).deriv have hsecond := (hDiffDeriv 0).hasDerivAt.const_mul (2 * H t) rw [congr_fun (congr_arg deriv hfirst_fun) 0, hsecond.deriv] rw [lhs_eq, rhs_eq] at key linarithThe proof passes through a differential equation in log coordinates, where the transformed function must satisfy H'' = H. dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The declaration taylorWithinEval_succ_real is not part of that chain. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Derivation, universal coefficient)**: If H is C∞ and satisfies d'Alembert, then `H''(t) = H''(0) * H(t)` everywhere. This is the unnormalized form of `dAlembert_to_ODE_theorem`. -/ theorem dAlembert_to_ODE_general_theorem (H : ℝ → ℝ) (h_smooth : ContDiff ℝ ⊤ H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) : ∀ t, deriv (deriv H) t = deriv (deriv H) 0 * H t := by have hCDiff2 : ContDiff ℝ 2 H := h_smooth.of_le le_top have hDiff : Differentiable ℝ H := hCDiff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have hCDiff1_H' : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at hCDiff2 rw [contDiff_succ_iff_deriv] at hCDiff2 exact hCDiff2.2.2 have hDiffDeriv : Differentiable ℝ (deriv H) := hCDiff1_H'.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) have hsh_add : ∀ (s v : ℝ), HasDerivAt (fun u => s + u) (1 : ℝ) v := fun s v => by have h := (hasDerivAt_id v).add_const s; simp only [id] at h rwa [show (fun u : ℝ => u + s) = fun u => s + u from funext fun u => add_comm u s] at h have hsh_sub : ∀ (s v : ℝ), HasDerivAt (fun u => s - u) (-1 : ℝ) v := fun s v => by have h1 : HasDerivAt (fun u : ℝ => -u) (-1 : ℝ) v := by have := (hasDerivAt_id v).neg; simp only [id] at this; exact this have h2 := h1.const_add s rwa [show (fun u : ℝ => s + -u) = fun u => s - u from funext fun u => by ring] at h2 intro t have h_feq : (fun u => H (t + u) + H (t - u)) = (fun u => 2 * H t * H u) := funext (h_dAlembert t) have key : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = deriv (deriv (fun u => 2 * H t * H u)) 0 := congr_arg (fun f => deriv (deriv f) 0) h_feq have lhs_eq : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = 2 * deriv (deriv H) t := by have h_plus : ∀ v, HasDerivAt (fun u => H (t + u)) (deriv H (t + v)) v := fun v => by have hH := (hDiff (t + v)).hasDerivAt have hcomp := hH.comp v (hsh_add t v) simp only [mul_one, Function.comp_apply] at hcomp; exact hcomp have h_minus : ∀ v, HasDerivAt (fun u => H (t - u)) (-deriv H (t - v)) v := fun v => by have hH := (hDiff (t - v)).hasDerivAt have hcomp := hH.comp v (hsh_sub t v) simp only [mul_neg, mul_one, Function.comp_apply] at hcomp; exact hcomp have hfirst_fun : deriv (fun u => H (t + u) + H (t - u)) = fun v => deriv H (t + v) - deriv H (t - v) := funext fun v => by have heq : (fun u => H (t + u)) + (fun u => H (t - u)) = fun u => H (t + u) + H (t - u) := by ext u; rfl have h12 : deriv (fun u => H (t + u) + H (t - u)) v = deriv H (t + v) + -deriv H (t - v) := by rw [← heq]; exact ((h_plus v).add (h_minus v)).deriv linarith [show deriv H (t + v) + -deriv H (t - v) = deriv H (t + v) - deriv H (t - v) from by ring] have hd2_plus : HasDerivAt (fun v => deriv H (t + v)) (deriv (deriv H) t) 0 := by have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t + 0)) (t + 0) := (hDiffDeriv (t + 0)).hasDerivAt have hcomp := hDH.comp 0 (hsh_add t 0) simp only [mul_one, add_zero, Function.comp_apply] at hcomp; exact hcomp have hd2_minus : HasDerivAt (fun v => deriv H (t - v)) (-deriv (deriv H) t) 0 := by have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t - 0)) (t - 0) := (hDiffDeriv (t - 0)).hasDerivAt have hcomp := hDH.comp 0 (hsh_sub t 0) simp only [mul_neg, mul_one, sub_zero, Function.comp_apply] at hcomp; exact hcomp rw [congr_fun (congr_arg deriv hfirst_fun) 0] have heq2 : (fun v => deriv H (t + v)) - (fun v => deriv H (t - v)) = fun v => deriv H (t + v) - deriv H (t - v) := by ext v; rfl have h : deriv (fun v => deriv H (t + v) - deriv H (t - v)) 0 = deriv (deriv H) t - -deriv (deriv H) t := by rw [← heq2]; exact (hd2_plus.sub hd2_minus).deriv linarith [show deriv (deriv H) t - -deriv (deriv H) t = 2 * deriv (deriv H) t from by ring] have rhs_eq : deriv (deriv (fun u => 2 * H t * H u)) 0 = 2 * H t * deriv (deriv H) 0 := by have hfirst_fun : deriv (fun u => 2 * H t * H u) = fun v => 2 * H t * deriv H v := funext fun v => ((hDiff v).hasDerivAt.const_mul (2 * H t)).deriv have hsecond := (hDiffDeriv 0).hasDerivAt.const_mul (2 * H t) rw [congr_fun (congr_arg deriv hfirst_fun) 0, hsecond.deriv] rw [lhs_eq, rhs_eq] at key linarithThe proof reaches the differential equation through a separate regularity argument, not through Taylor expansion. dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ) (h_ODE : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := h_cont_hyp h_ODE have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0The declaration ode_cosh_uniqueness is the machine-checked theorem that this equation, together with the initial conditions H(0) = 1 and H'(0) = 0, forces H(t) = cosh(t) for every real t. ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM cosh_satisfies_continuous · cosh_satisfies_differentiable · cosh_satisfies_bootstrap · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh is continuous. -/ theorem cosh_satisfies_continuous : ode_regularity_continuous_hypothesis Real.cosh := by intro _ exact Real.continuous_cosh/-- cosh is differentiable. -/ theorem cosh_satisfies_differentiable : ode_regularity_differentiable_hypothesis Real.cosh := by intro _ _ exact Real.differentiable_cosh/-- cosh satisfies the ODE regularity bootstrap. -/ theorem cosh_satisfies_bootstrap : ode_linear_regularity_bootstrap_hypothesis Real.cosh := by intro _ _ _ exact Real.contDiff_coshThe library proves these regularity hypotheses hold for the cosine itself. cosh_satisfies_continuous · cosh_satisfies_differentiable · cosh_satisfies_bootstrap · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Derivation, universal coefficient)**: If H is C∞ and satisfies d'Alembert, then `H''(t) = H''(0) * H(t)` everywhere. This is the unnormalized form of `dAlembert_to_ODE_theorem`. -/ theorem dAlembert_to_ODE_general_theorem (H : ℝ → ℝ) (h_smooth : ContDiff ℝ ⊤ H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) : ∀ t, deriv (deriv H) t = deriv (deriv H) 0 * H t := by have hCDiff2 : ContDiff ℝ 2 H := h_smooth.of_le le_top have hDiff : Differentiable ℝ H := hCDiff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have hCDiff1_H' : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at hCDiff2 rw [contDiff_succ_iff_deriv] at hCDiff2 exact hCDiff2.2.2 have hDiffDeriv : Differentiable ℝ (deriv H) := hCDiff1_H'.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) have hsh_add : ∀ (s v : ℝ), HasDerivAt (fun u => s + u) (1 : ℝ) v := fun s v => by have h := (hasDerivAt_id v).add_const s; simp only [id] at h rwa [show (fun u : ℝ => u + s) = fun u => s + u from funext fun u => add_comm u s] at h have hsh_sub : ∀ (s v : ℝ), HasDerivAt (fun u => s - u) (-1 : ℝ) v := fun s v => by have h1 : HasDerivAt (fun u : ℝ => -u) (-1 : ℝ) v := by have := (hasDerivAt_id v).neg; simp only [id] at this; exact this have h2 := h1.const_add s rwa [show (fun u : ℝ => s + -u) = fun u => s - u from funext fun u => by ring] at h2 intro t have h_feq : (fun u => H (t + u) + H (t - u)) = (fun u => 2 * H t * H u) := funext (h_dAlembert t) have key : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = deriv (deriv (fun u => 2 * H t * H u)) 0 := congr_arg (fun f => deriv (deriv f) 0) h_feq have lhs_eq : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = 2 * deriv (deriv H) t := by have h_plus : ∀ v, HasDerivAt (fun u => H (t + u)) (deriv H (t + v)) v := fun v => by have hH := (hDiff (t + v)).hasDerivAt have hcomp := hH.comp v (hsh_add t v) simp only [mul_one, Function.comp_apply] at hcomp; exact hcomp have h_minus : ∀ v, HasDerivAt (fun u => H (t - u)) (-deriv H (t - v)) v := fun v => by have hH := (hDiff (t - v)).hasDerivAt have hcomp := hH.comp v (hsh_sub t v) simp only [mul_neg, mul_one, Function.comp_apply] at hcomp; exact hcomp have hfirst_fun : deriv (fun u => H (t + u) + H (t - u)) = fun v => deriv H (t + v) - deriv H (t - v) := funext fun v => by have heq : (fun u => H (t + u)) + (fun u => H (t - u)) = fun u => H (t + u) + H (t - u) := by ext u; rfl have h12 : deriv (fun u => H (t + u) + H (t - u)) v = deriv H (t + v) + -deriv H (t - v) := by rw [← heq]; exact ((h_plus v).add (h_minus v)).deriv linarith [show deriv H (t + v) + -deriv H (t - v) = deriv H (t + v) - deriv H (t - v) from by ring] have hd2_plus : HasDerivAt (fun v => deriv H (t + v)) (deriv (deriv H) t) 0 := by have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t + 0)) (t + 0) := (hDiffDeriv (t + 0)).hasDerivAt have hcomp := hDH.comp 0 (hsh_add t 0) simp only [mul_one, add_zero, Function.comp_apply] at hcomp; exact hcomp have hd2_minus : HasDerivAt (fun v => deriv H (t - v)) (-deriv (deriv H) t) 0 := by have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t - 0)) (t - 0) := (hDiffDeriv (t - 0)).hasDerivAt have hcomp := hDH.comp 0 (hsh_sub t 0) simp only [mul_neg, mul_one, sub_zero, Function.comp_apply] at hcomp; exact hcomp rw [congr_fun (congr_arg deriv hfirst_fun) 0] have heq2 : (fun v => deriv H (t + v)) - (fun v => deriv H (t - v)) = fun v => deriv H (t + v) - deriv H (t - v) := by ext v; rfl have h : deriv (fun v => deriv H (t + v) - deriv H (t - v)) 0 = deriv (deriv H) t - -deriv (deriv H) t := by rw [← heq2]; exact (hd2_plus.sub hd2_minus).deriv linarith [show deriv (deriv H) t - -deriv (deriv H) t = 2 * deriv (deriv H) t from by ring] have rhs_eq : deriv (deriv (fun u => 2 * H t * H u)) 0 = 2 * H t * deriv (deriv H) 0 := by have hfirst_fun : deriv (fun u => 2 * H t * H u) = fun v => 2 * H t * deriv H v := funext fun v => ((hDiff v).hasDerivAt.const_mul (2 * H t)).deriv have hsecond := (hDiffDeriv 0).hasDerivAt.const_mul (2 * H t) rw [congr_fun (congr_arg deriv hfirst_fun) 0, hsecond.deriv] rw [lhs_eq, rhs_eq] at key linarithThe bridge theorem states that if H is smooth and satisfies the d'Alembert equation, then for all t, the second derivative satisfies deriv (deriv H) t = deriv (deriv H) 0 * H t. dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The main proof route in the library does not use this bridge theorem. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The Lean theorem proves that five stated conditions select one cost, J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean- DERIVED-UNFORMALIZEDOn paper, the manuscript derives continuity, then C2 regularity, from the composition identity and the quadratic calibration itself.
- DERIVED-UNFORMALIZEDThe manuscript also records the full calibrated classification on paper.
- DERIVED-UNFORMALIZEDFinally, the paper checks that the proposed cost really satisfies the stated conditions, including reciprocity, normalization, composition, and unit curvature, and prints all proofs in one place.
THEOREM gate_forces_bilinear_family · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Once the affine-response step is known, symmetry and the boundary law force the entire bilinear family. -/ theorem gate_forces_bilinear_family (P : ℝ → ℝ → ℝ) (hGate : FactorizationAssociativityGate P) : ∃ c : ℝ, ∀ u v, P u v = c * u * v + 2 * u + 2 * v := by classical choose α β hAffine using hGate.rightAffine have hβ : ∀ u, β u = 2 * u := by intro u have h0 : P u 0 = α u * 0 + β u := hAffine u 0 rw [hGate.zeroBoundary u] at h0 linarith let c : ℝ := α 1 - 2 refine ⟨c, ?_⟩ intro u v have hsym1 : P u 1 = P 1 u := hGate.symmetric u 1 have hαu : α u = c * u + 2 := by dsimp [c] have hcalc : α u * 1 + β u = α 1 * u + β 1 := by calc α u * 1 + β u = P u 1 := by symm; exact hAffine u 1 _ = P 1 u := hGate.symmetric u 1 _ = α 1 * u + β 1 := hAffine 1 u rw [hβ u, hβ 1] at hcalc linarith calc P u v = α u * v + β u := hAffine u v _ = (c * u + 2) * v + 2 * u := by rw [hαu, hβ u] _ = c * u * v + 2 * u + 2 * v := by ringThe theorem gate_forces_bilinear_family states that any P satisfying the factorization gate must be of the form c·u·v + 2u + 2v for some constant c. gate_forces_bilinear_family · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Canonical normalization selects the RCL member of the bilinear family. -/ theorem gate_forces_rcl (P : ℝ → ℝ → ℝ) (hGate : FactorizationAssociativityGate P) : ∀ u v, P u v = 2 * u * v + 2 * u + 2 * v := by obtain ⟨c, hc⟩ := gate_forces_bilinear_family P hGate have hc_two : c = 2 := by have h11 : P 1 1 = c * 1 * 1 + 2 * 1 + 2 * 1 := by simpa using hc 1 1 linarith [hGate.unitDiagonal, h11] intro u v calc P u v = c * u * v + 2 * u + 2 * v := hc u v _ = 2 * u * v + 2 * u + 2 * v := by rw [hc_two]The theorem gate_forces_rcl, which uses the normalization P(1,1) = 6 to select the member with c = 2, depends directly on the bilinear family. gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM factorization_gate_iff_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Exact gate characterization: the factorization gate is equivalent to being the canonical RCL combiner. -/ theorem factorization_gate_iff_rcl (P : ℝ → ℝ → ℝ) : FactorizationAssociativityGate P ↔ ∀ u v, P u v = rclCombiner u v := by constructor · intro hGate u v rw [gate_forces_rcl P hGate u v] rfl · intro hP refine { symmetric := ?_ rightAffine := ?_ zeroBoundary := ?_ unitDiagonal := ?_ } · intro u v rw [hP u v, hP v u] unfold rclCombiner ring · intro u refine ⟨2 * u + 2, 2 * u, ?_⟩ intro v rw [hP u v] unfold rclCombiner ring · intro u rw [hP u 0] unfold rclCombiner ring · rw [hP 1 1] unfold rclCombiner norm_numThe equivalence factorization_gate_iff_rcl, which states that the gate is exactly equivalent to being the canonical RCL combiner, would also fail, because it relies on the same bilinear classification. factorization_gate_iff_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM cosh_satisfies_continuous · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh is continuous. -/ theorem cosh_satisfies_continuous : ode_regularity_continuous_hypothesis Real.cosh := by intro _ exact Real.continuous_coshThe theorem cosh_satisfies_continuous states that the hyperbolic cosine is continuous. cosh_satisfies_continuous · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_deriv_zero : deriv H 0 = 0 := by have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt exact even_deriv_at_zero H h_even h_diff exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hypThe theorem dAlembert_cosh_solution requires several regularity hypotheses, and cosh_satisfies_continuous is the one that supplies continuity for the hyperbolic cosine. dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The uniqueness theorem law_of_logic_forces_jcost takes continuity as one of its five input conditions. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Lemma 2.1**: If F is reciprocal, then G(t) = F(e^t) is even. -/ theorem reciprocal_implies_G_even (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) : Function.Even (G F) := G_even_of_reciprocal_symmetry F (fun {x} hx => hRecip x hx)The theorem reciprocal_implies_G_even in the machine-checked library of formal theorems proves exactly this implication. reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.leanMEASURED dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_deriv_zero : deriv H 0 = 0 := by have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt exact even_deriv_at_zero H h_even h_diff exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hypThe d'Alembert equation, H(t+u) + H(t-u) = 2 H(t) H(u), admits many non-even continuous solutions, such as H(t) = cosh(kt) for any constant k, each with a different curvature at zero. dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_to_ODE_hypothesis · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **d'Alembert to ODE derivation.** If H satisfies the d'Alembert equation and is smooth, then H'' = H. Proof sketch: Differentiate H(t+u) + H(t-u) = 2H(t)H(u) twice with respect to u, then set u = 0 to get H''(t) = H''(0) · H(t). With calibration H''(0) = 1, this gives H''(t) = H(t). -/ def dAlembert_to_ODE_hypothesis (H : ℝ → ℝ) : Prop := H 0 = 1 → Continuous H → (∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) → deriv (deriv H) 0 = 1 → ∀ t, deriv (deriv H) t = H tThe theorem dAlembert_to_ODE_hypothesis, which states that the d'Alembert equation plus evenness implies H'' = H, would no longer apply. dAlembert_to_ODE_hypothesis · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM CoshAddIdentity_implies_DirectCoshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma CoshAddIdentity_implies_DirectCoshAdd (F : ℝ → ℝ) (h : CoshAddIdentity F) : DirectCoshAdd (G F) := hThe bridge lemma takes the statement that F satisfies the composition law and returns the statement that G satisfies the corresponding addition identity. CoshAddIdentity_implies_DirectCoshAdd · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The theorem law_of_logic_forces_jcost, which concludes that F equals J, relies on this bridge. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM CoshAddIdentity · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The cosh-type functional identity for `G_F`. -/ def CoshAddIdentity (F : ℝ → ℝ) : Prop := ∀ t u : ℝ, G F (t+u) + G F (t-u) = 2 * (G F t * G F u) + 2 * (G F t + G F u)The lemma holds by the definition of CoshAddIdentity, which is stated directly in terms of G. CoshAddIdentity · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The cost uniqueness theorem states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost_with_regularization · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem 1.1 (Main Result, Reformulated)**: Let F : ℝ₊ → ℝ satisfy: 1. Reciprocity: F(x) = F(1/x) 2. Normalization: F(1) = 0 3. Composition Law: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y) 4. Calibration: lim_{t→0} 2F(e^t)/t² = 1 5. Continuity and regularity hypotheses Then F = J on ℝ₊, where J(x) = (x + 1/x)/2 - 1. This theorem corresponds to Theorem 1.1 in: J. Washburn & M. Zlatanović, "Uniqueness of the Canonical Reciprocal Cost" -/ theorem law_of_logic_forces_jcost_with_regularization (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) -- Regularity hypotheses (from Aczél theory) (h_smooth : dAlembert_continuous_implies_smooth_hypothesis (H F)) (h_ode : dAlembert_to_ODE_hypothesis (H F)) (h_cont : ode_regularity_continuous_hypothesis (H F)) (h_diff : ode_regularity_differentiable_hypothesis (H F)) (h_boot : ode_linear_regularity_bootstrap_hypothesis (H F)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by -- The proof follows the structure of T5_uniqueness_complete: -- 1. Convert composition law to CoshAddIdentity on G -- 2. Shift to H = G + 1 to get standard d'Alembert equation -- 3. Apply Aczél's theorem: continuous d'Alembert solutions are cosh -- 4. Calibration H''(0) = 1 selects cosh (not cos or constant) -- 5. Unshift: G = cosh - 1, hence F = J intro x hx -- Convert hypotheses to the required format have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp -- Step 1: Set up G and H let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F -- Step 2: Derive key properties of G and H have h_G_even : Function.Even Gf := G_even_of_reciprocal_symmetry F hSymm have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] -- Goal is F 1 + 1 = 1, and hNorm says F 1 = 0 rw [hNorm] ring -- Step 3: G is continuous (F continuous on (0,∞), exp continuous) have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const -- Step 4: Convert CoshAddIdentity to d'Alembert equation for H have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal -- Step 5: Second derivative condition have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t change deriv (fun y => Gf y + 1) t = deriv Gf t simpa using (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 -- Step 6: Apply d'Alembert uniqueness theorem have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution Hf h_H0 h_H_cont h_dAlembert h_H_d2 h_smooth h_ode h_cont h_diff h_boot -- Step 7: Unshift to get G = cosh - 1 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := by intro t have hH := h_H_cosh t have hH' : Gf t + 1 = Real.cosh t := by simpa [Hf, H, Gf] using hH linarith -- Step 8: Convert back via log parametrization have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simpa using hJG.symm _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simpa [ht]The proof in the machine-checked library of formal theorems reaches this conclusion by a chain of analytic steps: it transforms the problem into log coordinates, derives a differential equation, and then solves that equation. law_of_logic_forces_jcost_with_regularization · IndisputableMonolith/Cost/FunctionalEquation.leanMODEL dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Derivation, universal coefficient)**: If H is C∞ and satisfies d'Alembert, then `H''(t) = H''(0) * H(t)` everywhere. This is the unnormalized form of `dAlembert_to_ODE_theorem`. -/ theorem dAlembert_to_ODE_general_theorem (H : ℝ → ℝ) (h_smooth : ContDiff ℝ ⊤ H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) : ∀ t, deriv (deriv H) t = deriv (deriv H) 0 * H t := by have hCDiff2 : ContDiff ℝ 2 H := h_smooth.of_le le_top have hDiff : Differentiable ℝ H := hCDiff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have hCDiff1_H' : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at hCDiff2 rw [contDiff_succ_iff_deriv] at hCDiff2 exact hCDiff2.2.2 have hDiffDeriv : Differentiable ℝ (deriv H) := hCDiff1_H'.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) have hsh_add : ∀ (s v : ℝ), HasDerivAt (fun u => s + u) (1 : ℝ) v := fun s v => by have h := (hasDerivAt_id v).add_const s; simp only [id] at h rwa [show (fun u : ℝ => u + s) = fun u => s + u from funext fun u => add_comm u s] at h have hsh_sub : ∀ (s v : ℝ), HasDerivAt (fun u => s - u) (-1 : ℝ) v := fun s v => by have h1 : HasDerivAt (fun u : ℝ => -u) (-1 : ℝ) v := by have := (hasDerivAt_id v).neg; simp only [id] at this; exact this have h2 := h1.const_add s rwa [show (fun u : ℝ => s + -u) = fun u => s - u from funext fun u => by ring] at h2 intro t have h_feq : (fun u => H (t + u) + H (t - u)) = (fun u => 2 * H t * H u) := funext (h_dAlembert t) have key : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = deriv (deriv (fun u => 2 * H t * H u)) 0 := congr_arg (fun f => deriv (deriv f) 0) h_feq have lhs_eq : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = 2 * deriv (deriv H) t := by have h_plus : ∀ v, HasDerivAt (fun u => H (t + u)) (deriv H (t + v)) v := fun v => by have hH := (hDiff (t + v)).hasDerivAt have hcomp := hH.comp v (hsh_add t v) simp only [mul_one, Function.comp_apply] at hcomp; exact hcomp have h_minus : ∀ v, HasDerivAt (fun u => H (t - u)) (-deriv H (t - v)) v := fun v => by have hH := (hDiff (t - v)).hasDerivAt have hcomp := hH.comp v (hsh_sub t v) simp only [mul_neg, mul_one, Function.comp_apply] at hcomp; exact hcomp have hfirst_fun : deriv (fun u => H (t + u) + H (t - u)) = fun v => deriv H (t + v) - deriv H (t - v) := funext fun v => by have heq : (fun u => H (t + u)) + (fun u => H (t - u)) = fun u => H (t + u) + H (t - u) := by ext u; rfl have h12 : deriv (fun u => H (t + u) + H (t - u)) v = deriv H (t + v) + -deriv H (t - v) := by rw [← heq]; exact ((h_plus v).add (h_minus v)).deriv linarith [show deriv H (t + v) + -deriv H (t - v) = deriv H (t + v) - deriv H (t - v) from by ring] have hd2_plus : HasDerivAt (fun v => deriv H (t + v)) (deriv (deriv H) t) 0 := by have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t + 0)) (t + 0) := (hDiffDeriv (t + 0)).hasDerivAt have hcomp := hDH.comp 0 (hsh_add t 0) simp only [mul_one, add_zero, Function.comp_apply] at hcomp; exact hcomp have hd2_minus : HasDerivAt (fun v => deriv H (t - v)) (-deriv (deriv H) t) 0 := by have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t - 0)) (t - 0) := (hDiffDeriv (t - 0)).hasDerivAt have hcomp := hDH.comp 0 (hsh_sub t 0) simp only [mul_neg, mul_one, sub_zero, Function.comp_apply] at hcomp; exact hcomp rw [congr_fun (congr_arg deriv hfirst_fun) 0] have heq2 : (fun v => deriv H (t + v)) - (fun v => deriv H (t - v)) = fun v => deriv H (t + v) - deriv H (t - v) := by ext v; rfl have h : deriv (fun v => deriv H (t + v) - deriv H (t - v)) 0 = deriv (deriv H) t - -deriv (deriv H) t := by rw [← heq2]; exact (hd2_plus.sub hd2_minus).deriv linarith [show deriv (deriv H) t - -deriv (deriv H) t = 2 * deriv (deriv H) t from by ring] have rhs_eq : deriv (deriv (fun u => 2 * H t * H u)) 0 = 2 * H t * deriv (deriv H) 0 := by have hfirst_fun : deriv (fun u => 2 * H t * H u) = fun v => 2 * H t * deriv H v := funext fun v => ((hDiff v).hasDerivAt.const_mul (2 * H t)).deriv have hsecond := (hDiffDeriv 0).hasDerivAt.const_mul (2 * H t) rw [congr_fun (congr_arg deriv hfirst_fun) 0, hsecond.deriv] rw [lhs_eq, rhs_eq] at key linarithThe declaration ode_diagonalization is not part of this chain. dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ) (h_ODE : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := h_cont_hyp h_ODE have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0The current proof does not take that route. ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The cost uniqueness theorem states that any recognition cost satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_product · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_product (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) : ∀ t u, H (t+u) * H (t-u) = (H t)^2 + (H u)^2 - 1 := by intro t u have h := h_dAlembert (t + u) (t - u) have h' : H (2 * t) + H (2 * u) = 2 * H (t + u) * H (t - u) := by -- (t+u)+(t-u)=2t and (t+u)-(t-u)=2u simpa [two_mul, sub_eq_add_neg, add_assoc, add_left_comm, add_comm] using h have h2t : H (2 * t) = 2 * (H t)^2 - 1 := dAlembert_double H h_one h_dAlembert t have h2u : H (2 * u) = 2 * (H u)^2 - 1 := dAlembert_double H h_one h_dAlembert u have h'' : 2 * H (t + u) * H (t - u) = (2 * (H t)^2 - 1) + (2 * (H u)^2 - 1) := by calc 2 * H (t + u) * H (t - u) = H (2 * t) + H (2 * u) := by linarith [h'] _ = (2 * (H t)^2 - 1) + (2 * (H u)^2 - 1) := by simp [h2t, h2u] linarithThe lemma dAlembert_product derives a product identity from the sum identity: H(t+u) * H(t-u) = (H t)^2 + (H u)^2 - 1. dAlembert_product · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ) (h_ODE : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := h_cont_hyp h_ODE have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0The differential equation H''(t) = H(t) with initial conditions H(0) = 1 and H'(0) = 0 has the hyperbolic cosine as its unique solution. ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_to_ODE_hypothesis · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **d'Alembert to ODE derivation.** If H satisfies the d'Alembert equation and is smooth, then H'' = H. Proof sketch: Differentiate H(t+u) + H(t-u) = 2H(t)H(u) twice with respect to u, then set u = 0 to get H''(t) = H''(0) · H(t). With calibration H''(0) = 1, this gives H''(t) = H(t). -/ def dAlembert_to_ODE_hypothesis (H : ℝ → ℝ) : Prop := H 0 = 1 → Continuous H → (∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) → deriv (deriv H) 0 = 1 → ∀ t, deriv (deriv H) t = H tThe product identity is what makes the log-curvature condition translate into a full second-order differential equation. dAlembert_to_ODE_hypothesis · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM logCurvature_eq_deriv2 · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- For a smooth function with `Hf 0 = 1` and vanishing first derivative, the log curvature exists and equals the second derivative at the origin. This is the l'Hôpital step, and it is also what makes the corrected calibration satisfiable rather than empty. -/ theorem logCurvature_eq_deriv2 (Hf : ℝ → ℝ) (hsm : ContDiff ℝ ⊤ Hf) (h1 : Hf 0 = 1) (hd0 : deriv Hf 0 = 0) : HasLogCurvature Hf (deriv (deriv Hf) 0) := by have h2 : ContDiff ℝ 2 Hf := hsm.of_le (by exact_mod_cast le_top) have hderiv_diff : Differentiable ℝ (deriv Hf) := by have h3 := h2 rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h3 rw [contDiff_succ_iff_deriv] at h3 exact h3.2.2.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) have hdiffHf : Differentiable ℝ Hf := h2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have hd2 : HasDerivAt (deriv Hf) (deriv (deriv Hf) 0) 0 := (hderiv_diff 0).hasDerivAt have hslope : Filter.Tendsto (fun t : ℝ => deriv Hf t / t) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (deriv (deriv Hf) 0)) := by have h := hasDerivAt_iff_tendsto_slope.mp hd2 have hsl : ∀ t : ℝ, slope (deriv Hf) 0 t = deriv Hf t / t := by intro t simp [slope_def_field, hd0] exact Filter.Tendsto.congr hsl h have hnum : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1)) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 0) := by have hcont : Filter.Tendsto Hf (nhds (0 : ℝ)) (nhds (Hf 0)) := hdiffHf.continuous.tendsto 0 have hconst : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhds (0 : ℝ)) (nhds 1) := tendsto_const_nhds have hsub : Filter.Tendsto (fun t : ℝ => Hf t - 1) (nhds (0 : ℝ)) (nhds (Hf 0 - 1)) := hcont.sub hconst have hmul : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1)) (nhds (0 : ℝ)) (nhds (2 * (Hf 0 - 1))) := hsub.const_mul (2 : ℝ) rw [h1] at hmul simpa using hmul.mono_left nhdsWithin_le_nhds have hden : Filter.Tendsto (fun t : ℝ => t ^ 2) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 0) := by have h := (continuous_pow 2).tendsto (0 : ℝ) simpa using h.mono_left nhdsWithin_le_nhds have hff' : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), HasDerivAt (fun s : ℝ => 2 * (Hf s - 1)) (2 * deriv Hf t) t := by filter_upwards with t simpa using ((hdiffHf t).hasDerivAt.sub_const 1).const_mul (2 : ℝ) have hgg' : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), HasDerivAt (fun s : ℝ => s ^ 2) (2 * t) t := by filter_upwards with t simpa [mul_comm] using hasDerivAt_pow 2 t have hg'ne : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), (2 : ℝ) * t ≠ 0 := by filter_upwards [self_mem_nhdsWithin] with t ht have htne : t ≠ 0 := ht positivity have hdiv : Filter.Tendsto (fun t : ℝ => (2 * deriv Hf t) / (2 * t)) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (deriv (deriv Hf) 0)) := by refine Filter.Tendsto.congr' ?_ hslope filter_upwards [self_mem_nhdsWithin] with t ht have htne : t ≠ 0 := ht field_simp exact HasDerivAt.lhopital_zero_nhdsNE hff' hgg' hg'ne hnum hden hdivThe declaration sub_one_eq_mul_ratio is a lemma about positive real numbers, stating that x - 1 equals y times the ratio (x - 1) / y. logCurvature_eq_deriv2 · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThe proof of the cost uniqueness theorem transforms the problem into log coordinates, where the function must satisfy a differential equation whose unique smooth solution is the hyperbolic cosine. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_law_equiv_coshAdd · dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G. Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y) becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t) via the substitution x = e^s, y = e^t. -/ theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) : SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by constructor · intro hComp t u have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos -- exp(t) * exp(u) = exp(t + u) have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm -- exp(t) / exp(u) = exp(t - u) have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg] simp only [G, h1, h2] at h ⊢ linarith · intro hCosh x y hx hy let t := Real.log x let u := Real.log y have hx_eq : x = Real.exp t := (Real.exp_log hx).symm have hy_eq : y = Real.exp u := (Real.exp_log hy).symm have h := hCosh t u simp only [G] at h rw [hx_eq, hy_eq] rw [← Real.exp_add, ← Real.exp_sub] -- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u)) -- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u) calc F (Real.exp (t + u)) + F (Real.exp (t - u)) = 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h _ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ring/-- **Theorem (ODE Derivation, universal coefficient)**: If H is C∞ and satisfies d'Alembert, then `H''(t) = H''(0) * H(t)` everywhere. This is the unnormalized form of `dAlembert_to_ODE_theorem`. -/ theorem dAlembert_to_ODE_general_theorem (H : ℝ → ℝ) (h_smooth : ContDiff ℝ ⊤ H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) : ∀ t, deriv (deriv H) t = deriv (deriv H) 0 * H t := by have hCDiff2 : ContDiff ℝ 2 H := h_smooth.of_le le_top have hDiff : Differentiable ℝ H := hCDiff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have hCDiff1_H' : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at hCDiff2 rw [contDiff_succ_iff_deriv] at hCDiff2 exact hCDiff2.2.2 have hDiffDeriv : Differentiable ℝ (deriv H) := hCDiff1_H'.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) have hsh_add : ∀ (s v : ℝ), HasDerivAt (fun u => s + u) (1 : ℝ) v := fun s v => by have h := (hasDerivAt_id v).add_const s; simp only [id] at h rwa [show (fun u : ℝ => u + s) = fun u => s + u from funext fun u => add_comm u s] at h have hsh_sub : ∀ (s v : ℝ), HasDerivAt (fun u => s - u) (-1 : ℝ) v := fun s v => by have h1 : HasDerivAt (fun u : ℝ => -u) (-1 : ℝ) v := by have := (hasDerivAt_id v).neg; simp only [id] at this; exact this have h2 := h1.const_add s rwa [show (fun u : ℝ => s + -u) = fun u => s - u from funext fun u => by ring] at h2 intro t have h_feq : (fun u => H (t + u) + H (t - u)) = (fun u => 2 * H t * H u) := funext (h_dAlembert t) have key : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = deriv (deriv (fun u => 2 * H t * H u)) 0 := congr_arg (fun f => deriv (deriv f) 0) h_feq have lhs_eq : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = 2 * deriv (deriv H) t := by have h_plus : ∀ v, HasDerivAt (fun u => H (t + u)) (deriv H (t + v)) v := fun v => by have hH := (hDiff (t + v)).hasDerivAt have hcomp := hH.comp v (hsh_add t v) simp only [mul_one, Function.comp_apply] at hcomp; exact hcomp have h_minus : ∀ v, HasDerivAt (fun u => H (t - u)) (-deriv H (t - v)) v := fun v => by have hH := (hDiff (t - v)).hasDerivAt have hcomp := hH.comp v (hsh_sub t v) simp only [mul_neg, mul_one, Function.comp_apply] at hcomp; exact hcomp have hfirst_fun : deriv (fun u => H (t + u) + H (t - u)) = fun v => deriv H (t + v) - deriv H (t - v) := funext fun v => by have heq : (fun u => H (t + u)) + (fun u => H (t - u)) = fun u => H (t + u) + H (t - u) := by ext u; rfl have h12 : deriv (fun u => H (t + u) + H (t - u)) v = deriv H (t + v) + -deriv H (t - v) := by rw [← heq]; exact ((h_plus v).add (h_minus v)).deriv linarith [show deriv H (t + v) + -deriv H (t - v) = deriv H (t + v) - deriv H (t - v) from by ring] have hd2_plus : HasDerivAt (fun v => deriv H (t + v)) (deriv (deriv H) t) 0 := by have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t + 0)) (t + 0) := (hDiffDeriv (t + 0)).hasDerivAt have hcomp := hDH.comp 0 (hsh_add t 0) simp only [mul_one, add_zero, Function.comp_apply] at hcomp; exact hcomp have hd2_minus : HasDerivAt (fun v => deriv H (t - v)) (-deriv (deriv H) t) 0 := by have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t - 0)) (t - 0) := (hDiffDeriv (t - 0)).hasDerivAt have hcomp := hDH.comp 0 (hsh_sub t 0) simp only [mul_neg, mul_one, sub_zero, Function.comp_apply] at hcomp; exact hcomp rw [congr_fun (congr_arg deriv hfirst_fun) 0] have heq2 : (fun v => deriv H (t + v)) - (fun v => deriv H (t - v)) = fun v => deriv H (t + v) - deriv H (t - v) := by ext v; rfl have h : deriv (fun v => deriv H (t + v) - deriv H (t - v)) 0 = deriv (deriv H) t - -deriv (deriv H) t := by rw [← heq2]; exact (hd2_plus.sub hd2_minus).deriv linarith [show deriv (deriv H) t - -deriv (deriv H) t = 2 * deriv (deriv H) t from by ring] have rhs_eq : deriv (deriv (fun u => 2 * H t * H u)) 0 = 2 * H t * deriv (deriv H) 0 := by have hfirst_fun : deriv (fun u => 2 * H t * H u) = fun v => 2 * H t * deriv H v := funext fun v => ((hDiff v).hasDerivAt.const_mul (2 * H t)).deriv have hsecond := (hDiffDeriv 0).hasDerivAt.const_mul (2 * H t) rw [congr_fun (congr_arg deriv hfirst_fun) 0, hsecond.deriv] rw [lhs_eq, rhs_eq] at key linarithThe proof's route passes through the composition law, the d'Alembert equation, and an ordinary differential equation. composition_law_equiv_coshAdd · dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The cost uniqueness theorem states that any cost function satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Derivation, universal coefficient)**: If H is C∞ and satisfies d'Alembert, then `H''(t) = H''(0) * H(t)` everywhere. This is the unnormalized form of `dAlembert_to_ODE_theorem`. -/ theorem dAlembert_to_ODE_general_theorem (H : ℝ → ℝ) (h_smooth : ContDiff ℝ ⊤ H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) : ∀ t, deriv (deriv H) t = deriv (deriv H) 0 * H t := by have hCDiff2 : ContDiff ℝ 2 H := h_smooth.of_le le_top have hDiff : Differentiable ℝ H := hCDiff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have hCDiff1_H' : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at hCDiff2 rw [contDiff_succ_iff_deriv] at hCDiff2 exact hCDiff2.2.2 have hDiffDeriv : Differentiable ℝ (deriv H) := hCDiff1_H'.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) have hsh_add : ∀ (s v : ℝ), HasDerivAt (fun u => s + u) (1 : ℝ) v := fun s v => by have h := (hasDerivAt_id v).add_const s; simp only [id] at h rwa [show (fun u : ℝ => u + s) = fun u => s + u from funext fun u => add_comm u s] at h have hsh_sub : ∀ (s v : ℝ), HasDerivAt (fun u => s - u) (-1 : ℝ) v := fun s v => by have h1 : HasDerivAt (fun u : ℝ => -u) (-1 : ℝ) v := by have := (hasDerivAt_id v).neg; simp only [id] at this; exact this have h2 := h1.const_add s rwa [show (fun u : ℝ => s + -u) = fun u => s - u from funext fun u => by ring] at h2 intro t have h_feq : (fun u => H (t + u) + H (t - u)) = (fun u => 2 * H t * H u) := funext (h_dAlembert t) have key : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = deriv (deriv (fun u => 2 * H t * H u)) 0 := congr_arg (fun f => deriv (deriv f) 0) h_feq have lhs_eq : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = 2 * deriv (deriv H) t := by have h_plus : ∀ v, HasDerivAt (fun u => H (t + u)) (deriv H (t + v)) v := fun v => by have hH := (hDiff (t + v)).hasDerivAt have hcomp := hH.comp v (hsh_add t v) simp only [mul_one, Function.comp_apply] at hcomp; exact hcomp have h_minus : ∀ v, HasDerivAt (fun u => H (t - u)) (-deriv H (t - v)) v := fun v => by have hH := (hDiff (t - v)).hasDerivAt have hcomp := hH.comp v (hsh_sub t v) simp only [mul_neg, mul_one, Function.comp_apply] at hcomp; exact hcomp have hfirst_fun : deriv (fun u => H (t + u) + H (t - u)) = fun v => deriv H (t + v) - deriv H (t - v) := funext fun v => by have heq : (fun u => H (t + u)) + (fun u => H (t - u)) = fun u => H (t + u) + H (t - u) := by ext u; rfl have h12 : deriv (fun u => H (t + u) + H (t - u)) v = deriv H (t + v) + -deriv H (t - v) := by rw [← heq]; exact ((h_plus v).add (h_minus v)).deriv linarith [show deriv H (t + v) + -deriv H (t - v) = deriv H (t + v) - deriv H (t - v) from by ring] have hd2_plus : HasDerivAt (fun v => deriv H (t + v)) (deriv (deriv H) t) 0 := by have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t + 0)) (t + 0) := (hDiffDeriv (t + 0)).hasDerivAt have hcomp := hDH.comp 0 (hsh_add t 0) simp only [mul_one, add_zero, Function.comp_apply] at hcomp; exact hcomp have hd2_minus : HasDerivAt (fun v => deriv H (t - v)) (-deriv (deriv H) t) 0 := by have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t - 0)) (t - 0) := (hDiffDeriv (t - 0)).hasDerivAt have hcomp := hDH.comp 0 (hsh_sub t 0) simp only [mul_neg, mul_one, sub_zero, Function.comp_apply] at hcomp; exact hcomp rw [congr_fun (congr_arg deriv hfirst_fun) 0] have heq2 : (fun v => deriv H (t + v)) - (fun v => deriv H (t - v)) = fun v => deriv H (t + v) - deriv H (t - v) := by ext v; rfl have h : deriv (fun v => deriv H (t + v) - deriv H (t - v)) 0 = deriv (deriv H) t - -deriv (deriv H) t := by rw [← heq2]; exact (hd2_plus.sub hd2_minus).deriv linarith [show deriv (deriv H) t - -deriv (deriv H) t = 2 * deriv (deriv H) t from by ring] have rhs_eq : deriv (deriv (fun u => 2 * H t * H u)) 0 = 2 * H t * deriv (deriv H) 0 := by have hfirst_fun : deriv (fun u => 2 * H t * H u) = fun v => 2 * H t * deriv H v := funext fun v => ((hDiff v).hasDerivAt.const_mul (2 * H t)).deriv have hsecond := (hDiffDeriv 0).hasDerivAt.const_mul (2 * H t) rw [congr_fun (congr_arg deriv hfirst_fun) 0, hsecond.deriv] rw [lhs_eq, rhs_eq] at key linarithThe proof reaches a differential equation in log coordinates, where the transformed function must satisfy H'' = H. dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Zero Uniqueness)**: The unique solution to f'' = f with f(0) = f'(0) = 0 is f = 0. -/ theorem ode_zero_uniqueness (f : ℝ → ℝ) (h_diff2 : ContDiff ℝ 2 f) (h_ode : ∀ t, deriv (deriv f) t = f t) (h_f0 : f 0 = 0) (h_f'0 : deriv f 0 = 0) : ∀ t, f t = 0 := by have ⟨h_minus, h_plus⟩ := ode_diagonalization f h_diff2 h_ode have h_diff1 : Differentiable ℝ f := h_diff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have h_deriv_contdiff : ContDiff ℝ 1 (deriv f) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff2 rw [contDiff_succ_iff_deriv] at h_diff2 exact h_diff2.2.2 have h_diff_deriv : Differentiable ℝ (deriv f) := h_deriv_contdiff.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) let g := fun s => deriv f s - f s let hf := fun s => deriv f s + f s have hg_diff : Differentiable ℝ g := h_diff_deriv.sub h_diff1 have hh_diff : Differentiable ℝ hf := h_diff_deriv.add h_diff1 have hg0 : g 0 = 0 := by simp [g, h_f0, h_f'0] have hh0 : hf 0 = 0 := by simp [hf, h_f0, h_f'0] have hg_deriv : ∀ t, deriv g t = -g t := h_minus have hh_deriv : ∀ t, deriv hf t = hf t := h_plus have hg_zero := deriv_neg_self_zero g hg_diff hg_deriv hg0 have hh_zero := deriv_pos_self_zero hf hh_diff hh_deriv hh0 intro t have hgt := hg_zero t have hht := hh_zero t simp only [g, hf] at hgt hht linarithThe lemma ode_zero_uniqueness states that if a twice-differentiable function f satisfies the differential equation f'' = f, with initial conditions f(0) = 0 and f'(0) = 0, then f is identically zero. ode_zero_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The theorem law_of_logic_forces_jcost assumes continuity directly, not smoothness. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The declaration ode_regularity_continuous_of_smooth is not part of the main proof chain. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM cosh_dAlembert_smooth · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh satisfies the d'Alembert smoothness hypothesis. -/ theorem cosh_dAlembert_smooth : dAlembert_continuous_implies_smooth_hypothesis Real.cosh := by intro _ _ _ exact Real.contDiff_coshThe declaration cosh_dAlembert_smooth asserts that the hyperbolic cosine satisfies the smoothness hypothesis that the d'Alembert equation, together with continuity, implies infinite differentiability. cosh_dAlembert_smooth · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThe theorem dAlembert_cosh_solution_of_log_curvature takes this smoothness hypothesis as an input, along with the d'Alembert equation and the log-curvature condition, and concludes that the function is exactly cosh. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The cost uniqueness theorem states that any recognition cost satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_diff_square · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_diff_square (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) : ∀ t u, (H (t+u) - H (t-u))^2 = 4 * ((H t)^2 - 1) * ((H u)^2 - 1) := by intro t u have h_sum : H (t+u) + H (t-u) = 2 * H t * H u := h_dAlembert t u have h_prod : H (t+u) * H (t-u) = (H t)^2 + (H u)^2 - 1 := dAlembert_product H h_one h_dAlembert t u calc (H (t+u) - H (t-u))^2 = (H (t+u) + H (t-u))^2 - 4 * (H (t+u) * H (t-u)) := by ring _ = (2 * H t * H u)^2 - 4 * ((H t)^2 + (H u)^2 - 1) := by simp [h_sum, h_prod] _ = 4 * ((H t)^2 - 1) * ((H u)^2 - 1) := by ringThe diff-square lemma states that (H(t+u) - H(t-u))² = 4 ((H t)² - 1) ((H u)² - 1) follows from the cosine addition formula alone. dAlembert_diff_square · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_to_ODE_hypothesis · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **d'Alembert to ODE derivation.** If H satisfies the d'Alembert equation and is smooth, then H'' = H. Proof sketch: Differentiate H(t+u) + H(t-u) = 2H(t)H(u) twice with respect to u, then set u = 0 to get H''(t) = H''(0) · H(t). With calibration H''(0) = 1, this gives H''(t) = H(t). -/ def dAlembert_to_ODE_hypothesis (H : ℝ → ℝ) : Prop := H 0 = 1 → Continuous H → (∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) → deriv (deriv H) 0 = 1 → ∀ t, deriv (deriv H) t = H tThe lemma is the step that converts the functional equation into the differential equation H'' = H. dAlembert_to_ODE_hypothesis · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_deriv_zero : deriv H 0 = 0 := by have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt exact even_deriv_at_zero H h_even h_diff exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hypThe theorem dAlembert_cosh_solution states that a continuous solution of the cosine addition formula with H(0) = 1 and second derivative 1 at 0 must be cosh. dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_double · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_double (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (t : ℝ) : H (2 * t) = 2 * (H t)^2 - 1 := by have h := h_dAlembert t t have h' : H (t + t) = 2 * (H t)^2 - 1 := by -- H(2t) + H(0) = 2 H(t)^2 have h0 : H (t + t) + 1 = 2 * H t * H t := by simpa [h_one] using h have h1 : H (t + t) = 2 * H t * H t - 1 := by linarith simpa [pow_two, mul_assoc] using h1 simpa [two_mul] using h'A simple consequence, the doubling identity H(2t) = 2 H(t)^2 - 1, follows by setting u = t in the addition formula. dAlembert_double · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The page's main theorem, law_of_logic_forces_jcost, relies on this analytic route through the differential equation, not on the doubling identity. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM Jcost_G_eq_cosh_sub_one · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_G_eq_cosh_sub_one (t : ℝ) : G Cost.Jcost t = Real.cosh t - 1 := by simp only [G, Jcost] -- Jcost(exp t) = (exp t + exp(-t))/2 - 1 = cosh t - 1 have h1 : (Real.exp t)⁻¹ = Real.exp (-t) := by simp [Real.exp_neg] rw [h1, Real.cosh_eq]For the actual solution H(t) = cosh(t), this is the familiar double-angle formula cosh(2t) = 2 cosh(t)^2 - 1, a fact the library also records. Jcost_G_eq_cosh_sub_one · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM Jcost_G_eq_cosh_sub_one · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_G_eq_cosh_sub_one (t : ℝ) : G Cost.Jcost t = Real.cosh t - 1 := by simp only [G, Jcost] -- Jcost(exp t) = (exp t + exp(-t))/2 - 1 = cosh t - 1 have h1 : (Real.exp t)⁻¹ = Real.exp (-t) := by simp [Real.exp_neg] rw [h1, Real.cosh_eq]The cost function J(x) = (x + 1/x)/2 - 1, after the logarithmic change of variables x = e^t, equals cosh(t) - 1. Jcost_G_eq_cosh_sub_one · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_deriv_zero : deriv H 0 = 0 := by have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt exact even_deriv_at_zero H h_even h_diff exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hypThe continuous solutions to d'Alembert's equation H(t+u) + H(t-u) = 2 H(t) H(u) are exactly the hyperbolic cosine functions H(t) = cosh(kt) for a constant k. dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]Any cost function satisfying the five plain conditions must equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Canonical normalization selects the RCL member of the bilinear family. -/ theorem gate_forces_rcl (P : ℝ → ℝ → ℝ) (hGate : FactorizationAssociativityGate P) : ∀ u v, P u v = 2 * u * v + 2 * u + 2 * v := by obtain ⟨c, hc⟩ := gate_forces_bilinear_family P hGate have hc_two : c = 2 := by have h11 : P 1 1 = c * 1 * 1 + 2 * 1 + 2 * 1 := by simpa using hc 1 1 linarith [hGate.unitDiagonal, h11] intro u v calc P u v = c * u * v + 2 * u + 2 * v := hc u v _ = 2 * u * v + 2 * u + 2 * v := by rw [hc_two]gate_forces_rcl proves that any combiner satisfying the four gate conditions must be the RCL polynomial P u v = 2uv + 2u + 2v. gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM FactorizationAssociativityGate · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Packaged combiner gate used by the factorization/associativity bridge. -/ structure FactorizationAssociativityGate (P : ℝ → ℝ → ℝ) : Prop where symmetric : ∀ u v, P u v = P v u rightAffine : ∀ u, ∃ α β, ∀ v, P u v = α * v + β zeroBoundary : ∀ u, P u 0 = 2 * u unitDiagonal : P 1 1 = 6The gate's four conditions are symmetry, affine response in the second argument, the zero boundary law P u 0 = 2u, and the unit diagonal normalization P 1 1 = 6. FactorizationAssociativityGate · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM gate_forces_bilinear_family · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Once the affine-response step is known, symmetry and the boundary law force the entire bilinear family. -/ theorem gate_forces_bilinear_family (P : ℝ → ℝ → ℝ) (hGate : FactorizationAssociativityGate P) : ∃ c : ℝ, ∀ u v, P u v = c * u * v + 2 * u + 2 * v := by classical choose α β hAffine using hGate.rightAffine have hβ : ∀ u, β u = 2 * u := by intro u have h0 : P u 0 = α u * 0 + β u := hAffine u 0 rw [hGate.zeroBoundary u] at h0 linarith let c : ℝ := α 1 - 2 refine ⟨c, ?_⟩ intro u v have hsym1 : P u 1 = P 1 u := hGate.symmetric u 1 have hαu : α u = c * u + 2 := by dsimp [c] have hcalc : α u * 1 + β u = α 1 * u + β 1 := by calc α u * 1 + β u = P u 1 := by symm; exact hAffine u 1 _ = P 1 u := hGate.symmetric u 1 _ = α 1 * u + β 1 := hAffine 1 u rw [hβ u, hβ 1] at hcalc linarith calc P u v = α u * v + β u := hAffine u v _ = (c * u + 2) * v + 2 * u := by rw [hαu, hβ u] _ = c * u * v + 2 * u + 2 * v := by ringThe proof of gate_forces_rcl runs through gate_forces_bilinear_family, which shows the conditions force P into the family c·uv + 2u + 2v, and then the unit diagonal pins down c = 2. gate_forces_bilinear_family · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The cost uniqueness page proves that any cost function obeying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThe proof passes through a differential equation, a hard analytic step that selects the unique smooth solution. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanMODEL SatisfiesCompositionLaw · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Composition Law (Equation 1.1)**: F(xy) + F(x/y) = 2·F(x)·F(y) + 2·F(x) + 2·F(y) for all x, y > 0. This is the Recognition Composition Law (RCL). -/ def SatisfiesCompositionLaw (F : ℝ → ℝ) : Prop := ∀ x y : ℝ, 0 < x → 0 < y → F (x * y) + F (x / y) = 2 * F x * F y + 2 * F x + 2 * F yThe declaration G_zero_of_unit belongs to a different, purely algebraic corner of the framework: it characterizes a two-argument combiner P(u,v) by four structural conditions: symmetry, affine response in its second argument, a zero boundary law, and a composition rule. SatisfiesCompositionLaw · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_cosh_add_identity : CoshAddIdentity Cost.Jcost := by intro t u simp only [G, Jcost] -- Use exp(t+u) = exp(t)*exp(u) and exp(t-u) = exp(t)/exp(u) have he1 : Real.exp (t + u) = Real.exp t * Real.exp u := Real.exp_add t u have he2 : Real.exp (t - u) = Real.exp t / Real.exp u := by rw [sub_eq_add_neg, Real.exp_add, Real.exp_neg] ring have hpos_t : Real.exp t > 0 := Real.exp_pos t have hpos_u : Real.exp u > 0 := Real.exp_pos u have hne_t : Real.exp t ≠ 0 := hpos_t.ne' have hne_u : Real.exp u ≠ 0 := hpos_u.ne' rw [he1, he2] field_simp ringThe lemma G_zero_of_unit proves that this law holds for the specific combiner that the framework uses. Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The declaration taylorWithinEval_two_univ is not part of that chain. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanMODEL cosh_initials · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem cosh_initials : Real.cosh 0 = 1 ∧ deriv (fun x => Real.cosh x) 0 = 0 := by constructor · simp [Real.cosh_zero] · have h := Real.deriv_cosh simp only [h, Real.sinh_zero]The hyperbolic cosine, written cosh(t), is the average of the exponential function and its reciprocal: cosh(t) = (e^t + e^-t)/2. cosh_initials · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_deriv_zero : deriv H 0 = 0 := by have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt exact even_deriv_at_zero H h_even h_diff exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hypIn 1747, Jean le Rond d'Alembert studied the functional equation H(t+u) + H(t-u) = 2 H(t) H(u) for all real t and u. dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The cost uniqueness theorem states that any recognition cost, the amount posted when something is recognized, satisfying five plain conditions must equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM cosh_dAlembert_smooth · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh satisfies the d'Alembert smoothness hypothesis. -/ theorem cosh_dAlembert_smooth : dAlembert_continuous_implies_smooth_hypothesis Real.cosh := by intro _ _ _ exact Real.contDiff_coshThe machine-checked library of formal theorems proves a lemma named cosh_dAlembert_smooth. cosh_dAlembert_smooth · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM cosh_dAlembert_smooth · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- cosh satisfies the d'Alembert smoothness hypothesis. -/ theorem cosh_dAlembert_smooth : dAlembert_continuous_implies_smooth_hypothesis Real.cosh := by intro _ _ _ exact Real.contDiff_coshIt confirms that cosh satisfies the hypothesis that continuity, together with the d'Alembert equation, implies infinite differentiability. cosh_dAlembert_smooth · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The declaration deriv_pos_self_zero contributes nothing to the proof as it stands, and the page should not cite it. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **The cost theorem on two premises.** The composition law and unit log curvature force `F = J` on the positives. Normalization, nonnegativity, and continuity are all conclusions rather than hypotheses; compare `law_of_logic_forces_jcost`, which assumes all of them. -/ theorem composition_logCurvature_forces_jcost [AczelSmoothnessPackage] (F : ℝ → ℝ) (hComp : SatisfiesCompositionLaw F) (hκ : HasLogCurvature (H F) 1) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by have hNorm : IsNormalized F := logCurvature_forces_normalized F hComp hκ have hN : F 1 = 0 := hNorm have hH0 : H F 0 = 1 := by simp [H, G, hN] have hCosh : CoshAddIdentity F := (composition_law_equiv_coshAdd F).mp hComp have hdA : ∀ t u, H F (t + u) + H F (t - u) = 2 * H F t * H F u := by intro t u have hG := hCosh t u have hgoal : (G F (t + u) + 1) + (G F (t - u) + 1) = 2 * (G F t + 1) * (G F u + 1) := by calc (G F (t + u) + 1) + (G F (t - u) + 1) = (G F (t + u) + G F (t - u)) + 2 := by ring _ = (2 * (G F t * G F u) + 2 * (G F t + G F u)) + 2 := by simpa [hG] _ = 2 * (G F t + 1) * (G F u + 1) := by ring simpa [H] using hgoal have hcont : Continuous (H F) := dAlembert_continuous_of_log_curvature (H F) hH0 hdA hκ have hsm : ContDiff ℝ ⊤ (H F) := aczel_dAlembert_smooth (H F) hH0 hcont hdA have heven : Function.Even (H F) := dAlembert_even (H F) hH0 hdA have hd0 : deriv (H F) 0 = 0 := even_deriv_at_zero (H F) heven (hsm.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) 0) have hd2 : deriv (deriv (H F)) 0 = 1 := deriv2_of_logCurvature (H F) hsm hH0 hd0 hκ have hcosh : ∀ t, H F t = Real.cosh t := dAlembert_cosh_solution_aczel (H F) hH0 hcont hdA hd2 intro x hx have hGc : G F (Real.log x) = Real.cosh (Real.log x) - 1 := by have h := hcosh (Real.log x) simp only [H] at h linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = G F (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := hGc _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The proof transforms the problem into log coordinates, derives a differential equation, and then solves that equation. composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_aczel · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (d'Alembert → cosh, Aczél form)**: Using only the Aczél axiom, a continuous solution to d'Alembert with H(0) = 1 and H''(0) = 1 must equal cosh. This is the clean version of `dAlembert_cosh_solution`, requiring no regularity params. -/ theorem dAlembert_cosh_solution_aczel [AczelSmoothnessPackage] (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_d2_zero : deriv (deriv H) 0 = 1) : ∀ t, H t = Real.cosh t := by have h_smooth : ContDiff ℝ ⊤ H := aczel_dAlembert_smooth H h_one h_cont h_dAlembert have hDiff : Differentiable ℝ H := (h_smooth.of_le le_top : ContDiff ℝ 1 H).differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_H'0 : deriv H 0 = 0 := even_deriv_at_zero H h_even hDiff.differentiableAt have h_ode : ∀ t, deriv (deriv H) t = H t := dAlembert_to_ODE_theorem H h_smooth h_dAlembert h_d2_zero have h_C2 : ContDiff ℝ 2 H := h_smooth.of_le le_top exact ode_cosh_uniqueness_contdiff H h_C2 h_ode h_one h_H'0A continuous solution of the d'Alembert equation with H(0) = 1 and the second derivative at zero equal to 1 must be the hyperbolic cosine. dAlembert_cosh_solution_aczel · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/ theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ) (h_diff : ContDiff ℝ 2 H) (h_ode : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) : ∀ t, H t = Real.cosh t := by let g := fun t => H t - Real.cosh t have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh have hg_ode : ∀ t, deriv (deriv g) t = g t := by intro t have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by ext s; apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by have hH_diff1 : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff rw [contDiff_succ_iff_deriv] at h_diff exact h_diff.2.2 have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by rw [Real.deriv_cosh]; exact Real.contDiff_sinh rw [h1]; apply deriv_sub · exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt · exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt rw [h2, h_ode t, cosh_second_deriv_eq t] have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero] have hg'0 : deriv g 0 = 0 := by have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0 intro t have := hg_zero t simp only [g] at this; linarithThe uniqueness of the solution to the differential equation H'' = H with initial conditions H(0) = 1 and H'(0) = 0 is proved in ode_cosh_uniqueness_contdiff. ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Lemma 2.1**: If F is reciprocal, then G(t) = F(e^t) is even. -/ theorem reciprocal_implies_G_even (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) : Function.Even (G F) := G_even_of_reciprocal_symmetry F (fun {x} hx => hRecip x hx)The reciprocal symmetry condition, which says F(x) = F(1/x) for every positive x, becomes the statement that G F is even: G F t = G F (-t). reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Lemma 2.1**: If F is reciprocal, then G(t) = F(e^t) is even. -/ theorem reciprocal_implies_G_even (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) : Function.Even (G F) := G_even_of_reciprocal_symmetry F (fun {x} hx => hRecip x hx)The lemma proves this implication directly, without any calculus. reciprocal_implies_G_even · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ) (h_ODE : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := h_cont_hyp h_ODE have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0One of those conditions is that the derivative of G F at zero is zero, which follows immediately from evenness. ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_product · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_product (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) : ∀ t u, H (t+u) * H (t-u) = (H t)^2 + (H u)^2 - 1 := by intro t u have h := h_dAlembert (t + u) (t - u) have h' : H (2 * t) + H (2 * u) = 2 * H (t + u) * H (t - u) := by -- (t+u)+(t-u)=2t and (t+u)-(t-u)=2u simpa [two_mul, sub_eq_add_neg, add_assoc, add_left_comm, add_comm] using h have h2t : H (2 * t) = 2 * (H t)^2 - 1 := dAlembert_double H h_one h_dAlembert t have h2u : H (2 * u) = 2 * (H u)^2 - 1 := dAlembert_double H h_one h_dAlembert u have h'' : 2 * H (t + u) * H (t - u) = (2 * (H t)^2 - 1) + (2 * (H u)^2 - 1) := by calc 2 * H (t + u) * H (t - u) = H (2 * t) + H (2 * u) := by linarith [h'] _ = (2 * (H t)^2 - 1) + (2 * (H u)^2 - 1) := by simp [h2t, h2u] linarithThe declaration dAlembert_product in the framework's library of formal theorems proves exactly this identity. dAlembert_product · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_product · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_product (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) : ∀ t u, H (t+u) * H (t-u) = (H t)^2 + (H u)^2 - 1 := by intro t u have h := h_dAlembert (t + u) (t - u) have h' : H (2 * t) + H (2 * u) = 2 * H (t + u) * H (t - u) := by -- (t+u)+(t-u)=2t and (t+u)-(t-u)=2u simpa [two_mul, sub_eq_add_neg, add_assoc, add_left_comm, add_comm] using h have h2t : H (2 * t) = 2 * (H t)^2 - 1 := dAlembert_double H h_one h_dAlembert t have h2u : H (2 * u) = 2 * (H u)^2 - 1 := dAlembert_double H h_one h_dAlembert u have h'' : 2 * H (t + u) * H (t - u) = (2 * (H t)^2 - 1) + (2 * (H u)^2 - 1) := by calc 2 * H (t + u) * H (t - u) = H (2 * t) + H (2 * u) := by linarith [h'] _ = (2 * (H t)^2 - 1) + (2 * (H u)^2 - 1) := by simp [h2t, h2u] linarithIt is a lemma, not a theorem about the cost function itself. dAlembert_product · IndisputableMonolith/Cost/FunctionalEquation.lean- OPENThe page's main proof does not currently use this product identity.
THEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The theorem law_of_logic_forces_jcost takes calibration as one of its hypotheses and concludes that F must equal J(x) = (x + 1/x)/2 - 1 everywhere on positive inputs. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_deriv_zero : deriv H 0 = 0 := by have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt exact even_deriv_at_zero H h_even h_diff exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hypThe continuous solutions of the d'Alembert equation are exactly H(t) = cosh(kt) for a constant k. dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **The cost theorem on two premises.** The composition law and unit log curvature force `F = J` on the positives. Normalization, nonnegativity, and continuity are all conclusions rather than hypotheses; compare `law_of_logic_forces_jcost`, which assumes all of them. -/ theorem composition_logCurvature_forces_jcost [AczelSmoothnessPackage] (F : ℝ → ℝ) (hComp : SatisfiesCompositionLaw F) (hκ : HasLogCurvature (H F) 1) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by have hNorm : IsNormalized F := logCurvature_forces_normalized F hComp hκ have hN : F 1 = 0 := hNorm have hH0 : H F 0 = 1 := by simp [H, G, hN] have hCosh : CoshAddIdentity F := (composition_law_equiv_coshAdd F).mp hComp have hdA : ∀ t u, H F (t + u) + H F (t - u) = 2 * H F t * H F u := by intro t u have hG := hCosh t u have hgoal : (G F (t + u) + 1) + (G F (t - u) + 1) = 2 * (G F t + 1) * (G F u + 1) := by calc (G F (t + u) + 1) + (G F (t - u) + 1) = (G F (t + u) + G F (t - u)) + 2 := by ring _ = (2 * (G F t * G F u) + 2 * (G F t + G F u)) + 2 := by simpa [hG] _ = 2 * (G F t + 1) * (G F u + 1) := by ring simpa [H] using hgoal have hcont : Continuous (H F) := dAlembert_continuous_of_log_curvature (H F) hH0 hdA hκ have hsm : ContDiff ℝ ⊤ (H F) := aczel_dAlembert_smooth (H F) hH0 hcont hdA have heven : Function.Even (H F) := dAlembert_even (H F) hH0 hdA have hd0 : deriv (H F) 0 = 0 := even_deriv_at_zero (H F) heven (hsm.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) 0) have hd2 : deriv (deriv (H F)) 0 = 1 := deriv2_of_logCurvature (H F) hsm hH0 hd0 hκ have hcosh : ∀ t, H F t = Real.cosh t := dAlembert_cosh_solution_aczel (H F) hH0 hcont hdA hd2 intro x hx have hGc : G F (Real.log x) = Real.cosh (Real.log x) - 1 := by have h := hcosh (Real.log x) simp only [H] at h linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = G F (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := hGc _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]Calibration forces k = 1, and with it the unique J. composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM hasLogCurvature_full_filter_forces_zero · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Tripwire.** The full-filter reading of log curvature forces `κ = 0`, so at the calibrated value `κ = 1` it is satisfied by no function at all. Kept as a theorem so the defect cannot be reintroduced without a failing build. -/ theorem hasLogCurvature_full_filter_forces_zero (Hf : ℝ → ℝ) (κ : ℝ) (h : Filter.Tendsto (fun t => 2 * (Hf t - 1) / t^2) (nhds 0) (nhds κ)) : κ = 0 := by have h1 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2) (pure 0) (nhds κ) := h.mono_left (pure_le_nhds 0) have h2 : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1) / t ^ 2) (pure 0) (nhds (2 * (Hf 0 - 1) / (0 : ℝ) ^ 2)) := tendsto_pure_nhds _ _ have h3 := tendsto_nhds_unique h2 h1 simpa using h3.symmThe lemma hasLogCurvature_full_filter_forces_zero shows that if the log-curvature limit exists at all, it must be 0. hasLogCurvature_full_filter_forces_zero · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM cosh_initials · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem cosh_initials : Real.cosh 0 = 1 ∧ deriv (fun x => Real.cosh x) 0 = 0 := by constructor · simp [Real.cosh_zero] · have h := Real.deriv_cosh simp only [h, Real.sinh_zero]The theorem cosh_initials states exactly these two facts: cosh(0) = 1 and the derivative of cosh at 0 is 0. cosh_initials · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_deriv_zero : deriv H 0 = 0 := by have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt exact even_deriv_at_zero H h_even h_diff exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hypIn 1747, Jean le Rond d'Alembert studied a functional equation that asks for functions H satisfying H(t+u) + H(t-u) = 2 H(t) H(u) for all real t and u. dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_deriv_zero : deriv H 0 = 0 := by have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt exact even_deriv_at_zero H h_even h_diff exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hypThe theorem dAlembert_cosh_solution uses precisely these two values along with the d'Alembert equation to conclude H(t) = cosh(t) for all t. dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_deriv_zero : deriv H 0 = 0 := by have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt exact even_deriv_at_zero H h_even h_diff exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hypThe declaration dAlembert_cosh_solution shows that a continuous function satisfying the d'Alembert equation H(t+u) + H(t-u) = 2 H(t) H(u), with H(0) = 1 and a second-derivative condition at zero, must be exactly the hyperbolic cosine H(t) = cosh(t). dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThe declaration dAlembert_cosh_solution_of_log_curvature is the sharper version used in the main proof: it assumes the log-curvature condition directly and derives the d'Alembert equation from it. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanMEASURED dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_deriv_zero : deriv H 0 = 0 := by have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt exact even_deriv_at_zero H h_even h_diff exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hypIn 1747, Jean le Rond d'Alembert studied the functional equation H(t+u) + H(t-u) = 2 H(t) H(u) while modeling a vibrating string. dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_continuous_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_continuous_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) : Continuous H := by refine continuous_iff_continuousAt.2 ?_ intro t have h_lim_H : Filter.Tendsto H (nhds 0) (nhds 1) := tendsto_H_one_of_log_curvature H h_one h_calib have h_sum : Filter.Tendsto (fun u => H (t+u) + H (t-u)) (nhds 0) (nhds (2 * H t)) := by have h_prod : Filter.Tendsto (fun u => (2 * H t) * H u) (nhds 0) (nhds ((2 * H t) * (1 : ℝ))) := (tendsto_const_nhds.mul h_lim_H) have h_prod' : Filter.Tendsto (fun u => 2 * H t * H u) (nhds 0) (nhds (2 * H t)) := by simpa [mul_assoc] using h_prod have h_eq : (fun u => H (t+u) + H (t-u)) = fun u => 2 * H t * H u := by funext u exact h_dAlembert t u simpa [h_eq] using h_prod' have h_diff_sq : Filter.Tendsto (fun u => (H (t+u) - H (t-u))^2) (nhds 0) (nhds (0 : ℝ)) := by have h_u_sq : Filter.Tendsto (fun u => (H u)^2) (nhds 0) (nhds ((1 : ℝ)^2)) := by simpa [pow_two] using h_lim_H.mul h_lim_H have h_u_sq_sub : Filter.Tendsto (fun u => (H u)^2 - 1) (nhds 0) (nhds (0 : ℝ)) := by have h_const : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhds 0) (nhds (1 : ℝ)) := tendsto_const_nhds simpa using h_u_sq.sub h_const have h_const : Filter.Tendsto (fun _ : ℝ => 4 * ((H t)^2 - 1)) (nhds 0) (nhds (4 * ((H t)^2 - 1))) := tendsto_const_nhds have h_mul : Filter.Tendsto (fun u => (4 * ((H t)^2 - 1)) * ((H u)^2 - 1)) (nhds 0) (nhds (4 * ((H t)^2 - 1) * (0 : ℝ))) := h_const.mul h_u_sq_sub have h_eq : (fun u => (H (t+u) - H (t-u))^2) = (fun u => 4 * ((H t)^2 - 1) * ((H u)^2 - 1)) := by funext u exact dAlembert_diff_square H h_one h_dAlembert t u simpa [h_eq] using h_mul have h_abs : Filter.Tendsto (fun u => |H (t+u) - H (t-u)|) (nhds 0) (nhds (0 : ℝ)) := by have h_sqrt : Filter.Tendsto (fun u => Real.sqrt ((H (t+u) - H (t-u))^2)) (nhds 0) (nhds (Real.sqrt 0)) := (Real.continuous_sqrt.tendsto 0).comp h_diff_sq simpa [Real.sqrt_sq_eq_abs] using h_sqrt have h_diff : Filter.Tendsto (fun u => H (t+u) - H (t-u)) (nhds 0) (nhds (0 : ℝ)) := (tendsto_zero_iff_abs_tendsto_zero (f := fun u => H (t+u) - H (t-u))).2 h_abs have h_sum_diff : Filter.Tendsto (fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) (nhds 0) (nhds ((2 * H t) + (0 : ℝ))) := h_sum.add h_diff have h_twice : Filter.Tendsto (fun u => 2 * H (t+u)) (nhds 0) (nhds (2 * H t)) := by have h_sum_diff' : Filter.Tendsto (fun u => H (t+u) + H (t+u)) (nhds 0) (nhds (2 * H t)) := by have h_eq : (fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) = (fun u => H (t+u) + H (t+u)) := by funext u ring have h_sum_diff'' : Filter.Tendsto (fun u => (H (t+u) + H (t-u)) + (H (t+u) - H (t-u))) (nhds 0) (nhds (2 * H t)) := by simpa using h_sum_diff simpa [h_eq] using h_sum_diff'' simpa [two_mul] using h_sum_diff' have h_half : Filter.Tendsto (fun u => (2 * H (t+u)) / 2) (nhds 0) (nhds ((2 * H t) / 2)) := by have h_const : Filter.Tendsto (fun _ : ℝ => (1 / 2 : ℝ)) (nhds 0) (nhds (1 / 2 : ℝ)) := tendsto_const_nhds simpa [div_eq_mul_inv] using h_twice.mul h_const have h_at0 : Filter.Tendsto (fun u => H (t+u)) (nhds 0) (nhds (H t)) := by simpa using h_half have h_map : Filter.Tendsto H (Filter.map (fun u => t + u) (nhds 0)) (nhds (H t)) := (Filter.tendsto_map'_iff).2 h_at0 have h_tendsto : Filter.Tendsto H (nhds t) (nhds (H t)) := by simpa [map_add_left_nhds_zero] using h_map exact h_tendstoThe theorem dAlembert_continuous_of_log_curvature states that if H satisfies the d'Alembert equation, has H(0) = 1, and has a finite log-curvature at zero, then H is continuous everywhere. dAlembert_continuous_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The log-curvature condition is the fifth of the five plain conditions in the cost uniqueness theorem. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Derivation, universal coefficient)**: If H is C∞ and satisfies d'Alembert, then `H''(t) = H''(0) * H(t)` everywhere. This is the unnormalized form of `dAlembert_to_ODE_theorem`. -/ theorem dAlembert_to_ODE_general_theorem (H : ℝ → ℝ) (h_smooth : ContDiff ℝ ⊤ H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) : ∀ t, deriv (deriv H) t = deriv (deriv H) 0 * H t := by have hCDiff2 : ContDiff ℝ 2 H := h_smooth.of_le le_top have hDiff : Differentiable ℝ H := hCDiff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have hCDiff1_H' : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at hCDiff2 rw [contDiff_succ_iff_deriv] at hCDiff2 exact hCDiff2.2.2 have hDiffDeriv : Differentiable ℝ (deriv H) := hCDiff1_H'.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) have hsh_add : ∀ (s v : ℝ), HasDerivAt (fun u => s + u) (1 : ℝ) v := fun s v => by have h := (hasDerivAt_id v).add_const s; simp only [id] at h rwa [show (fun u : ℝ => u + s) = fun u => s + u from funext fun u => add_comm u s] at h have hsh_sub : ∀ (s v : ℝ), HasDerivAt (fun u => s - u) (-1 : ℝ) v := fun s v => by have h1 : HasDerivAt (fun u : ℝ => -u) (-1 : ℝ) v := by have := (hasDerivAt_id v).neg; simp only [id] at this; exact this have h2 := h1.const_add s rwa [show (fun u : ℝ => s + -u) = fun u => s - u from funext fun u => by ring] at h2 intro t have h_feq : (fun u => H (t + u) + H (t - u)) = (fun u => 2 * H t * H u) := funext (h_dAlembert t) have key : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = deriv (deriv (fun u => 2 * H t * H u)) 0 := congr_arg (fun f => deriv (deriv f) 0) h_feq have lhs_eq : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = 2 * deriv (deriv H) t := by have h_plus : ∀ v, HasDerivAt (fun u => H (t + u)) (deriv H (t + v)) v := fun v => by have hH := (hDiff (t + v)).hasDerivAt have hcomp := hH.comp v (hsh_add t v) simp only [mul_one, Function.comp_apply] at hcomp; exact hcomp have h_minus : ∀ v, HasDerivAt (fun u => H (t - u)) (-deriv H (t - v)) v := fun v => by have hH := (hDiff (t - v)).hasDerivAt have hcomp := hH.comp v (hsh_sub t v) simp only [mul_neg, mul_one, Function.comp_apply] at hcomp; exact hcomp have hfirst_fun : deriv (fun u => H (t + u) + H (t - u)) = fun v => deriv H (t + v) - deriv H (t - v) := funext fun v => by have heq : (fun u => H (t + u)) + (fun u => H (t - u)) = fun u => H (t + u) + H (t - u) := by ext u; rfl have h12 : deriv (fun u => H (t + u) + H (t - u)) v = deriv H (t + v) + -deriv H (t - v) := by rw [← heq]; exact ((h_plus v).add (h_minus v)).deriv linarith [show deriv H (t + v) + -deriv H (t - v) = deriv H (t + v) - deriv H (t - v) from by ring] have hd2_plus : HasDerivAt (fun v => deriv H (t + v)) (deriv (deriv H) t) 0 := by have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t + 0)) (t + 0) := (hDiffDeriv (t + 0)).hasDerivAt have hcomp := hDH.comp 0 (hsh_add t 0) simp only [mul_one, add_zero, Function.comp_apply] at hcomp; exact hcomp have hd2_minus : HasDerivAt (fun v => deriv H (t - v)) (-deriv (deriv H) t) 0 := by have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t - 0)) (t - 0) := (hDiffDeriv (t - 0)).hasDerivAt have hcomp := hDH.comp 0 (hsh_sub t 0) simp only [mul_neg, mul_one, sub_zero, Function.comp_apply] at hcomp; exact hcomp rw [congr_fun (congr_arg deriv hfirst_fun) 0] have heq2 : (fun v => deriv H (t + v)) - (fun v => deriv H (t - v)) = fun v => deriv H (t + v) - deriv H (t - v) := by ext v; rfl have h : deriv (fun v => deriv H (t + v) - deriv H (t - v)) 0 = deriv (deriv H) t - -deriv (deriv H) t := by rw [← heq2]; exact (hd2_plus.sub hd2_minus).deriv linarith [show deriv (deriv H) t - -deriv (deriv H) t = 2 * deriv (deriv H) t from by ring] have rhs_eq : deriv (deriv (fun u => 2 * H t * H u)) 0 = 2 * H t * deriv (deriv H) 0 := by have hfirst_fun : deriv (fun u => 2 * H t * H u) = fun v => 2 * H t * deriv H v := funext fun v => ((hDiff v).hasDerivAt.const_mul (2 * H t)).deriv have hsecond := (hDiffDeriv 0).hasDerivAt.const_mul (2 * H t) rw [congr_fun (congr_arg deriv hfirst_fun) 0, hsecond.deriv] rw [lhs_eq, rhs_eq] at key linarithThe theorem guarantees that H is continuous, which then allows the proof to invoke the classical result that a continuous d'Alembert solution is smooth and satisfies the differential equation H'' = κ H. dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Derivation, universal coefficient)**: If H is C∞ and satisfies d'Alembert, then `H''(t) = H''(0) * H(t)` everywhere. This is the unnormalized form of `dAlembert_to_ODE_theorem`. -/ theorem dAlembert_to_ODE_general_theorem (H : ℝ → ℝ) (h_smooth : ContDiff ℝ ⊤ H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) : ∀ t, deriv (deriv H) t = deriv (deriv H) 0 * H t := by have hCDiff2 : ContDiff ℝ 2 H := h_smooth.of_le le_top have hDiff : Differentiable ℝ H := hCDiff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have hCDiff1_H' : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at hCDiff2 rw [contDiff_succ_iff_deriv] at hCDiff2 exact hCDiff2.2.2 have hDiffDeriv : Differentiable ℝ (deriv H) := hCDiff1_H'.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) have hsh_add : ∀ (s v : ℝ), HasDerivAt (fun u => s + u) (1 : ℝ) v := fun s v => by have h := (hasDerivAt_id v).add_const s; simp only [id] at h rwa [show (fun u : ℝ => u + s) = fun u => s + u from funext fun u => add_comm u s] at h have hsh_sub : ∀ (s v : ℝ), HasDerivAt (fun u => s - u) (-1 : ℝ) v := fun s v => by have h1 : HasDerivAt (fun u : ℝ => -u) (-1 : ℝ) v := by have := (hasDerivAt_id v).neg; simp only [id] at this; exact this have h2 := h1.const_add s rwa [show (fun u : ℝ => s + -u) = fun u => s - u from funext fun u => by ring] at h2 intro t have h_feq : (fun u => H (t + u) + H (t - u)) = (fun u => 2 * H t * H u) := funext (h_dAlembert t) have key : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = deriv (deriv (fun u => 2 * H t * H u)) 0 := congr_arg (fun f => deriv (deriv f) 0) h_feq have lhs_eq : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = 2 * deriv (deriv H) t := by have h_plus : ∀ v, HasDerivAt (fun u => H (t + u)) (deriv H (t + v)) v := fun v => by have hH := (hDiff (t + v)).hasDerivAt have hcomp := hH.comp v (hsh_add t v) simp only [mul_one, Function.comp_apply] at hcomp; exact hcomp have h_minus : ∀ v, HasDerivAt (fun u => H (t - u)) (-deriv H (t - v)) v := fun v => by have hH := (hDiff (t - v)).hasDerivAt have hcomp := hH.comp v (hsh_sub t v) simp only [mul_neg, mul_one, Function.comp_apply] at hcomp; exact hcomp have hfirst_fun : deriv (fun u => H (t + u) + H (t - u)) = fun v => deriv H (t + v) - deriv H (t - v) := funext fun v => by have heq : (fun u => H (t + u)) + (fun u => H (t - u)) = fun u => H (t + u) + H (t - u) := by ext u; rfl have h12 : deriv (fun u => H (t + u) + H (t - u)) v = deriv H (t + v) + -deriv H (t - v) := by rw [← heq]; exact ((h_plus v).add (h_minus v)).deriv linarith [show deriv H (t + v) + -deriv H (t - v) = deriv H (t + v) - deriv H (t - v) from by ring] have hd2_plus : HasDerivAt (fun v => deriv H (t + v)) (deriv (deriv H) t) 0 := by have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t + 0)) (t + 0) := (hDiffDeriv (t + 0)).hasDerivAt have hcomp := hDH.comp 0 (hsh_add t 0) simp only [mul_one, add_zero, Function.comp_apply] at hcomp; exact hcomp have hd2_minus : HasDerivAt (fun v => deriv H (t - v)) (-deriv (deriv H) t) 0 := by have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t - 0)) (t - 0) := (hDiffDeriv (t - 0)).hasDerivAt have hcomp := hDH.comp 0 (hsh_sub t 0) simp only [mul_neg, mul_one, sub_zero, Function.comp_apply] at hcomp; exact hcomp rw [congr_fun (congr_arg deriv hfirst_fun) 0] have heq2 : (fun v => deriv H (t + v)) - (fun v => deriv H (t - v)) = fun v => deriv H (t + v) - deriv H (t - v) := by ext v; rfl have h : deriv (fun v => deriv H (t + v) - deriv H (t - v)) 0 = deriv (deriv H) t - -deriv (deriv H) t := by rw [← heq2]; exact (hd2_plus.sub hd2_minus).deriv linarith [show deriv (deriv H) t - -deriv (deriv H) t = 2 * deriv (deriv H) t from by ring] have rhs_eq : deriv (deriv (fun u => 2 * H t * H u)) 0 = 2 * H t * deriv (deriv H) 0 := by have hfirst_fun : deriv (fun u => 2 * H t * H u) = fun v => 2 * H t * deriv H v := funext fun v => ((hDiff v).hasDerivAt.const_mul (2 * H t)).deriv have hsecond := (hDiffDeriv 0).hasDerivAt.const_mul (2 * H t) rw [congr_fun (congr_arg deriv hfirst_fun) 0, hsecond.deriv] rw [lhs_eq, rhs_eq] at key linarithThe declaration dAlembert_to_ODE_theorem contributes the bridge from the algebraic d'Alembert equation to the differential equation H'' = H. dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_deriv_zero : deriv H 0 = 0 := by have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt exact even_deriv_at_zero H h_even h_diff exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hypThe d'Alembert equation is H(t+u) + H(t-u) = 2 H(t) H(u) for all real t and u. dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_aczel · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (d'Alembert → cosh, Aczél form)**: Using only the Aczél axiom, a continuous solution to d'Alembert with H(0) = 1 and H''(0) = 1 must equal cosh. This is the clean version of `dAlembert_cosh_solution`, requiring no regularity params. -/ theorem dAlembert_cosh_solution_aczel [AczelSmoothnessPackage] (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_d2_zero : deriv (deriv H) 0 = 1) : ∀ t, H t = Real.cosh t := by have h_smooth : ContDiff ℝ ⊤ H := aczel_dAlembert_smooth H h_one h_cont h_dAlembert have hDiff : Differentiable ℝ H := (h_smooth.of_le le_top : ContDiff ℝ 1 H).differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_H'0 : deriv H 0 = 0 := even_deriv_at_zero H h_even hDiff.differentiableAt have h_ode : ∀ t, deriv (deriv H) t = H t := dAlembert_to_ODE_theorem H h_smooth h_dAlembert h_d2_zero have h_C2 : ContDiff ℝ 2 H := h_smooth.of_le le_top exact ode_cosh_uniqueness_contdiff H h_C2 h_ode h_one h_H'0Its continuous solutions are exactly the hyperbolic cosine functions H(t) = cosh(kt) for a constant k. dAlembert_cosh_solution_aczel · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_ode : ∀ t, deriv (deriv H) t = H t := h_ode_hyp h_one h_cont h_dAlembert h_deriv2_zero have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_deriv_zero : deriv H 0 = 0 := by have h_smooth := h_smooth_hyp h_one h_cont h_dAlembert have h_diff : DifferentiableAt ℝ H 0 := h_smooth.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) |>.differentiableAt exact even_deriv_at_zero H h_even h_diff exact ode_cosh_uniqueness H h_ode h_one h_deriv_zero h_cont_hyp h_diff_hyp h_bootstrap_hypThe continuous solutions of the d'Alembert equation H(t+u) + H(t-u) = 2 H(t) H(u) are exactly the functions H(t) = cosh(kt) for a constant k. dAlembert_cosh_solution · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM logCurvature_eq_deriv2 · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- For a smooth function with `Hf 0 = 1` and vanishing first derivative, the log curvature exists and equals the second derivative at the origin. This is the l'Hôpital step, and it is also what makes the corrected calibration satisfiable rather than empty. -/ theorem logCurvature_eq_deriv2 (Hf : ℝ → ℝ) (hsm : ContDiff ℝ ⊤ Hf) (h1 : Hf 0 = 1) (hd0 : deriv Hf 0 = 0) : HasLogCurvature Hf (deriv (deriv Hf) 0) := by have h2 : ContDiff ℝ 2 Hf := hsm.of_le (by exact_mod_cast le_top) have hderiv_diff : Differentiable ℝ (deriv Hf) := by have h3 := h2 rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h3 rw [contDiff_succ_iff_deriv] at h3 exact h3.2.2.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) have hdiffHf : Differentiable ℝ Hf := h2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have hd2 : HasDerivAt (deriv Hf) (deriv (deriv Hf) 0) 0 := (hderiv_diff 0).hasDerivAt have hslope : Filter.Tendsto (fun t : ℝ => deriv Hf t / t) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (deriv (deriv Hf) 0)) := by have h := hasDerivAt_iff_tendsto_slope.mp hd2 have hsl : ∀ t : ℝ, slope (deriv Hf) 0 t = deriv Hf t / t := by intro t simp [slope_def_field, hd0] exact Filter.Tendsto.congr hsl h have hnum : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1)) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 0) := by have hcont : Filter.Tendsto Hf (nhds (0 : ℝ)) (nhds (Hf 0)) := hdiffHf.continuous.tendsto 0 have hconst : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhds (0 : ℝ)) (nhds 1) := tendsto_const_nhds have hsub : Filter.Tendsto (fun t : ℝ => Hf t - 1) (nhds (0 : ℝ)) (nhds (Hf 0 - 1)) := hcont.sub hconst have hmul : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1)) (nhds (0 : ℝ)) (nhds (2 * (Hf 0 - 1))) := hsub.const_mul (2 : ℝ) rw [h1] at hmul simpa using hmul.mono_left nhdsWithin_le_nhds have hden : Filter.Tendsto (fun t : ℝ => t ^ 2) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 0) := by have h := (continuous_pow 2).tendsto (0 : ℝ) simpa using h.mono_left nhdsWithin_le_nhds have hff' : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), HasDerivAt (fun s : ℝ => 2 * (Hf s - 1)) (2 * deriv Hf t) t := by filter_upwards with t simpa using ((hdiffHf t).hasDerivAt.sub_const 1).const_mul (2 : ℝ) have hgg' : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), HasDerivAt (fun s : ℝ => s ^ 2) (2 * t) t := by filter_upwards with t simpa [mul_comm] using hasDerivAt_pow 2 t have hg'ne : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), (2 : ℝ) * t ≠ 0 := by filter_upwards [self_mem_nhdsWithin] with t ht have htne : t ≠ 0 := ht positivity have hdiv : Filter.Tendsto (fun t : ℝ => (2 * deriv Hf t) / (2 * t)) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (deriv (deriv Hf) 0)) := by refine Filter.Tendsto.congr' ?_ hslope filter_upwards [self_mem_nhdsWithin] with t ht have htne : t ≠ 0 := ht field_simp exact HasDerivAt.lhopital_zero_nhdsNE hff' hgg' hg'ne hnum hden hdivThe calibration condition HasLogCurvature H 1 forces the second derivative at zero to equal 1. logCurvature_eq_deriv2 · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_aczel · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (d'Alembert → cosh, Aczél form)**: Using only the Aczél axiom, a continuous solution to d'Alembert with H(0) = 1 and H''(0) = 1 must equal cosh. This is the clean version of `dAlembert_cosh_solution`, requiring no regularity params. -/ theorem dAlembert_cosh_solution_aczel [AczelSmoothnessPackage] (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_d2_zero : deriv (deriv H) 0 = 1) : ∀ t, H t = Real.cosh t := by have h_smooth : ContDiff ℝ ⊤ H := aczel_dAlembert_smooth H h_one h_cont h_dAlembert have hDiff : Differentiable ℝ H := (h_smooth.of_le le_top : ContDiff ℝ 1 H).differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_H'0 : deriv H 0 = 0 := even_deriv_at_zero H h_even hDiff.differentiableAt have h_ode : ∀ t, deriv (deriv H) t = H t := dAlembert_to_ODE_theorem H h_smooth h_dAlembert h_d2_zero have h_C2 : ContDiff ℝ 2 H := h_smooth.of_le le_top exact ode_cosh_uniqueness_contdiff H h_C2 h_ode h_one h_H'0With H(0) = 1, continuity, the d'Alembert equation, and the condition deriv (deriv H) 0 = 1, the function H must equal cosh(t). dAlembert_cosh_solution_aczel · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The full cost uniqueness theorem states that any cost function satisfying reciprocal symmetry, normalization, the composition law, calibration, and continuity must equal J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM logCurvature_forces_normalized · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The composition law together with unit log curvature force normalization. The composition law at `y = 1` gives `F 1 * (F x + 1) = 0`, so either `F 1 = 0` or `F` is constantly `-1`; the constant has `H ≡ 0`, whose curvature quotient is negative throughout a punctured neighbourhood and so cannot tend to `1`. -/ theorem logCurvature_forces_normalized (F : ℝ → ℝ) (hComp : SatisfiesCompositionLaw F) (hκ : HasLogCurvature (H F) 1) : IsNormalized F := by by_contra hne have hconst : ∀ x : ℝ, 0 < x → F x = -1 := by intro x hx have h := hComp x 1 hx one_pos rw [mul_one, div_one] at h have hquad : F 1 * (F x + 1) = 0 := by nlinarith rcases mul_eq_zero.mp hquad with h1 | h2 · exact absurd h1 hne · linarith have hH : ∀ t : ℝ, H F t = 0 := by intro t have hx := hconst (Real.exp t) (Real.exp_pos t) simp [H, G, hx] have hgt : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), (1 / 2 : ℝ) < 2 * (H F t - 1) / t ^ 2 := hκ.eventually (eventually_gt_nhds (by norm_num)) have hne0 : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), t ≠ 0 := by filter_upwards [self_mem_nhdsWithin] with t ht using ht obtain ⟨t, hgt', ht0⟩ := (hgt.and hne0).exists have ht2 : 0 < t ^ 2 := by positivity have hneg : 2 * (H F t - 1) / t ^ 2 < 0 := by rw [hH t] exact div_neg_of_neg_of_pos (by norm_num) ht2 linarithThe declaration logCurvature_forces_normalized proves that normalization follows from the composition law together with log curvature equal to 1. logCurvature_forces_normalized · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The main theorem law_of_logic_forces_jcost still lists all five conditions as hypotheses. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The theorem law_of_logic_forces_jcost takes IsNormalized as one of its five explicit hypotheses and concludes that the function equals J(x) = (x + 1/x)/2 - 1. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM logCurvature_forces_normalized · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The composition law together with unit log curvature force normalization. The composition law at `y = 1` gives `F 1 * (F x + 1) = 0`, so either `F 1 = 0` or `F` is constantly `-1`; the constant has `H ≡ 0`, whose curvature quotient is negative throughout a punctured neighbourhood and so cannot tend to `1`. -/ theorem logCurvature_forces_normalized (F : ℝ → ℝ) (hComp : SatisfiesCompositionLaw F) (hκ : HasLogCurvature (H F) 1) : IsNormalized F := by by_contra hne have hconst : ∀ x : ℝ, 0 < x → F x = -1 := by intro x hx have h := hComp x 1 hx one_pos rw [mul_one, div_one] at h have hquad : F 1 * (F x + 1) = 0 := by nlinarith rcases mul_eq_zero.mp hquad with h1 | h2 · exact absurd h1 hne · linarith have hH : ∀ t : ℝ, H F t = 0 := by intro t have hx := hconst (Real.exp t) (Real.exp_pos t) simp [H, G, hx] have hgt : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), (1 / 2 : ℝ) < 2 * (H F t - 1) / t ^ 2 := hκ.eventually (eventually_gt_nhds (by norm_num)) have hne0 : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), t ≠ 0 := by filter_upwards [self_mem_nhdsWithin] with t ht using ht obtain ⟨t, hgt', ht0⟩ := (hgt.and hne0).exists have ht2 : 0 < t ^ 2 := by positivity have hneg : 2 * (H F t - 1) / t ^ 2 < 0 := by rw [hH t] exact div_neg_of_neg_of_pos (by norm_num) ht2 linarithThe theorem logCurvature_forces_normalized proves that if a function satisfies the composition law and has log-curvature 1, then it is automatically normalized. logCurvature_forces_normalized · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_aczel · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (d'Alembert → cosh, Aczél form)**: Using only the Aczél axiom, a continuous solution to d'Alembert with H(0) = 1 and H''(0) = 1 must equal cosh. This is the clean version of `dAlembert_cosh_solution`, requiring no regularity params. -/ theorem dAlembert_cosh_solution_aczel [AczelSmoothnessPackage] (H : ℝ → ℝ) (h_one : H 0 = 1) (h_cont : Continuous H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) (h_d2_zero : deriv (deriv H) 0 = 1) : ∀ t, H t = Real.cosh t := by have h_smooth : ContDiff ℝ ⊤ H := aczel_dAlembert_smooth H h_one h_cont h_dAlembert have hDiff : Differentiable ℝ H := (h_smooth.of_le le_top : ContDiff ℝ 1 H).differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) have h_even : Function.Even H := dAlembert_even H h_one h_dAlembert have h_H'0 : deriv H 0 = 0 := even_deriv_at_zero H h_even hDiff.differentiableAt have h_ode : ∀ t, deriv (deriv H) t = H t := dAlembert_to_ODE_theorem H h_smooth h_dAlembert h_d2_zero have h_C2 : ContDiff ℝ 2 H := h_smooth.of_le le_top exact ode_cosh_uniqueness_contdiff H h_C2 h_ode h_one h_H'0The continuous solutions of the d'Alembert equation are exactly the hyperbolic cosine functions H(t) = cosh(kt) for a constant k. dAlembert_cosh_solution_aczel · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_diff_square · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_diff_square (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) : ∀ t u, (H (t+u) - H (t-u))^2 = 4 * ((H t)^2 - 1) * ((H u)^2 - 1) := by intro t u have h_sum : H (t+u) + H (t-u) = 2 * H t * H u := h_dAlembert t u have h_prod : H (t+u) * H (t-u) = (H t)^2 + (H u)^2 - 1 := dAlembert_product H h_one h_dAlembert t u calc (H (t+u) - H (t-u))^2 = (H (t+u) + H (t-u))^2 - 4 * (H (t+u) * H (t-u)) := by ring _ = (2 * H t * H u)^2 - 4 * ((H t)^2 + (H u)^2 - 1) := by simp [h_sum, h_prod] _ = 4 * ((H t)^2 - 1) * ((H u)^2 - 1) := by ringThe lemma dAlembert_diff_square states that if a function H satisfies the d'Alembert equation, H(t+u) + H(t-u) = 2 * H t * H u, then the square of the difference between H at t+u and H at t-u factors into a product of terms that depend separately on t and on u. dAlembert_diff_square · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThis identity is what separates the variables, letting the proof convert the functional equation into a differential equation for H, which then has a unique smooth solution: the hyperbolic cosine. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_product · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma dAlembert_product (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) : ∀ t u, H (t+u) * H (t-u) = (H t)^2 + (H u)^2 - 1 := by intro t u have h := h_dAlembert (t + u) (t - u) have h' : H (2 * t) + H (2 * u) = 2 * H (t + u) * H (t - u) := by -- (t+u)+(t-u)=2t and (t+u)-(t-u)=2u simpa [two_mul, sub_eq_add_neg, add_assoc, add_left_comm, add_comm] using h have h2t : H (2 * t) = 2 * (H t)^2 - 1 := dAlembert_double H h_one h_dAlembert t have h2u : H (2 * u) = 2 * (H u)^2 - 1 := dAlembert_double H h_one h_dAlembert u have h'' : 2 * H (t + u) * H (t - u) = (2 * (H t)^2 - 1) + (2 * (H u)^2 - 1) := by calc 2 * H (t + u) * H (t - u) = H (2 * t) + H (2 * u) := by linarith [h'] _ = (2 * (H t)^2 - 1) + (2 * (H u)^2 - 1) := by simp [h2t, h2u] linarithThe d'Alembert product law states that for any two numbers t and u, the product cosh(t+u) * cosh(t-u) equals cosh(t)^2 + cosh(u)^2 - 1. dAlembert_product · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G. Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y) becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t) via the substitution x = e^s, y = e^t. -/ theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) : SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by constructor · intro hComp t u have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos -- exp(t) * exp(u) = exp(t + u) have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm -- exp(t) / exp(u) = exp(t - u) have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg] simp only [G, h1, h2] at h ⊢ linarith · intro hCosh x y hx hy let t := Real.log x let u := Real.log y have hx_eq : x = Real.exp t := (Real.exp_log hx).symm have hy_eq : y = Real.exp u := (Real.exp_log hy).symm have h := hCosh t u simp only [G] at h rw [hx_eq, hy_eq] rw [← Real.exp_add, ← Real.exp_sub] -- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u)) -- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u) calc F (Real.exp (t + u)) + F (Real.exp (t - u)) = 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h _ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ringIn log coordinates, the cost's composition law becomes exactly the d'Alembert addition formula: G(t+u) + G(t-u) = 2 * G(t) * G(u) + 2 * G(t) + 2 * G(u). composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Derivation, universal coefficient)**: If H is C∞ and satisfies d'Alembert, then `H''(t) = H''(0) * H(t)` everywhere. This is the unnormalized form of `dAlembert_to_ODE_theorem`. -/ theorem dAlembert_to_ODE_general_theorem (H : ℝ → ℝ) (h_smooth : ContDiff ℝ ⊤ H) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) : ∀ t, deriv (deriv H) t = deriv (deriv H) 0 * H t := by have hCDiff2 : ContDiff ℝ 2 H := h_smooth.of_le le_top have hDiff : Differentiable ℝ H := hCDiff2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have hCDiff1_H' : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at hCDiff2 rw [contDiff_succ_iff_deriv] at hCDiff2 exact hCDiff2.2.2 have hDiffDeriv : Differentiable ℝ (deriv H) := hCDiff1_H'.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) have hsh_add : ∀ (s v : ℝ), HasDerivAt (fun u => s + u) (1 : ℝ) v := fun s v => by have h := (hasDerivAt_id v).add_const s; simp only [id] at h rwa [show (fun u : ℝ => u + s) = fun u => s + u from funext fun u => add_comm u s] at h have hsh_sub : ∀ (s v : ℝ), HasDerivAt (fun u => s - u) (-1 : ℝ) v := fun s v => by have h1 : HasDerivAt (fun u : ℝ => -u) (-1 : ℝ) v := by have := (hasDerivAt_id v).neg; simp only [id] at this; exact this have h2 := h1.const_add s rwa [show (fun u : ℝ => s + -u) = fun u => s - u from funext fun u => by ring] at h2 intro t have h_feq : (fun u => H (t + u) + H (t - u)) = (fun u => 2 * H t * H u) := funext (h_dAlembert t) have key : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = deriv (deriv (fun u => 2 * H t * H u)) 0 := congr_arg (fun f => deriv (deriv f) 0) h_feq have lhs_eq : deriv (deriv (fun u => H (t + u) + H (t - u))) 0 = 2 * deriv (deriv H) t := by have h_plus : ∀ v, HasDerivAt (fun u => H (t + u)) (deriv H (t + v)) v := fun v => by have hH := (hDiff (t + v)).hasDerivAt have hcomp := hH.comp v (hsh_add t v) simp only [mul_one, Function.comp_apply] at hcomp; exact hcomp have h_minus : ∀ v, HasDerivAt (fun u => H (t - u)) (-deriv H (t - v)) v := fun v => by have hH := (hDiff (t - v)).hasDerivAt have hcomp := hH.comp v (hsh_sub t v) simp only [mul_neg, mul_one, Function.comp_apply] at hcomp; exact hcomp have hfirst_fun : deriv (fun u => H (t + u) + H (t - u)) = fun v => deriv H (t + v) - deriv H (t - v) := funext fun v => by have heq : (fun u => H (t + u)) + (fun u => H (t - u)) = fun u => H (t + u) + H (t - u) := by ext u; rfl have h12 : deriv (fun u => H (t + u) + H (t - u)) v = deriv H (t + v) + -deriv H (t - v) := by rw [← heq]; exact ((h_plus v).add (h_minus v)).deriv linarith [show deriv H (t + v) + -deriv H (t - v) = deriv H (t + v) - deriv H (t - v) from by ring] have hd2_plus : HasDerivAt (fun v => deriv H (t + v)) (deriv (deriv H) t) 0 := by have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t + 0)) (t + 0) := (hDiffDeriv (t + 0)).hasDerivAt have hcomp := hDH.comp 0 (hsh_add t 0) simp only [mul_one, add_zero, Function.comp_apply] at hcomp; exact hcomp have hd2_minus : HasDerivAt (fun v => deriv H (t - v)) (-deriv (deriv H) t) 0 := by have hDH : HasDerivAt (deriv H) (deriv (deriv H) (t - 0)) (t - 0) := (hDiffDeriv (t - 0)).hasDerivAt have hcomp := hDH.comp 0 (hsh_sub t 0) simp only [mul_neg, mul_one, sub_zero, Function.comp_apply] at hcomp; exact hcomp rw [congr_fun (congr_arg deriv hfirst_fun) 0] have heq2 : (fun v => deriv H (t + v)) - (fun v => deriv H (t - v)) = fun v => deriv H (t + v) - deriv H (t - v) := by ext v; rfl have h : deriv (fun v => deriv H (t + v) - deriv H (t - v)) 0 = deriv (deriv H) t - -deriv (deriv H) t := by rw [← heq2]; exact (hd2_plus.sub hd2_minus).deriv linarith [show deriv (deriv H) t - -deriv (deriv H) t = 2 * deriv (deriv H) t from by ring] have rhs_eq : deriv (deriv (fun u => 2 * H t * H u)) 0 = 2 * H t * deriv (deriv H) 0 := by have hfirst_fun : deriv (fun u => 2 * H t * H u) = fun v => 2 * H t * deriv H v := funext fun v => ((hDiff v).hasDerivAt.const_mul (2 * H t)).deriv have hsecond := (hDiffDeriv 0).hasDerivAt.const_mul (2 * H t) rw [congr_fun (congr_arg deriv hfirst_fun) 0, hsecond.deriv] rw [lhs_eq, rhs_eq] at key linarithFrom the product law one can derive that the second derivative of G at any point equals G itself. dAlembert_to_ODE_general_theorem · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem (ODE Cosh Uniqueness)**: The unique solution to H'' = H with H(0) = 1, H'(0) = 0 is cosh. -/ theorem ode_cosh_uniqueness_contdiff (H : ℝ → ℝ) (h_diff : ContDiff ℝ 2 H) (h_ode : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) : ∀ t, H t = Real.cosh t := by let g := fun t => H t - Real.cosh t have hg_diff : ContDiff ℝ 2 g := h_diff.sub Real.contDiff_cosh have hg_ode : ∀ t, deriv (deriv g) t = g t := by intro t have h1 : deriv g = fun s => deriv H s - deriv Real.cosh s := by ext s; apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt have h2 : deriv (deriv g) t = deriv (deriv H) t - deriv (deriv Real.cosh) t := by have hH_diff1 : ContDiff ℝ 1 (deriv H) := by rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h_diff rw [contDiff_succ_iff_deriv] at h_diff exact h_diff.2.2 have hcosh_diff1 : ContDiff ℝ 1 (deriv Real.cosh) := by rw [Real.deriv_cosh]; exact Real.contDiff_sinh rw [h1]; apply deriv_sub · exact hH_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt · exact hcosh_diff1.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) |>.differentiableAt rw [h2, h_ode t, cosh_second_deriv_eq t] have hg0 : g 0 = 0 := by simp [g, h_H0, Real.cosh_zero] have hg'0 : deriv g 0 = 0 := by have h1 : deriv g 0 = deriv H 0 - deriv Real.cosh 0 := by apply deriv_sub · exact (h_diff.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0)).differentiableAt · exact Real.differentiable_cosh.differentiableAt rw [h1, h_H'0, Real.deriv_cosh, Real.sinh_zero]; ring have hg_zero := ode_zero_uniqueness g hg_diff hg_ode hg0 hg'0 intro t have := hg_zero t simp only [g] at this; linarithThat is the differential equation whose unique smooth solution, with the right starting values, is the hyperbolic cosine. ode_cosh_uniqueness_contdiff · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The main theorem, law_of_logic_forces_jcost, assumes the cost function is continuous on the positive real line and, through a package called AczelSmoothnessPackage, implicitly relies on a classical result: that a continuous solution of the d'Alembert equation is automatically smooth. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost_with_regularization · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem 1.1 (Main Result, Reformulated)**: Let F : ℝ₊ → ℝ satisfy: 1. Reciprocity: F(x) = F(1/x) 2. Normalization: F(1) = 0 3. Composition Law: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y) 4. Calibration: lim_{t→0} 2F(e^t)/t² = 1 5. Continuity and regularity hypotheses Then F = J on ℝ₊, where J(x) = (x + 1/x)/2 - 1. This theorem corresponds to Theorem 1.1 in: J. Washburn & M. Zlatanović, "Uniqueness of the Canonical Reciprocal Cost" -/ theorem law_of_logic_forces_jcost_with_regularization (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) -- Regularity hypotheses (from Aczél theory) (h_smooth : dAlembert_continuous_implies_smooth_hypothesis (H F)) (h_ode : dAlembert_to_ODE_hypothesis (H F)) (h_cont : ode_regularity_continuous_hypothesis (H F)) (h_diff : ode_regularity_differentiable_hypothesis (H F)) (h_boot : ode_linear_regularity_bootstrap_hypothesis (H F)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by -- The proof follows the structure of T5_uniqueness_complete: -- 1. Convert composition law to CoshAddIdentity on G -- 2. Shift to H = G + 1 to get standard d'Alembert equation -- 3. Apply Aczél's theorem: continuous d'Alembert solutions are cosh -- 4. Calibration H''(0) = 1 selects cosh (not cos or constant) -- 5. Unshift: G = cosh - 1, hence F = J intro x hx -- Convert hypotheses to the required format have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp -- Step 1: Set up G and H let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F -- Step 2: Derive key properties of G and H have h_G_even : Function.Even Gf := G_even_of_reciprocal_symmetry F hSymm have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] -- Goal is F 1 + 1 = 1, and hNorm says F 1 = 0 rw [hNorm] ring -- Step 3: G is continuous (F continuous on (0,∞), exp continuous) have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const -- Step 4: Convert CoshAddIdentity to d'Alembert equation for H have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal -- Step 5: Second derivative condition have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t change deriv (fun y => Gf y + 1) t = deriv Gf t simpa using (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 -- Step 6: Apply d'Alembert uniqueness theorem have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution Hf h_H0 h_H_cont h_dAlembert h_H_d2 h_smooth h_ode h_cont h_diff h_boot -- Step 7: Unshift to get G = cosh - 1 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := by intro t have hH := h_H_cosh t have hH' : Gf t + 1 = Real.cosh t := by simpa [Hf, H, Gf] using hH linarith -- Step 8: Convert back via log parametrization have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simpa using hJG.symm _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simpa [ht]The regularization variant keeps the same five conditions, but instead of the package it lists five named regularity hypotheses. law_of_logic_forces_jcost_with_regularization · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM logCurvature_eq_deriv2 · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- For a smooth function with `Hf 0 = 1` and vanishing first derivative, the log curvature exists and equals the second derivative at the origin. This is the l'Hôpital step, and it is also what makes the corrected calibration satisfiable rather than empty. -/ theorem logCurvature_eq_deriv2 (Hf : ℝ → ℝ) (hsm : ContDiff ℝ ⊤ Hf) (h1 : Hf 0 = 1) (hd0 : deriv Hf 0 = 0) : HasLogCurvature Hf (deriv (deriv Hf) 0) := by have h2 : ContDiff ℝ 2 Hf := hsm.of_le (by exact_mod_cast le_top) have hderiv_diff : Differentiable ℝ (deriv Hf) := by have h3 := h2 rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h3 rw [contDiff_succ_iff_deriv] at h3 exact h3.2.2.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) have hdiffHf : Differentiable ℝ Hf := h2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have hd2 : HasDerivAt (deriv Hf) (deriv (deriv Hf) 0) 0 := (hderiv_diff 0).hasDerivAt have hslope : Filter.Tendsto (fun t : ℝ => deriv Hf t / t) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (deriv (deriv Hf) 0)) := by have h := hasDerivAt_iff_tendsto_slope.mp hd2 have hsl : ∀ t : ℝ, slope (deriv Hf) 0 t = deriv Hf t / t := by intro t simp [slope_def_field, hd0] exact Filter.Tendsto.congr hsl h have hnum : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1)) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 0) := by have hcont : Filter.Tendsto Hf (nhds (0 : ℝ)) (nhds (Hf 0)) := hdiffHf.continuous.tendsto 0 have hconst : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhds (0 : ℝ)) (nhds 1) := tendsto_const_nhds have hsub : Filter.Tendsto (fun t : ℝ => Hf t - 1) (nhds (0 : ℝ)) (nhds (Hf 0 - 1)) := hcont.sub hconst have hmul : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1)) (nhds (0 : ℝ)) (nhds (2 * (Hf 0 - 1))) := hsub.const_mul (2 : ℝ) rw [h1] at hmul simpa using hmul.mono_left nhdsWithin_le_nhds have hden : Filter.Tendsto (fun t : ℝ => t ^ 2) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 0) := by have h := (continuous_pow 2).tendsto (0 : ℝ) simpa using h.mono_left nhdsWithin_le_nhds have hff' : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), HasDerivAt (fun s : ℝ => 2 * (Hf s - 1)) (2 * deriv Hf t) t := by filter_upwards with t simpa using ((hdiffHf t).hasDerivAt.sub_const 1).const_mul (2 : ℝ) have hgg' : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), HasDerivAt (fun s : ℝ => s ^ 2) (2 * t) t := by filter_upwards with t simpa [mul_comm] using hasDerivAt_pow 2 t have hg'ne : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), (2 : ℝ) * t ≠ 0 := by filter_upwards [self_mem_nhdsWithin] with t ht have htne : t ≠ 0 := ht positivity have hdiv : Filter.Tendsto (fun t : ℝ => (2 * deriv Hf t) / (2 * t)) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (deriv (deriv Hf) 0)) := by refine Filter.Tendsto.congr' ?_ hslope filter_upwards [self_mem_nhdsWithin] with t ht have htne : t ≠ 0 := ht field_simp exact HasDerivAt.lhopital_zero_nhdsNE hff' hgg' hg'ne hnum hden hdivThe declaration logCurvature_eq_deriv2 states that for a smooth function H with H(0) = 1 and derivative zero at zero, the logarithmic curvature equals the second derivative at zero. logCurvature_eq_deriv2 · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The theorem law_of_logic_forces_jcost proves the uniqueness result directly from the five conditions. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G. Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y) becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t) via the substitution x = e^s, y = e^t. -/ theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) : SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by constructor · intro hComp t u have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos -- exp(t) * exp(u) = exp(t + u) have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm -- exp(t) / exp(u) = exp(t - u) have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg] simp only [G, h1, h2] at h ⊢ linarith · intro hCosh x y hx hy let t := Real.log x let u := Real.log y have hx_eq : x = Real.exp t := (Real.exp_log hx).symm have hy_eq : y = Real.exp u := (Real.exp_log hy).symm have h := hCosh t u simp only [G] at h rw [hx_eq, hy_eq] rw [← Real.exp_add, ← Real.exp_sub] -- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u)) -- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u) calc F (Real.exp (t + u)) + F (Real.exp (t - u)) = 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h _ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ringThe theorem composition_law_equiv_coshAdd proves that SatisfiesCompositionLaw is equivalent to CoshAddIdentity. composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM CoshAddIdentity_implies_DirectCoshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
lemma CoshAddIdentity_implies_DirectCoshAdd (F : ℝ → ℝ) (h : CoshAddIdentity F) : DirectCoshAdd (G F) := hThe lemma CoshAddIdentity_implies_DirectCoshAdd shows that CoshAddIdentity implies DirectCoshAdd. CoshAddIdentity_implies_DirectCoshAdd · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem dAlembert_cosh_solution_of_log_curvature (H : ℝ → ℝ) (h_one : H 0 = 1) (h_dAlembert : ∀ t u, H (t+u) + H (t-u) = 2 * H t * H u) {κ : ℝ} (h_calib : HasLogCurvature H κ) (h_deriv2_zero : deriv (deriv H) 0 = 1) (h_smooth_hyp : dAlembert_continuous_implies_smooth_hypothesis H) (h_ode_hyp : dAlembert_to_ODE_hypothesis H) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := dAlembert_continuous_of_log_curvature H h_one h_dAlembert h_calib exact dAlembert_cosh_solution H h_one h_cont h_dAlembert h_deriv2_zero h_smooth_hyp h_ode_hyp h_cont_hyp h_diff_hyp h_bootstrap_hypThe theorem dAlembert_cosh_solution_of_log_curvature shows that a function satisfying the d'Alembert equation and the log curvature condition must be the hyperbolic cosine. dAlembert_cosh_solution_of_log_curvature · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem ode_cosh_uniqueness (H : ℝ → ℝ) (h_ODE : ∀ t, deriv (deriv H) t = H t) (h_H0 : H 0 = 1) (h_H'0 : deriv H 0 = 0) (h_cont_hyp : ode_regularity_continuous_hypothesis H) (h_diff_hyp : ode_regularity_differentiable_hypothesis H) (h_bootstrap_hyp : ode_linear_regularity_bootstrap_hypothesis H) : ∀ t, H t = Real.cosh t := by have h_cont : Continuous H := h_cont_hyp h_ODE have h_diff : Differentiable ℝ H := h_diff_hyp h_ODE h_cont have h_C2 : ContDiff ℝ 2 H := h_bootstrap_hyp h_ODE h_cont h_diff exact ode_cosh_uniqueness_contdiff H h_C2 h_ODE h_H0 h_H'0The theorem ode_cosh_uniqueness proves that the differential equation with the right initial conditions has the unique solution H(t) = cosh(t). ode_cosh_uniqueness · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **The cost theorem on two premises.** The composition law and unit log curvature force `F = J` on the positives. Normalization, nonnegativity, and continuity are all conclusions rather than hypotheses; compare `law_of_logic_forces_jcost`, which assumes all of them. -/ theorem composition_logCurvature_forces_jcost [AczelSmoothnessPackage] (F : ℝ → ℝ) (hComp : SatisfiesCompositionLaw F) (hκ : HasLogCurvature (H F) 1) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by have hNorm : IsNormalized F := logCurvature_forces_normalized F hComp hκ have hN : F 1 = 0 := hNorm have hH0 : H F 0 = 1 := by simp [H, G, hN] have hCosh : CoshAddIdentity F := (composition_law_equiv_coshAdd F).mp hComp have hdA : ∀ t u, H F (t + u) + H F (t - u) = 2 * H F t * H F u := by intro t u have hG := hCosh t u have hgoal : (G F (t + u) + 1) + (G F (t - u) + 1) = 2 * (G F t + 1) * (G F u + 1) := by calc (G F (t + u) + 1) + (G F (t - u) + 1) = (G F (t + u) + G F (t - u)) + 2 := by ring _ = (2 * (G F t * G F u) + 2 * (G F t + G F u)) + 2 := by simpa [hG] _ = 2 * (G F t + 1) * (G F u + 1) := by ring simpa [H] using hgoal have hcont : Continuous (H F) := dAlembert_continuous_of_log_curvature (H F) hH0 hdA hκ have hsm : ContDiff ℝ ⊤ (H F) := aczel_dAlembert_smooth (H F) hH0 hcont hdA have heven : Function.Even (H F) := dAlembert_even (H F) hH0 hdA have hd0 : deriv (H F) 0 = 0 := even_deriv_at_zero (H F) heven (hsm.differentiable (by decide : (⊤ : WithTop ℕ∞) ≠ 0) 0) have hd2 : deriv (deriv (H F)) 0 = 1 := deriv2_of_logCurvature (H F) hsm hH0 hd0 hκ have hcosh : ∀ t, H F t = Real.cosh t := dAlembert_cosh_solution_aczel (H F) hH0 hcont hdA hd2 intro x hx have hGc : G F (Real.log x) = Real.cosh (Real.log x) - 1 := by have h := hcosh (Real.log x) simp only [H] at h linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = G F (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := hGc _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The theorem composition_logCurvature_forces_jcost combines these to show that the cost function must be J(x). composition_logCurvature_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The theorem law_of_logic_forces_jcost, which states the full uniqueness result, relies on the composition law and the other conditions. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM rclCombiner_satisfies_gate · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- The canonical RCL polynomial satisfies the full factorization gate. -/ theorem rclCombiner_satisfies_gate : FactorizationAssociativityGate rclCombiner where symmetric := by intro u v unfold rclCombiner ring rightAffine := by intro u refine ⟨2 * u + 2, 2 * u, ?_⟩ intro v unfold rclCombiner ring zeroBoundary := by intro u unfold rclCombiner ring unitDiagonal := by unfold rclCombiner norm_numThe declaration rclCombiner_satisfies_gate proves that the canonical RCL combiner meets the factorization and associativity gate. rclCombiner_satisfies_gate · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.lean
/-- Canonical normalization selects the RCL member of the bilinear family. -/ theorem gate_forces_rcl (P : ℝ → ℝ → ℝ) (hGate : FactorizationAssociativityGate P) : ∀ u v, P u v = 2 * u * v + 2 * u + 2 * v := by obtain ⟨c, hc⟩ := gate_forces_bilinear_family P hGate have hc_two : c = 2 := by have h11 : P 1 1 = c * 1 * 1 + 2 * 1 + 2 * 1 := by simpa using hc 1 1 linarith [hGate.unitDiagonal, h11] intro u v calc P u v = c * u * v + 2 * u + 2 * v := hc u v _ = 2 * u * v + 2 * u + 2 * v := by rw [hc_two]Any function satisfying the gate must equal the RCL combiner. gate_forces_rcl · IndisputableMonolith/Foundation/DAlembert/FactorizationForcing.leanTHEOREM logCurvature_eq_deriv2 · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- For a smooth function with `Hf 0 = 1` and vanishing first derivative, the log curvature exists and equals the second derivative at the origin. This is the l'Hôpital step, and it is also what makes the corrected calibration satisfiable rather than empty. -/ theorem logCurvature_eq_deriv2 (Hf : ℝ → ℝ) (hsm : ContDiff ℝ ⊤ Hf) (h1 : Hf 0 = 1) (hd0 : deriv Hf 0 = 0) : HasLogCurvature Hf (deriv (deriv Hf) 0) := by have h2 : ContDiff ℝ 2 Hf := hsm.of_le (by exact_mod_cast le_top) have hderiv_diff : Differentiable ℝ (deriv Hf) := by have h3 := h2 rw [show (2 : WithTop ℕ∞) = 1 + 1 from rfl] at h3 rw [contDiff_succ_iff_deriv] at h3 exact h3.2.2.differentiable (by decide : (1 : WithTop ℕ∞) ≠ 0) have hdiffHf : Differentiable ℝ Hf := h2.differentiable (by decide : (2 : WithTop ℕ∞) ≠ 0) have hd2 : HasDerivAt (deriv Hf) (deriv (deriv Hf) 0) 0 := (hderiv_diff 0).hasDerivAt have hslope : Filter.Tendsto (fun t : ℝ => deriv Hf t / t) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (deriv (deriv Hf) 0)) := by have h := hasDerivAt_iff_tendsto_slope.mp hd2 have hsl : ∀ t : ℝ, slope (deriv Hf) 0 t = deriv Hf t / t := by intro t simp [slope_def_field, hd0] exact Filter.Tendsto.congr hsl h have hnum : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1)) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 0) := by have hcont : Filter.Tendsto Hf (nhds (0 : ℝ)) (nhds (Hf 0)) := hdiffHf.continuous.tendsto 0 have hconst : Filter.Tendsto (fun _ : ℝ => (1 : ℝ)) (nhds (0 : ℝ)) (nhds 1) := tendsto_const_nhds have hsub : Filter.Tendsto (fun t : ℝ => Hf t - 1) (nhds (0 : ℝ)) (nhds (Hf 0 - 1)) := hcont.sub hconst have hmul : Filter.Tendsto (fun t : ℝ => 2 * (Hf t - 1)) (nhds (0 : ℝ)) (nhds (2 * (Hf 0 - 1))) := hsub.const_mul (2 : ℝ) rw [h1] at hmul simpa using hmul.mono_left nhdsWithin_le_nhds have hden : Filter.Tendsto (fun t : ℝ => t ^ 2) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds 0) := by have h := (continuous_pow 2).tendsto (0 : ℝ) simpa using h.mono_left nhdsWithin_le_nhds have hff' : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), HasDerivAt (fun s : ℝ => 2 * (Hf s - 1)) (2 * deriv Hf t) t := by filter_upwards with t simpa using ((hdiffHf t).hasDerivAt.sub_const 1).const_mul (2 : ℝ) have hgg' : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), HasDerivAt (fun s : ℝ => s ^ 2) (2 * t) t := by filter_upwards with t simpa [mul_comm] using hasDerivAt_pow 2 t have hg'ne : ∀ᶠ t in nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ), (2 : ℝ) * t ≠ 0 := by filter_upwards [self_mem_nhdsWithin] with t ht have htne : t ≠ 0 := ht positivity have hdiv : Filter.Tendsto (fun t : ℝ => (2 * deriv Hf t) / (2 * t)) (nhdsWithin (0 : ℝ) ({(0 : ℝ)}ᶜ)) (nhds (deriv (deriv Hf) 0)) := by refine Filter.Tendsto.congr' ?_ hslope filter_upwards [self_mem_nhdsWithin] with t ht have htne : t ≠ 0 := ht field_simp exact HasDerivAt.lhopital_zero_nhdsNE hff' hgg' hg'ne hnum hden hdivThe lemma deriv_pos_self_zero says that if a function's second derivative exists and is positive at zero, and the function itself is zero there with zero first derivative, then the function must be positive in a small neighborhood around zero. logCurvature_eq_deriv2 · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.lean
theorem Jcost_cosh_add_identity : CoshAddIdentity Cost.Jcost := by intro t u simp only [G, Jcost] -- Use exp(t+u) = exp(t)*exp(u) and exp(t-u) = exp(t)/exp(u) have he1 : Real.exp (t + u) = Real.exp t * Real.exp u := Real.exp_add t u have he2 : Real.exp (t - u) = Real.exp t / Real.exp u := by rw [sub_eq_add_neg, Real.exp_add, Real.exp_neg] ring have hpos_t : Real.exp t > 0 := Real.exp_pos t have hpos_u : Real.exp u > 0 := Real.exp_pos u have hne_t : Real.exp t ≠ 0 := hpos_t.ne' have hne_u : Real.exp u ≠ 0 := hpos_u.ne' rw [he1, he2] field_simp ringThe declaration Jcost_cosh_add_identity verifies that the proposed solution J itself satisfies the same composition law that the proof used to derive it. Jcost_cosh_add_identity · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM CoshAddIdentity · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- The cosh-type functional identity for `G_F`. -/ def CoshAddIdentity (F : ℝ → ℝ) : Prop := ∀ t u : ℝ, G F (t+u) + G F (t-u) = 2 * (G F t * G F u) + 2 * (G F t + G F u)The identity states that J obeys the CoshAddIdentity, the log-coordinate form of the composition law: G(t+u) + G(t-u) = 2(G(t)G(u) + G(t) + G(u)), where G(t) = J(e^t). CoshAddIdentity · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Key Identity**: The composition law on F is equivalent to CoshAddIdentity on G. Specifically: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y) becomes: G(s+t) + G(s-t) = 2G(s)G(t) + 2G(s) + 2G(t) via the substitution x = e^s, y = e^t. -/ theorem composition_law_equiv_coshAdd (F : ℝ → ℝ) : SatisfiesCompositionLaw F ↔ CoshAddIdentity F := by constructor · intro hComp t u have hexp_t_pos : 0 < Real.exp t := Real.exp_pos t have hexp_u_pos : 0 < Real.exp u := Real.exp_pos u have h := hComp (Real.exp t) (Real.exp u) hexp_t_pos hexp_u_pos -- exp(t) * exp(u) = exp(t + u) have h1 : Real.exp t * Real.exp u = Real.exp (t + u) := (Real.exp_add t u).symm -- exp(t) / exp(u) = exp(t - u) have h2 : Real.exp t / Real.exp u = Real.exp (t - u) := by rw [div_eq_mul_inv, ← Real.exp_neg u, ← Real.exp_add, sub_eq_add_neg] simp only [G, h1, h2] at h ⊢ linarith · intro hCosh x y hx hy let t := Real.log x let u := Real.log y have hx_eq : x = Real.exp t := (Real.exp_log hx).symm have hy_eq : y = Real.exp u := (Real.exp_log hy).symm have h := hCosh t u simp only [G] at h rw [hx_eq, hy_eq] rw [← Real.exp_add, ← Real.exp_sub] -- h : F (exp (t + u)) + F (exp (t - u)) = 2 * (F (exp t) * F (exp u)) + 2 * (F (exp t) + F (exp u)) -- Goal: F (exp (t + u)) + F (exp (t - u)) = 2 * F (exp t) * F (exp u) + 2 * F (exp t) + 2 * F (exp u) calc F (Real.exp (t + u)) + F (Real.exp (t - u)) = 2 * (F (Real.exp t) * F (Real.exp u)) + 2 * (F (Real.exp t) + F (Real.exp u)) := h _ = 2 * F (Real.exp t) * F (Real.exp u) + 2 * F (Real.exp t) + 2 * F (Real.exp u) := by ringThe declaration confirms that the cost function J is not merely a candidate that happens to solve the differential equation; it is actually a solution to the original problem's defining condition. composition_law_equiv_coshAdd · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Law of Logic cost theorem**: The J-cost function is the unique reciprocal cost satisfying the RCL, normalization, calibration, and continuity. This version uses the global Aczél axiom internally and requires NO regularity hypothesis parameters from the caller. -/ theorem law_of_logic_forces_jcost (F : ℝ → ℝ) [AczelSmoothnessPackage] (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by intro x hx have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] rw [hNorm]; ring have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t; change deriv (fun y => Gf y + 1) t = deriv Gf t exact (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution_aczel Hf h_H0 h_H_cont h_dAlembert h_H_d2 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := fun t => by have : Gf t + 1 = Real.cosh t := h_H_cosh t linarith have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simp only [hJG] _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simp [ht]The main theorem law_of_logic_forces_jcost takes five hypotheses, one of which is hCalib : IsCalibrated F. law_of_logic_forces_jcost · IndisputableMonolith/Cost/FunctionalEquation.leanTHEOREM law_of_logic_forces_jcost_with_regularization · IndisputableMonolith/Cost/FunctionalEquation.lean
/-- **Theorem 1.1 (Main Result, Reformulated)**: Let F : ℝ₊ → ℝ satisfy: 1. Reciprocity: F(x) = F(1/x) 2. Normalization: F(1) = 0 3. Composition Law: F(xy) + F(x/y) = 2F(x)F(y) + 2F(x) + 2F(y) 4. Calibration: lim_{t→0} 2F(e^t)/t² = 1 5. Continuity and regularity hypotheses Then F = J on ℝ₊, where J(x) = (x + 1/x)/2 - 1. This theorem corresponds to Theorem 1.1 in: J. Washburn & M. Zlatanović, "Uniqueness of the Canonical Reciprocal Cost" -/ theorem law_of_logic_forces_jcost_with_regularization (F : ℝ → ℝ) (hRecip : IsReciprocalCost F) (hNorm : IsNormalized F) (hComp : SatisfiesCompositionLaw F) (hCalib : IsCalibrated F) (hCont : ContinuousOn F (Set.Ioi 0)) -- Regularity hypotheses (from Aczél theory) (h_smooth : dAlembert_continuous_implies_smooth_hypothesis (H F)) (h_ode : dAlembert_to_ODE_hypothesis (H F)) (h_cont : ode_regularity_continuous_hypothesis (H F)) (h_diff : ode_regularity_differentiable_hypothesis (H F)) (h_boot : ode_linear_regularity_bootstrap_hypothesis (H F)) : ∀ x : ℝ, 0 < x → F x = Cost.Jcost x := by -- The proof follows the structure of T5_uniqueness_complete: -- 1. Convert composition law to CoshAddIdentity on G -- 2. Shift to H = G + 1 to get standard d'Alembert equation -- 3. Apply Aczél's theorem: continuous d'Alembert solutions are cosh -- 4. Calibration H''(0) = 1 selects cosh (not cos or constant) -- 5. Unshift: G = cosh - 1, hence F = J intro x hx -- Convert hypotheses to the required format have hSymm : ∀ {y}, 0 < y → F y = F y⁻¹ := fun {y} hy => hRecip y hy have hCoshAdd : CoshAddIdentity F := composition_law_equiv_coshAdd F |>.mp hComp -- Step 1: Set up G and H let Gf : ℝ → ℝ := G F let Hf : ℝ → ℝ := H F -- Step 2: Derive key properties of G and H have h_G_even : Function.Even Gf := G_even_of_reciprocal_symmetry F hSymm have h_G0 : Gf 0 = 0 := G_zero_of_unit F hNorm have h_H0 : Hf 0 = 1 := by show H F 0 = 1 simp only [H, G, Real.exp_zero] -- Goal is F 1 + 1 = 1, and hNorm says F 1 = 0 rw [hNorm] ring -- Step 3: G is continuous (F continuous on (0,∞), exp continuous) have h_G_cont : Continuous Gf := by have h := ContinuousOn.comp_continuous hCont continuous_exp have h' : Continuous (fun t => F (Real.exp t)) := h (by intro t; exact Set.mem_Ioi.mpr (Real.exp_pos t)) simp [Gf, G] at h' exact h' have h_H_cont : Continuous Hf := by simpa [Hf, H] using h_G_cont.add continuous_const -- Step 4: Convert CoshAddIdentity to d'Alembert equation for H have h_direct : DirectCoshAdd Gf := CoshAddIdentity_implies_DirectCoshAdd F hCoshAdd have h_dAlembert : ∀ t u, Hf (t + u) + Hf (t - u) = 2 * Hf t * Hf u := by intro t u have hG := h_direct t u have h_goal : (Gf (t + u) + 1) + (Gf (t - u) + 1) = 2 * (Gf t + 1) * (Gf u + 1) := by calc (Gf (t + u) + 1) + (Gf (t - u) + 1) = (Gf (t + u) + Gf (t - u)) + 2 := by ring _ = (2 * (Gf t * Gf u) + 2 * (Gf t + Gf u)) + 2 := by simp [hG] _ = 2 * (Gf t + 1) * (Gf u + 1) := by ring simp [Hf, H, Gf] at h_goal exact h_goal -- Step 5: Second derivative condition have h_H_d2 : deriv (deriv Hf) 0 = 1 := by have hG_d2 : deriv (deriv Gf) 0 = 1 := by simpa [Gf, G] using hCalib have hderiv : deriv Hf = deriv Gf := by funext t change deriv (fun y => Gf y + 1) t = deriv Gf t simpa using (deriv_add_const (f := Gf) (x := t) (c := (1 : ℝ))) have hderiv2 : deriv (deriv Hf) = deriv (deriv Gf) := congrArg deriv hderiv exact (congrArg (fun g => g 0) hderiv2).trans hG_d2 -- Step 6: Apply d'Alembert uniqueness theorem have h_H_cosh : ∀ t, Hf t = Real.cosh t := dAlembert_cosh_solution Hf h_H0 h_H_cont h_dAlembert h_H_d2 h_smooth h_ode h_cont h_diff h_boot -- Step 7: Unshift to get G = cosh - 1 have h_G_cosh : ∀ t, Gf t = Real.cosh t - 1 := by intro t have hH := h_H_cosh t have hH' : Gf t + 1 = Real.cosh t := by simpa [Hf, H, Gf] using hH linarith -- Step 8: Convert back via log parametrization have ht : Real.exp (Real.log x) = x := Real.exp_log hx have hJG : G Cost.Jcost (Real.log x) = Real.cosh (Real.log x) - 1 := Jcost_G_eq_cosh_sub_one (Real.log x) calc F x = F (Real.exp (Real.log x)) := by rw [ht] _ = Gf (Real.log x) := rfl _ = Real.cosh (Real.log x) - 1 := h_G_cosh (Real.log x) _ = G Cost.Jcost (Real.log x) := by simpa using hJG.symm _ = Cost.Jcost (Real.exp (Real.log x)) := by simp [G] _ = Cost.Jcost x := by simpa [ht]The lemma isCalibrated_of_isCalibratedLimit proves that the limit-based definition implies the exact one, under the right continuity conditions. law_of_logic_forces_jcost_with_regularization · IndisputableMonolith/Cost/FunctionalEquation.lean