Skip to content

Commit 91e4c39

Browse files
committed
chore: fix two sets of induction recursor names (#29537)
Both in `Algebra.Polynomial`. We also deprime `induction` in the same files. These were split off from #29291. Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>
1 parent 212a45c commit 91e4c39

File tree

2 files changed

+26
-29
lines changed

2 files changed

+26
-29
lines changed

Mathlib/Algebra/Polynomial/EraseLead.lean

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -259,38 +259,35 @@ theorem nextCoeff_eq_zero_of_eraseLead_eq_zero (h : f.eraseLead = 0) : f.nextCoe
259259
end EraseLead
260260

261261
/-- An induction lemma for polynomials. It takes a natural number `N` as a parameter, that is
262-
required to be at least as big as the `nat_degree` of the polynomial. This is useful to prove
262+
required to be at least as big as the `natDegree` of the polynomial. This is useful to prove
263263
results where you want to change each term in a polynomial to something else depending on the
264-
`nat_degree` of the polynomial itself and not on the specific `nat_degree` of each term. -/
265-
theorem induction_with_natDegree_le (P : R[X] → Prop) (N : ℕ) (P_0 : P 0)
266-
(P_C_mul_pow : ∀ n : ℕ, ∀ r : R, r ≠ 0 → n ≤ N → P (C r * X ^ n))
267-
(P_C_add : ∀ f g : R[X], f.natDegree < g.natDegree → g.natDegree ≤ N → P f → P g → P (f + g)) :
268-
∀ f : R[X], f.natDegree ≤ N → P f := by
269-
intro f df
270-
generalize hd : #f.support = c
271-
revert f
272-
induction' c with c hc
273-
· intro f _ f0
274-
convert P_0
275-
simpa [support_eq_empty, card_eq_zero] using f0
276-
· intro f df f0
264+
`natDegree` of the polynomial itself and not on the specific `natDegree` of each term. -/
265+
theorem induction_with_natDegree_le (motive : R[X] → Prop) (N : ℕ) (zero : motive 0)
266+
(C_mul_pow : ∀ n : ℕ, ∀ r : R, r ≠ 0 → n ≤ N → motive (C r * X ^ n))
267+
(add : ∀ f g : R[X], f.natDegree < g.natDegree → g.natDegree ≤ N →
268+
motive f → motive g → motive (f + g)) (f : R[X]) (df : f.natDegree ≤ N) : motive f := by
269+
induction hf : #f.support generalizing f with
270+
| zero =>
271+
convert zero
272+
simpa [support_eq_empty, card_eq_zero] using hf
273+
| succ c hc =>
277274
rw [← eraseLead_add_C_mul_X_pow f]
278275
cases c
279-
· convert P_C_mul_pow f.natDegree f.leadingCoeff ?_ df using 1
276+
· convert C_mul_pow f.natDegree f.leadingCoeff ?_ df using 1
280277
· convert zero_add (C (leadingCoeff f) * X ^ f.natDegree)
281-
rw [← card_support_eq_zero, card_support_eraseLead' f0]
282-
· rw [leadingCoeff_ne_zero, Ne, ← card_support_eq_zero, f0]
278+
rw [← card_support_eq_zero, card_support_eraseLead' hf]
279+
· rw [leadingCoeff_ne_zero, Ne, ← card_support_eq_zero, hf]
283280
exact zero_ne_one.symm
284-
refine P_C_add f.eraseLead _ ?_ ?_ ?_ ?_
281+
refine add f.eraseLead _ ?_ ?_ ?_ ?_
285282
· refine (eraseLead_natDegree_lt ?_).trans_le (le_of_eq ?_)
286-
· exact (Nat.succ_le_succ (Nat.succ_le_succ (Nat.zero_le _))).trans f0.ge
283+
· exact (Nat.succ_le_succ (Nat.succ_le_succ (Nat.zero_le _))).trans hf.ge
287284
· rw [natDegree_C_mul_X_pow _ _ (leadingCoeff_ne_zero.mpr _)]
288285
rintro rfl
289-
simp at f0
286+
simp at hf
290287
· exact (natDegree_C_mul_X_pow_le f.leadingCoeff f.natDegree).trans df
291-
· exact hc _ (eraseLead_natDegree_le_aux.trans df) (card_support_eraseLead' f0)
292-
· refine P_C_mul_pow _ _ ?_ df
293-
rw [Ne, leadingCoeff_eq_zero, ← card_support_eq_zero, f0]
288+
· exact hc _ (eraseLead_natDegree_le_aux.trans df) (card_support_eraseLead' hf)
289+
· refine C_mul_pow _ _ ?_ df
290+
rw [Ne, leadingCoeff_eq_zero, ← card_support_eq_zero, hf]
294291
exact Nat.succ_ne_zero _
295292

296293
/-- Let `φ : R[x] → S[x]` be an additive map, `k : ℕ` a bound, and `fu : ℕ → ℕ` a

Mathlib/Algebra/Polynomial/Laurent.lean

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -354,20 +354,20 @@ theorem exists_T_pow (f : R[T;T⁻¹]) : ∃ (n : ℕ) (f' : R[X]), toLaurent f'
354354

355355
/-- This is a version of `exists_T_pow` stated as an induction principle. -/
356356
@[elab_as_elim]
357-
theorem induction_on_mul_T {Q : R[T;T⁻¹] → Prop} (f : R[T;T⁻¹])
358-
(Qf : ∀ {f : R[X]} {n : ℕ}, Q (toLaurent f * T (-n))) : Q f := by
357+
theorem induction_on_mul_T {motive : R[T;T⁻¹] → Prop} (f : R[T;T⁻¹])
358+
(mul_T : ∀ (f : R[X]) (n : ℕ), motive (toLaurent f * T (-n))) : motive f := by
359359
rcases f.exists_T_pow with ⟨n, f', hf⟩
360360
rw [← mul_one f, ← T_zero, ← Nat.cast_zero, ← Nat.sub_self n, Nat.cast_sub rfl.le, T_sub,
361361
← mul_assoc, ← hf]
362-
exact Qf
362+
exact mul_T ..
363363

364364
/-- Suppose that `Q` is a statement about Laurent polynomials such that
365365
* `Q` is true on *ordinary* polynomials;
366366
* `Q (f * T)` implies `Q f`;
367367
it follow that `Q` is true on all Laurent polynomials. -/
368368
theorem reduce_to_polynomial_of_mul_T (f : R[T;T⁻¹]) {Q : R[T;T⁻¹] → Prop}
369369
(Qf : ∀ f : R[X], Q (toLaurent f)) (QT : ∀ f, Q (f * T 1) → Q f) : Q f := by
370-
induction' f using LaurentPolynomial.induction_on_mul_T with f n
370+
induction f using LaurentPolynomial.induction_on_mul_T with | _ f n
371371
induction n with
372372
| zero => simpa only [Nat.cast_zero, neg_zero, T_zero, mul_one] using Qf _
373373
| succ n hn => convert QT _ _; simpa using hn
@@ -501,8 +501,8 @@ instance isLocalization : IsLocalization.Away (X : R[X]) R[T;T⁻¹] :=
501501
obtain ⟨n, rfl⟩ := ht
502502
rw [algebraMap_eq_toLaurent, toLaurent_X_pow]
503503
exact isUnit_T ↑n
504-
surj' := fun f => by
505-
induction' f using LaurentPolynomial.induction_on_mul_T with f n
504+
surj' f := by
505+
induction f using LaurentPolynomial.induction_on_mul_T with | _ f n
506506
have : X ^ n ∈ Submonoid.powers (X : R[X]) := ⟨n, rfl⟩
507507
refine ⟨(f, ⟨_, this⟩), ?_⟩
508508
simp only [algebraMap_eq_toLaurent, toLaurent_X_pow, mul_T_assoc, neg_add_cancel, T_zero,

0 commit comments

Comments
 (0)