cfahlgren1/math / lean /OAI /Combinatorics /PlanarL1 /FamilyPersistence.lean
cfahlgren1's picture
download
raw
37.2 kB
15
lemma mem_domain_iff_distance (seeds : Finset (M.Point J root)) (radius : ℝ)
    (x : M.Point J root) : x.height ∈ domain seeds radius x.column ↔ seedDistance seeds x≤radius := by
proof · 6 lines
  constructor
  · intro h
    obtain ⟨z,hc,hH,hd⟩ := (mem_domain seeds radius).mp h
    exact Point.eq_of_coordinates z x hc hH ▸ hd
  · intro h
    exact (mem_domain seeds radius).mpr ⟨x,rfl,rfl,h⟩
23
lemma point_eq (seeds : Finset (M.Point J root)) (radius : ℝ) (x : M.Point J root)
    (h : x.height ∈ domain seeds radius x.column) : point seeds radius _ _ h=x :=
proof · 1 line
  Point.eq_of_coordinates _ _ (point_column _ _ _) (point_height _ _ _)
32
lemma fullNamed_at (z : M.Point J root) (hz : SecondaryCell.seedDistance U.seeds z≤U.radius) :
    U.fullNamed z.column ⟨z.height,U.sub_old z.inBand⟩=U.named z := by
proof · 2 lines
  have hd := (SecondaryCell.mem_domain_iff_distance U.seeds U.radius z).mpr hz
  simp only [fullNamed,dite_eq_left hd,SecondaryCell.point_eq]

A crossed seed-domain is identically old on the small ball, including its actual deterministic branch name. No independence or pruning assumption.

39
lemma fullNamed_boundary_ball (x y : M.Point J root) {ρ : ℝ}
    (hsmall : 18*ρ≤(199/1000:ℝ)*U.radius) (hy : dist x y≤ρ)
    (hout : y.height ∉ SecondaryCell.domain U.seeds U.radius y.column)
    (z : M.Point J root) (hz : dist x z≤ρ) :
    U.fullNamed z.column ⟨z.height,U.sub_old z.inBand⟩=⟨0,U.old z⟩ := by
proof · 11 lines
  by_cases hd : z.height ∈ SecondaryCell.domain U.seeds U.radius z.column
  · have hin := (SecondaryCell.mem_domain_iff_distance U.seeds U.radius z).mp hd
    rw [U.fullNamed_at z hin]
    have hyout : U.radius≤SecondaryCell.seedDistance U.seeds y := le_of_lt (lt_of_not_ge
      (fun h => hout ((SecondaryCell.mem_domain_iff_distance U.seeds U.radius y).mpr h)))
    exact SecondaryCell.namedReplacement_boundary_ball U.tree U.seeds U.old U.supportValue U.data.isOrdinary
      U.seeds_nonempty U.old_lipschitz U.support_lipschitz U.zeta_eq U.radius_nonneg
      U.ordered_bound U.delta_eq U.noise_bounds U.support_le U.admitted U.shield_offset U.lo
      x y hsmall hy hyout z hz hin
  · rw [fullNamed,dite_eq_right hd]
    rfl
76
lemma group_touched_band : i.1.2.val.val=Tiling.index a₂ p x.height := by
proof · 4 lines
  apply Tiling.near_band_unique interpolationB.2.1 hρ hp _
    (i.1.narrow_eq ▸ SecondaryCell.inBand_of_mem _ _ hd)
  rw [abs_sub_comm]
  exact (x.height_change_le z).trans hz
81
lemma group_touched_envelope : ∀ H, |H-x.height|≤ρ → H ∈ BandTrees.band narrow (group A SA SB v hv i).lower := by
proof · 5 lines
  intro H hH
  have he := group_touched_band A SA SB v hv x hρ hp i positive C hz hd
  have hb := Tiling.near_mem_band interpolationB.2.1 hρ hp hH
  rw [←he,←i.1.narrow_eq] at hb
  exact hb
87
lemma group_local_center : ∃ x' : M.Point (BandTrees.band narrow (group A SA SB v hv i).lower)
    ((group A SA SB v hv i).root C), x'.column=x.column ∧ x'.height=x.height :=
proof · 3 lines
  Point.local_center x z (SecondaryCell.point _ _ _ _ hd)
    (SecondaryCell.point_column _ _ _) (SecondaryCell.point_height _ _ _) hρ
      (group_touched_envelope A SA SB v hv x hρ hp i positive C hz hd) hz
93
lemma ball_domain_touch (b : Block (M := M) q p L U)
    (c : M.Point (BandTrees.band broad b.lower) (BandTrees.root M broad b.lower b.1.2))
    (hc : c.column=x.column) (hH : c.height=x.height)
    (hC : ((group A SA SB v hv i).admittedSeeds positive C).Nonempty) (hsmall : ρ+R≤4*R) :
    Touch A SA SB v hv b c i := by
