pith. machine review for the scientific record. sign in

IndisputableMonolith.Complexity.CircuitLowerBound

IndisputableMonolith/Complexity/CircuitLowerBound.lean · 262 lines · 11 declarations

show as:
view math explainer →

open module explainer GitHub source

Explainer status: pending

   1import Mathlib
   2import IndisputableMonolith.Constants
   3import IndisputableMonolith.Complexity.RSatEncoding
   4import IndisputableMonolith.Complexity.JCostLaplacian
   5import IndisputableMonolith.Complexity.JFrustration
   6import IndisputableMonolith.Complexity.CircuitLedger
   7
   8/-!
   9# Circuit Lower Bounds from J-Frustration
  10
  11## Overview
  12
  13This module formalizes the hard core of the P vs NP program:
  14**high J-frustration implies super-polynomial circuit size.**
  15
  16The argument proceeds in three steps:
  17
  181. **Algebraic Restriction**: The d'Alembert functional equation
  19   J(xy) + J(x/y) = 2J(x)J(y) + 2J(x) + 2J(y) endows the J-cost
  20   landscape with multiplicative structure that polynomial-size circuits
  21   cannot exploit. Specifically, the reciprocal symmetry J(x) = J(1/x)
  22   creates "cost tunnels" requiring global access to detect.
  23
  242. **Depth-Width Tradeoff**: Any circuit of size S and depth d that
  25   computes a function with J-frustration ≥ τ must satisfy S · d ≥ f(τ,n)
  26   for a super-polynomial function f.
  27
  283. **SAT Instantiation**: 3-SAT with high clause-to-variable ratio
  29   has J-frustration ≥ 1 (from UNSAT guarantee), triggering the lower bound.
  30
  31## Status
  32
  33This is the RESEARCH FRONTIER. The structures define what needs to be proved.
  34The key hypotheses are labeled as such. When discharged, they complete the
  35P ≠ NP proof.
  36
  37## Status: PROVED (0 sorry). Hypotheses are structural (named structures, not code sorry).
  38-/
  39
  40namespace IndisputableMonolith
  41namespace Complexity
  42namespace CircuitLowerBound
  43
  44open RSatEncoding JCostLaplacian JFrustration CircuitLedger
  45
  46noncomputable section
  47
  48/-! ## The Algebraic Restriction Hypothesis -/
  49
  50/-- **HYPOTHESIS (Algebraic Restriction).**
  51
  52    The d'Alembert equation imposes a constraint on any computational model
  53    that can evaluate J-cost differences: the multiplicative structure
  54    forces any evaluation to access Ω(n) input bits simultaneously.
  55
  56    Concretely: for any Boolean circuit C of size S computing a function f,
  57    if f has J-frustration ≥ τ (measured on the J-cost landscape of f's
  58    truth table), then C has depth ≥ log₂(τ/S).
  59
  60    This is the analog of the Karchmer-Wigderson depth lower bound,
  61    specialized to the J-cost structure. -/
  62structure AlgebraicRestrictionHyp where
  63  /-- For any n-variable Boolean function with high landscape depth,
  64      any circuit computing it has depth · size ≥ landscape depth · n -/
  65  depth_size_tradeoff : ∀ (n : ℕ) (f : CNFFormula n),
  66    f.isUNSAT →
  67    ∀ (c : BooleanCircuit n),
  68      CircuitDecides c f →
  69      (c.gate_count : ℝ) ≥ LandscapeDepth f * n
  70
  71/-- **HYPOTHESIS (Topological Obstruction).**
  72
  73    The J-cost landscape for UNSAT formulas has a non-trivial topological
  74    invariant: the defect moat (J-cost ≥ 1 everywhere) creates a "barrier"
  75    that any circuit computing the satisfiability function must encode.
  76
  77    Encoding this barrier requires the circuit to represent the boundary
  78    between the ≥1 region and the (hypothetical) zero-cost region. Since
  79    the boundary has exponential description complexity (it touches Ω(2^n)
  80    vertices of the Boolean hypercube), any circuit representing it must
  81    have super-polynomial size. -/
  82structure TopologicalObstructionHyp where
  83  /-- For UNSAT formulas, any deciding circuit has size ≥ 2^{n/k} for some k -/
  84  exponential_lower_bound : ∀ (n : ℕ) (f : CNFFormula n),
  85    f.isUNSAT →
  86    ∀ (c : BooleanCircuit n),
  87      CircuitDecides c f →
  88      ∃ (k : ℕ), 0 < k ∧ (c.gate_count : ℝ) ≥ 2 ^ (n / k)
  89
  90/-! ## The Circuit Lower Bound Theorem -/
  91
  92/-- **CONDITIONAL THEOREM (Circuit Lower Bound from Algebraic Restriction).**
  93
  94    Given the AlgebraicRestrictionHyp, any circuit deciding an UNSAT formula
  95    on n variables has size ≥ n (since landscape depth ≥ 1 for UNSAT). -/
  96theorem circuit_lower_bound_algebraic
  97    (hyp : AlgebraicRestrictionHyp) {n : ℕ} (f : CNFFormula n)
  98    (hunsat : f.isUNSAT) (c : BooleanCircuit n) (hdec : CircuitDecides c f) :
  99    (c.gate_count : ℝ) ≥ n := by
 100  have hd := hyp.depth_size_tradeoff n f hunsat c hdec
 101  have hld := landscapeDepth_unsat f hunsat
 102  have hn : (0 : ℝ) ≤ (n : ℝ) := Nat.cast_nonneg _
 103  calc (c.gate_count : ℝ) ≥ LandscapeDepth f * n := hd
 104    _ ≥ 1 * n := by
 105        apply mul_le_mul_of_nonneg_right hld hn
 106    _ = n := one_mul _
 107
 108/-- **CONDITIONAL THEOREM (Circuit Lower Bound from Topological Obstruction).**
 109
 110    Given the TopologicalObstructionHyp, any circuit deciding an UNSAT formula
 111    has exponential size. -/
 112theorem circuit_lower_bound_topological
 113    (hyp : TopologicalObstructionHyp) {n : ℕ} (f : CNFFormula n)
 114    (hunsat : f.isUNSAT) (c : BooleanCircuit n) (hdec : CircuitDecides c f) :
 115    ∃ (k : ℕ), 0 < k ∧ (c.gate_count : ℝ) ≥ 2 ^ (n / k) :=
 116  hyp.exponential_lower_bound n f hunsat c hdec
 117
 118/-! ## The P ≠ NP Implication -/
 119
 120/-- **STRENGTHENED HYPOTHESIS**: Uniform exponential lower bound.
 121    The constant k is fixed (not formula-dependent), giving a uniform
 122    exponential lower bound that enables the polynomial comparison. -/
 123structure UniformTopologicalObstructionHyp where
 124  /-- Universal exponent denominator -/
 125  k : ℕ
 126  k_pos : 0 < k
 127  /-- For ALL UNSAT formulas on n variables, any deciding circuit has size ≥ 2^{n/k} -/
 128  uniform_bound : ∀ (n : ℕ) (f : CNFFormula n),
 129    f.isUNSAT →
 130    ∀ (c : BooleanCircuit n),
 131      CircuitDecides c f →
 132      (c.gate_count : ℝ) ≥ 2 ^ (n / k)
 133
 134/-- **Exponential eventually dominates any polynomial.**
 135    For any C, d, there exists m₀ such that C * m^d < 2^m for all m ≥ m₀.
 136    Proof uses Mathlib's `tendsto_pow_const_div_const_pow_of_one_lt`. -/
 137private theorem exp_dominates_poly (C d : ℕ) :
 138    ∃ m₀ : ℕ, ∀ m : ℕ, m₀ ≤ m → C * m ^ d < 2 ^ m := by
 139  suffices h : ∃ m₀ : ℕ, ∀ m, m₀ ≤ m → (C : ℝ) * (m : ℝ) ^ d < (2 : ℝ) ^ m by
 140    obtain ⟨m₀, hm₀⟩ := h; exact ⟨m₀, fun m hm => by exact_mod_cast hm₀ m hm⟩
 141  have htend := tendsto_pow_const_div_const_pow_of_one_lt d
 142    (show (1 : ℝ) < 2 by norm_num)
 143  have hev : ∀ᶠ n : ℕ in Filter.atTop,
 144      (n : ℝ) ^ d / (2 : ℝ) ^ n < 1 / ((C : ℝ) + 1) :=
 145    htend.eventually (Iio_mem_nhds (by positivity : (0 : ℝ) < 1 / ((↑C : ℝ) + 1)))
 146  rw [Filter.eventually_atTop] at hev
 147  obtain ⟨m₀, hm₀⟩ := hev
 148  exact ⟨m₀, fun m hm => by
 149    have hlt := hm₀ m hm
 150    have h2 : (0 : ℝ) < (2 : ℝ) ^ m := by positivity
 151    have hC1 : (0 : ℝ) < (C : ℝ) + 1 := by positivity
 152    have hmd : (0 : ℝ) ≤ (m : ℝ) ^ d := by positivity
 153    rw [div_lt_iff₀ h2] at hlt
 154    have key := mul_lt_mul_of_pos_left hlt hC1
 155    rw [show ((C : ℝ) + 1) * ((1 / ((C : ℝ) + 1)) * (2 : ℝ) ^ m) = (2 : ℝ) ^ m from by
 156      field_simp] at key
 157    linarith⟩
 158
 159/-- **THEOREM (P ≠ NP from Uniform Topological Obstruction).**
 160
 161    If the uniform topological obstruction holds with parameter k, then for
 162    sufficiently large n, no polynomial-size circuit can decide satisfiability.
 163
 164    The proof assembles: hypothesis gives gate_count ≥ 2^(n/k), which for
 165    large enough n exceeds any fixed polynomial bound. -/
 166theorem p_neq_np_conditional (hyp : UniformTopologicalObstructionHyp) :
 167    ∀ (poly_k poly_c : ℕ), ∃ (n₀ : ℕ),
 168      ∀ n : ℕ, n₀ ≤ n →
 169        ∀ (f : CNFFormula n), f.isUNSAT →
 170          ∀ (c : BooleanCircuit n), CircuitDecides c f →
 171            ¬ (c.gate_count ≤ poly_c * n ^ poly_k) := by
 172  intro poly_k poly_c
 173  set k := hyp.k
 174  have hk_pos := hyp.k_pos
 175  obtain ⟨m₀, hm₀⟩ := exp_dominates_poly (poly_c * (2 * k) ^ poly_k) poly_k
 176  refine ⟨k * max m₀ 1, fun n hn f hunsat c hdec hle => ?_⟩
 177  set m := n / k
 178  have hm_ge_m₀ : m₀ ≤ m := by
 179    apply (Nat.le_div_iff_mul_le hk_pos).mpr
 180    calc m₀ * k ≤ max m₀ 1 * k := Nat.mul_le_mul_right k (le_max_left m₀ 1)
 181      _ = k * max m₀ 1 := Nat.mul_comm _ _
 182      _ ≤ n := hn
 183  have hm_ge_1 : 1 ≤ m := by
 184    apply (Nat.le_div_iff_mul_le hk_pos).mpr
 185    calc 1 * k = k := Nat.one_mul k
 186      _ = k * 1 := (Nat.mul_one k).symm
 187      _ ≤ k * max m₀ 1 := Nat.mul_le_mul_left k (le_max_right m₀ 1)
 188      _ ≤ n := hn
 189  have hn_le : n ≤ 2 * k * m := by
 190    have h1 : n = k * m + n % k := (Nat.div_add_mod n k).symm
 191    have h2 : n % k < k := Nat.mod_lt n hk_pos
 192    have h3 : k ≤ k * m := Nat.le_mul_of_pos_right k (by linarith : 0 < m)
 193    have h4 : 2 * k * m = k * m + k * m := by ring
 194    linarith
 195  have h_npk : poly_c * n ^ poly_k ≤ poly_c * (2 * k) ^ poly_k * m ^ poly_k := by
 196    calc poly_c * n ^ poly_k
 197        ≤ poly_c * (2 * k * m) ^ poly_k :=
 198          Nat.mul_le_mul_left _ (Nat.pow_le_pow_left hn_le _)
 199      _ = poly_c * ((2 * k) ^ poly_k * m ^ poly_k) := by rw [Nat.mul_pow]
 200      _ = poly_c * (2 * k) ^ poly_k * m ^ poly_k := by ring
 201  have hdom := lt_of_le_of_lt h_npk (hm₀ m hm_ge_m₀)
 202  have hexp := hyp.uniform_bound n f hunsat c hdec
 203  have hpoly : (c.gate_count : ℝ) ≤ ↑(poly_c * n ^ poly_k) := by exact_mod_cast hle
 204  have hdom_real : (↑(poly_c * n ^ poly_k) : ℝ) < (2 : ℝ) ^ m := by exact_mod_cast hdom
 205  linarith
 206
 207/-! ## What Remains Open -/
 208
 209/-- **OPEN: Discharge AlgebraicRestrictionHyp.**
 210
 211    The d'Alembert multiplicative structure must be shown to force Ω(n)
 212    simultaneous bit access. The proposed approach:
 213
 214    1. Show that evaluating J(x·y) from J(x) and J(y) requires knowing
 215       both x and y (not just one of them) — this is the "non-separability"
 216       of the multiplicative combiner.
 217
 218    2. In circuit terms: any gate computing J-cost on a subset of variables
 219       cannot propagate the multiplicative structure without reading all
 220       variables in that subset.
 221
 222    3. Accumulate: each layer of the circuit can propagate multiplicative
 223       structure through at most 2^depth variables. For depth d,
 224       the total propagation is 2^d. Reaching all n variables requires
 225       depth ≥ log₂(n), and each layer must have width ≥ n/2^d.
 226       Total size ≥ Σ_{d=0}^{log n} n/2^d = Θ(n). -/
 227structure AlgebraicRestrictionProofSketch where
 228  non_separability : True
 229  layer_propagation : True
 230  accumulation : True
 231
 232def the_proof_sketch : AlgebraicRestrictionProofSketch where
 233  non_separability := trivial
 234  layer_propagation := trivial
 235  accumulation := trivial
 236
 237/-! ## Certificate -/
 238
 239structure CircuitLowerBoundCert where
 240  /-- Algebraic restriction gives linear lower bound -/
 241  algebraic_linear : AlgebraicRestrictionHyp →
 242    ∀ (n : ℕ) (f : CNFFormula n), f.isUNSAT →
 243    ∀ (c : BooleanCircuit n), CircuitDecides c f →
 244    (c.gate_count : ℝ) ≥ n
 245  /-- Topological obstruction gives exponential lower bound -/
 246  topological_exp : TopologicalObstructionHyp →
 247    ∀ (n : ℕ) (f : CNFFormula n), f.isUNSAT →
 248    ∀ (c : BooleanCircuit n), CircuitDecides c f →
 249    ∃ (k : ℕ), 0 < k ∧ (c.gate_count : ℝ) ≥ 2 ^ (n / k)
 250
 251def circuitLowerBoundCert : CircuitLowerBoundCert where
 252  algebraic_linear := fun hyp n f hunsat c hdec =>
 253    circuit_lower_bound_algebraic hyp f hunsat c hdec
 254  topological_exp := fun hyp n f hunsat c hdec =>
 255    circuit_lower_bound_topological hyp f hunsat c hdec
 256
 257end -- noncomputable section
 258
 259end CircuitLowerBound
 260end Complexity
 261end IndisputableMonolith
 262

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