Skip to content

Commit 9d6361b

Browse files
committed
clean up & add induction for finite presentation
1 parent 4e97831 commit 9d6361b

File tree

1 file changed

+84
-35
lines changed

1 file changed

+84
-35
lines changed

LeanCamCombi/GrowthInGroups/Chevalley.lean

Lines changed: 84 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -212,29 +212,35 @@ lemma Prod.Lex.lt_iff' {α β} [PartialOrder α] [Preorder β] (x y : α) (w z :
212212

213213
@[simp]
214214
lemma Ideal.span_singleton_zero : Ideal.span {0} = (⊥ : Ideal R) := by simp
215-
-- Fin n → ℕ × Prop
215+
216+
lemma Polynomial.degree_C_mul_eq_of_mul_ne_zero
217+
(r : R) (p : R[X]) (h : r * p.leadingCoeff ≠ 0) : (C r * p).degree = p.degree := by
218+
by_cases hp : p = 0
219+
· simp [hp]
220+
rw [degree_eq_natDegree hp, degree_eq_natDegree, natDegree_C_mul_eq_of_mul_ne_zero h]
221+
exact fun e ↦ h (by simpa using congr(($e).coeff p.natDegree))
216222

217223
lemma Polynomial.monic_unit_leadingCoeff_inv_smul
218224
(p : R[X]) (h : IsUnit p.leadingCoeff) :
219-
(((h.unit ⁻¹ : Rˣ) : R) p).Monic := by
225+
(C ((h.unit⁻¹ : Rˣ) : R) * p).Monic := by
220226
nontriviality R
221-
rw [Monic.def, ← coeff_natDegree, Algebra.smul_def, algebraMap_eq,
222-
natDegree_C_mul_eq_of_mul_ne_zero, coeff_C_mul, coeff_natDegree, IsUnit.val_inv_mul]
227+
rw [Monic.def, ← coeff_natDegree, natDegree_C_mul_eq_of_mul_ne_zero, coeff_C_mul,
228+
coeff_natDegree, IsUnit.val_inv_mul]
223229
rw [IsUnit.val_inv_mul]
224230
exact one_ne_zero
225231

