Download data/lean/OAI/AlgebraicGeometry/PlaneCurves/Homogenization.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 7.08 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/AlgebraicGeometry/PlaneCurves/Homogenization.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/AlgebraicGeometry/PlaneCurves/Homogenization.lean
-
curl -L -o Homogenization.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/AlgebraicGeometry/PlaneCurves/Homogenization.lean
7.08 kB
| import Lean.Elab.Tactic.Omega | |
| import Mathlib.Algebra.BigOperators.Fin | |
| import Mathlib.Algebra.MvPolynomial.Eval | |
| import Mathlib.Data.Fintype.BigOperators | |
| namespace OAI | |
| /-! | |
| # Guarded homogenization of affine incidence equations | |
| -/ | |
| section | |
| noncomputable section | |
| namespace Nagata.W27 | |
| open scoped BigOperators | |
| open MvPolynomial | |
| variable {r : β} {R : Type*} [CommRing R] | |
| /-- Affine degree in one point-coordinate block. -/ | |
| def blockOrder (a : (Fin r Γ Fin 2) ββ β) (i : Fin r) : β := | |
| a (i, 0) + a (i, 1) | |
| /-- A separate degree bound for each point-coordinate block. -/ | |
| def blockDegreeBound (f : MvPolynomial (Fin r Γ Fin 2) R) (i : Fin r) : β := | |
| f.support.sup (fun a => blockOrder a i) | |
| theorem blockOrder_le_bound (f : MvPolynomial (Fin r Γ Fin 2) R) | |
| (a : (Fin r Γ Fin 2) ββ β) (ha : a β f.support) (i : Fin r) : | |
| blockOrder a i β€ blockDegreeBound f i := by | |
| exact Finset.le_sup (f := fun a => blockOrder a i) ha | |
| /-- Insert the distinguished projective-coordinate exponent. The extra one | |
| is the guard: every term vanishes outside the chosen product affine chart. -/ | |
| def guardedExponent (c : Fin r β Fin 3) (D : Fin r β β) | |
| (a : (Fin r Γ Fin 2) ββ β) : (Fin r Γ Fin 3) ββ β := | |
| Finsupp.equivFunOnFinite.symm fun ij : Fin r Γ Fin 3 => | |
| Fin.insertNth (Ξ± := fun _ : Fin 3 => β) (c ij.1) | |
| (D ij.1 - blockOrder a ij.1 + 1) | |
| (fun j => a (ij.1, j)) ij.2 | |
| @[simp] theorem guardedExponent_same (c : Fin r β Fin 3) (D : Fin r β β) | |
| (a : (Fin r Γ Fin 2) ββ β) (i : Fin r) : | |
| guardedExponent c D a (i, c i) = D i - blockOrder a i + 1 := by | |
| simp [guardedExponent] | |
| @[simp] theorem guardedExponent_other (c : Fin r β Fin 3) (D : Fin r β β) | |
| (a : (Fin r Γ Fin 2) ββ β) (i : Fin r) (j : Fin 2) : | |
| guardedExponent c D a (i, (c i).succAbove j) = a (i, j) := by | |
| simp [guardedExponent] | |
| theorem guardedExponent_block_sum (c : Fin r β Fin 3) (D : Fin r β β) | |
| (a : (Fin r Γ Fin 2) ββ β) (i : Fin r) (ha : blockOrder a i β€ D i) : | |
| (β j : Fin 3, guardedExponent c D a (i, j)) = D i + 1 := by | |
| rw [Fin.sum_univ_succAbove _ (c i)] | |
| simp only [guardedExponent_same, guardedExponent_other, Fin.sum_univ_two] | |
| unfold blockOrder at * | |
| omega | |
| /-- Guarded block homogenization of an arbitrary affine polynomial. -/ | |
| def guardedHomogenize (c : Fin r β Fin 3) | |
| (f : MvPolynomial (Fin r Γ Fin 2) R) : MvPolynomial (Fin r Γ Fin 3) R := | |
| β a β f.support, monomial (guardedExponent c (blockDegreeBound f) a) (f.coeff a) | |
| /-- Each actual support monomial has the prescribed degree in every block. -/ | |
| theorem guardedHomogenize_homogeneous (c : Fin r β Fin 3) | |
| (f : MvPolynomial (Fin r Γ Fin 2) R) | |
| (b : (Fin r Γ Fin 3) ββ β) (hb : b β (guardedHomogenize c f).support) | |
| (i : Fin r) : (β j : Fin 3, b (i, j)) = blockDegreeBound f i + 1 := by | |
| classical | |
| have hcoeff : (guardedHomogenize c f).coeff b β 0 := mem_support_iff.mp hb | |
| simp only [guardedHomogenize, coeff_sum] at hcoeff | |
| obtain β¨a, ha, htermβ© := Finset.exists_ne_zero_of_sum_ne_zero hcoeff | |
| have heq : guardedExponent c (blockDegreeBound f) a = b := by | |
| by_contra hne | |
| exact hterm (by simp [coeff_monomial, hne]) | |
| rw [β heq] | |
| exact guardedExponent_block_sum c _ a i (blockOrder_le_bound f a ha i) | |
| /-- A zero distinguished coordinate kills every guarded term. -/ | |
| theorem eval_guardedHomogenize_zero (c : Fin r β Fin 3) | |
| (f : MvPolynomial (Fin r Γ Fin 2) R) (v : Fin r Γ Fin 3 β R) | |
| (i : Fin r) (hi : v (i, c i) = 0) : | |
| eval v (guardedHomogenize c f) = 0 := by | |
| classical | |
| simp only [guardedHomogenize, map_sum] | |
| apply Finset.sum_eq_zero | |
| intro a ha | |
| rw [eval_monomial, Finsupp.prod_fintype _ _ (fun _ => pow_zero _)] | |
| apply mul_eq_zero_of_right | |
| apply Finset.prod_eq_zero (Finset.mem_univ (i, c i)) | |
| rw [guardedExponent_same, hi] | |
| exact zero_pow (by omega) | |
| /-- On normalized homogeneous representatives the homogenized polynomial | |
| evaluates to the original affine polynomial. -/ | |
| theorem eval_guardedHomogenize_normalized (c : Fin r β Fin 3) | |
| (f : MvPolynomial (Fin r Γ Fin 2) R) (v : Fin r Γ Fin 3 β R) | |
| (hv : β i, v (i, c i) = 1) : | |
| eval v (guardedHomogenize c f) = | |
| eval (fun ij => v (ij.1, (c ij.1).succAbove ij.2)) f := by | |
| classical | |
| rw [eval_eq' _ f] | |
| simp only [guardedHomogenize, map_sum, eval_monomial] | |
| apply Finset.sum_congr rfl | |
| intro a ha | |
| congr 1 | |
| rw [Finsupp.prod_fintype _ _ (fun _ => pow_zero _), | |
| Fintype.prod_prod_type, Fintype.prod_prod_type] | |
| apply Finset.prod_congr rfl | |
| intro i hi | |
| rw [Fin.prod_univ_succAbove _ (c i)] | |
| simp only [guardedExponent_same, guardedExponent_other, hv, one_pow, one_mul] | |
| /-- Scaling each homogeneous coordinate block scales the polynomial by its | |
| actual block degree. -/ | |
| theorem eval_guardedHomogenize_scale (c : Fin r β Fin 3) | |
| (f : MvPolynomial (Fin r Γ Fin 2) R) | |
| (a : Fin r β R) (v : Fin r Γ Fin 3 β R) : | |
| eval (fun ij => a ij.1 * v ij) (guardedHomogenize c f) = | |
| (β i, a i ^ (blockDegreeBound f i + 1)) * eval v (guardedHomogenize c f) := by | |
| classical | |
| simp only [eval_eq', Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro b hb | |
| simp only [mul_pow, Finset.prod_mul_distrib] | |
| have hprod : (β ij : Fin r Γ Fin 3, a ij.1 ^ b ij) = | |
| β i, a i ^ (blockDegreeBound f i + 1) := by | |
| rw [Fintype.prod_prod_type] | |
| apply Finset.prod_congr rfl | |
| intro i hi | |
| change (β j : Fin 3, a i ^ b (i, j)) = a i ^ (blockDegreeBound f i + 1) | |
| rw [Finset.prod_pow_eq_pow_sum, guardedHomogenize_homogeneous c f b hb i] | |
| rw [hprod] | |
| ac_rfl | |
| /-- For arbitrary nonzero chart coordinates the denominator-clearing factor | |
| is explicit and nonzero. -/ | |
| theorem eval_guardedHomogenize_chart {K : Type*} [Field K] | |
| (c : Fin r β Fin 3) (f : MvPolynomial (Fin r Γ Fin 2) K) | |
| (v : Fin r Γ Fin 3 β K) (hv : β i, v (i, c i) β 0) : | |
| eval v (guardedHomogenize c f) = | |
| (β i, v (i, c i) ^ (blockDegreeBound f i + 1)) * | |
| eval (fun ij => v (ij.1, (c ij.1).succAbove ij.2) / v (ij.1, c ij.1)) f := by | |
| have h := eval_guardedHomogenize_scale c f | |
| (fun i => v (i, c i)) (fun ij => v ij / v (ij.1, c ij.1)) | |
| have heq : (fun ij : Fin r Γ Fin 3 => | |
| v (ij.1, c ij.1) * (v ij / v (ij.1, c ij.1))) = v := by | |
| funext ij | |
| exact mul_div_cancelβ _ (hv ij.1) | |
| rw [heq] at h | |
| rw [eval_guardedHomogenize_normalized c f | |
| (fun ij => v ij / v (ij.1, c ij.1)) (fun i => div_self (hv i))] at h | |
| exact h | |
| theorem eval_guardedHomogenize_eq_zero_iff {K : Type*} [Field K] | |
| (c : Fin r β Fin 3) (f : MvPolynomial (Fin r Γ Fin 2) K) | |
| (v : Fin r Γ Fin 3 β K) (hv : β i, v (i, c i) β 0) : | |
| eval v (guardedHomogenize c f) = 0 β | |
| eval (fun ij => v (ij.1, (c ij.1).succAbove ij.2) / v (ij.1, c ij.1)) f = 0 := by | |
| rw [eval_guardedHomogenize_chart c f v hv] | |
| have hfactor : (β i, v (i, c i) ^ (blockDegreeBound f i + 1)) β 0 := | |
| Finset.prod_ne_zero_iff.mpr fun i hi => pow_ne_zero _ (hv i) | |
| exact mul_eq_zero.trans (or_iff_right hfactor) | |
| end Nagata.W27 | |
| end | |
| end | |
| end OAI | |