Download data/lean/OAI/Computability/PerfectCompleteness/Algebra/LowerAffineSliceRank.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 11.3 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/PerfectCompleteness/Algebra/LowerAffineSliceRank.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Computability/PerfectCompleteness/Algebra/LowerAffineSliceRank.lean
-
curl -L -o LowerAffineSliceRank.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Computability/PerfectCompleteness/Algebra/LowerAffineSliceRank.lean
11.3 kB
Lean 4 Β· 9
declarations fullstatements
| import Mathlib.Algebra.BigOperators.Pi | |
| import Mathlib.Data.Fintype.EquivFin | |
| import OAI.Computability.PerfectCompleteness.Algebra.BilinearGramCompressionLemmas | |
| import OAI.Computability.PerfectCompleteness.Algebra.LowerCrossRank | |
| import OAI.Computability.PerfectCompleteness.Algebra.MatrixErasure | |
| import OAI.Computability.PerfectCompleteness.Foundations.PartialTableInverse | |
| import OAI.Computability.PerfectCompleteness.Sampling.RestrictionCrossLaw | |
| namespace OAI | |
| namespace PerfectCompleteness.LowerAffineSliceRank | |
| noncomputable section | |
| open scoped BigOperators Classical | |
| open UniqueGamesTheorem.Integration.BinaryLinear (F2) | |
| open UniqueGamesTheorem.Foundations.Games | |
| open UniqueGamesTheorem.Fourier.MatrixRestrictions | |
| open UniqueGamesTheorem.Fourier.MatrixLevelBridge | |
| open UniqueGamesTheorem.Appendix.RankLevelFilter | |
| open BilinearGramCompression | |
| variable {E : Type*} [AddCommGroup E] [Module F2 E] | |
| [Fintype E] [FiniteDimensional F2 E] | |
| {β m : Nat} | |
| [Fintype (Module.Dual F2 E)] | |
| def matrixRows (X : E ββ[F2] (Fin β β F2)) : Fin β β Module.Dual F2 E := | |
| fun i => (LinearMap.proj i).comp X | |
| def testedGram (F : Module.Dual F2 E ββ[F2] Module.Dual F2 (Module.Dual F2 E)) | |
| (X : E ββ[F2] (Fin β β F2)) : Matrix (Fin β) (Fin β) F2 := | |
| gram F (matrixRows X) | |
| omit [Fintype E] [FiniteDimensional F2 E] [Fintype (Module.Dual F2 E)] in | |
| theorem coordinate_eq_sum (X : E ββ[F2] (Fin β β F2)) | |
| (q : Module.Dual F2 (Fin β β F2)) : | |
| q.comp X = β k, q (Pi.single k 1) β’ matrixRows X k := by | |
| apply LinearMap.ext | |
| intro e | |
| simp only [LinearMap.sum_apply, LinearMap.smul_apply, LinearMap.comp_apply, | |
| matrixRows, LinearMap.proj_apply, smul_eq_mul] | |
| change q (X e) = β k, q (Pi.single k 1) * X e k | |
| have hrows := pi_eq_sum_univ' (X e) | |
| calc | |
| q (X e) = q (β k : Fin β, (X e k) β’ Pi.single k (1 : F2)) := | |
| congrArg q hrows | |
| _ = β k : Fin β, (X e k) * q (Pi.single k 1) := by | |
| simp only [map_sum, map_smul, smul_eq_mul] | |
| _ = _ := Finset.sum_congr rfl (fun k _ => mul_comm _ _) | |
| omit [Fintype E] [FiniteDimensional F2 E] [Fintype (Module.Dual F2 E)] in | |
| theorem coordinate_cross_rank_le | |
| (F : Module.Dual F2 E ββ[F2] Module.Dual F2 (Module.Dual F2 E)) | |
| (X : E ββ[F2] (Fin β β F2)) | |
| (left right : Fin m β Module.Dual F2 (Fin β β F2)) : | |
| Matrix.rank ((fun i j => F ((left i).comp X) ((right j).comp X)) : | |
| Matrix (Fin m) (Fin m) F2) β€ | |
| (testedGram F X).rank := by | |
| have hleft : combinations (matrixRows X) | |
| (fun i k => left i (Pi.single k 1)) = fun i => (left i).comp X := by | |
| funext i | |
| exact (coordinate_eq_sum X (left i)).symm | |
| have hright : combinations (matrixRows X) | |
| (fun j k => right j (Pi.single k 1)) = fun j => (right j).comp X := by | |
| funext j | |
| exact (coordinate_eq_sum X (right j)).symm | |
| have h := cross_rank_le F (matrixRows X) | |
| (fun i k => left i (Pi.single k 1)) | |
| (fun j k => right j (Pi.single k 1)) | |
| rw [hleft, hright] at h | |
| exact h | |
| section Coordinates | |
| variable {I : Type*} [Fintype I] | |
| (W : Submodule F2 E) (C' : Submodule F2 (Fin β β F2)) | |
| (b : Module.Basis I F2 C') (sel : (Fin m β Fin m) β I) | |
| theorem slice_probability_le_of_coordinates (hsel : Function.Injective sel) | |
| (coordinates : I β Module.Dual F2 (Fin β β F2)) | |
| (hcoordinates : β i, (coordinates i).comp C'.subtype = b.coord i) | |
| (X : E ββ[F2] (Fin β β F2)) | |
| (F : Module.Dual F2 E ββ[F2] Module.Dual F2 (Module.Dual F2 E)) | |
| (r s : Nat) (hW : Module.finrank F2 W β€ r) | |
| (hrank : s < Module.finrank F2 (LinearMap.range F)) : | |
| (FiniteDistribution.uniform (Parameter W C')).probability | |
| (fun A => decide ((testedGram F (translate W C' X A)).rank β€ 1)) β€ | |
| (2 : β) ^ m / (2 : β) ^ (s - 2 * r) + | |
| (2 : β) ^ (2 * m) / (2 : β) ^ (m * m) := by | |
| have hlaw := RestrictionCrossLaw.crossMatrix_law W C' b sel hsel | |
| coordinates hcoordinates X F | |
| have hp := congrArg | |
| (fun ΞΌ : FiniteDistribution (Matrix (Fin m) (Fin m) F2) => | |
| ΞΌ.probability (fun M => decide (M.rank β€ 1))) hlaw | |
| simp only [FiniteDistribution.probability_pushforward] at hp | |
| have hsource := FiniteDistribution.probability_pushforward | |
| (Ξ := Matrix (Fin m) (Fin m) F2) | |
| (FiniteDistribution.uniform (Parameter W C')) | |
| (fun A i j => | |
| F ((coordinates (sel (Sum.inl i))).comp (translate W C' X A)) | |
| ((coordinates (sel (Sum.inr j))).comp (translate W C' X A))) | |
| (fun M => decide (M.rank β€ 1)) | |
| have hp' := hsource.symm.trans hp | |
| have hcodim : Module.finrank F2 | |
| (Module.Dual F2 E β§Έ W.dualAnnihilator) β€ r := by | |
| rw [DualQuotientRows.codim_dualAnnihilator_eq] | |
| exact hW | |
| calc | |
| _ β€ (FiniteDistribution.uniform (Parameter W C')).probability | |
| (fun A => decide (Matrix.rank ((fun i j => | |
| F ((coordinates (sel (Sum.inl i))).comp (translate W C' X A)) | |
| ((coordinates (sel (Sum.inr j))).comp (translate W C' X A))) : | |
| Matrix (Fin m) (Fin m) F2) β€ 1)) := by | |
| apply FiniteDistribution.probability_mono | |
| intro A hA | |
| apply decide_eq_true | |
| exact (coordinate_cross_rank_le F (translate W C' X A) | |
| (fun i => coordinates (sel (Sum.inl i))) | |
| (fun j => coordinates (sel (Sum.inr j)))).trans (of_decide_eq_true hA) | |
| _ = _ := hp' | |
| _ β€ _ := LowerCrossRank.cross_rank_probability_le_of_rank_gt F W.dualAnnihilator | |
| (fun i => (coordinates (sel (Sum.inl i))).comp X) | |
| (fun j => (coordinates (sel (Sum.inr j))).comp X) r s hcodim hrank | |
| end Coordinates | |
| theorem slice_rank_probability_le_of_rank_gt | |
| (W : Submodule F2 E) (C' : Submodule F2 (Fin β β F2)) | |
| (X : E ββ[F2] (Fin β β F2)) | |
| (F : Module.Dual F2 E ββ[F2] Module.Dual F2 (Module.Dual F2 E)) | |
| (r s : Nat) (horder : order W C' β€ r) (hrows : 2 * m + r β€ β) | |
| (hrank : s < Module.finrank F2 (LinearMap.range F)) : | |
| (FiniteDistribution.uniform (Parameter W C')).probability | |
| (fun A => decide ((testedGram F (translate W C' X A)).rank β€ 1)) β€ | |
| (2 : β) ^ m / (2 : β) ^ (s - 2 * r) + | |
| (2 : β) ^ (2 * m) / (2 : β) ^ (m * m) := by | |
| let b := Module.finBasis F2 C' | |
| have hW : Module.finrank F2 W β€ r := (Nat.le_add_right _ _).trans horder | |
| have hdim : 2 * m β€ Module.finrank F2 C' := by | |
| have htotal := C'.finrank_quotient_add_finrank | |
| have hfull : Module.finrank F2 (Fin β β F2) = β := by | |
| simp [Module.finrank_fintype_fun_eq_card] | |
| rw [hfull] at htotal | |
| unfold order at horder | |
| omega | |
| obtain β¨selβ© := Function.Embedding.nonempty_of_card_le | |
| (show Fintype.card (Fin m β Fin m) β€ | |
| Fintype.card (Fin (Module.finrank F2 C')) by | |
| simpa only [Fintype.card_sum, Fintype.card_fin, two_mul] using hdim) | |
| let coordinates : Fin (Module.finrank F2 C') β Module.Dual F2 (Fin β β F2) := | |
| fun i => Subspace.dualLift C' (b.coord i) | |
| have hcoordinates : β i, (coordinates i).comp C'.subtype = b.coord i := by | |
| intro i | |
| apply LinearMap.ext | |
| intro x | |
| change Subspace.dualLift C' (b.coord i) (x : Fin β β F2) = b.coord i x | |
| exact Subspace.dualLift_of_subtype (Ο := b.coord i) x | |
| exact slice_probability_le_of_coordinates W C' b sel sel.injective | |
| coordinates hcoordinates X F r s hW hrank | |
| variable {Y : Type*} [Fintype Y] | |
| (f : (E ββ[F2] (Fin β β F2)) β Option Y) | |
| (form : Y β Module.Dual F2 E ββ[F2] Module.Dual F2 (Module.Dual F2 E)) | |
| private theorem probability_eq_expect_indicator {A : Type*} [Fintype A] [Nonempty A] | |
| (event : A β Bool) : | |
| (FiniteDistribution.uniform A).probability event = | |
| πΌ a : A, if event a then (1 : β) else 0 := by | |
| have h : (FiniteDistribution.uniform A).probability event = | |
| (FiniteDistribution.uniform A).expectation (fun a => if event a then (1 : β) else 0) := by | |
| simp [FiniteDistribution.probability, FiniteDistribution.expectation, mul_ite] | |
| rw [h, FiniteDistribution.expectation_uniform, Fintype.expect_eq_sum_div_card] | |
| omit [Fintype Y] in | |
| theorem dense_value_rank_le | |
| (tested : β X y, f X = some y β (testedGram (form y) X).rank β€ 1) | |
| (W : Submodule F2 E) (C' : Submodule F2 (Fin β β F2)) | |
| (X : E ββ[F2] (Fin β β F2)) (y : Y) | |
| (r s : Nat) (Ο : β) (horder : order W C' β€ r) (hrows : 2 * m + r β€ β) | |
| (herror : (2 : β) ^ m / (2 : β) ^ (s - 2 * r) + | |
| (2 : β) ^ (2 * m) / (2 : β) ^ (m * m) β€ Ο) | |
| (hdense : Ο < πΌ A : Parameter W C', | |
| restrict (PartialTableInverse.indicator f y) W C' X A) : | |
| Module.finrank F2 (LinearMap.range (form y)) β€ s := by | |
| by_contra h | |
| have hbound := slice_rank_probability_le_of_rank_gt W C' X (form y) r s | |
| horder hrows (Nat.lt_of_not_ge h) | |
| have hdom : (πΌ A : Parameter W C', | |
| restrict (PartialTableInverse.indicator f y) W C' X A) β€ | |
| (FiniteDistribution.uniform (Parameter W C')).probability | |
| (fun A => decide ((testedGram (form y) (translate W C' X A)).rank β€ 1)) := by | |
| rw [probability_eq_expect_indicator] | |
| apply Finset.expect_le_expect | |
| intro A _ | |
| by_cases hf : f (translate W C' X A) = some y | |
| Β· simp [restrict, PartialTableInverse.indicator, hf, tested _ _ hf] | |
| Β· simp only [restrict, PartialTableInverse.indicator, ite_eq_right hf] | |
| split_ifs <;> norm_num | |
| exact (not_le_of_gt hdense) (hdom.trans (hbound.trans herror)) | |
| theorem high_rank_agreement_lt | |
| [Fintype (E ββ[F2] (Fin β β F2))] | |
| [Fintype ((Fin β β F2) ββ[F2] E)] | |
| (tested : β X y, f X = some y β (testedGram (form y) X).rank β€ 1) | |
| (r s : Nat) (Ο Ξ· : β) (hm : 0 < m) | |
| (hΟ : 0 < Ο) (hΟ1 : Ο < 1) | |
| (hconstants : levelCutoffConstant r Ο + node (r + 1) < Ξ·) | |
| (hrows : 2 * m + r β€ β) | |
| (herror : (2 : β) ^ m / (2 : β) ^ (s - 2 * r) + | |
| (2 : β) ^ (2 * m) / (2 : β) ^ (m * m) β€ Ο) : | |
| PartialTableInverse.nonzeroAgreement | |
| (MatrixErasure.erase f (fun X => β y, f X = some y β§ | |
| Module.finrank F2 (LinearMap.range (form y)) β€ s)) < Ξ· := by | |
| have hβ : 0 < β := by omega | |
| let : Nonempty (Fin β) := β¨β¨0, hββ©β© | |
| let T := fun X => β y, f X = some y β§ | |
| Module.finrank F2 (LinearMap.range (form y)) β€ s | |
| let g := MatrixErasure.erase f T | |
| have htested : β X y, g X = some y β (testedGram (form y) X).rank β€ 1 := by | |
| intro X y h | |
| exact tested X y ((MatrixErasure.erase_eq_some_iff f T X y).mp h).2 | |
| by_contra h | |
| have hagreement : Ξ· β€ PartialTableInverse.nonzeroAgreement g := le_of_not_gt h | |
| obtain β¨y, W, C', X, horder, hdenseβ© := | |
| PartialTableInverse.exists_dense_slice_nonzero r Ο Ξ· hΟ hΟ1 hconstants g hagreement | |
| have hrank := dense_value_rank_le g form htested W C' X y r s Ο horder hrows herror hdense | |
| have hnone (A : Parameter W C') : g (translate W C' X A) β some y := by | |
| intro h | |
| have he := (MatrixErasure.erase_eq_some_iff f T _ y).mp h | |
| exact he.1 β¨y, he.2, hrankβ© | |
| have hzero : (πΌ A : Parameter W C', | |
| restrict (PartialTableInverse.indicator g y) W C' X A) = 0 := by | |
| apply Finset.expect_eq_zero | |
| intro A _ | |
| simp [restrict, PartialTableInverse.indicator, hnone A] | |
| rw [hzero] at hdense | |
| exact (not_lt_of_ge hΟ.le) hdense | |
| end | |
| end PerfectCompleteness.LowerAffineSliceRank | |
| end OAI | |
Outline