proof · 14 lines
  obtain ⟨ha,w,hw,r,hr⟩ := (group A SA SB v hv i).domain_near positive C hC z.column z.height hd
  obtain ⟨s,_,hs⟩ := x.exists_shortest isClosed_univ z
  obtain ⟨t,ht⟩ := s.restrict_of_length x.height z.height x.height ρ
    (group_touched_envelope A SA SB v hv x hρ hp i positive C hz hd) (by simpa [hs] using hz)
  obtain ⟨u,hu,he⟩ := (SurvivingGroups.seed_mem
    (localSeeds A SA SB v hv (phaseD := phaseD) (phaseG := phaseG) i.1) i.2).mp hw
  subst w
  refine ⟨?_,u,hu,(t.cast hc.symm rfl).append r,?_⟩
  · rw [hH]
    exact group_touched_envelope A SA SB v hv x hρ hp i positive C hz hd _ (by simpa using hρ)
  · have ht' : (t.cast hc.symm rfl).length c.height z.height≤ρ := by
      rw [Path.length_cast,hH,ht,hs]
      exact hz
    exact ((t.cast hc.symm rfl).length_append_le r c.height z.height _).trans (by linarith)
127
lemma ball_variation {J : Set ℝ} {r : Fin (k+1)} {K : ℝ≥0} (F : M.Field J K)
    (x z : M.Point Set.univ r) {ρ : ℝ} (hρ : 0≤ρ)
    (hJ : ∀ H, |H-x.height|≤ρ → H ∈ J) (hz : dist x z≤ρ) :
    ∃ (hx : x.height ∈ J) (hZ : z.height ∈ J),
      |F.value x.column ⟨x.height,hx⟩-F.value z.column ⟨z.height,hZ⟩|≤(K:ℝ)*ρ := by
proof · 7 lines
  have hx := hJ x.height (by simpa using hρ)
  have hZ := hJ z.height (by rw [abs_sub_comm]; exact (x.height_change_le z).trans hz)
  obtain ⟨p,_,hp⟩ := x.exists_shortest isClosed_univ z
  obtain ⟨q,hq⟩ := p.restrict_of_length x.height z.height x.height ρ hJ (by simpa [hp] using hz)
  refine ⟨hx,hZ,(F.path_bound q ⟨x.height,hx⟩ ⟨z.height,hZ⟩).trans ?_⟩
  rw [hq,hp]
  exact mul_le_mul_of_nonneg_left hz (NNReal.coe_nonneg K)
145
lemma point_dist (x z : M.Point Set.univ r) {ρ : ℝ}
    (hJ : ∀ H, |H-x.height|≤ρ → H ∈ J) (hz : dist x z≤ρ)
    (hx : x.height ∈ SecondaryCell.domain U.seeds U.radius x.column)
    (hZ : z.height ∈ SecondaryCell.domain U.seeds U.radius z.column) :
    dist (SecondaryCell.point U.seeds U.radius _ _ hx) (SecondaryCell.point U.seeds U.radius _ _ hZ)=dist x z := by
proof · 6 lines
  obtain ⟨z',hc,hH,hd⟩ := Point.local_point x z (SecondaryCell.point _ _ _ _ hx)
    (SecondaryCell.point_column _ _ _) (SecondaryCell.point_height _ _ _) isClosed_univ
    (Set.subset_univ _) hJ hz
  have he : z'=SecondaryCell.point U.seeds U.radius _ _ hZ := Point.eq_of_coordinates _ _
    (hc.trans (SecondaryCell.point_column _ _ _).symm) (hH.trans (SecondaryCell.point_height _ _ _).symm)
  rwa [he] at hd

Crossing the domain anywhere on the ambient small ball makes this actual proposal identically old on that ball. Intrinsic paths are derived by height padding, rather than silently identified with ambient paths.

160
lemma fullNamed_boundary_global (x y z : M.Point Set.univ r) {ρ : ℝ} (hρ : 0≤ρ)
    (hJ : ∀ H, |H-x.height|≤ρ → H ∈ J)
    (hsmall : 18*ρ≤(199/1000:ℝ)*U.radius) (hy : dist x y≤ρ)
    (hout : y.height ∉ SecondaryCell.domain U.seeds U.radius y.column)
    (hz : dist x z≤ρ) (hZ : z.height ∈ U.data.band) :
    U.fullNamed z.column ⟨z.height,hZ⟩=⟨0,U.comparison.value z.column ⟨z.height,hZ⟩⟩ := by
proof · 12 lines
  by_cases hd : z.height ∈ SecondaryCell.domain U.seeds U.radius z.column
  · let zp := SecondaryCell.point U.seeds U.radius _ _ hd
    obtain ⟨xp,hxc,hxh⟩ := Point.local_center x z zp
      (SecondaryCell.point_column _ _ _) (SecondaryCell.point_height _ _ _) hρ hJ hz
    obtain ⟨yp,hyc,hyh,hdy⟩ := Point.local_point x y xp hxc hxh isClosed_univ (Set.subset_univ _) hJ hy
    obtain ⟨zz,hzc,hzh,hdz⟩ := Point.local_point x z xp hxc hxh isClosed_univ (Set.subset_univ _) hJ hz
    have hout' : yp.height ∉ SecondaryCell.domain U.seeds U.radius yp.column := by rwa [hyc,hyh]
    have he := U.fullNamed_boundary_ball xp yp hsmall (hdy.le.trans hy) hout' zz (hdz.le.trans hz)
    have hzz : zz.column=z.column := hzc
    have hZZ : zz.height=z.height := hzh
    simpa only [hzz,hZZ,old] using he
  · rw [fullNamed,dite_eq_right hd]
