Download data/lean/OAI/NumberTheory/TwoPoint/Circuits/CircuitPolynomialAlgebra.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.61 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/TwoPoint/Circuits/CircuitPolynomialAlgebra.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/NumberTheory/TwoPoint/Circuits/CircuitPolynomialAlgebra.lean
-
curl -L -o CircuitPolynomialAlgebra.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/TwoPoint/Circuits/CircuitPolynomialAlgebra.lean
3.61 kB
| import OAI.NumberTheory.TwoPoint.Circuits.CircuitPolynomialMean | |
| import Mathlib.Data.Finset.SymmDiff | |
| namespace OAI | |
| /-! Algebra of the low-degree functions used in the circuit approximation. | |
| Multiplication adds degrees, including after Boolean multilinearization. -/ | |
| namespace TwoPointCorrelations | |
| open Finset | |
| open scoped Classical symmDiff | |
| variable {n : β} | |
| lemma walsh_mul (S T : Finset (Fin n)) (x : BooleanCube n) : | |
| walsh S x * walsh T x = walsh (S β T) x := by | |
| have hd : Disjoint (S β T) (S β© T) := by | |
| rw [disjoint_left] | |
| intro i hi hi' | |
| simp only [mem_symmDiff, mem_inter] at hi hi' | |
| tauto | |
| have hu : (S β T) βͺ (S β© T) = S βͺ T := by | |
| ext i | |
| simp only [mem_union, mem_symmDiff, mem_inter] | |
| tauto | |
| have he : walsh (S βͺ T) x * walsh (S β© T) x = walsh S x * walsh T x := | |
| prod_union_inter | |
| have hh : walsh (S βͺ T) x = walsh (S β T) x * walsh (S β© T) x := by | |
| simpa only [walsh, hu] using | |
| (prod_union hd : (β i β (S β T) βͺ (S β© T), booleanSign (x i)) = _) | |
| rw [hh, mul_assoc, walsh_mul_self, mul_one] at he | |
| exact he.symm | |
| lemma WalshDegreeLE.of_walsh (S : Finset (Fin n)) {t : β} (hS : S.card β€ t) : | |
| WalshDegreeLE (walsh S) t := by | |
| refine β¨fun T => if T = S then 1 else 0, ?_β© | |
| intro x | |
| simp [hS] | |
| lemma WalshDegreeLE.const (c : β) (t : β) : | |
| WalshDegreeLE (fun _ : BooleanCube n => c) t := by | |
| refine β¨fun S => if S = β then c else 0, ?_β© | |
| intro x | |
| simp | |
| lemma WalshDegreeLE.smul {F : BooleanCube n β β} {t : β} | |
| (hF : WalshDegreeLE F t) (c : β) : WalshDegreeLE (fun x => c * F x) t := by | |
| obtain β¨a, haβ© := hF | |
| refine β¨fun S => c * a S, ?_β© | |
| intro x | |
| dsimp only | |
| rw [ha, mul_sum] | |
| apply sum_congr rfl | |
| intro S _ | |
| ring | |
| lemma WalshDegreeLE.sub {F G : BooleanCube n β β} {t : β} | |
| (hF : WalshDegreeLE F t) (hG : WalshDegreeLE G t) : | |
| WalshDegreeLE (fun x => F x - G x) t := by | |
| obtain β¨a, haβ© := hF | |
| obtain β¨b, hbβ© := hG | |
| refine β¨fun S => a S - b S, ?_β© | |
| intro x | |
| dsimp only | |
| rw [ha, hb, β sum_sub_distrib] | |
| apply sum_congr rfl | |
| intro S _ | |
| ring | |
| lemma WalshDegreeLE.sum {ΞΉ : Type*} (I : Finset ΞΉ) (F : ΞΉ β BooleanCube n β β) | |
| {t : β} (hF : β i β I, WalshDegreeLE (F i) t) : | |
| WalshDegreeLE (fun x => β i β I, F i x) t := by | |
| choose a ha using fun i : I => hF i i.property | |
| refine β¨fun S => β i : I, a i S, ?_β© | |
| intro x | |
| dsimp only | |
| rw [β sum_coe_sort I] | |
| simp_rw [ha] | |
| rw [sum_comm] | |
| apply sum_congr rfl | |
| intro S _ | |
| exact (sum_mul _ _ _).symm | |
| lemma WalshDegreeLE.mul {F G : BooleanCube n β β} {p q : β} | |
| (hF : WalshDegreeLE F p) (hG : WalshDegreeLE G q) : | |
| WalshDegreeLE (fun x => F x * G x) (p + q) := by | |
| obtain β¨a, haβ© := hF | |
| obtain β¨b, hbβ© := hG | |
| let A := (univ : Finset (Finset (Fin n))).filter (fun S => S.card β€ p) | |
| let B := (univ : Finset (Finset (Fin n))).filter (fun S => S.card β€ q) | |
| have heq : (fun x => F x * G x) = fun x => | |
| β S β A, β T β B, (a S * b T) * walsh (S β T) x := by | |
| funext x | |
| rw [ha, hb, sum_mul] | |
| apply sum_congr rfl | |
| intro S _ | |
| rw [mul_sum] | |
| apply sum_congr rfl | |
| intro T _ | |
| rw [β walsh_mul] | |
| ring | |
| rw [heq] | |
| apply WalshDegreeLE.sum A | |
| intro S hS | |
| apply WalshDegreeLE.sum B | |
| intro T hT | |
| apply WalshDegreeLE.smul | |
| apply WalshDegreeLE.of_walsh | |
| calc | |
| (S β T).card β€ (S βͺ T).card := card_le_card symmDiff_subset_union | |
| _ β€ S.card + T.card := card_union_le S T | |
| _ β€ p + q := add_le_add (mem_filter.mp hS).2 (mem_filter.mp hT).2 | |
| end TwoPointCorrelations | |
| end OAI | |