math / data /lean /OAI /Algebra /Determinantal /LinearForms.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
20.1 kB
import OAI.Algebra.Determinantal.Multigraded
namespace OAI
namespace PermanentBorder.Multigraded
open MvPolynomial
section LinearCoefficients
variable {K Οƒ Ο„ : Type*} [Field K] [Fintype Ο„]
noncomputable def linearFormMap (v : Ο„ β†’ Οƒ) : (Ο„ β†’ K) β†’β‚—[K] MvPolynomial Οƒ K :=
βˆ‘ t, (LinearMap.proj t).smulRight (X (v t))
lemma linearFormMap_apply (v : Ο„ β†’ Οƒ) (c : Ο„ β†’ K) :
linearFormMap v c = βˆ‘ t, C (c t) * X (v t) := by
simp [linearFormMap, smul_eq_C_mul]
lemma linearFormMap_single [DecidableEq Ο„] (v : Ο„ β†’ Οƒ) (t : Ο„) :
linearFormMap v (Pi.single t (1 : K)) = X (v t) := by
classical
simp [linearFormMap_apply, Pi.single_apply]
noncomputable def linearCoefficientSubspace (v : Ο„ β†’ Οƒ) (I : Ideal (MvPolynomial Οƒ K)) :
Submodule K (Ο„ β†’ K) := (I.restrictScalars K).comap (linearFormMap v)
theorem linear_relations_of_codimension_le_one (v : Ο„ β†’ Οƒ) (I : Ideal (MvPolynomial Οƒ K))
(h : Module.finrank K ((Ο„ β†’ K) β§Έ linearCoefficientSubspace v I) ≀ 1) :
βˆƒ z : MvPolynomial Οƒ K, βˆƒ c : Ο„ β†’ K, βˆ€ t, X (v t) - C (c t) * z ∈ I := by
classical
obtain ⟨a,ha⟩ := finrank_le_one_iff.mp h
obtain ⟨b,rfl⟩ := Submodule.Quotient.mk_surjective (linearCoefficientSubspace v I) a
choose c hc using fun t => ha (Submodule.Quotient.mk (Pi.single t (1 : K)))
refine ⟨linearFormMap v b,c,fun t => ?_⟩
have hmem : Pi.single t (1 : K) - c t β€’ b ∈ linearCoefficientSubspace v I := by
apply (Submodule.Quotient.eq (linearCoefficientSubspace v I)).mp
simpa only [Submodule.Quotient.mk_smul] using (hc t).symm
change linearFormMap v (Pi.single t 1 - c t β€’ b) ∈ I at hmem
simpa only [map_sub, map_smul, linearFormMap_single, smul_eq_C_mul] using hmem
theorem variables_mem_of_codimension_zero (v : Ο„ β†’ Οƒ) (I : Ideal (MvPolynomial Οƒ K))
(h : Module.finrank K ((Ο„ β†’ K) β§Έ linearCoefficientSubspace v I) = 0) :
βˆ€ t, X (v t) ∈ I := by
classical
intro t
have hz : Submodule.Quotient.mk (Pi.single t (1 : K)) =
(0 : (Ο„ β†’ K) β§Έ linearCoefficientSubspace v I) := by
obtain ⟨c,hc,hq⟩ := Module.finrank_eq_zero_iff.mp h
(Submodule.Quotient.mk (Pi.single t (1 : K)))
exact (smul_eq_zero.mp hq).resolve_left hc
have hm := (Submodule.Quotient.mk_eq_zero (linearCoefficientSubspace v I)).mp hz
change linearFormMap v (Pi.single t (1 : K)) ∈ I at hm
simpa only [linearFormMap_single] using hm
end LinearCoefficients
section Vandermonde
variable {K : Type*} [Field K]
lemma linearIndependent_rect_vandermonde {n N : β„•} (hn : n ≀ N)
(t : Fin n β†’ K) (ht : Function.Injective t) :
LinearIndependent K (fun i : Fin n => fun j : Fin N => t i ^ j.val) := by
let f : (Fin N β†’ K) β†’β‚—[K] Fin n β†’ K :=
LinearMap.funLeft K K (Fin.castLE hn)
apply LinearIndependent.of_comp f
exact Matrix.linearIndependent_rows_of_det_ne_zero
(Matrix.det_vandermonde_ne_zero_iff.mpr ht)
lemma linear_block_codimension_le {Οƒ : Type*} {n N : β„•} (hn : n ≀ N)
(v : Fin N β†’ Οƒ) (I : Ideal (MvPolynomial Οƒ K))
(t : Fin n β†’ K) (ht : Function.Injective t)
(hforms : βˆ€ i, linearFormMap v (fun j => t i ^ j.val) ∈ I) :
Module.finrank K ((Fin N β†’ K) β§Έ linearCoefficientSubspace v I) + n ≀ N := by
have hi := linearIndependent_rect_vandermonde hn t ht
have hspan : Submodule.span K (Set.range (fun i : Fin n => fun j : Fin N => t i ^ j.val)) ≀
linearCoefficientSubspace v I := by
apply Submodule.span_le.mpr
rintro _ ⟨i,rfl⟩
exact hforms i
have hr := Submodule.finrank_mono hspan
rw [finrank_span_eq_card hi, Fintype.card_fin] at hr
have he := Submodule.finrank_quotient_add_finrank (linearCoefficientSubspace v I)
rw [Module.finrank_fintype_fun_eq_card, Fintype.card_fin] at he
omega
end Vandermonde
end PermanentBorder.Multigraded
namespace PermanentBorder.Multigraded
open MvPolynomial
section VandermondeLeaves
variable {K ΞΉ L : Type*} [Field K] [Fintype ΞΉ] [DecidableEq ΞΉ] [Fintype L]
abbrev BlockVariables (a : ΞΉ β†’ β„•) := (j : ΞΉ) Γ— Fin (a j + 1)
def blockVar (a : ΞΉ β†’ β„•) (j : ΞΉ) (h : Fin (a j+1)) : BlockVariables a := ⟨j,h⟩
noncomputable def blockLinearForm (a : ΞΉ β†’ β„•) (j : ΞΉ) (t : K) :
MvPolynomial (BlockVariables a) K :=
linearFormMap (blockVar a j) (fun h : Fin (a j+1) => t ^ h.val)
omit [Fintype ΞΉ] in
lemma blockLinearForm_homogeneous (a : ΞΉ β†’ β„•) (j : ΞΉ) (t : K) :
(blockLinearForm a j t).IsWeightedHomogeneous (blockWeight (fun v : BlockVariables a => v.1))
(Pi.single j 1) := by
classical
rw [blockLinearForm,linearFormMap_apply]
apply IsWeightedHomogeneous.sum
intro h _
exact (isWeightedHomogeneous_X K (blockWeight (fun v : BlockVariables a => v.1)) (blockVar a j h)).C_mul _
omit [Fintype ΞΉ] in
lemma labeled_codimension (a : ΞΉ β†’ β„•) (g : L β†’ ΞΉ) (t : L β†’ K)
(ht : Function.Injective t) (I : Ideal (MvPolynomial (BlockVariables a) K))
(hforms : βˆ€ l, blockLinearForm a (g l) (t l) ∈ I)
(j : ΞΉ) (n : β„•) (hn : n ≀ a j+1) (hj : n ≀ Fintype.card {l // g l = j}) :
Module.finrank K ((Fin (a j+1) β†’ K) β§Έ linearCoefficientSubspace (blockVar a j) I) + n ≀ a j+1 := by
classical
obtain ⟨e⟩ := Function.Embedding.nonempty_of_card_le (α := Fin n)
(Ξ² := {l // g l = j}) (by simpa using hj)
apply linear_block_codimension_le hn (blockVar a j) I (fun i => t (e i).val)
(ht.comp (Subtype.val_injective.comp e.injective))
intro i
have h := hforms (e i).val
have hij : g (e i).val = j := (e i).property
rw [hij] at h
exact h
theorem labeled_leaf_bound (a : ΞΉ β†’ β„•) (g : L β†’ ΞΉ) (t : L β†’ K)
(ht : Function.Injective t) (hcard : Fintype.card L = βˆ‘ j, a j)
(I : Ideal (MvPolynomial (BlockVariables a) K))
(hforms : βˆ€ l, blockLinearForm a (g l) (t l) ∈ I)
(d : ΞΉ β†’ β„€) (hd : βˆ€ j, 0 < d j) :
Module.finrank K (componentQuotient (blockWeight (fun v : BlockVariables a => v.1)) I d) ≀
if βˆ€ j, Fintype.card {l // g l = j} = a j then 1 else 0 := by
classical
split_ifs with hbalanced
Β· have hj (j : ΞΉ) :
Module.finrank K ((Fin (a j+1) β†’ K) β§Έ linearCoefficientSubspace (blockVar a j) I) ≀ 1 := by
have h := labeled_codimension a g t ht I hforms j (a j) (by omega) (by rw [hbalanced])
omega
choose z c hc using fun j => linear_relations_of_codimension_le_one (blockVar a j) I (hj j)
exact component_finrank_le_one_of_linear_relations (fun v : BlockVariables a => v.1) I z
(fun v => c v.1 v.2) (fun v => hc v.1 v.2) d
Β· have hs : (βˆ‘ j, Fintype.card {l // g l = j}) = βˆ‘ j, a j := by
rw [← Fintype.card_sigma, Fintype.card_congr (Equiv.sigmaFiberEquiv g), hcard]
have hex : βˆƒ j, a j < Fintype.card {l // g l = j} := by
by_contra! hn
apply hbalanced
exact fun j => (Finset.sum_eq_sum_iff_of_le (fun j _ => hn j)).mp hs j (Finset.mem_univ j)
obtain ⟨j,hj⟩ := hex
have hdim := labeled_codimension a g t ht I hforms j (a j+1) le_rfl hj
have hz := variables_mem_of_codimension_zero (blockVar a j) I (by omega)
have hb : βˆ€ v : BlockVariables a, v.1 = j β†’ X v ∈ I := by
rintro ⟨i,v⟩ hv
change i = j at hv
subst i
exact hz v
exact (component_finrank_zero_of_block_killed (fun v : BlockVariables a => v.1) I j hb d (hd j)).le
end VandermondeLeaves
end PermanentBorder.Multigraded
namespace PermanentBorder.Multigraded
open MvPolynomial
section BinaryChoices
variable {K Οƒ G : Type*} [Field K] [AddCommGroup G]
variable (w : Οƒ β†’ G)
noncomputable def pieceDim (I : Ideal (MvPolynomial Οƒ K)) (d : G) : β„• :=
Module.finrank K (componentQuotient w I d)
noncomputable def choiceIdeal : (qs : List (FactorPair (K := K) w)) β†’
(Fin qs.length β†’ Bool) β†’ Ideal (MvPolynomial Οƒ K)
| [], _ => βŠ₯
| q::qs, c => Ideal.span {if c 0 then q.right else q.left} βŠ”
choiceIdeal qs (fun i => c i.succ)
noncomputable def choiceShift : (qs : List (FactorPair (K := K) w)) β†’
(Fin qs.length β†’ Bool) β†’ G
| [], _ => 0
| q::qs, c => (if c 0 then q.leftDegree else 0) + choiceShift qs (fun i => c i.succ)
lemma splitBound_eq_choiceSum (qs : List (FactorPair (K := K) w))
(I : Ideal (MvPolynomial Οƒ K)) (d : G) :
splitBound w I d qs = βˆ‘ c : Fin qs.length β†’ Bool,
pieceDim w (I βŠ” choiceIdeal w qs c) (d-choiceShift w qs c) := by
classical
induction qs generalizing I d with
| nil =>
change pieceDim w I d = βˆ‘ c : Fin 0 β†’ Bool,
pieceDim w (I βŠ” choiceIdeal w [] c) (d-choiceShift w [] c)
simp only [choiceIdeal, choiceShift, sup_bot_eq, sub_zero]
simp
| cons q qs ih =>
rw [splitBound, ih, ih]
let f : (Fin (qs.length+1) β†’ Bool) β†’ β„• := fun c =>
pieceDim w (I βŠ” choiceIdeal w (q::qs) c) (d-choiceShift w (q::qs) c)
have hs := (Fin.consEquiv (fun _ : Fin (qs.length+1) => Bool)).sum_comp f
apply Eq.trans (b := βˆ‘ p : Bool Γ— (Fin qs.length β†’ Bool), f (Fin.cons p.1 p.2)) _ hs
simp only [f, Fintype.sum_prod_type, Fintype.sum_bool,
choiceIdeal, choiceShift, Fin.cons_zero, Fin.cons_succ, Bool.false_eq_true,
ite_false, ite_true, zero_add, ← sup_assoc]
simp_rw [sub_add_eq_sub_sub]
exact add_comm _ _
lemma choice_mem_choiceIdeal (qs : List (FactorPair (K := K) w))
(c : Fin qs.length β†’ Bool) (i : Fin qs.length) :
(if c i then (qs.get i).right else (qs.get i).left) ∈ choiceIdeal w qs c := by
induction qs with
| nil => exact Fin.elim0 i
| cons q qs ih =>
refine Fin.cases ?_ (fun i => ?_) i
Β· exact Submodule.mem_sup_left (Ideal.subset_span (Set.mem_singleton _))
Β· exact Submodule.mem_sup_right (ih (fun j => c j.succ) i)
end BinaryChoices
end PermanentBorder.Multigraded
namespace PermanentBorder.Multigraded
open MvPolynomial
section MixedCoefficient
variable {ΞΉ E : Type*} [Fintype E] [DecidableEq ΞΉ]
noncomputable def choiceCount (g : E β†’ ΞΉ) : ΞΉ β†’β‚€ β„• := βˆ‘ e, Finsupp.single (g e) 1
lemma choiceCount_apply (g : E β†’ ΞΉ) (j : ΞΉ) :
choiceCount g j = Fintype.card {e // g e = j} := by
classical
rw [Fintype.card_subtype, Finset.card_filter]
simp only [choiceCount, Finsupp.finsetSum_apply, Finsupp.single_apply]
noncomputable def mixedPolynomial (u v : E β†’ ΞΉ) : MvPolynomial ΞΉ β„• :=
∏ e, (X (u e) + X (v e))
omit [DecidableEq ΞΉ] in
lemma mixedPolynomial_eq_choices [DecidableEq E] (u v : E β†’ ΞΉ) :
mixedPolynomial u v = βˆ‘ c : E β†’ Bool,
monomial (choiceCount (fun e => if c e then v e else u e)) (1 : β„•) := by
classical
have h := Fintype.prod_sum (fun e (b : Bool) =>
if b then X (v e) else X (u e) : E β†’ Bool β†’ MvPolynomial ΞΉ β„•)
simp only [Fintype.sum_bool, ite_true, Bool.false_eq_true, ite_false] at h
rw [mixedPolynomial]
simp_rw [add_comm] at h
rw [h]
apply Finset.sum_congr rfl
intro c _
rw [choiceCount, monomial_sum_one]
apply Finset.prod_congr rfl
intro e _
cases c e <;> rfl
lemma mixed_coefficient_eq_count [Fintype ΞΉ] [DecidableEq E] (u v : E β†’ ΞΉ) (a : ΞΉ β†’β‚€ β„•) :
(mixedPolynomial u v).coeff a =
βˆ‘ c : E β†’ Bool, if βˆ€ j,
Fintype.card {e // (if c e then v e else u e) = j} = a j then 1 else 0 := by
classical
rw [mixedPolynomial_eq_choices, coeff_sum]
apply Finset.sum_congr rfl
intro c _
rw [coeff_monomial]
congr 1
rw [Finsupp.ext_iff]
simp only [choiceCount_apply]
end MixedCoefficient
end PermanentBorder.Multigraded
namespace PermanentBorder.Multigraded
open MvPolynomial
section ComparisonPieceBound
variable {K ΞΉ Οƒ : Type*} [Field K] [DecidableEq ΞΉ]
omit [DecidableEq ΞΉ] in
lemma choiceShift_le_length (w : Οƒ β†’ (ΞΉ β†’ β„€))
(qs : List (FactorPair (K := K) w)) (c : Fin qs.length β†’ Bool)
(hdeg : βˆ€ q ∈ qs, βˆ€ j, q.leftDegree j ≀ 1) (j : ΞΉ) :
choiceShift w qs c j ≀ (qs.length : β„€) := by
induction qs with
| nil => simp [choiceShift]
| cons q qs ih =>
have hq := hdeg q (List.mem_cons_self) j
have hs := ih (fun i => c i.succ) (fun q h => hdeg q (List.mem_cons_of_mem _ h))
by_cases hc : c 0 = true
Β· simpa [choiceShift, hc, add_comm] using add_le_add hq hs
Β· simpa [choiceShift, hc] using hs.trans (show (qs.length : β„€) ≀ qs.length + 1 by omega)
variable [Fintype ΞΉ]
theorem comparison_piece_bound (a : ΞΉ β†’β‚€ β„•)
(qs : List (FactorPair (K := K) (blockWeight (fun v : BlockVariables a => v.1))))
(u v : Fin qs.length β†’ ΞΉ) (t : (Fin qs.length Γ— Bool) β†’ K)
(ht : Function.Injective t)
(hleft : βˆ€ i, (qs.get i).left = blockLinearForm a (u i) (t (i,false)))
(hright : βˆ€ i, (qs.get i).right = blockLinearForm a (v i) (t (i,true)))
(hdeg : βˆ€ q ∈ qs, βˆ€ j, q.leftDegree j ≀ 1)
(hlen : qs.length = βˆ‘ j, a j) (d : ΞΉ β†’ β„€) (hd : βˆ€ j, (qs.length : β„€) < d j) :
pieceDim (blockWeight (fun v : BlockVariables a => v.1))
(productIdeal (blockWeight (fun v : BlockVariables a => v.1)) qs) d ≀
(mixedPolynomial u v).coeff a := by
classical
let w := blockWeight (fun v : BlockVariables a => v.1)
have hf := finrank_le_splitBound w qs βŠ₯ (componentClosed_bot w) d
change pieceDim w (βŠ₯ βŠ” productIdeal w qs) d ≀ splitBound w βŠ₯ d qs at hf
rw [bot_sup_eq] at hf
apply hf.trans
rw [splitBound_eq_choiceSum, mixed_coefficient_eq_count]
apply Finset.sum_le_sum
intro c _
simp only [bot_sup_eq]
let g : Fin qs.length β†’ ΞΉ := fun i => if c i then v i else u i
let t' : Fin qs.length β†’ K := fun i => t (i,c i)
have ht' : Function.Injective t' := by
intro i j hij
exact congrArg Prod.fst (ht hij)
have hforms (i : Fin qs.length) :
blockLinearForm a (g i) (t' i) ∈ choiceIdeal w qs c := by
have h := choice_mem_choiceIdeal w qs c i
dsimp only [g,t']
cases hc : c i
Β· simpa only [hc, Bool.false_eq_true, ite_false, hleft i] using h
Β· simpa only [hc, ite_true, hright i] using h
have hp (j : ΞΉ) : 0 < (d-choiceShift w qs c) j := by
have hb := choiceShift_le_length w qs c hdeg j
have hh := hd j
simp only [Pi.sub_apply]
omega
exact labeled_leaf_bound a g t' ht' (by simpa using hlen)
(choiceIdeal w qs c) hforms (d-choiceShift w qs c) hp
end ComparisonPieceBound
end PermanentBorder.Multigraded
namespace PermanentBorder.Multigraded
open MvPolynomial
section HomogeneousIdealMap
variable {K Οƒ G E : Type*} [Field K] [AddCommGroup G] [Fintype E]
variable (w : Οƒ β†’ G) (e : E β†’ G) (F : E β†’ MvPolynomial Οƒ K)
(hF : βˆ€ i, (F i).IsWeightedHomogeneous w (e i))
noncomputable def homogeneousIdealMap (d : G) :
(βˆ€ i : E, Piece (K := K) w (d-e i)) β†’β‚—[K] Piece (K := K) w d :=
βˆ‘ i, (mulPiece w (hF i) d).comp (LinearMap.proj i)
lemma homogeneousIdealMap_val (d : G) (p : βˆ€ i : E, Piece (K := K) w (d-e i)) :
(homogeneousIdealMap w e F hF d p).val = βˆ‘ i, F i * (p i).val := by
simp [homogeneousIdealMap]
lemma homogeneousIdealMap_range (d : G) :
LinearMap.range (homogeneousIdealMap w e F hF d) =
((Ideal.span (Set.range F)).restrictScalars K).comap (Piece (K := K) w d).subtype := by
classical
ext p
constructor
· rintro ⟨g,rfl⟩
change (homogeneousIdealMap w e F hF d g).val ∈ Ideal.span (Set.range F)
rw [homogeneousIdealMap_val]
exact Ideal.sum_mem _ fun i _ => Ideal.mul_mem_right _ _ (Ideal.mem_span_range_self)
Β· intro hp
change p.val ∈ Ideal.span (Set.range F) at hp
obtain ⟨g,hg⟩ := Ideal.mem_span_range_iff_exists_fun.mp hp
let g' : βˆ€ i : E, Piece (K := K) w (d-e i) := fun i =>
⟨weightedHomogeneousComponent w (d-e i) (g i),
weightedHomogeneousComponent_mem w (g i) (d-e i)⟩
refine ⟨g', Subtype.ext ?_⟩
rw [homogeneousIdealMap_val]
change βˆ‘ i, F i * weightedHomogeneousComponent w (d-e i) (g i) = p.val
simp_rw [← project_mul w (hF _)]
rw [← map_sum]
simp_rw [mul_comm (F _) _]
rw [hg, weightedHomogeneousComponent_eq_self p.property]
lemma isWeightedHomogeneous_smul {p : MvPolynomial Οƒ K} {a : G}
(hp : p.IsWeightedHomogeneous w a) (c : K) :
(c β€’ p).IsWeightedHomogeneous w a := by
simpa only [Algebra.smul_def, MvPolynomial.algebraMap_eq] using hp.C_mul c
lemma homogeneousIdealMap_affine (Q : E β†’ MvPolynomial Οƒ K)
(hQ : βˆ€ i, (Q i).IsWeightedHomogeneous w (e i)) (d : G) (t : K) :
homogeneousIdealMap w e (fun i => (1-t) β€’ Q i + t β€’ F i)
(fun i => (isWeightedHomogeneous_smul w (hQ i) (1-t)).add
(isWeightedHomogeneous_smul w (hF i) t)) d =
(1-t) β€’ homogeneousIdealMap w e Q hQ d + t β€’ homogeneousIdealMap w e F hF d := by
classical
apply LinearMap.ext
intro p
apply Subtype.ext
simp only [LinearMap.add_apply, LinearMap.smul_apply, Submodule.coe_add,
Submodule.coe_smul]
rw [homogeneousIdealMap_val, homogeneousIdealMap_val, homogeneousIdealMap_val]
simp only [add_mul, smul_mul_assoc, Finset.sum_add_distrib, ← Finset.smul_sum]
end HomogeneousIdealMap
lemma pairProduct_mem_productIdeal {K Οƒ G : Type*} [Field K] [AddCommGroup G]
(w : Οƒ β†’ G) (qs : List (FactorPair (K := K) w)) (i : Fin qs.length) :
(qs.get i).left * (qs.get i).right ∈ productIdeal w qs := by
induction qs with
| nil => exact Fin.elim0 i
| cons q qs ih =>
refine Fin.cases ?_ (fun i => ?_) i
Β· exact Submodule.mem_sup_left (Ideal.subset_span (Set.mem_singleton _))
Β· exact Submodule.mem_sup_right (ih i)
lemma productIdeal_le {K Οƒ G : Type*} [Field K] [AddCommGroup G]
(w : Οƒ β†’ G) (qs : List (FactorPair (K := K) w)) (I : Ideal (MvPolynomial Οƒ K))
(h : βˆ€ i : Fin qs.length, (qs.get i).left * (qs.get i).right ∈ I) :
productIdeal w qs ≀ I := by
induction qs with
| nil => exact bot_le
| cons q qs ih =>
exact sup_le (Ideal.span_le.mpr (Set.singleton_subset_iff.mpr (h 0)))
(ih (fun i => h i.succ))
lemma productIdeal_eq_span {K Οƒ G : Type*} [Field K] [AddCommGroup G]
(w : Οƒ β†’ G) (qs : List (FactorPair (K := K) w)) :
productIdeal w qs = Ideal.span (Set.range (fun i : Fin qs.length =>
(qs.get i).left * (qs.get i).right)) := by
apply le_antisymm
Β· exact productIdeal_le w qs _ (fun _ => Ideal.mem_span_range_self)
Β· apply Ideal.span_le.mpr
rintro _ ⟨i,rfl⟩
exact pairProduct_mem_productIdeal w qs i
end PermanentBorder.Multigraded
namespace PermanentBorder.Multigraded
section AffineIndependent
variable {K E V : Type*} [Field K] [Fintype E]
[AddCommGroup V] [Module K V]
theorem affine_independent_polynomial (v w : E β†’ V) (hv : LinearIndependent K v) :
βˆƒ p : Polynomial K, p.eval 0 = 1 ∧ βˆ€ t : K, p.eval t β‰  0 β†’
LinearIndependent K (fun i => (1-t) β€’ v i + t β€’ w i) := by
classical
let f := Fintype.linearCombination K v
obtain ⟨g,hg⟩ := f.exists_leftInverse_of_injective
(LinearMap.ker_eq_bot.mpr hv.fintypeLinearCombination_injective)
have hgv (i : E) : g (v i) = Pi.single i 1 := by
have h := LinearMap.congr_fun hg (Pi.single i 1)
simpa [f, Fintype.linearCombination_apply] using h
let M : Matrix E E (Polynomial K) := fun j i =>
(1-Polynomial.X) * Polynomial.C (g (v i) j) + Polynomial.X * Polynomial.C (g (w i) j)
have hM (t : K) : M.map (Polynomial.evalRingHom t) =
(fun j i => g ((1-t) β€’ v i + t β€’ w i) j) := by
ext j i
change (Polynomial.evalRingHom t) (M j i) = _
simp [M]
ring
have hzero : M.map (Polynomial.evalRingHom 0) = 1 := by
rw [hM]
ext j i
by_cases h : j = i
Β· subst j; simp [hgv]
Β· simp [hgv, h]
refine ⟨M.det, ?_, ?_⟩
Β· change Polynomial.evalRingHom 0 M.det = 1
rw [RingHom.map_det, RingHom.mapMatrix_apply, hzero, Matrix.det_one]
Β· intro t ht
have hu : IsUnit ((M.map (Polynomial.evalRingHom t)).det) := by
rw [← RingHom.mapMatrix_apply, ← RingHom.map_det]
exact isUnit_iff_ne_zero.mpr ht
have hi := (Matrix.linearIndependent_cols_iff_isUnit).mpr
((Matrix.isUnit_iff_isUnit_det _).mpr hu)
apply LinearIndependent.of_comp g
rw [hM] at hi
exact hi
end AffineIndependent
end PermanentBorder.Multigraded
end OAI