File size: 3,284 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 | import Mathlib
import OAI.Computability.VertexCover.Machines.ExpanderStep
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.Machine.ExpandMachine
open UniqueGames.Foundations.PCP
@[simp] theorem lookup_fst_val {q v : ℕ} (T : ExpanderTables.Table v q) (x : Fin v × Fin q) :
(ExpanderTables.lookup T x).1.val = (lookup q (T.rows.toList.map Fin.val,(x.1.val,x.2.val))).1 :=
(congrArg Prod.fst (lookup_erase T x)).symm
@[simp] theorem lookup_snd_val {q v : ℕ} (T : ExpanderTables.Table v q) (x : Fin v × Fin q) :
(ExpanderTables.lookup T x).2.val = (lookup q (T.rows.toList.map Fin.val,(x.1.val,x.2.val))).2 :=
(congrArg Prod.snd (lookup_erase T x)).symm
@[simp] theorem index_val {v q : ℕ} (x : Fin v × Fin q) :
(ExpanderTables.rowIndex v q x).val=x.2.val+q*x.1.val := rfl
@[simp] theorem index_inv_fst {v q : ℕ} (i : Fin (v*q)) :
((ExpanderTables.rowIndex v q).symm i).1.val=i.val/q := rfl
@[simp] theorem index_inv_snd {v q : ℕ} (i : Fin (v*q)) :
((ExpanderTables.rowIndex v q).symm i).2.val=i.val%q := rfl
theorem stepRow_lookup {v d : ℕ} (T : ExpanderTables.Table v (d*d))
(H : ExpanderTables.Table ((d*d)*(d*d)) d) (i : Fin ((v*((d*d)*(d*d)))*(d*d))) :
stepRow d (H.rows.toList.map Fin.val) (erase ⟨v,T⟩,i.val) =
(ExpanderTables.rowIndex _ _ (ExpanderTables.stepLookup T H
((ExpanderTables.rowIndex _ _).symm i))).val := by
simp only [ExpanderTables.stepLookup,index_val,index_inv_fst,index_inv_snd,
lookup_fst_val,lookup_snd_val]
rfl
theorem stepRow_source {v d : ℕ} (T : ExpanderTables.Table v (d*d))
(H : ExpanderTables.Table ((d*d)*(d*d)) d) (i : Fin ((v*((d*d)*(d*d)))*(d*d))) :
stepRow d (H.rows.toList.map Fin.val) (erase ⟨v,T⟩,i.val) =
(ExpanderTables.step T H).rows[i].val := by
rw [stepRow_lookup,← ExpanderTables.lookup_step]
simp only [ExpanderTables.lookup,Equiv.apply_symm_apply,ExpanderTables.reverseIndex]
def step {d : ℕ} (H : ExpanderTables.Table ((d*d)*(d*d)) d) (T : Input (d*d)) : Input (d*d) :=
⟨T.1*((d*d)*(d*d)),ExpanderTables.step T.2 H⟩
theorem stepData_source {d : ℕ} (H : ExpanderTables.Table ((d*d)*(d*d)) d) (T : Input (d*d)) :
stepData d (H.rows.toList.map Fin.val) (erase T)=erase (step H T) := by
apply Prod.ext
· rfl
· apply List.ext_getElem
· simp [stepData,erase,step]
· intro i h₁ h₂
simp only [stepData,List.getElem_map,List.getElem_range,erase,step,Vector.getElem_toList]
exact stepRow_source T.2 H ⟨i, by simpa [stepData,erase] using h₁⟩
noncomputable def stepPoly {d : ℕ} (H : ExpanderTables.Table ((d*d)*(d*d)) d) :
Poly (code (q := d*d)) code (step H) :=
(stepDataPoly d (H.rows.toList.map Fin.val)).encodeCongr erase (fun _ => rfl) (fun T => by
change dataCode _ = dataCode _
rw [stepData_source])
end VertexCover.Machine.ExpandMachine
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
|