File size: 4,634 Bytes
4a56cd6 | 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 | import OAI.NumberTheory.TwoPoint.Circuits.CircuitBooleanOps
import OAI.NumberTheory.TwoPoint.Circuits.CircuitGateApproximation
namespace OAI
/-! The single-hit test used by the random polynomial is itself a small
constant-depth circuit on the original child outputs. -/
namespace TwoPointCorrelations
open Finset
open scoped Classical
namespace AC0Circuit
noncomputable def certificateDisjunction {ΞΉ : Type*} [Fintype ΞΉ] {n : β}
(c : ΞΉ β AC0Circuit n) : AC0Circuit n :=
(conjunction (fun i => (c i).negate)).negate
lemma certificateDisjunction_eval {ΞΉ : Type*} [Fintype ΞΉ] {n : β}
(c : ΞΉ β AC0Circuit n) (x : BooleanCube n) :
(certificateDisjunction c).eval x = true β β i, (c i).eval x = true := by
rw [certificateDisjunction, negate_eval]
simp only [ne_eq, conjunction_eval, negate_eval, not_forall, not_not]
lemma certificateDisjunction_depth {ΞΉ : Type*} [Fintype ΞΉ] {n d : β}
(c : ΞΉ β AC0Circuit n) (hc : β i, (c i).depth β€ d) :
(certificateDisjunction c).depth β€ d + 1 := by
simp only [certificateDisjunction, negate_depth]
exact conjunction_depth _ (fun i => by simpa only [negate_depth] using hc i)
lemma certificateDisjunction_size {ΞΉ : Type*} [Fintype ΞΉ] {n : β}
(c : ΞΉ β AC0Circuit n) : (certificateDisjunction c).size = 1 + β i, (c i).size := by
simp only [certificateDisjunction, negate_size, conjunction_size]
noncomputable def uniqueFalseTerm {n k : β} (c : Fin k β AC0Circuit n)
(S : Finset (Fin k)) (i : S) : AC0Circuit n :=
conjunction (fun j : S => if j = i then (c j).negate else c j)
lemma uniqueFalseTerm_eval {n k : β} (c : Fin k β AC0Circuit n)
(S : Finset (Fin k)) (i : S) (x : BooleanCube n) :
(uniqueFalseTerm c S i).eval x = true β
(c i).eval x = false β§ β j : S, j β i β (c j).eval x = true := by
rw [uniqueFalseTerm, conjunction_eval]
constructor
Β· intro h
refine β¨?_, fun j hj => ?_β©
Β· have hi := h i
apply Bool.eq_false_iff.mpr
simpa only [ite_true, negate_eval] using hi
Β· simpa only [ite_eq_right hj] using h j
Β· rintro β¨hi, hβ© j
by_cases hj : j = i
Β· subst j
rw [ite_eq_left rfl, negate_eval, hi]
decide
Β· simpa only [ite_eq_right hj] using h j hj
noncomputable def uniqueFalseCircuit {n k : β} (c : Fin k β AC0Circuit n)
(S : Finset (Fin k)) : AC0Circuit n :=
certificateDisjunction (fun i : S => uniqueFalseTerm c S i)
lemma uniqueFalseCircuit_eval {n k : β} (c : Fin k β AC0Circuit n)
(S : Finset (Fin k)) (x : BooleanCube n) :
(uniqueFalseCircuit c S).eval x = true β
β i : S, (c i).eval x = false β§ β j : S, j β i β (c j).eval x = true := by
simp only [uniqueFalseCircuit, certificateDisjunction_eval, uniqueFalseTerm_eval]
lemma uniqueFalseTerm_depth {n k d : β} (c : Fin k β AC0Circuit n)
(hc : β i, (c i).depth β€ d) (S : Finset (Fin k)) (i : S) :
(uniqueFalseTerm c S i).depth β€ d + 1 := by
apply conjunction_depth
intro j
split_ifs <;> simpa only [negate_depth] using hc j
lemma uniqueFalseCircuit_depth {n k d : β} (c : Fin k β AC0Circuit n)
(hc : β i, (c i).depth β€ d) (S : Finset (Fin k)) :
(uniqueFalseCircuit c S).depth β€ d + 2 := by
exact certificateDisjunction_depth _ (uniqueFalseTerm_depth c hc S)
lemma uniqueFalseTerm_size {n k : β} (c : Fin k β AC0Circuit n)
(S : Finset (Fin k)) (i : S) :
(uniqueFalseTerm c S i).size = 1 + β j : S, (c j).size := by
rw [uniqueFalseTerm, conjunction_size]
congr 1
apply sum_congr rfl
intro j _
split_ifs <;> simp only [negate_size]
lemma uniqueFalseCircuit_size {n k : β} (c : Fin k β AC0Circuit n)
(S : Finset (Fin k)) :
(uniqueFalseCircuit c S).size = 1 + S.card * (1 + β j : S, (c j).size) := by
simp only [uniqueFalseCircuit, certificateDisjunction_size, uniqueFalseTerm_size, sum_const,
card_univ, Fintype.card_coe, nsmul_eq_mul, Nat.cast_id]
lemma uniqueFalseCircuit_size_le {n k : β} (c : Fin k β AC0Circuit n)
(S : Finset (Fin k)) :
(uniqueFalseCircuit c S).size β€ 1 + k * (1 + β j, (c j).size) := by
rw [uniqueFalseCircuit_size]
have hcard : S.card β€ k := (card_le_card (subset_univ S)).trans_eq (card_fin k)
have hsum : β j : S, (c j).size β€ β j, (c j).size := by
calc
_ = β j β S, (c j).size := sum_coe_sort S (fun j => (c j).size)
_ β€ _ := sum_le_sum_of_subset_of_nonneg (subset_univ S) (fun _ _ _ => Nat.zero_le _)
exact Nat.add_le_add_left (Nat.mul_le_mul hcard (Nat.add_le_add_left hsum 1)) 1
end AC0Circuit
end TwoPointCorrelations
end OAI
|