Yang–Mills: the 2026 Lean construction, rerun and read; the mass gap still open
OpenAI's 2026 Lean construction of 4D Yang–Mills as the expert group keeps it: settle what it proves, rerun it, read it; uniqueness and the mass gap are open, and Clay's problem unsolved

| 1 | import YM.Corona.Spend |
| 2 | import YM.Next.SCHEDULE.Pre |
| 3 | |
| 4 | /-! |
| 5 | # Pre-L support exchange rate |
| 6 | |
| 7 | eq:Fproj, eq:ageom, eq:1shape. Use with complete projected |
| 8 | supports incl all data dependence. Importantly pointwise (independent of period |
| 9 | and *all* supports), anchored→hit for the actual SumBudget test. Separate |
| 10 | assertion that formula data can be localized into these supports NOT made. |
| 11 | |
| 12 | Native site max-distance and `coverNumber` of connected cover on actual torus |
| 13 | (include all projected unions, windows, correlations and flag reads when using |
| 14 | this). There's no wrap hypothesis nor measure normalization or supremum almost |
| 15 | sure convention. Don't do this with a quoted bound on path *kernel location* |
| 16 | instead of path length; on original complete E,K supports already all sites |
| 17 | count. The exp estimate is independent of path multiplicity. This buys arbitrary |
| 18 | finite support-exponent shifts *chosen pre-L* on each transition, incl j→j |
| 19 | without spending any of the exponent needed at an earlier scale. |
| 20 | -/ |
| 21 | set_option autoImplicit false |
| 22 | noncomputable section |
| 23 | namespace YM.Next.Scheduling |
| 24 | open Lattice Filter RG RG.Supply Bid Precision Function Finset |
| 25 | open scoped Topology BigOperators |
| 26 | |
| 27 | variable {G : Gauge} {s : Survey G} {q : Quote} {e : Exchange} {j i : ℕ} |
| 28 | variable {c f n : Side} |
| 29 | |
| 30 | def foundation (s : Survey G) (e : Exchange) (j : ℕ) := min (s.o.A j) e.guard |
| 31 | def payment (s : Survey G) (e : Exchange) (j : ℕ) := e.foot*(s.o.A j+e.extra) |
| 32 | |
| 33 | lemma foundation_pos (s : Survey G) (e : Exchange) (j : ℕ) : 0 < foundation s e j := lt_min (s.o.pos j) e.ok.2.1 |
| 34 | |
| 35 | /-- Require a pre-L halo estimate on projected *complete* supports. -/ |
| 36 | def Footage (l : Ratio c f) (r B : ℕ) (X : Support f) (Y : Support c) := |
| 37 | Y ⊆ halo (r*B) (X.image l.parent) |
| 38 | |
| 39 | lemma Buy.footage (l : Ratio c f) (h : Buy s q e j i l.count.val) |
| 40 | (a b : ℝ) (ha : foundation s e j ≤ a) (hb : 0 ≤ b) (he : b ≤ s.o.A j+e.extra) |
| 41 | {M B : ℕ} (hg : 0 < B) (hh : M ≤ 2*B) (X : Support f) (Y : Support c) (ht : Footage l e.radius B X Y) : |
| 42 | b * coverNumber B Y ≤ a * coverNumber M X + payment s e j - (foundation s e j/2)*coverNumber M X := by |
| 43 | let L := (l.count.val:ℝ); let x := coverNumber M X; let y:= coverNumber B Y |
| 44 | have hl : 0 < L := by dsimp only [L]; exact_mod_cast l.count.property |
| 45 | let a₀ := foundation s e j |
| 46 | have hA : 0<a₀ := foundation_pos s e j |
| 47 | have hc : l.count.val*y ≤ (l.count.val+10*x)*e.foot := |
| 48 | le_trans (Nat.mul_le_mul_left _ (Corona.cover_mono ht _)) (Corona.collapse l X M B hg hh e.radius) |
| 49 | have hf : L*(y:ℝ) ≤ (L+10*(x:ℝ))*e.foot := by dsimp only [L]; exact_mod_cast hc |
| 50 | have hy : (y:ℝ) ≤ e.foot+10*(e.foot:ℝ)/L*x := by |
| 51 | apply (le_of_mul_le_mul_left ?_ hl) |
| 52 | refine hf.trans (le_of_eq ?_) |
| 53 | field_simp |
| 54 | have HP := mul_nonneg hA.le (show 0 ≤ (x:ℝ) by positivity) |
| 55 | calc |
| 56 | b * coverNumber B Y ≤ (s.o.A j+e.extra)*(e.foot+10*(e.foot:ℝ)/L*x) := |
| 57 | mul_le_mul he hy (by positivity) (hb.trans he) |
| 58 | _ = payment s e j + (10*e.foot*(s.o.A j+e.extra)/L)*x := by unfold payment; ring |
| 59 | _ ≤ payment s e j + a₀/4*x := |
| 60 | add_le_add_right (mul_le_mul_of_nonneg_right h.exchange (by positivity)) _ |
| 61 | _ ≤ payment s e j+a*(x:ℝ)-a₀/2*x := by |
| 62 | have hK := mul_le_mul_of_nonneg_right ha (show 0 ≤ (x:ℝ) by positivity) |
| 63 | change a₀*_≤_ at hK |
| 64 | linarith |
| 65 | _ = _ := by ring |
| 66 | |
| 67 | /-- One possible halo add-on includes old support AND the one-time flag |
| 68 | layer (even computations returning zero can need to read that). This is real |
| 69 | testing by `inspected`. -/ |
| 70 | lemma flag_layer (X : Support f) : inspected X ⊆ halo 8 X := by |
| 71 | have hv (x y : Site f) (W : Walk) (h : y ∈ visits x W) : separation x y ≤ W.length := by |
| 72 | induction W generalizing x with |
| 73 | | nil => simp only [Lattice.visits,List.mem_singleton] at h; rw [h]; simp |
| 74 | | cons a r ih => |
| 75 | rcases List.mem_cons.mp h with e|e |
| 76 | · rw [e]; simp |
| 77 | have hh := ih _ e |
| 78 | have ha : separation x (x+a.vec) ≤ 1 := by |
| 79 | rw [separation_comm, separation, add_comm,add_sub_cancel_right,Step.vec]; split |
| 80 | · rw [pdist_neg]; exact pdist_step _ |
| 81 | exact pdist_step _ |
| 82 | refine le_trans (separation_triangle _ (x+a.vec) _) ?_ |
| 83 | rw [List.length_cons] |
| 84 | omega |
| 85 | intro y hy; unfold inspected at hy |
| 86 | rcases mem_union.mp hy with h|h |
| 87 | · exact halo_subset _ _ h |
| 88 | obtain ⟨p,-,hp⟩ := mem_biUnion.mp h |
| 89 | split_ifs at hp with he |
| 90 | · simp at hp |
| 91 | obtain ⟨x,hx,hx'⟩:=not_disjoint_iff.mp he |
| 92 | refine halo_spec.mpr ⟨x,hx,le_trans (separation_triangle x p.1 y) ?_⟩ |
| 93 | rw [separation_comm x p.1] |
| 94 | exact add_le_add (hv _ _ (square _ _) (List.mem_toFinset.mp hx')) (hv _ _ (square _ _) (List.mem_toFinset.mp hp)) |
| 95 | |
| 96 | lemma projects_inspected (l : Ratio c f) (B : ℕ) (hB : 9 ≤ B) (r : ℕ) (X : Support f) : |
| 97 | halo (r*B) ((inspected X).image l.parent) ⊆ halo ((r+1)*B) (X.image l.parent) := by |
| 98 | intro y hy |
| 99 | obtain ⟨u,hu,hj⟩:=halo_spec.mp hy |
| 100 | obtain ⟨a,ha,rfl⟩:=mem_image.mp hu |
| 101 | obtain ⟨x,hx,hv⟩:=halo_spec.mp (flag_layer X ha) |
| 102 | have hl : 1 ≤ l.count.val := l.count.property |
| 103 | have he : separation (l.parent x) (l.parent a) ≤ B := by |
| 104 | have hh := Corona.foreshorten l x a |
| 105 | apply Nat.le_of_mul_le_mul_left _ hl |
| 106 | nlinarith only [hv,hB,hl,hh] |
| 107 | exact halo_spec.mpr ⟨_,mem_image_of_mem _ hx,le_trans (separation_triangle _ (l.parent a) _) (by rw [Nat.add_mul];omega)⟩ |
| 108 | |
| 109 | private lemma embed_dist (l : Ratio c f) (x y : Site c) : |
| 110 | separation (l.embed x) (l.embed y) ≤ l.count.val * separation x y := by |
| 111 | unfold separation; rw [← l.root_embed,← l.root_embed,← map_sub,l.root_embed] |
| 112 | refine Finset.sup_le ?_; intro i hi |
| 113 | rw [l.lift_embed]; simp only [Pi.smul_apply,nsmul_eq_mul,Int.natAbs_mul,Int.natAbs_natCast] |
| 114 | exact Nat.mul_le_mul_left _ (component_le _ _) |
| 115 | |
| 116 | /-- Group fine anchors by old cover number t. Radius of ball needed in fine |
| 117 | NATIVE units. -/ |
| 118 | private def measureBall (L B r t : ℕ) := B * L * (r+20) * (t+1) |
| 119 | |
| 120 | private lemma fine_hit (l : Ratio c f) (x : Support f) (o : Site f) (ho : o∈x) {Y : Support c} {y} |
| 121 | {r M B : ℕ} (hg : 0 < B) (hm : M ≤ 2*B) (ht : Footage l r B x Y) (hy : y∈Y) : |
| 122 | separation (l.embed y) o ≤ measureBall l.count.val B r (coverNumber M x) := by |
| 123 | let L := l.count.val; have hl : 1 ≤ L := l.count.property |
| 124 | obtain ⟨j,hj,hJ⟩:=halo_spec.mp (ht hy) |
| 125 | obtain ⟨a,ha,rfl⟩:=mem_image.mp hj |
| 126 | have hv := Corona.extent x M ha ho |
| 127 | have he := le_trans (embed_dist l y (l.parent a)) (Nat.mul_le_mul_left L (show separation y _ ≤ r*B from separation_comm _ y ▸ hJ)) |
| 128 | have hh := Corona.near l a; rw [separation_comm a _] at hh |
| 129 | have hx := separation_triangle (l.embed y) (l.embed (l.parent a)) a |
| 130 | have H := separation_triangle (l.embed y) a o |
| 131 | generalize hn : coverNumber M x=n at * |
| 132 | -- collect terms B*L*r+L+ n*(8B+2)+4B |
| 133 | have hn : separation (l.embed y) o ≤ B*L*r+L+(n*(8*B+2)+4*B) := by |
| 134 | change 2*_≤L at hh |
| 135 | rw [show B*L*r=L*(r*B) by ring] |
| 136 | have hk : n*(4*M+2) ≤ n*(8*B+2) := Nat.mul_le_mul_left _ (by omega) |
| 137 | omega |
| 138 | unfold measureBall; refine hn.trans ?_ |
| 139 | -- n*(8*B+2) ≤ n*10*B*L |
| 140 | change _ ≤ B*L*(r+20)*(n+1) |
| 141 | have hB : B ≤ B*L := Nat.le_mul_of_pos_right _ hl |
| 142 | have hL : L ≤ B*L := Nat.le_mul_of_pos_left _ hg |
| 143 | have hn' : n*(8*B+2) ≤ n*(10*(B*L)) := Nat.mul_le_mul_left _ (by omega) |
| 144 | rw [Nat.mul_add, Nat.mul_add, Nat.mul_one]; nlinarith only [hB,hL,hn',Nat.zero_le (B*L*r*n)] |
| 145 | |
| 146 | /-- Convergence of the cover-count charge with any fixed power. -/ |
| 147 | def decay (p : ℕ) (r : ℝ) (n : ℕ) : ℝ := ((n:ℝ)+1)^p * Real.exp (-r*n) |
| 148 | |
| 149 | lemma decay_summable (p : ℕ) (r : ℝ) (hr : 0 < r) : Summable (decay p r) := by |
| 150 | have hi := (summable_nat_add_iff 1).2 (Real.summable_pow_mul_exp_neg_nat_mul p hr) |
| 151 | refine (hi.mul_right (Real.exp r)).congr ?_ |
| 152 | intro b; unfold decay |
| 153 | push_cast; rw [mul_assoc, ← Real.exp_add]; ring_nf |
| 154 | |
| 155 | /-- Absolute per-output-hit cost INCLUDING an extra `foundation/4` |
| 156 | fine-cover exponential reserve per address and ANY power (fixed pre-L, or, |
| 157 | when an operation can use a post-L constant, chosen post-L). -/ |
| 158 | def footprintCost (s : Survey G) (j : ℕ) (e : Exchange) (p L B : ℕ) := |
| 159 | let base := 3*B*L*(e.radius+20) |
| 160 | Real.exp (payment s e j) * (base:ℝ)^ (4:ℕ) * ∑' t, decay (p+4) (foundation s e j/4) t |
| 161 | |
| 162 | lemma footprintCost_pos (s : Survey G) (j) (e) (p L B) (hL : 0 < L) (hB : 0 < B) : |
| 163 | 0 < footprintCost s j e p L B := by |
| 164 | let r := foundation s e j/4 |
| 165 | have hh := decay_summable (p+4) r (show 0 < r from div_pos (foundation_pos s e j) (by norm_num)) |
| 166 | have h := hh.sum_le_tsum ({0}:Finset ℕ) (fun x _ => show 0 ≤ decay (p+4) r x by unfold decay; positivity) |
| 167 | have H : 0 < ∑' t, decay (p+4) (foundation s e j/4) t := by |
| 168 | simpa only using (lt_of_lt_of_le (by simp [decay]) h) |
| 169 | unfold footprintCost |
| 170 | dsimp only |
| 171 | positivity |
| 172 | |
| 173 | private lemma partitionTest {ι : Type*} {F : ι → ℝ} {d : ι → ℕ} (t : Finset ι) : |
| 174 | ∑ i ∈ t, F i = ∑ j ∈ t.image d, ∑ i ∈ t, if d i=j then F i else 0 := by |
| 175 | classical |
| 176 | rw [sum_comm]; apply sum_congr rfl; intro i hi |
| 177 | simp [mem_image_of_mem d hi] |
| 178 | |
| 179 | set_option maxHeartbeats 800000 in |
| 180 | lemma Buy.hit {ι : Type*} (l : Ratio c f) (h : Buy s q e j i l.count.val) (a b : ℝ) |
| 181 | (ha : foundation s e j ≤ a) (hb : 0 ≤ b) (he : b ≤ s.o.A j+e.extra) {M B : ℕ} |
| 182 | (hg : 0 < B) (hh : M ≤ 2*B) (X : ι → Support f) (o : ι → Site f) (ho : ∀ i,o i ∈ X i) |
| 183 | (Y : ι → Support c) (ht : ∀ i,Footage l e.radius B (X i) (Y i)) (k : ℕ) |
| 184 | (F : ι → ℝ) (hn : ∀ i,0 ≤ F i) (δ : ℝ) (hd : 0 ≤ δ) |
| 185 | (hf : ∀ x : Site f, SumBudget (fun i => if o i=x then Real.exp (a*coverNumber M (X i))*F i else 0) δ) : |
| 186 | ∀ y : Site c, SumBudget (fun i => if y ∈ Y i then |
| 187 | Real.exp (b*coverNumber B (Y i)+(foundation s e j/4)*coverNumber M (X i))*((coverNumber M (X i):ℝ)+1)^k*F i else 0) |
| 188 | (footprintCost s j e k l.count.val B * δ) := by |
| 189 | classical |
| 190 | intro y |
| 191 | let d i := coverNumber M (X i) |
| 192 | let A := payment s e j |
| 193 | let r := foundation s e j/4 |
| 194 | let C := 3*B*l.count.val*(e.radius+20) |
| 195 | let fns (x : Site f) i := if o i=x then Real.exp (a*d i)*F i else 0 |
| 196 | let t (i : ι) := if y∈Y i then Real.exp (b*coverNumber B (Y i)+r*d i)*((d i:ℝ)+1)^k*F i else 0 |
| 197 | let Q (x : ℕ) := halo (measureBall l.count.val B e.radius x) {l.embed y} |
| 198 | have ht0 : ∀ i, 0 ≤ t i := by |
| 199 | intro i; unfold t; split |
| 200 | · have := hn i; positivity |
| 201 | exact le_rfl |
| 202 | have hr0 : 0 < r := div_pos (foundation_pos ..) (by norm_num) |
| 203 | have H : ∀ w : Finset ι, ∑ i∈w,t i ≤ footprintCost s j e k l.count.val B*δ := by |
| 204 | intro w |
| 205 | have hp (x : ℕ) : ∑ i∈w,(if d i=x then t i else 0) ≤ Real.exp A*decay (k+4) r x*C^ (4:ℕ)*δ := by |
| 206 | have hv (i : ι) : (if d i=x then t i else 0) ≤ |
| 207 | Real.exp A * decay k r x * ∑ z∈ Q x, fns z i := by |
| 208 | have he0 : 0 ≤ ∑ z∈ Q x, fns z i := Finset.sum_nonneg fun z _ => (hf z).1 i |
| 209 | have ho0 : 0 ≤ decay k r x := by unfold decay; positivity |
| 210 | by_cases hx : d i=x |
| 211 | · rw [if_pos hx] |
| 212 | unfold t |
| 213 | by_cases hy : y∈Y i |
| 214 | · rw [if_pos hy,hx] |
| 215 | have he1 : o i ∈ Q x := halo_spec.mpr ⟨_,mem_singleton.mpr rfl,hx ▸ fine_hit l (X i) (o i) (ho i) hg hh (ht i) hy⟩ |
| 216 | calc |
| 217 | _ ≤ Real.exp (a*x+A-r*x)*((x:ℝ)+1)^k*F i := by |
| 218 | have hz:= h.footage l a b ha hb he hg hh (X i) (Y i) (ht i) |
| 219 | change _ ≤ a*(d i)+A-_*(d i) at hz |
| 220 | rw [hx] at hz |
| 221 | refine mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right (Real.exp_monotone ?_) (by positivity)) (hn i) |
| 222 | unfold r; linarith |
| 223 | _ = Real.exp A*decay k r x*fns (o i) i := by |
| 224 | unfold fns decay; rw [if_pos rfl,hx, sub_eq_add_neg, Real.exp_add, Real.exp_add,neg_mul]; ring |
| 225 | _ ≤ _ := mul_le_mul_of_nonneg_left (single_le_sum (fun z _ => (hf z).1 i) he1) (by positivity) |
| 226 | rw [if_neg hy] |
| 227 | positivity |
| 228 | rw [if_neg hx]; positivity |
| 229 | have hc (z : Site f) : ∑ i ∈ w, fns z i ≤ δ := |
| 230 | ((hf z).2.1.sum_le_tsum w (fun i _ ↦ (hf z).1 i)).trans (hf z).2.2 |
| 231 | have hL : 0<l.count.val:=l.count.property |
| 232 | have hq : (Q x).card ≤ C^4*(x+1)^4 := by |
| 233 | unfold Q |
| 234 | refine le_trans (Corona.halo_size {l.embed y} _) ?_ |
| 235 | rw [card_singleton,one_mul, ← mul_pow]; apply Nat.pow_le_pow_left |
| 236 | unfold C |
| 237 | have hi : 0 < measureBall l.count.val B e.radius x := by unfold measureBall; positivity |
| 238 | rw [show 3*B*l.count.val*(e.radius+20)*(x+1)=3*measureBall l.count.val B e.radius x by unfold measureBall; ring]; omega |
| 239 | calc |
| 240 | _ ≤ ∑ i ∈ w, Real.exp A * decay k r x * ∑ z∈ Q x, fns z i := Finset.sum_le_sum fun i _ => hv i |
| 241 | _ = Real.exp A*decay k r x*∑ z∈Q x, ∑ i∈w, fns z i := by rw [← mul_sum,sum_comm] |
| 242 | _ ≤ Real.exp A*decay k r x*∑ _z∈ Q x, δ := |
| 243 | mul_le_mul_of_nonneg_left (Finset.sum_le_sum fun i _ => hc i) (by unfold decay; positivity) |
| 244 | _ ≤ Real.exp A*decay k r x * ((C^ (4:ℕ):ℝ)*((x:ℝ)+1)^ (4:ℕ)*δ) := by |
| 245 | rw [Finset.sum_const,nsmul_eq_mul]; apply mul_le_mul_of_nonneg_left _ (by unfold decay; positivity) |
| 246 | exact mul_le_mul_of_nonneg_right (by exact_mod_cast hq) hd |
| 247 | _ = _ := by unfold decay; rw [pow_add]; ring |
| 248 | rw [partitionTest (d:=d) w] |
| 249 | apply le_trans (Finset.sum_le_sum (fun i _ => hp i)) |
| 250 | simp only [← Finset.sum_mul, ← Finset.mul_sum] |
| 251 | have hS := (decay_summable (k+4) r hr0).sum_le_tsum (Finset.image d w) (fun i _ => by unfold decay; positivity) |
| 252 | unfold footprintCost |
| 253 | dsimp only |
| 254 | -- normalize mul order |
| 255 | calc |
| 256 | _ ≤ Real.exp A*(∑' i, decay (k+4) r i)*(C:ℝ)^ (4:ℕ)*δ := by gcongr |
| 257 | _ = _ := by change _ = Real.exp A * (C:ℝ)^ (4:ℕ) * _ * _; ring |
| 258 | exact ⟨ht0, summable_of_sum_le ht0 H,Real.tsum_le_of_sum_le ht0 H⟩ |
| 259 | /-- If testing only at the projected old *anchor*, pay exactly the sites |
| 260 | per residue cell instead of costs growing with B. E.g. the `L⁻⁵` part in |
| 261 | needs this. -/ |
| 262 | def localCost (s : Survey G) (j : ℕ) (e : Exchange) (p : ℕ) := |
| 263 | Real.exp (payment s e j) * ∑' t, decay p (foundation s e j/4) t |
| 264 | |
| 265 | lemma Buy.aligned {ι : Type*} (l : Ratio c f) (h : Buy s q e j i l.count.val) (a b : ℝ) |
| 266 | (ha : foundation s e j ≤ a) (hb : 0 ≤ b) (he : b ≤ s.o.A j+e.extra) {M B : ℕ} |
| 267 | (hg : 0 < B) (hh : M ≤ 2*B) (X : ι → Support f) (o : ι → Site f) |
| 268 | (Y : ι → Support c) (ht : ∀ i,Footage l e.radius B (X i) (Y i)) (k : ℕ) |
| 269 | (F : ι → ℝ) (hn : ∀ i,0 ≤ F i) (δ : ℝ) |
| 270 | (hf : ∀ x : Site f, SumBudget (fun i => if o i=x then Real.exp (a*coverNumber M (X i))*F i else 0) δ) : |
| 271 | ∀ y : Site c, SumBudget (fun i => if l.parent (o i)=y then |
| 272 | Real.exp (b*coverNumber B (Y i)+(foundation s e j/4)*coverNumber M (X i))*((coverNumber M (X i):ℝ)+1)^k*F i else 0) |
| 273 | (localCost s j e k * ((l.count.val:ℝ)^ (4:ℕ) * δ)) := by |
| 274 | classical |
| 275 | intro y |
| 276 | let d i := coverNumber M (X i) |
| 277 | let fns (x : Site f) i := if o i=x then Real.exp (a*d i)*F i else 0 |
| 278 | let C := localCost s j e k |
| 279 | let A := payment s e j |
| 280 | let r := foundation s e j/4 |
| 281 | let p i := if l.parent (o i)=y then Real.exp (b*coverNumber B (Y i)+r*d i)*((d i:ℝ)+1)^k*F i else 0 |
| 282 | have hd (n) : 0 ≤ decay k r n := by unfold decay; positivity |
| 283 | have hC : 0 ≤ C := mul_nonneg (Real.exp_nonneg _) (tsum_nonneg hd) |
| 284 | have hp (i) : 0 ≤ p i := by have := hn i; dsimp only [p]; split_ifs <;> positivity |
| 285 | let P (z : Site l.count) := l.splitSites.symm (y,z) |
| 286 | have hz (i) : p i ≤ C*∑ z : Site l.count, fns (P z) i := by |
| 287 | unfold p; split_ifs with hO |
| 288 | · let n := l.residue (o i) |
| 289 | have hzz : P n=o i := by unfold P; apply l.splitSites.injective; rw [l.splitSites.apply_symm_apply,← l.unpack,hO] |
| 290 | apply le_trans ?_ (mul_le_mul_of_nonneg_left (single_le_sum (f:=fun z => fns (P z) i) |
| 291 | (fun m _ => (hf _).1 i) (mem_univ n)) hC) |
| 292 | rw [hzz] |
| 293 | have hv := h.footage l a b ha hb he hg hh (X i) (Y i) (ht i) |
| 294 | have hw := decay_summable k r (show 0<r from div_pos (foundation_pos ..) (by norm_num)) |
| 295 | have hb0 : decay k r (d i) ≤ ∑' t, decay k r t := by |
| 296 | simpa using hw.sum_le_tsum ({d i}:Finset ℕ) (fun n _ => hd n) |
| 297 | calc |
| 298 | _ ≤ Real.exp (a*d i+A-r*d i)*((d i:ℝ)+1)^k*F i := by |
| 299 | refine mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right (Real.exp_monotone ?_) (by positivity)) (hn i) |
| 300 | dsimp only [d,A,r]; linarith |
| 301 | _ = (Real.exp A * decay k r (d i))*fns (o i) i := by |
| 302 | unfold fns decay; rw [if_pos rfl, sub_eq_add_neg,Real.exp_add,Real.exp_add,neg_mul]; ring |
| 303 | _ ≤ C*fns (o i) i := mul_le_mul_of_nonneg_right |
| 304 | (mul_le_mul_of_nonneg_left hb0 (Real.exp_nonneg _)) ((hf _).1 _) |
| 305 | exact mul_nonneg hC (sum_nonneg fun z _ => (hf _).1 i) |
| 306 | have hH (w : Finset ι) : ∑ i∈w,p i ≤ C*((l.count.val:ℝ)^ (4:ℕ)*δ) := by |
| 307 | apply le_trans (Finset.sum_le_sum (fun i _ => hz i)) |
| 308 | rw [← mul_sum,sum_comm]; apply mul_le_mul_of_nonneg_left _ hC |
| 309 | have hQ (z : Site l.count) : ∑ i∈w,fns (P z) i ≤ δ := |
| 310 | ((hf _).2.1.sum_le_tsum w (fun i _ => (hf _).1 i)).trans (hf _).2.2 |
| 311 | apply le_trans (Finset.sum_le_sum (fun z _ => hQ z)); rw [sum_const,card_univ,Lattice.site_card] |
| 312 | rw [nsmul_eq_mul]; push_cast; rfl |
| 313 | exact ⟨hp,summable_of_sum_le hp hH, Real.tsum_le_of_sum_le hp hH⟩ |
| 314 | |
| 315 | /-- The two types of actual input. Keep the same derivative and support |
| 316 | certificate. |
| 317 | Don't change `Healthy` when masks on the threshold. -/ |
| 318 | def reuseCharge {c f : Side} (s : Survey G) (j : ℕ) (e : Exchange) (X : ℕ → Support f) (Y : ℕ → Support c) |
| 319 | (M B k : ℕ) (b : ℝ) (F : ℕ → ℝ) (δ : ℝ) : Prop := ∀ y : Site c, |
| 320 | SumBudget (fun i => if y∈Y i then Real.exp (b*coverNumber B (Y i)+(foundation s e j/4)*coverNumber M (X i))* |
| 321 | ((coverNumber M (X i):ℝ)+1)^k*F i else 0) δ |
| 322 | |
| 323 | lemma Buy.fromE (l : Ratio c f) (h : Buy s q e j i l.count.val) {T : Activities G f} {δ : ℝ} {p : BudgetPoint} |
| 324 | (hT : T.EBound p δ) (b : ℝ) |
| 325 | (ha : foundation s e j ≤ p.supportExponent) (hb : 0 ≤ b) (he : b ≤ s.o.A j+e.extra) {B : ℕ} |
| 326 | (hg : 0<B) (hh : p.B ≤ 2*B) (hd : 0 ≤ δ) : ∃ F : ℕ → ℝ, |
| 327 | (∀ i,p.supBounds (T.reg i).site (T.reg i).support (T.E i) (F i)) ∧ |
| 328 | ∀ Y, (∀ i,Footage l e.radius B (T.reg i).support (Y i)) → ∀ k, |
| 329 | reuseCharge s j e (fun i => (T.reg i).support) Y p.B B k b F (footprintCost s j e k l.count.val B * δ) := by |
| 330 | obtain ⟨F,hF,Hf⟩ := hT |
| 331 | exact ⟨F,hF,fun Y hY k => h.hit l _ b ha hb he hg hh _ _ (fun i => (T.reg i).anchor) Y hY k F |
| 332 | (fun i => (hF i).1) δ hd Hf⟩ |
| 333 | |
| 334 | lemma Buy.fromK (l : Ratio c f) (h : Buy s q e j i l.count.val) {T : Activities G f} {δ : ℝ} {p : BudgetPoint} |
| 335 | (hT : T.KBound p δ) (b : ℝ) |
| 336 | (ha : foundation s e j ≤ p.supportExponent) (hb : 0 ≤ b) (he : b ≤ s.o.A j+e.extra) {B : ℕ} |
| 337 | (hg : 0<B) (hh : p.B ≤ 2*B) (hd : 0 ≤ δ) : ∃ F : ℕ → ℝ, |
| 338 | (∀ i,(0 ≤ F i) ∧ ∀ U, ‖T.K i U‖ ≤ F i) ∧ |
| 339 | ∀ Y, (∀ i,Footage l e.radius B (T.forced i).support (Y i)) → ∀ k, |
| 340 | reuseCharge s j e (fun i => (T.forced i).support) Y p.B B k b F (footprintCost s j e k l.count.val B * δ) := by |
| 341 | obtain ⟨F,hF,Hf⟩ := hT |
| 342 | choose o ho using fun i => ((T.forced i).inventory_ne.mono (T.forced i).inventory_sup) |
| 343 | refine ⟨F,hF,fun Y hY k => h.hit l _ b ha hb he hg hh _ o ho Y hY k F |
| 344 | (fun i => (hF i).1) δ hd ?_⟩ |
| 345 | intro x |
| 346 | have he := Hf x |
| 347 | let t n := if o n=x then p.mass (T.forced n).support (F n) else 0 |
| 348 | have hp (i : ℕ) : 0 ≤ t i := by |
| 349 | have := (hF i).1; unfold t BudgetPoint.mass; split_ifs <;> positivity |
| 350 | have ht (i) : t i ≤ (if x ∈ (T.forced i).support then p.mass (T.forced i).support (F i) else 0) := by |
| 351 | unfold t; split_ifs with h hx hx |
| 352 | · exact le_rfl |
| 353 | · exact False.elim (hx (h ▸ ho i)) |
| 354 | · have := (hF i).1; unfold BudgetPoint.mass; positivity |
| 355 | exact le_rfl |
| 356 | have h := he.2.1.of_nonneg_of_le hp ht |
| 357 | exact ⟨hp,h,(h.tsum_le_tsum ht he.2.1).trans he.2.2⟩ |
| 358 | end YM.Next.Scheduling |