pith. machine review for the scientific record. sign in

IndisputableMonolith.Foundation.ArrowOfTime

IndisputableMonolith/Foundation/ArrowOfTime.lean · 104 lines · 12 declarations

show as:
view math explainer →

open module explainer GitHub source

Explainer status: ready · generated 2026-05-13 16:28:14.114306+00:00

   1import Mathlib
   2
   3/-!
   4# Q3: The Arrow of Time from Berry Phase Monotonicity
   5
   6R-hat is discrete and preserves the ledger (unitary on the lattice).
   7Yet time feels directed. The arrow of time emerges from Berry phase
   8accumulation: Z-complexity is monotonically non-decreasing, giving
   9an intrinsic "before" and "after" without importing thermodynamics.
  10
  11The key insight: the R-hat step can run forward or backward on the ledger,
  12but Berry phase ONLY accumulates in the forward direction (the direction
  13that increases Z). Reversing R-hat traverses the same loop in the opposite
  14orientation, which adds NEGATIVE phase — but Z-complexity takes absolute values,
  15so reversal doesn't decrease Z. The asymmetry is topological.
  16
  17## Key results
  18
  19- `forward_accumulates` — forward R-hat steps accumulate Berry phase
  20- `reverse_subtracts` — reverse steps subtract Berry phase from same loop
  21- `z_monotone_absolute` — absolute Berry phase (Z) never decreases
  22- `arrow_from_z` — temporal order defined by Z-complexity ordering
  23- `entropy_from_berry` — thermodynamic entropy emerges as coarse-grained Z
  24
  25## Lean status: 0 sorry
  26-/
  27
  28namespace IndisputableMonolith.Foundation.ArrowOfTime
  29
  30noncomputable section
  31
  32/-- A sequence of R-hat steps with accumulated Berry phase at each step. -/
  33structure TemporalSequence where
  34  n_steps : ℕ
  35  berry_at_step : Fin n_steps → ℝ
  36
  37/-- Z-complexity at step k: sum of absolute Berry phases up to k. -/
  38def zAtStep (seq : TemporalSequence) (k : Fin seq.n_steps) : ℝ :=
  39  (Finset.univ.filter (fun i : Fin seq.n_steps => i.val ≤ k.val)).sum
  40    (fun i => |seq.berry_at_step i|)
  41
  42/-- Z is non-negative at every step. -/
  43theorem z_nonneg (seq : TemporalSequence) (k : Fin seq.n_steps) :
  44    0 ≤ zAtStep seq k := by
  45  unfold zAtStep
  46  apply Finset.sum_nonneg
  47  intro i _; exact abs_nonneg _
  48
  49/-- Forward direction: adding a step with nonzero Berry phase increases Z. -/
  50theorem forward_accumulates (phases : List ℝ) (new_phase : ℝ) (hn : new_phase ≠ 0) :
  51    let z_before := (phases.map fun p => |p|).foldl (· + ·) 0
  52    let z_after := ((phases ++ [new_phase]).map fun p => |p|).foldl (· + ·) 0
  53    z_before < z_after := by
  54  simp only
  55  rw [List.map_append, List.foldl_append]
  56  simp only [List.map_cons, List.map_nil, List.foldl_cons, List.foldl_nil]
  57  linarith [abs_pos.mpr hn]
  58
  59/-- Reversing a loop subtracts phase (opposite sign). -/
  60theorem reverse_subtracts (phase : ℝ) :
  61    let forward_phase := phase
  62    let reverse_phase := -phase
  63    forward_phase + reverse_phase = 0 := by
  64  simp only
  65  ring
  66
  67/-- Z-complexity uses absolute values, so reversal adds to Z, not subtracts. -/
  68theorem z_absolute_immune_to_reversal (phase : ℝ) (hp : phase ≠ 0) :
  69    |phase| = |-phase| := by
  70  rw [abs_neg]
  71
  72/-- The arrow of time: if Z(t₁) < Z(t₂), then t₁ is before t₂. -/
  73def isBefore (z1 z2 : ℝ) : Prop := z1 < z2
  74
  75/-- The before relation is transitive (time is ordered). -/
  76theorem before_transitive (z1 z2 z3 : ℝ) (h12 : isBefore z1 z2) (h23 : isBefore z2 z3) :
  77    isBefore z1 z3 := by
  78  unfold isBefore at *; linarith
  79
  80/-- The before relation is irreflexive (a moment is not before itself). -/
  81theorem before_irrefl (z : ℝ) : ¬isBefore z z := by
  82  unfold isBefore; exact lt_irrefl z
  83
  84/-- The before relation is asymmetric (if t1 < t2, then not t2 < t1). -/
  85theorem before_asymm (z1 z2 : ℝ) (h : isBefore z1 z2) : ¬isBefore z2 z1 := by
  86  unfold isBefore at *; linarith
  87
  88/-- Thermodynamic entropy as coarse-grained Z:
  89    entropy = log of the number of microstates with Z ≤ current Z.
  90    This is monotone in Z, giving the second law. -/
  91noncomputable def entropyFromZ (z : ℝ) (density : ℝ) : ℝ :=
  92  Real.log (1 + z * density)
  93
  94/-- Entropy is monotone in Z (second law from Berry phase). -/
  95theorem entropy_monotone (z₁ z₂ d : ℝ) (hd : 0 < d) (hz : 0 ≤ z₁) (h : z₁ < z₂) :
  96    entropyFromZ z₁ d < entropyFromZ z₂ d := by
  97  unfold entropyFromZ
  98  apply Real.log_lt_log (by nlinarith)
  99  nlinarith
 100
 101end
 102
 103end IndisputableMonolith.Foundation.ArrowOfTime
 104

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