226232
lemma Ideal.span_range_update_divByMonic {ι : Type*} [DecidableEq ι]
227233
(v : ι → R[X]) (i j : ι) (hij : i ≠ j) (h : IsUnit (v i).leadingCoeff) :
228-
Ideal.span (Set.range (Function.update v j (v j %ₘ (((h.unit ⁻¹ : Rˣ) : R) v i)))) =
234+
Ideal.span (Set.range (Function.update v j (v j %ₘ (C ((h.unit⁻¹ : Rˣ) : R) * v i)))) =
229235
Ideal.span (Set.range v) := by
230-
have H : (((h.unit ⁻¹ : Rˣ) : R) v i).Monic :=
236+
have H : (C ((h.unit⁻¹ : Rˣ) : R) * v i).Monic :=
231237
Polynomial.monic_unit_leadingCoeff_inv_smul (v i) h
232238
refine le_antisymm ?_ ?_ <;>
233239
simp only [Ideal.span_le, Set.range_subset_iff, SetLike.mem_coe]
234240
· intro k
235241
by_cases hjk : j = k
236242
· subst hjk
237-
rw [Function.update_same, modByMonic_eq_sub_mul_div (v j) H, Algebra.smul_def]
243+
rw [Function.update_same, modByMonic_eq_sub_mul_div (v j) H]
238244
apply sub_mem (Ideal.subset_span ?_) (Ideal.mul_mem_right _ _
239245
(Ideal.mul_mem_left _ _ <| Ideal.subset_span ?_))
240246
· exact ⟨j, rfl⟩
@@ -244,7 +250,6 @@ lemma Ideal.span_range_update_divByMonic {ι : Type*} [DecidableEq ι]
244250
by_cases hjk : j = k
245251
· subst hjk
246252
nth_rw 2 [← modByMonic_add_div (v j) H]
247-
rw [Algebra.smul_def]
248253
apply add_mem (Ideal.subset_span ?_) (Ideal.mul_mem_right _ _
249254
(Ideal.mul_mem_left _ _ <| Ideal.subset_span ?_))
250255
· exact ⟨j, Function.update_same _ _ _⟩
@@ -273,56 +278,56 @@ lemma foo_induction
273278
| h v H_IH =>
274279
by_cases he0 : e = 0
275280
· rw [he0, Set.range_zero, Ideal.span_singleton_zero]; exact hP₁ R
281+
cases subsingleton_or_nontrivial R
282+
· rw [Subsingleton.elim (Ideal.span (Set.range e)) ⊥]; exact hP₁ R
276283
simp only [funext_iff, Pi.zero_apply, not_forall] at he0
277-
by_cases H : ∃ i, IsUnit (e i).leadingCoeff ∧ ∀ j, e j ≠ 0
278-
(e i).degree ≤ (e j).degree
284+
-- Case I : The `e i ≠ 0` with minimal degree has invertible leading coefficient
285+
by_cases H : ∃ i, IsUnit (e i).leadingCoeff ∧ ∀ j, e j ≠ 0 (e i).degree ≤ (e j).degree
279286
· obtain ⟨i, hi, i_min⟩ := H
280-
cases subsingleton_or_nontrivial R
281-
· rw [Subsingleton.elim (Ideal.span (Set.range e)) ⊥]; exact hP₁ R
287+
-- Case I.ii : `e j = 0` for all `j ≠ i`.
282288
by_cases H' : ∀ j ≠ i, e j = 0
283-
· convert hP₀ R (((hi.unit ⁻¹ : Rˣ) : R) • e i) ?_ using 1
289+
-- then `I = Ideal.span {e i}`
290+
· convert hP₀ R (C ((hi.unit⁻¹ : Rˣ) : R) * e i) ?_ using 1
284291
· refine le_antisymm ?_ ?_ <;>
285292
simp only [Ideal.span_le, Set.range_subset_iff, Set.singleton_subset_iff]
286293
· intro j
287294
by_cases hij : i = j
288295
· simp only [SetLike.mem_coe, Ideal.mem_span_singleton]
289-
use algebraMap _ _ (e i).leadingCoeff
290-
rw [mul_comm, ← Algebra.smul_def, ← mul_smul, IsUnit.mul_val_inv, one_smul, hij]
296+
use C (e i).leadingCoeff
297+
rw [mul_comm, ← mul_assoc, ← map_mul, IsUnit.mul_val_inv, map_one, one_mul, hij]
291298
· rw [H' j (.symm hij)]
292299
exact Ideal.zero_mem _
293-
· rw [Algebra.smul_def]
294-
apply Ideal.mul_mem_left _ _ (Ideal.subset_span (Set.mem_range_self i))
300+
· exact Ideal.mul_mem_left _ _ (Ideal.subset_span (Set.mem_range_self i))
295301
exact Polynomial.monic_unit_leadingCoeff_inv_smul _ _
296-
· cases subsingleton_or_nontrivial R
297-
· rw [Subsingleton.elim (Ideal.span (Set.range e)) ⊥]; exact hP₁ R
298-
simp only [ne_eq, not_forall, Classical.not_imp] at H'
302+
-- Case I.i : There is another `e j ≠ 0`
303+
· simp only [ne_eq, not_forall, Classical.not_imp] at H'
299304
obtain ⟨j, hj, hj'⟩ := H'
300305
replace i_min := i_min j hj'
306+
-- then we can replace `e j` with `e j %ₘ (C h.unit⁻¹ * e i) `
307+
-- with `h : IsUnit (e i).leadingCoeff`.
301308
rw [← Ideal.span_range_update_divByMonic e i j (.symm hj) hi]
302309
refine H_IH _ ?_ _ rfl
303-
have h_deg : (((hi.unit ⁻¹ : Rˣ) : R) • e i).degree = (e i).degree := by
304-
rw [degree_eq_natDegree (p := e i) (fun e ↦ by simp [e] at hi),
305-
degree_eq_iff_natDegree_eq, Algebra.smul_def, algebraMap_eq,
306-
natDegree_C_mul_eq_of_mul_ne_zero]
307-
· rw [IsUnit.val_inv_mul]; exact one_ne_zero
308-
· exact (Polynomial.monic_unit_leadingCoeff_inv_smul (e i) hi).ne_zero
309-
refine .left _ _ (lt_of_le_of_ne ?_ ?_)
310-
· show _ ≤ (ofLex v).1
311-
intro k
310+
refine .left _ _ (lt_of_le_of_ne (b := (ofLex v).1) ?_ ?_)
311+
· intro k
312312
simp only [Function.comp_apply, Function.update_apply, hv, ne_eq, not_exists, not_and,
313313
not_forall, Classical.not_imp, not_le, ofLex_toLex]
314314
split_ifs with hjk
315315
· rw [hjk]
316-
exact (degree_modByMonic_le _
317-
(Polynomial.monic_unit_leadingCoeff_inv_smul _ _)).trans (h_deg.trans_le i_min)
316+
refine (degree_modByMonic_le _
317+
(monic_unit_leadingCoeff_inv_smul _ _)).trans
318+
((degree_C_mul_eq_of_mul_ne_zero _ _ ?_).trans_le i_min)
319+
rw [IsUnit.val_inv_mul]
320+
exact one_ne_zero
318321
· exact le_rfl
319-
· show _ ≠ (ofLex v).1
320-
simp only [hv, ne_eq, not_exists, not_and, not_forall, not_le, funext_iff,
322+
· simp only [hv, ne_eq, not_exists, not_and, not_forall, not_le, funext_iff,
321323
Function.comp_apply, exists_prop, ofLex_toLex]
322324
use j
323325
simp only [Function.update_same]
324-
exact ((degree_modByMonic_lt _
325-
(Polynomial.monic_unit_leadingCoeff_inv_smul _ _)).trans_le (h_deg.trans_le i_min)).ne
326+
refine ((degree_modByMonic_lt _ (monic_unit_leadingCoeff_inv_smul _ _)).trans_le
327+
((degree_C_mul_eq_of_mul_ne_zero _ _ ?_).trans_le i_min)).ne
328+
rw [IsUnit.val_inv_mul]
329+
exact one_ne_zero
330+
-- Case II : The `e i ≠ 0` with minimal degree has non-invertible leading coefficient
326331
obtain ⟨i, hi, i_min⟩ : ∃ i, e i ≠ 0 ∧ ∀ j, e j ≠ 0 → (e i).degree ≤ (e j).degree := by
327332
have : ∃ n : ℕ, ∃ i, (e i).degree = n ∧ (e i) ≠ 0 := by
328333
obtain ⟨i, hi⟩ := he0; exact ⟨(e i).natDegree, i, degree_eq_natDegree hi, hi⟩
@@ -333,6 +338,8 @@ lemma foo_induction
333338
rw [degree_eq_natDegree hj, Nat.cast_le]
334339
exact Nat.find_min' _ ⟨j, degree_eq_natDegree hj, hj⟩
335340
have : ¬ IsUnit (e i).leadingCoeff := fun HH ↦ H ⟨i, HH, i_min⟩
341+
-- We replace `R` by `R ⧸ Ideal.span {(e i).leadingCoeff}` where `(e i).degree` is lowered
342+
-- and `Localization.Away (e i).leadingCoeff` where `(e i).leadingCoeff` becomes invertible.
336343
apply hP _ (e i).leadingCoeff
337344
· rw [Ideal.map_span, ← Set.range_comp]
338345
refine H_IH _ ?_ _ rfl
@@ -368,3 +375,45 @@ lemma foo_induction
368375
simp only [Ideal.Quotient.algebraMap_eq, Function.comp_apply, degree_map_eq_iff,
369376
Ideal.Quotient.mk_singleton_self, ne_eq, not_true_eq_false, false_or] at h_eq
370377
exact hi h_eq
378+
379+
universe v
380+
381+
lemma RingHom.FinitePresentation.polynomial_induction
382+
(P : ∀ (R : Type u) [CommRing R] (S : Type u) [CommRing S], (R →+* S) → Prop)
383+
(Q : ∀ (R : Type u) [CommRing R] (S : Type v) [CommRing S], (R →+* S) → Prop)
384+
(h₁ : ∀ (R) [CommRing R], P R R[X] C)
385+
(h₂ : ∀ (R : Type u) [CommRing R] (S : Type v) [CommRing S] (f : R →+* S),
386+
Function.Surjective f → (RingHom.ker f).FG → Q R S f)
387+
(h₃ : ∀ (R) [CommRing R] (S) [CommRing S] (T) [CommRing T] (f : R →+* S) (g : S →+* T),
388+
P R S f → Q S T g → Q R T (g.comp f))
389+
{R S} [CommRing R] [CommRing S] (f : R →+* S) (hf : RingHom.FinitePresentation f) :
390+
Q R S f := by
391+
obtain ⟨n, g, hg, hg'⟩ := hf
392+
let g' := letI := f.toAlgebra; g.toRingHom
393+
replace hg : Function.Surjective g' := hg
394+
replace hg' : (RingHom.ker g').FG := hg'
395+
have : g'.comp (MvPolynomial.C) = f := letI := f.toAlgebra; g.comp_algebraMap
396+
clear_value g'
397+
subst this
398+
clear g
399+
induction n generalizing R S with
400+
| zero =>
401+
refine h₂ _ _ _ (hg.comp (MvPolynomial.C_surjective (Fin 0))) ?_
402+
rw [← RingHom.comap_ker]
403+
convert hg'.map (MvPolynomial.isEmptyRingEquiv R (Fin 0)).toRingHom using 1
404+
simp only [RingEquiv.toRingHom_eq_coe]
405+
exact Ideal.comap_symm (RingHom.ker g') (MvPolynomial.isEmptyRingEquiv R (Fin 0))
406+
| succ n IH =>
407+
let e : MvPolynomial (Fin (n + 1)) R ≃ₐ[R] MvPolynomial (Fin n) R[X] :=
408+
(MvPolynomial.renameEquiv R (_root_.finSuccEquiv n)).trans
409+
(MvPolynomial.optionEquivRight R (Fin n))
410+
have he : (RingHom.ker (g'.comp <| RingHomClass.toRingHom e.symm)).FG := by
411+
rw [← RingHom.comap_ker]
412+
convert hg'.map e.toAlgHom.toRingHom using 1
413+
exact Ideal.comap_symm (RingHom.ker g') e.toRingEquiv
414+
have := IH (R := R[X]) (S := S) (g'.comp e.symm) (hg.comp e.symm.surjective) he
415+
convert h₃ _ _ _ _ _ (h₁ _) this using 1
416+
rw [RingHom.comp_assoc, RingHom.comp_assoc]
417+
congr 1
418+
ext : 1
419+
simp [e]

0 commit comments

Comments
 (0)