Download data/lean/OAI/Computability/DepthThree/CircuitLowerBound.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.54 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/DepthThree/CircuitLowerBound.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/DepthThree/CircuitLowerBound.lean
-
curl -L -o CircuitLowerBound.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/DepthThree/CircuitLowerBound.lean
4.54 kB
| import OAI.Computability.DepthThree.CircuitNormalization | |
| import OAI.Computability.DepthThree.CircuitDeletion | |
| import Mathlib.Tactic.Linarith | |
| namespace OAI | |
| universe uDepth1 | |
| noncomputable section | |
| open scoped BigOperators | |
| open scoped Classical | |
| namespace DepthThreeLowerBound | |
| variable {V : Type uDepth1} [instFintypeV : Fintype V] | |
| namespace CNF | |
| theorem mass_le_of_width_correlation (H : CNF V) (hH : H.Normalized) | |
| (f : Cube V β Bool) (hsupport : β x, H.eval x = true β f x = true) | |
| (k : β) (Ξ΅ : β) | |
| (hcorr : β J : CNF V, J.WidthAtMost k β | |
| |finiteAvg (fun x : Cube V => sign (f x) * indicator (J.eval x))| β€ Ξ΅) : | |
| finiteAvg (fun x : Cube V => indicator (H.eval x)) β€ | |
| Ξ΅ + (H.length : β) * ((2 : β) ^ k)β»ΒΉ := by | |
| let J := H.deleteWide k | |
| have hpoint (x : Cube V) : indicator (H.eval x) β€ | |
| sign (f x) * indicator (J.eval x) + | |
| (indicator (J.eval x) - indicator (H.eval x)) := by | |
| have hm := H.indicator_eval_le_deleteWide k x | |
| have hs := hsupport x | |
| change indicator (H.eval x) β€ indicator (J.eval x) at hm | |
| cases hh : H.eval x <;> cases hj : J.eval x <;> cases hf : f x <;> | |
| simp_all [indicator, sign] | |
| calc | |
| _ β€ finiteAvg (fun x : Cube V => sign (f x) * indicator (J.eval x) + | |
| (indicator (J.eval x) - indicator (H.eval x))) := finiteAvg_mono hpoint | |
| _ = finiteAvg (fun x : Cube V => sign (f x) * indicator (J.eval x)) + | |
| finiteAvg (fun x : Cube V => indicator (J.eval x) - indicator (H.eval x)) := | |
| finiteAvg_add _ _ | |
| _ β€ |finiteAvg (fun x : Cube V => sign (f x) * indicator (J.eval x))| + | |
| finiteAvg (fun x : Cube V => indicator (J.eval x) - indicator (H.eval x)) := | |
| add_le_add_left (le_abs_self _) _ | |
| _ β€ Ξ΅ + (H.length : β) * ((2 : β) ^ k)β»ΒΉ := | |
| add_le_add (hcorr J (H.deleteWide_widthAtMost k)) (H.deletion_error_bound hH k) | |
| end CNF | |
| namespace Circuit3 | |
| theorem indicator_output_le_sum_middle | |
| {V : Type uDepth1} | |
| [Fintype V] | |
| (C : Circuit3 V) (x : Cube V) : | |
| indicator (C.eval x) β€ β j β C.top, indicator ((C.middleCNF j).eval x) := by | |
| classical | |
| cases h : C.eval x with | |
| | false => | |
| simpa using Finset.sum_nonneg (fun j (_ : j β C.top) => | |
| indicator_nonneg ((C.middleCNF j).eval x)) | |
| | true => | |
| obtain β¨j, hj, hxβ© := (C.eval_eq_true_iff_middleCNF x).mp h | |
| have hb := Finset.single_le_sum | |
| (fun i (_ : i β C.top) => indicator_nonneg ((C.middleCNF i).eval x)) hj | |
| simpa [hx] using hb | |
| theorem acceptance_density_le (C : Circuit3 V) (f : Cube V β Bool) | |
| (hC : C.Computes f) (k : β) (Ξ΅ : β) (hΞ΅ : 0 β€ Ξ΅) | |
| (hcorr : β H : CNF V, H.WidthAtMost k β | |
| |finiteAvg (fun x : Cube V => sign (f x) * indicator (H.eval x))| β€ Ξ΅) : | |
| finiteAvg (fun x : Cube V => indicator (f x)) β€ | |
| (C.gateCount : β) * Ξ΅ + (C.gateCount : β) ^ 2 * ((2 : β) ^ k)β»ΒΉ := by | |
| classical | |
| let q : β := ((2 : β) ^ k)β»ΒΉ | |
| have hq : 0 β€ q := inv_nonneg.mpr (pow_nonneg (by norm_num) _) | |
| have hm (j : Fin C.middleCount) (hj : j β C.top) : | |
| finiteAvg (fun x : Cube V => indicator ((C.middleCNF j).eval x)) β€ | |
| Ξ΅ + (C.gateCount : β) * q := by | |
| have hs (x : Cube V) (hx : (C.middleCNF j).eval x = true) : f x = true := by | |
| rw [β hC x] | |
| exact C.middleCNF_implies_output hj hx | |
| have hfirst := (C.middleCNF j).mass_le_of_width_correlation | |
| (C.middleCNF_normalized j) f hs k Ξ΅ hcorr | |
| refine hfirst.trans (add_le_add_right (mul_le_mul_of_nonneg_right ?_ hq) Ξ΅) | |
| exact_mod_cast C.middleCNF_length_le_gateCount j | |
| have hB : 0 β€ Ξ΅ + (C.gateCount : β) * q := | |
| add_nonneg hΞ΅ (mul_nonneg (Nat.cast_nonneg _) hq) | |
| calc | |
| _ = finiteAvg (fun x : Cube V => indicator (C.eval x)) := | |
| finiteAvg_congr (fun x => congrArg indicator (hC x).symm) | |
| _ β€ finiteAvg (fun x : Cube V => | |
| β j β C.top, indicator ((C.middleCNF j).eval x)) := | |
| finiteAvg_mono (C.indicator_output_le_sum_middle) | |
| _ = β j β C.top, finiteAvg (fun x : Cube V => | |
| indicator ((C.middleCNF j).eval x)) := finiteAvg_sum _ _ | |
| _ β€ β j β C.top, (Ξ΅ + (C.gateCount : β) * q) := | |
| Finset.sum_le_sum hm | |
| _ = (C.top.card : β) * (Ξ΅ + (C.gateCount : β) * q) := by | |
| simp only [Finset.sum_const, nsmul_eq_mul] | |
| _ β€ (C.gateCount : β) * (Ξ΅ + (C.gateCount : β) * q) := by | |
| apply mul_le_mul_of_nonneg_right _ hB | |
| exact_mod_cast C.top_card_le_gateCount | |
| _ = _ := by dsimp [q]; ring | |
| end Circuit3 | |
| end DepthThreeLowerBound | |
| end | |
| end OAI | |