roseking's picture
Add lean source and binary files (part 64)
92416a2 verified
Raw History Blame Contribute Delete
3.66 kB
import Mathlib
import OAI.Computability.VertexCover.PCP.FinalBooleanVerifier
import OAI.Computability.VertexCover.Fourier.SourceGap
namespace OAI
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
namespace UniqueGames.Foundations.Hastad.SourceNonempty
open Target PCP
theorem real_clause_gap_of_count (F : Formula) (a b : ℕ) (hb : 0 < b)
(hgap : ∀ assignment : Fin F.«variables» → Bool,
a * F.clauses.length ≤ b * NameCompaction.failedCount F assignment)
(assignment : Fin F.«variables» → Bool) :
(a : ℝ) / (b : ℝ) * F.clauses.length ≤
(failureCount F assignment (allIndices F) : ℝ) := by
rw [NameCompaction.verifier_failureCount]
have hreal : (a : ℝ) * F.clauses.length ≤
(b : ℝ) * (NameCompaction.failedCount F assignment : ℝ) := by
exact_mod_cast hgap assignment
rw [div_mul_eq_mul_div]
apply (div_le_iff₀ (Nat.cast_pos.mpr hb)).mpr
simpa only [mul_comm] using hreal
theorem clauseGap_of_count (F : Formula) (a b : ℕ) (hne : F.clauses ≠ [])
(hb : 0 < b)
(hgap : ∀ assignment : Fin F.«variables» → Bool,
a * F.clauses.length ≤ b * NameCompaction.failedCount F assignment) :
SourceGap.ClauseGap F ((a : ℚ) / (b : ℚ)) := by
refine ⟨hne, fun assignment => ?_⟩
simpa only [Rat.cast_div, Rat.cast_natCast] using
real_clause_gap_of_count F a b hb hgap assignment
variable {V E : Type*} {n m : ℕ}
theorem cnf_nonempty_of_nonempty_darts [Fintype E] [Nonempty E]
(G : ConstraintGraph V E FinalBooleanVerifier.Label)
(vertices : V ≃ Fin n) (edges : E ≃ Fin m) :
(FinalBooleanVerifier.cnf G vertices edges).clauses ≠ [] := by
have hcard : Fintype.card E = m := by
simpa only [Fintype.card_fin] using Fintype.card_congr edges
have hm : 0 < m := hcard ▸ Fintype.card_pos
exact FinalBooleanVerifier.cnf_nonempty G vertices edges hm
theorem cnf_clauseGap [Fintype E] [Nonempty E]
(G : ConstraintGraph V E FinalBooleanVerifier.Label)
(vertices : V ≃ Fin n) (edges : E ≃ Fin m) (a b : ℕ) (hb : 0 < b)
(hgap : ∀ labeling : V → FinalBooleanVerifier.Label,
a * Fintype.card E ≤ b * G.rejectionCount labeling) :
SourceGap.ClauseGap (FinalBooleanVerifier.cnf G vertices edges)
((a : ℚ) / ((b : ℚ) * 40960)) := by
have h := clauseGap_of_count (FinalBooleanVerifier.cnf G vertices edges) a (b * 40960)
(cnf_nonempty_of_nonempty_darts G vertices edges)
(Nat.mul_pos hb (by decide)) (FinalBooleanVerifier.cnf_gap G vertices edges a b hgap)
simpa only [Nat.cast_mul, Nat.cast_ofNat] using h
theorem cnf_clauseGap_unit [Fintype E] [Nonempty E]
(G : ConstraintGraph V E FinalBooleanVerifier.Label)
(vertices : V ≃ Fin n) (edges : E ≃ Fin m) (walkLength : ℕ)
(hwalk : 0 < walkLength)
(hgap : ∀ labeling : V → FinalBooleanVerifier.Label,
Fintype.card E ≤ walkLength * G.rejectionCount labeling) :
SourceGap.ClauseGap (FinalBooleanVerifier.cnf G vertices edges)
(1 / (40960 * (walkLength : ℚ))) := by
have h := cnf_clauseGap G vertices edges 1 walkLength hwalk
(by simpa only [one_mul] using hgap)
simpa only [Nat.cast_one, mul_comm] using h
end UniqueGames.Foundations.Hastad.SourceNonempty
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end OAI