Download data/lean/OAI/Computability/UniqueGames/Analysis/MatrixRestrictions.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 14.6 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/UniqueGames/Analysis/MatrixRestrictions.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/UniqueGames/Analysis/MatrixRestrictions.lean
-
curl -L -o MatrixRestrictions.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/UniqueGames/Analysis/MatrixRestrictions.lean
14.6 kB
| import Mathlib.Algebra.BigOperators.Expect | |
| import Mathlib.Data.Fintype.BigOperators | |
| import Mathlib.Basic.Real.Basic | |
| import Mathlib.LinearAlgebra.Quotient.Basic | |
| import Mathlib.Tactic.NormNum | |
| import OAI.Computability.UniqueGames.Analysis.SubspaceCountingLemmas | |
| import OAI.Computability.UniqueGames.Reduction.BinaryLinear | |
| namespace OAI | |
| section | |
| namespace UniqueGamesTheorem.Fourier.MatrixRestrictions | |
| open UniqueGamesTheorem.Integration.BinaryLinear | |
| open scoped BigOperators | |
| abbrev Ambient (m n : Nat) := Vector m ββ[F2] Vector n | |
| variable {E C : Type*} [AddCommGroup E] [Module F2 E] | |
| [AddCommGroup C] [Module F2 C] | |
| abbrev Parameter (W : Submodule F2 E) | |
| (C' : Submodule F2 C) := (E β§Έ W) ββ[F2] C' | |
| /-- The canonical inclusion of `L(E/W,C')` into `L(E,C)`. -/ | |
| def embed (W : Submodule F2 E) | |
| (C' : Submodule F2 C) (A : Parameter W C') : (E ββ[F2] C) := | |
| C'.subtype.comp (A.comp W.mkQ) | |
| @[simp] theorem embed_apply (W : Submodule F2 E) | |
| (C' : Submodule F2 C) (A : Parameter W C') (x : E) : | |
| embed W C' A x = (A (W.mkQ x) : C) := rfl | |
| theorem embed_injective (W : Submodule F2 E) | |
| (C' : Submodule F2 C) : Function.Injective (embed W C') := by | |
| intro A B h | |
| apply LinearMap.ext | |
| intro x | |
| obtain β¨y, rflβ© := W.mkQ_surjective x | |
| apply Subtype.ext | |
| exact congrArg (fun f : (E ββ[F2] C) => f y) h | |
| theorem embed_vanishes (W : Submodule F2 E) | |
| (C' : Submodule F2 C) (A : Parameter W C') : | |
| W β€ LinearMap.ker (embed W C' A) := by | |
| intro x hx | |
| change (A (W.mkQ x) : C) = 0 | |
| have hzero : W.mkQ x = 0 := by simpa using hx | |
| simp [hzero] | |
| theorem embed_range (W : Submodule F2 E) | |
| (C' : Submodule F2 C) (A : Parameter W C') : | |
| LinearMap.range (embed W C' A) β€ C' := by | |
| rintro x β¨y, rflβ© | |
| exact (A (W.mkQ y)).property | |
| /-- These are exactly the maps vanishing on `W` with image in `C'`. -/ | |
| theorem exists_embed_iff (W : Submodule F2 E) | |
| (C' : Submodule F2 C) (B : (E ββ[F2] C)) : | |
| (β A : Parameter W C', embed W C' A = B) β | |
| W β€ LinearMap.ker B β§ LinearMap.range B β€ C' := by | |
| constructor | |
| Β· rintro β¨A, rflβ© | |
| exact β¨embed_vanishes W C' A, embed_range W C' Aβ© | |
| Β· rintro β¨hW, hCβ© | |
| let B' : E ββ[F2] C' := | |
| B.codRestrict C' (fun x => hC β¨x, rflβ©) | |
| have hker : W β€ LinearMap.ker B' := by | |
| intro x hx | |
| apply Subtype.ext | |
| exact hW hx | |
| refine β¨W.liftQ B' hker, ?_β© | |
| apply LinearMap.ext | |
| intro x | |
| rfl | |
| /-- Quotient rows are unchanged by every admissible restriction perturbation. -/ | |
| theorem quotient_embed_zero (W : Submodule F2 E) | |
| (C' : Submodule F2 C) (A : Parameter W C') : | |
| C'.mkQ.comp (embed W C' A) = 0 := by | |
| apply LinearMap.ext | |
| intro x | |
| change C'.mkQ (embed W C' A x) = 0 | |
| exact (Submodule.Quotient.mk_eq_zero C').mpr (A (W.mkQ x)).property | |
| def translate (W : Submodule F2 E) | |
| (C' : Submodule F2 C) (X : (E ββ[F2] C)) | |
| (A : Parameter W C') : (E ββ[F2] C) := X + embed W C' A | |
| theorem translate_injective (W : Submodule F2 E) | |
| (C' : Submodule F2 C) (X : (E ββ[F2] C)) : | |
| Function.Injective (translate W C' X) := by | |
| intro A B h | |
| exact embed_injective W C' (add_left_cancel h) | |
| theorem quotient_translate (W : Submodule F2 E) | |
| (C' : Submodule F2 C) (X : (E ββ[F2] C)) | |
| (A : Parameter W C') : | |
| C'.mkQ.comp (translate W C' X A) = C'.mkQ.comp X := by | |
| apply LinearMap.ext | |
| intro x | |
| change C'.mkQ (X x + embed W C' A x) = C'.mkQ (X x) | |
| rw [map_add] | |
| have h : C'.mkQ (embed W C' A x) = 0 := | |
| congrArg (fun f : E ββ[F2] (C β§Έ C') => f x) | |
| (quotient_embed_zero W C' A) | |
| rw [h, add_zero] | |
| /-- The perturbation inclusion is itself a binary linear map. -/ | |
| def embedding (W : Submodule F2 E) (C' : Submodule F2 C) : | |
| Parameter W C' ββ[F2] (E ββ[F2] C) where | |
| toFun := embed W C' | |
| map_add' A B := by | |
| apply LinearMap.ext | |
| intro x | |
| rfl | |
| map_smul' a A := by | |
| apply LinearMap.ext | |
| intro x | |
| rfl | |
| noncomputable def order (W : Submodule F2 E) (C' : Submodule F2 C) : Nat := | |
| Module.finrank F2 W + Module.finrank F2 (C β§Έ C') | |
| /-- Restrict a real observable to the actual affine quotient-map domain. -/ | |
| def restrict (f : (E ββ[F2] C) β β) (W : Submodule F2 E) | |
| (C' : Submodule F2 C) (X : E ββ[F2] C) : Parameter W C' β β := | |
| fun A => f (translate W C' X A) | |
| noncomputable instance parameterFintype [Finite E] [Finite C] | |
| (W : Submodule F2 E) (C' : Submodule F2 C) : Fintype (Parameter W C') := by | |
| classical | |
| letI : Fintype E := Fintype.ofFinite E | |
| letI : Fintype C' := Fintype.ofFinite C' | |
| exact Fintype.ofInjective (fun A : Parameter W C' => (A : (E β§Έ W) β C')) | |
| DFunLike.coe_injective | |
| /-- Every actual restriction domain has at least its zero map. -/ | |
| theorem parameter_card_pos [Finite E] [Finite C] | |
| (W : Submodule F2 E) (C' : Submodule F2 C) : | |
| 0 < Fintype.card (Parameter W C') := Fintype.card_pos | |
| /-- An actual row includes its target subspace as part of its index. -/ | |
| structure Row (E C : Type*) [AddCommGroup E] [Module F2 E] | |
| [AddCommGroup C] [Module F2 C] where | |
| target : Submodule F2 C | |
| value : E ββ[F2] (C β§Έ target) | |
| structure Witness (E C : Type*) [AddCommGroup E] [Module F2 E] | |
| [AddCommGroup C] [Module F2 C] where | |
| vanishing : Submodule F2 E | |
| target : Submodule F2 C | |
| base : E ββ[F2] C | |
| noncomputable def samples [Finite E] [Finite C] (t : Witness E C) : | |
| List (E ββ[F2] C) := | |
| (Finset.univ : Finset (Parameter t.vanishing t.target)).toList.map | |
| (translate t.vanishing t.target t.base) | |
| theorem samples_length [Finite E] [Finite C] (t : Witness E C) : | |
| (samples t).length = Fintype.card (Parameter t.vanishing t.target) := by | |
| simp [samples] | |
| theorem samples_nonempty [Finite E] [Finite C] (t : Witness E C) : | |
| samples t β [] := by | |
| intro h | |
| have hp := parameter_card_pos t.vanishing t.target | |
| rw [β samples_length t, h] at hp | |
| exact Nat.not_lt_zero 0 hp | |
| theorem mem_samples_iff [Finite E] [Finite C] (t : Witness E C) | |
| (X : E ββ[F2] C) : X β samples t β | |
| β A : Parameter t.vanishing t.target, | |
| translate t.vanishing t.target t.base A = X := by | |
| classical | |
| simp [samples] | |
| theorem samples_nodup [Finite E] [Finite C] (t : Witness E C) : | |
| (samples t).Nodup := by | |
| classical | |
| exact List.Nodup.map (translate_injective t.vanishing t.target t.base) | |
| (Finset.nodup_toList _) | |
| /-- Actual affine matrix restrictions instantiate the generic deletion interface. -/ | |
| noncomputable def system [Finite E] [Finite C] (r : Nat) : | |
| Deletion.RestrictionSystem (E ββ[F2] C) (Row E C) (Witness E C) where | |
| samples := samples | |
| samples_nonempty := samples_nonempty | |
| admissible t := order t.vanishing t.target β€ r | |
| row t X := t.target.mkQ.comp X = t.value | |
| containingRow t := β¨t.target, t.target.mkQ.comp t.baseβ© | |
| contained t X hX := by | |
| obtain β¨A, rflβ© := (mem_samples_iff t X).mp hX | |
| exact quotient_translate t.vanishing t.target t.base A | |
| /-- Every actual affine restriction of order at most `r` obeys the residual | |
| count bound after whole-row deletion. No linear containment assumption remains. -/ | |
| theorem remainder_restriction_count [Finite E] [Finite C] | |
| (H : (E ββ[F2] C) β Bool) (r p q : Nat) (t : Witness E C) | |
| (ht : order t.vanishing t.target β€ r) : | |
| q * Deletion.trueCount (Deletion.remainder (system r) H p q) (samples t) β€ | |
| p * Fintype.card (Parameter t.vanishing t.target) := by | |
| rw [β samples_length t] | |
| exact Deletion.remainder_restrictionGlobal (system r) H p q t ht | |
| private theorem trueCount_eq_countP {Ξ± : Type*} (H : Ξ± β Bool) (xs : List Ξ±) : | |
| Deletion.trueCount H xs = xs.countP H := by | |
| induction xs with | |
| | nil => rfl | |
| | cons x xs ih => | |
| cases hx : H x <;> simp [Deletion.trueCount, ih, hx, Nat.add_comm] | |
| /-- Exact numerator for uniform sampling of the actual affine restriction. -/ | |
| theorem samples_trueCount [Finite E] [Finite C] (H : (E ββ[F2] C) β Bool) | |
| (t : Witness E C) : | |
| Deletion.trueCount H (samples t) = | |
| (Finset.univ.filter fun A : Parameter t.vanishing t.target => | |
| H (translate t.vanishing t.target t.base A) = true).card := by | |
| classical | |
| rw [trueCount_eq_countP] | |
| simp only [samples, List.countP_map] | |
| symm | |
| simpa [Function.comp_def] using (Finset.nodup_toList | |
| (Finset.univ : Finset (Parameter t.vanishing t.target))).card_eq_countP | |
| (P := fun A => H (translate t.vanishing t.target t.base A) = true) | |
| noncomputable def density [Finite E] [Finite C] | |
| (H : (E ββ[F2] C) β Bool) (t : Witness E C) : β := | |
| πΌ A : Parameter t.vanishing t.target, | |
| if H (translate t.vanishing t.target t.base A) then (1 : β) else 0 | |
| theorem density_eq_count_div [Finite E] [Finite C] | |
| (H : (E ββ[F2] C) β Bool) (t : Witness E C) : | |
| density H t = (Deletion.trueCount H (samples t) : β) / | |
| Fintype.card (Parameter t.vanishing t.target) := by | |
| classical | |
| rw [density, Finset.expect_eq_sum_div_card, samples_trueCount] | |
| simp | |
| theorem dense_iff_lt_density [Finite E] [Finite C] | |
| (H : (E ββ[F2] C) β Bool) (r p q : Nat) (hq : 0 < q) | |
| (t : Witness E C) : | |
| Deletion.Dense (system r) H p q t β (p : β) / q < density H t := by | |
| rw [density_eq_count_div] | |
| have hq' : (0 : β) < q := by exact_mod_cast hq | |
| have hcard : (0 : β) < Fintype.card (Parameter t.vanishing t.target) := by | |
| exact_mod_cast parameter_card_pos t.vanishing t.target | |
| rw [div_lt_div_iffβ hq' hcard] | |
| rw [mul_comm (Deletion.trueCount H (samples t) : β) (q : β)] | |
| change p * (samples t).length < q * Deletion.trueCount H (samples t) β _ | |
| rw [samples_length] | |
| constructor <;> intro h <;> exact_mod_cast h | |
| /-- Whole-row deletion gives the normalized real restriction bound on every | |
| actual affine restriction of the permitted dimension and codimension. -/ | |
| theorem remainder_restriction_density [Finite E] [Finite C] | |
| (H : (E ββ[F2] C) β Bool) (r p q : Nat) (hq : 0 < q) | |
| (t : Witness E C) (ht : order t.vanishing t.target β€ r) : | |
| density (Deletion.remainder (system r) H p q) t β€ (p : β) / q := by | |
| rw [density_eq_count_div] | |
| have hcard : (0 : β) < Fintype.card (Parameter t.vanishing t.target) := by | |
| exact_mod_cast parameter_card_pos t.vanishing t.target | |
| have hq' : (0 : β) < q := by exact_mod_cast hq | |
| apply (div_le_div_iffβ hcard hq').mpr | |
| have h := remainder_restriction_count H r p q t ht | |
| have hc : (q : β) * Deletion.trueCount (Deletion.remainder (system r) H p q) | |
| (samples t) β€ (p : β) * Fintype.card (Parameter t.vanishing t.target) := by | |
| exact_mod_cast h | |
| simpa [mul_comm] using hc | |
| /-- The same bound expressed as the squared normalized real `LΒ²` norm. | |
| This is the restriction-global hypothesis used by the Fourier level theorem. -/ | |
| theorem remainder_restriction_sq_expect [Finite E] [Finite C] | |
| (H : (E ββ[F2] C) β Bool) (r p q : Nat) (hq : 0 < q) | |
| (W : Submodule F2 E) (C' : Submodule F2 C) | |
| (horder : order W C' β€ r) (X : E ββ[F2] C) : | |
| (πΌ A : Parameter W C', | |
| (restrict (fun Y => if Deletion.remainder (system r) H p q Y | |
| then (1 : β) else 0) W C' X A) ^ 2) β€ (p : β) / q := by | |
| have heq : (πΌ A : Parameter W C', | |
| (restrict (fun Y => if Deletion.remainder (system r) H p q Y | |
| then (1 : β) else 0) W C' X A) ^ 2) = | |
| density (Deletion.remainder (system r) H p q) β¨W, C', Xβ© := by | |
| apply Finset.expect_congr rfl | |
| intro A _ | |
| simp only [restrict] | |
| split <;> norm_num | |
| rw [heq] | |
| exact remainder_restriction_density H r p q hq β¨W, C', Xβ© horder | |
| /-- A dual map killed by the quotient has a unique factor with values in `W`. | |
| This is the exact finite object counted in the parity argument of Lemma 5.3. -/ | |
| def quotientKernelEquiv (W : Submodule F2 E) : | |
| {T : C ββ[F2] E // W.mkQ.comp T = 0} β (C ββ[F2] W) where | |
| toFun T := T.val.codRestrict W (fun x => by | |
| apply (Submodule.Quotient.mk_eq_zero W).mp | |
| exact congrArg (fun f : C ββ[F2] (E β§Έ W) => f x) T.property) | |
| invFun T := β¨W.subtype.comp T, by | |
| apply LinearMap.ext | |
| intro x | |
| exact (Submodule.Quotient.mk_eq_zero W).mpr (T x).propertyβ© | |
| left_inv T := by | |
| apply Subtype.ext | |
| apply LinearMap.ext | |
| intro x | |
| rfl | |
| right_inv T := by | |
| apply LinearMap.ext | |
| intro x | |
| rfl | |
| theorem quotientKernel_card (W : Submodule F2 E) | |
| [Fintype {T : C ββ[F2] E // W.mkQ.comp T = 0}] | |
| [Fintype (C ββ[F2] W)] : | |
| Fintype.card {T : C ββ[F2] E // W.mkQ.comp T = 0} = | |
| Fintype.card (C ββ[F2] W) := | |
| Fintype.card_congr (quotientKernelEquiv W) | |
| open scoped Classical in | |
| theorem quotientKernel_filter_card (W : Submodule F2 E) | |
| [Fintype (C ββ[F2] E)] [Fintype (C ββ[F2] W)] : | |
| (Finset.univ.filter fun T : C ββ[F2] E => W.mkQ.comp T = 0).card = | |
| Fintype.card (C ββ[F2] W) := by | |
| classical | |
| rw [β Fintype.card_subtype] | |
| exact quotientKernel_card W | |
| /-- Every deleted point determines its row once the target subspace is fixed. | |
| Thus the union bound ranges over target subspaces, not over row values. -/ | |
| theorem deletedSet_iff_exists_target [Finite E] [Finite C] | |
| (H : (E ββ[F2] C) β Bool) (r p q : Nat) (X : E ββ[F2] C) : | |
| Deletion.DeletedSet (system r) H p q X β | |
| β C' : Submodule F2 C, | |
| Deletion.BadRow (system r) H p q β¨C', C'.mkQ.comp Xβ© := by | |
| constructor | |
| Β· rintro β¨β¨C', Zβ©, hbad, hXβ© | |
| change C'.mkQ.comp X = Z at hX | |
| subst Z | |
| exact β¨C', hbadβ© | |
| Β· rintro β¨C', hbadβ© | |
| exact β¨β¨C', C'.mkQ.comp Xβ©, hbad, rflβ© | |
| theorem badRow_codim_le [Finite E] [Finite C] | |
| (H : (E ββ[F2] C) β Bool) (r p q : Nat) (row : Row E C) | |
| (hbad : Deletion.BadRow (system r) H p q row) : | |
| Module.finrank F2 (C β§Έ row.target) β€ r := by | |
| rcases hbad with β¨t, ht, heq, _β© | |
| have ht' : Module.finrank F2 t.vanishing + | |
| Module.finrank F2 (C β§Έ t.target) β€ r := ht | |
| have htarget : t.target = row.target := congrArg Row.target heq | |
| rw [β htarget] | |
| omega | |
| theorem deletedSet_iff_exists_admissible_target [Finite E] [Finite C] | |
| (H : (E ββ[F2] C) β Bool) (r p q : Nat) (X : E ββ[F2] C) : | |
| Deletion.DeletedSet (system r) H p q X β | |
| β C' : Submodule F2 C, Module.finrank F2 (C β§Έ C') β€ r β§ | |
| Deletion.BadRow (system r) H p q β¨C', C'.mkQ.comp Xβ© := by | |
| rw [deletedSet_iff_exists_target] | |
| constructor | |
| Β· rintro β¨C', hbβ© | |
| exact β¨C', badRow_codim_le H r p q β¨C', C'.mkQ.comp Xβ© hb, hbβ© | |
| Β· rintro β¨C', _, hbβ© | |
| exact β¨C', hbβ© | |
| end UniqueGamesTheorem.Fourier.MatrixRestrictions | |
| end | |
| end OAI | |