189
noncomputable def secondaryK : ℝ≥0 := max 5 ⟨3/(9*a₂/100),by norm_num [a₂]⟩
190
noncomputable def secondaryQ : ℝ := zetaB*(EB/8)/20
191
noncomputable def secondaryRadius : ℝ := zetaB*(EB/8)/1000
192
noncomputable def secondaryN : ℕ := 6*(⌈15/zetaB⌉₊+3+1)+3
193
noncomputable def secondaryTestLoss (ρ : ℝ) (m : ℕ) : ℝ :=
body · 1 line
  (4*(secondaryK:ℝ)*ρ+secondaryQ/m)/secondaryQ+(4*(secondaryK:ℝ)*ρ+EB/m)/EB
195
lemma secondaryTestLoss_nonneg {ρ : ℝ} (hρ : 0 ≤ ρ) (m : ℕ) : 0 ≤ secondaryTestLoss ρ m := by
proof · 2 lines
  unfold secondaryTestLoss
  positivity [show 0 < secondaryQ by norm_num [secondaryQ,zetaB,EB,R],interpolationB.1]
208
abbrev Offset := Point.RadialTree.GridSample (n := k+1) (G.tree C).depthCap m × Fin (m+1) × Fin (m+1)
209
noncomputable def sampledStep (w : Offset G C (m := m)) :=
body · 2 lines
  G.step positive C hC ((G.tree C).gridNoise _ m w.1) ((G.tree C).gridNoise_bounds _ _ hm w.1)
    (EB/m*w.2.1.val) (EB/m*w.2.2.val) (offset_bound hm _) (offset_bound hm _)
