pith. machine review for the scientific record. sign in

IndisputableMonolith.Unification.CriticalRecognitionLoading

IndisputableMonolith/Unification/CriticalRecognitionLoading.lean · 240 lines · 29 declarations

show as:
view math explainer →

open module explainer GitHub source

Explainer status: pending

   1import Mathlib
   2import IndisputableMonolith.Constants
   3import IndisputableMonolith.Unification.RecognitionBandwidth
   4import IndisputableMonolith.Unification.ConsciousnessBandwidth
   5import IndisputableMonolith.Unification.RecognitionBandGeometry
   6
   7/-!
   8# Critical Recognition Loading
   9
  10This module sketches a control theorem for the operating regime suggested by
  11recognition bandwidth and the semantic condensation gate.
  12
  13The central control variable is the load ratio
  14
  15    rho = R_dem / R_max
  16
  17where `R_dem` is the demanded recognition rate and `R_max` is the recognition
  18bandwidth of the bounded region currently doing the work. The claim is that
  19healthy operation lives in a narrow sub-saturation band:
  20
  21    rho_min < rho < 1
  22
  23The actuator runs on the native 8-tick cadence, but the controller judges
  24stability on the 360-tick supervisory horizon forced by `lcm(8,45)`.
  25
  26This file is a theorem sketch. It proves the structural lemmas that a fuller
  27runtime or physics deployment theorem can build on.
  28-/
  29
  30namespace IndisputableMonolith
  31namespace Unification
  32namespace CriticalRecognitionLoading
  33
  34open Constants
  35open RecognitionBandwidth
  36open ConsciousnessBandwidth
  37open RecognitionBandGeometry
  38
  39noncomputable section
  40
  41/-! ## §1. Native control geometry -/
  42
  43/-- Native actuation period. -/
  44def pulseTicks : ℕ := 8
  45
  46/-- Supervisory horizon for persistence checks. -/
  47def supervisoryTicks : ℕ := barrierTicks
  48
  49theorem supervisoryTicks_eq : supervisoryTicks = 360 := by
  50  rfl
  51
  52theorem supervisoryTicks_is_lcm : supervisoryTicks = Nat.lcm pulseTicks 45 := by
  53  unfold supervisoryTicks pulseTicks
  54  simpa using barrier_is_lcm
  55
  56theorem pulse_divides_supervisory : pulseTicks ∣ supervisoryTicks := by
  57  use 45
  58  unfold pulseTicks supervisoryTicks barrierTicks
  59  norm_num
  60
  61/-! ## §2. Load ratio and regimes -/
  62
  63/-- The runtime load ratio for a bounded recognition system. -/
  64def loadRatio (area demand : ℝ) : ℝ :=
  65  demand / bandwidth area
  66
  67/-- Underloaded systems do not reach the target condensation band. -/
  68def IsUnderloaded (rhoMin area demand : ℝ) : Prop :=
  69  loadRatio area demand ≤ rhoMin
  70
  71/-- Subcritical systems remain below the bandwidth ceiling. -/
  72def IsSubcritical (area demand : ℝ) : Prop :=
  73  demand < bandwidth area
  74
  75/-- Overloaded systems hit or exceed the bandwidth ceiling. -/
  76def IsOverloaded (area demand : ℝ) : Prop :=
  77  bandwidth area ≤ demand
  78
  79/-- The critical-loading band: close to saturation, but still below it. -/
  80def InCriticalBand (rhoMin area demand : ℝ) : Prop :=
  81  rhoMin < loadRatio area demand ∧ loadRatio area demand < 1
  82
  83/-- The forced lower edge of the control band from the phase-transition geometry. -/
  84abbrev rhoCriticalMin : ℝ := rhoBandLower
  85
  86theorem rhoCriticalMin_eq : rhoCriticalMin = phi⁻¹ ^ 2 :=
  87  RecognitionBandGeometry.rhoBandLower_eq
  88
  89/-- The fixed control band used by the runtime. -/
  90def InForcedCriticalBand (area demand : ℝ) : Prop :=
  91  InCriticalBand rhoCriticalMin area demand
  92
  93theorem loadRatio_pos {area demand : ℝ} (hArea : 0 < area) (hDemand : 0 < demand) :
  94    0 < loadRatio area demand := by
  95  unfold loadRatio
  96  exact div_pos hDemand (bandwidth_pos hArea)
  97
  98theorem criticalBand_implies_subcritical
  99    {rhoMin area demand : ℝ} (hArea : 0 < area)
 100    (h : InCriticalBand rhoMin area demand) :
 101    IsSubcritical area demand := by
 102  rcases h with ⟨_, hlt⟩
 103  unfold IsSubcritical
 104  unfold loadRatio at hlt
 105  have hB : 0 < bandwidth area := bandwidth_pos hArea
 106  rw [div_lt_one hB] at hlt
 107  simpa using hlt
 108
 109theorem criticalBand_not_overloaded
 110    {rhoMin area demand : ℝ} (hArea : 0 < area)
 111    (h : InCriticalBand rhoMin area demand) :
 112    ¬ IsOverloaded area demand := by
 113  unfold IsOverloaded
 114  have hSub : demand < bandwidth area := by
 115    simpa [IsSubcritical] using criticalBand_implies_subcritical hArea h
 116  exact not_le_of_gt hSub
 117
 118/-! ## §3. Semantic free energy and condensation gate -/
 119
 120/-- Query-level semantic free energy. -/
 121def semanticFreeEnergy
 122    (refCost entropy attention berryWeight berry : ℝ) : ℝ :=
 123  refCost - attention * entropy - berryWeight * berry
 124
 125theorem higher_entropy_lowers_freeEnergy
 126    {refCost attention berryWeight berry entropy₁ entropy₂ : ℝ}
 127    (hAttention : 0 ≤ attention) (hEntropy : entropy₁ ≤ entropy₂) :
 128    semanticFreeEnergy refCost entropy₂ attention berryWeight berry ≤
 129      semanticFreeEnergy refCost entropy₁ attention berryWeight berry := by
 130  have hMul : attention * entropy₁ ≤ attention * entropy₂ :=
 131    mul_le_mul_of_nonneg_left hEntropy hAttention
 132  unfold semanticFreeEnergy
 133  linarith
 134
 135theorem higher_berry_lowers_freeEnergy
 136    {refCost entropy attention berryWeight berry₁ berry₂ : ℝ}
 137    (hWeight : 0 ≤ berryWeight) (hBerry : berry₁ ≤ berry₂) :
 138    semanticFreeEnergy refCost entropy attention berryWeight berry₂ ≤
 139      semanticFreeEnergy refCost entropy attention berryWeight berry₁ := by
 140  have hMul : berryWeight * berry₁ ≤ berryWeight * berry₂ :=
 141    mul_le_mul_of_nonneg_left hBerry hWeight
 142  unfold semanticFreeEnergy
 143  linarith
 144
 145/-- Query-level semantic admissibility region. -/
 146def SemanticCondensationGate
 147    (entropy entropyFloor attention signature signatureMin signatureMax z : ℝ) : Prop :=
 148  entropyFloor < entropy ∧
 149    signatureMin ≤ signature ∧
 150    signature ≤ signatureMax ∧
 151    attention ≤ phi ^ (3 : ℕ) ∧
 152    phi ^ (45 : ℕ) ≤ z
 153
 154theorem semanticGate_implies_attention_cap
 155    {entropy entropyFloor attention signature signatureMin signatureMax z : ℝ}
 156    (h : SemanticCondensationGate entropy entropyFloor attention
 157      signature signatureMin signatureMax z) :
 158    attention ≤ phi ^ (3 : ℕ) :=
 159  h.2.2.2.1
 160
 161theorem semanticGate_implies_gap_ready
 162    {entropy entropyFloor attention signature signatureMin signatureMax z : ℝ}
 163    (h : SemanticCondensationGate entropy entropyFloor attention
 164      signature signatureMin signatureMax z) :
 165    phi ^ (45 : ℕ) ≤ z :=
 166  h.2.2.2.2
 167
 168/-! ## §4. Controller state and certificate -/
 169
 170/-- Minimal runtime state needed by the governor. -/
 171structure ControllerState where
 172  area : ℝ
 173  demand : ℝ
 174  entropy : ℝ
 175  entropyFloor : ℝ
 176  attention : ℝ
 177  signature : ℝ
 178  signatureMin : ℝ
 179  signatureMax : ℝ
 180  z : ℝ
 181  hArea : 0 < area
 182  hDemand : 0 < demand
 183
 184/-- The full critical-loading condition. -/
 185def IsCriticalRecognitionLoading (rhoMin : ℝ) (s : ControllerState) : Prop :=
 186  InCriticalBand rhoMin s.area s.demand ∧
 187    SemanticCondensationGate
 188      s.entropy s.entropyFloor s.attention
 189      s.signature s.signatureMin s.signatureMax s.z
 190
 191/-- The non-parameterized critical-loading condition. -/
 192def IsForcedCriticalRecognitionLoading (s : ControllerState) : Prop :=
 193  IsCriticalRecognitionLoading rhoCriticalMin s
 194
 195/-- Penalty for leaving the critical-loading band. -/
 196def loadPenalty (rhoMin area demand : ℝ) : ℝ :=
 197  max 0 (rhoMin - loadRatio area demand) + max 0 (loadRatio area demand - 1)
 198
 199theorem loadPenalty_zero_of_critical
 200    {rhoMin area demand : ℝ}
 201    (h : InCriticalBand rhoMin area demand) :
 202    loadPenalty rhoMin area demand = 0 := by
 203  unfold loadPenalty
 204  have hLeft : rhoMin - loadRatio area demand ≤ 0 := by
 205    linarith [h.1]
 206  have hRight : loadRatio area demand - 1 ≤ 0 := by
 207    linarith [h.2]
 208  rw [max_eq_left hLeft, max_eq_left hRight]
 209  ring
 210
 211theorem criticalRecognitionLoading_certificate
 212    {rhoMin : ℝ} {s : ControllerState}
 213    (h : IsCriticalRecognitionLoading rhoMin s) :
 214    IsSubcritical s.area s.demand ∧
 215      s.attention ≤ phi ^ (3 : ℕ) ∧
 216      phi ^ (45 : ℕ) ≤ s.z ∧
 217      pulseTicks ∣ supervisoryTicks ∧
 218      loadPenalty rhoMin s.area s.demand = 0 := by
 219  refine ⟨?_, ?_, ?_, ?_, ?_⟩
 220  · exact criticalBand_implies_subcritical s.hArea h.1
 221  · exact semanticGate_implies_attention_cap h.2
 222  · exact semanticGate_implies_gap_ready h.2
 223  · exact pulse_divides_supervisory
 224  · exact loadPenalty_zero_of_critical h.1
 225
 226theorem forcedCriticalRecognitionLoading_certificate
 227    {s : ControllerState}
 228    (h : IsForcedCriticalRecognitionLoading s) :
 229    IsSubcritical s.area s.demand ∧
 230      s.attention ≤ phi ^ (3 : ℕ) ∧
 231      phi ^ (45 : ℕ) ≤ s.z ∧
 232      pulseTicks ∣ supervisoryTicks ∧
 233      loadPenalty rhoCriticalMin s.area s.demand = 0 := by
 234  exact criticalRecognitionLoading_certificate h
 235
 236end
 237end CriticalRecognitionLoading
 238end Unification
 239end IndisputableMonolith
 240

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