import OAI.Geometry.ComplexBundle.Avoidance import Mathlib.LinearAlgebra.Dimension.RankNullity namespace OAI noncomputable section /-! Finite-point incidence avoidance and expansion inequalities. -/ section open scoped MeasureTheory open Set Module MeasureTheory MeasureTheory.Measure namespace Kaplansky.Incidence open ComplexGrassmann variable {q s k t l : ℕ} def PointBad : Set (TupleOperators q s k t l) := {T | ∃ (P : Grassmann s k) (Q : Grassmann t l), ∀ i, ∀ x ∈ P.val, T i x ∈ Q.val} /-- The full bad locus over a point is null, across ALL s-planes and t-planes. The countable graph cover is constructed from the actual Grassmann spaces. -/ theorem pointBad_null [MeasurableSpace (TupleOperators q s k t l)] [BorelSpace (TupleOperators q s k t l)] (hgap : s*k+t*l intro _; exact ⟨S,le_rfl,by omega⟩ | succ j ih => intro hj obtain ⟨U,hSU,hU⟩ := ih (by omega) have hu : finrank ℂ U ?_⟩ by_contra h have hd : finrank ℂ (⨆ i, S.map (T i).toLinearMap : Submodule ℂ (Components t l))≤t := by omega obtain ⟨U,hWU,hU⟩ := exists_super_finrank (⨆ i, S.map (T i).toLinearMap : Submodule ℂ (Components t l)) hd (by simp [Components]) apply hT ⟨S,hS⟩ ⟨U,hU⟩ intro i x hx apply hWU apply (le_iSup (fun i => S.map (T i).toLinearMap) i) exact Submodule.mem_map.mpr ⟨x,hx,rfl⟩ end Kaplansky.Incidence end open scoped MeasureTheory open Set Module MeasureTheory MeasureTheory.Measure namespace Kaplansky.Incidence open ComplexGrassmann abbrev MatrixTuple (q d r : ℕ) := Fin q → (Fin d → ℂ) →L[ℂ] (Fin r → ℂ) def RankBad {q d r : ℕ} (s t : ℕ) : Set (MatrixTuple q d r) := {T | ∃ S : Submodule ℂ (Fin d → ℂ), finrank ℂ S=s ∧ ∃ U : Submodule ℂ (Fin r → ℂ), finrank ℂ U=t ∧ ∀ i, ∀ x ∈ S, T i x ∈ U} theorem rankBad_null {q d r s t : ℕ} [MeasurableSpace (MatrixTuple q d r)] [BorelSpace (MatrixTuple q d r)] (hsd : s≤d) (htr : t≤r) (hgap : s*(d-s)+t*(r-t) measure_iUnion_null (fun hp => rankBad_null (hpairs p hp).1 (hpairs p hp).2.1 (hpairs p hp).2.2)) have hev : ∃ T : MatrixTuple q d r, T ∉ ⋃ p ∈ pairs, RankBad (q := q) (d := d) (r := r) p.1 p.2 := by by_contra h push Not at h have hu : (⋃ p ∈ pairs, RankBad (q := q) (d := d) (r := r) p.1 p.2)=univ := Set.eq_univ_of_forall h rw [hu] at hn have hp : 0<μH[finrank ℝ (MatrixTuple q d r)] (univ : Set (MatrixTuple q d r)) := isOpen_univ.measure_pos _ Set.univ_nonempty exact (ne_of_gt hp) hn obtain ⟨T,hT⟩ := hev refine ⟨T,fun p hp S hS => ?_⟩ by_contra h have hd : finrank ℂ (⨆ i, S.map (T i).toLinearMap : Submodule ℂ (Fin r → ℂ))≤p.2 := by omega obtain ⟨U,hWU,hU⟩ := exists_super_finrank (⨆ i, S.map (T i).toLinearMap : Submodule ℂ (Fin r → ℂ)) hd (by simpa using (hpairs p hp).2.1) apply hT refine Set.mem_iUnion.mpr ⟨p,Set.mem_iUnion.mpr ⟨hp,S,hS,U,hU,?_⟩⟩ intro i x hx apply hWU apply (le_iSup (fun i => S.map (T i).toLinearMap) i) exact Submodule.mem_map.mpr ⟨x,hx,rfl⟩ theorem point_dimension_inequality_iff {q d r s t : ℕ} (hsd : s≤d) (htr : t≤r) : ((q : ℤ)*s-t)*(r-t)-(s : ℤ)*(d-s)>0 ↔ s*(d-s)+t*(r-t)