File size: 16,098 Bytes
ddc84c5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | import OAI.Analysis.DiamondDistortion.Incomparable
namespace OAI
universe u v
noncomputable section
open scoped BigOperators Classical Topology
open Set
namespace DiamondDistortion
open scoped ENNReal
namespace RecursiveModel
instance countableCoord (h : ℕ) : Countable (Coord h) := by
induction h with
| zero => exact inferInstanceAs (Countable Unit)
| succ h ih => exact inferInstanceAs (Countable (Unit ⊕ (ℕ × Coord h)))
lemma aggregate_sq {ι : Type*} (f : ι →₀ ℝ) :
(aggregate 2 f)^2=∑ i ∈ f.support,f i^2 := by
have hh := lp.norm_rpow_eq_tsum (p := 2) (by norm_num) (finiteLp 2 f)
have he : (aggregate 2 f)^2=∑' i,f i^2 := by
simpa only [aggregate,ENNReal.toReal_ofNat,Real.rpow_two,finiteLp_apply,Real.norm_eq_abs,sq_abs] using hh
rw [he]
exact tsum_eq_sum (fun i hi => by rw [Finsupp.notMem_support_iff.mp hi]; norm_num)
lemma components_zero (p : ForestVec) (h : ℕ) (hh : h ∉ p.support.image Sigma.fst) :
components p h=0 := by
ext i
change p ⟨h,i⟩=0
apply Finsupp.notMem_support_iff.mp
intro hi
exact hh (Finset.mem_image.mpr ⟨⟨h,i⟩,hi,rfl⟩)
lemma outer_support (s : ∀ h,Seminorm ℝ (Vec (h+1))) (p : ForestVec) :
(outerValues s p).support ⊆ p.support.image Sigma.fst := by
intro h hh
by_contra hn
have he : outerValues s p h=0 := by rw [outerValues_apply,components_zero p h hn,map_zero]
exact (Finsupp.mem_support_iff.mp hh) he
lemma outer_sq (s : ∀ h,Seminorm ℝ (Vec (h+1))) (p : ForestVec) (C : Finset ℕ)
(hC : p.support.image Sigma.fst ⊆ C) :
(outerSeminorm s p)^2=∑ h ∈ C,(s h (components p h))^2 := by
change (aggregate 2 (outerValues s p))^2=_
rw [aggregate_sq]
apply Finset.sum_subset ((outer_support s p).trans hC)
intro h _ hh
rw [Finsupp.notMem_support_iff.mp hh]
norm_num
lemma components_filter (p : ForestVec) (C : Set ℕ) (h : ℕ) :
components (p.filter (fun i => i.1 ∈ C)) h=if h ∈ C then components p h else 0 := by
ext i
by_cases hh : h ∈ C
· rw [ite_eq_left hh]
change (p.filter (fun i => i.1 ∈ C)) ⟨h,i⟩=p ⟨h,i⟩
rw [Finsupp.filter_apply,ite_eq_left hh]
· rw [ite_eq_right hh]
change (p.filter (fun i => i.1 ∈ C)) ⟨h,i⟩=0
rw [Finsupp.filter_apply,ite_eq_right hh]
lemma outer_contractive (s : ∀ h,Seminorm ℝ (Vec (h+1))) (p : ForestVec) (C : Set ℕ) :
outerSeminorm s (p.filter (fun i => i.1 ∈ C)) ≤ outerSeminorm s p := by
apply aggregate_mono 2
· exact outerValues_nonneg s _
· intro h
rw [outerValues_apply,outerValues_apply,components_filter]
split_ifs
· exact le_rfl
· rw [map_zero]; exact apply_nonneg _ _
lemma outer_orthogonal (s : ∀ h,Seminorm ℝ (Vec (h+1))) (p q : ForestVec)
(hd : Disjoint (p.support.image Sigma.fst) (q.support.image Sigma.fst)) :
(outerSeminorm s (p+q))^2 ≤ (outerSeminorm s p)^2+(outerSeminorm s q)^2 := by
let C := p.support.image Sigma.fst ∪ q.support.image Sigma.fst
have hp : p.support.image Sigma.fst ⊆ C := Finset.subset_union_left
have hq : q.support.image Sigma.fst ⊆ C := Finset.subset_union_right
have hpq : (p+q).support.image Sigma.fst ⊆ C := by
intro h hh
obtain ⟨i,hi,rfl⟩ := Finset.mem_image.mp hh
rcases Finset.mem_union.mp (Finsupp.support_add hi) with hi | hi
· exact hp (Finset.mem_image.mpr ⟨i,hi,rfl⟩)
· exact hq (Finset.mem_image.mpr ⟨i,hi,rfl⟩)
rw [outer_sq s p C hp,outer_sq s q C hq,outer_sq s (p+q) C hpq,← Finset.sum_add_distrib]
apply le_of_eq
apply Finset.sum_congr rfl
intro h _
rw [map_add,DFinsupp.add_apply]
by_cases hh : h ∈ p.support.image Sigma.fst
· have hhq := Finset.disjoint_left.mp hd hh
rw [components_zero q h hhq,add_zero,map_zero,zero_pow (by decide : 2 ≠ 0),add_zero]
· rw [components_zero p h hh,zero_add,map_zero,zero_pow (by decide : 2 ≠ 0),zero_add]
lemma energy_components (p : ForestVec) (C : Finset ℕ) (hC : p.support.image Sigma.fst ⊆ C) :
(∑ i ∈ p.support,p i^2)=∑ h ∈ C,∑ i ∈ (components p h).support,(components p h i)^2 := by
have he (h : ℕ) : p.split h=components p h := by ext i; rw [Finsupp.split_apply]; rfl
have hh := p.sigma_sum (fun _ a => a^2)
simp only [Finsupp.sum,he] at hh
rw [hh]
have hes : p.splitSupport=p.support.image Sigma.fst := by
ext h
simp only [Finsupp.splitSupport,Finset.mem_image]
rw [hes]
apply Finset.sum_subset hC
intro h _ hh
have hzero := components_zero p h hh
rw [hzero,Finsupp.support_zero,Finset.sum_empty]
end RecursiveModel
namespace PathModel
open RecursiveModel
lemma path_norm (h : ℕ) (μ : L1 h) : ‖path h μ‖ ≤ (h+1:ℝ)*‖μ‖ := by
have hb : ‖path h‖ ≤ (h+1:ℝ) :=
LinearMap.mkContinuous_norm_le _ (by positivity : (0:ℝ) ≤ h+1) _
exact ((path h).le_opNorm μ).trans (mul_le_mul_of_nonneg_right hb (norm_nonneg _))
lemma linear_l2 (h : ℕ) (v : L2 h) : ‖v‖ ≤ (h+1:ℝ)*cost 1 h v := by
apply (presentation 1 h).bound v (by positivity : (0:ℝ) ≤ h+1)
intro d hd
change d.fst+path h d.snd=v at hd
rw [← hd,WithLp.prod_norm_eq_of_L1]
have hb := (norm_add_le d.fst (path h d.snd)).trans (add_le_add le_rfl (path_norm h d.snd))
have hhn : 1 ≤ (h+1:ℝ) := by linarith [Nat.cast_nonneg (α := ℝ) h]
have hn := norm_nonneg d.fst
nlinarith
lemma finite_l2_sq (h : ℕ) (v : Vec h) :
‖finiteEmbedding h v‖^2=∑ i ∈ v.support,v i^2 := aggregate_sq v
lemma linear_upper (p : ForestVec) :
(linearForestSeminorm p)^2 ≤ ∑ i ∈ p.support,p i^2 := by
let C := p.support.image Sigma.fst
rw [energy_components p C (by rfl)]
change (outerSeminorm (fun h => finiteCost 1 (h+1)) p)^2 ≤ _
rw [outer_sq _ p C (by rfl)]
apply Finset.sum_le_sum
intro h _
rw [← finite_l2_sq]
exact (sq_le_sq₀ (apply_nonneg _ _) (norm_nonneg _)).mpr (linear_le_norm (h+1) _)
lemma linear_lower (C : Finset ℕ) (p : ForestVec)
(hp : ∀ i ∈ p.support,i.1 ∈ C) :
(∑ i ∈ p.support,p i^2) ≤ (((C.sup (id : ℕ → ℕ) : ℕ) : ℝ)+2)^2*(linearForestSeminorm p)^2 := by
have hC : p.support.image Sigma.fst ⊆ C := by
rintro _ hh
obtain ⟨i,hi,rfl⟩ := Finset.mem_image.mp hh
exact hp i hi
rw [energy_components p C hC]
change _ ≤ _*(outerSeminorm (fun h => finiteCost 1 (h+1)) p)^2
rw [outer_sq _ p C hC,Finset.mul_sum]
apply Finset.sum_le_sum
intro h hh
rw [← finite_l2_sq]
have hb := linear_l2 (h+1) (finiteEmbedding _ (components p h))
have hm : ((h+1:ℕ):ℝ)+1 ≤ ((C.sup (id : ℕ → ℕ) : ℕ) : ℝ)+2 := by
have he : (h:ℝ) ≤ ((C.sup (id : ℕ → ℕ) : ℕ) : ℝ) := by exact_mod_cast Finset.le_sup (f := id) hh
push_cast
linarith
have hpos : 0 ≤ cost 1 (h+1) (finiteEmbedding _ (components p h)) := apply_nonneg _ _
have hb' := hb.trans (mul_le_mul_of_nonneg_right hm hpos)
have hs := (sq_le_sq₀ (norm_nonneg _) (by positivity)).mpr hb'
simpa only [mul_pow,finiteCost,Seminorm.comp_apply] using hs
lemma linearBlocks : linearData.HilbertBlocks Sigma.fst where
orthogonal p q hd := outer_orthogonal _ p q (by
simpa only [Finset.disjoint_left,Finset.mem_image] using hd)
contractive := outer_contractive _
upper C := ⟨1,by norm_num,fun p _ => by simpa only [linearData,one_mul] using linear_upper p⟩
lower C := ⟨(((C.sup (id : ℕ → ℕ) : ℕ) : ℝ)+2)^2,by positivity,
fun p hp => linear_lower C p hp⟩
instance linearDualSeparable : TopologicalSpace.SeparableSpace (StrongDual ℝ LinearSpace) :=
linearData.dual_separable Sigma.fst linearBlocks
/-- The original weak-sequence input on the concrete linear path-cost space. -/
theorem linear_weak_graph (hinput : PathApplications.WeakInput LinearSpace)
{D s : ℝ} (k : ℕ) (f : Diamond.Vertex k → LinearSpace) (hf : Diamond.HasDistortion k f D s) :
1+(k:ℝ)/64 ≤ D^2 := PathApplications.weak_linear hinput k f hf
end PathModel
namespace StartModel
open RecursiveModel PathModel
namespace ContractiveMap
variable {E F : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
[NormedAddCommGroup F] [NormedSpace ℝ F]
def lift (f : E →ₗ[ℝ] F) (hf : ∀ x,‖f x‖ ≤ ‖x‖) :
lp (fun _ : ℕ => E) 2 →ₗ[ℝ] lp (fun _ : ℕ => F) 2 where
toFun v := ⟨fun i => f (v i),v.property.mono' (fun i => hf (v i))⟩
map_add' v w := by ext i; exact f.map_add _ _
map_smul' c v := by ext i; exact f.map_smul c _
lemma lift_apply (f : E →ₗ[ℝ] F) (hf : ∀ x,‖f x‖ ≤ ‖x‖)
(v : lp (fun _ : ℕ => E) 2) (i : ℕ) : lift f hf v i=f (v i) := rfl
lemma lift_norm (f : E →ₗ[ℝ] F) (hf : ∀ x,‖f x‖ ≤ ‖x‖)
(v : lp (fun _ : ℕ => E) 2) : ‖lift f hf v‖ ≤ ‖v‖ :=
lp.norm_mono (by norm_num) (fun i => hf (v i))
variable {G H : Type*} [NormedAddCommGroup G] [NormedSpace ℝ G]
[NormedAddCommGroup H] [NormedSpace ℝ H]
def prod₁ (f : E →ₗ[ℝ] F) (g : G →ₗ[ℝ] H) : WithLp 1 (E × G) →ₗ[ℝ] WithLp 1 (F × H) :=
(WithLp.linearEquiv 1 ℝ (F × H)).symm.toLinearMap.comp
((f.prodMap g).comp (WithLp.linearEquiv 1 ℝ (E × G)).toLinearMap)
lemma prod₁_norm (f : E →ₗ[ℝ] F) (g : G →ₗ[ℝ] H) (hf : ∀ x,‖f x‖ ≤ ‖x‖)
(hg : ∀ x,‖g x‖ ≤ ‖x‖) (d : WithLp 1 (E × G)) : ‖prod₁ f g d‖ ≤ ‖d‖ := by
change ‖WithLp.toLp 1 (f d.fst,g d.snd)‖ ≤ ‖d‖
rw [WithLp.prod_norm_eq_of_L1,WithLp.prod_norm_eq_of_L1]
exact add_le_add (hf d.fst) (hg d.snd)
def single (E : Type*) [NormedAddCommGroup E] [NormedSpace ℝ E] :
{f : E →ₗ[ℝ] lp (fun _ : ℕ => E) 1 // ∀ d,‖f d‖ ≤ ‖d‖} :=
⟨lp.lsingle (𝕜 := ℝ) (E := fun _ : ℕ => E) 1 0,fun d => by
change ‖(lp.single 1 0 d : lp (fun _ : ℕ => E) 1)‖ ≤ ‖d‖
exact (lp.norm_single (E := fun _ : ℕ => E) (p := 1) (by norm_num) 0 d).le⟩
end ContractiveMap
/-- Repetition labels are retained: each start node admits a countable sequence
of signed coefficient arrays over all its possible endpoints. Its mass is
the ℓ¹ sum of the ℓ¹ norms of these arrays, before any cancellation. -/
abbrev rawRepresentationModel : ℕ → RealNormed
| 0 => ⟨lp (fun _ : ℕ => ℝ) 1⟩
| h+1 => ⟨WithLp 1 (lp (fun _ : ℕ => L1 (h+1)) 1 ×
lp (fun _ : ℕ => rawRepresentationModel h) 2)⟩
abbrev Raw (h : ℕ) := rawRepresentationModel h
/-- Group repetitions at every start/end pair. Triangle inequalities make this
operation contractive, rather than an unjustified equality of costs. -/
def compression : (h : ℕ) → {f : Raw h →ₗ[ℝ] Rep h // ∀ d,‖f d‖ ≤ ‖d‖}
| 0 => ⟨(lp.tsumCLM ℝ ℕ ℝ).toLinearMap,lp.norm_tsum_le⟩
| h+1 =>
let prev := compression h
let rootMap := (lp.tsumCLM ℝ ℕ (L1 (h+1))).toLinearMap
let child := ContractiveMap.lift prev.val prev.property
⟨ContractiveMap.prod₁ rootMap child,
ContractiveMap.prod₁_norm rootMap child lp.norm_tsum_le
(ContractiveMap.lift_norm prev.val prev.property)⟩
/-- A representation with no repetitions is also one of the arbitrary countable
representations, by placing all its coefficients in repetition row zero. -/
def expansion : (h : ℕ) → {f : Rep h →ₗ[ℝ] Raw h // ∀ d,‖f d‖ ≤ ‖d‖}
| 0 => ContractiveMap.single ℝ
| h+1 =>
let prev := expansion h
let rootMap := ContractiveMap.single (L1 (h+1))
let child := ContractiveMap.lift prev.val prev.property
⟨ContractiveMap.prod₁ rootMap.val child,
ContractiveMap.prod₁_norm rootMap.val child rootMap.property
(ContractiveMap.lift_norm prev.val prev.property)⟩
lemma tsum_single_zero {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E] (x : E) :
lp.tsumCLM ℝ ℕ E (lp.single 1 0 x)=x := by
change ∑' i,(lp.single 1 0 x : lp (fun _ : ℕ => E) 1) i=x
rw [tsum_eq_single 0,lp.single_apply_self]
intro i hi
exact lp.single_apply_ne _ _ _ hi
lemma compression_expansion (h : ℕ) (d : Rep h) :
(compression h).val ((expansion h).val d)=d := by
induction h with
| zero => exact tsum_single_zero d
| succ h ih =>
apply WithLp.ofLp_injective
apply Prod.ext
· change lp.tsumCLM ℝ ℕ (L1 (h+1)) (lp.single 1 0 d.fst)=d.fst
exact tsum_single_zero d.fst
· ext i
exact ih (d.snd i)
/-- Literal coordinatewise output of countably many signed segments: first sum
all rows with a common start/end, then use the absolutely summable path map. -/
def rawOutput (h : ℕ) : Raw h →ₗ[ℝ] (Coord h → ℝ) :=
(output h).comp (compression h).val
def rawRelation (h : ℕ) : InfimalCost.Relation (Raw h) (Vec h) (Coord h → ℝ) where
output := rawOutput h
value := (relation h).value
sectionMap := (expansion h).val.comp (finiteSection h)
section_output v := by
change output h ((compression h).val ((expansion h).val (finiteSection h v)))=(relation h).value v
rw [compression_expansion]
exact (relation h).section_output v
lemma raw_cost_eq (h : ℕ) (v : Vec h) : (rawRelation h).seminorm v=finiteCost h v := by
apply le_antisymm
· apply (relation h).bound v
intro d hd
have he : (rawRelation h).output ((expansion h).val d)=(rawRelation h).value v := by
change output h ((compression h).val ((expansion h).val d))=(relation h).value v
rw [compression_expansion]
exact hd
exact ((rawRelation h).le_representation he).trans ((expansion h).property d)
· apply (rawRelation h).bound v
intro d hd
exact ((relation h).le_representation hd).trans ((compression h).property d)
/-- The start-cost infimum is unchanged when arbitrary repetitions are allowed.
No minimizer, finite optimal representation, or attained infimum is assumed. -/
theorem finiteCost_eq_raw_sInf (h : ℕ) (v : Vec h) :
finiteCost h v=sInf {r : ℝ | ∃ d : Raw h,rawOutput h d=(fun s => v s) ∧ ‖d‖=r} := by
rw [← raw_cost_eq]
exact (rawRelation h).eq_sInf v
lemma lp1_norm {ι E : Type*} [NormedAddCommGroup E] (d : lp (fun _ : ι => E) 1) :
‖d‖=∑' i,‖d i‖ := by
simpa only [ENNReal.toReal_one,one_div,inv_one,Real.rpow_one] using
lp.norm_eq_tsum_rpow (by norm_num : (0:ℝ)<(1:ℝ≥0∞).toReal) d
lemma raw_norm_zero (d : Raw 0) : ‖d‖=∑' j,|d j| := by
rw [lp1_norm]
simp only [Real.norm_eq_abs]
/-- The exact start masses before any grouping or cancellation. -/
lemma raw_root_mass (h : ℕ) (d : Raw (h+1)) :
‖d.fst‖=∑' j,∑' s : Coord (h+1),|d.fst j s| := by
rw [lp1_norm]
apply tsum_congr
intro j
rw [lp1_norm]
simp only [Real.norm_eq_abs]
lemma raw_children_cost_sq (h : ℕ) (d : Raw (h+1)) :
‖d.snd‖^2=∑' i,‖d.snd i‖^2 := by
simpa only [ENNReal.toReal_ofNat,Real.rpow_two] using
lp.norm_rpow_eq_tsum (by norm_num : (0:ℝ)<(2:ℝ≥0∞).toReal) d.snd
lemma raw_norm_succ (h : ℕ) (d : Raw (h+1)) :
‖d‖=(∑' j,∑' s : Coord (h+1),|d.fst j s|)+Real.sqrt (∑' i,‖d.snd i‖^2) := by
rw [WithLp.prod_norm_eq_of_L1,raw_root_mass,← raw_children_cost_sq,Real.sqrt_sq (norm_nonneg _)]
/-- Absolute convergence of all root-start row outputs, at every coordinate.
The rest of each coordinate's output is the finite ancestral recursion. -/
lemma raw_root_absolute (h : ℕ) (d : Raw (h+1)) (r : Coord (h+1)) :
Summable (fun j => ‖path (h+1) (d.fst j) r‖) := by
have hs : Summable (fun j => ‖d.fst j‖) := by
simpa only [ENNReal.toReal_one,Real.rpow_one] using d.fst.property.summable (by norm_num : (0:ℝ)<(1:ℝ≥0∞).toReal)
apply Summable.of_nonneg_of_le (fun j => norm_nonneg _) (fun j => ?_) hs
simpa only [Real.norm_eq_abs] using path_coordinate (h+1) (d.fst j) r
lemma raw_root_tsum (h : ℕ) (d : Raw (h+1)) :
path (h+1) (lp.tsumCLM ℝ ℕ (L1 (h+1)) d.fst)=∑' j,path (h+1) (d.fst j) := by
change path (h+1) (∑' j,d.fst j)=_
exact (path (h+1)).map_tsum (Summable.of_norm (by
simpa only [ENNReal.toReal_one,Real.rpow_one] using d.fst.property.summable (by norm_num : (0:ℝ)<(1:ℝ≥0∞).toReal)))
end StartModel
end DiamondDistortion
end
end OAI
|