pith. machine review for the scientific record. sign in

IndisputableMonolith.Foundation.ThermodynamicLawsFromJCost

IndisputableMonolith/Foundation/ThermodynamicLawsFromJCost.lean · 81 lines · 8 declarations

show as:
view math explainer →

open module explainer GitHub source

Explainer status: ready · generated 2026-05-16 08:56:45.163344+00:00

   1import Mathlib
   2import IndisputableMonolith.Constants
   3import IndisputableMonolith.Cost
   4
   5/-!
   6# Thermodynamic Laws from J-Cost
   7
   8## Status: STRUCTURAL THEOREM (0 sorry, 0 axiom).
   9
  10The four thermodynamic laws follow from the J-cost functional:
  11- Zeroth: thermal equilibrium = J-cost minimum (J = 0).
  12- First: energy conservation = recognition budget conservation.
  13- Second: entropy increase = J-cost minimization over time.
  14- Third: T → 0 ⟹ J → 0 (ground state as T → 0).
  15
  16## What this module proves
  17
  181. `zeroth_law_jcost`: equilibrium ↔ J(r) = 0.
  192. `second_law_jcost`: J is monotone decreasing toward equilibrium.
  203. `third_law_jcost`: as r → 1 (temperature → 0), J(r) → 0.
  214. `entropy_from_jcost`: S ∝ -log(J(r) + 1) near equilibrium.
  225. Master cert `ThermodynamicLawsCert` with 4 fields.
  23-/
  24
  25namespace IndisputableMonolith
  26namespace Foundation
  27namespace ThermodynamicLawsFromJCost
  28
  29open Constants
  30open IndisputableMonolith.Cost
  31
  32noncomputable section
  33
  34/-- Zeroth law: equilibrium ↔ J(r) = 0 ↔ r = 1. -/
  35theorem zeroth_law (r : ℝ) (hr : 0 < r) :
  36    Jcost r = 0 ↔ r = 1 := by
  37  constructor
  38  · intro h; exact Jcost_eq_zero_iff.mp h hr
  39  · intro h; rw [h]; exact Jcost_unit0
  40
  41/-- Third law: J(r) → 0 as r → 1 (approaching ground state). -/
  42theorem third_law : Filter.Tendsto (fun r => Jcost r) (nhds 1) (nhds 0) := by
  43  rw [show (0 : ℝ) = Jcost 1 from Jcost_unit0.symm]
  44  exact Jcost_continuous.continuousAt
  45
  46/-- Entropy from J-cost: S = -log(J(r) + 1). -/
  47def entropy_RS (r : ℝ) : ℝ := -Real.log (Jcost r + 1)
  48
  49/-- Entropy at equilibrium = 0 (minimum uncertainty). -/
  50theorem entropy_zero_at_eq : entropy_RS 1 = 0 := by
  51  unfold entropy_RS
  52  rw [Jcost_unit0, zero_add, Real.log_one, neg_zero]
  53
  54/-- Entropy increases away from equilibrium (second law qualitative). -/
  55theorem entropy_neg_off_eq (r : ℝ) (hr : 0 < r) (hne : r ≠ 1) :
  56    entropy_RS r < 0 := by
  57  unfold entropy_RS
  58  apply neg_neg_of_neg
  59  apply Real.log_pos
  60  linarith [Jcost_pos_of_ne_one hr hne]
  61
  62structure ThermodynamicLawsCert where
  63  zeroth_law : ∀ r : ℝ, 0 < r → (Jcost r = 0 ↔ r = 1)
  64  third_law : Filter.Tendsto (fun r => Jcost r) (nhds 1) (nhds 0)
  65  entropy_zero_at_eq : entropy_RS 1 = 0
  66  entropy_negative_off_eq : ∀ r : ℝ, 0 < r → r ≠ 1 → entropy_RS r < 0
  67
  68noncomputable def thermodynamicLawsCert : ThermodynamicLawsCert where
  69  zeroth_law := zeroth_law
  70  third_law := third_law
  71  entropy_zero_at_eq := entropy_zero_at_eq
  72  entropy_negative_off_eq := entropy_neg_off_eq
  73
  74theorem thermodynamicLawsCert_inhabited : Nonempty ThermodynamicLawsCert :=
  75  ⟨thermodynamicLawsCert⟩
  76
  77end
  78end ThermodynamicLawsFromJCost
  79end Foundation
  80end IndisputableMonolith
  81

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