Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit e593ffa

Browse files
committed
feat(algebra/ordered*): more simp lemmas (#4359)
Simplify expressions like `0 < a * b`, `0 < a / b`, `a / b < 1` etc. to FOL formulas of inequalities on `a`, `b`.
1 parent b790b27 commit e593ffa

File tree

12 files changed

+147
-93
lines changed

12 files changed

+147
-93
lines changed

src/algebra/gcd_monoid.lean

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -461,11 +461,8 @@ instance : normalization_monoid ℤ :=
461461
norm_unit_zero := if_pos (le_refl _),
462462
norm_unit_mul := assume a b hna hnb,
463463
begin
464-
by_cases ha : 0 ≤ a; by_cases hb : 0 ≤ b; simp [ha, hb],
465-
exact if_pos (mul_nonneg ha hb),
466-
exact if_neg (assume h, hb $ nonneg_of_mul_nonneg_left h $ lt_of_le_of_ne ha hna.symm),
467-
exact if_neg (assume h, ha $ nonneg_of_mul_nonneg_right h $ lt_of_le_of_ne hb hnb.symm),
468-
exact if_pos (mul_nonneg_of_nonpos_of_nonpos (le_of_not_ge ha) (le_of_not_ge hb))
464+
cases hna.lt_or_lt with ha ha; cases hnb.lt_or_lt with hb hb;
465+
simp [mul_nonneg_iff, ha.le, ha.not_le, hb.le, hb.not_le]
469466
end,
470467
norm_unit_coe_units := assume u, (units_eq_one_or u).elim
471468
(assume eq, eq.symm ▸ if_pos zero_le_one)

src/algebra/group_power/basic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,11 +485,11 @@ end canonically_ordered_semiring
485485
section linear_ordered_semiring
486486
variable [linear_ordered_semiring R]
487487

488-
theorem pow_pos {a : R} (H : 0 < a) : ∀ (n : ℕ), 0 < a ^ n
488+
@[simp] theorem pow_pos {a : R} (H : 0 < a) : ∀ (n : ℕ), 0 < a ^ n
489489
| 0 := zero_lt_one
490490
| (n+1) := mul_pos H (pow_pos _)
491491

492-
theorem pow_nonneg {a : R} (H : 0 ≤ a) : ∀ (n : ℕ), 0 ≤ a ^ n
492+
@[simp] theorem pow_nonneg {a : R} (H : 0 ≤ a) : ∀ (n : ℕ), 0 ≤ a ^ n
493493
| 0 := zero_le_one
494494
| (n+1) := mul_nonneg H (pow_nonneg _)
495495

src/algebra/group_with_zero.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,9 @@ inv_involutive'.injective
510510
lemma inv_eq_iff {g h : G₀} : g⁻¹ = h ↔ h⁻¹ = g :=
511511
by rw [← inv_inj', eq_comm, inv_inv']
512512

513+
@[simp] lemma inv_eq_one' {g : G₀} : g⁻¹ = 1 ↔ g = 1 :=
514+
by rw [inv_eq_iff, inv_one, eq_comm]
515+
513516
end group_with_zero
514517

515518
namespace units

src/algebra/order.lean

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ h.lt_or_eq.symm
111111

112112
alias eq_or_lt_of_le ← has_le.le.eq_or_lt
113113

114+
lemma ne.le_iff_lt [partial_order α] {a b : α} (h : a ≠ b) : a ≤ b ↔ a < b :=
115+
⟨λ h', lt_of_le_of_ne h' h, λ h, h.le⟩
116+
114117
lemma lt_of_not_ge' [linear_order α] {a b : α} (h : ¬ b ≤ a) : a < b :=
115118
((le_total _ _).resolve_right h).lt_of_not_le h
116119

@@ -122,6 +125,9 @@ lemma le_of_not_lt [linear_order α] {a b : α} : ¬ a < b → b ≤ a := not_lt
122125
lemma lt_or_le [linear_order α] : ∀ a b : α, a < b ∨ b ≤ a := lt_or_ge
123126
lemma le_or_lt [linear_order α] : ∀ a b : α, a ≤ b ∨ b < a := le_or_gt
124127

128+
lemma ne.lt_or_lt [linear_order α] {a b : α} (h : a ≠ b) : a < b ∨ b < a :=
129+
lt_or_gt_of_ne h
130+
125131
lemma has_le.le.lt_or_le [linear_order α] {a b : α} (h : a ≤ b) (c : α) : a < c ∨ c ≤ b :=
126132
(lt_or_le a c).imp id $ λ hc, hc.trans h
127133

src/algebra/ordered_field.lean

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,18 @@ inv_eq_one_div a ▸ inv_nonneg
5858
lemma one_div_nonpos : 1 / a ≤ 0 ↔ a ≤ 0 :=
5959
inv_eq_one_div a ▸ inv_nonpos
6060

61+
lemma div_pos_iff : 0 < a / b ↔ 0 < a ∧ 0 < b ∨ a < 0 ∧ b < 0 :=
62+
by simp [division_def, mul_pos_iff]
63+
64+
lemma div_neg_iff : a / b < 00 < a ∧ b < 0 ∨ a < 00 < b :=
65+
by simp [division_def, mul_neg_iff]
66+
67+
lemma div_nonneg_iff : 0 ≤ a / b ↔ 0 ≤ a ∧ 0 ≤ b ∨ a ≤ 0 ∧ b ≤ 0 :=
68+
by simp [division_def, mul_nonneg_iff]
69+
70+
lemma div_nonpos_iff : a / b ≤ 00 ≤ a ∧ b ≤ 0 ∨ a ≤ 00 ≤ b :=
71+
by simp [division_def, mul_nonpos_iff]
72+
6173
lemma div_pos (ha : 0 < a) (hb : 0 < b) : 0 < a / b :=
6274
mul_pos ha (inv_pos.2 hb)
6375

@@ -240,6 +252,29 @@ by rwa [inv_le ((@zero_lt_one α _).trans_le ha) zero_lt_one, inv_one]
240252
lemma one_le_inv (h₁ : 0 < a) (h₂ : a ≤ 1) : 1 ≤ a⁻¹ :=
241253
by rwa [le_inv (@zero_lt_one α _) h₁, inv_one]
242254

255+
lemma inv_lt_one_iff_of_pos (h₀ : 0 < a) : a⁻¹ < 11 < a :=
256+
⟨λ h₁, inv_inv' a ▸ one_lt_inv (inv_pos.2 h₀) h₁, inv_lt_one⟩
257+
258+
lemma inv_lt_one_iff : a⁻¹ < 1 ↔ a ≤ 01 < a :=
259+
begin
260+
cases le_or_lt a 0 with ha ha,
261+
{ simp [ha, (inv_nonpos.2 ha).trans_lt zero_lt_one] },
262+
{ simp only [ha.not_le, false_or, inv_lt_one_iff_of_pos ha] }
263+
end
264+
265+
lemma one_lt_inv_iff : 1 < a⁻¹ ↔ 0 < a ∧ a < 1 :=
266+
⟨λ h, ⟨inv_pos.1 (zero_lt_one.trans h), inv_inv' a ▸ inv_lt_one h⟩, and_imp.2 one_lt_inv⟩
267+
268+
lemma inv_le_one_iff : a⁻¹ ≤ 1 ↔ a ≤ 01 ≤ a :=
269+
begin
270+
rcases em (a = 1) with (rfl|ha),
271+
{ simp [le_rfl] },
272+
{ simp only [ne.le_iff_lt (ne.symm ha), ne.le_iff_lt (mt inv_eq_one'.1 ha), inv_lt_one_iff] }
273+
end
274+
275+
lemma one_le_inv_iff : 1 ≤ a⁻¹ ↔ 0 < a ∧ a ≤ 1 :=
276+
⟨λ h, ⟨inv_pos.1 (zero_lt_one.trans_le h), inv_inv' a ▸ inv_le_one h⟩, and_imp.2 one_le_inv⟩
277+
243278
/-!
244279
### Relating two divisions.
245280
-/
@@ -368,6 +403,38 @@ by simpa using le_inv_of_neg ha hb
368403
lemma lt_one_div_of_neg (ha : a < 0) (hb : b < 0) : a < 1 / b ↔ b < 1 / a :=
369404
by simpa using lt_inv_of_neg ha hb
370405

406+
lemma one_lt_div_iff : 1 < a / b ↔ 0 < b ∧ b < a ∨ b < 0 ∧ a < b :=
407+
begin
408+
rcases lt_trichotomy b 0 with (hb|rfl|hb),
409+
{ simp [hb, hb.not_lt, one_lt_div_of_neg] },
410+
{ simp [lt_irrefl, zero_le_one] },
411+
{ simp [hb, hb.not_lt, one_lt_div] }
412+
end
413+
414+
lemma one_le_div_iff : 1 ≤ a / b ↔ 0 < b ∧ b ≤ a ∨ b < 0 ∧ a ≤ b :=
415+
begin
416+
rcases lt_trichotomy b 0 with (hb|rfl|hb),
417+
{ simp [hb, hb.not_lt, one_le_div_of_neg] },
418+
{ simp [lt_irrefl, zero_lt_one.not_le, zero_lt_one] },
419+
{ simp [hb, hb.not_lt, one_le_div] }
420+
end
421+
422+
lemma div_lt_one_iff : a / b < 10 < b ∧ a < b ∨ b = 0 ∨ b < 0 ∧ b < a :=
423+
begin
424+
rcases lt_trichotomy b 0 with (hb|rfl|hb),
425+
{ simp [hb, hb.not_lt, hb.ne, div_lt_one_of_neg] },
426+
{ simp [zero_lt_one], },
427+
{ simp [hb, hb.not_lt, div_lt_one, hb.ne.symm] }
428+
end
429+
430+
lemma div_le_one_iff : a / b ≤ 10 < b ∧ a ≤ b ∨ b = 0 ∨ b < 0 ∧ b ≤ a :=
431+
begin
432+
rcases lt_trichotomy b 0 with (hb|rfl|hb),
433+
{ simp [hb, hb.not_lt, hb.ne, div_le_one_of_neg] },
434+
{ simp [zero_le_one], },
435+
{ simp [hb, hb.not_lt, div_le_one, hb.ne.symm] }
436+
end
437+
371438
/-!
372439
### Relating two divisions, involving `1`
373440
-/

src/algebra/ordered_ring.lean

Lines changed: 59 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -197,17 +197,33 @@ le_of_not_gt
197197
have h2 : b * c < a * c, from mul_lt_mul_of_pos_right h1 hc,
198198
h2.not_le h)
199199

200-
lemma pos_of_mul_pos_left (h : 0 < a * b) (h1 : 0 ≤ a) : 0 < b :=
201-
lt_of_not_ge
202-
(assume h2 : b ≤ 0,
203-
have h3 : a * b ≤ 0, from mul_nonpos_of_nonneg_of_nonpos h1 h2,
204-
h3.not_lt h)
200+
lemma pos_and_pos_or_neg_and_neg_of_mul_pos (hab : 0 < a * b) :
201+
(0 < a ∧ 0 < b) ∨ (a < 0 ∧ b < 0) :=
202+
begin
203+
rcases lt_trichotomy 0 a with (ha|rfl|ha),
204+
{ refine or.inl ⟨ha, _⟩,
205+
contrapose! hab,
206+
exact mul_nonpos_of_nonneg_of_nonpos ha.le hab },
207+
{ rw [zero_mul] at hab, exact hab.false.elim },
208+
{ refine or.inr ⟨ha, _⟩,
209+
contrapose! hab,
210+
exact mul_nonpos_of_nonpos_of_nonneg ha.le hab }
211+
end
205212

206-
lemma pos_of_mul_pos_right (h : 0 < a * b) (h1 : 0 ≤ b) : 0 < a :=
207-
lt_of_not_ge
208-
(assume h2 : a ≤ 0,
209-
have h3 : a * b ≤ 0, from mul_nonpos_of_nonpos_of_nonneg h2 h1,
210-
h3.not_lt h)
213+
lemma nonneg_and_nonneg_or_nonpos_and_nonpos_of_mul_nnonneg (hab : 0 ≤ a * b) :
214+
(0 ≤ a ∧ 0 ≤ b) ∨ (a ≤ 0 ∧ b ≤ 0) :=
215+
begin
216+
contrapose! hab,
217+
rcases lt_trichotomy 0 a with (ha|rfl|ha),
218+
exacts [mul_neg_of_pos_of_neg ha (hab.1 ha.le), ((hab.1 le_rfl).asymm (hab.2 le_rfl)).elim,
219+
mul_neg_of_neg_of_pos ha (hab.2 ha.le)]
220+
end
221+
222+
lemma pos_of_mul_pos_left (h : 0 < a * b) (ha : 0 ≤ a) : 0 < b :=
223+
((pos_and_pos_or_neg_and_neg_of_mul_pos h).resolve_right $ λ h, h.1.not_le ha).2
224+
225+
lemma pos_of_mul_pos_right (h : 0 < a * b) (hb : 0 ≤ b) : 0 < a :=
226+
((pos_and_pos_or_neg_and_neg_of_mul_pos h).resolve_right $ λ h, h.2.not_le hb).1
211227

212228
lemma nonneg_of_mul_nonneg_left (h : 0 ≤ a * b) (h1 : 0 < a) : 0 ≤ b :=
213229
le_of_not_gt (assume h2 : b < 0, (mul_neg_of_pos_of_neg h1 h2).not_le h)
@@ -523,29 +539,37 @@ instance linear_ordered_ring.to_linear_ordered_semiring : linear_ordered_semirin
523539
le_total := linear_ordered_ring.le_total,
524540
..‹linear_ordered_ring α› }
525541

542+
@[priority 100] -- see Note [lower instance priority]
543+
instance linear_ordered_ring.to_domain : domain α :=
544+
{ eq_zero_or_eq_zero_of_mul_eq_zero :=
545+
begin
546+
intros a b hab,
547+
contrapose! hab,
548+
cases (lt_or_gt_of_ne hab.1) with ha ha; cases (lt_or_gt_of_ne hab.2) with hb hb,
549+
exacts [(mul_pos_of_neg_of_neg ha hb).ne.symm, (mul_neg_of_neg_of_pos ha hb).ne,
550+
(mul_neg_of_pos_of_neg ha hb).ne, (mul_pos ha hb).ne.symm]
551+
end,
552+
.. ‹linear_ordered_ring α› }
553+
554+
lemma mul_pos_iff : 0 < a * b ↔ 0 < a ∧ 0 < b ∨ a < 0 ∧ b < 0 :=
555+
⟨pos_and_pos_or_neg_and_neg_of_mul_pos,
556+
λ h, h.elim (and_imp.2 mul_pos) (and_imp.2 mul_pos_of_neg_of_neg)⟩
557+
558+
lemma mul_neg_iff : a * b < 00 < a ∧ b < 0 ∨ a < 00 < b :=
559+
by rw [← neg_pos, neg_mul_eq_mul_neg, mul_pos_iff, neg_pos, neg_lt_zero]
560+
561+
lemma mul_nonneg_iff : 0 ≤ a * b ↔ 0 ≤ a ∧ 0 ≤ b ∨ a ≤ 0 ∧ b ≤ 0 :=
562+
⟨nonneg_and_nonneg_or_nonpos_and_nonpos_of_mul_nnonneg,
563+
λ h, h.elim (and_imp.2 mul_nonneg) (and_imp.2 mul_nonneg_of_nonpos_of_nonpos)⟩
564+
565+
lemma mul_nonpos_iff : a * b ≤ 00 ≤ a ∧ b ≤ 0 ∨ a ≤ 00 ≤ b :=
566+
by rw [← neg_nonneg, neg_mul_eq_mul_neg, mul_nonneg_iff, neg_nonneg, neg_nonpos]
567+
526568
lemma mul_self_nonneg (a : α) : 0 ≤ a * a :=
527569
or.elim (le_total 0 a)
528570
(assume h : a ≥ 0, mul_nonneg h h)
529571
(assume h : a ≤ 0, mul_nonneg_of_nonpos_of_nonpos h h)
530572

531-
lemma pos_and_pos_or_neg_and_neg_of_mul_pos (hab : 0 < a * b) :
532-
(0 < a ∧ 0 < b) ∨ (a < 0 ∧ b < 0) :=
533-
match lt_trichotomy 0 a with
534-
| or.inl hlt₁ :=
535-
match lt_trichotomy 0 b with
536-
| or.inl hlt₂ := or.inl ⟨hlt₁, hlt₂⟩
537-
| or.inr (or.inl heq₂) := begin rw [← heq₂, mul_zero] at hab, exact absurd hab (lt_irrefl _) end
538-
| or.inr (or.inr hgt₂) := absurd hab (lt_asymm (mul_neg_of_pos_of_neg hlt₁ hgt₂))
539-
end
540-
| or.inr (or.inl heq₁) := begin rw [← heq₁, zero_mul] at hab, exact absurd hab (lt_irrefl _) end
541-
| or.inr (or.inr hgt₁) :=
542-
match lt_trichotomy 0 b with
543-
| or.inl hlt₂ := absurd hab (lt_asymm (mul_neg_of_neg_of_pos hgt₁ hlt₂))
544-
| or.inr (or.inl heq₂) := begin rw [← heq₂, mul_zero] at hab, exact absurd hab (lt_irrefl _) end
545-
| or.inr (or.inr hgt₂) := or.inr ⟨hgt₁, hgt₂⟩
546-
end
547-
end
548-
549573
lemma gt_of_mul_lt_mul_neg_left (h : c * a < c * b) (hc : c ≤ 0) : b < a :=
550574
have nhc : 0 ≤ -c, from neg_nonneg_of_nonpos hc,
551575
have h2 : -(c * b) < -(c * a), from neg_lt_neg h,
@@ -555,7 +579,6 @@ have h3 : (-c) * b < (-c) * a, from calc
555579
... = (-c) * a : by rewrite neg_mul_eq_neg_mul,
556580
lt_of_mul_lt_mul_left h3 nhc
557581

558-
559582
lemma neg_one_lt_zero : -1 < (0:α) :=
560583
begin
561584
have this := neg_lt_neg (@zero_lt_one α _),
@@ -579,44 +602,13 @@ lemma mul_self_lt_mul_self_iff {a b : α} (h1 : 0 ≤ a) (h2 : 0 ≤ b) : a < b
579602
iff.trans (lt_iff_not_ge _ _) $ iff.trans (not_iff_not_of_iff $ mul_self_le_mul_self_iff h2 h1) $
580603
iff.symm (lt_iff_not_ge _ _)
581604

582-
lemma linear_ordered_ring.eq_zero_or_eq_zero_of_mul_eq_zero
583-
{a b : α} (h : a * b = 0) : a = 0 ∨ b = 0 :=
584-
match lt_trichotomy 0 a with
585-
| or.inl hlt₁ :=
586-
match lt_trichotomy 0 b with
587-
| or.inl hlt₂ :=
588-
have 0 < a * b, from mul_pos hlt₁ hlt₂,
589-
begin rw h at this, exact absurd this (lt_irrefl _) end
590-
| or.inr (or.inl heq₂) := or.inr heq₂.symm
591-
| or.inr (or.inr hgt₂) :=
592-
have 0 > a * b, from mul_neg_of_pos_of_neg hlt₁ hgt₂,
593-
begin rw h at this, exact absurd this (lt_irrefl _) end
594-
end
595-
| or.inr (or.inl heq₁) := or.inl heq₁.symm
596-
| or.inr (or.inr hgt₁) :=
597-
match lt_trichotomy 0 b with
598-
| or.inl hlt₂ :=
599-
have 0 > a * b, from mul_neg_of_neg_of_pos hgt₁ hlt₂,
600-
begin rw h at this, exact absurd this (lt_irrefl _) end
601-
| or.inr (or.inl heq₂) := or.inr heq₂.symm
602-
| or.inr (or.inr hgt₂) :=
603-
have 0 < a * b, from mul_pos_of_neg_of_neg hgt₁ hgt₂,
604-
begin rw h at this, exact absurd this (lt_irrefl _) end
605-
end
606-
end
607-
608605
/- TODO This theorem ought to be written in the context of `nontrivial` linearly ordered (additive)
609606
commutative groups rather than linearly ordered rings; however, the former concept does not
610607
currently exist in mathlib. -/
611608
@[priority 100] -- see Note [lower instance priority]
612609
instance linear_ordered_ring.to_no_bot_order : no_bot_order α :=
613610
⟨assume a, ⟨a - 1, sub_lt_iff_lt_add.mpr $ lt_add_of_pos_right _ zero_lt_one⟩⟩
614611

615-
@[priority 100] -- see Note [lower instance priority]
616-
instance linear_ordered_ring.to_domain : domain α :=
617-
{ eq_zero_or_eq_zero_of_mul_eq_zero := @linear_ordered_ring.eq_zero_or_eq_zero_of_mul_eq_zero α _,
618-
..‹linear_ordered_ring α› }
619-
620612
@[simp] lemma mul_le_mul_left_of_neg {a b c : α} (h : c < 0) : c * a ≤ c * b ↔ b ≤ a :=
621613
⟨le_imp_le_of_lt_imp_lt $ λ h', mul_lt_mul_of_neg_left h' h,
622614
λ h', mul_le_mul_of_nonpos_left h' h.le⟩
@@ -675,9 +667,9 @@ such that multiplication with a positive number and addition are monotone. -/
675667
class linear_ordered_comm_ring (α : Type u) extends linear_ordered_ring α, comm_monoid α
676668

677669
@[priority 100] -- see Note [lower instance priority]
678-
instance linear_ordered_comm_ring.to_integral_domain [s: linear_ordered_comm_ring α] : integral_domain α :=
679-
{ eq_zero_or_eq_zero_of_mul_eq_zero := @linear_ordered_ring.eq_zero_or_eq_zero_of_mul_eq_zero α _,
680-
..s }
670+
instance linear_ordered_comm_ring.to_integral_domain [s: linear_ordered_comm_ring α] :
671+
integral_domain α :=
672+
{ ..s, .. linear_ordered_ring.to_domain }
681673

682674
/-- A `decidable_linear_ordered_comm_ring α` is a commutative ring `α` with a
683675
decidable linear order such that multiplication with a positive number and
@@ -786,17 +778,14 @@ begin
786778
apply sub_le_sub_left,
787779
iterate {rw mul_assoc},
788780
apply mul_le_mul_of_nonneg_left,
789-
rw [← abs_mul],
790-
apply le_abs_self,
791-
apply le_of_lt,
792-
apply add_pos,
793-
apply zero_lt_one,
794-
apply zero_lt_one
781+
{ rw [← abs_mul],
782+
apply le_abs_self },
783+
{ exact (add_pos (@zero_lt_one α _) zero_lt_one).le }
795784
end
796785

797786
-- The proof doesn't need commutativity but we have no `decidable_linear_ordered_ring`
798787
@[simp] lemma abs_two : abs (2:α) = 2 :=
799-
abs_of_pos $ by refine zero_lt_two
788+
abs_of_pos zero_lt_two
800789

801790
end decidable_linear_ordered_comm_ring
802791

src/analysis/hofer.lean

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ begin
4848
choose! F hF using H, -- Use the axiom of choice
4949
-- Now define u by induction starting at x, with u_{n+1} = F(n, u_n)
5050
let u : ℕ → X := λ n, nat.rec_on n x F,
51+
have hu0 : u 0 = x := rfl,
5152
-- The properties of F translate to properties of u
5253
have hu :
5354
∀ n,
@@ -56,14 +57,12 @@ begin
5657
{ intro n,
5758
exact hF n (u n) },
5859
clear hF,
59-
6060
-- Key properties of u, to be proven by induction
6161
have key : ∀ n, d (u n) (u (n + 1)) ≤ ε / 2 ^ n ∧ 2 * ϕ (u n) < ϕ (u (n + 1)),
6262
{ intro n,
6363
induction n using nat.case_strong_induction_on with n IH,
6464
{ specialize hu 0,
65-
simp [show u 0 = x, from rfl, le_refl] at *,
66-
exact hu (by linarith) },
65+
simpa [hu0, mul_nonneg_iff, zero_le_one, ε_pos.le] using hu },
6766
have A : d (u (n+1)) x ≤ 2 * ε,
6867
{ rw [dist_comm],
6968
let r := range (n+1), -- range (n+1) = {0, ..., n}
@@ -82,18 +81,15 @@ begin
8281
exact hu (n+1) ⟨A, B⟩, },
8382
cases forall_and_distrib.mp key with key₁ key₂,
8483
clear hu key,
85-
8684
-- Hence u is Cauchy
8785
have cauchy_u : cauchy_seq u,
8886
{ apply cauchy_seq_of_le_geometric _ ε (by norm_num : 1/(2:ℝ) < 1),
8987
intro n,
9088
convert key₁ n,
9189
simp },
92-
9390
-- So u converges to some y
9491
obtain ⟨y, limy⟩ : ∃ y, tendsto u at_top (𝓝 y),
9592
from complete_space.complete cauchy_u,
96-
9793
-- And ϕ ∘ u goes to +∞
9894
have lim_top : tendsto (ϕ ∘ u) at_top at_top,
9995
{ let v := λ n, (ϕ ∘ u) (n+1),
@@ -105,11 +101,9 @@ begin
105101
... < ϕ (u (0 + 1)) : key₂ 0 },
106102
apply tendsto_at_top_of_geom_lt hv₀ (by norm_num : (1 : ℝ) < 2),
107103
exact λ n, key₂ (n+1) },
108-
109104
-- But ϕ ∘ u also needs to go to ϕ(y)
110105
have lim : tendsto (ϕ ∘ u) at_top (𝓝 (ϕ y)),
111106
from tendsto.comp cont.continuous_at limy,
112-
113107
-- So we have our contradiction!
114108
exact not_tendsto_at_top_of_tendsto_nhds lim lim_top,
115109
end

src/data/int/basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ by rw [← int.coe_nat_zero, coe_nat_inj']
100100
theorem coe_nat_ne_zero {n : ℕ} : (n : ℤ) ≠ 0 ↔ n ≠ 0 :=
101101
not_congr coe_nat_eq_zero
102102

103-
lemma coe_nat_nonneg (n : ℕ) : 0 ≤ (n : ℤ) := coe_nat_le.2 (nat.zero_le _)
103+
@[simp] lemma coe_nat_nonneg (n : ℕ) : 0 ≤ (n : ℤ) := coe_nat_le.2 (nat.zero_le _)
104104

105105
lemma coe_nat_ne_zero_iff_pos {n : ℕ} : (n : ℤ) ≠ 00 < n :=
106106
⟨λ h, nat.pos_of_ne_zero (coe_nat_ne_zero.1 h),

0 commit comments

Comments
 (0)