File size: 4,366 Bytes
92416a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
import Mathlib
import OAI.Computability.VertexCover.PCP.TableGapReduction
import OAI.Computability.VertexCover.Reduction.SimpleParallel

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
section
namespace VertexCover.LabelCover

theorem value_le_of_counts (Φ : LabelCover) (σ : ℝ)
    (h : ∀ A : Φ.Labeling, (Φ.satisfiedCount A : ℝ) ≤ σ * Φ.M) : Φ.value ≤ σ := by
  classical
  obtain ⟨A, _, hA⟩ := Finset.exists_mem_eq_sup (Finset.univ : Finset Φ.Labeling)
    ⟨Φ.defaultLabeling, Finset.mem_univ _⟩ Φ.satisfiedCount
  apply (div_le_iff₀ (Nat.cast_pos.mpr Φ.M_pos)).mpr
  change ((Finset.univ.sup Φ.satisfiedCount : ℕ) : ℝ) ≤ _
  rw [hA]
  exact h A

def ParallelCoherent (Φ : LabelCover) : Prop :=
  ∀ e e', Φ.left e = Φ.left e' → Φ.right e = Φ.right e' → Φ.projection e = Φ.projection e'

end VertexCover.LabelCover

namespace VertexCover.ClauseProjection
open UniqueGames.Foundations
open Target

theorem failureCount_eq_sum (F : Formula) (a : Fin F.«variables» → Bool)
    (indices : List (Fin F.clauses.length)) :
    PCP.failureCount F a indices =
      (indices.map (fun i => if (F.clauses.get i).eval a = false then 1 else 0)).sum := by
  induction indices with
  | nil => rfl
  | cons i rest ih =>
      simp only [PCP.failureCount, List.map_cons, List.sum_cons, ih]
      congr 1
      unfold PCP.clauseFailure PCP.clauseAt
      change (if (F.clauses.get i).eval a = true then 0 else 1) = _
      cases (F.clauses.get i).eval a <;> rfl

theorem failureCount_all (F : Formula) (a : Fin F.«variables» → Bool) :
    PCP.failureCount F a (PCP.allIndices F) = (unsatisfiedClauses F a).card := by
  rw [failureCount_eq_sum]
  simp only [PCP.allIndices, List.finRange, List.map_ofFn, List.sum_ofFn, Function.comp_apply]
  exact (Finset.card_filter _ _).symm

theorem simple_value_le (F : Formula) (η : ℚ) (hgap : Hastad.SourceGap.ClauseGap F η) :
    (simpleGame F hgap.1).value ≤ 1 - (η : ℝ) / 3 := by
  classical
  apply LabelCover.value_le_of_counts
  intro A
  have hbad := hgap.2 (assignmentOf F hgap.1 (decodedLabeling F hgap.1 A))
  rw [failureCount_all] at hbad
  have hreject := simple_rejection_count F hgap.1 A
  have hrejectR := Nat.cast_le (α := ℝ) |>.mpr hreject
  have hpart := Finset.card_filter_add_card_filter_not ((simpleGame F hgap.1).Satisfies A)
    (s := Finset.univ)
  have hpartR : ((simpleGame F hgap.1).satisfiedCount A : ℝ) +
      ((Finset.univ.filter (fun e => ¬(simpleGame F hgap.1).Satisfies A e)).card : ℝ) =
      (F.clauses.length : ℝ) * 3 := by
    simp only [Finset.card_univ, Fintype.card_fin] at hpart
    change (simpleGame F hgap.1).satisfiedCount A + _ = F.clauses.length * 3 at hpart
    exact_mod_cast hpart
  change ((simpleGame F hgap.1).satisfiedCount A : ℝ) ≤
    (1 - (η : ℝ) / 3) * ((F.clauses.length * 3 : ℕ) : ℝ)
  push_cast
  nlinarith

noncomputable def fixedBaseTable : PCP.RoundTables.BaseTable :=
  PCP.ExpanderTables.exists_base_table.choose

theorem fixedBaseTable_certificate :
    PCP.SpectralReturn.SpectralCertificate (PCP.ExpanderTables.graph fixedBaseTable) (1/100 : ℝ) :=
  PCP.ExpanderTables.exists_base_table.choose_spec

noncomputable def baseReduction (F : Formula) : LabelCover :=
  simpleGame (PCP.TableIteration.gapMap fixedBaseTable F)
    (PCP.TableIteration.gapMap_nonempty fixedBaseTable F)

theorem baseReduction_complete (F : Formula) (hF : F.Satisfiable) :
    ∃ A : (baseReduction F).Labeling, ∀ e, (baseReduction F).Satisfies A e :=
  simple_perfect_complete _ _ (PCP.TableIteration.gapMap_completeness fixedBaseTable F hF)

theorem baseReduction_sound (F : Formula) (hF : ¬F.Satisfiable) :
    (baseReduction F).value ≤ 1 - (PCP.PCPIteration.finalClauseGap : ℝ) / 3 :=
  simple_value_le _ _ (PCP.TableGapReduction.gapMap_clauseGap fixedBaseTable
    fixedBaseTable_certificate F hF)

theorem baseReduction_coherent (F : Formula) : (baseReduction F).ParallelCoherent :=
  simple_parallel _ _

end VertexCover.ClauseProjection


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

end OAI