Lean / 0xOsprey/shub-smale-tau9 / TwoAdicBautinExtensions.lean
Lean readerResearch/PvsNP/Tau/TwoAdicBautinExtensions.lean
modulepublic import Research.PvsNP.Tau.TwoAdicMonicAnnihilators@[expose] public sectionnamespace Research.PvsNP.Tau/-!# Extensions to Constructive `U`-Conjugation & Generalized `θ < 1` Bautin Taylor DominationThis module extends `TwoAdicMonicAnnihilators.lean` with three machine-verified results:1. **Generalized `θ < 1` Bautin Taylor Domination (`bautin_taylor_domination_slope`):**We do **not** require `D₀ = 1` (`θ = 0`) to avoid `2`-adic subdisk splitting!Whenever `P_m = V^m(P)(0)` satisfies a valuation recurrence with ANY rational denominatorslope `θ = p / q < 1` (`0 ≤ p < q`):`q * vp m ≥ q * vp j₀ - p * (m - B)` for all `m > B`,the unrescaled unit-disk Taylor coefficient valuation `vc m := 2 * m - v2Fact m + vp m`satisfies strict domination `vc m > vc j₀` for every`m > B + Nat.log 2 (B + 1) * q / (q - p)`,giving `w₁(F) ≤ B + ⌊(q / (q - p)) · ⌊log₂(B + 1)⌋⌋` with **zero subdisk splitting**.2. **Depth-4 `w₃`-Elimination Identity (`depth4_w3_elimination`, `depth4_HF3_linear_comb`):**Lifting the Depth-3 order-6 operator `L₃` to Depth 4 by shifting every factor by `α₃ * w₃`(`L₃⁽⁴⁾ := U₃ ∘ L₃ ∘ U₃⁻¹`) eliminates the top variable `w₃` from **all four** Depth-4generators `{1, w₁, F₂, F₃}` simultaneously:`L₃⁽⁴⁾(g) = w₃ * (L₃^{+α₃})(g)` for `g ∈ {1, w₁, F₂}`,`L₃⁽⁴⁾(α₃ * w₃) = w₃ * (L₃^{+α₃})(α₃) = w₃ * (p₃ * H₁ + q₃ * H_{F₂})`.3. **Exact Closed-Form Order-3 `D₀ = 1` Universal Identity for `1 + w₂ ^ D`(`depth3_one_add_w2_pow_order3`):**For every `D : ℕ`, `1 + w₂ ^ D` is annihilated identically in `R` by the explicit order-3monic (`D₀ = 1`) operator`[-d₁ * (1 - 2 * w₁) - α₂ * (D - (D + 1) * w₂), -α₂ * (D - (D + 1) * w₂), 0]`.-//-! ## 1. Generalized `θ = p / q < 1` Bautin Taylor Domination (Zero Subdisk Splitting) -//-- **Generalized `θ < 1` Bautin Taylor Domination Theorem (Zero Subdisk Splitting):**Suppose `F(s) = ∑_{m ≥ 0} (4^m / m!) P_m s^m` has derivative valuations `vp : ℕ → ℤ`satisfying a linear valuation recurrence with rational slope `θ = p / q < 1` (`p < q`, `0 < q`):`∀ m > B, (q : ℤ) * vp m ≥ (q : ℤ) * vp j₀ - (p : ℤ) * ((m - B : ℕ) : ℤ)`where `j₀ ≤ B`. Then the unit-disk Taylor coefficient valuation`vc m := 2 * (m : ℤ) - (v2Fact m : ℤ) + vp m`satisfies strict domination `vc m > vc j₀` for every`m > B + (q * Nat.log 2 (B + 1)) / (q - p)`,bounding the unit-disk Weierstrass degree `w₁(F) ≤ B + (q * Nat.log 2 (B + 1)) / (q - p)`with **zero** subdisk splitting! -/theorem bautin_taylor_domination_slope (p q B : ℕ) (hpq : p < q) (vp : ℕ → ℤ)(j₀ : ℕ) (hj₀ : j₀ ≤ B)(hrec : ∀ m : ℕ, B < m →(q : ℤ) * vp m ≥ (q : ℤ) * vp j₀ - (p : ℤ) * ((m - B : ℕ) : ℤ))(m : ℕ) (hm : B + (q * Nat.log 2 (B + 1)) / (q - p) < m) :2 * (m : ℤ) - (v2Fact m : ℤ) + vp m >2 * (j₀ : ℤ) - (v2Fact j₀ : ℤ) + vp j₀ := byhave hq_pos : 0 < q := by omegahave hqp_pos : 0 < q - p := by omegahave hBm : B < m := lt_of_le_of_lt (Nat.le_add_right _ _) hmhave hrm := hrec m hBmhave hleg_m : (v2Fact m : ℤ) + (popcount2 m : ℤ) = (m : ℤ) := byexact_mod_cast legendre_v2Fact mhave hleg_j : (v2Fact j₀ : ℤ) + (popcount2 j₀ : ℤ) = (j₀ : ℤ) := byexact_mod_cast legendre_v2Fact j₀have hpop_m : (1 : ℤ) ≤ (popcount2 m : ℤ) := byexact_mod_cast popcount2_pos (by omega : 0 < m)have hpop_j : (popcount2 j₀ : ℤ) ≤ (Nat.log 2 (B + 1) : ℤ) := byhave h1 : popcount2 j₀ ≤ Nat.log 2 (j₀ + 1) := popcount2_le_log_succ j₀have h2 : Nat.log 2 (j₀ + 1) ≤ Nat.log 2 (B + 1) := Nat.log_mono_right (by omega)exact_mod_cast le_trans h1 h2-- From hm: (q * log) / (q - p) < m - B, hence q * log < (q - p) * (m - B) + (q - p),-- actually (q * log) / (q - p) + 1 ≤ m - B => q * log < (q - p) * (m - B)!have hdiv_lt : q * Nat.log 2 (B + 1) < (q - p) * (m - B) := byhave h1 : (q * Nat.log 2 (B + 1)) / (q - p) + 1 ≤ m - B := by omegahave h2 : q * Nat.log 2 (B + 1) < (q - p) * ((q * Nat.log 2 (B + 1)) / (q - p) + 1) := byhave hmod := Nat.mod_lt (q * Nat.log 2 (B + 1)) hqp_poshave hdm := Nat.div_add_mod (q * Nat.log 2 (B + 1)) (q - p)rw [mul_add, mul_one]; omegaexact lt_of_lt_of_le h2 (Nat.mul_le_mul_left (q - p) h1)have hdiv_lt_Z : (q : ℤ) * (Nat.log 2 (B + 1) : ℤ) <((q : ℤ) - (p : ℤ)) * ((m : ℤ) - (B : ℤ)) := byhave hqp_cast : ((q - p : ℕ) : ℤ) = (q : ℤ) - (p : ℤ) := byexact_mod_cast Nat.cast_sub (le_of_lt hpq)have hmB_cast : ((m - B : ℕ) : ℤ) = (m : ℤ) - (B : ℤ) := byexact_mod_cast Nat.cast_sub (le_of_lt hBm)have hcast : ((q * Nat.log 2 (B + 1) : ℕ) : ℤ) < (((q - p) * (m - B) : ℕ) : ℤ) := byexact_mod_cast hdiv_ltpush_cast at hcastrw [hqp_cast, hmB_cast] at hcastexact hcasthave hmB_cast : ((m - B : ℕ) : ℤ) = (m : ℤ) - (B : ℤ) := byexact_mod_cast Nat.cast_sub (le_of_lt hBm)rw [hmB_cast] at hrmhave hBj0 : (j₀ : ℤ) ≤ (B : ℤ) := by exact_mod_cast hj₀have hq_pos_Z : (0 : ℤ) < (q : ℤ) := by exact_mod_cast hq_pos-- Multiply desired inequality by q > 0:-- q*(2m - v2Fact m + vp m) - q*(2j0 - v2Fact j0 + vp j0)-- = q*(m + popcount2 m - j0 - popcount2 j0) + q*(vp m - vp j0)-- ≥ q*(m - B) + q*(B - j0) + q*(1 - log) - p*(m - B)-- = (q - p)*(m - B) - q*log + q*(B - j0) + q > 0!have hq_gt : (q : ℤ) * (2 * (m : ℤ) - (v2Fact m : ℤ) + vp m) >(q : ℤ) * (2 * (j₀ : ℤ) - (v2Fact j₀ : ℤ) + vp j₀) := bynlinarithnlinarith/-! ## 2. Depth-4 `w₃`-Elimination Identity & `H_{F₃} = p₃ H₁ + q₃ H_{F₂}` -/section DiffRingExtensionsvariable {R : Type*} [CommRing R] [DiffRing R]/-- **Depth-4 `w₃`-Elimination Theorem:**Let `L₃` be the Depth-3 order-6 monic operator and let `L₃⁽⁴⁾ := L₃.map (· + α₃ * w₃)` be its`U₃`-conjugate (`U₃ = 1 - w₃`). Then `L₃⁽⁴⁾` eliminates the top variable `w₃` from **all four**Depth-4 generators `{1, w₁, F₂, F₃}` simultaneously:`L₃⁽⁴⁾(g) = w₃ * (L₃.map (· + α₃))(g)` for `g ∈ {1, w₁, F₂}`, and`L₃⁽⁴⁾(α₃ * w₃) = w₃ * (L₃.map (· + α₃))(α₃)`.In particular, `L₃⁽⁴⁾(g)` is strictly linear in `w₃` (zero `w₃^2` or higher terms!), and itscofactor `(L₃.map (· + α₃))(α₃)` is a constant linear combination `p₃ * H₁ + q₃ * H_{F₂}`. -/theorem depth4_w3_elimination (w₁ w₂ w₃ d₁ p₂ q₂ p₃ q₃ : R)(hd₁ : der d₁ = 0) (hp₂ : der p₂ = 0) (hq₂ : der q₂ = 0) (hp₃ : der p₃ = 0) (hq₃ : der q₃ = 0)(hw₁ : der w₁ = d₁ * (w₁ * (1 - w₁)))(hw₂ : der w₂ = (p₂ + q₂ * w₁) * (w₂ * (1 - w₂)))(hw₃ : der w₃ = (p₃ + q₃ * ((p₂ + q₂ * w₁) * w₂)) * (w₃ * (1 - w₃))) :let α₂ := p₂ + q₂ * w₁let α₃ := p₃ + q₃ * (α₂ * w₂)let A₃ := d₁ * w₁ + α₂ * w₂let B₃ := 3 * d₁ * w₁ + α₂ * w₂let L₃ := [B₃ - α₂ - 3 * d₁, B₃ - α₂ - 2 * d₁, B₃ - α₂ - d₁, B₃ - α₂, A₃, A₃ - d₁]let L₃_4 := L₃.map (fun φ => φ + α₃ * w₃)let L₃_a3 := L₃.map (fun φ => φ + α₃)(∀ r t s : R, der r = 0 → der t = 0 → der s = 0 →applyOps L₃_4 (r + t * w₁ + s * (α₂ * w₂)) =w₃ * applyOps L₃_a3 (r + t * w₁ + s * (α₂ * w₂))) ∧applyOps L₃_4 (α₃ * w₃) =w₃ * (p₃ * applyOps L₃_a3 1 + q₃ * applyOps L₃_a3 (α₂ * w₂)) := byintro α₂ α₃ A₃ B₃ L₃ L₃_4 L₃_a3have h1mw3 : der (1 - w₃) = -(α₃ * w₃) * (1 - w₃) := byrw [der_sub, der_one, hw₃]; dsimp only [α₃]; ringhave hw3_fac : der w₃ = -(α₃ * w₃ - α₃) * w₃ := byrw [hw₃]; dsimp only [α₃]; ringhave hmap_eq : L₃_4 = L₃_a3.map (fun φ => φ + (α₃ * w₃ - α₃)) := bydsimp only [L₃_4, L₃_a3]rw [List.map_map]refine List.map_congr_left fun φ _ => ?_simp only [Function.comp_apply]; ringhave hpull_w3 : ∀ g : R, applyOps L₃_4 (w₃ * g) = w₃ * applyOps L₃_a3 g := byintro grw [hmap_eq]exact applyOps_map_add_mul L₃_a3 (α₃ * w₃ - α₃) w₃ g hw3_facconstructor· intro r t s hr ht hsset g := r + t * w₁ + s * (α₂ * w₂)have hsplit : g = (1 - w₃) * g + w₃ * g := by ringhave hkill_1mw : applyOps L₃_4 ((1 - w₃) * g) = 0 := bydsimp only [L₃_4]rw [applyOps_map_add_mul L₃ (α₃ * w₃) (1 - w₃) g h1mw3]have h0 := depth3_universal_order6_annihilator w₁ w₂ d₁ p₂ q₂ hd₁ hp₂ hq₂ hw₁ hw₂r t s hr ht hsrw [show applyOps L₃ g = 0 from h0, mul_zero]conv_lhs => rw [hsplit]rw [applyOps_add, hkill_1mw, zero_add, hpull_w3 g]· rw [mul_comm α₃ w₃, hpull_w3 α₃]congr 1dsimp only [α₃]rw [applyOps_add]congr 1· conv_lhs => rw [show p₃ = p₃ * 1 from (mul_one p₃).symm]exact applyOps_const_mul _ p₃ 1 hp₃· exact applyOps_const_mul _ q₃ (α₂ * w₂) hq₃/-! ## 3. Exact Closed-Form Order-3 `D₀ = 1` Universal Identity for `1 + w₂ ^ D` -//-- **Exact Closed-Form Order-3 `D₀ = 1` Identity for `1 + w₂ ^ D` (all `D : ℕ`):**For every `D : ℕ`, `V w₁ = d₁ w₁ (1 - w₁)`, `α₂ = p₂ + q₂ w₁`, `V w₂ = α₂ w₂ (1 - w₂)`,the explicit order-3 monic (`D₀ = 1`) operator`[-d₁ * (1 - 2 * w₁) - α₂ * (D - (D + 1) * w₂), -α₂ * (D - (D + 1) * w₂), 0]`annihilates `1 + w₂ ^ D` identically in `R`! -/theorem depth3_one_add_w2_pow_order3 (w₁ w₂ d₁ p₂ q₂ : R) (D : ℕ)(hd₁ : der d₁ = 0) (hp₂ : der p₂ = 0) (hq₂ : der q₂ = 0)(hw₁ : der w₁ = d₁ * (w₁ * (1 - w₁)))(hw₂ : der w₂ = (p₂ + q₂ * w₁) * (w₂ * (1 - w₂))) :let α₂ := p₂ + q₂ * w₁let φ := -(α₂ * ((D : R) - ((D : R) + 1) * w₂))let ψ := -(d₁ * (1 - 2 * w₁)) + φapplyOps [ψ, φ, 0] (1 + w₂ ^ D) = 0 := byintro α₂ φ ψsimp only [applyOps_cons, applyOps_nil, shiftOp, zero_mul, add_zero]cases D with| zero =>simp only [pow_zero, der_add, der_one, der_zero, add_zero, mul_zero]| succ n =>-- Let h = (n + 1) * w₂ ^ (n + 1) * (1 - w₂).-- Step 1: der (1 + w₂ ^ (n + 1)) = α₂ * h.have hstep1 : der (1 + w₂ ^ (n + 1)) =α₂ * (((n + 1 : ℕ) : R) * w₂ ^ (n + 1) * (1 - w₂)) := byrw [der_add, der_one, zero_add, der_pow, Nat.add_sub_cancel, hw₂]dsimp only [α₂]rw [pow_succ]ring-- Step 2: der h = (-φ) * h!have hder_h : der (((n + 1 : ℕ) : R) * w₂ ^ (n + 1) * (1 - w₂)) =-φ * (((n + 1 : ℕ) : R) * w₂ ^ (n + 1) * (1 - w₂)) := byrw [der_mul, der_mul, der_natCast, zero_mul, zero_add, der_pow, Nat.add_sub_cancel,der_sub, der_one, hw₂]dsimp only [φ, α₂]push_castrw [pow_succ]ring-- Step 3: (der + φ) (α₂ * h) = (der α₂) * h!have hstep2 : der (der (1 + w₂ ^ (n + 1))) + φ * der (1 + w₂ ^ (n + 1)) =der α₂ * (((n + 1 : ℕ) : R) * w₂ ^ (n + 1) * (1 - w₂)) := byrw [hstep1, der_mul, hder_h]ring-- Step 4: der (der α₂) = d₁ * (1 - 2 * w₁) * der α₂!have hder2_a2 : der (der α₂) = d₁ * (1 - 2 * w₁) * der α₂ := byhave h1 : der α₂ = q₂ * (d₁ * (w₁ * (1 - w₁))) := bydsimp only [α₂]rw [der_add, hp₂, zero_add, der_mul, hq₂, zero_mul, zero_add, hw₁]rw [h1, der_mul, hq₂, zero_mul, zero_add, der_mul, hd₁, zero_mul, zero_add,der_mul, der_sub, der_one, hw₁]ringrw [hstep2, der_mul, hder2_a2, hder_h]dsimp only [ψ]ringend DiffRingExtensionsend Research.PvsNP.Tau