@@ -259,38 +259,35 @@ theorem nextCoeff_eq_zero_of_eraseLead_eq_zero (h : f.eraseLead = 0) : f.nextCoe
259
259
end EraseLead
260
260
261
261
/-- 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
263
263
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 =>
277
274
rw [← eraseLead_add_C_mul_X_pow f]
278
275
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
280
277
· 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 ]
283
280
exact zero_ne_one.symm
284
- refine P_C_add f.eraseLead _ ?_ ?_ ?_ ?_
281
+ refine add f.eraseLead _ ?_ ?_ ?_ ?_
285
282
· 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
287
284
· rw [natDegree_C_mul_X_pow _ _ (leadingCoeff_ne_zero.mpr _)]
288
285
rintro rfl
289
- simp at f0
286
+ simp at hf
290
287
· 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 ]
294
291
exact Nat.succ_ne_zero _
295
292
296
293
/-- Let `φ : R[x] → S[x]` be an additive map, `k : ℕ` a bound, and `fu : ℕ → ℕ` a
0 commit comments