Lean sources / SurfaceBlowup / Reciprocity / Patterns.lean
Pattern sums, crossing factorization and unitarity
1/-2Copyright (c) 2026 Asvin G, Claude (Anthropic), GPT-6-Astra (OpenAI). All rights reserved.3Released under Apache 2.0 license as described in the file LICENSE.4Authors: Asvin G, Claude (Anthropic), GPT-6-Astra (OpenAI)5-/6import SurfaceBlowup.Reciprocity.Plethysm7 8/-!9# Pattern sums, crossing factorization and unitarity10 11Coefficient-level identities connecting the recursion laws of single-boundary states `S(a;n)` and12crossing states `T(a,b;c,h)` to the series calculus of the reciprocity proof: pattern sums and13their independence of the ambient dimension, reciprocal and Adams substitution in laws, closed14forms of the weight rational functions, the Euler transform as a pattern sum, the crossing15factorization of the contact series `U_{a,b}`, and its unitarity `U U† ≡ 1` by induction.16 17## Main results18 19* `coeff_eulerSer`: `[xⁿ] eulerSer ε a = patternSum ε a n n`.20* `coeff_recipCoef_lawCoef`, `lawCoef_globalLaw_false`, `lawCoef_globalLaw_true`: coefficients of21 the laws in `Coef`.22* `crossingQ_eq_qmul_qplus_qdiag_qminus`: `U_{a,b} = U_{a+b,b}⁺ J(P_{a+b}) U_{a,a+b}⁻`.23* `qcongr_crossingQ_mul_qdagger`: unitarity of `U_{a,b}` through degree `2M + 1`.24* `coeff_qact_crossingQ_gaussPhi_eulerSer`, `lawCoef_single_self_term`: the two sides of the25 single-boundary operator equation.26 27## Implementation notes28 29The recursion is unfolded with `exitLaw` and `state_law_unfold` from30`SurfaceBlowup.Formula.StateCombinatorics`, so that the reciprocity proof only depends on the31combinatorics of the formula.32 33Provenance: `Thm_SurfaceBlowupV2_recip_{pattern_extend, pattern_pad, stateLaw_globalLaw_wf,34monic_projective_coef, subst_inv_var, lawCoef_recip_subst, subst_pow_var, lawCoef_descend,35otherChildren_coef, crossing_term_coef, crossing_exit_regroup, globalLaw_coef, single_term_coef,36weights_rational, closing_scalar, countSum_eq, crossing_exchange, crossingQ_basic,37euler_product_trunc, euler_coeff_product, euler_coeff_pattern, crossing_factorization_coeff,38crossing_factorization, contact_induction, eulerSer_coeff_one, cluster_base,39single_operator_coeff, single_self_term_value}`.40-/41 42namespace SurfaceBlowup43 44/-! ### Pattern sums -/45 46@[to_additive]47private theorem prod_castLE_extend {M : Type*} [CommMonoid M] (N N' : ℕ) (hNN' : N ≤ N')48 (f : Fin N' → M) (g : Fin N → M) (h1 : ∀ i : Fin N, f (Fin.castLE hNN' i) = g i)49 (h2 : ∀ i : Fin N', N ≤ i.val → f i = 1) : ∏ i, f i = ∏ i, g i := by50 rw [← Finset.prod_subset (Finset.subset_univ (Finset.univ.map (Fin.castLEEmb hNN')))]51 · rw [Finset.prod_map]52 exact Finset.prod_congr rfl (fun i _ ↦ h1 i)53 · intro i _ hi54 apply h255 by_contra hc56 exact hi (Finset.mem_map.2 ⟨⟨i.val, by omega⟩, Finset.mem_univ _, Fin.ext rfl⟩)57 58section Extend59 60variable {N N' : ℕ} (hNN' : N ≤ N') {m : Pattern N} {m' : Pattern N'}61 (h : ∀ i j : Fin N', (m' (i, j)).val =62 if hij : i.val < N ∧ j.val < N then (m (⟨i.val, hij.1⟩, ⟨j.val, hij.2⟩)).val else 0)63include h64 65@[to_additive]66private theorem prod_row_castLE {M : Type*} [CommMonoid M] (g : ℕ → ℕ → M)67 (hg : ∀ j, g j 0 = 1) (i : Fin N) :68 ∏ j : Fin N', g j (m' (Fin.castLE hNN' i, j)).val = ∏ j : Fin N, g j (m (i, j)).val :=69 prod_castLE_extend N N' hNN' _ _ (fun j ↦ by simp [h]) fun j hj ↦ by simp [h, not_lt.2 hj, hg]70 71@[to_additive]72private theorem prod_row_eq_one {M : Type*} [CommMonoid M] (g : ℕ → ℕ → M)73 (hg : ∀ j, g j 0 = 1) (i : Fin N') (hi : N ≤ i.val) :74 ∏ j : Fin N', g j (m' (i, j)).val = 1 :=75 Finset.prod_eq_one fun j _ ↦ by simp [h, not_lt.2 hi, hg]76 77include hNN' in78@[to_additive]79private theorem prod_pattern_extend {M : Type*} [CommMonoid M] (g : ℕ → ℕ → ℕ → M)80 (hg : ∀ i j, g i j 0 = 1) :81 ∏ ij : Fin N' × Fin N', g ij.1 ij.2 (m' ij).val =82 ∏ ij : Fin N × Fin N, g ij.1 ij.2 (m ij).val := by83 rw [Fintype.prod_prod_type, Fintype.prod_prod_type]84 exact prod_castLE_extend N N' hNN' _ _ (fun i ↦ prod_row_castLE hNN' h (g i) (hg i) i)85 fun i hi ↦ prod_row_eq_one h (g i) (hg i) i hi86 87include hNN' in88private theorem patternWeight_extend : patternWeight m' = patternWeight m :=89 sum_pattern_extend hNN' h (fun i j k ↦ (i + 1) * (j + 1) * k) fun _ _ ↦ mul_zero _90 91include hNN' in92private theorem rational_divisorCount_extend (ε : ℤ) :93 (divisorCount ε m').rational = (divisorCount ε m).rational := by94 rw [rational_divisorCount, rational_divisorCount]95 refine prod_castLE_extend N N' hNN' _ _ (fun i ↦ ?_) fun i hi ↦ ?_96 · rw [sum_row_castLE hNN' h (fun _ k ↦ k) (fun _ ↦ rfl),97 prod_row_castLE hNN' h (fun _ k ↦ ((k.factorial : ℕ) : ℚ)) (fun _ ↦ by simp)]98 simp99 · rw [sum_row_eq_zero h (fun _ k ↦ k) (fun _ ↦ rfl) i hi,100 prod_row_eq_one h (fun _ k ↦ ((k.factorial : ℕ) : ℚ)) (fun _ ↦ by simp) i hi]101 simp102 103end Extend104 105/-- The pattern sum of weight `w ≤ N` does not change when the ambient dimension grows from `N`106to `N' ≥ N` (patterns of weight `w` live in the first `w` rows and columns). -/107private theorem patternSum_extend (ε : ℤ) (a N N' w : ℕ) (hNN' : N ≤ N') (hw : w ≤ N) :108 patternSum ε a N w = patternSum ε a N' w := by109 let ext : Pattern N → Pattern N' := fun m ij ↦110 if hij : ij.1.val < N ∧ ij.2.val < N then111 Fin.castLE (by omega) (m (⟨ij.1.val, hij.1⟩, ⟨ij.2.val, hij.2⟩)) else 0112 let res : Pattern N' → Pattern N := fun m' ij ↦113 ⟨min (m' (Fin.castLE hNN' ij.1, Fin.castLE hNN' ij.2)).val N, by omega⟩114 have hext (m : Pattern N) (i j : Fin N') : ((ext m) (i, j)).val =115 if hij : i.val < N ∧ j.val < N then (m (⟨i.val, hij.1⟩, ⟨j.val, hij.2⟩)).val else 0 := by116 simp only [ext]117 split_ifs <;> simp118 have hres (m' : Pattern N') (hm : patternWeight m' = w) (i j : Fin N') : (m' (i, j)).val =119 if hij : i.val < N ∧ j.val < N then ((res m') (⟨i.val, hij.1⟩, ⟨j.val, hij.2⟩)).val120 else 0 := by121 split_ifs with hij122 · simpa [res, Fin.castLE] using123 (pattern_entry_le_patternWeight N' m' (i, j)).trans (hm.trans_le hw)124 · refine pattern_entry_eq_zero_of_lt N' m' (i, j) ?_125 rw [hm]126 rcases not_and_or.mp hij with h | h <;> dsimp only <;> nlinarith127 refine Finset.sum_nbij' ext res (fun m hm ↦ ?_) (fun m' hm' ↦ ?_) (fun m _ ↦ ?_)128 (fun m' hm' ↦ ?_) fun m _ ↦ ?_129 · simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hm ⊢130 rw [patternWeight_extend hNN' (hext m), hm]131 · simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hm' ⊢132 rw [← patternWeight_extend hNN' (hres m' hm'), hm']133 · funext ij134 have := (m ij).isLt135 simp only [res, Fin.ext_iff, hext, Fin.val_castLE, ij.1.isLt, ij.2.isLt, and_self, dite_true,136 Fin.eta, Prod.mk.eta]137 omega138 · simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hm'139 funext ⟨i, j⟩140 exact Fin.ext ((hext _ i j).trans (hres m' hm' i j).symm)141 · rw [rational_divisorCount_extend hNN' (hext m),142 prod_pattern_extend hNN' (hext m) (fun i j k ↦143 adamsCoef (i + 1) (lawCoef (stateLaw (State.single a (j + 1)))) ^ k) fun _ _ ↦ pow_zero _]144 145/-- The pattern sum of weight `w` is independent of the ambient dimension, as long as it is at146least `w`. -/147theorem patternSum_eq_of_le (ε : ℤ) (a N N' w : ℕ) (hN : w ≤ N) (hN' : w ≤ N') :148 patternSum ε a N w = patternSum ε a N' w := by149 rw [patternSum_extend ε a N (max N N') w (le_max_left _ _) hN,150 patternSum_extend ε a N' (max N N') w (le_max_right _ _) hN']151 152/-- The laws of valid states consist of well-formed expressions. -/153theorem lawWf_stateLaw (s : State) (hs : s.Valid) : LawWf (stateLaw s) :=154 (local_law_safe s hs).lawWf155 156/-- The global laws consist of well-formed expressions. -/157theorem lawWf_globalLaw (ε : Bool) (n : ℕ) : LawWf (globalLaw ε n) :=158 (global_law_safe n ε).lawWf159 160/-- The `σ`-coefficient of the global monic law, read in `Coef`, is the rational function of161`monicExpr n σ`. -/162theorem coeff_lawCoef_globalLaw_false (n : ℕ) (σ : FactorType) :163 (lawCoef (globalLaw false n)).coeff σ = (monicExpr n σ).rational :=164 coeff_lawCoef _ (lawWf_globalLaw false n) σ165 166/-- The `σ`-coefficient of the global projective law, read in `Coef`, is the rational function167of `projectiveExpr n σ`. -/168theorem coeff_lawCoef_globalLaw_true (n : ℕ) (σ : FactorType) :169 (lawCoef (globalLaw true n)).coeff σ = (projectiveExpr n σ).rational :=170 coeff_lawCoef _ (lawWf_globalLaw true n) σ171 172/-- Substituting a well-formed expression `e` for the variable, where `e.rational = φ(q)` for a173ring endomorphism `φ` of `ℚ(q)`, preserves well-formedness and acts on rational functions as174`φ` (the two facts are proved by a joint induction). -/175private theorem wf_subst_and_rational_subst (e : Expr) (he : e.wf) (φ : RatFunc ℚ →+* RatFunc ℚ)176 (hX : e.rational = φ RatFunc.X) (x : Expr) (hx : x.wf) :177 (x.subst e).wf ∧ (x.subst e).rational = φ x.rational := by178 induction x with179 | const r =>180 refine ⟨trivial, ?_⟩181 simp only [Expr.subst, Expr.rational_const]182 rw [eq_ratCast RatFunc.C r, map_ratCast]183 | var => exact ⟨he, by simp only [Expr.subst, Expr.rational_var, hX]⟩184 | add a b iha ihb =>185 obtain ⟨wa, ea⟩ := iha hx.1186 obtain ⟨wb, eb⟩ := ihb hx.2187 refine ⟨⟨wa, wb⟩, ?_⟩188 simp only [Expr.subst]189 rw [Expr.rational_add wa wb, Expr.rational_add hx.1 hx.2, map_add, ea, eb]190 | mul a b iha ihb =>191 obtain ⟨wa, ea⟩ := iha hx.1192 obtain ⟨wb, eb⟩ := ihb hx.2193 refine ⟨⟨wa, wb⟩, ?_⟩194 simp only [Expr.subst]195 rw [Expr.rational_mul, Expr.rational_mul a b, map_mul, ea, eb]196 | inv a iha =>197 obtain ⟨ha, hn⟩ := hx198 obtain ⟨wa, ea⟩ := iha ha199 have hr : a.rational ≠ 0 :=200 div_ne_zero (RatFunc.algebraMap_ne_zero hn)201 (RatFunc.algebraMap_ne_zero (Expr.fraction_snd_ne_zero ha))202 refine ⟨⟨wa, fun h ↦ ?_⟩, ?_⟩203 · refine hr (φ.injective ?_)204 rw [← ea, map_zero, Expr.rational, h, map_zero, zero_div]205 · simp only [Expr.subst]206 rw [Expr.rational_inv, Expr.rational_inv a, map_inv₀, ea]207 208/-- Substituting a well-formed expression `e` with `e.rational = φ(q)` for the variable of a209well-formed expression acts on rational functions as `φ`. -/210private theorem rational_subst_of_wf (e : Expr) (he : e.wf) (φ : RatFunc ℚ →+* RatFunc ℚ)211 (hX : e.rational = φ RatFunc.X) {x : Expr} (hx : x.wf) :212 (x.subst e).rational = φ x.rational :=213 (wf_subst_and_rational_subst e he φ hX x hx).2214 215/-- Substituting `q ↦ 1/q` into a well-formed expression acts on its rational function as216`recipRat`. -/217private theorem rational_subst_inv_var (x : Expr) (hx : x.wf) :218 (x.subst (.inv .var)).rational = recipRat x.rational :=219 rational_subst_of_wf (.inv .var) ⟨trivial, by simp [Expr.fraction, Polynomial.X_ne_zero]⟩ recipRat220 (by rw [Expr.rational_inv, Expr.rational_var, recipRat_X]) hx221 222/-- For a well-formed law, the `σ`-coefficient of `lawCoef L` with `q ↦ 1/q` applied is the223rational function of the coefficient expression with `q ↦ 1/q` substituted. -/224theorem coeff_recipCoef_lawCoef (L : Law) (hL : LawWf L) (σ : FactorType) :225 (recipCoef (lawCoef L)).coeff σ = ((lawCoeff L σ).subst (.inv .var)).rational := by226 rw [recipCoef_coeff, coeff_lawCoef L hL σ, rational_subst_inv_var _ (hL.wf_lawCoeff σ)]227 228/-- Descending a well-formed law along a degree-`δ` extension acts on `lawCoef` as the Adams229operation `ψ_δ`. -/230private theorem lawCoef_lawDescend (δ : ℕ) (hδ : 0 < δ) (L : Law) (hL : LawWf L) :231 lawCoef (lawDescend δ L) = adamsCoef δ (lawCoef L) := by232 unfold lawCoef lawDescend233 rw [map_list_sum, List.map_map, List.map_map]234 congr 1235 refine List.map_congr_left fun z hz ↦ ?_236 simp only [Function.comp]237 rw [rational_subst_of_wf _ (Expr.wf_pow (x := Expr.var) trivial δ) (adamsRat δ)238 (by rw [Expr.rational_pow, Expr.rational_var, adamsRat_X δ hδ]) (hL z hz), adamsCoef_single]239 240/-- The product of the descended laws of the off-boundary children of a pattern `m` is241`Π_{(i,j)} ψ_{i+1}(F_{S(a;j+1)})^{m(i,j)}`. -/242private theorem lawCoef_otherChildren (a N : ℕ) (ha : 0 < a) (m : Pattern N) :243 lawCoef (lawProd ((otherChildren a m).map fun z ↦ lawDescend z.1 (stateLaw z.2))) =244 ∏ ij : Fin N × Fin N, (adamsCoef (ij.1.val + 1) (lawCoef245 (stateLaw (State.single a (ij.2.val + 1))))) ^ (m ij).val := by246 have hf : ∀ ij : Fin N × Fin N, lawCoef (lawDescend (ij.1.val + 1)247 (stateLaw (State.single a (ij.2.val + 1)))) = adamsCoef (ij.1.val + 1)248 (lawCoef (stateLaw (State.single a (ij.2.val + 1)))) := by249 intro ij250 refine lawCoef_lawDescend _ (Nat.succ_pos _) _ ?_251 exact (lawWf_stateLaw _ (by simp [State.Valid]; omega))252 rw [(lawCoef_lawProd _)]253 unfold otherChildren254 simp only [List.map_flatMap, List.map_replicate, hf]255 rw [List.flatMap_def, List.prod_flatten, List.map_map, Finset.prod_eq_multiset_prod,256 ← Multiset.prod_map_toList]257 simp [List.prod_replicate, Finset.toList, Function.comp_def]258 259private theorem prod_lawCoef_optional_child (p : Prop) [Decidable p] (s' : State)260 (hv : ¬p → s'.Valid) :261 ((if p then [] else [((1 : ℕ), s')]).map262 (lawCoef ∘ fun z : ℕ × State ↦ lawDescend z.1 (stateLaw z.2))).prod263 = if p then 1 else lawCoef (stateLaw s') := by264 split_ifs with h265 · simp266 · simp only [List.map_cons, List.map_nil, List.prod_cons, List.prod_nil, mul_one,267 Function.comp]268 rw [lawCoef_lawDescend 1 one_pos _ (lawWf_stateLaw _ (hv h)), adamsCoef_one]269 270/-- The contribution of an allowed tangent pattern `P` of the crossing state `T(a,b;c,h)` to its271recursion, as an element of `Coef`: the weights times the laws of the crossing children and the272off-boundary product. -/273private theorem lawCoef_crossing_term (a b c h : ℕ) (ha : 0 < a) (hb : 0 < b) (hc : 0 < c)274 (hh : 0 < h)275 (P : TangentPattern (State.crossing a b c h).degree) (hP : Allowed (State.crossing a b c h) P) :276 lawCoef (lawScale (.mul (tangentCount (State.crossing a b c h) P)277 (divisorProbability (State.crossing a b c h) P.d.val))278 (lawProd ((children (State.crossing a b c h) P).map fun z ↦279 lawDescend z.1 (stateLaw z.2)))) = scalar ((divisorCount (-1) P.other).rational *280 (divisorProbability (State.crossing a b c h) P.d.val).rational) *281 ((if P.rt.val = 0 then 1 else lawCoef (stateLaw (State.crossing (a + b) a P.rt.val282 (c - P.d.val)))) * (if P.rx.val = 0 then 1 else lawCoef283 (stateLaw (State.crossing (a + b) b P.rx.val (h - P.d.val)))) *284 ∏ ij : Fin (State.crossing a b c h).degree × Fin (State.crossing a b c h).degree,285 (adamsCoef (ij.1.val + 1) (lawCoef (stateLaw (State.single (a + b) (ij.2.val + 1))))) ^286 (P.other ij).val) := by287 have hv : ∀ z ∈ children (State.crossing a b c h) P, z.2.Valid :=288 children_valid (State.crossing a b c h) ⟨ha, hb, hc, hh⟩ P hP289 rw [lawCoef_lawScale, Expr.rational_mul]290 congr 1291 have hch : children (State.crossing a b c h) P =292 (if P.rt.val=0 then [] else [(1,State.crossing (a+b) a P.rt.val (c-P.d.val))]) ++293 (if P.rx.val=0 then [] else [(1,State.crossing (a+b) b P.rx.val (h-P.d.val))]) ++294 otherChildren (a+b) P.other := rfl295 have hoth := lawCoef_otherChildren (a+b) _ (by omega) P.other296 rw [lawCoef_lawProd, List.map_map] at hoth297 rw [lawCoef_lawProd, List.map_map, hch, List.map_append, List.map_append, List.prod_append,298 List.prod_append, ← hoth, prod_lawCoef_optional_child _ _ ?_,299 prod_lawCoef_optional_child _ _ ?_]300 all_goals exact fun h1 ↦ hv (1, _) (by rw [hch]; simp [h1])301 302/-- Summing the pattern terms `scalar (divisorCount ε m · Y) · B · Π ψ_{i+1}(F_{S(a;j+1)})^{m(i,j)}`303over the patterns `m` of weight `w` gives `scalar Y · B · patternSum ε a N w`. -/304theorem sum_patterns_scalar_mul_eq_patternSum (ε : ℤ) (a N w : ℕ) (Y : RatFunc ℚ) (B : Coef) :305 ∑ m ∈ (Finset.univ : Finset (Pattern N)).filter (fun m ↦ patternWeight m = w),306 scalar ((divisorCount ε m).rational * Y) * (B * ∏ ij : Fin N × Fin N,307 (adamsCoef (ij.1.val + 1) (lawCoef (stateLaw (State.single a (ij.2.val + 1))))) ^308 (m ij).val) = scalar Y * (B * patternSum ε a N w) := by309 unfold patternSum310 rw [Finset.mul_sum, Finset.mul_sum]311 refine Finset.sum_congr rfl fun m _ ↦ ?_312 rw [scalar_mul, Algebra.smul_def, ← scalar_eq_algebraMap]313 ring314 315/-- The exit law of `T(a,b;c,h)` regrouped by divisor degree `d` and tangent depths `rt`, `rx`316into crossing-child laws and pattern sums `patternSum (-1) (a+b) (ac+bh) (d-rt-rx)`. -/317private theorem lawCoef_exitLaw_crossing (a b c h : ℕ) (ha : 0 < a) (hb : 0 < b) (hc : 0 < c)318 (hh : 0 < h) :319 lawCoef (exitLaw (State.crossing a b c h)) = ∑ d ∈ Finset.Icc 1 (min c h),320 ∑ rt ∈ Finset.range (d + 1), ∑ rx ∈ Finset.range (d + 1),321 (if ((0 < rt ↔ d < c) ∧ (0 < rx ↔ d < h) ∧ rt + rx ≤ d) then scalar322 (divisorProbability (State.crossing a b c h) d).rational *323 ((if rt = 0 then 1 else lawCoef (stateLaw (State.crossing (a + b) a rt (c - d)))) *324 (if rx = 0 then 1 else lawCoef (stateLaw (State.crossing (a + b) b rx (h - d)))) *325 patternSum (-1) (a + b) (a * c + b * h) (d - rt - rx)) else 0) := by326 classical327 unfold exitLaw328 rw [lawCoef_flatMap, Finset.sum_map_toList]329 have hns : ∀ P, ¬ SelfPattern (State.crossing a b c h) P := by330 rintro P ⟨a', c', h1, -⟩331 exact State.noConfusion h1332 simp only [hns, ite_false]333 refine (Finset.sum_congr rfl (fun P hP ↦ lawCoef_crossing_term a b c h ha hb hc hh P334 (by unfold allowedPatterns at hP; exact (Finset.mem_filter.mp hP).2))).trans ?_335 rw [sum_allowedPatterns_crossing a b c h ha hb hh (fun d rt rx m ↦336 scalar ((divisorCount (-1) m).rational * (divisorProbability (State.crossing a b c h)337 d).rational) *338 ((if rt = 0 then 1 else lawCoef (stateLaw (State.crossing (a + b) a rt (c - d)))) *339 (if rx = 0 then 1 else lawCoef (stateLaw (State.crossing (a + b) b rx (h - d)))) *340 ∏ ij : Fin (State.crossing a b c h).degree × Fin (State.crossing a b c h).degree,341 (adamsCoef (ij.1.val + 1) (lawCoef (stateLaw (State.single (a + b) (ij.2.val + 1))))) ^342 (m ij).val))]343 refine Finset.sum_congr rfl (fun d _ ↦ Finset.sum_congr rfl344 (fun rt _ ↦ Finset.sum_congr rfl (fun rx _ ↦ ?_)))345 by_cases hcond : ((0 < rt ↔ d < c) ∧ (0 < rx ↔ d < h) ∧ rt + rx ≤ d)346 · rw [ite_eq_left hcond, ite_eq_left hcond]347 exact sum_patterns_scalar_mul_eq_patternSum _ _ _ _ _ _348 · rw [ite_eq_right hcond, ite_eq_right hcond]349 350private theorem lawCoef_residue_flatMap (n : ℕ) (b : Bool) :351 lawCoef ((residuePatterns n).toList.flatMap fun m ↦352 lawScale (divisorCount (if b then 1 else 0) m)353 (lawProd ((otherChildren 1 m).map fun z ↦ lawDescend z.1 (stateLaw z.2))))354 = patternSum (if b then 1 else 0) 1 n n := by355 rw [lawCoef_flatMap]356 unfold patternSum residuePatterns357 rw [Finset.sum_map_toList]358 refine Finset.sum_congr rfl fun m _ ↦ ?_359 rw [lawCoef_lawScale, lawCoef_otherChildren 1 n Nat.one_pos m, Algebra.smul_def]360 rfl361 362/-- The global monic law is `q^{-n}` times the pattern sum `patternSum 0 1 n n`. -/363theorem lawCoef_globalLaw_false (n : ℕ) :(G) = (7.9)364 lawCoef (globalLaw false n) = qpow (-(n : ℤ)) * patternSum 0 1 n n := by365 have k0 := lawCoef_residue_flatMap n false366 simp only [Bool.false_eq_true, ite_false] at k0367 unfold globalLaw368 simp only [Bool.false_eq_true, ite_false]369 rw [lawCoef_lawScale, k0, Expr.rational_inv, Expr.rational_pow, Expr.rational_var, qpow,370 zpow_neg, zpow_natCast]371 372/-- The global projective law is the pattern sum `patternSum 1 1 n n` divided by373`1 + q + ⋯ + qⁿ`. -/374theorem lawCoef_globalLaw_true (n : ℕ) :(G) = (7.9)375 lawCoef (globalLaw true n) =376 scalar (((projectiveNormalizer n).rational)⁻¹) * patternSum 1 1 n n := by377 have k1 := lawCoef_residue_flatMap n true378 simp only [ite_true] at k1379 unfold globalLaw380 simp only [ite_true]381 rw [lawCoef_lawScale, k1, Expr.rational_inv]382 383/-- The contribution of an allowed tangent pattern `P` of `S(a;n)` to its recursion, as an element384of `Coef`. -/385theorem lawCoef_single_term (a n : ℕ) (ha : 0 < a) (hn : 0 < n)386 (P : TangentPattern (State.single a n).degree) (hP : Allowed (State.single a n) P) :387 lawCoef (lawScale (.mul (tangentCount (State.single a n) P)388 (divisorProbability (State.single a n) P.d.val))389 (lawProd ((children (State.single a n) P).map fun z ↦ lawDescend z.1 (stateLaw z.2)))) =390 scalar ((divisorCount 0 P.other).rational * (divisorProbability (State.single a n)391 P.d.val).rational) * ((if P.rt.val = 0 then 1 else lawCoef392 (stateLaw (State.crossing a a P.rt.val (n - P.d.val)))) *393 ∏ ij : Fin (State.single a n).degree × Fin (State.single a n).degree,394 (adamsCoef (ij.1.val + 1) (lawCoef (stateLaw (State.single a (ij.2.val + 1))))) ^395 (P.other ij).val) := by396 have hv : ∀ z ∈ children (State.single a n) P, z.2.Valid :=397 children_valid (State.single a n) ⟨ha, hn⟩ P hP398 rw [lawCoef_lawScale, Expr.rational_mul]399 congr 1400 have hch : children (State.single a n) P =401 (if P.rt.val=0 then [] else [(1,State.crossing a a P.rt.val (n-P.d.val))]) ++402 otherChildren a P.other := rfl403 have hoth := lawCoef_otherChildren a _ ha P.other404 rw [lawCoef_lawProd, List.map_map] at hoth405 rw [lawCoef_lawProd, List.map_map, hch, List.map_append, List.prod_append, ← hoth,406 prod_lawCoef_optional_child _ _ ?_]407 all_goals exact fun h1 ↦ hv (1, _) (by rw [hch]; simp [h1])408 409/-! ### Closed forms of the weights -/410 411/-- The divisor probability of `S(a;c)` at degree `d` is `q^{-tri d} (q-1)^{[d < c]}`. -/412theorem rational_divisorProbability_single (a c d : ℕ) :Proposition 6.1413 (divisorProbability (State.single a c) d).rational =414 ((RatFunc.X : RatFunc ℚ) ^ tri d)⁻¹ *415 ((RatFunc.X : RatFunc ℚ) - 1) ^ (if d < c then 1 else 0) := by416 simp only [divisorProbability, Expr.rational_mul, Expr.rational_inv, Expr.rational_pow,417 Expr.rational_var, rational_eminusOne]418 419/-- The divisor probability of `T(a,b;c,h)` at degree `d` is `q^{-C(d,2)}` times the crossing weight420`w_j` (`w_0 = (q-1)⁻¹`, `w_j = (q-1)^{j-1}`) with `j = [d < c] + [d < h]`. -/421private theorem rational_divisorProbability_crossing (a b c h d : ℕ) :422 (divisorProbability (State.crossing a b c h) d).rational =423 ((RatFunc.X : RatFunc ℚ) ^ chooseTwo d)⁻¹ * (if (if d < c then 1 else 0) +424 (if d < h then 1 else 0) = 0 then ((RatFunc.X : RatFunc ℚ) - 1)⁻¹ else425 ((RatFunc.X : RatFunc ℚ) - 1) ^426 ((if d < c then 1 else 0) + (if d < h then 1 else 0) - 1)) := by427 simp only [divisorProbability]428 rw [Expr.rational_mul, Expr.rational_inv, Expr.rational_pow, Expr.rational_var]429 split_ifs <;> simp [Expr.rational_inv, Expr.rational_pow, rational_eminusOne]430 431/-- The return weight is `q · q^{-tri c}`. -/432theorem rational_returnWeight (c : ℕ) :433 (returnWeight c).rational = (RatFunc.X : RatFunc ℚ) * ((RatFunc.X : RatFunc ℚ) ^ tri c)⁻¹ := by434 simp only [returnWeight, Expr.rational_mul, Expr.rational_inv, Expr.rational_pow,435 Expr.rational_var]436 437/-- The point count `(1/δ) Σ_{j ∣ δ} μ(j) q^{δ/j}` of degree-`δ` points. -/438private theorem rational_pointCount (δ : ℕ) : (pointCount δ).rational = RatFunc.C (1 / (δ : ℚ)) *439 ∑ j ∈ δ.divisors, RatFunc.C (((ArithmeticFunction.moebius j : ℤ) : ℚ)) *440 (RatFunc.X : RatFunc ℚ) ^ (δ / j) := by441 unfold pointCount442 rw [Expr.rational_mul, Expr.rational_const, Expr.rational_sum]443 · rw [List.map_map, ← Finset.sum_map_toList]444 congr 2445 refine List.map_congr_left fun j _ ↦ ?_446 simp [Expr.rational_mul, Expr.rational_const, Expr.rational_pow, Expr.rational_var]447 · intro z hz448 obtain ⟨j, _, rfl⟩ := List.mem_map.1 hz449 exact ⟨trivial, Expr.wf_pow (x := Expr.var) trivial _⟩450 451/-- The available points: `q + ε` in degree `1`, and the point count in higher degree. -/452private theorem rational_availablePoints (ε : ℤ) (δ : ℕ) :453 (availablePoints ε δ).rational =454 if δ = 1 then (RatFunc.X : RatFunc ℚ) + (ε : RatFunc ℚ) else (pointCount δ).rational := by455 unfold availablePoints456 split_ifs457 · rw [Expr.rational_add (x := Expr.var) (y := Expr.const (ε : ℚ)) trivial trivial,458 Expr.rational_var, Expr.rational_const, map_intCast]459 · rfl460 461/-- `q (q⁻¹ - q^{-tri n}) = 1 - returnWeight n`. -/462private theorem X_mul_X_inv_sub_X_zpow_neg_tri (n : ℕ) :463 (RatFunc.X : RatFunc ℚ) * ((RatFunc.X : RatFunc ℚ)⁻¹ - (RatFunc.X : RatFunc ℚ) ^464 (-(tri n : ℤ))) = 1 - (returnWeight n).rational := by465 rw [rational_returnWeight n, zpow_neg, zpow_natCast, mul_sub, mul_inv_cancel₀ RatFunc.X_ne_zero]466 467/-- For `n ≥ 2`, the return weight is not `1`: `1 - returnWeight n ≠ 0`. -/468theorem one_sub_rational_returnWeight_ne_zero (n : ℕ) (hn : 2 ≤ n) :469 1 - (returnWeight n).rational ≠ 0 := by470 have h3 : 3 ≤ tri n := by471 unfold tri472 have : 6 ≤ n * (n + 1) := by nlinarith473 omega474 intro h0475 have hX : (RatFunc.X : RatFunc ℚ) ≠ 0 := RatFunc.X_ne_zero476 have h1 : (returnWeight n).rational = 1 := by linear_combination -h0477 rw [rational_returnWeight] at h1478 have hk : (RatFunc.X : RatFunc ℚ) = (RatFunc.X : RatFunc ℚ) ^ tri n := by479 have := congrArg (· * (RatFunc.X : RatFunc ℚ) ^ tri n) h1480 simpa [mul_assoc, inv_mul_cancel₀ (pow_ne_zero _ hX)] using this481 have hp : (Polynomial.X : Polynomial ℚ) = Polynomial.X ^ tri n := by482 apply RatFunc.algebraMap_injective ℚ483 simpa [RatFunc.algebraMap_X] using hk484 have := congrArg Polynomial.natDegree hp485 simp at this486 omega487 488/-- For `n ≥ 2`, the scalar `q⁻¹ - q^{-tri n}` is nonzero. -/489theorem X_inv_sub_X_zpow_neg_tri_ne_zero (n : ℕ) (hn : 2 ≤ n) :Proof of monic/cluster reciprocity490 (RatFunc.X : RatFunc ℚ)⁻¹ - (RatFunc.X : RatFunc ℚ) ^ (-(tri n : ℤ)) ≠ 0 := fun h ↦ by491 have := X_mul_X_inv_sub_X_zpow_neg_tri n492 rw [h, mul_zero] at this493 exact one_sub_rational_returnWeight_ne_zero n hn this.symm494 495private theorem adamsRat_X_add_int (k : ℕ) (hk : 0 < k) (ε : ℤ) :496 adamsRat k (RatFunc.X + (ε : RatFunc ℚ)) = RatFunc.X ^ k + (ε : RatFunc ℚ) := by497 rw [map_add, map_intCast, (adamsRat_X k hk)]498 499private theorem availablePoints_rational_eq_sum (ε : ℤ) (m : ℕ) (hm : 0 < m) :500 ∑ k ∈ m.divisors, (RatFunc.C ((k : ℚ)⁻¹ * (((ArithmeticFunction.moebius (m / k) : ℤ) : ℚ) /501 ((m / k : ℕ) : ℚ))))502 * ((RatFunc.X : RatFunc ℚ) ^ k + (ε : RatFunc ℚ)) = (availablePoints ε m).rational := by503 rw [rational_availablePoints]504 have hm' : (m : ℚ) ≠ 0 := by exact_mod_cast hm.ne'505 have ht : ∀ k ∈ m.divisors,506 RatFunc.C ((k : ℚ)⁻¹ * (((ArithmeticFunction.moebius (m / k) : ℤ) : ℚ) / ((m / k : ℕ) : ℚ)))507 * ((RatFunc.X : RatFunc ℚ) ^ k + (ε : RatFunc ℚ))508 = (fun j : ℕ ↦ RatFunc.C (((ArithmeticFunction.moebius j : ℤ) : ℚ) / m)509 * ((RatFunc.X : RatFunc ℚ) ^ (m / j) + (ε : RatFunc ℚ))) (m / k) := by510 intro k hk511 have hk0 : (k : ℚ) ≠ 0 := by exact_mod_cast (Nat.pos_of_mem_divisors hk).ne'512 simp only [Nat.div_div_self (Nat.dvd_of_mem_divisors hk) hm.ne']513 congr 2514 rw [Nat.cast_div (Nat.dvd_of_mem_divisors hk) hk0]515 field_simp516 rw [Finset.sum_congr rfl ht, Nat.sum_div_divisors m (fun j : ℕ ↦517 RatFunc.C (((ArithmeticFunction.moebius j : ℤ) : ℚ) / m)518 * ((RatFunc.X : RatFunc ℚ) ^ (m / j) + (ε : RatFunc ℚ)))]519 split_ifs with h1520 · subst h1; simp521 · rw [rational_pointCount]522 simp only [mul_add, Finset.sum_add_distrib, Finset.mul_sum]523 have h0 : ∑ j ∈ m.divisors, RatFunc.C (((ArithmeticFunction.moebius j : ℤ) : ℚ) / m) *524 (ε : RatFunc ℚ) = 0 := by525 rw [← Finset.sum_mul, ← map_sum, ← Finset.sum_div, sum_divisors_moebius, ite_eq_right h1]526 simp527 rw [h0, add_zero]528 refine Finset.sum_congr rfl fun j _ ↦ ?_529 rw [← mul_assoc, ← map_mul]530 congr 2531 field_simp532 533/-- `Σ_k ψ_k((q+ε) · Σ_j μ(j) ψ_j(L)/j)/k` equals `Σ_m C_m ψ_m(L)` with534`C_m = availablePoints ε m`. -/535private theorem plethSum_C_mul_moebiusSum (ε : ℤ) (L : Ser) :536 plethSum (PowerSeries.C (scalar (RatFunc.X + (ε : RatFunc ℚ))) * moebiusSum L) =537 countSum ε L := by538 ext n : 1539 simp only [plethSum, moebiusSum, countSum, PowerSeries.coeff_mk, PowerSeries.coeff_C_mul,540 Finset.mul_sum, map_sum, Finset.smul_sum]541 have h1 : ∀ k ∈ n.divisors, ∀ j ∈ (n / k).divisors,542 (k : ℚ)⁻¹ • adamsCoef k (scalar (RatFunc.X + (ε : RatFunc ℚ)) *543 ((((ArithmeticFunction.moebius j : ℤ) : ℚ)) / (j : ℚ)) •544 adamsCoef j (PowerSeries.coeff (n / k / j) L))545 = (fun (k j : ℕ) ↦ scalar (RatFunc.C ((k : ℚ)⁻¹ *546 (((ArithmeticFunction.moebius j : ℤ) : ℚ) / (j : ℚ))) *547 ((RatFunc.X : RatFunc ℚ) ^ k + (ε : RatFunc ℚ))) *548 adamsCoef (k * j) (PowerSeries.coeff (n / (k * j)) L)) k j := by549 intro k hk j hj550 have hk0 : 0 < k := Nat.pos_of_mem_divisors hk551 have hj0 : 0 < j := Nat.pos_of_mem_divisors hj552 rw [mul_smul_comm, map_rat_smul, map_mul, adamsCoef_adamsCoef k j hk0 hj0,553 Nat.div_div_eq_div_mul,554 adamsCoef_scalar k, adamsRat_X_add_int k hk0, smul_smul, rat_smul_eq_scalar_mul, ← mul_assoc,555 ← scalar_mul]556 rw [Finset.sum_congr rfl fun k hk ↦ Finset.sum_congr rfl (h1 k hk),557 sum_divisors_sum_divisors_div]558 refine Finset.sum_congr rfl fun m hm ↦ ?_559 have hm0 : 0 < m := Nat.pos_of_mem_divisors hm560 have h2 : ∀ k ∈ m.divisors, k * (m / k) = m := fun k hk ↦561 Nat.mul_div_cancel' (Nat.dvd_of_mem_divisors hk)562 rw [Finset.sum_congr rfl fun k hk ↦ by563 rw [h2 k hk], ← Finset.sum_mul, ← availablePoints_rational_eq_sum ε m hm0]564 simp only [scalar_eq_algebraMap, ← map_sum, Algebra.smul_def]565 566/-- The law of a crossing state is symmetric under exchanging the two branches:567`F_{T(a,b;c,h)} = F_{T(b,a;h,c)}`. -/568private theorem lawCoef_stateLaw_crossing_comm (a b c h : ℕ) (ha : 0 < a) (hb : 0 < b) (hc : 0 < c)569 (hh : 0 < h) :570 lawCoef (stateLaw (State.crossing a b c h)) = lawCoef (stateLaw (State.crossing b a h c)) := by571 have h1 := (state_law_unfold (.crossing a b c h) ⟨ha, hb, hc, hh⟩ rfl).2 a b c h rfl572 have h2 := (state_law_unfold (.crossing b a h c) ⟨hb, ha, hh, hc⟩ rfl).2 b a h c rfl573 rw [h1, h2, lawCoef_exitLaw_crossing a b c h ha hb hc hh,574 lawCoef_exitLaw_crossing b a h c hb ha hh hc, Nat.min_comm h c]575 refine Finset.sum_congr rfl fun d _ ↦ ?_576 conv_rhs => rw [Finset.sum_comm]577 refine Finset.sum_congr rfl fun rt _ ↦ Finset.sum_congr rfl fun rx _ ↦ ?_578 have hp : (divisorProbability (State.crossing b a h c) d).rational579 = (divisorProbability (State.crossing a b c h) d).rational := by580 rw [rational_divisorProbability_crossing b a h c d,581 rational_divisorProbability_crossing a b c h d,582 Nat.add_comm (if d < h then 1 else 0)]583 rw [hp, Nat.add_comm b a, Nat.add_comm (b * h) (a * c), Nat.sub_right_comm d rx rt]584 by_cases hc1 : ((0 < rt ↔ d < c) ∧ (0 < rx ↔ d < h) ∧ rt + rx ≤ d)585 · have hc2 : ((0 < rx ↔ d < h) ∧ (0 < rt ↔ d < c) ∧ rx + rt ≤ d) := by586 obtain ⟨x, y, z⟩ := hc1; exact ⟨y, x, by omega⟩587 rw [ite_eq_left hc1, ite_eq_left hc2, mul_comm (if rx = 0 then _ else _)]588 · have hc2 : ¬ ((0 < rx ↔ d < h) ∧ (0 < rt ↔ d < c) ∧ rx + rt ≤ d) := by589 rintro ⟨y, x, z⟩; exact hc1 ⟨x, y, by omega⟩590 rw [ite_eq_right hc1, ite_eq_right hc2]591 592/-- The contact series `U_{a,b}` has constant term `1`. -/593theorem crossingQ_zero_zero (a b : ℕ) : crossingQ a b 0 0 = 1 := by simp [crossingQ]594 595/-- The contact series `U_{a,b}` vanishes on the axes away from `(0,0)`. -/596private theorem qPositive_crossingQ (a b : ℕ) : QPositive (crossingQ a b) := by597 intro c h h1 h2598 have : ¬ (0 < c ∧ 0 < h) := by omega599 simp [crossingQ, h2, this]600 601/-- The off-axis coefficients of `U_{a,b}` are `(q-1) F_{T(a,b;c,h)}`. -/602private theorem crossingQ_of_pos (a b c h : ℕ) (hc : 0 < c) (hh : 0 < h) :603 crossingQ a b c h = scalar (RatFunc.X - 1) * lawCoef (stateLaw (State.crossing a b c h)) := by604 have : ¬ (c = 0 ∧ h = 0) := by omega605 simp [crossingQ, this, hc, hh]606 607/-- The symmetry `U_{a,b}(c,h) = U_{b,a}(h,c)`. -/608theorem crossingQ_symm (a b c h : ℕ) (ha : 0 < a) (hb : 0 < b) :(H) = (7.4)609 crossingQ a b c h = crossingQ b a h c := by610 by_cases h1 : c = 0 ∧ h = 0611 · obtain ⟨rfl, rfl⟩ := h1612 simp [crossingQ]613 · by_cases h2 : 0 < c ∧ 0 < h614 · rw [crossingQ_of_pos a b c h h2.1 h2.2, crossingQ_of_pos b a h c h2.2 h2.1,615 lawCoef_stateLaw_crossing_comm a b c h ha hb h2.1 h2.2]616 · rw [qPositive_crossingQ a b c h (by omega) h1,617 qPositive_crossingQ b a h c (by omega) (by tauto)]618 619private theorem expSer_sum (s : Finset ℕ) (F : ℕ → Ser)620 (hF : ∀ m ∈ s, PowerSeries.constantCoeff (F m) = 0) :621 expSer (∑ m ∈ s, F m) = ∏ m ∈ s, expSer (F m) := by622 induction s using Finset.induction_on with623 | empty => simpa using expSer_zero624 | insert a s ha ih =>625 rw [Finset.sum_insert ha, Finset.prod_insert ha,626 expSer_add _ _ (hF a (Finset.mem_insert_self _ _)),627 ih (fun m hm ↦ hF m (Finset.mem_insert_of_mem hm))]628 rw [map_sum]629 exact Finset.sum_eq_zero (fun m hm ↦ hF m (Finset.mem_insert_of_mem hm))630 631/-- Through degree `N`, the plethystic power `P_{q+ε}(B)` is the Euler product632`Π_{m=1}^N ψ_m(B)^{C_m}`. -/633private theorem pPow_scongr_prod_formalPow_adamsSer (ε : ℤ) (B : Ser)634 (hB : PowerSeries.constantCoeff B = 1) (N : ℕ) :635 SCongr N (pPow (RatFunc.X + (ε : RatFunc ℚ)) B) (∏ m ∈ Finset.Icc 1 N,636 formalPow (availablePoints ε m).rational (adamsSer m B)) := by637 set L := logSer B with hLdef638 have hL : PowerSeries.constantCoeff L = 0 := (constantCoeff_logSer B hB)639 have hp : pPow (RatFunc.X + (ε : RatFunc ℚ)) B = expSer (countSum ε L) := by640 rw [pPow, pExp, pLog, plethSum_C_mul_moebiusSum]641 set S : Ser := ∑ m ∈ Finset.Icc 1 N,642 PowerSeries.C (scalar (availablePoints ε m).rational) * adamsSer m L with hS643 have hterm : ∀ m ∈ Finset.Icc 1 N, PowerSeries.constantCoeff644 (PowerSeries.C (scalar (availablePoints ε m).rational) * adamsSer m L) = 0 := by645 intro m hm646 have hm0 : m ≠ 0 := by have := (Finset.mem_Icc.1 hm).1; omega647 rw [map_mul, (constantCoeff_adamsSer m hm0 L), hL, map_zero, mul_zero]648 have hS0 : PowerSeries.constantCoeff S = 0 := by649 rw [hS, map_sum]; exact Finset.sum_eq_zero hterm650 have hc0 : PowerSeries.constantCoeff (countSum ε L) = 0 := by651 rw [← PowerSeries.coeff_zero_eq_constantCoeff_apply]; simp [countSum]652 have h1 : SCongr N (countSum ε L) S := by653 intro n hn654 rw [hS, map_sum]655 have hrw : ∀ m ∈ Finset.Icc 1 N, PowerSeries.coeff n656 (PowerSeries.C (scalar (availablePoints ε m).rational) * adamsSer m L) =657 if m ∣ n then (availablePoints ε m).rational • adamsCoef m (PowerSeries.coeff (n / m) L)658 else 0 := by659 intro m hm660 have hm0 : m ≠ 0 := by have := (Finset.mem_Icc.1 hm).1; omega661 rw [PowerSeries.coeff_C_mul, (coeff_adamsSer m hm0 L n), scalar_mul_eq_smul]662 split_ifs <;> simp663 rw [Finset.sum_congr rfl hrw, ← Finset.sum_filter]664 simp only [countSum, PowerSeries.coeff_mk]665 rcases Nat.eq_zero_or_pos n with rfl | hnpos666 · simp only [Nat.divisors_zero, Finset.sum_empty, Nat.zero_div]667 rw [← PowerSeries.coeff_zero_eq_constantCoeff_apply] at hL668 simp [hL]669 · apply Finset.sum_congr _ (fun _ _ ↦ rfl)670 ext m671 simp only [Nat.mem_divisors, Finset.mem_filter, Finset.mem_Icc]672 constructor673 · rintro ⟨hd, hn0⟩674 exact ⟨⟨Nat.pos_of_dvd_of_pos hd hnpos, (Nat.le_of_dvd hnpos hd).trans hn⟩, hd⟩675 · rintro ⟨_, hd⟩676 exact ⟨hd, by omega⟩677 have h2 := (SCongr.expSer hc0 hS0 h1)678 have h3 : expSer S = ∏ m ∈ Finset.Icc 1 N, formalPow (availablePoints ε m).rational679 (adamsSer m B) := by680 rw [hS, expSer_sum _ _ hterm]681 apply Finset.prod_congr rfl682 intro m hm683 have hm0 : m ≠ 0 := by have := (Finset.mem_Icc.1 hm).1; omega684 rw [formalPow, ← (adamsSer_logSer m hm0 B hB)]685 rw [hp, ← h3]; exact h2686 687/-- The `n`-th coefficient of the Euler transform `eulerSer ε a` is that of the finite Euler688product `Π_{m=1}^n ψ_m(B_a)^{C_m}`. -/689private theorem coeff_eulerSer_eq_coeff_prod (ε : ℤ) (a n : ℕ) :690 PowerSeries.coeff n (eulerSer ε a) = PowerSeries.coeff n691 (∏ m ∈ Finset.Icc 1 n, formalPow (availablePoints ε m).rational692 (adamsSer m (clusterSer a))) := by693 have hB : PowerSeries.constantCoeff (clusterSer a) = 1 := by694 rw [← PowerSeries.coeff_zero_eq_constantCoeff_apply]695 simp [clusterSer]696 exact pPow_scongr_prod_formalPow_adamsSer ε (clusterSer a) hB n n le_rfl697 698/-- The `n`-th coefficient of the Euler transform `eulerSer ε a` is the pattern sum699`patternSum ε a n n`. -/700theorem coeff_eulerSer (ε : ℤ) (a n : ℕ) :lem-7.2(G) = (7.9)701 PowerSeries.coeff n (eulerSer ε a) = patternSum ε a n n := by702 rw [coeff_eulerSer_eq_coeff_prod,703 prod_formalPow_adamsSer_clusterSer_scongr ε a n n le_rfl,704 coeff_euler_families_eq_patternSum]705 706private theorem crossing_factorization_term (a b c h d rt rx : ℕ) (ha : 0 < a) (hb : 0 < b)707 (hdc : d ≤ min c h) :708 (if (rt + rx ≤ d ∧ d ≤ min c h) then709 qpow (-(chooseTwo (rx + (d - rt - rx) + rt) : ℤ)) *710 (crossingQ (a + b) b rx (h - (rx + (d - rt - rx) + rt)) *711 (PowerSeries.coeff (d - rt - rx) (eulerSer (-1) (a + b)) *712 crossingQ a (a + b) (c - (rx + (d - rt - rx) + rt)) rt)) else 0)713 = scalar (RatFunc.X - 1) * (if ((0 < rt ↔ d < c) ∧ (0 < rx ↔ d < h) ∧ rt + rx ≤ d) then scalar714 (divisorProbability (State.crossing a b c h) d).rational *715 ((if rt = 0 then 1 else lawCoef (stateLaw (State.crossing (a + b) a rt (c - d)))) *716 (if rx = 0 then 1 else lawCoef (stateLaw (State.crossing (a + b) b rx (h - d)))) *717 patternSum (-1) (a + b) (a * c + b * h) (d - rt - rx)) else 0) := by718 by_cases hsum : rt + rx ≤ d719 swap720 · simp [hsum]721 rw [show rx + (d - rt - rx) + rt = d by omega]722 simp only [hsum, hdc, and_self, ite_true, and_true]723 rw [coeff_eulerSer,724 patternSum_eq_of_le (-1) (a + b) (d - rt - rx) (a * c + b * h) (d - rt - rx) le_rfl (by725 have : c ≤ a * c := Nat.le_mul_of_pos_left c ha726 have := min_le_left c h727 omega)]728 set P := patternSum (-1) (a + b) (a * c + b * h) (d - rt - rx)729 by_cases hT : (0 < rt ↔ d < c)730 swap731 · have : crossingQ a (a + b) (c - d) rt = 0 := by732 unfold crossingQ; rw [ite_eq_right (by omega), ite_eq_right (by omega)]733 simp [this, hT]734 by_cases hX : (0 < rx ↔ d < h)735 swap736 · have : crossingQ (a + b) b rx (h - d) = 0 := by737 unfold crossingQ; rw [ite_eq_right (by omega), ite_eq_right (by omega)]738 simp [this, hX]739 simp only [hT, hX, and_self, ite_true]740 set Bt := (if rt = 0 then 1 else lawCoef (stateLaw (State.crossing (a + b) a rt (c - d))))741 set Bx := (if rx = 0 then 1 else lawCoef (stateLaw (State.crossing (a + b) b rx (h - d))))742 set i := (if d < c then 1 else 0)743 set k := (if d < h then 1 else 0)744 have eT : crossingQ a (a + b) (c - d) rt = scalar ((RatFunc.X - 1) ^ i) * Bt := by745 by_cases h1 : d < c746 · have hrt : 0 < rt := hT.2 h1747 simp only [i, Bt, crossingQ, ite_eq_left h1, pow_one, ite_eq_right748 (show ¬ (c - d = 0 ∧ rt = 0) by omega),749 ite_eq_left (show 0 < c - d ∧ 0 < rt by omega), ite_eq_right (show ¬ rt = 0 by omega)]750 rw [lawCoef_stateLaw_crossing_comm a (a + b) (c - d) rt ha (by omega) (by omega) hrt]751 · have hrt : rt = 0 := by omega752 simp only [i, Bt, crossingQ, ite_eq_right h1, pow_zero, scalar_one, ite_eq_left hrt, mul_one,753 ite_eq_left (show c - d = 0 ∧ rt = 0 by omega)]754 have eX : crossingQ (a + b) b rx (h - d) = scalar ((RatFunc.X - 1) ^ k) * Bx := by755 by_cases h1 : d < h756 · have hrx : 0 < rx := hX.2 h1757 simp only [k, Bx, crossingQ, ite_eq_left h1, pow_one, ite_eq_right758 (show ¬ (rx = 0 ∧ h - d = 0) by omega),759 ite_eq_left (show 0 < rx ∧ 0 < h - d by omega), ite_eq_right (show ¬ rx = 0 by omega)]760 · have hrx : rx = 0 := by omega761 simp only [k, Bx, crossingQ, ite_eq_right h1, pow_zero, scalar_one, ite_eq_left hrx, mul_one,762 ite_eq_left (show rx = 0 ∧ h - d = 0 by omega)]763 rw [eT, eX, rational_divisorProbability_crossing a b c h d,764 show qpow (-(chooseTwo d : ℤ)) = scalar (((RatFunc.X : RatFunc ℚ) ^ chooseTwo d)⁻¹) by765 rw [qpow, zpow_neg, zpow_natCast]]766 calc scalar ((RatFunc.X ^ chooseTwo d)⁻¹) * (scalar ((RatFunc.X - 1) ^ k) * Bx *767 (P * (scalar ((RatFunc.X - 1) ^ i) * Bt)))768 = scalar ((RatFunc.X ^ chooseTwo d)⁻¹ * ((RatFunc.X - 1) ^ (i + k))) * (Bt * Bx * P) := by769 rw [pow_add, scalar_mul, scalar_mul]; ring770 _ = _ := by771 rw [← X_sub_one_mul_crossingWeight (i + k), ← mul_assoc (scalar (RatFunc.X - 1)),772 ← scalar_mul]773 simp only [mul_assoc]774 congr 2775 ring776 777/-- The `(c,h)` coefficient of `U_{a+b,b}⁺ · J(P_{a+b}) · U_{a,a+b}⁻` (`c > 0`) is `(q-1)` times778the regrouped exit sum of `T(a,b;c,h)`. -/779private theorem qmul_qplus_qdiag_qminus_crossingQ_apply (a b c h : ℕ) (ha : 0 < a) (hb : 0 < b)780 (hc : 0 < c) :781 qmul (qmul (qplus (crossingQ (a + b) b)) (qdiag (eulerSer (-1) (a + b))))782 (qminus (crossingQ a (a + b))) c h = scalar (RatFunc.X - 1) *783 (∑ d ∈ Finset.Icc 1 (min c h), ∑ rt ∈ Finset.range (d + 1), ∑ rx ∈ Finset.range (d + 1),784 (if ((0 < rt ↔ d < c) ∧ (0 < rx ↔ d < h) ∧ rt + rx ≤ d) then scalar785 (divisorProbability (State.crossing a b c h) d).rational *786 ((if rt = 0 then 1 else lawCoef (stateLaw (State.crossing (a + b) a rt (c - d)))) *787 (if rx = 0 then 1 else lawCoef (stateLaw (State.crossing (a + b) b rx (h - d)))) *788 patternSum (-1) (a + b) (a * c + b * h) (d - rt - rx)) else 0)) := by789 rw [qmul_qplus_qdiag_qminus_apply]790 set G : ℕ → ℕ → ℕ → Coef := fun rx m rt ↦791 qpow (-(chooseTwo (rx + m + rt) : ℤ)) *792 (crossingQ (a + b) b rx (h - (rx + m + rt)) *793 (PowerSeries.coeff m (eulerSer (-1) (a + b)) *794 crossingQ a (a + b) (c - (rx + m + rt)) rt)) with hG795 have step1 : ∀ rx m rt : ℕ, (if (rx + m + rt ≤ c ∧ rx + m + rt ≤ h) then qpow796 (-(chooseTwo rx : ℤ) - (chooseTwo m : ℤ) - (chooseTwo rt : ℤ) - (rx : ℤ) *797 (m : ℤ) - ((rx : ℤ) + (m : ℤ)) * (rt : ℤ)) * (crossingQ (a + b) b rx (h - (rx + m + rt)) *798 (PowerSeries.coeff m (eulerSer (-1) (a + b)) * crossingQ a (a + b) (c - (rx + m + rt)) rt))799 else 0)800 = if rx + m + rt ≤ min c h then G rx m rt else 0 := by801 intro rx m rt802 have e : (chooseTwo rx : ℤ) + chooseTwo m + chooseTwo rt + rx * m + rx * rt + m * rt =803 ((chooseTwo (rx + m + rt) : ℕ) : ℤ) := by804 rw [chooseTwo_add, chooseTwo_add]; push_cast; ring805 rw [hG]806 simp only [le_min_iff]807 split_ifs808 · congr 2809 rw [← e]; ring810 · rfl811 simp only [step1]812 rw [sum_triple_reindex c (min c h) (min_le_left _ _) G, Finset.mul_sum]813 symm814 have hsub : Finset.Icc 1 (min c h) ⊆ Finset.range (c + 1) := fun d hd ↦ by815 simp only [Finset.mem_Icc, Finset.mem_range] at hd ⊢; omega816 have hzero : ∀ d ∈ Finset.range (c + 1), d ∉ Finset.Icc 1 (min c h) →817 (∑ rt ∈ Finset.range (d + 1), ∑ rx ∈ Finset.range (d + 1), if rt + rx ≤ d ∧ d ≤818 min c h then G rx (d - rt - rx) rt else 0) = 0 := by819 intro d hd hnot820 simp only [Finset.mem_Icc, not_and_or, not_le] at hnot821 refine Finset.sum_eq_zero fun rt hrt ↦ Finset.sum_eq_zero fun rx hrx ↦ ?_822 rcases hnot with h0 | h1823 · obtain rfl : d = 0 := by omega824 simp only [Finset.mem_range] at hrt hrx825 obtain ⟨rfl, rfl⟩ : rt = 0 ∧ rx = 0 := by omega826 have hz : crossingQ a (a + b) c 0 = 0 := qPositive_crossingQ _ _ c 0 (Or.inr rfl) (by omega)827 simp [hG, hz]828 · exact ite_eq_right (by omega)829 rw [← Finset.sum_subset hsub hzero]830 refine Finset.sum_congr rfl fun d hd ↦ ?_831 simp only [Finset.mul_sum]832 exact Finset.sum_congr rfl fun rt _ ↦ Finset.sum_congr rfl fun rx _ ↦833 (crossing_factorization_term a b c h d rt rx ha hb (Finset.mem_Icc.1 hd).2).symm834 835/-- **Crossing factorization.** `U_{a,b} = U_{a+b,b}⁺ · J(P_{a+b}) · U_{a,a+b}⁻`, where `J` is the836diagonal substitution and `P_{a+b} = eulerSer (-1) (a+b)`. -/837theorem crossingQ_eq_qmul_qplus_qdiag_qminus (a b c h : ℕ) (ha : 0 < a) (hb : 0 < b) :(T) = (7.12)Lemma 8.2838 crossingQ a b c h = qmul (qmul (qplus (crossingQ (a + b) b)) (qdiag (eulerSer (-1) (a + b))))839 (qminus (crossingQ a (a + b))) c h := by840 have Q2 : QPositive (qmul (qplus (crossingQ (a + b) b)) (qdiag (eulerSer (-1) (a + b)))) :=841 (qPositive_crossingQ _ _).qplus.qmul (qPositive_qdiag _)842 by_cases h00 : c = 0 ∧ h = 0843 · obtain ⟨rfl, rfl⟩ := h00844 rw [qmul_zero_zero, qmul_zero_zero, crossingQ_zero_zero]845 simp [qplus, qminus, qdiag, chooseTwo, crossingQ_zero_zero, qpow_zero, coeff_zero_eulerSer]846 · by_cases hp : 0 < c ∧ 0 < h847 · rw [qmul_qplus_qdiag_qminus_crossingQ_apply a b c h ha hb hp.1,848 ← lawCoef_exitLaw_crossing a b c h ha hb hp.1 hp.2,849 ← (state_law_unfold (.crossing a b c h) ⟨ha, hb, hp.1, hp.2⟩ rfl).2 a b c h rfl,850 crossingQ_of_pos a b c h hp.1 hp.2]851 · have z : c = 0 ∨ h = 0 := by omega852 rw [Q2.qmul (qPositive_crossingQ _ _).qminus c h z h00, qPositive_crossingQ a b c h z h00]853 854/-- If `G_b ≡ S(B_bᵛ)` through degree `M` for all `b > 0`, then `U_{a,b}` is unitary,855`U_{a,b} U_{a,b}† ≡ 1`, through total contact degree `2M + 1`. -/856theorem qcongr_crossingQ_mul_qdagger (M : ℕ) (hS : ∀ a : ℕ, 0 < a →Lemma 8.3Theorem 9.3857 SCongr M (eulerSer 0 a) (dilate (recipSer (clusterSer a)))) (j : ℕ) (hj : j ≤ 2 * M + 1)858 (a b : ℕ) (ha : 0 < a) (hb : 0 < b) :859 QCongr j (qmul (crossingQ a b) (qdagger (crossingQ a b))) qone := by860 have refl : ∀ (k : ℕ) (U : QSer), QCongr k U U := fun k U c h _ ↦ rfl861 have posUU : ∀ x y : ℕ, QPositive (qmul (crossingQ x y) (qdagger (crossingQ x y))) :=862 fun x y ↦ (qPositive_crossingQ x y).qmul (qPositive_crossingQ x y).qdagger863 induction j generalizing a b with864 | zero =>865 intro c h hc866 obtain ⟨rfl, rfl⟩ : c = 0 ∧ h = 0 := by omega867 rw [qmul_zero_zero]868 simp [qdagger, qone, crossingQ_zero_zero, qpow_zero]869 | succ j ih =>870 have hj' : j ≤ 2 * M + 1 := by omega871 set s := a + b with hs872 have hs0 : 0 < s := by omega873 set A := crossingQ s b874 set D := qdiag (eulerSer (-1) s)875 set Cq := crossingQ a s876 have hfac : crossingQ a b = qmul (qmul (qplus A) D) (qminus Cq) := by877 funext c h; exact crossingQ_eq_qmul_qplus_qdiag_qminus a b c h ha hb878 have hdag : qdagger (crossingQ a b) =879 qmul (qminus (qdagger Cq)) (qmul (qdagger D) (qplus (qdagger A))) := by880 rw [hfac, qdagger_qmul, qdagger_qmul, qdagger_qplus, qdagger_qminus]881 rw [hdag, hfac]882 -- rearrange883 have e1 : qmul (qmul (qmul (qplus A) D) (qminus Cq))884 (qmul (qminus (qdagger Cq)) (qmul (qdagger D) (qplus (qdagger A)))) =885 qmul (qmul (qplus A) D) (qmul (qminus (qmul Cq (qdagger Cq)))886 (qmul (qdagger D) (qplus (qdagger A)))) := by887 rw [qminus_qmul, qmul_assoc, ← qmul_assoc (qminus Cq)]888 rw [e1]889 have hC : QCongr (j + 1) (qminus (qmul Cq (qdagger Cq))) qone :=890 qcongr_qminus_qone (j + 1) _ (posUU a s) (by simpa using ih hj' a s ha hs0)891 have hA : QCongr (j + 1) (qplus (qmul A (qdagger A))) qone :=892 qcongr_qplus_qone (j + 1) _ (posUU s b) (by simpa using ih hj' s b hs0 hb)893 have hD : QCongr (j + 1) (qmul D (qdagger D)) qone :=894 (qcongr_qdiag_mul_qdagger M s895 (dilate_recipSer_eulerSer_mul_scongr_one M s hs0 hS)).mono (by omega)896 refine ((refl _ _).qmul (hC.qmul (refl _ _))).trans ?_897 rw [qone_qmul, qmul_assoc, ← qmul_assoc D]898 refine ((refl _ _).qmul (hD.qmul (refl _ _))).trans ?_899 rw [qone_qmul, ← qplus_qmul]900 exact hA901 902/-- The degree-one coefficient of `G_a = eulerSer 0 a` is `q Z_{a,1}`. -/903theorem coeff_one_eulerSer_zero (a : ℕ) :904 PowerSeries.coeff 1 (eulerSer 0 a) = qpow 1 * AddMonoidAlgebra.single ({(a, 1)} : FactorType)905 1 := by906 rw [coeff_eulerSer]907 let m1 : Pattern 1 := fun _ ↦ 1908 have hf : (Finset.univ : Finset (Pattern 1)).filter (fun m ↦ patternWeight m = 1) = {m1} := by909 ext m910 have key : patternWeight m = (m (0,0)).val := by911 simp [patternWeight, Fintype.sum_prod_type]912 rw [Finset.mem_filter, Finset.mem_singleton, key]913 simp only [Finset.mem_univ, true_and]914 constructor915 · intro h916 funext ij917 have : ij = (0,0) := Subsingleton.elim _ _918 subst this919 apply Fin.ext920 simpa [m1] using h921 · intro h; subst h; rfl922 unfold patternSum923 rw [hf, Finset.sum_singleton]924 have hc : lawCoef (stateLaw (State.single a 1)) =925 AddMonoidAlgebra.single ({(a, 1)} : FactorType) 1 :=926 (coeff_succ_clusterSer a 0).symm.trans (coeff_one_clusterSer a)927 have hP : (∏ ij : Fin 1 × Fin 1,928 (adamsCoef (ij.1.val + 1) (lawCoef (stateLaw (State.single a (ij.2.val + 1))))) ^ (m1 ij).val)929 = AddMonoidAlgebra.single ({(a, 1)} : FactorType) 1 := by930 simp [m1, hc, adamsCoef_one]931 have hD : (divisorCount 0 m1).rational = RatFunc.X := by932 rw [rational_divisorCount]933 simp [m1, rational_availablePoints]934 rw [hP, hD, Algebra.smul_def, qpow_one, scalar_eq_algebraMap]935 936/-- Base case of cluster reciprocity: `G_a ≡ S(B_aᵛ)` through degree `1`. -/937theorem cluster_reciprocity_one (a : ℕ) :Proof of monic/cluster reciprocity938 SCongr 1 (eulerSer 0 a) (dilate (recipSer (clusterSer a))) := by939 intro m hm940 interval_cases m941 · rw [coeff_zero_eulerSer, coeff_zero_dilate_recipSer_clusterSer]942 · rw [coeff_one_eulerSer_zero a, coeff_one_dilate_recipSer_clusterSer]943 944/-- The `n`-th coefficient of `ρ(U_{a,a}) Φ(G_a)`, expanded by divisor degree `d` and crossing945depth `r` into crossing laws and pattern sums (plus `1` in degree `0`). -/946theorem coeff_qact_crossingQ_gaussPhi_eulerSer (a n : ℕ) (ha : 0 < a) :(S) = (7.11)947 PowerSeries.coeff n (qact (crossingQ a a) (gaussPhi (eulerSer 0 a))) =948 (∑ d ∈ Finset.Icc 1 n, ∑ r ∈ Finset.range (d + 1),949 (if ((0 < r ↔ d < n) ∧ r ≤ d) then scalar (divisorProbability (State.single a n)950 d).rational * ((if r = 0 then 1 else lawCoef (stateLaw (State.crossing a a r (n - d)))) *951 patternSum 0 a (a * n) (d - r)) else 0)) + (if n = 0 then 1 else 0) := by952 have hG : ∀ d r, d ≤ n → PowerSeries.coeff (d - r) (eulerSer 0 a) =953 patternSum 0 a (a * n) (d - r) := by954 intro d r hd955 rw [coeff_eulerSer]956 apply patternSum_eq_of_le957 · exact le_rfl958 · have := Nat.le_mul_of_pos_left n ha; omega959 rw [coeff_qact_gaussPhi, Finset.sum_range_succ']960 congr 1961 · have hI : Finset.Icc 1 n = Finset.Ico 1 (n + 1) := by962 ext x; simp only [Finset.mem_Icc, Finset.mem_Ico]; omega963 rw [hI, Finset.sum_Ico_eq_sum_range, Nat.add_sub_cancel]964 refine Finset.sum_congr rfl fun d hd ↦ ?_965 rw [Finset.mem_range] at hd966 rw [add_comm 1 d]967 refine Finset.sum_congr rfl fun r hr ↦ ?_968 rw [Finset.mem_range] at hr969 rw [hG _ _ (by omega), rational_divisorProbability_single a n (d+1)]970 simp only [crossingQ, qpow]971 have hX : (RatFunc.X : RatFunc ℚ) ^ (-((tri (d+1) : ℕ) : ℤ)) =972 ((RatFunc.X : RatFunc ℚ) ^ tri (d+1))⁻¹ := by973 rw [zpow_neg, zpow_natCast]974 rw [hX]975 rcases Nat.eq_zero_or_pos r with h0 | h0976 · subst h0977 by_cases hdn : d + 1 < n978 · have : ¬ (n - (d+1) = 0) := by omega979 simp [hdn, this]980 · have : n - (d+1) = 0 := by omega981 simp [hdn, this]982 · by_cases hdn : d + 1 < n983 · have : 0 < n - (d+1) := by omega984 have hr' : r ≤ d + 1 := by omega985 simp only [h0.ne', false_and, ite_false, h0, this, hdn, iff_self, hr', and_self, ite_true,986 pow_one, scalar_mul]987 ring988 · have : ¬ (0 < n - (d+1)) := by omega989 simp [h0.ne', hdn, this]990 · have ht : tri 0 = 0 := rfl991 simp only [zero_add, Finset.sum_range_one, Nat.sub_self, ht, Nat.cast_zero, neg_zero, qpow_zero,992 one_mul, coeff_zero_eulerSer, mul_one, crossingQ]993 by_cases hn : n = 0 <;> simp [hn]994 995/-- The self-pattern term of the recursion of `S(a;n)` (`n ≥ 2`) is996`q^{-tri n} · q · F_{S(a;n)}`. -/997theorem lawCoef_single_self_term (a n : ℕ) (ha : 0 < a) (hn : 2 ≤ n)(S) = (7.11)998 (P : TangentPattern (State.single a n).degree) (hP : Allowed (State.single a n) P)999 (hself : SelfPattern (State.single a n) P) :1000 lawCoef (lawScale (.mul (tangentCount (State.single a n) P)1001 (divisorProbability (State.single a n) P.d.val))1002 (lawProd ((children (State.single a n) P).map fun z ↦ lawDescend z.1 (stateLaw z.2)))) =1003 qpow (-(tri n : ℤ)) * (qpow 1 * lawCoef (stateLaw (State.single a n))) := by1004 rw [lawCoef_single_term a n ha (by omega) P hP]1005 obtain ⟨hd, hrt, -, hother⟩ := (selfPattern_single_iff a n ha hn P hP).1 hself1006 have hdeg : (State.single a n).degree = a * n := rfl1007 have hpos : 0 < (State.single a n).degree := by rw [hdeg]; exact Nat.mul_pos ha (by omega)1008 have hn1 : n - 1 < (State.single a n).degree := by1009 rw [hdeg]; have := Nat.le_mul_of_pos_left n ha; omega1010 have hprob : (divisorProbability (State.single a n) P.d.val).rational1011 = ((RatFunc.X : RatFunc ℚ) ^ tri n)⁻¹ := by1012 rw [hd, rational_divisorProbability_single a n n]; simp1013 have hf : ∀ b, (∏ j : Fin (State.single a n).degree,1014 ((Nat.factorial (P.other (b, j)).val : ℕ) : ℚ)) = 1 := fun b ↦1015 Finset.prod_eq_one fun j _ ↦ by rw [hother]; split_ifs <;> simp1016 have hcount : (divisorCount 0 P.other).rational = (RatFunc.X : RatFunc ℚ) := by1017 rw [rational_divisorCount, Finset.prod_eq_single (⟨0, hpos⟩ : Fin (State.single a n).degree)]1018 · rw [Finset.sum_eq_single (⟨n - 1, hn1⟩ : Fin (State.single a n).degree), hf]1019 · simp [hother, rational_availablePoints]1020 · intro b _ hb1021 simp [hother, show b.val ≠ n - 1 from fun h ↦ hb (Fin.ext h)]1022 · simp1023 · intro b _ hb1024 rw [Finset.sum_eq_zero fun j _ ↦ by1025 simp [hother, show b.val ≠ 0 from fun h ↦ hb (Fin.ext h)], hf]1026 simp1027 · simp1028 have hprod : (∏ ij : Fin (State.single a n).degree × Fin (State.single a n).degree,1029 (adamsCoef (ij.1.val + 1) (lawCoef (stateLaw (State.single a (ij.2.val + 1))))) ^1030 (P.other ij).val)1031 = lawCoef (stateLaw (State.single a n)) := by1032 rw [Finset.prod_eq_single ((⟨0, hpos⟩, ⟨n - 1, hn1⟩) : Fin (State.single a n).degree × Fin1033 (State.single a n).degree)]1034 · rw [hother]1035 simp only [and_self, ite_true, pow_one]1036 rw [show n - 1 + 1 = n by omega, adamsCoef_one]1037 · intro b _ hb1038 rw [hother, ite_eq_right, pow_zero]1039 rintro ⟨h1, h2⟩1040 exact hb (Prod.ext (Fin.ext h1) (Fin.ext h2))1041 · simp1042 rw [hprod, hprob, hcount, ite_eq_left hrt, one_mul, scalar_mul, ← qpow_one,1043 show qpow (-(tri n : ℤ)) = scalar (((RatFunc.X : RatFunc ℚ) ^ tri n)⁻¹) by1044 rw [qpow, zpow_neg, zpow_natCast]]1045 ring1046 1047end SurfaceBlowup