214
abbrev Ball := {z : M.Point Set.univ A.root // dist x z ≤ ρ}
215
noncomputable def ballCenter : Ball x (ρ := ρ) := ⟨x,by simpa using hρ⟩
217
noncomputable def oldOnBall (z : Ball x (ρ := ρ)) : ℝ :=
body · 1 line
  (G.comparison positive).value z.val.column ⟨z.val.height,hBand z⟩
219
noncomputable def sampledOnBall (w : Offset G C (m := m)) (z : Ball x (ρ := ρ)) : NamedValue :=
body · 1 line
  (G.sampledStep positive C hC hm w).fullNamed z.val.column ⟨z.val.height,hBand z⟩
222
lemma sampledStep_seeds (w : Offset G C (m := m)) :
    (G.sampledStep positive C hC hm w).seeds=G.admittedSeeds positive C := rfl
224
lemma sampledStep_radius (w : Offset G C (m := m)) :
    (G.sampledStep positive C hC hm w).radius=R := rfl
227
lemma component_local_list
    (hsmall : 18*ρ ≤ (199/1000:ℝ)*R) (hr : ρ ≤ secondaryRadius)
    (hOld : ∀ z, |G.oldOnBall positive x hBand (ballCenter x hρ)-G.oldOnBall positive x hBand z| ≤ (secondaryK:ℝ)*ρ)
    (hEnv : (∃ z : Ball x (ρ := ρ), z.val.height∈SecondaryCell.domain (G.admittedSeeds positive C) R z.val.column) →
      ∀ H, |H-x.height| ≤ ρ → H ∈ BandTrees.band narrow G.lower) :
    ∃ L : LocalList (G.oldOnBall positive x hBand) (G.sampledOnBall positive C hC hm x hBand)
      (ballCenter x hρ) ((secondaryK:ℝ)*ρ) (secondaryTestLoss ρ m),
      L.names.card ≤ secondaryN ∧
      ((¬∀ z : Ball x (ρ := ρ), z.val.height∈SecondaryCell.domain (G.admittedSeeds positive C) R z.val.column) → L.names={0}) := by
proof · 49 lines
  classical
  by_cases hfull : ∀ z : Ball x (ρ := ρ), z.val.height∈SecondaryCell.domain (G.admittedSeeds positive C) R z.val.column
  · let lift := fun z : Ball x (ρ := ρ) => SecondaryCell.point _ _ _ _ (hfull z)
    let w0 : Offset G C (m := m) := Classical.arbitrary _
    let U := G.sampledStep positive C hC hm w0
    have hJ := hEnv ⟨ballCenter x hρ,hfull _⟩
    have hdist z : dist (lift (ballCenter x hρ)) (lift z) ≤ ρ := by
      have he := U.point_dist x z.val hJ z.property (hfull (ballCenter x hρ)) (hfull z)
      exact he.le.trans z.property
    have hrad : ρ ≤ U.tree.radius := hr
    have hex := SecondaryCell.sampled_local_list U.tree U.seeds U.old U.supportValue lift
      (ballCenter x hρ) hρ hrad hdist U.data.isOrdinary U.old_lipschitz U.support_lipschitz U.zeta_eq
      U.pc U.radius U.lo EB interpolationB.1 m hm
    have ho : (fun z => U.old (lift z))=G.oldOnBall positive x hBand := by
      funext z
      simp only [BState.SecondaryStep.old,lift,SecondaryCell.point_column,SecondaryCell.point_height]
      rfl
    have hf : (fun (w : Offset G C (m := m)) z =>
        SecondaryCell.namedReplacement U.tree U.seeds U.old U.supportValue U.data.isOrdinary U.pc U.radius
          (EB/m*w.2.1.val) (EB/m*w.2.2.val) U.lo (U.tree.gridNoise U.tree.depthCap m w.1) (lift z))=
        G.sampledOnBall positive C hC hm x hBand := by
      funext w z
      unfold sampledOnBall BState.SecondaryStep.fullNamed
      split
      · rfl
      · rename_i hn
        exact False.elim (hn (hfull z))
    have heK : SecondaryCell.replacementConstant U.tree=secondaryK := rfl
    have heQ : U.tree.q=secondaryQ := rfl
    erw [ho,hf,heK,heQ] at hex
    obtain ⟨L,hh⟩ := hex
    exact ⟨L,hh,fun hn => False.elim (hn hfull)⟩
  · have he : G.sampledOnBall positive C hC hm x hBand=fun (_ : Offset G C (m := m)) z =>
        ⟨0,G.oldOnBall positive x hBand z⟩ := by
      funext w z
      obtain ⟨y,hy⟩ := not_forall.mp hfull
      by_cases hz : z.val.height∈SecondaryCell.domain (G.admittedSeeds positive C) R z.val.column
      · exact (G.sampledStep positive C hC hm w).fullNamed_boundary_global x y.val z.val hρ
          (hEnv ⟨z,hz⟩) hsmall y.property hy z.property (hBand z)
      · unfold sampledOnBall BState.SecondaryStep.fullNamed
        split
        · exact False.elim (hz ‹_›)
        · rfl
    rw [he]
    refine ⟨oldLocalList (G.oldOnBall positive x hBand) (ballCenter x hρ) hOld,?_,fun _ => rfl⟩
    change ({0} : Finset ℕ).card ≤ secondaryN
    simp only [Finset.card_singleton]
    unfold secondaryN
    omega
294
noncomputable def scaleNamed (c : ℝ) (a : NamedValue) : NamedValue := ⟨a.name,c*a.value⟩
295
lemma maxNamed_scale {c : ℝ} (hc : 0<c) (a b : NamedValue) :
    maxNamed (scaleNamed c a) (scaleNamed c b)=scaleNamed c (maxNamed a b) := by
proof · 2 lines
  simp only [maxNamed,scaleNamed,mul_lt_mul_iff_right₀ hc,mul_right_inj' hc.ne']
  split_ifs <;> rfl
299
lemma maxSelection_scale {X : Type*} {c : ℝ} (hc : 0<c)
    (old : X → NamedValue) (Fs : List (X → NamedValue)) (x : X) :
    maxSelection (fun z => scaleNamed c (old z))
      (Fs.map (fun F z => scaleNamed c (F z))) x=scaleNamed c (maxSelection old Fs x) := by
proof · 3 lines
  induction Fs with
  | nil => rfl
  | cons F Fs ih => simpa only [List.map_cons,maxSelection,ih] using maxNamed_scale hc _ _
306
lemma familySelection_scale {X : Type*} {k : ℕ} {c : ℝ} (hc : 0<c)
    (old : X → ℝ) (F : Fin k → X → NamedValue) (x : X) :
    familySelection (fun z => c*old z) (fun g z => scaleNamed c (F g z)) x=
      scaleNamed c (familySelection old F x) := by
proof · 5 lines
  unfold familySelection
  rw [←maxSelection_scale hc]
  congr 2
  rw [List.map_ofFn]
  rfl
329
abbrev Coordinate := Σ i, (G i).Component
330
abbrev Offsets (m : ℕ) := ∀ u : Coordinate G, ComponentSample G u.1 u.2 m
331
noncomputable instance : Fintype (Coordinate G) := Fintype.ofFinite _
333
noncomputable def flatSample (w : Offsets G m) : Sample G m := (o,c,fun i C => w ⟨i,C⟩)
334
noncomputable def fixedSample : Sample G m := flatSample G o c (Classical.arbitrary _)
335
noncomputable def slot (a : Fin (S.count+1)) (j : Fin (Fintype.card (Acting G (fixedSample G o c (m := m)) a))) :
    Acting G (fixedSample G o c (m := m)) a := (Fintype.equivFin _).symm j
337
noncomputable def coord (a : Fin (S.count+1)) (j : Fin (Fintype.card (Acting G (fixedSample G o c (m := m)) a))) :
    Coordinate G := (slot G o c (m := m) a j).val
339
lemma coord_injective (a : Fin (S.count+1)) : Function.Injective (coord G o c (m := m) a) := by
proof · 3 lines
  intro i j he
  apply (Fintype.equivFin (Acting G (fixedSample G o c (m := m)) a)).symm.injective
  exact Subtype.ext he
345
lemma flat_actingStep (hm : 0 < m) (w : Offsets G m) (a : Fin (S.count+1))
    (u : Acting G (fixedSample G o c (m := m)) a) :
    actingStep G hm (flatSample G o c w) a u=
      (G u.val.1).sampledStep (o a) u.val.2 u.property.2.2 hm (w u.val) := rfl
350
lemma coord_index (a : Fin (S.count+1)) (j : Fin (Fintype.card (Acting G (fixedSample G o c (m := m)) a))) :
    (G (coord G o c (m := m) a j).1).index=a := (slot G o c (m := m) a j).property.1
352
lemma slot_band (a : Fin (S.count+1)) (j : Fin (Fintype.card (Acting G (fixedSample G o c (m := m)) a)))
    (H : (S.chart a).band) : H.val∈(G (coord G o c (m := m) a j).1).data.band := by
proof · 3 lines
  change H.val∈(S.chart (G (coord G o c (m := m) a j).1).index).band
  rw [coord_index]
  exact H.property
358
lemma selected_flat (hm : 0 < m) (w : Offsets G m) (a : Fin (S.count+1))
    (i : Fin (k+1)) (H : (S.chart a).band) :
    ((batch G hm (flatSample G o c w) a).selected i H).name=
      (familySelection (fun T : (S.chart a).band => ((S.chart a).comparison Group.lam Group.lam_bound (o a)).value i T)
        (fun j T => ((G (coord G o c (m := m) a j).1).sampledStep (o a) (coord G o c (m := m) a j).2
          (slot G o c (m := m) a j).property.2.2 hm (w (coord G o c (m := m) a j))).fullNamed i
            ⟨T.val,slot_band G o c (m := m) a j T⟩) H).name := by
proof · 6 lines
  change (familySelection (fun T : (S.chart a).band => kappaB*((S.chart a).comparison Group.lam Group.lam_bound (o a)).value i T)
    (fun j T => scaleNamed kappaB (((G (coord G o c (m := m) a j).1).sampledStep (o a) (coord G o c (m := m) a j).2
      (slot G o c (m := m) a j).property.2.2 hm (w (coord G o c (m := m) a j))).fullNamed i
        ⟨T.val,slot_band G o c (m := m) a j T⟩)) H).name=_
  rw [familySelection_scale (by norm_num [kappaB,a₂])]
  rfl
380
lemma maxSelection_map {X Y : Type*} (old : Y → NamedValue)
    (Fs : List (Y → NamedValue)) (f : X → Y) (x : X) :
    maxSelection (old ∘ f) (Fs.map (fun F => F ∘ f)) x=maxSelection old Fs (f x) := by
proof · 3 lines
  induction Fs with
  | nil => rfl
  | cons F Fs ih => simp only [List.map_cons,maxSelection,Function.comp_apply,ih]
386
lemma familySelection_map {X Y : Type*} {k : ℕ} (old : Y → ℝ)
    (F : Fin k → Y → NamedValue) (f : X → Y) (x : X) :
    familySelection (old ∘ f) (fun g => F g ∘ f) x=familySelection old F (f x) := by
proof · 3 lines
  unfold familySelection
  rw [←maxSelection_map _ _ f x,List.map_ofFn]
  rfl
392
lemma maxSelection_eq_fold {X : Type*} (old : X → NamedValue)
    (Fs : List (X → NamedValue)) (x : X) :
    maxSelection old Fs x=(Fs.map (fun F => F x)).foldr maxNamed (old x) := by
proof · 3 lines
  induction Fs with
  | nil => rfl
  | cons F Fs ih => simpa only [maxSelection,List.map_cons,List.foldr_cons] using congrArg (maxNamed (F x)) ih
398
lemma familySelection_congr_at {X Y : Type*} {k : ℕ} (old : X → ℝ) (old' : Y → ℝ)
    (F : Fin k → X → NamedValue) (F' : Fin k → Y → NamedValue)
    (x : X) (y : Y) (ho : old x=old' y) (hF : ∀ g, F g x=F' g y) :
    familySelection old F x=familySelection old' F' y := by
proof · 5 lines
  simp only [familySelection,maxSelection_eq_fold,List.map_ofFn,ho]
  congr 2
  funext g
  dsimp only [Function.comp_apply]
  rw [hF g]
424
abbrev Slot := Fin (Fintype.card (Acting G (fixedSample G o c (m := m)) a))
426
noncomputable def ballOld (z : Group.Ball x (ρ := ρ)) : ℝ :=
body · 1 line
  ((S.chart a).comparison Group.lam Group.lam_bound (o a)).value z.val.column ⟨z.val.height,hBand z⟩
429
lemma ball_slot_band (j : Slot G o c a (m := m)) (z : Group.Ball x (ρ := ρ)) :
    z.val.height∈(G (coord G o c (m := m) a j).1).data.band :=
proof · 1 line
  slot_band G o c (m := m) a j ⟨z.val.height,hBand z⟩
432
noncomputable def ballFamily (hm : 0 < m) (j : Slot G o c a (m := m))
    (w : ComponentSample G (coord G o c (m := m) a j).1 (coord G o c (m := m) a j).2 m) (z : Group.Ball x (ρ := ρ)) : NamedValue :=
body · 2 lines
  (G (coord G o c (m := m) a j).1).sampledOnBall (o a) (coord G o c (m := m) a j).2
    (slot G o c (m := m) a j).property.2.2 hm x (ball_slot_band G o c (m := m) a x hBand j) w z
436
lemma ballOld_eq (j : Slot G o c a (m := m)) :
    (G (coord G o c (m := m) a j).1).oldOnBall (o a) x (ball_slot_band G o c (m := m) a x hBand j)=ballOld o a x hBand := by
proof · 9 lines
  funext z
  unfold Group.oldOnBall Group.comparison ballOld
  simp only [Group.data]
  have heval (b : Fin (S.count+1)) (hb : z.val.height∈(S.chart b).band) (he : b=a) :
      ((S.chart b).comparison Group.lam Group.lam_bound (o a)).value z.val.column ⟨z.val.height,hb⟩ =
      ((S.chart a).comparison Group.lam Group.lam_bound (o a)).value z.val.column ⟨z.val.height,hBand z⟩ := by
    subst b
    rfl
  exact heval _ _ (coord_index G o c (m := m) a j)
447
lemma selected_ball (hm : 0 < m) (w : Offsets G m) (z : Group.Ball x (ρ := ρ)) :
    ((batch G hm (flatSample G o c w) a).selected z.val.column ⟨z.val.height,hBand z⟩).name=
      (familySelection (ballOld o a x hBand) (fun j => ballFamily G o c a x hBand hm j (w (coord G o c (m := m) a j))) z).name := by
proof · 6 lines
  apply (selected_flat G o c hm w a z.val.column ⟨z.val.height,hBand z⟩).trans
  apply congrArg NamedValue.name
  refine familySelection_congr_at _ _ _ _ _ _ ?_ ?_
  · rfl
  · intro j
    rfl
456
noncomputable def wholeBallSlots : Finset (Slot G o c a (m := m)) := Finset.univ.filter fun j =>
body · 2 lines
  ∀ z : Group.Ball x (ρ := ρ), z.val.height∈SecondaryCell.domain
    ((G (coord G o c (m := m) a j).1).admittedSeeds (o a) (coord G o c (m := m) a j).2) R z.val.column
460
lemma persistence_flat [SFinite μ] (hρ : 0 ≤ ρ) (hm : 0 < m)
    (hsmall : 18*ρ ≤ (199/1000:ℝ)*R) (hr : ρ ≤ secondaryRadius)
    (hOld : ∀ z, |ballOld o a x hBand (Group.ballCenter x hρ)-ballOld o a x hBand z| ≤ (secondaryK:ℝ)*ρ)
    (hold : ∀ z : Group.Ball x (ρ := ρ), S.name z.val.column z.val.height=a)
    (hEnv : ∀ j : Slot G o c a (m := m),
      (∃ z : Group.Ball x (ρ := ρ), z.val.height∈SecondaryCell.domain
        ((G (coord G o c (m := m) a j).1).admittedSeeds (o a) (coord G o c (m := m) a j).2) R z.val.column) →
      ∀ H, |H-x.height| ≤ ρ → H ∈ BandTrees.band narrow (G (coord G o c (m := m) a j).1).lower)
    {B : ℕ} (hpack : (wholeBallSlots G o c a x (ρ := ρ) (m := m)).card ≤ B) :
    prob (fun w : Offsets G m => ∃ z : Group.Ball x (ρ := ρ),
      (result G hm (flatSample G o c w)).name z.val.column z.val.height≠
        (result G hm (flatSample G o c w)).name x.column x.height) ≤
      (1+B*secondaryN : ℕ)^2*secondaryTestLoss ρ m := by
proof · 28 lines
  classical
  have hList (j : Slot G o c a (m := m)) :
      ∃ L : LocalList (ballOld o a x hBand) (ballFamily G o c a x hBand hm j)
        (Group.ballCenter x hρ) ((secondaryK:ℝ)*ρ) (secondaryTestLoss ρ m),
        L.names.card ≤ secondaryN ∧ (j∉wholeBallSlots G o c a x (ρ := ρ) (m := m) → L.names={0}) := by
    have ho := hOld
    rw [←ballOld_eq G o c (m := m) a x hBand j] at ho
    have he := (G (coord G o c (m := m) a j).1).component_local_list (o a) (coord G o c (m := m) a j).2
      (slot G o c (m := m) a j).property.2.2 hm x hρ (ball_slot_band G o c (m := m) a x hBand j)
      hsmall hr ho (hEnv j)
    erw [ballOld_eq G o c (m := m) a x hBand j] at he
    obtain ⟨L,hN,hout⟩ := he
    exact ⟨L,hN,fun hn => hout (by simpa only [wholeBallSlots,Finset.mem_filter,Finset.mem_univ,true_and] using hn)⟩
  choose L hN hout using hList
  have hprob := LocalList.family_probability (D := fun u : Coordinate G => ComponentSample G u.1 u.2 m)
    (coord G o c (m := m) a) (coord_injective G o c (m := m) a) (ballOld o a x hBand)
    (ballFamily G o c a x hBand hm) (Group.ballCenter x hρ) (secondaryTestLoss_nonneg hρ m) hOld L
    (wholeBallSlots G o c a x (ρ := ρ) (m := m)) (fun j _ => hN j)
    (fun j hj => (hout j hj).le) hpack
  apply (prob_mono (Q := fun w : Offsets G m => ∃ z : Group.Ball x (ρ := ρ),
    (familySelection (ballOld o a x hBand) (fun j => ballFamily G o c a x hBand hm j (w (coord G o c (m := m) a j))) z).name≠
      (familySelection (ballOld o a x hBand) (fun j => ballFamily G o c a x hBand hm j (w (coord G o c (m := m) a j))) (Group.ballCenter x hρ)).name) ?_).trans hprob
  rintro w ⟨z,hz⟩
  refine ⟨z,fun he => hz ?_⟩
  apply (layer G hm (flatSample G o c w)).name_eq_of_selected a (hBand z) (hBand (Group.ballCenter x hρ))
    (hold z) (hold (Group.ballCenter x hρ))
  exact (selected_ball G o c a x hBand hm w z).trans
    (he.trans (selected_ball G o c a x hBand hm w (Group.ballCenter x hρ)).symm)
515
lemma component_eq_of_domain (positive : Bool) (C D : G.Component) (i : Fin (k+1)) (H : ℝ)
    (hC : H ∈ SecondaryCell.domain (G.admittedSeeds positive C) R i)
    (hD : H ∈ SecondaryCell.domain (G.admittedSeeds positive D) R i) : C=D := by
proof · 10 lines
  let x := SecondaryCell.point _ _ _ _ hC
  let y := SecondaryCell.point _ _ _ _ hD
  have hc : x.column=i := SecondaryCell.point_column _ _ _
  have hd : y.column=i := SecondaryCell.point_column _ _ _
  have h1 := BandTrees.reachable_mem M narrow G.lower C x.reachable
  have h2 := BandTrees.reachable_mem M narrow G.lower D y.reachable
  rw [hc] at h1
  rw [hd] at h2
  exact ((SimpleGraph.ConnectedComponent.mem_supp_iff C i).mp h1).symm.trans
    ((SimpleGraph.ConnectedComponent.mem_supp_iff D i).mp h2)
549
noncomputable def centerActs : Finset (Acting (group A SA SB v hv) omega a) :=
body · 2 lines
  Finset.univ.filter fun u => c.height ∈ SecondaryCell.domain
    ((group A SA SB v hv u.val.1).admittedSeeds (omega.1 a) u.val.2) R c.column
554
lemma centerActs_card : (centerActs A SA SB v hv b c omega a).card≤SurvivingGroups.packBound := by
proof · 25 lines
  let f : (centerActs A SA SB v hv b c omega a) → Hits A SA SB v hv b c
      (phaseD := phaseD) (phaseG := phaseG) := fun u =>
    ⟨u.val.val.1, domain_touch A SA SB v hv b c _ (omega.1 a) _ u.val.property.2.2
      (Finset.mem_filter.mp u.property).2⟩
  have hf : Function.Injective f := by
    intro u w he
    have hi := congrArg Subtype.val he
    change u.val.val.1=w.val.val.1 at hi
    apply Subtype.ext
    apply Subtype.ext
    apply Sigma.ext hi
    cases u with | mk u hu =>
      cases w with | mk w hw =>
        cases u with | mk u hu' =>
          cases w with | mk w hw' =>
            cases u with | mk i C =>
              cases w with | mk j D =>
                dsimp only at hi
                subst j
                apply heq_of_eq
                exact (group A SA SB v hv i).component_eq_of_domain (omega.1 a) C D c.column c.height
                  (Finset.mem_filter.mp hu).2 (Finset.mem_filter.mp hw).2
  have he := Fintype.card_le_of_injective f hf
  rw [Fintype.card_coe] at he
  exact he.trans (touching_card_small A SA SB v hv b c hc hρ hτ hp hn)
601
lemma center_point_of_domain
    (i : GroupIndex A SA SB v hv (p := p) (phaseD := phaseD) (phaseG := phaseG))
    (positive : Bool) (C : (group A SA SB v hv i).Component)
    (hC : ((group A SA SB v hv i).admittedSeeds positive C).Nonempty)
    (hd : x.height∈SecondaryCell.domain ((group A SA SB v hv i).admittedSeeds positive C) R x.column) :
    ∃ z : M.Point (BandTrees.band broad i.1.lower) (BandTrees.root M broad i.1.lower i.1.1.2),
      z.column=x.column ∧ z.height=x.height ∧ z.height∈BandTrees.band narrow i.1.lower₂ := by
proof · 5 lines
  obtain ⟨hH,w,_,path,_⟩ := (group A SA SB v hv i).domain_near positive C hC x.column x.height hd
  refine ⟨{ column := x.column
            height := x.height
            inBand := i.1.sub hH
            reachable := w.reachable.trans (path.widen i.1.sub).word.reachable.symm }, rfl,rfl,hH⟩
614
lemma wholeBallSlots_card (o : Fin (SB.count+1) → Bool)
    (coins : GroupIndex A SA SB v hv (p := p) (phaseD := phaseD) (phaseG := phaseG) → Bool)
    (a : Fin (SB.count+1)) {m : ℕ} {ρ : ℝ} (hρ : 0 ≤ ρ)
    (hp : Tiling.Padded a₁ q x.height ρ) (hn : Tiling.Padded a₂ p x.height ρ) :
    (wholeBallSlots (group A SA SB v hv) o coins a x (ρ := ρ) (m := m)).card ≤ SurvivingGroups.packBound := by
proof · 25 lines
  classical
  let G := group A SA SB v hv (p := p) (phaseD := phaseD) (phaseG := phaseG)
  let T := wholeBallSlots G o coins a x (ρ := ρ) (m := m)
  by_cases he : T.Nonempty
  · obtain ⟨j,hj⟩ := he
    have hd := (Finset.mem_filter.mp hj).2 (Group.ballCenter x hρ)
    obtain ⟨z,hzc,hzh,hzband⟩ := center_point_of_domain A SA SB v hv x (coord G o coins (m := m) a j).1
      (o a) (coord G o coins (m := m) a j).2 (slot G o coins (m := m) a j).property.2.2 hd
    let b := (coord G o coins (m := m) a j).1.1
    let omega := fixedSample G o coins (m := m)
    let f : T → centerActs A SA SB v hv b z omega a := fun t =>
      ⟨slot G o coins (m := m) a t.val,Finset.mem_filter.mpr ⟨Finset.mem_univ _,by
        change z.height∈SecondaryCell.domain
          ((G (coord G o coins (m := m) a t.val).1).admittedSeeds (o a) (coord G o coins (m := m) a t.val).2) R z.column
        rw [hzc,hzh]
        exact (Finset.mem_filter.mp t.property).2 (Group.ballCenter x hρ)⟩⟩
    have hf : Function.Injective f := by
      intro s t he
      apply Subtype.ext
      exact (Fintype.equivFin (Acting G omega a)).symm.injective (congrArg Subtype.val he)
    have hh := Fintype.card_le_of_injective f hf
    rw [Fintype.card_coe,Fintype.card_coe] at hh
    exact hh.trans (centerActs_card A SA SB v hv b z hzband hρ hρ
      (by simpa only [hzh] using hp) (by simpa only [hzh] using hn) omega a)
  · exact (Finset.card_eq_zero.mpr (Finset.not_nonempty_iff_eq_empty.mp he)).le.trans (Nat.zero_le _)
654
noncomputable def mainK : ℝ≥0 := max 1 ⟨3/(9*a₁/100),by norm_num [a₁]⟩
655
noncomputable def mainQ : ℝ := zetaA*(EA/8)/20
656
noncomputable def mainRadius : ℝ := zetaA*(EA/8)/1000
657
noncomputable def mainN : ℕ := 6*(⌈15/zetaA⌉₊+3+1)+2
658
noncomputable def mainTestLoss (ρ : ℝ) (m : ℕ) : ℝ :=
body · 1 line
  (4*(mainK:ℝ)*ρ+mainQ/m)/mainQ+(4*(mainK:ℝ)*ρ+EA/m)/EA
660
noncomputable def mainLoss (ρ : ℝ) (m : ℕ) : ℝ := (mainN:ℝ)^2*mainTestLoss ρ m
661
noncomputable def secondaryLoss (ρ : ℝ) (m : ℕ) : ℝ :=
body · 1 line
  (1+Columns.Model.SurvivingGroups.packBound*secondaryN : ℕ)^2*secondaryTestLoss ρ m
663
lemma mainQ_pos : 0 < mainQ := by norm_num [mainQ,zetaA,EA,epsilon]
664
lemma mainRadius_pos : 0 < mainRadius := by norm_num [mainRadius,zetaA,EA,epsilon]
665
lemma secondaryQ_pos : 0 < secondaryQ := by norm_num [secondaryQ,zetaB,EB,R]
666
lemma secondaryRadius_pos : 0 < secondaryRadius := by norm_num [secondaryRadius,zetaB,EB,R]
667
noncomputable def persistenceRadius : ℝ :=
body · 1 line
  min (EA/20) (min mainRadius (min ((199/18000:ℝ)*R) secondaryRadius))
669
lemma persistenceRadius_pos : 0 < persistenceRadius := by
proof · 2 lines
  exact lt_min (div_pos interpolationA.1 (by norm_num))
    (lt_min mainRadius_pos (lt_min (by norm_num [R]) secondaryRadius_pos))
672
lemma persistence_main_small {ρ : ℝ} (h : ρ≤persistenceRadius) : 4*ρ<3*EA := by
proof · 3 lines
  have h' := h.trans (min_le_left _ _)
  have hE := interpolationA.1
  linarith
676
lemma persistence_main_radius {ρ : ℝ} (h : ρ≤persistenceRadius) : ρ ≤ mainRadius :=
proof · 1 line
  h.trans (le_trans (min_le_right (EA/20) _) (min_le_left mainRadius _))
678
lemma persistence_secondary_small {ρ : ℝ} (h : ρ≤persistenceRadius) : 18*ρ≤(199/1000:ℝ)*R := by
proof · 2 lines
  have h' := h.trans (le_trans (min_le_right (EA/20) _) (le_trans (min_le_right mainRadius _) (min_le_left ((199/18000:ℝ)*R) _)))
  linarith
681
lemma persistence_secondary_radius {ρ : ℝ} (h : ρ≤persistenceRadius) : ρ ≤ secondaryRadius :=
proof · 1 line
  h.trans (le_trans (min_le_right (EA/20) _) (le_trans (min_le_right mainRadius _) (min_le_right ((199/18000:ℝ)*R) _)))
689
lemma localLoss_eq (c : CellIndex q L U phase) (ρ : ℝ) (m : ℕ) :
    localLoss phase c ρ m=mainLoss ρ m := rfl
691
lemma radius_eq (c : CellIndex q L U phase) : (tree phase c).radius=mainRadius := rfl

Xet Storage Details

Size:
37.2 kB
·
Xet hash:
4c40e2570fdc86a0bfc40ad36e9a20d52d78c2863f8104d07be3e81556b9a933

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.