Download data/lean/OAI/Computability/DirectedFeedback/RankGraph/CloneGap.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 37.7 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/DirectedFeedback/RankGraph/CloneGap.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/DirectedFeedback/RankGraph/CloneGap.lean
-
curl -L -o CloneGap.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/DirectedFeedback/RankGraph/CloneGap.lean
37.7 kB
| import Mathlib | |
| import OAI.Computability.DirectedFeedback.Machines.ContextLoad | |
| namespace OAI | |
| namespace DFVSGames.Reduction.CloneGap | |
| variable {Element OtherElement : Type*} | |
| def cart (xs : List Element) (ys : List OtherElement) : List (Element Ć OtherElement) := | |
| xs.flatMap fun x => ys.map fun y => (x, y) | |
| theorem count_const (xs : List Element) (b : Bool) : | |
| xs.countP (fun _ => b) = if b then xs.length else 0 := by | |
| cases b <;> simp | |
| theorem count_cart (xs : List Element) (ys : List OtherElement) | |
| (p : Element ā Bool) (q : OtherElement ā Bool) : | |
| (cart xs ys).countP (fun z => p z.1 && q z.2) = | |
| xs.countP p * ys.countP q := by | |
| induction xs with | |
| | nil => simp [cart] | |
| | cons x xs ih => | |
| simp only [cart, List.flatMap_cons, List.countP_append] at * | |
| rw [ih] | |
| cases h : p x <;> | |
| simp [List.countP_map, Function.comp_def, h, Nat.add_mul, Nat.add_comm] | |
| theorem length_cart (xs : List Element) (ys : List OtherElement) : | |
| (cart xs ys).length = xs.length * ys.length := by | |
| have := count_cart xs ys (fun _ => true) (fun _ => true) | |
| simpa using this | |
| theorem count_cart_left (xs : List Element) (ys : List OtherElement) (p : Element ā Bool) : | |
| (cart xs ys).countP (fun z => p z.1) = xs.countP p * ys.length := by | |
| simpa using count_cart xs ys p (fun _ => true) | |
| theorem count_cart_right (xs : List Element) (ys : List OtherElement) (p : OtherElement ā Bool) : | |
| (cart xs ys).countP (fun z => p z.2) = xs.length * ys.countP p := by | |
| simpa using count_cart xs ys (fun _ => true) p | |
| theorem count_cart_le (xs : List Element) (ys : List OtherElement) | |
| (p : Element Ć OtherElement ā Bool) | |
| (bound : Nat) (h : ā x ā xs, ys.countP (fun y => p (x, y)) ⤠bound) : | |
| (cart xs ys).countP p ⤠xs.length * bound := by | |
| induction xs with | |
| | nil => simp [cart] | |
| | cons x xs ih => | |
| have hx := h x (by simp) | |
| have ht := ih (fun y hy => h y (by simp [hy])) | |
| simp only [cart, List.flatMap_cons, List.countP_append, List.countP_map, | |
| Function.comp_def] at * | |
| simp only [List.length_cons, Nat.add_mul] | |
| omega | |
| theorem count_union_le (xs : List Element) (p q : Element ā Bool) : | |
| xs.countP (fun x => p x || q x) ⤠xs.countP p + xs.countP q := by | |
| induction xs with | |
| | nil => simp | |
| | cons x xs ih => | |
| cases hp : p x <;> cases hq : q x <;> | |
| simp [hp, hq] at * <;> omega | |
| theorem count_remove (xs : List Element) (p q : Element ā Bool) : | |
| xs.countP p ⤠xs.countP (fun x => p x && !q x) + xs.countP q := by | |
| induction xs with | |
| | nil => simp | |
| | cons x xs ih => | |
| cases hp : p x <;> cases hq : q x <;> | |
| simp [hp, hq] at * <;> omega | |
| abbrev Index := Nat | |
| def indices : List Index := List.range 48 | |
| def triples : List (Index Ć Index Ć Index) := cart indices (cart indices indices) | |
| def collision (t : Index Ć Index Ć Index) : Bool := | |
| (t.1 == t.2.1) || (t.1 == t.2.2) || (t.2.1 == t.2.2) | |
| def distinctTriples : List (Index Ć Index Ć Index) := triples.filter (fun t => !collision t) | |
| theorem length_indices : indices.length = 48 := by simp [indices] | |
| theorem length_triples : triples.length = 110592 := by | |
| simp [triples, length_cart, length_indices] | |
| theorem count_index_eq_le (i : Index) : indices.countP (fun j => i == j) ⤠1 := by | |
| have h := List.count_range (a := i) (n := 48) | |
| have heq : (fun j => i == j) = (fun j => j == i) := by | |
| funext j | |
| exact Bool.beq_comm | |
| rw [heq] | |
| change (List.range 48).count i ⤠1 | |
| rw [h] | |
| split <;> omega | |
| theorem count_collision_le : triples.countP collision ⤠6912 := by | |
| have h12 : triples.countP (fun t => t.1 == t.2.1) ⤠2304 := by | |
| apply count_cart_le indices (cart indices indices) _ 48 | |
| intro i _ | |
| change (cart indices indices).countP (fun y => i == y.1) ⤠48 | |
| rw [count_cart_left indices indices (fun j => i == j), length_indices] | |
| have := count_index_eq_le i | |
| omega | |
| have h13 : triples.countP (fun t => t.1 == t.2.2) ⤠2304 := by | |
| apply count_cart_le indices (cart indices indices) _ 48 | |
| intro i _ | |
| change (cart indices indices).countP (fun y => i == y.2) ⤠48 | |
| rw [count_cart_right indices indices (fun j => i == j), length_indices] | |
| have := count_index_eq_le i | |
| omega | |
| have h23 : triples.countP (fun t => t.2.1 == t.2.2) ⤠2304 := by | |
| change (cart indices (cart indices indices)).countP (fun t => t.2.1 == t.2.2) ⤠2304 | |
| rw [count_cart_right indices (cart indices indices) (fun t => t.1 == t.2), length_indices] | |
| have h : (cart indices indices).countP (fun t => t.1 == t.2) ⤠48 := by | |
| apply count_cart_le indices indices _ 1 | |
| intro i _ | |
| exact count_index_eq_le i | |
| omega | |
| have hA := count_union_le triples (fun t => t.1 == t.2.1) (fun t => t.1 == t.2.2) | |
| have hB := count_union_le triples | |
| (fun t => (t.1 == t.2.1) || (t.1 == t.2.2)) (fun t => t.2.1 == t.2.2) | |
| unfold collision | |
| omega | |
| theorem majority_exists (g : Index ā Bool) : | |
| ā b : Bool, 24 ⤠indices.countP (fun i => g i == b) := by | |
| have h := List.length_eq_countP_add_countP g (l := indices) | |
| have hn : (fun i => decide (¬g i = true)) = (fun i => !g i) := by | |
| funext i | |
| cases g i <;> rfl | |
| rw [hn] at h | |
| rw [length_indices] at h | |
| by_cases ht : 24 ⤠indices.countP g | |
| Ā· exact āØtrue, by simpa using htā© | |
| Ā· refine āØfalse, ?_ā© | |
| have : 24 ⤠indices.countP (fun i => !g i) := by omega | |
| simpa using this | |
| def allAgree (p q r : Index ā Bool) (t : Index Ć Index Ć Index) : Bool := | |
| p t.1 && (q t.2.1 && r t.2.2) | |
| theorem count_agree_distinct (p q r : Index ā Bool) | |
| (hp : 24 ⤠indices.countP p) (hq : 24 ⤠indices.countP q) | |
| (hr : 24 ⤠indices.countP r) : | |
| 6912 ⤠distinctTriples.countP (allAgree p q r) := by | |
| have hprod := count_cart indices (cart indices indices) p | |
| (fun t => q t.1 && r t.2) | |
| rw [count_cart] at hprod | |
| have h1 : 24 * 24 ⤠indices.countP q * indices.countP r := Nat.mul_le_mul hq hr | |
| have h2 : 24 * (24 * 24) ⤠indices.countP p * | |
| (indices.countP q * indices.countP r) := Nat.mul_le_mul hp h1 | |
| have hremove := count_remove triples (allAgree p q r) collision | |
| have hcollision := count_collision_le | |
| change triples.countP (allAgree p q r) = _ at hprod | |
| unfold distinctTriples | |
| rw [List.countP_filter] | |
| omega | |
| structure Equation (Name : Type) where | |
| first : Name | |
| second : Name | |
| third : Name | |
| rhs : Bool | |
| variable {Name : Type} | |
| def satisfied (e : Equation Name) (g : Name ā Bool) : Bool := | |
| (xor (xor (g e.first) (g e.second)) (g e.third)) == e.rhs | |
| def clone (e : Equation Name) (t : Index Ć Index Ć Index) : Equation (Name Ć Index) := | |
| āØ(e.first, t.1), (e.second, t.2.1), (e.third, t.2.2), e.rhsā© | |
| theorem lift_preserves (e : Equation Name) (t : Index Ć Index Ć Index) (g : Name ā Bool) : | |
| satisfied (clone e t) (fun z => g z.1) = satisfied e g := rfl | |
| theorem clone_names_distinct (e : Equation Name) (t : Index Ć Index Ć Index) | |
| (h : collision t = false) : | |
| (clone e t).first ā (clone e t).second ā§ | |
| (clone e t).first ā (clone e t).third ā§ | |
| (clone e t).second ā (clone e t).third := by | |
| simp only [collision, Bool.or_eq_false_iff, beq_eq_false_iff_ne] at h | |
| dsimp [clone] | |
| exact āØfun he => h.1.1 (congrArg Prod.snd he), | |
| fun he => h.1.2 (congrArg Prod.snd he), | |
| fun he => h.2 (congrArg Prod.snd he)ā© | |
| theorem agree_failure (e : Equation Name) (g : Name Ć Index ā Bool) | |
| (majority : Name ā Bool) (t : Index Ć Index Ć Index) | |
| (hfail : satisfied e majority = false) | |
| (h : allAgree (fun i => g (e.first, i) == majority e.first) | |
| (fun i => g (e.second, i) == majority e.second) | |
| (fun i => g (e.third, i) == majority e.third) t = true) : | |
| satisfied (clone e t) g = false := by | |
| simp only [allAgree, Bool.and_eq_true, beq_iff_eq] at h | |
| simpa [satisfied, clone, h.1, h.2.1, h.2.2] using hfail | |
| theorem failed_occurrence_clones (e : Equation Name) (g : Name Ć Index ā Bool) | |
| (majority : Name ā Bool) | |
| (hmaj : ā v, 24 ⤠indices.countP (fun i => g (v, i) == majority v)) | |
| (hfail : satisfied e majority = false) : | |
| 6912 ⤠distinctTriples.countP (fun t => !satisfied (clone e t) g) := by | |
| have h := count_agree_distinct | |
| (fun i => g (e.first, i) == majority e.first) | |
| (fun i => g (e.second, i) == majority e.second) | |
| (fun i => g (e.third, i) == majority e.third) | |
| (hmaj _) (hmaj _) (hmaj _) | |
| apply Nat.le_trans h | |
| apply List.countP_mono_left | |
| intro t _ ht | |
| have hf := agree_failure e g majority t hfail ht | |
| simp [hf] | |
| def majorityBit (g : Index ā Bool) : Bool := decide (24 ⤠indices.countP g) | |
| theorem majorityBit_count (g : Index ā Bool) : | |
| 24 ⤠indices.countP (fun i => g i == majorityBit g) := by | |
| have h := List.length_eq_countP_add_countP g (l := indices) | |
| have hn : (fun i => decide (¬g i = true)) = (fun i => !g i) := by | |
| funext i | |
| cases g i <;> rfl | |
| rw [hn, length_indices] at h | |
| by_cases ht : 24 ⤠indices.countP g | |
| Ā· simp [majorityBit, ht] | |
| · have hn : 24 ⤠indices.countP (fun i => !g i) := by omega | |
| simpa [majorityBit, ht] using hn | |
| def cloneList (source : List (Equation Name)) : List (Equation (Name Ć Index)) := | |
| source.flatMap fun e => distinctTriples.map (clone e) | |
| theorem length_cloneList (source : List (Equation Name)) : | |
| (cloneList source).length = source.length * distinctTriples.length := by | |
| induction source with | |
| | nil => simp [cloneList] | |
| | cons e es ih => | |
| simp only [cloneList, List.flatMap_cons, List.length_append, List.length_map] at * | |
| rw [ih] | |
| simp [Nat.add_mul, Nat.add_comm] | |
| theorem cloneList_failure_lower (source : List (Equation Name)) | |
| (g : Name Ć Index ā Bool) (majority : Name ā Bool) | |
| (hmaj : ā v, 24 ⤠indices.countP (fun i => g (v, i) == majority v)) : | |
| 6912 * source.countP (fun e => !satisfied e majority) ⤠| |
| (cloneList source).countP (fun e => !satisfied e g) := by | |
| induction source with | |
| | nil => simp [cloneList] | |
| | cons e es ih => | |
| simp only [cloneList, List.flatMap_cons, List.countP_append, | |
| List.countP_map, Function.comp_def] at * | |
| cases hf : satisfied e majority with | |
| | false => | |
| have he := failed_occurrence_clones e g majority hmaj hf | |
| simp [hf, Nat.mul_add] at * | |
| omega | |
| | true => | |
| simp [hf] | |
| omega | |
| theorem clone_gap (source : List (Equation Name)) | |
| (source_gap : ā A : Name ā Bool, | |
| source.length ⤠4 * source.countP (fun e => !satisfied e A)) | |
| (g : Name Ć Index ā Bool) : | |
| (cloneList source).length ⤠| |
| 64 * (cloneList source).countP (fun e => !satisfied e g) := by | |
| let majority : Name ā Bool := fun v => majorityBit (fun i => g (v, i)) | |
| have hmaj : ā v, 24 ⤠indices.countP (fun i => g (v, i) == majority v) := | |
| fun v => majorityBit_count (fun i => g (v, i)) | |
| have hlocal := cloneList_failure_lower source g majority hmaj | |
| have hsource := source_gap majority | |
| have hd : distinctTriples.length ⤠110592 := by | |
| exact Nat.le_trans (List.length_filter_le _ triples) (by simp [length_triples]) | |
| rw [length_cloneList] | |
| have hlength := Nat.mul_le_mul_left source.length hd | |
| have hs := Nat.mul_le_mul_right 27648 hsource | |
| have hc := Nat.mul_le_mul_left 64 hlocal | |
| omega | |
| theorem clone_completeness_count (source : List (Equation Name)) (A : Name ā Bool) : | |
| (cloneList source).countP (fun e => satisfied e (fun z => A z.1)) = | |
| source.countP (fun e => satisfied e A) * distinctTriples.length := by | |
| induction source with | |
| | nil => simp [cloneList] | |
| | cons e es ih => | |
| simp only [cloneList, List.flatMap_cons, List.countP_append, | |
| List.countP_map, Function.comp_def] at * | |
| rw [ih] | |
| have he : (fun t => satisfied (clone e t) (fun z => A z.1)) = | |
| (fun _ => satisfied e A) := by | |
| funext t | |
| exact lift_preserves e t A | |
| rw [he, count_const] | |
| cases h : satisfied e A <;> simp [h, Nat.add_mul, Nat.add_comm] | |
| end DFVSGames.Reduction.CloneGap | |
| namespace DFVSGames.Foundations.Hastad.FoldedEquation | |
| open DFVSGames.Reduction.CloneGap | |
| open scoped BigOperators | |
| variable {I J : Type} [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] | |
| abbrev Address (iā : I) (jā : J) := HalfCube iā ā HalfCube jā | |
| def storedAssignment {iā : I} {jā : J} | |
| (tableA : HalfCube iā ā Bool) (tableB : HalfCube jā ā Bool) : | |
| Address iā jā ā Bool := Sum.elim tableA tableB | |
| def rhsCorrection (Ļ : J ā I) (iā : I) (jā : J) | |
| (f : Cube I) (μ : Cube J) : Bool := f iā ^^ f (Ļ jā) ^^ μ jā | |
| omit [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] in | |
| theorem correction_eq (Ļ : J ā I) (iā : I) (jā : J) | |
| (f : Cube I) (g μ : Cube J) : | |
| (f iā ^^ g jā ^^ thirdQuery Ļ f g μ jā) = rhsCorrection Ļ iā jā f μ := by | |
| change (f iā ^^ g jā ^^ (g jā ^^ (f (Ļ jā) ^^ μ jā))) = | |
| (f iā ^^ f (Ļ jā) ^^ μ jā) | |
| cases f iā <;> cases g jā <;> cases f (Ļ jā) <;> cases μ jā <;> rfl | |
| def equation (Ļ : J ā I) (iā : I) (jā : J) | |
| (f : Cube I) (g μ : Cube J) : Equation (Address iā jā) where | |
| first := .inl (canonicalInput iā f) | |
| second := .inr (canonicalInput jā g) | |
| third := .inr (canonicalInput jā (thirdQuery Ļ f g μ)) | |
| rhs := rhsCorrection Ļ iā jā f μ | |
| theorem xor_corrections (a b c u v w : Bool) : | |
| ((a ^^ b ^^ c) == (u ^^ v ^^ w)) = | |
| !((a ^^ u) ^^ (b ^^ v) ^^ (c ^^ w)) := by | |
| cases a <;> cases b <;> cases c <;> cases u <;> cases v <;> cases w <;> rfl | |
| omit [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] in | |
| theorem equation_satisfied (Ļ : J ā I) (iā : I) (jā : J) | |
| (tableA : HalfCube iā ā Bool) (tableB : HalfCube jā ā Bool) | |
| (f : Cube I) (g μ : Cube J) : | |
| satisfied (equation Ļ iā jā f g μ) (storedAssignment tableA tableB) = | |
| !(foldedAnswer iā tableA f ^^ foldedAnswer jā tableB g ^^ | |
| foldedAnswer jā tableB (thirdQuery Ļ f g μ)) := by | |
| change ((tableA (canonicalInput iā f) ^^ tableB (canonicalInput jā g) ^^ | |
| tableB (canonicalInput jā (thirdQuery Ļ f g μ))) == rhsCorrection Ļ iā jā f μ) = _ | |
| rw [ā correction_eq Ļ iā jā f g μ] | |
| exact xor_corrections _ _ _ _ _ _ | |
| omit [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] in | |
| theorem equation_satisfied_iff (Ļ : J ā I) (iā : I) (jā : J) | |
| (tableA : HalfCube iā ā Bool) (tableB : HalfCube jā ā Bool) | |
| (f : Cube I) (g μ : Cube J) : | |
| satisfied (equation Ļ iā jā f g μ) (storedAssignment tableA tableB) = true ā | |
| (foldedAnswer iā tableA f ^^ foldedAnswer jā tableB g ^^ | |
| foldedAnswer jā tableB (thirdQuery Ļ f g μ)) = false := by | |
| rw [equation_satisfied] | |
| simp | |
| omit [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] in | |
| theorem equation_indicator (Ļ : J ā I) (iā : I) (jā : J) | |
| (tableA : HalfCube iā ā Bool) (tableB : HalfCube jā ā Bool) | |
| (f : Cube I) (g μ : Cube J) : | |
| (if satisfied (equation Ļ iā jā f g μ) (storedAssignment tableA tableB) | |
| then (1 : ā) else 0) = | |
| (if foldedAnswer iā tableA f ^^ foldedAnswer jā tableB g ^^ | |
| foldedAnswer jā tableB (thirdQuery Ļ f g μ) then 0 else 1) := by | |
| rw [equation_satisfied] | |
| cases foldedAnswer iā tableA f ^^ foldedAnswer jā tableB g ^^ | |
| foldedAnswer jā tableB (thirdQuery Ļ f g μ) <;> rfl | |
| theorem satisfied_repeated_right {Name : Type} (e : Equation Name) | |
| (assignment : Name ā Bool) (h : e.second = e.third) : | |
| satisfied e assignment = (assignment e.first == e.rhs) := by | |
| unfold satisfied | |
| rw [ā h] | |
| cases assignment e.first <;> cases assignment e.second <;> cases e.rhs <;> rfl | |
| omit [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] in | |
| theorem equation_repeated_right (Ļ : J ā I) (iā : I) (jā : J) | |
| (tableA : HalfCube iā ā Bool) (tableB : HalfCube jā ā Bool) | |
| (f : Cube I) (g μ : Cube J) | |
| (h : canonicalInput jā g = canonicalInput jā (thirdQuery Ļ f g μ)) : | |
| satisfied (equation Ļ iā jā f g μ) (storedAssignment tableA tableB) = | |
| (tableA (canonicalInput iā f) == rhsCorrection Ļ iā jā f μ) := by | |
| apply satisfied_repeated_right | |
| exact congrArg Sum.inr h | |
| omit [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] in | |
| theorem restrict_thirdQuery (valid : J ā Bool) (Ļ : J ā I) | |
| (f : Cube I) (g μ : Cube J) : | |
| restrictQuery valid (thirdQuery Ļ f g μ) = | |
| thirdQuery (fun j : {j : J // valid j = true} => Ļ j.val) f | |
| (restrictQuery valid g) (restrictQuery valid μ) := rfl | |
| def conditionedEquation (valid : J ā Bool) (Ļ : J ā I) | |
| (iā : I) (jā : {j : J // valid j = true}) | |
| (f : Cube I) (g μ : Cube J) : Equation (Address iā jā) := | |
| equation (fun j => Ļ j.val) iā jā f (restrictQuery valid g) (restrictQuery valid μ) | |
| omit [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] in | |
| theorem conditionedEquation_rhs (valid : J ā Bool) (Ļ : J ā I) | |
| (iā : I) (jā : {j : J // valid j = true}) (f : Cube I) (g μ : Cube J) : | |
| (conditionedEquation valid Ļ iā jā f g μ).rhs = | |
| (f iā ^^ f (Ļ jā.val) ^^ μ jā.val) := rfl | |
| omit [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] in | |
| theorem conditionedEquation_satisfied (valid : J ā Bool) (Ļ : J ā I) | |
| (iā : I) (jā : {j : J // valid j = true}) | |
| (tableA : HalfCube iā ā Bool) (tableB : HalfCube jā ā Bool) | |
| (f : Cube I) (g μ : Cube J) : | |
| satisfied (conditionedEquation valid Ļ iā jā f g μ) (storedAssignment tableA tableB) = | |
| !(foldedAnswer iā tableA f ^^ conditionedFoldedAnswer valid jā tableB g ^^ | |
| conditionedFoldedAnswer valid jā tableB (thirdQuery Ļ f g μ)) := by | |
| unfold conditionedEquation | |
| rw [equation_satisfied] | |
| simp only [conditionedFoldedAnswer, restrict_thirdQuery] | |
| omit [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] in | |
| theorem conditionedEquation_satisfied_iff (valid : J ā Bool) (Ļ : J ā I) | |
| (iā : I) (jā : {j : J // valid j = true}) | |
| (tableA : HalfCube iā ā Bool) (tableB : HalfCube jā ā Bool) | |
| (f : Cube I) (g μ : Cube J) : | |
| satisfied (conditionedEquation valid Ļ iā jā f g μ) (storedAssignment tableA tableB) = true ā | |
| (foldedAnswer iā tableA f ^^ conditionedFoldedAnswer valid jā tableB g ^^ | |
| conditionedFoldedAnswer valid jā tableB (thirdQuery Ļ f g μ)) = false := by | |
| rw [conditionedEquation_satisfied] | |
| simp | |
| omit [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] in | |
| theorem conditionedEquation_indicator (valid : J ā Bool) (Ļ : J ā I) | |
| (iā : I) (jā : {j : J // valid j = true}) | |
| (tableA : HalfCube iā ā Bool) (tableB : HalfCube jā ā Bool) | |
| (f : Cube I) (g μ : Cube J) : | |
| (if satisfied (conditionedEquation valid Ļ iā jā f g μ) (storedAssignment tableA tableB) | |
| then (1 : ā) else 0) = | |
| (if foldedAnswer iā tableA f ^^ conditionedFoldedAnswer valid jā tableB g ^^ | |
| conditionedFoldedAnswer valid jā tableB (thirdQuery Ļ f g μ) then 0 else 1) := by | |
| rw [conditionedEquation_satisfied] | |
| cases foldedAnswer iā tableA f ^^ conditionedFoldedAnswer valid jā tableB g ^^ | |
| conditionedFoldedAnswer valid jā tableB (thirdQuery Ļ f g μ) <;> rfl | |
| omit [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] in | |
| theorem conditionedEquation_repeated_right (valid : J ā Bool) (Ļ : J ā I) | |
| (iā : I) (jā : {j : J // valid j = true}) | |
| (tableA : HalfCube iā ā Bool) (tableB : HalfCube jā ā Bool) | |
| (f : Cube I) (g μ : Cube J) | |
| (h : canonicalInput jā (restrictQuery valid g) = | |
| canonicalInput jā (restrictQuery valid (thirdQuery Ļ f g μ))) : | |
| satisfied (conditionedEquation valid Ļ iā jā f g μ) (storedAssignment tableA tableB) = | |
| (tableA (canonicalInput iā f) == (f iā ^^ f (Ļ jā.val) ^^ μ jā.val)) := by | |
| apply satisfied_repeated_right | |
| exact congrArg Sum.inr h | |
| noncomputable section | |
| def equationAcceptance (ε : ā) (Ļ : J ā I) (iā : I) (jā : J) | |
| (tableA : HalfCube iā ā Bool) (tableB : HalfCube jā ā Bool) : ā := | |
| š¼ f, ā μ, noiseWeight ε μ * | |
| (š¼ g, if satisfied (equation Ļ iā jā f g μ) (storedAssignment tableA tableB) | |
| then (1 : ā) else 0) | |
| theorem equationAcceptance_eq (ε : ā) (Ļ : J ā I) (iā : I) (jā : J) | |
| (tableA : HalfCube iā ā Bool) (tableB : HalfCube jā ā Bool) : | |
| equationAcceptance ε Ļ iā jā tableA tableB = | |
| testAcceptance ε Ļ (foldedAnswer iā tableA) (foldedAnswer jā tableB) := by | |
| unfold equationAcceptance testAcceptance | |
| simp_rw [equation_indicator] | |
| def conditionedEquationAcceptance (ε : ā) (valid : J ā Bool) (Ļ : J ā I) | |
| (iā : I) (jā : {j : J // valid j = true}) | |
| (tableA : HalfCube iā ā Bool) (tableB : HalfCube jā ā Bool) : ā := | |
| š¼ f, ā μ, noiseWeight ε μ * | |
| (š¼ g, if satisfied (conditionedEquation valid Ļ iā jā f g μ) | |
| (storedAssignment tableA tableB) then (1 : ā) else 0) | |
| theorem conditionedEquationAcceptance_eq (ε : ā) (valid : J ā Bool) (Ļ : J ā I) | |
| (iā : I) (jā : {j : J // valid j = true}) | |
| (tableA : HalfCube iā ā Bool) (tableB : HalfCube jā ā Bool) : | |
| conditionedEquationAcceptance ε valid Ļ iā jā tableA tableB = | |
| testAcceptance ε Ļ (foldedAnswer iā tableA) | |
| (conditionedFoldedAnswer valid jā tableB) := by | |
| unfold conditionedEquationAcceptance testAcceptance | |
| simp_rw [conditionedEquation_indicator] | |
| end | |
| end DFVSGames.Foundations.Hastad.FoldedEquation | |
| namespace DFVSGames.Foundations.Hastad | |
| open DFVSGames.Reduction.CloneGap | |
| open scoped BigOperators | |
| def mapEquation {Name Name' : Type} (rename : Name ā Name') | |
| (e : Equation Name) : Equation Name' where | |
| first := rename e.first | |
| second := rename e.second | |
| third := rename e.third | |
| rhs := e.rhs | |
| theorem satisfied_mapEquation {Name Name' : Type} (rename : Name ā Name') | |
| (e : Equation Name) (assignment : Name' ā Bool) : | |
| satisfied (mapEquation rename e) assignment = satisfied e (assignment ā rename) := rfl | |
| namespace EmptyContext | |
| variable {I : Type} [Fintype I] [DecidableEq I] | |
| abbrev Address (iā : I) := HalfCube iā ā Unit | |
| def storedAssignment {iā : I} (table : HalfCube iā ā Bool) (dummy : Bool) : | |
| Address iā ā Bool := Sum.elim table (fun _ => dummy) | |
| def equation (iā : I) (f : Cube I) : Equation (Address iā) where | |
| first := .inl (canonicalInput iā f) | |
| second := .inr () | |
| third := .inr () | |
| rhs := f iā | |
| omit [Fintype I] [DecidableEq I] in | |
| @[simp] theorem equation_second_eq_third (iā : I) (f : Cube I) : | |
| (equation iā f).second = (equation iā f).third := rfl | |
| omit [Fintype I] [DecidableEq I] in | |
| theorem equation_satisfied (iā : I) (assignment : Address iā ā Bool) (f : Cube I) : | |
| satisfied (equation iā f) assignment = | |
| !(foldedAnswer iā (fun h => assignment (.inl h)) f) := by | |
| rw [FoldedEquation.satisfied_repeated_right (equation iā f) assignment rfl] | |
| change (assignment (.inl (canonicalInput iā f)) == f iā) = | |
| !(assignment (.inl (canonicalInput iā f)) ^^ f iā) | |
| cases assignment (.inl (canonicalInput iā f)) <;> cases f iā <;> rfl | |
| omit [Fintype I] [DecidableEq I] in | |
| theorem equation_storedAssignment_satisfied (iā : I) (table : HalfCube iā ā Bool) | |
| (dummy : Bool) (f : Cube I) : | |
| satisfied (equation iā f) (storedAssignment table dummy) = | |
| !(foldedAnswer iā table f) := equation_satisfied iā _ f | |
| omit [Fintype I] [DecidableEq I] in | |
| theorem equation_flip_first (iā : I) (f : Cube I) : | |
| (equation iā (cubeFlip f)).first = (equation iā f).first := by | |
| change Sum.inl (canonicalInput iā (cubeFlip f)) = Sum.inl (canonicalInput iā f) | |
| rw [canonicalInput_flip] | |
| omit [Fintype I] [DecidableEq I] in | |
| theorem equation_flip_rhs (iā : I) (f : Cube I) : | |
| (equation iā (cubeFlip f)).rhs = !(equation iā f).rhs := rfl | |
| omit [Fintype I] [DecidableEq I] in | |
| theorem equation_satisfied_flip (iā : I) (assignment : Address iā ā Bool) | |
| (f : Cube I) : | |
| satisfied (equation iā (cubeFlip f)) assignment = | |
| !(satisfied (equation iā f) assignment) := by | |
| rw [equation_satisfied, foldedAnswer_flip, equation_satisfied] | |
| def pairedEquations (iā : I) (f : Cube I) : List (Equation (Address iā)) := | |
| [equation iā f, equation iā (cubeFlip f)] | |
| omit [Fintype I] [DecidableEq I] in | |
| @[simp] theorem pairedEquations_length (iā : I) (f : Cube I) : | |
| (pairedEquations iā f).length = 2 := rfl | |
| omit [Fintype I] [DecidableEq I] in | |
| theorem pairedEquations_ne_nil (iā : I) (f : Cube I) : | |
| pairedEquations iā f ā [] := by simp [pairedEquations] | |
| omit [Fintype I] [DecidableEq I] in | |
| theorem pairedEquations_acceptedCount (iā : I) (assignment : Address iā ā Bool) | |
| (f : Cube I) : | |
| (pairedEquations iā f).countP (fun e => satisfied e assignment) = 1 := by | |
| simp only [pairedEquations, List.countP_cons, List.countP_nil, equation_satisfied_flip] | |
| cases satisfied (equation iā f) assignment <;> rfl | |
| omit [Fintype I] [DecidableEq I] in | |
| theorem pairedEquations_failureCount (iā : I) (assignment : Address iā ā Bool) | |
| (f : Cube I) : | |
| (pairedEquations iā f).countP (fun e => !(satisfied e assignment)) = 1 := by | |
| simp only [pairedEquations, List.countP_cons, List.countP_nil, equation_satisfied_flip] | |
| cases satisfied (equation iā f) assignment <;> rfl | |
| noncomputable section | |
| def equationAcceptance (iā : I) (assignment : Address iā ā Bool) : ā := | |
| š¼ f : Cube I, if satisfied (equation iā f) assignment then (1 : ā) else 0 | |
| def equationBias (iā : I) (assignment : Address iā ā Bool) : ā := | |
| š¼ f : Cube I, if satisfied (equation iā f) assignment then (1 : ā) else -1 | |
| theorem foldedMean_eq_zero (iā : I) (table : HalfCube iā ā Bool) : | |
| (š¼ f : Cube I, bitSign (foldedAnswer iā table f)) = 0 := by | |
| simpa [coefficient, walsh, bitSign] using foldedAnswer_zero_coefficient iā table | |
| omit [Fintype I] [DecidableEq I] in | |
| theorem equation_indicator (iā : I) (assignment : Address iā ā Bool) (f : Cube I) : | |
| (if satisfied (equation iā f) assignment then (1 : ā) else 0) = | |
| (1 + bitSign (foldedAnswer iā (fun h => assignment (.inl h)) f)) / 2 := by | |
| rw [equation_satisfied] | |
| cases foldedAnswer iā (fun h => assignment (.inl h)) f <;> norm_num [bitSign] | |
| theorem equationAcceptance_eq_half (iā : I) (assignment : Address iā ā Bool) : | |
| equationAcceptance iā assignment = 1 / 2 := by | |
| unfold equationAcceptance | |
| simp_rw [equation_indicator, div_eq_mul_inv, ā Finset.expect_mul, | |
| Finset.expect_add_distrib, Fintype.expect_const, foldedMean_eq_zero] | |
| norm_num | |
| theorem equationBias_eq_zero (iā : I) (assignment : Address iā ā Bool) : | |
| equationBias iā assignment = 0 := by | |
| unfold equationBias | |
| have hi (f : Cube I) : | |
| (if satisfied (equation iā f) assignment then (1 : ā) else -1) = | |
| bitSign (foldedAnswer iā (fun h => assignment (.inl h)) f) := by | |
| rw [equation_satisfied] | |
| cases foldedAnswer iā (fun h => assignment (.inl h)) f <;> norm_num [bitSign] | |
| simp_rw [hi] | |
| exact foldedMean_eq_zero iā _ | |
| theorem mapped_equationAcceptance_eq_half {Name : Type} (iā : I) | |
| (rename : Address iā ā Name) (assignment : Name ā Bool) : | |
| (š¼ f : Cube I, if satisfied (mapEquation rename (equation iā f)) assignment | |
| then (1 : ā) else 0) = 1 / 2 := by | |
| simp only [satisfied_mapEquation] | |
| exact equationAcceptance_eq_half iā (assignment ā rename) | |
| end | |
| end EmptyContext | |
| end DFVSGames.Foundations.Hastad | |
| namespace DFVSGames.Reduction.FiniteNoise | |
| open scoped BigOperators | |
| open DFVSGames.Foundations.Hastad (noiseWeight) | |
| def realizedBit {D : Nat} (z : Fin D) : Bool := decide (z.val = 0) | |
| def realizedNoise {A : Type*} {D : Nat} (z : A ā Fin D) : A ā Bool := | |
| fun a => realizedBit (z a) | |
| theorem realizedBit_eq_true_iff {D : Nat} (positive : 0 < D) (z : Fin D) : | |
| realizedBit z = true ā z = āØ0, positiveā© := by | |
| simp [realizedBit, Fin.ext_iff] | |
| theorem coordinate_fiber_sum {D : Nat} (positive : 0 < D) (b : Bool) : | |
| (ā z : Fin D, if realizedBit z = b then (D : ā)ā»Ā¹ else 0) = | |
| if b then (D : ā)ā»Ā¹ else 1 - (D : ā)ā»Ā¹ := by | |
| have hd : (D : ā) ā 0 := by exact_mod_cast Nat.ne_of_gt positive | |
| have ht : (ā z : Fin D, if realizedBit z = true then (D : ā)ā»Ā¹ else 0) = | |
| (D : ā)ā»Ā¹ := by | |
| simp_rw [realizedBit_eq_true_iff positive] | |
| simp | |
| have htotal : | |
| (ā z : Fin D, if realizedBit z = false then (D : ā)ā»Ā¹ else 0) + | |
| (ā z : Fin D, if realizedBit z = true then (D : ā)ā»Ā¹ else 0) = 1 := by | |
| rw [ā Finset.sum_add_distrib] | |
| have he (z : Fin D) : | |
| (if realizedBit z = false then (D : ā)ā»Ā¹ else 0) + | |
| (if realizedBit z = true then (D : ā)ā»Ā¹ else 0) = (D : ā)ā»Ā¹ := by | |
| cases realizedBit z <;> simp | |
| simp_rw [he] | |
| simp [hd] | |
| cases b <;> simp only [Bool.false_eq_true, ite_false, ite_true] | |
| Ā· linarith | |
| Ā· exact ht | |
| variable {A : Type*} [Fintype A] [DecidableEq A] | |
| theorem noiseWeight_eq_fiber_sum {D : Nat} (positive : 0 < D) (μ : A ā Bool) : | |
| noiseWeight ((D : ā)ā»Ā¹) μ = | |
| ā z : A ā Fin D, | |
| ā a, if realizedBit (z a) = μ a then (D : ā)ā»Ā¹ else 0 := by | |
| rw [ā Fintype.prod_sum (fun (a : A) (z : Fin D) => | |
| if realizedBit z = μ a then (D : ā)ā»Ā¹ else 0)] | |
| unfold noiseWeight | |
| apply Finset.prod_congr rfl | |
| intro a _ | |
| exact (coordinate_fiber_sum positive (μ a)).symm | |
| omit [DecidableEq A] in | |
| theorem fiber_product_eq_indicator {D : Nat} (z : A ā Fin D) (μ : A ā Bool) : | |
| (ā a, if realizedBit (z a) = μ a then (D : ā)ā»Ā¹ else 0) = | |
| if realizedNoise z = μ then ((D : ā)ā»Ā¹) ^ Fintype.card A else 0 := by | |
| classical | |
| by_cases h : realizedNoise z = μ | |
| Ā· rw [ite_eq_left h] | |
| have ha (a : A) : realizedBit (z a) = μ a := congrFun h a | |
| simp [ha] | |
| Ā· rw [ite_eq_right h] | |
| obtain āØa, haā© := Function.ne_iff.mp h | |
| apply Finset.prod_eq_zero (Finset.mem_univ a) | |
| exact ite_eq_right ha | |
| theorem expect_realizedNoise {D : Nat} (positive : 0 < D) (H : (A ā Bool) ā ā) : | |
| (š¼ z : A ā Fin D, H (realizedNoise z)) = | |
| ā μ : A ā Bool, noiseWeight ((D : ā)ā»Ā¹) μ * H μ := by | |
| classical | |
| symm | |
| simp_rw [noiseWeight_eq_fiber_sum positive, Finset.sum_mul] | |
| rw [Finset.sum_comm] | |
| simp_rw [fiber_product_eq_indicator] | |
| have he (z : A ā Fin D) : | |
| (ā μ : A ā Bool, | |
| (if realizedNoise z = μ then ((D : ā)ā»Ā¹) ^ Fintype.card A else 0) * H μ) = | |
| ((D : ā)ā»Ā¹) ^ Fintype.card A * H (realizedNoise z) := by | |
| simp [eq_comm] | |
| simp_rw [he] | |
| rw [Fintype.expect_eq_sum_div_card] | |
| simp only [Fintype.card_fun, Fintype.card_fin, Nat.cast_pow] | |
| rw [div_eq_mul_inv, inv_pow] | |
| rw [ā Finset.mul_sum] | |
| exact mul_comm _ _ | |
| end DFVSGames.Reduction.FiniteNoise | |
| noncomputable section | |
| namespace DFVSGames.Foundations.Hastad | |
| open scoped BigOperators | |
| open DFVSGames.Reduction.FiniteNoise | |
| variable {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] | |
| omit [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] in | |
| theorem dictator_test_parity (Ļ : J ā I) (i : I) (j : J) (hĻ : Ļ j = i) | |
| (f : Cube I) (g μ : Cube J) : | |
| (f i ^^ g j ^^ (thirdQuery Ļ f g μ) j) = μ j := by | |
| simp only [thirdQuery, cubeXor, hĻ] | |
| cases f i <;> cases g j <;> cases μ j <;> rfl | |
| theorem noise_coordinate_sign (ε : ā) (j : J) : | |
| (ā μ : Cube J, noiseWeight ε μ * bitSign (μ j)) = 1 - 2 * ε := by | |
| have hs : support (coordinateMask j) = {j} := by | |
| ext k | |
| simp [support, coordinateMask] | |
| have h := noise_walsh ε (coordinateMask j) | |
| simp_rw [walsh_symm (coordinateMask j), walsh_coordinateMask] at h | |
| simpa only [hs, Finset.card_singleton, pow_one] using h | |
| theorem noise_coordinate_false (ε : ā) (j : J) : | |
| (ā μ : Cube J, noiseWeight ε μ * if μ j then (0 : ā) else 1) = 1 - ε := by | |
| have hind (b : Bool) : (if b then (0 : ā) else 1) = | |
| (1 + bitSign b) * (2 : ā)ā»Ā¹ := by | |
| cases b <;> norm_num [bitSign] | |
| have ht (μ : Cube J) : noiseWeight ε μ * (if μ j then (0 : ā) else 1) = | |
| (noiseWeight ε μ + noiseWeight ε μ * bitSign (μ j)) * (2 : ā)ā»Ā¹ := by | |
| rw [hind] | |
| ring | |
| simp_rw [ht] | |
| rw [ā Finset.sum_mul, Finset.sum_add_distrib, noiseWeight_sum, noise_coordinate_sign] | |
| ring | |
| theorem testAcceptance_dictator (ε : ā) (Ļ : J ā I) | |
| (i : I) (j : J) (hĻ : Ļ j = i) : | |
| testAcceptance ε Ļ (fun f => f i) (fun g => g j) = 1 - ε := by | |
| have hg (f : Cube I) (μ : Cube J) : | |
| (š¼ g : Cube J, if f i ^^ g j ^^ (thirdQuery Ļ f g μ) j then (0 : ā) else 1) = | |
| if μ j then 0 else 1 := by | |
| calc | |
| _ = š¼ _g : Cube J, if μ j then (0 : ā) else 1 := by | |
| apply Finset.expect_congr rfl | |
| intro g _ | |
| rw [dictator_test_parity Ļ i j hĻ f g μ] | |
| _ = _ := Fintype.expect_const _ | |
| change (š¼ f : Cube I, ā μ : Cube J, noiseWeight ε μ * | |
| (š¼ g : Cube J, if f i ^^ g j ^^ (thirdQuery Ļ f g μ) j then (0 : ā) else 1)) = _ | |
| simp_rw [hg] | |
| rw [Fintype.expect_const] | |
| exact noise_coordinate_false ε j | |
| theorem testAcceptance_folded_dictators (ε : ā) (Ļ : J ā I) | |
| (iā i : I) (jā j : J) (hĻ : Ļ j = i) : | |
| testAcceptance ε Ļ (foldedAnswer iā (fun h => h.val i)) | |
| (foldedAnswer jā (fun h => h.val j)) = 1 - ε := by | |
| have hA : foldedAnswer iā (fun h => h.val i) = (fun f : Cube I => f i) := | |
| funext (foldedAnswer_dictator iā i) | |
| have hB : foldedAnswer jā (fun h => h.val j) = (fun g : Cube J => g j) := | |
| funext (foldedAnswer_dictator jā j) | |
| rw [hA, hB] | |
| exact testAcceptance_dictator ε Ļ i j hĻ | |
| theorem testAcceptance_conditioned_dictators (ε : ā) (Ļ : J ā I) | |
| (validI : I ā Bool) (validJ : J ā Bool) | |
| (iā i : {i : I // validI i = true}) (jā j : {j : J // validJ j = true}) | |
| (hĻ : Ļ j.val = i.val) : | |
| testAcceptance ε Ļ | |
| (conditionedFoldedAnswer validI iā (fun h => h.val i)) | |
| (conditionedFoldedAnswer validJ jā (fun h => h.val j)) = 1 - ε := by | |
| have hA : conditionedFoldedAnswer validI iā (fun h => h.val i) = | |
| (fun f : Cube I => f i.val) := | |
| funext (conditionedFoldedAnswer_dictator validI iā i) | |
| have hB : conditionedFoldedAnswer validJ jā (fun h => h.val j) = | |
| (fun g : Cube J => g j.val) := | |
| funext (conditionedFoldedAnswer_dictator validJ jā j) | |
| rw [hA, hB] | |
| exact testAcceptance_dictator ε Ļ i.val j.val hĻ | |
| theorem testAcceptance_folded_conditioned_dictators (ε : ā) (Ļ : J ā I) | |
| (iā i : I) (valid : J ā Bool) | |
| (jā j : {j : J // valid j = true}) (hĻ : Ļ j.val = i) : | |
| testAcceptance ε Ļ (foldedAnswer iā (fun h => h.val i)) | |
| (conditionedFoldedAnswer valid jā (fun h => h.val j)) = 1 - ε := by | |
| have hA : foldedAnswer iā (fun h => h.val i) = (fun f : Cube I => f i) := | |
| funext (foldedAnswer_dictator iā i) | |
| have hB : conditionedFoldedAnswer valid jā (fun h => h.val j) = | |
| (fun g : Cube J => g j.val) := | |
| funext (conditionedFoldedAnswer_dictator valid jā j) | |
| rw [hA, hB] | |
| exact testAcceptance_dictator ε Ļ i j.val hĻ | |
| def realizedTestAcceptance (D : Nat) (Ļ : J ā I) | |
| (A : Cube I ā Bool) (B : Cube J ā Bool) : ā := | |
| š¼ f : Cube I, š¼ z : J ā Fin D, š¼ g : Cube J, | |
| if A f ^^ B g ^^ B (thirdQuery Ļ f g (realizedNoise z)) then 0 else 1 | |
| theorem realizedTestAcceptance_eq_testAcceptance {D : Nat} (positive : 0 < D) | |
| (Ļ : J ā I) (A : Cube I ā Bool) (B : Cube J ā Bool) : | |
| realizedTestAcceptance D Ļ A B = testAcceptance ((D : ā)ā»Ā¹) Ļ A B := by | |
| unfold realizedTestAcceptance testAcceptance | |
| apply Finset.expect_congr rfl | |
| intro f _ | |
| exact expect_realizedNoise positive | |
| (fun μ => š¼ g : Cube J, if A f ^^ B g ^^ B (thirdQuery Ļ f g μ) then 0 else 1) | |
| theorem realizedTestAcceptance_dictator {D : Nat} (positive : 0 < D) | |
| (Ļ : J ā I) (i : I) (j : J) (hĻ : Ļ j = i) : | |
| realizedTestAcceptance D Ļ (fun f => f i) (fun g => g j) = 1 - (D : ā)ā»Ā¹ := by | |
| rw [realizedTestAcceptance_eq_testAcceptance positive] | |
| exact testAcceptance_dictator _ Ļ i j hĻ | |
| theorem realizedTestAcceptance_folded_dictators {D : Nat} (positive : 0 < D) | |
| (Ļ : J ā I) (iā i : I) (jā j : J) (hĻ : Ļ j = i) : | |
| realizedTestAcceptance D Ļ (foldedAnswer iā (fun h => h.val i)) | |
| (foldedAnswer jā (fun h => h.val j)) = 1 - (D : ā)ā»Ā¹ := by | |
| rw [realizedTestAcceptance_eq_testAcceptance positive] | |
| exact testAcceptance_folded_dictators _ Ļ iā i jā j hĻ | |
| theorem realizedTestAcceptance_conditioned_dictators {D : Nat} (positive : 0 < D) | |
| (Ļ : J ā I) (validI : I ā Bool) (validJ : J ā Bool) | |
| (iā i : {i : I // validI i = true}) (jā j : {j : J // validJ j = true}) | |
| (hĻ : Ļ j.val = i.val) : | |
| realizedTestAcceptance D Ļ | |
| (conditionedFoldedAnswer validI iā (fun h => h.val i)) | |
| (conditionedFoldedAnswer validJ jā (fun h => h.val j)) = 1 - (D : ā)ā»Ā¹ := by | |
| rw [realizedTestAcceptance_eq_testAcceptance positive] | |
| exact testAcceptance_conditioned_dictators _ Ļ validI validJ iā i jā j hĻ | |
| theorem realizedTestAcceptance_folded_conditioned_dictators {D : Nat} (positive : 0 < D) | |
| (Ļ : J ā I) (iā i : I) (valid : J ā Bool) | |
| (jā j : {j : J // valid j = true}) (hĻ : Ļ j.val = i) : | |
| realizedTestAcceptance D Ļ (foldedAnswer iā (fun h => h.val i)) | |
| (conditionedFoldedAnswer valid jā (fun h => h.val j)) = 1 - (D : ā)ā»Ā¹ := by | |
| rw [realizedTestAcceptance_eq_testAcceptance positive] | |
| exact testAcceptance_folded_conditioned_dictators _ Ļ iā i valid jā j hĻ | |
| end DFVSGames.Foundations.Hastad | |
| end | |
| end OAI | |