cfahlgren1/math / lean /OAI /Combinatorics /Sensitivity /RecursiveRepair.lean
cfahlgren1's picture
download
raw
4.7 kB
import OAI.Combinatorics.Sensitivity.RecursiveFailures
namespace OAI
/-! A successful raw-bit flip repairs the unique initial failed condition. -/
noncomputable section
open scoped Classical
namespace Paper320
theorem repaired_target_location {k r h : ℕ} {I : Type} (T : Tournament k)
(label : Fin k → Fin k → Fin r) (F : Fin (h + 1) → (I → Bool) → Bool)
(q : Fin h) (x : ((Fin k × Fin r) × I) → Bool)
(i j : Fin k) (c c' : Fin r) (a : I)
(hf : rowClause T label F q (flip x {((j, c), a)}) i = true)
(hz : F (Fin.last h) (recursiveChild x i c') = false) : (i, c') = (j, c) := by
by_contra hne
have ht := ((rowClause_eq_true_iff T label F q _ i).mp hf).1 c'
rw [recursiveChild_flip_other x j i c c' a hne, hz] at ht
exact Bool.false_ne_true ht
theorem repaired_gate_location {k r h : ℕ} {I : Type} (T : Tournament k)
(label : Fin k → Fin k → Fin r) (F : Fin (h + 1) → (I → Bool) → Bool)
(q : Fin h) (x : ((Fin k × Fin r) × I) → Bool)
(i j j' : Fin k) (c : Fin r) (a : I)
(hf : rowClause T label F q (flip x {((j, c), a)}) i = true)
(hij' : T.Adj i j') (hon : F (gateIndex q) (recursiveChild x j' (label i j')) = true) :
(j', label i j') = (j, c) := by
by_contra hne
have hg := ((rowClause_eq_true_iff T label F q _ i).mp hf).2 j' hij'
rw [recursiveChild_flip_other x j j' c (label i j') a hne, hon] at hg
exact Bool.false_ne_true hg.symm
theorem rowClause_repair_cases {k r h : ℕ} {I : Type} (T : Tournament k)
(label : Fin k → Fin k → Fin r) (F : Fin (h + 1) → (I → Bool) → Bool)
(q : Fin h) (x : ((Fin k × Fin r) × I) → Bool)
(i j : Fin k) (c : Fin r) (a : I)
(hi : rowClause T label F q x i = false)
(hf : rowClause T label F q (flip x {((j, c), a)}) i = true) :
(i ∈ targetCandidates T label F q x ∧ j = i ∧
F (Fin.last h) (recursiveChild x j c) = false ∧
F (Fin.last h) (flip (recursiveChild x j c) {a}) = true) ∨
(i ∈ gateCandidates T label F q x ∧ T.Adj i j ∧ c = label i j ∧
F (gateIndex q) (recursiveChild x j c) = true ∧
F (gateIndex q) (flip (recursiveChild x j c) {a}) = false) := by
have hchange : rowClause T label F q (flip x {((j, c), a)}) i ≠ rowClause T label F q x i := by
simp [hi, hf]
rcases rowClause_flip_change T label F q x i j c a hchange with
⟨hji, ht⟩ | ⟨hij, rfl, hg⟩
· subst j
have hton := ((rowClause_eq_true_iff T label F q _ i).mp hf).1 c
rw [recursiveChild_flip_same] at hton
have htoff : F (Fin.last h) (recursiveChild x i c) = false := by
cases hc : F (Fin.last h) (recursiveChild x i c)
· rfl
· exact False.elim (ht (hton.trans hc.symm))
have htargets : targetFailures F x i = {c} := by
ext c'
simp only [targetFailures, Finset.mem_filter, Finset.mem_univ, true_and, Finset.mem_singleton]
constructor
· intro hfalse
exact congrArg Prod.snd (repaired_target_location T label F q x i i c c' a hf hfalse)
· rintro rfl
exact htoff
have hgates : gateFailures T label F q x i = ∅ := by
apply Finset.eq_empty_iff_forall_notMem.mpr
intro j' hj'
have h := (Finset.mem_filter.mp hj').2
have heq := repaired_gate_location T label F q x i i j' c a hf h.1 h.2
exact T.ne_of_adj h.1 (congrArg Prod.fst heq).symm
have hmem : i ∈ targetCandidates T label F q x := by
simp [targetCandidates, htargets, hgates]
exact Or.inl ⟨hmem, rfl, htoff, hton⟩
· have hgoff := ((rowClause_eq_true_iff T label F q _ i).mp hf).2 j hij
rw [recursiveChild_flip_same] at hgoff
have hgon : F (gateIndex q) (recursiveChild x j (label i j)) = true := by
cases hc : F (gateIndex q) (recursiveChild x j (label i j))
· exact False.elim (hg (hgoff.trans hc.symm))
· rfl
have htargets : targetFailures F x i = ∅ := by
apply Finset.eq_empty_iff_forall_notMem.mpr
intro c' hc'
have heq := repaired_target_location T label F q x i j (label i j) c' a hf
(Finset.mem_filter.mp hc').2
exact T.ne_of_adj hij (congrArg Prod.fst heq)
have hgates : gateFailures T label F q x i = {j} := by
ext j'
simp only [gateFailures, Finset.mem_filter, Finset.mem_univ, true_and, Finset.mem_singleton]
constructor
· rintro ⟨hij', hon⟩
exact congrArg Prod.fst (repaired_gate_location T label F q x i j j' (label i j) a hf hij' hon)
· rintro rfl
exact ⟨hij, hgon⟩
have hmem : i ∈ gateCandidates T label F q x := by
simp [gateCandidates, htargets, hgates]
exact Or.inr ⟨hmem, hij, rfl, hgon, hgoff⟩
end Paper320
end
end OAI

Xet Storage Details

Size:
4.7 kB
·
Xet hash:
10dbda3945644a87cf2e6c9db414088c91ad93f7208ad151bc5757d9ba0c876f

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.