@@ -148,24 +148,24 @@ begin
148
148
exact ⟨H1, dvd_trans (dvd_mul_left _ _) H2, λ p pp dp, H3 _ pp (this _ pp dp)⟩ }
149
149
end
150
150
151
- theorem min_sq_fac_aux_has_prop : ∀ {n : ℕ} k, 0 < n → ∀ i, k = 2 *i+3 →
151
+ theorem min_sq_fac_aux_has_prop : ∀ {n : ℕ} k, n ≠ 0 → ∀ i, k = 2 *i+3 →
152
152
(∀ m, prime m → m ∣ n → k ≤ m) → min_sq_fac_prop n (min_sq_fac_aux n k)
153
153
| n k := λ n0 i e ih, begin
154
154
rw min_sq_fac_aux,
155
155
by_cases h : n < k*k; simp [h],
156
156
{ refine squarefree_iff_prime_squarefree.2 (λ p pp d, _),
157
157
have := ih p pp (dvd_trans ⟨_, rfl⟩ d),
158
158
have := nat.mul_le_mul this this ,
159
- exact not_le_of_lt h (le_trans this (le_of_dvd n0 d)) },
159
+ exact not_le_of_lt h (le_trans this (le_of_dvd n0.bot_lt d)) },
160
160
have k2 : 2 ≤ k, { subst e, exact dec_trivial },
161
- have k0 : 0 < k := lt_of_lt_of_le dec_trivial k2,
161
+ have k0 : k ≠ 0 := ( lt_of_lt_of_le dec_trivial k2).ne' ,
162
162
have IH : ∀ n', n' ∣ n → ¬ k ∣ n' → min_sq_fac_prop n' (n'.min_sq_fac_aux (k + 2 )),
163
163
{ intros n' nd' nk,
164
- have hn' := le_of_dvd n0 nd',
164
+ have hn' := le_of_dvd n0.bot_lt nd',
165
165
refine
166
166
have nat.sqrt n' - k < nat.sqrt n + 2 - k, from
167
167
lt_of_le_of_lt (nat.sub_le_sub_right (nat.sqrt_le_sqrt hn') _) (nat.min_fac_lemma n k h),
168
- @min_sq_fac_aux_has_prop n' (k+2 ) (pos_of_dvd_of_pos nd' n0)
168
+ @min_sq_fac_aux_has_prop n' (k+2 ) (pos_of_dvd_of_pos nd' n0.bot_lt).ne'
169
169
(i+1 ) (by simp [e, left_distrib]) (λ m m2 d, _),
170
170
cases nat.eq_or_lt_of_le (ih m m2 (dvd_trans d nd')) with me ml,
171
171
{ subst me, contradiction },
@@ -191,10 +191,10 @@ begin
191
191
{ exact ⟨prime_two, (dvd_div_iff d2).1 d4, λ p pp _, pp.two_le⟩ },
192
192
{ cases nat.eq_zero_or_pos n with n0 n0, { subst n0, cases d4 dec_trivial },
193
193
refine min_sq_fac_prop_div _ prime_two d2 (mt (dvd_div_iff d2).2 d4) _,
194
- refine min_sq_fac_aux_has_prop 3 (nat.div_pos (le_of_dvd n0 d2) dec_trivial) 0 rfl _,
194
+ refine min_sq_fac_aux_has_prop 3 (nat.div_pos (le_of_dvd n0 d2) dec_trivial).ne' 0 rfl _,
195
195
refine λ p pp dp, succ_le_of_lt (lt_of_le_of_ne pp.two_le _),
196
196
rintro rfl, contradiction },
197
- { cases nat.eq_zero_or_pos n with n0 n0, { subst n0, cases d2 dec_trivial },
197
+ { rcases eq_or_ne n 0 with rfl | n0, { cases d2 dec_trivial },
198
198
refine min_sq_fac_aux_has_prop _ n0 0 rfl _,
199
199
refine λ p pp dp, succ_le_of_lt (lt_of_le_of_ne pp.two_le _),
200
200
rintro rfl, contradiction },
@@ -213,7 +213,7 @@ begin
213
213
have fd := min_fac_dvd m,
214
214
exact le_trans
215
215
(this.2 .2 _ (min_fac_prime $ ne_of_gt m2) (dvd_trans (mul_dvd_mul fd fd) md))
216
- (min_fac_le $ lt_of_lt_of_le dec_trivial m2),
216
+ (min_fac_le ( lt_of_lt_of_le dec_trivial m2).ne' ),
217
217
end
218
218
219
219
lemma squarefree_iff_min_sq_fac {n : ℕ} :
@@ -306,15 +306,15 @@ begin
306
306
rw hsa at hn,
307
307
obtain ⟨hlts, hlta⟩ := canonically_ordered_comm_semiring.mul_pos.mp hn,
308
308
rw hsb at hsa hn hlts,
309
- refine ⟨a, b, hlta, (pow_pos_iff zero_lt_two ).mp hlts, hsa.symm, _⟩,
309
+ refine ⟨a, b, hlta, (pow_pos_iff two_ne_zero ).mp hlts, hsa.symm, _⟩,
310
310
rintro x ⟨y, hy⟩,
311
311
rw nat.is_unit_iff,
312
312
by_contra hx,
313
313
refine lt_le_antisymm _ (finset.le_max' S ((b * x) ^ 2 ) _),
314
314
{ simp_rw [S, hsa, finset.sep_def, finset.mem_filter, finset.mem_range],
315
315
refine ⟨lt_succ_iff.mpr (le_of_dvd hn _), _, ⟨b * x, rfl⟩⟩; use y; rw hy; ring },
316
316
{ convert lt_mul_of_one_lt_right hlts
317
- (one_lt_pow 2 x zero_lt_two (one_lt_iff_ne_zero_and_ne_one.mpr ⟨λ h, by simp * at *, hx⟩)),
317
+ (one_lt_pow 2 x two_ne_zero (one_lt_iff_ne_zero_and_ne_one.mpr ⟨λ h, by simp * at *, hx⟩)),
318
318
rw mul_pow },
319
319
end
320
320
@@ -419,7 +419,7 @@ lemma squarefree_helper_3 (n n' k k' c : ℕ) (e : k + 1 = k')
419
419
{ rw [← hn', nat.mul_div_cancel _ k0'] },
420
420
have k2 : 2 ≤ bit1 k := nat.succ_le_succ (bit0_pos k0),
421
421
have pk : (bit1 k).prime,
422
- { refine nat.prime_def_min_fac.2 ⟨k2, le_antisymm (nat.min_fac_le k0') _⟩,
422
+ { refine nat.prime_def_min_fac.2 ⟨k2, le_antisymm (nat.min_fac_le k0'.ne' ) _⟩,
423
423
exact ih _ (nat.min_fac_prime (ne_of_gt k2)) (dvd_trans (nat.min_fac_dvd _) dk) },
424
424
have dkk' : ¬ bit1 k ∣ bit1 n', {rw [nat.dvd_iff_mod_eq_zero, hc], exact ne_of_gt c0},
425
425
have dkk : ¬ bit1 k * bit1 k ∣ bit1 n, {rwa [← nat.dvd_div_iff dk, this ]},
0 commit comments