import OAI.Analysis.CircleDomains.Rigidity.CodeRealFreeTrace import OAI.Analysis.CircleDomains.Selection.RealDomainIntersections import OAI.Analysis.CircleDomains.Selection.FiniteFlagIntersections import OAI.Analysis.CircleDomains.Probability.BandMeasure namespace OAI /-! Generic prior-level intersections for real coordinates under a base-code law, with physical, flagged, and free contributions. -/ open Set Function Filter MeasureTheory open scoped Topology ENNReal NNReal noncomputable section namespace CircleDomainRigidity attribute [local instance] sphereMetric sphereBorel local instance : BorelSpace Sphere := ⟨rfl⟩ variable [MeasurableSpace C(PathTime, Sphere)] [BorelSpace C(PathTime, Sphere)] theorem ae_code_real_level_intersections_finite (hcoarea : PlanarLipschitzFiberCoarea) (hsard : SmoothPlanarSard) (hsch : PlanarSchoenflies) (d : PathCodeData Sphere Sphere) (hG : IsOpen d.physicalDomain) (hU : IsOpen d.quotientDomain) (hdense : Dense d.quotientDomain) (hdust : d.dust = d.quotientDomainᶜ) (π : Sphere → Sphere) (hπ : Continuous π) (hclosed : IsClosedMap π) (hsurj : Surjective π) (hr : ∀ x y, π x = π y ↔ x = y ∨ (x ∈ d.physicalDomainᶜ ∧ y ∈ connectedComponentIn d.physicalDomainᶜ x)) (he : ∀ y : d.physicalDomain, (d.domainEquiv y).val = π y.val) (hTD : IsTotallyDisconnected d.quotientDomainᶜ) (hbad : ∀ p ∈ d.physicalDomainᶜ, π p ∈ d.quotientDomainᶜ) (Flags : Set Sphere) (hFlags : Flags.Countable) (hFlagsB : Flags ⊆ d.quotientDomainᶜ) (f : Sphere → ℝ) {M : ℝ} (hM : ∀ z ∈ d.quotientDomain, |f z| ≤ M) (hf : ContinuousOn f d.quotientDomain) (hv : ContDiffOn ℝ 1 (fun z : ℂ => f (π (z : Sphere))) (((↑) : ℂ → Sphere) ⁻¹' d.physicalDomain)) (henergy : (∫⁻ z in ((↑) : ℂ → Sphere) ⁻¹' d.physicalDomain, ENNReal.ofReal ‖fderiv ℝ (fun z : ℂ => f (π (z : Sphere))) z‖ ^ 2) < ∞) {K : Set ℂ} (hK : IsCompact K) (hzero : ∀ z : ℂ, (z : Sphere) ∈ d.physicalDomain → z ∉ K → f (π (z : Sphere)) = 0) (hinfty : OnePoint.infty ∈ d.physicalDomain → f (π OnePoint.infty) = 0) (P : ProbabilityMeasure (BasePathCode d)) (ρ : Sphere → ℝ≥0∞) (hρ : Measurable ρ) (hocc : meanCodeOccupation d P = sphericalArea.withDensity ρ) (hρ2 : (∫⁻ y, ρ y ^ 2 ∂sphericalArea) < ∞) (i : ℕ) (hm : (support (d.levelWeights i)).Countable) (hweight : countingSquareNorm (fun x : support (d.levelWeights i) => d.levelWeights i x.val) < ∞) (hvisits : countingSquareNorm (fun x : support (d.levelWeights i) => meanVisitCount (codePathLaw d P) x.val) < ∞) (hband : ∀ z ∈ d.quotientDomainᶜ, ENNReal.ofReal (limsup f (𝓝[d.quotientDomain] z) - liminf f (𝓝[d.quotientDomain] z)) ≤ d.levelWeights i z) (hmFree : ∀ z ∈ d.quotientDomainᶜ \ Flags, d.levelWeights i z = 0) (hcover : ∀ x ∈ support (d.levelWeights i), ∀ᶠ n in atTop, x ∈ d.flagDeletions n) (hdeletions : ∀ n, (d.flagDeletions n : Set Sphere) ⊆ Flags) (hH : ∀ j, IsClosed (d.levels j)) (hP : OrderedLevelNullCompatibility d.levels (d.quotientDomainᶜ \ Flags)) (hunique : ∀ x ∈ d.quotientDomainᶜ \ Flags, ∀ j a b, (a, x) ∈ d.levels j → (b, x) ∈ d.levels j → a = b) (ω : TupleType → ℝ≥0∞) [SFinite (tupleReference ω)] (hτ : meanCodeTuple d P ≪ tupleReference ω) (hlevel : ∀ θ x, (θ, x) ∈ d.levels i ↔ (x, θ) ∈ circleBandGraph d.quotientDomain f) : ∀ᵐ Γ ∂(P : Measure (BasePathCode d)), ∀ᵐ θ : UnitAddCircle ∂volume, (range Γ.val.1 ∩ {x | (θ, x) ∈ d.levels i}).Finite := by have hfree := ae_code_real_free_level_incidence_null hsard hsch d hG hU hdense hdust π hπ hclosed hsurj hr he hTD hbad Flags hFlags hFlagsB f hM hf hv henergy P ρ hρ hocc hρ2 i hm hweight hvisits hband hmFree hcover hdeletions hH hP hunique ω hτ hlevel have hfinite : ∀ᵐ γ ∂(codePathLaw d P : Measure C(PathTime, Sphere)), physicalDomainLength d.domainEquiv d.basePoint γ < ∞ := by change ∀ᵐ γ ∂(P : Measure (BasePathCode d)).map (codePath d), _ apply (ae_map_iff (measurable_codePath d).aemeasurable (measurableSet_finitePhysicalDomainLength d.domainEquiv hU d.basePoint)).mpr exact Eventually.of_forall fun Γ => Γ.property.1.1 have hdom := ae_real_domain_circle_count_finite hcoarea hG d.domainEquiv hU d.basePoint π hπ he f hf hv henergy hK hzero hinfty (codePathLaw d P) hfinite ρ hρ ((meanPhysicalOccupation_codePathLaw d hU P).trans hocc) hρ2 have hvol : ∀ x ∈ Flags, volume {θ : UnitAddCircle | (θ, x) ∈ d.levels i} ≤ d.levelWeights i x := by intro x hx have heq : {θ : UnitAddCircle | (θ, x) ∈ d.levels i} = {θ : UnitAddCircle | (x, θ) ∈ circleBandGraph d.quotientDomain f} := Set.ext fun θ => hlevel θ x rw [heq] exact (volume_circleBandGraph_incidence_le_budget hM (by rw [hdense.closure_eq]; exact mem_univ x) le_rfl).trans (hband x (hFlagsB hx)) have hflag := ae_flag_intersection_count_finite_of_support (hH i) Flags hFlags (d.levelWeights i) hvol (codePathLaw d P) hm hweight hvisits have hdomP := ae_of_ae_map (measurable_codePath d).aemeasurable hdom have hflagP := ae_of_ae_map (measurable_codePath d).aemeasurable hflag filter_upwards [hfree, hdomP, hflagP] with Γ hΓfree hΓdom hΓflag have hfreet : ∀ᵐ θ : UnitAddCircle ∂volume, ¬ ∃ x ∈ range Γ.val.1 ∩ (d.quotientDomainᶜ \ Flags), (θ, x) ∈ d.levels i := ae_iff.mpr (by simpa only [not_not] using hΓfree) filter_upwards [hfreet, hΓdom, hΓflag] with θ hθfree hθdom hθflag apply finite_level_of_no_free_hits d.quotientDomain Flags {x | (θ, x) ∈ d.levels i} Γ.val.1 hθfree · simpa only [hlevel, codePath] using hθdom · exact hθflag end CircleDomainRigidity end end OAI