cfahlgren1/math / lean /OAI /Algebra /FormulaHitting /WordIndependence.lean
cfahlgren1's picture
download
raw
13.3 kB
import OAI.Algebra.FormulaHitting.Series
import OAI.Algebra.FormulaHitting.Independence
import Mathlib.Data.Finsupp.Basic
import Mathlib.Algebra.BigOperators.Finsupp.Basic
import Mathlib.LinearAlgebra.Finsupp.LinearCombination
namespace OAI
noncomputable section
open Polynomial PowerSeries
namespace NCHitting
variable {F : Type*} [Field F] [CharZero F] {n : ℕ}
abbrev PolyWords (F : Type*) [Field F] (n : ℕ) := List (Fin n) →₀ F[X]
def polynomialEncode : PolyWords F n →+ PowerSeries F :=
Finsupp.liftAddHom fun w =>
{ toFun := fun p => (p : PowerSeries F) * wordSeries w
map_zero' := by simp
map_add' := by intro p q; simp [add_mul] }
omit [CharZero F] in
@[simp] theorem polynomialEncode_single (w : List (Fin n)) (p : F[X]) :
polynomialEncode (Finsupp.single w p) = (p : PowerSeries F) * wordSeries w := by
simp [polynomialEncode]
def stripLetter (i : Fin n) : PolyWords F n →+ PolyWords F n :=
Finsupp.comapDomain.addMonoidHom (List.cons_injective (a := i))
omit [CharZero F] in
@[simp] theorem stripLetter_apply (i : Fin n) (c : PolyWords F n) (w : List (Fin n)) :
stripLetter i c w = c (i :: w) := rfl
omit [CharZero F] in
@[simp] theorem stripLetter_single_nil (i : Fin n) (p : F[X]) :
stripLetter i (Finsupp.single [] p) = 0 := by
ext w
simp [stripLetter_apply]
omit [CharZero F] in
@[simp] theorem stripLetter_single_cons (i j : Fin n) (w : List (Fin n)) (p : F[X]) :
stripLetter i (Finsupp.single (j :: w) p) =
if i = j then Finsupp.single w p else 0 := by
classical
by_cases h : i = j
· subst j
ext v
simp [stripLetter_apply, Finsupp.single_apply]
· ext v
simp [stripLetter_apply, h]
def polynomialDifferential (q p0 : F[X]) : F[X] →+ F[X] where
toFun p := q * (p0 * p.derivative - p0.derivative * p)
map_zero' := by simp
map_add' p r := by simp [Polynomial.derivative_add]; ring
def polynomialMul (q : F[X]) : F[X] →+ F[X] where
toFun p := q * p
map_zero' := mul_zero q
map_add' := mul_add q
def polynomialTransform (q p0 : F[X]) (Q : Fin n → F[X]) : PolyWords F n →+ PolyWords F n :=
Finsupp.mapRange.addMonoidHom (polynomialDifferential q p0) +
∑ i, (Finsupp.mapRange.addMonoidHom (polynomialMul (p0 * Q i))).comp (stripLetter i)
omit [CharZero F] in
@[simp] theorem polynomialTransform_apply (q p0 : F[X]) (Q : Fin n → F[X])
(c : PolyWords F n) (w : List (Fin n)) :
polynomialTransform q p0 Q c w =
q * (p0 * (c w).derivative - p0.derivative * c w) +
∑ i, (p0 * Q i) * c (i :: w) := by
classical
simp [polynomialTransform, polynomialDifferential, polynomialMul]
omit [CharZero F] in
@[simp] theorem polynomialTransform_single_nil (q p0 : F[X]) (Q : Fin n → F[X])
(p : F[X]) :
polynomialTransform q p0 Q (Finsupp.single [] p) =
Finsupp.single [] (q * (p0 * p.derivative - p0.derivative * p)) := by
classical
simp [polynomialTransform, polynomialDifferential, polynomialMul]
omit [CharZero F] in
@[simp] theorem polynomialTransform_single_cons (q p0 : F[X]) (Q : Fin n → F[X])
(i : Fin n) (w : List (Fin n)) (p : F[X]) :
polynomialTransform q p0 Q (Finsupp.single (i :: w) p) =
Finsupp.single (i :: w) (q * (p0 * p.derivative - p0.derivative * p)) +
Finsupp.single w ((p0 * Q i) * p) := by
classical
simp [polynomialTransform, polynomialDifferential, polynomialMul, apply_ite]
omit [CharZero F] in
theorem polynomialEncode_transform (q p0 : F[X]) (Q : Fin n → F[X])
(hq : ∀ (i : Fin n) (w : List (Fin n)),
(q : PowerSeries F) * PowerSeries.derivative (R := F) (wordSeries (i :: w)) =
(Q i : PowerSeries F) * wordSeries w)
(c : PolyWords F n) :
polynomialEncode (polynomialTransform q p0 Q c) =
(q : PowerSeries F) * ((p0 : PowerSeries F) *
PowerSeries.derivative (R := F) (polynomialEncode c) -
(p0.derivative : PowerSeries F) * polynomialEncode c) := by
classical
induction c using Finsupp.induction_linear with
| zero => simp
| add c d hc hd =>
simp only [map_add, hc, hd]
ring
| single w p =>
cases w with
| nil => simp [PowerSeries.derivative_coe]
| cons i w =>
rw [polynomialTransform_single_cons, map_add, polynomialEncode_single,
polynomialEncode_single, polynomialEncode_single]
simp only [Polynomial.coe_mul, Polynomial.coe_sub]
symm
calc
_ = ((q : PowerSeries F) * ((p0 : PowerSeries F) *
(p.derivative : PowerSeries F) - (p0.derivative : PowerSeries F) *
(p : PowerSeries F))) *
wordSeries (i :: w) +
((p0 : PowerSeries F) * (p : PowerSeries F)) *
((q : PowerSeries F) * PowerSeries.derivative (R := F) (wordSeries (i :: w))) := by
rw [Derivation.leibniz, PowerSeries.derivative_coe]
simp only [smul_eq_mul]
ring
_ = _ := by rw [hq]; ring
def naturalPoles (i : Fin n) : F := -((i.val + 1 : ℕ) : F)
theorem naturalPoles_injective : Function.Injective (naturalPoles (F := F) (n := n)) := by
intro i j h
apply Fin.ext
have he : ((i.val + 1 : ℕ) : F) = ((j.val + 1 : ℕ) : F) := neg_injective h
have hn := Nat.cast_injective he
omega
omit [CharZero F] in
theorem natural_poleProduct_ne_zero : poleProduct (naturalPoles (F := F) (n := n)) ≠ 0 := by
apply Finset.prod_ne_zero_iff.mpr
intro i hi
exact Polynomial.X_sub_C_ne_zero _
theorem natural_poleProduct_mul_kernel (i : Fin n) :
(poleProduct (naturalPoles (F := F) (n := n)) : PowerSeries F) * kernel (i.val + 1) =
(puncturedPoleProduct (naturalPoles (F := F)) i : PowerSeries F) := by
rw [poleProduct_eq _ i]
simp only [Polynomial.coe_mul, Polynomial.coe_add,
Polynomial.coe_X, Polynomial.coe_C,
naturalPoles, map_neg, sub_neg_eq_add]
calc
_ = (puncturedPoleProduct (naturalPoles (F := F)) i : PowerSeries F) *
(kernel (i.val + 1) * (PowerSeries.X + PowerSeries.C (((i.val + 1 : ℕ) : F)))) := by ring
_ = _ := by rw [kernel_mul_linear _ (Nat.succ_ne_zero _)]; simp
theorem natural_poleProduct_derivative (i : Fin n) (w : List (Fin n)) :
(poleProduct (naturalPoles (F := F) (n := n)) : PowerSeries F) *
PowerSeries.derivative (R := F) (wordSeries (i :: w)) =
(puncturedPoleProduct (naturalPoles (F := F)) i : PowerSeries F) * wordSeries w := by
rw [derivative_wordSeries_cons]
rw [mul_left_comm, natural_poleProduct_mul_kernel, mul_comm]
def LengthBound (D : ℕ) (c : PolyWords F n) : Prop :=
∀ w, c w ≠ 0 → w.length ≤ D
def topSupport (D : ℕ) (c : PolyWords F n) : Finset (List (Fin n)) :=
c.support.filter fun w => w.length = D
omit [CharZero F] in
@[simp] theorem mem_topSupport (D : ℕ) (c : PolyWords F n) (w : List (Fin n)) :
w ∈ topSupport D c ↔ c w ≠ 0 ∧ w.length = D := by
simp [topSupport]
omit [CharZero F] in
theorem transform_lengthBound (D : ℕ) (c : PolyWords F n) (hc : LengthBound D c)
(q p0 : F[X]) (Q : Fin n → F[X]) : LengthBound D (polynomialTransform q p0 Q c) := by
intro w hw
by_contra hlen
have hcw : c w = 0 := by
by_contra hne
exact hlen (hc w hne)
have hchild : ∀ i, c (i :: w) = 0 := by
intro i
by_contra hne
have hb := hc (i :: w) hne
simp only [List.length_cons] at hb
omega
apply hw
simp [hcw, hchild]
omit [CharZero F] in
theorem transform_top_coefficient (D : ℕ) (c : PolyWords F n) (hc : LengthBound D c)
(q p0 : F[X]) (Q : Fin n → F[X]) (w : List (Fin n)) (hw : w.length = D) :
polynomialTransform q p0 Q c w = q * (p0 * (c w).derivative - p0.derivative * c w) := by
have hchild : ∀ i, c (i :: w) = 0 := by
intro i
by_contra hne
have hb := hc (i :: w) hne
simp only [List.length_cons, hw] at hb
omega
simp [hchild]
omit [CharZero F] in
private theorem topSupport_transform_ssubset (D : ℕ) (c : PolyWords F n)
(hc : LengthBound D c) (q : F[X]) (Q : Fin n → F[X])
(w0 : List (Fin n)) (hw0 : w0 ∈ topSupport D c) :
topSupport D (polynomialTransform q (c w0) Q c) ⊂ topSupport D c := by
have hsub : topSupport D (polynomialTransform q (c w0) Q c) ⊆ topSupport D c := by
intro w hw
obtain ⟨hne, hlen⟩ := (mem_topSupport _ _ _).mp hw
apply (mem_topSupport _ _ _).mpr
refine ⟨?_, hlen⟩
intro hz
apply hne
rw [transform_top_coefficient D c hc q (c w0) Q w hlen, hz]
simp
apply Finset.ssubset_iff_subset_ne.mpr
refine ⟨hsub, ?_⟩
intro heq
have hm : w0 ∈ topSupport D (polynomialTransform q (c w0) Q c) := by rwa [heq]
have hz : polynomialTransform q (c w0) Q c w0 = 0 := by
rw [transform_top_coefficient D c hc q (c w0) Q w0
((mem_topSupport _ _ _).mp hw0).2]
ring
exact ((mem_topSupport _ _ _).mp hm).1 hz
theorem polynomialEncode_eq_zero (D : ℕ) (c : PolyWords F n)
(hc : LengthBound D c) (he : polynomialEncode c = 0) : c = 0 := by
classical
induction D generalizing c with
| zero =>
have hs : c = Finsupp.single [] (c []) := by
ext w
cases w with
| nil => simp
| cons i w =>
have hz : c (i :: w) = 0 := by
by_contra hne
have hh := hc (i :: w) hne
simp [List.length_cons] at hh
simp [hz]
have hz : c [] = 0 := by
have hh := he
rw [hs, polynomialEncode_single, wordSeries_nil, mul_one] at hh
exact Polynomial.coe_eq_zero_iff.mp hh
rw [hs, hz, Finsupp.single_zero]
| succ D ih =>
by_contra hcne
have top_exists : ∀ b : PolyWords F n, LengthBound (D+1) b →
polynomialEncode b = 0 → b ≠ 0 → (topSupport (D+1) b).Nonempty := by
intro b hb hbe hbne
by_contra hn
apply hbne
apply ih b ?_ hbe
intro w hw
have hbnd := hb w hw
have hneq : w.length ≠ D+1 := by
intro hlen
exact hn ⟨w, (mem_topSupport _ _ _).mpr ⟨hw, hlen⟩⟩
omega
let P : ℕ → Prop := fun k => ∃ b : PolyWords F n,
LengthBound (D+1) b ∧ polynomialEncode b = 0 ∧ b ≠ 0 ∧
(topSupport (D+1) b).card = k
have hex : ∃ k, P k := ⟨(topSupport (D+1) c).card, c, hc, he, hcne, rfl⟩
obtain ⟨b, hb, hbe, hbne, hbcard⟩ := Nat.find_spec hex
obtain ⟨w0, hw0⟩ := top_exists b hb hbe hbne
have hp0 : b w0 ≠ 0 := ((mem_topSupport _ _ _).mp hw0).1
have hwlen : w0.length = D+1 := ((mem_topSupport _ _ _).mp hw0).2
let q := poleProduct (naturalPoles (F := F) (n := n))
let Q := puncturedPoleProduct (naturalPoles (F := F) (n := n))
let p0 := b w0
let b' := polynomialTransform q p0 Q b
have hb' : LengthBound (D+1) b' := transform_lengthBound _ b hb q p0 Q
have hb'e : polynomialEncode b' = 0 := by
rw [polynomialEncode_transform q p0 Q natural_poleProduct_derivative, hbe]
simp
have hcard : (topSupport (D+1) b').card < (topSupport (D+1) b).card :=
Finset.card_lt_card (topSupport_transform_ssubset (D+1) b hb q Q w0 hw0)
have hb'zero : b' = 0 := by
by_contra hne
have hmin : Nat.find hex ≤ (topSupport (D+1) b').card :=
Nat.find_min' hex ⟨b', hb', hb'e, hne, rfl⟩
omega
have htop : ∀ w, w.length = D+1 →
Polynomial.wronskian p0 (b w) = 0 := by
intro w hw
have hh : polynomialTransform q p0 Q b w = 0 := by
exact DFunLike.congr_fun hb'zero w
rw [transform_top_coefficient (D+1) b hb q p0 Q w hw] at hh
have hq : q ≠ 0 := natural_poleProduct_ne_zero
exact (mul_eq_zero.mp hh).resolve_left hq
cases w0 with
| nil => simp at hwlen
| cons i v =>
have hvl : v.length = D := by simpa using hwlen
have hprop : ∀ j : Fin n, ∃ a : F, b (j :: v) = a • p0 := by
intro j
apply eq_smul_of_wronskian_eq_zero p0 (b (j :: v)) hp0
apply htop
simp [hvl]
choose a ha using hprop
have hraw : q * (p0 * (b v).derivative - p0.derivative * b v) +
∑ j, (p0 * Q j) * b (j :: v) = 0 := by
rw [← polynomialTransform_apply]
exact DFunLike.congr_fun hb'zero v
have hsum : (∑ j, (p0 * Q j) * b (j :: v)) =
p0^2 * (∑ j, Polynomial.C (a j) * Q j) := by
rw [Finset.mul_sum]
apply Finset.sum_congr rfl
intro j hj
rw [ha j, Polynomial.smul_eq_C_mul]
ring
rw [hsum] at hraw
have ha0 := no_polynomial_log_primitive (naturalPoles (F := F) (n := n))
naturalPoles_injective p0 (b v) hp0 a hraw i
apply hp0
rw [ha i, ha0, zero_smul]
omit [CharZero F] in
private theorem linearCombination_eq_polynomialEncode (c : PolyWords F n) :
Finsupp.linearCombination F[X] (wordSeries (F := F) (n := n)) c = polynomialEncode c := by
simp [Finsupp.linearCombination_apply, polynomialEncode, Finsupp.liftAddHom_apply,
Algebra.smul_def, PowerSeries.algebraMap_apply']
theorem wordSeries_polynomial_independent :
LinearIndependent F[X] (wordSeries (F := F) (n := n)) := by
rw [linearIndependent_iff]
intro c hc
apply polynomialEncode_eq_zero (c.support.sup List.length) c
· intro w hw
exact Finset.le_sup (Finsupp.mem_support_iff.mpr hw)
· rwa [linearCombination_eq_polynomialEncode] at hc
theorem wordSeries_independent : LinearIndependent F (wordSeries (F := F) (n := n)) :=
wordSeries_polynomial_independent.restrict_scalars' F
end NCHitting
end
end OAI

Xet Storage Details

Size:
13.3 kB
·
Xet hash:
09eb1c5935083772f557a82c4b42403dd3c0032cf661fe77295fc72b4d6b7a9f

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