IndisputableMonolith.Complexity.JFrustration
IndisputableMonolith/Complexity/JFrustration.lean · 99 lines · 8 declarations
show as:
view math explainer →
1import Mathlib
2import IndisputableMonolith.Constants
3import IndisputableMonolith.Complexity.RSatEncoding
4import IndisputableMonolith.Complexity.JCostLaplacian
5
6/-!
7# J-Frustration: A Non-Natural Complexity Property
8
9J-frustration measures the topological depth of the J-cost landscape barrier
10around a formula's satisfying region.
11
12## Key Results
13
14- `JFrust` — binary frustration: 0 for SAT, 1 for UNSAT
15- `LandscapeDepth` — average J-cost across all assignments
16- `jfrust_unsat_ge_one` / `jfrust_sat_eq_zero` — basic classification
17- `landscapeDepth_unsat` — UNSAT formulas have average depth ≥ 1
18
19## Status: 0 sorry, 0 axiom
20-/
21
22namespace IndisputableMonolith
23namespace Complexity
24namespace JFrustration
25
26open RSatEncoding JCostLaplacian
27
28noncomputable section
29
30/-! ## J-Frustration of a Formula -/
31
32/-- J-Frustration of a CNF formula.
33 Binary classification: 0 for SAT, 1 for UNSAT. -/
34def JFrust {n : ℕ} (f : CNFFormula n) : ℝ :=
35 haveI := Classical.propDecidable f.isSAT
36 if f.isSAT then 0 else 1
37
38theorem jfrust_unsat_ge_one {n : ℕ} (f : CNFFormula n) (h : f.isUNSAT) :
39 JFrust f ≥ 1 := by
40 unfold JFrust
41 haveI := Classical.propDecidable f.isSAT
42 have hns : ¬f.isSAT := by
43 intro ⟨a, ha⟩; exact absurd ha (by simp [h a])
44 simp [hns]
45
46theorem jfrust_sat_eq_zero {n : ℕ} (f : CNFFormula n) (h : f.isSAT) :
47 JFrust f = 0 := by
48 unfold JFrust
49 haveI := Classical.propDecidable f.isSAT
50 simp [h]
51
52/-! ## Landscape Depth -/
53
54/-- The average J-cost across all assignments. -/
55def LandscapeDepth {n : ℕ} (f : CNFFormula n) : ℝ :=
56 Finset.univ.sum (fun a : Fin n → Bool => satJCost f a) /
57 (Finset.univ.card (α := Fin n → Bool) : ℝ)
58
59theorem landscapeDepth_nonneg {n : ℕ} (f : CNFFormula n) :
60 0 ≤ LandscapeDepth f := by
61 unfold LandscapeDepth
62 apply div_nonneg
63 · exact Finset.sum_nonneg (fun a _ => satJCost_nonneg f a)
64 · exact Nat.cast_nonneg _
65
66/-- For UNSAT formulas, landscape depth is ≥ 1. -/
67theorem landscapeDepth_unsat {n : ℕ} (f : CNFFormula n) (h : f.isUNSAT) :
68 1 ≤ LandscapeDepth f := by
69 unfold LandscapeDepth
70 have hcard_pos : (0 : ℝ) < (Finset.univ.card (α := Fin n → Bool) : ℝ) := by
71 exact_mod_cast Finset.card_pos.mpr ⟨fun _ => false, Finset.mem_univ _⟩
72 rw [le_div_iff₀ hcard_pos]
73 calc (1 : ℝ) * ↑(Finset.univ.card (α := Fin n → Bool))
74 = Finset.univ.sum (fun _ : Fin n → Bool => (1 : ℝ)) := by
75 simp [Finset.sum_const, smul_eq_mul]
76 _ ≤ Finset.univ.sum (fun a : Fin n → Bool => satJCost f a) := by
77 apply Finset.sum_le_sum; intro a _
78 exact unsat_cost_lower_bound f h a
79
80/-! ## Certificate -/
81
82structure JFrustrationCert where
83 unsat_ge_one : ∀ (n : ℕ) (f : CNFFormula n), f.isUNSAT → JFrust f ≥ 1
84 sat_eq_zero : ∀ (n : ℕ) (f : CNFFormula n), f.isSAT → JFrust f = 0
85 depth_nonneg : ∀ (n : ℕ) (f : CNFFormula n), 0 ≤ LandscapeDepth f
86 depth_unsat : ∀ (n : ℕ) (f : CNFFormula n), f.isUNSAT → 1 ≤ LandscapeDepth f
87
88def jfrustrationCert : JFrustrationCert where
89 unsat_ge_one := fun n f h => jfrust_unsat_ge_one f h
90 sat_eq_zero := fun n f h => jfrust_sat_eq_zero f h
91 depth_nonneg := fun n f => landscapeDepth_nonneg f
92 depth_unsat := fun n f h => landscapeDepth_unsat f h
93
94end -- noncomputable section
95
96end JFrustration
97end Complexity
98end IndisputableMonolith
99