2015-06-09 05:39:28 +00:00
|
|
|
|
/-
|
|
|
|
|
Copyright (c) 2015 Robert Y. Lewis. All rights reserved.
|
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
Author: Robert Y. Lewis
|
|
|
|
|
The real numbers, constructed as equivalence classes of Cauchy sequences of rationals.
|
|
|
|
|
This construction follows Bishop and Bridges (1985).
|
|
|
|
|
|
|
|
|
|
At this point, we no longer proceed constructively: this file makes heavy use of decidability,
|
2015-09-14 17:39:42 +00:00
|
|
|
|
excluded middle, and Hilbert choice. Two sets of definitions of Cauchy sequences, convergence,
|
2015-09-15 22:56:26 +00:00
|
|
|
|
etc are available in the libray, one with rates and one without. The definitions here, with rates,
|
|
|
|
|
are amenable to be used constructively if and when that development takes place. The second set of
|
|
|
|
|
definitions available in /library/theories/analysis/metric_space.lean are the usual classical ones.
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
Here, we show that ℝ is complete. The proofs of Cauchy completeness and the supremum property
|
|
|
|
|
are independent of each other.
|
2015-06-09 05:39:28 +00:00
|
|
|
|
-/
|
2015-06-10 02:46:30 +00:00
|
|
|
|
|
2015-06-16 06:55:06 +00:00
|
|
|
|
import data.real.basic data.real.order data.real.division data.rat data.nat data.pnat
|
2015-10-23 12:54:32 +00:00
|
|
|
|
open rat algebra
|
2015-10-13 19:59:57 +00:00
|
|
|
|
local postfix ⁻¹ := pnat.inv
|
2015-08-13 00:06:15 +00:00
|
|
|
|
open eq.ops pnat classical
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-09-11 03:00:18 +00:00
|
|
|
|
namespace rat_seq
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-09-11 03:00:18 +00:00
|
|
|
|
theorem rat_approx {s : seq} (H : regular s) :
|
2015-06-09 05:39:28 +00:00
|
|
|
|
∀ n : ℕ+, ∃ q : ℚ, ∃ N : ℕ+, ∀ m : ℕ+, m ≥ N → abs (s m - q) ≤ n⁻¹ :=
|
|
|
|
|
begin
|
|
|
|
|
intro n,
|
|
|
|
|
existsi (s (2 * n)),
|
|
|
|
|
existsi 2 * n,
|
|
|
|
|
intro m Hm,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply le.trans,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
apply H,
|
2015-06-16 04:55:02 +00:00
|
|
|
|
rewrite -(add_halves n),
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply algebra.add_le_add_right,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
apply inv_ge_of_le Hm
|
|
|
|
|
end
|
|
|
|
|
|
2015-09-11 03:00:18 +00:00
|
|
|
|
theorem rat_approx_seq {s : seq} (H : regular s) :
|
2015-06-10 02:46:30 +00:00
|
|
|
|
∀ n : ℕ+, ∃ q : ℚ, s_le (s_abs (sadd s (sneg (const q)))) (const n⁻¹) :=
|
2015-06-09 05:39:28 +00:00
|
|
|
|
begin
|
|
|
|
|
intro m,
|
|
|
|
|
rewrite ↑s_le,
|
2015-09-11 03:00:18 +00:00
|
|
|
|
cases rat_approx H m with [q, Hq],
|
2015-08-03 19:02:03 +00:00
|
|
|
|
cases Hq with [N, HN],
|
2015-06-09 05:39:28 +00:00
|
|
|
|
existsi q,
|
|
|
|
|
apply nonneg_of_bdd_within,
|
|
|
|
|
repeat (apply reg_add_reg | apply reg_neg_reg | apply abs_reg_of_reg | apply const_reg
|
|
|
|
|
| assumption),
|
|
|
|
|
intro n,
|
|
|
|
|
existsi N,
|
|
|
|
|
intro p Hp,
|
|
|
|
|
rewrite ↑[sadd, sneg, s_abs, const],
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply le.trans,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
rotate 1,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
rewrite -sub_eq_add_neg,
|
|
|
|
|
apply algebra.sub_le_sub_left,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
apply HN,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply pnat.le_trans,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
apply Hp,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
rewrite -*pnat.mul_assoc,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
apply pnat.mul_le_mul_left,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
rewrite [algebra.sub_self, -neg_zero],
|
2015-06-09 05:39:28 +00:00
|
|
|
|
apply neg_le_neg,
|
|
|
|
|
apply rat.le_of_lt,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply pnat.inv_pos
|
2015-06-09 05:39:28 +00:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
theorem r_rat_approx (s : reg_seq) :
|
2015-06-10 02:46:30 +00:00
|
|
|
|
∀ n : ℕ+, ∃ q : ℚ, r_le (r_abs (radd s (rneg (r_const q)))) (r_const n⁻¹) :=
|
2015-09-11 03:00:18 +00:00
|
|
|
|
rat_approx_seq (reg_seq.is_reg s)
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-06-23 12:17:50 +00:00
|
|
|
|
theorem const_bound {s : seq} (Hs : regular s) (n : ℕ+) :
|
|
|
|
|
s_le (s_abs (sadd s (sneg (const (s n))))) (const n⁻¹) :=
|
2015-06-09 05:39:28 +00:00
|
|
|
|
begin
|
|
|
|
|
rewrite ↑[s_le, nonneg, s_abs, sadd, sneg, const],
|
|
|
|
|
intro m,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
rewrite -sub_eq_add_neg,
|
|
|
|
|
apply iff.mp !le_add_iff_neg_le_sub_left,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply le.trans,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
apply Hs,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply algebra.add_le_add_right,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
rewrite -*pnat.mul_assoc,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
apply inv_ge_of_le,
|
|
|
|
|
apply pnat.mul_le_mul_left
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
theorem abs_const (a : ℚ) : const (abs a) ≡ s_abs (const a) :=
|
2015-08-03 19:02:03 +00:00
|
|
|
|
by apply equiv.refl
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
|
|
|
|
theorem r_abs_const (a : ℚ) : requiv (r_const (abs a) ) (r_abs (r_const a)) := abs_const a
|
|
|
|
|
|
|
|
|
|
theorem equiv_abs_of_ge_zero {s : seq} (Hs : regular s) (Hz : s_le zero s) : s_abs s ≡ s :=
|
2015-06-10 02:46:30 +00:00
|
|
|
|
begin
|
2015-06-09 05:39:28 +00:00
|
|
|
|
apply eq_of_bdd,
|
|
|
|
|
apply abs_reg_of_reg Hs,
|
|
|
|
|
apply Hs,
|
|
|
|
|
intro j,
|
|
|
|
|
rewrite ↑s_abs,
|
|
|
|
|
let Hz' := s_nonneg_of_ge_zero Hs Hz,
|
|
|
|
|
existsi 2 * j,
|
|
|
|
|
intro n Hn,
|
2015-08-03 19:02:03 +00:00
|
|
|
|
cases em (s n ≥ 0) with [Hpos, Hneg],
|
2015-10-13 19:59:57 +00:00
|
|
|
|
rewrite [abs_of_nonneg Hpos, algebra.sub_self, abs_zero],
|
2015-06-09 05:39:28 +00:00
|
|
|
|
apply rat.le_of_lt,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply pnat.inv_pos,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
let Hneg' := lt_of_not_ge Hneg,
|
2015-06-10 02:46:30 +00:00
|
|
|
|
have Hsn : -s n - s n > 0, from add_pos (neg_pos_of_neg Hneg') (neg_pos_of_neg Hneg'),
|
2015-10-13 19:59:57 +00:00
|
|
|
|
rewrite [abs_of_neg Hneg', abs_of_pos Hsn],
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply le.trans,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply add_le_add,
|
|
|
|
|
repeat (apply neg_le_neg; apply Hz'),
|
2015-10-23 12:54:32 +00:00
|
|
|
|
rewrite neg_neg,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply le.trans,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply add_le_add,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
repeat (apply inv_ge_of_le; apply Hn),
|
2015-10-13 22:09:02 +00:00
|
|
|
|
krewrite pnat.add_halves,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply le.refl
|
2015-06-09 05:39:28 +00:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
theorem equiv_neg_abs_of_le_zero {s : seq} (Hs : regular s) (Hz : s_le s zero) : s_abs s ≡ sneg s :=
|
|
|
|
|
begin
|
|
|
|
|
apply eq_of_bdd,
|
|
|
|
|
apply abs_reg_of_reg Hs,
|
|
|
|
|
apply reg_neg_reg Hs,
|
|
|
|
|
intro j,
|
|
|
|
|
rewrite [↑s_abs, ↑s_le at Hz],
|
|
|
|
|
have Hz' : nonneg (sneg s), begin
|
|
|
|
|
apply nonneg_of_nonneg_equiv,
|
|
|
|
|
rotate 3,
|
|
|
|
|
apply Hz,
|
|
|
|
|
rotate 2,
|
|
|
|
|
apply s_zero_add,
|
|
|
|
|
repeat (apply Hs | apply zero_is_reg | apply reg_neg_reg | apply reg_add_reg)
|
|
|
|
|
end,
|
|
|
|
|
existsi 2 * j,
|
|
|
|
|
intro n Hn,
|
2015-08-03 19:02:03 +00:00
|
|
|
|
cases em (s n ≥ 0) with [Hpos, Hneg],
|
2015-06-09 05:39:28 +00:00
|
|
|
|
have Hsn : s n + s n ≥ 0, from add_nonneg Hpos Hpos,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
rewrite [abs_of_nonneg Hpos, ↑sneg, sub_neg_eq_add, abs_of_nonneg Hsn],
|
2015-06-09 05:39:28 +00:00
|
|
|
|
rewrite [↑nonneg at Hz', ↑sneg at Hz'],
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply le.trans,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply add_le_add,
|
|
|
|
|
repeat apply (le_of_neg_le_neg !Hz'),
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply le.trans,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply add_le_add,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
repeat (apply inv_ge_of_le; apply Hn),
|
2015-10-13 22:09:02 +00:00
|
|
|
|
krewrite pnat.add_halves,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply le.refl,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
let Hneg' := lt_of_not_ge Hneg,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
rewrite [abs_of_neg Hneg', ↑sneg, sub_neg_eq_add, neg_add_eq_sub, algebra.sub_self,
|
2015-06-10 02:46:30 +00:00
|
|
|
|
abs_zero],
|
2015-06-09 05:39:28 +00:00
|
|
|
|
apply rat.le_of_lt,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply pnat.inv_pos
|
2015-06-09 05:39:28 +00:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
theorem r_equiv_abs_of_ge_zero {s : reg_seq} (Hz : r_le r_zero s) : requiv (r_abs s) s :=
|
2015-06-10 02:46:30 +00:00
|
|
|
|
equiv_abs_of_ge_zero (reg_seq.is_reg s) Hz
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
|
|
|
|
theorem r_equiv_neg_abs_of_le_zero {s : reg_seq} (Hz : r_le s r_zero) : requiv (r_abs s) (-s) :=
|
|
|
|
|
equiv_neg_abs_of_le_zero (reg_seq.is_reg s) Hz
|
|
|
|
|
|
2015-09-11 03:00:18 +00:00
|
|
|
|
end rat_seq
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
|
|
|
|
namespace real
|
2015-09-11 03:00:18 +00:00
|
|
|
|
open [classes] rat_seq
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-09-11 03:00:18 +00:00
|
|
|
|
private theorem rewrite_helper9 (a b c : ℝ) : b - c = (b - a) - (c - a) :=
|
2015-10-13 19:59:57 +00:00
|
|
|
|
by rewrite [-sub_add_eq_sub_sub_swap, algebra.sub_add_cancel]
|
2015-06-23 12:17:50 +00:00
|
|
|
|
|
2015-09-11 03:00:18 +00:00
|
|
|
|
private theorem rewrite_helper10 (a b c d : ℝ) : c - d = (c - a) + (a - b) + (b - d) :=
|
2015-10-13 19:59:57 +00:00
|
|
|
|
by rewrite [*add_sub, *algebra.sub_add_cancel]
|
2015-06-23 12:17:50 +00:00
|
|
|
|
|
2015-09-11 03:00:18 +00:00
|
|
|
|
noncomputable definition rep (x : ℝ) : rat_seq.reg_seq := some (quot.exists_rep x)
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-07-29 15:28:40 +00:00
|
|
|
|
definition re_abs (x : ℝ) : ℝ :=
|
2015-10-23 12:54:32 +00:00
|
|
|
|
quot.lift_on x (λ a, quot.mk (rat_seq.r_abs a))
|
|
|
|
|
(take a b Hab, quot.sound (rat_seq.r_abs_well_defined Hab))
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-06-24 07:14:31 +00:00
|
|
|
|
theorem r_abs_nonneg {x : ℝ} : zero ≤ x → re_abs x = x :=
|
2015-09-11 03:00:18 +00:00
|
|
|
|
quot.induction_on x (λ a Ha, quot.sound (rat_seq.r_equiv_abs_of_ge_zero Ha))
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-06-24 07:14:31 +00:00
|
|
|
|
theorem r_abs_nonpos {x : ℝ} : x ≤ zero → re_abs x = -x :=
|
2015-09-11 03:00:18 +00:00
|
|
|
|
quot.induction_on x (λ a Ha, quot.sound (rat_seq.r_equiv_neg_abs_of_le_zero Ha))
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-10-23 12:54:32 +00:00
|
|
|
|
private theorem abs_const' (a : ℚ) : of_rat (abs a) = re_abs (of_rat a) :=
|
|
|
|
|
quot.sound (rat_seq.r_abs_const a)
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-10-13 19:59:57 +00:00
|
|
|
|
private theorem re_abs_is_abs : re_abs = abs := funext
|
2015-06-09 05:39:28 +00:00
|
|
|
|
(begin
|
|
|
|
|
intro x,
|
|
|
|
|
apply eq.symm,
|
2015-08-03 19:02:03 +00:00
|
|
|
|
cases em (zero ≤ x) with [Hor1, Hor2],
|
2015-06-24 07:14:31 +00:00
|
|
|
|
rewrite [abs_of_nonneg Hor1, r_abs_nonneg Hor1],
|
2015-10-13 19:59:57 +00:00
|
|
|
|
have Hor2' : x ≤ zero, from algebra.le_of_lt (lt_of_not_ge Hor2),
|
2015-06-24 07:14:31 +00:00
|
|
|
|
rewrite [abs_of_neg (lt_of_not_ge Hor2), r_abs_nonpos Hor2']
|
2015-06-09 05:39:28 +00:00
|
|
|
|
end)
|
|
|
|
|
|
2015-10-13 19:59:57 +00:00
|
|
|
|
theorem abs_const (a : ℚ) : of_rat (abs a) = abs (of_rat a) :=
|
|
|
|
|
by rewrite -re_abs_is_abs
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-09-11 03:00:18 +00:00
|
|
|
|
private theorem rat_approx' (x : ℝ) : ∀ n : ℕ+, ∃ q : ℚ, re_abs (x - of_rat q) ≤ of_rat n⁻¹ :=
|
|
|
|
|
quot.induction_on x (λ s n, rat_seq.r_rat_approx s n)
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-07-16 17:18:35 +00:00
|
|
|
|
theorem rat_approx (x : ℝ) : ∀ n : ℕ+, ∃ q : ℚ, abs (x - of_rat q) ≤ of_rat n⁻¹ :=
|
2015-06-09 05:39:28 +00:00
|
|
|
|
by rewrite -re_abs_is_abs; apply rat_approx'
|
|
|
|
|
|
2015-07-29 04:56:35 +00:00
|
|
|
|
noncomputable definition approx (x : ℝ) (n : ℕ+) := some (rat_approx x n)
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-07-16 17:18:35 +00:00
|
|
|
|
theorem approx_spec (x : ℝ) (n : ℕ+) : abs (x - (of_rat (approx x n))) ≤ of_rat n⁻¹ :=
|
2015-06-09 05:39:28 +00:00
|
|
|
|
some_spec (rat_approx x n)
|
|
|
|
|
|
2015-07-16 17:18:35 +00:00
|
|
|
|
theorem approx_spec' (x : ℝ) (n : ℕ+) : abs ((of_rat (approx x n)) - x) ≤ of_rat n⁻¹ :=
|
2015-06-24 07:14:31 +00:00
|
|
|
|
by rewrite abs_sub; apply approx_spec
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
|
|
|
|
notation `r_seq` := ℕ+ → ℝ
|
|
|
|
|
|
2015-09-13 00:35:43 +00:00
|
|
|
|
noncomputable definition converges_to_with_rate (X : r_seq) (a : ℝ) (N : ℕ+ → ℕ+) :=
|
2015-07-16 17:18:35 +00:00
|
|
|
|
∀ k : ℕ+, ∀ n : ℕ+, n ≥ N k → abs (X n - a) ≤ of_rat k⁻¹
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-09-13 00:35:43 +00:00
|
|
|
|
noncomputable definition cauchy_with_rate (X : r_seq) (M : ℕ+ → ℕ+) :=
|
2015-07-16 17:18:35 +00:00
|
|
|
|
∀ k : ℕ+, ∀ m n : ℕ+, m ≥ M k → n ≥ M k → abs (X m - X n) ≤ of_rat k⁻¹
|
2015-06-23 12:17:50 +00:00
|
|
|
|
|
2015-09-13 00:35:43 +00:00
|
|
|
|
theorem cauchy_with_rate_of_converges_to_with_rate {X : r_seq} {a : ℝ} {N : ℕ+ → ℕ+}
|
|
|
|
|
(Hc : converges_to_with_rate X a N) :
|
|
|
|
|
cauchy_with_rate X (λ k, N (2 * k)) :=
|
2015-06-09 05:39:28 +00:00
|
|
|
|
begin
|
2015-06-10 02:46:30 +00:00
|
|
|
|
intro k m n Hm Hn,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
rewrite (rewrite_helper9 a),
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply algebra.le.trans,
|
2015-06-24 07:14:31 +00:00
|
|
|
|
apply abs_add_le_abs_add_abs,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply algebra.le.trans,
|
2015-06-24 07:14:31 +00:00
|
|
|
|
apply add_le_add,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
apply Hc,
|
|
|
|
|
apply Hm,
|
2015-06-24 07:14:31 +00:00
|
|
|
|
krewrite abs_neg,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
apply Hc,
|
|
|
|
|
apply Hn,
|
2015-09-13 00:04:57 +00:00
|
|
|
|
xrewrite -of_rat_add,
|
2015-07-16 17:18:35 +00:00
|
|
|
|
apply of_rat_le_of_rat_of_le,
|
2015-10-13 22:09:02 +00:00
|
|
|
|
krewrite pnat.add_halves,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply rat.le_refl
|
2015-06-09 05:39:28 +00:00
|
|
|
|
end
|
|
|
|
|
|
2015-09-11 03:00:18 +00:00
|
|
|
|
private definition Nb (M : ℕ+ → ℕ+) := λ k, pnat.max (3 * k) (M (2 * k))
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-10-23 02:18:14 +00:00
|
|
|
|
private theorem Nb_spec_right (M : ℕ+ → ℕ+) (k : ℕ+) : M (2 * k) ≤ Nb M k := !pnat.max_right
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-10-23 02:18:14 +00:00
|
|
|
|
private theorem Nb_spec_left (M : ℕ+ → ℕ+) (k : ℕ+) : 3 * k ≤ Nb M k := !pnat.max_left
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-08-03 15:12:56 +00:00
|
|
|
|
section lim_seq
|
|
|
|
|
parameter {X : r_seq}
|
|
|
|
|
parameter {M : ℕ+ → ℕ+}
|
2015-09-13 00:35:43 +00:00
|
|
|
|
hypothesis Hc : cauchy_with_rate X M
|
2015-08-03 15:12:56 +00:00
|
|
|
|
include Hc
|
|
|
|
|
|
|
|
|
|
noncomputable definition lim_seq : ℕ+ → ℚ :=
|
2015-06-09 05:39:28 +00:00
|
|
|
|
λ k, approx (X (Nb M k)) (2 * k)
|
|
|
|
|
|
2015-09-11 03:00:18 +00:00
|
|
|
|
private theorem lim_seq_reg_helper {m n : ℕ+} (Hmn : M (2 * n) ≤M (2 * m)) :
|
2015-08-03 15:12:56 +00:00
|
|
|
|
abs (of_rat (lim_seq m) - X (Nb M m)) + abs (X (Nb M m) - X (Nb M n)) + abs
|
|
|
|
|
(X (Nb M n) - of_rat (lim_seq n)) ≤ of_rat (m⁻¹ + n⁻¹) :=
|
2015-06-09 05:39:28 +00:00
|
|
|
|
begin
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply algebra.le.trans,
|
2015-06-24 07:14:31 +00:00
|
|
|
|
apply add_le_add_three,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
apply approx_spec',
|
|
|
|
|
rotate 1,
|
|
|
|
|
apply approx_spec,
|
|
|
|
|
rotate 1,
|
|
|
|
|
apply Hc,
|
|
|
|
|
rotate 1,
|
|
|
|
|
apply Nb_spec_right,
|
|
|
|
|
rotate 1,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply pnat.le_trans,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
apply Hmn,
|
|
|
|
|
apply Nb_spec_right,
|
2015-10-13 22:09:02 +00:00
|
|
|
|
krewrite [-+of_rat_add],
|
|
|
|
|
change of_rat ((2 * m)⁻¹ + (2 * n)⁻¹ + (2 * n)⁻¹) ≤ of_rat (m⁻¹ + n⁻¹),
|
|
|
|
|
rewrite [algebra.add.assoc],
|
|
|
|
|
krewrite pnat.add_halves,
|
2015-07-16 17:18:35 +00:00
|
|
|
|
apply of_rat_le_of_rat_of_le,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply add_le_add_right,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
apply inv_ge_of_le,
|
|
|
|
|
apply pnat.mul_le_mul_left
|
|
|
|
|
end
|
|
|
|
|
|
2015-09-11 03:00:18 +00:00
|
|
|
|
theorem lim_seq_reg : rat_seq.regular lim_seq :=
|
2015-06-09 05:39:28 +00:00
|
|
|
|
begin
|
2015-09-11 03:00:18 +00:00
|
|
|
|
rewrite ↑rat_seq.regular,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
intro m n,
|
2015-09-13 00:04:57 +00:00
|
|
|
|
apply le_of_of_rat_le_of_rat,
|
|
|
|
|
rewrite [abs_const, of_rat_sub, (rewrite_helper10 (X (Nb M m)) (X (Nb M n)))],
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply algebra.le.trans,
|
2015-06-24 07:14:31 +00:00
|
|
|
|
apply abs_add_three,
|
2015-08-03 19:02:03 +00:00
|
|
|
|
cases em (M (2 * m) ≥ M (2 * n)) with [Hor1, Hor2],
|
2015-08-03 15:12:56 +00:00
|
|
|
|
apply lim_seq_reg_helper Hor1,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
let Hor2' := pnat.le_of_lt (pnat.lt_of_not_le Hor2),
|
2015-10-13 22:09:02 +00:00
|
|
|
|
krewrite [abs_sub (X (Nb M n)), abs_sub (X (Nb M m)), abs_sub,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
rat.add_comm, add_comm_three],
|
2015-08-03 15:12:56 +00:00
|
|
|
|
apply lim_seq_reg_helper Hor2'
|
2015-06-09 05:39:28 +00:00
|
|
|
|
end
|
|
|
|
|
|
2015-08-03 15:12:56 +00:00
|
|
|
|
theorem lim_seq_spec (k : ℕ+) :
|
2015-09-13 00:35:43 +00:00
|
|
|
|
rat_seq.s_le (rat_seq.s_abs (rat_seq.sadd lim_seq
|
|
|
|
|
(rat_seq.sneg (rat_seq.const (lim_seq k))))) (rat_seq.const k⁻¹) :=
|
2015-09-11 03:00:18 +00:00
|
|
|
|
by apply rat_seq.const_bound; apply lim_seq_reg
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-09-11 03:00:18 +00:00
|
|
|
|
private noncomputable definition r_lim_seq : rat_seq.reg_seq :=
|
|
|
|
|
rat_seq.reg_seq.mk lim_seq lim_seq_reg
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-09-11 03:00:18 +00:00
|
|
|
|
private theorem r_lim_seq_spec (k : ℕ+) : rat_seq.r_le
|
2015-09-13 00:35:43 +00:00
|
|
|
|
(rat_seq.r_abs ((rat_seq.radd r_lim_seq (rat_seq.rneg
|
|
|
|
|
(rat_seq.r_const ((rat_seq.reg_seq.sq r_lim_seq) k))))))
|
2015-09-11 03:00:18 +00:00
|
|
|
|
(rat_seq.r_const k⁻¹) :=
|
2015-08-03 15:12:56 +00:00
|
|
|
|
lim_seq_spec k
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-08-03 15:12:56 +00:00
|
|
|
|
noncomputable definition lim : ℝ :=
|
|
|
|
|
quot.mk r_lim_seq
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-08-03 15:12:56 +00:00
|
|
|
|
theorem re_lim_spec (k : ℕ+) : re_abs (lim - (of_rat (lim_seq k))) ≤ of_rat k⁻¹ :=
|
|
|
|
|
r_lim_seq_spec k
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-08-03 15:12:56 +00:00
|
|
|
|
theorem lim_spec' (k : ℕ+) : abs (lim - (of_rat (lim_seq k))) ≤ of_rat k⁻¹ :=
|
2015-06-09 05:39:28 +00:00
|
|
|
|
by rewrite -re_abs_is_abs; apply re_lim_spec
|
|
|
|
|
|
2015-08-03 15:12:56 +00:00
|
|
|
|
theorem lim_spec (k : ℕ+) :
|
|
|
|
|
abs ((of_rat (lim_seq k)) - lim) ≤ of_rat k⁻¹ :=
|
2015-06-24 07:14:31 +00:00
|
|
|
|
by rewrite abs_sub; apply lim_spec'
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-09-13 00:35:43 +00:00
|
|
|
|
theorem converges_to_with_rate_of_cauchy_with_rate : converges_to_with_rate X lim (Nb M) :=
|
2015-06-09 05:39:28 +00:00
|
|
|
|
begin
|
|
|
|
|
intro k n Hn,
|
2015-08-03 15:12:56 +00:00
|
|
|
|
rewrite (rewrite_helper10 (X (Nb M n)) (of_rat (lim_seq n))),
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply algebra.le.trans,
|
2015-06-24 07:14:31 +00:00
|
|
|
|
apply abs_add_three,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply algebra.le.trans,
|
2015-06-24 07:14:31 +00:00
|
|
|
|
apply add_le_add_three,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
apply Hc,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply pnat.le_trans,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
rotate 1,
|
|
|
|
|
apply Hn,
|
|
|
|
|
rotate_right 1,
|
|
|
|
|
apply Nb_spec_right,
|
|
|
|
|
have HMk : M (2 * k) ≤ Nb M n, begin
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply pnat.le_trans,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
apply Nb_spec_right,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply pnat.le_trans,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
apply Hn,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply pnat.le_trans,
|
|
|
|
|
apply pnat.mul_le_mul_left 3,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
apply Nb_spec_left
|
|
|
|
|
end,
|
|
|
|
|
apply HMk,
|
|
|
|
|
rewrite ↑lim_seq,
|
|
|
|
|
apply approx_spec,
|
|
|
|
|
apply lim_spec,
|
2015-10-13 22:09:02 +00:00
|
|
|
|
krewrite [-+of_rat_add],
|
|
|
|
|
change of_rat ((2 * k)⁻¹ + (2 * n)⁻¹ + n⁻¹) ≤ of_rat k⁻¹,
|
2015-07-16 17:18:35 +00:00
|
|
|
|
apply of_rat_le_of_rat_of_le,
|
2015-10-13 22:09:02 +00:00
|
|
|
|
apply algebra.le.trans,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply add_le_add_three,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply rat.le_refl,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
apply inv_ge_of_le,
|
|
|
|
|
apply pnat_mul_le_mul_left',
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply pnat.le_trans,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
rotate 1,
|
|
|
|
|
apply Hn,
|
|
|
|
|
rotate_right 1,
|
|
|
|
|
apply Nb_spec_left,
|
|
|
|
|
apply inv_ge_of_le,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply pnat.le_trans,
|
2015-06-09 05:39:28 +00:00
|
|
|
|
rotate 1,
|
|
|
|
|
apply Hn,
|
|
|
|
|
rotate_right 1,
|
|
|
|
|
apply Nb_spec_left,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
rewrite -*pnat.mul_assoc,
|
2015-10-13 22:09:02 +00:00
|
|
|
|
krewrite pnat.p_add_fractions,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply rat.le_refl
|
2015-06-24 07:14:31 +00:00
|
|
|
|
end
|
2015-07-31 14:54:27 +00:00
|
|
|
|
|
2015-08-03 15:12:56 +00:00
|
|
|
|
end lim_seq
|
2015-07-31 14:54:27 +00:00
|
|
|
|
-------------------------------------------
|
|
|
|
|
-- int embedding theorems
|
|
|
|
|
-- archimedean properties, integer floor and ceiling
|
2015-07-29 22:06:09 +00:00
|
|
|
|
section ints
|
2015-06-09 05:39:28 +00:00
|
|
|
|
|
2015-07-29 22:06:09 +00:00
|
|
|
|
open int
|
|
|
|
|
|
2015-09-13 00:04:57 +00:00
|
|
|
|
theorem archimedean_upper (x : ℝ) : ∃ z : ℤ, x ≤ of_int z :=
|
2015-07-29 22:06:09 +00:00
|
|
|
|
begin
|
|
|
|
|
apply quot.induction_on x,
|
|
|
|
|
intro s,
|
2015-09-11 03:00:18 +00:00
|
|
|
|
cases rat_seq.bdd_of_regular (rat_seq.reg_seq.is_reg s) with [b, Hb],
|
2015-07-31 17:30:00 +00:00
|
|
|
|
existsi ubound b,
|
2015-09-11 03:00:18 +00:00
|
|
|
|
have H : rat_seq.s_le (rat_seq.reg_seq.sq s) (rat_seq.const (rat.of_nat (ubound b))), begin
|
|
|
|
|
apply rat_seq.s_le_of_le_pointwise (rat_seq.reg_seq.is_reg s),
|
|
|
|
|
apply rat_seq.const_reg,
|
2015-07-29 22:06:09 +00:00
|
|
|
|
intro n,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply rat.le_trans,
|
2015-07-29 22:06:09 +00:00
|
|
|
|
apply Hb,
|
|
|
|
|
apply ubound_ge
|
|
|
|
|
end,
|
|
|
|
|
apply H
|
|
|
|
|
end
|
|
|
|
|
|
2015-09-13 00:04:57 +00:00
|
|
|
|
theorem archimedean_upper_strict (x : ℝ) : ∃ z : ℤ, x < of_int z :=
|
2015-07-29 22:06:09 +00:00
|
|
|
|
begin
|
2015-09-11 03:00:18 +00:00
|
|
|
|
cases archimedean_upper x with [z, Hz],
|
2015-07-29 22:06:09 +00:00
|
|
|
|
existsi z + 1,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply algebra.lt_of_le_of_lt,
|
2015-07-29 22:06:09 +00:00
|
|
|
|
apply Hz,
|
2015-09-12 14:00:34 +00:00
|
|
|
|
apply of_int_lt_of_int_of_lt,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply lt_add_of_pos_right,
|
2015-07-29 22:06:09 +00:00
|
|
|
|
apply dec_trivial
|
|
|
|
|
end
|
|
|
|
|
|
2015-09-13 00:04:57 +00:00
|
|
|
|
theorem archimedean_lower (x : ℝ) : ∃ z : ℤ, x ≥ of_int z :=
|
2015-07-29 22:06:09 +00:00
|
|
|
|
begin
|
2015-09-11 03:00:18 +00:00
|
|
|
|
cases archimedean_upper (-x) with [z, Hz],
|
2015-07-29 22:06:09 +00:00
|
|
|
|
existsi -z,
|
2015-09-13 00:04:57 +00:00
|
|
|
|
rewrite [of_int_neg],
|
2015-07-29 22:06:09 +00:00
|
|
|
|
apply iff.mp !neg_le_iff_neg_le Hz
|
|
|
|
|
end
|
|
|
|
|
|
2015-09-13 00:04:57 +00:00
|
|
|
|
theorem archimedean_lower_strict (x : ℝ) : ∃ z : ℤ, x > of_int z :=
|
2015-07-29 22:06:09 +00:00
|
|
|
|
begin
|
2015-09-11 03:00:18 +00:00
|
|
|
|
cases archimedean_upper_strict (-x) with [z, Hz],
|
2015-07-29 22:06:09 +00:00
|
|
|
|
existsi -z,
|
2015-09-13 00:04:57 +00:00
|
|
|
|
rewrite [of_int_neg],
|
2015-07-29 22:06:09 +00:00
|
|
|
|
apply iff.mp !neg_lt_iff_neg_lt Hz
|
|
|
|
|
end
|
|
|
|
|
|
2015-09-13 00:35:43 +00:00
|
|
|
|
private definition ex_floor (x : ℝ) :=
|
2015-09-13 00:51:34 +00:00
|
|
|
|
(@exists_greatest_of_bdd (λ z, x ≥ of_int z) _
|
2015-07-29 22:06:09 +00:00
|
|
|
|
(begin
|
2015-09-11 03:00:18 +00:00
|
|
|
|
existsi some (archimedean_upper_strict x),
|
|
|
|
|
let Har := some_spec (archimedean_upper_strict x),
|
2015-07-29 22:06:09 +00:00
|
|
|
|
intros z Hz,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply algebra.not_le_of_gt,
|
|
|
|
|
apply algebra.lt_of_lt_of_le,
|
2015-07-29 22:06:09 +00:00
|
|
|
|
apply Har,
|
2015-09-13 00:04:57 +00:00
|
|
|
|
have H : of_int (some (archimedean_upper_strict x)) ≤ of_int z, begin
|
2015-09-12 14:00:34 +00:00
|
|
|
|
apply of_int_le_of_int_of_le,
|
2015-07-29 22:06:09 +00:00
|
|
|
|
apply Hz
|
|
|
|
|
end,
|
|
|
|
|
exact H
|
|
|
|
|
end)
|
2015-09-11 03:00:18 +00:00
|
|
|
|
(by existsi some (archimedean_lower x); apply some_spec (archimedean_lower x)))
|
2015-07-29 22:06:09 +00:00
|
|
|
|
|
2015-07-31 14:54:27 +00:00
|
|
|
|
noncomputable definition floor (x : ℝ) : ℤ :=
|
2015-07-29 22:06:09 +00:00
|
|
|
|
some (ex_floor x)
|
|
|
|
|
|
2015-07-31 14:54:27 +00:00
|
|
|
|
noncomputable definition ceil (x : ℝ) : ℤ := - floor (-x)
|
2015-07-29 22:06:09 +00:00
|
|
|
|
|
2015-09-13 00:35:43 +00:00
|
|
|
|
theorem floor_le (x : ℝ) : floor x ≤ x :=
|
2015-07-29 22:06:09 +00:00
|
|
|
|
and.left (some_spec (ex_floor x))
|
|
|
|
|
|
2015-09-13 00:35:43 +00:00
|
|
|
|
theorem lt_of_floor_lt {x : ℝ} {z : ℤ} (Hz : floor x < z) : x < z :=
|
2015-07-29 22:06:09 +00:00
|
|
|
|
begin
|
|
|
|
|
apply lt_of_not_ge,
|
|
|
|
|
cases some_spec (ex_floor x),
|
|
|
|
|
apply a_1 _ Hz
|
|
|
|
|
end
|
|
|
|
|
|
2015-09-13 00:35:43 +00:00
|
|
|
|
theorem le_ceil (x : ℝ) : x ≤ ceil x :=
|
2015-07-29 22:06:09 +00:00
|
|
|
|
begin
|
2015-09-13 00:04:57 +00:00
|
|
|
|
rewrite [↑ceil, of_int_neg],
|
2015-07-29 22:06:09 +00:00
|
|
|
|
apply iff.mp !le_neg_iff_le_neg,
|
2015-09-13 00:35:43 +00:00
|
|
|
|
apply floor_le
|
2015-07-29 22:06:09 +00:00
|
|
|
|
end
|
|
|
|
|
|
2015-09-13 00:35:43 +00:00
|
|
|
|
theorem lt_of_lt_ceil {x : ℝ} {z : ℤ} (Hz : z < ceil x) : z < x :=
|
2015-07-29 22:06:09 +00:00
|
|
|
|
begin
|
|
|
|
|
rewrite ↑ceil at Hz,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
let Hz' := lt_of_floor_lt (iff.mp !lt_neg_iff_lt_neg Hz),
|
2015-09-13 00:04:57 +00:00
|
|
|
|
rewrite [of_int_neg at Hz'],
|
2015-07-29 22:06:09 +00:00
|
|
|
|
apply lt_of_neg_lt_neg Hz'
|
|
|
|
|
end
|
|
|
|
|
|
2015-09-13 00:35:43 +00:00
|
|
|
|
theorem floor_succ (x : ℝ) : floor (x + 1) = floor x + 1 :=
|
2015-07-29 22:06:09 +00:00
|
|
|
|
begin
|
|
|
|
|
apply by_contradiction,
|
|
|
|
|
intro H,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
cases lt_or_gt_of_ne H with [Hgt, Hlt],
|
2015-09-13 00:35:43 +00:00
|
|
|
|
let Hl := lt_of_floor_lt Hgt,
|
2015-09-13 00:04:57 +00:00
|
|
|
|
rewrite [of_int_add at Hl],
|
2015-09-13 00:35:43 +00:00
|
|
|
|
apply not_le_of_gt (lt_of_add_lt_add_right Hl) !floor_le,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
let Hl := lt_of_floor_lt (iff.mp !add_lt_iff_lt_sub_right Hlt),
|
2015-09-13 00:35:43 +00:00
|
|
|
|
rewrite [of_int_sub at Hl],
|
|
|
|
|
apply not_le_of_gt (iff.mpr !add_lt_iff_lt_sub_right Hl) !floor_le
|
2015-07-29 22:06:09 +00:00
|
|
|
|
end
|
|
|
|
|
|
2015-09-13 00:35:43 +00:00
|
|
|
|
theorem floor_sub_one_lt_floor (x : ℝ) : floor (x - 1) < floor x :=
|
2015-07-29 22:06:09 +00:00
|
|
|
|
begin
|
2015-10-13 19:59:57 +00:00
|
|
|
|
|
|
|
|
|
apply @algebra.lt_of_add_lt_add_right ℤ _ _ 1,
|
2015-09-13 00:35:43 +00:00
|
|
|
|
rewrite [-floor_succ (x - 1), sub_add_cancel],
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply lt_add_of_pos_right dec_trivial
|
2015-07-29 22:06:09 +00:00
|
|
|
|
end
|
|
|
|
|
|
2015-09-13 00:35:43 +00:00
|
|
|
|
theorem ceil_lt_ceil_succ (x : ℝ) : ceil x < ceil (x + 1) :=
|
2015-07-29 22:06:09 +00:00
|
|
|
|
begin
|
|
|
|
|
rewrite [↑ceil, neg_add],
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply neg_lt_neg,
|
2015-09-13 00:35:43 +00:00
|
|
|
|
apply floor_sub_one_lt_floor
|
2015-07-29 22:06:09 +00:00
|
|
|
|
end
|
2015-10-13 19:59:57 +00:00
|
|
|
|
open nat
|
2015-10-13 22:09:02 +00:00
|
|
|
|
|
2015-09-13 00:35:43 +00:00
|
|
|
|
theorem archimedean_small {ε : ℝ} (H : ε > 0) : ∃ (n : ℕ), 1 / succ n < ε :=
|
|
|
|
|
let n := int.nat_abs (ceil (2 / ε)) in
|
2015-10-13 19:59:57 +00:00
|
|
|
|
assert int.of_nat n ≥ ceil (2 / ε),
|
|
|
|
|
by rewrite of_nat_nat_abs; apply le_abs_self,
|
2015-09-13 00:35:43 +00:00
|
|
|
|
have int.of_nat (succ n) ≥ ceil (2 / ε),
|
2015-10-13 19:59:57 +00:00
|
|
|
|
begin apply algebra.le.trans, exact this, apply int.of_nat_le_of_nat_of_le, apply le_succ end,
|
2015-09-13 00:35:43 +00:00
|
|
|
|
have H₁ : succ n ≥ ceil (2 / ε), from of_int_le_of_int_of_le this,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
have H₂ : succ n ≥ 2 / ε, from !algebra.le.trans !le_ceil H₁,
|
2015-09-13 00:35:43 +00:00
|
|
|
|
have H₃ : 2 / ε > 0, from div_pos_of_pos_of_pos two_pos H,
|
|
|
|
|
have 1 / succ n < ε, from calc
|
2015-09-13 00:44:34 +00:00
|
|
|
|
1 / succ n ≤ 1 / (2 / ε) : one_div_le_one_div_of_le H₃ H₂
|
2015-09-13 00:35:43 +00:00
|
|
|
|
... = ε / 2 : one_div_div
|
|
|
|
|
... < ε : div_two_lt_of_pos H,
|
|
|
|
|
exists.intro n this
|
|
|
|
|
|
2015-07-29 22:06:09 +00:00
|
|
|
|
end ints
|
2015-07-27 15:11:14 +00:00
|
|
|
|
--------------------------------------------------
|
|
|
|
|
-- supremum property
|
2015-07-28 15:32:20 +00:00
|
|
|
|
-- this development roughly follows the proof of completeness done in Isabelle.
|
2015-07-31 14:54:27 +00:00
|
|
|
|
-- It does not depend on the previous proof of Cauchy completeness. Much of the same
|
|
|
|
|
-- machinery can be used to show that Cauchy completeness implies the supremum property.
|
2015-07-27 15:11:14 +00:00
|
|
|
|
|
|
|
|
|
section supremum
|
|
|
|
|
open prod nat
|
2015-07-27 21:49:26 +00:00
|
|
|
|
local postfix `~` := nat_of_pnat
|
2015-07-27 15:11:14 +00:00
|
|
|
|
|
2015-07-28 21:44:56 +00:00
|
|
|
|
-- The top part of this section could be refactored. What is the appropriate place to define
|
|
|
|
|
-- bounds, supremum, etc? In algebra/ordered_field? They potentially apply to more than just ℝ.
|
2015-07-27 15:11:14 +00:00
|
|
|
|
parameter X : ℝ → Prop
|
|
|
|
|
|
|
|
|
|
definition ub (x : ℝ) := ∀ y : ℝ, X y → y ≤ x
|
2015-09-13 00:35:43 +00:00
|
|
|
|
definition is_sup (x : ℝ) := ub x ∧ ∀ y : ℝ, ub y → x ≤ y
|
2015-07-27 15:11:14 +00:00
|
|
|
|
|
2015-07-31 17:30:00 +00:00
|
|
|
|
definition lb (x : ℝ) := ∀ y : ℝ, X y → x ≤ y
|
2015-09-13 00:35:43 +00:00
|
|
|
|
definition is_inf (x : ℝ) := lb x ∧ ∀ y : ℝ, lb y → y ≤ x
|
2015-07-31 17:30:00 +00:00
|
|
|
|
|
2015-07-27 15:11:14 +00:00
|
|
|
|
parameter elt : ℝ
|
|
|
|
|
hypothesis inh : X elt
|
|
|
|
|
parameter bound : ℝ
|
|
|
|
|
hypothesis bdd : ub bound
|
|
|
|
|
|
2015-07-29 22:06:09 +00:00
|
|
|
|
include inh bdd
|
2015-07-28 15:32:20 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private definition avg (a b : ℚ) := a / 2 + b / 2
|
2015-07-27 15:11:14 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private noncomputable definition bisect (ab : ℚ × ℚ) :=
|
2015-07-27 15:11:14 +00:00
|
|
|
|
if ub (avg (pr1 ab) (pr2 ab)) then
|
|
|
|
|
(pr1 ab, (avg (pr1 ab) (pr2 ab)))
|
|
|
|
|
else
|
|
|
|
|
(avg (pr1 ab) (pr2 ab), pr2 ab)
|
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private noncomputable definition under : ℚ := rat.of_int (floor (elt - 1))
|
2015-07-27 15:11:14 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem under_spec1 : of_rat under < elt :=
|
2015-09-13 00:04:57 +00:00
|
|
|
|
have H : of_rat under < of_int (floor elt), begin
|
2015-09-12 14:00:34 +00:00
|
|
|
|
apply of_int_lt_of_int_of_lt,
|
2015-09-13 00:35:43 +00:00
|
|
|
|
apply floor_sub_one_lt_floor
|
2015-07-28 03:28:35 +00:00
|
|
|
|
end,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
algebra.lt_of_lt_of_le H !floor_le
|
2015-07-28 03:28:35 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem under_spec : ¬ ub under :=
|
2015-07-28 03:28:35 +00:00
|
|
|
|
begin
|
|
|
|
|
rewrite ↑ub,
|
|
|
|
|
apply not_forall_of_exists_not,
|
|
|
|
|
existsi elt,
|
|
|
|
|
apply iff.mpr not_implies_iff_and_not,
|
|
|
|
|
apply and.intro,
|
|
|
|
|
apply inh,
|
|
|
|
|
apply not_le_of_gt under_spec1
|
|
|
|
|
end
|
2015-07-27 15:11:14 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private noncomputable definition over : ℚ := rat.of_int (ceil (bound + 1)) -- b
|
2015-07-27 15:11:14 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem over_spec1 : bound < of_rat over :=
|
2015-09-13 00:04:57 +00:00
|
|
|
|
have H : of_int (ceil bound) < of_rat over, begin
|
2015-09-12 14:00:34 +00:00
|
|
|
|
apply of_int_lt_of_int_of_lt,
|
2015-09-13 00:35:43 +00:00
|
|
|
|
apply ceil_lt_ceil_succ
|
2015-07-28 03:28:35 +00:00
|
|
|
|
end,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
algebra.lt_of_le_of_lt !le_ceil H
|
2015-07-28 03:28:35 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem over_spec : ub over :=
|
2015-07-28 03:28:35 +00:00
|
|
|
|
begin
|
|
|
|
|
rewrite ↑ub,
|
|
|
|
|
intro y Hy,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply algebra.le_of_lt,
|
|
|
|
|
apply algebra.lt_of_le_of_lt,
|
2015-07-28 03:28:35 +00:00
|
|
|
|
apply bdd,
|
|
|
|
|
apply Hy,
|
|
|
|
|
apply over_spec1
|
|
|
|
|
end
|
2015-07-27 15:11:14 +00:00
|
|
|
|
|
2015-09-16 00:29:54 +00:00
|
|
|
|
private noncomputable definition under_seq := λ n : ℕ, pr1 (iterate bisect n (under, over)) -- A
|
2015-07-27 15:11:14 +00:00
|
|
|
|
|
2015-09-16 00:29:54 +00:00
|
|
|
|
private noncomputable definition over_seq := λ n : ℕ, pr2 (iterate bisect n (under, over)) -- B
|
2015-07-27 15:11:14 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private noncomputable definition avg_seq := λ n : ℕ, avg (over_seq n) (under_seq n) -- C
|
2015-07-27 15:11:14 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem avg_symm (n : ℕ) : avg_seq n = avg (under_seq n) (over_seq n) :=
|
2015-10-23 02:18:14 +00:00
|
|
|
|
by rewrite [↑avg_seq, ↑avg, add.comm]
|
2015-07-28 15:32:20 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem over_0 : over_seq 0 = over := rfl
|
2015-07-27 15:11:14 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem under_0 : under_seq 0 = under := rfl
|
|
|
|
|
|
|
|
|
|
private theorem succ_helper (n : ℕ) :
|
2015-09-16 00:29:54 +00:00
|
|
|
|
avg (pr1 (iterate bisect n (under, over))) (pr2 (iterate bisect n (under, over))) = avg_seq n :=
|
2015-07-28 15:32:20 +00:00
|
|
|
|
by rewrite avg_symm
|
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem under_succ (n : ℕ) : under_seq (succ n) =
|
2015-07-28 15:32:20 +00:00
|
|
|
|
(if ub (avg_seq n) then under_seq n else avg_seq n) :=
|
|
|
|
|
begin
|
2015-07-31 17:30:00 +00:00
|
|
|
|
cases em (ub (avg_seq n)) with [Hub, Hub],
|
2015-07-28 15:32:20 +00:00
|
|
|
|
rewrite [if_pos Hub],
|
2015-09-16 00:29:54 +00:00
|
|
|
|
have H : pr1 (bisect (iterate bisect n (under, over))) = under_seq n, by
|
2015-07-28 15:32:20 +00:00
|
|
|
|
rewrite [↑under_seq, ↑bisect at {2}, -succ_helper at Hub, if_pos Hub],
|
|
|
|
|
apply H,
|
|
|
|
|
rewrite [if_neg Hub],
|
2015-09-16 00:29:54 +00:00
|
|
|
|
have H : pr1 (bisect (iterate bisect n (under, over))) = avg_seq n, by
|
2015-07-28 15:32:20 +00:00
|
|
|
|
rewrite [↑bisect at {2}, -succ_helper at Hub, if_neg Hub, avg_symm],
|
|
|
|
|
apply H
|
|
|
|
|
end
|
2015-07-27 15:11:14 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem over_succ (n : ℕ) : over_seq (succ n) =
|
2015-07-28 15:32:20 +00:00
|
|
|
|
(if ub (avg_seq n) then avg_seq n else over_seq n) :=
|
|
|
|
|
begin
|
2015-07-31 17:30:00 +00:00
|
|
|
|
cases em (ub (avg_seq n)) with [Hub, Hub],
|
2015-07-28 15:32:20 +00:00
|
|
|
|
rewrite [if_pos Hub],
|
2015-09-16 00:29:54 +00:00
|
|
|
|
have H : pr2 (bisect (iterate bisect n (under, over))) = avg_seq n, by
|
2015-07-28 15:32:20 +00:00
|
|
|
|
rewrite [↑bisect at {2}, -succ_helper at Hub, if_pos Hub, avg_symm],
|
|
|
|
|
apply H,
|
|
|
|
|
rewrite [if_neg Hub],
|
2015-09-16 00:29:54 +00:00
|
|
|
|
have H : pr2 (bisect (iterate bisect n (under, over))) = over_seq n, by
|
2015-07-28 15:32:20 +00:00
|
|
|
|
rewrite [↑over_seq, ↑bisect at {2}, -succ_helper at Hub, if_neg Hub],
|
|
|
|
|
apply H
|
|
|
|
|
end
|
2015-07-27 15:11:14 +00:00
|
|
|
|
|
2015-10-13 19:59:57 +00:00
|
|
|
|
private theorem nat.zero_eq_0 : (zero : ℕ) = 0 := rfl
|
|
|
|
|
|
|
|
|
|
private theorem width (n : ℕ) : over_seq n - under_seq n = (over - under) / ((2^n) : ℚ) :=
|
2015-07-27 15:11:14 +00:00
|
|
|
|
nat.induction_on n
|
2015-10-13 19:59:57 +00:00
|
|
|
|
(by xrewrite [nat.zero_eq_0, over_0, under_0, pow_zero, div_one])
|
2015-07-27 15:11:14 +00:00
|
|
|
|
(begin
|
|
|
|
|
intro a Ha,
|
|
|
|
|
rewrite [over_succ, under_succ],
|
2015-07-28 15:32:20 +00:00
|
|
|
|
let Hou := calc
|
2015-10-13 19:59:57 +00:00
|
|
|
|
(over_seq a) / 2 - (under_seq a) / 2 = ((over - under) / 2^a) / 2 :
|
|
|
|
|
by rewrite [div_sub_div_same, Ha]
|
|
|
|
|
... = (over - under) / ((2^a) * 2) : by rewrite div_div_eq_div_mul
|
|
|
|
|
... = (over - under) / 2^(a + 1) : by rewrite pow_add,
|
2015-07-31 17:30:00 +00:00
|
|
|
|
cases em (ub (avg_seq a)),
|
2015-10-13 19:59:57 +00:00
|
|
|
|
rewrite [*if_pos a_1, -add_one, -Hou, ↑avg_seq, ↑avg, sub_eq_add_neg, algebra.add.assoc, -sub_eq_add_neg, div_two_sub_self],
|
|
|
|
|
rewrite [*if_neg a_1, -add_one, -Hou, ↑avg_seq, ↑avg, sub_add_eq_sub_sub,
|
|
|
|
|
algebra.sub_self_div_two]
|
2015-07-27 15:11:14 +00:00
|
|
|
|
end)
|
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem width_narrows : ∃ n : ℕ, over_seq n - under_seq n ≤ 1 :=
|
2015-07-27 21:49:26 +00:00
|
|
|
|
begin
|
|
|
|
|
cases binary_bound (over - under) with [a, Ha],
|
|
|
|
|
existsi a,
|
|
|
|
|
rewrite (width a),
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply div_le_of_le_mul,
|
|
|
|
|
apply pow_pos dec_trivial,
|
2015-07-27 21:49:26 +00:00
|
|
|
|
rewrite rat.mul_one,
|
|
|
|
|
apply Ha
|
|
|
|
|
end
|
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private noncomputable definition over' := over_seq (some width_narrows)
|
2015-07-27 21:49:26 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private noncomputable definition under' := under_seq (some width_narrows)
|
2015-07-27 21:49:26 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private noncomputable definition over_seq' := λ n, over_seq (n + some width_narrows)
|
2015-07-27 21:49:26 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private noncomputable definition under_seq' := λ n, under_seq (n + some width_narrows)
|
2015-07-27 21:49:26 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem over_seq'0 : over_seq' 0 = over' :=
|
2015-07-28 21:44:56 +00:00
|
|
|
|
by rewrite [↑over_seq', nat.zero_add]
|
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem under_seq'0 : under_seq' 0 = under' :=
|
2015-07-28 21:44:56 +00:00
|
|
|
|
by rewrite [↑under_seq', nat.zero_add]
|
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem under_over' : over' - under' ≤ 1 := some_spec width_narrows
|
2015-07-27 21:49:26 +00:00
|
|
|
|
|
2015-10-13 19:59:57 +00:00
|
|
|
|
private theorem width' (n : ℕ) : over_seq' n - under_seq' n ≤ 1 / 2^n :=
|
2015-07-28 21:44:56 +00:00
|
|
|
|
nat.induction_on n
|
|
|
|
|
(begin
|
2015-10-13 19:59:57 +00:00
|
|
|
|
xrewrite [nat.zero_eq_0, over_seq'0, under_seq'0, pow_zero, div_one],
|
2015-07-28 21:44:56 +00:00
|
|
|
|
apply under_over'
|
|
|
|
|
end)
|
|
|
|
|
(begin
|
|
|
|
|
intros a Ha,
|
|
|
|
|
rewrite [↑over_seq' at *, ↑under_seq' at *, *succ_add at *, width at *,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
-add_one, -(add_one a), pow_add, pow_add _ a 1, *pow_one],
|
|
|
|
|
apply div_mul_le_div_mul_of_div_le_div_pos' Ha dec_trivial
|
2015-07-28 21:44:56 +00:00
|
|
|
|
end)
|
2015-07-27 15:11:14 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem PA (n : ℕ) : ¬ ub (under_seq n) :=
|
2015-07-27 15:11:14 +00:00
|
|
|
|
nat.induction_on n
|
|
|
|
|
(by rewrite under_0; apply under_spec)
|
|
|
|
|
(begin
|
|
|
|
|
intro a Ha,
|
|
|
|
|
rewrite under_succ,
|
2015-07-31 17:30:00 +00:00
|
|
|
|
cases em (ub (avg_seq a)),
|
2015-07-27 15:11:14 +00:00
|
|
|
|
rewrite (if_pos a_1),
|
|
|
|
|
assumption,
|
|
|
|
|
rewrite (if_neg a_1),
|
|
|
|
|
assumption
|
|
|
|
|
end)
|
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem PB (n : ℕ) : ub (over_seq n) :=
|
2015-07-27 15:11:14 +00:00
|
|
|
|
nat.induction_on n
|
|
|
|
|
(by rewrite over_0; apply over_spec)
|
|
|
|
|
(begin
|
|
|
|
|
intro a Ha,
|
|
|
|
|
rewrite over_succ,
|
2015-07-31 17:30:00 +00:00
|
|
|
|
cases em (ub (avg_seq a)),
|
2015-07-27 15:11:14 +00:00
|
|
|
|
rewrite (if_pos a_1),
|
|
|
|
|
assumption,
|
|
|
|
|
rewrite (if_neg a_1),
|
|
|
|
|
assumption
|
|
|
|
|
end)
|
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem under_lt_over : under < over :=
|
2015-07-27 21:49:26 +00:00
|
|
|
|
begin
|
2015-07-31 17:30:00 +00:00
|
|
|
|
cases exists_not_of_not_forall under_spec with [x, Hx],
|
|
|
|
|
cases iff.mp not_implies_iff_and_not Hx with [HXx, Hxu],
|
2015-09-13 00:04:57 +00:00
|
|
|
|
apply lt_of_of_rat_lt_of_rat,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply algebra.lt_of_lt_of_le,
|
2015-07-27 21:49:26 +00:00
|
|
|
|
apply lt_of_not_ge Hxu,
|
|
|
|
|
apply over_spec _ HXx
|
|
|
|
|
end
|
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem under_seq_lt_over_seq : ∀ m n : ℕ, under_seq m < over_seq n :=
|
2015-07-27 21:49:26 +00:00
|
|
|
|
begin
|
|
|
|
|
intros,
|
2015-07-31 17:30:00 +00:00
|
|
|
|
cases exists_not_of_not_forall (PA m) with [x, Hx],
|
2015-08-03 15:12:56 +00:00
|
|
|
|
cases iff.mp not_implies_iff_and_not Hx with [HXx, Hxu],
|
2015-09-13 00:04:57 +00:00
|
|
|
|
apply lt_of_of_rat_lt_of_rat,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply algebra.lt_of_lt_of_le,
|
2015-07-27 21:49:26 +00:00
|
|
|
|
apply lt_of_not_ge Hxu,
|
|
|
|
|
apply PB,
|
|
|
|
|
apply HXx
|
|
|
|
|
end
|
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem under_seq_lt_over_seq_single : ∀ n : ℕ, under_seq n < over_seq n :=
|
2015-07-27 21:49:26 +00:00
|
|
|
|
by intros; apply under_seq_lt_over_seq
|
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem under_seq'_lt_over_seq' : ∀ m n : ℕ, under_seq' m < over_seq' n :=
|
2015-07-27 21:49:26 +00:00
|
|
|
|
by intros; apply under_seq_lt_over_seq
|
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem under_seq'_lt_over_seq'_single : ∀ n : ℕ, under_seq' n < over_seq' n :=
|
2015-07-27 21:49:26 +00:00
|
|
|
|
by intros; apply under_seq_lt_over_seq
|
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem under_seq_mono_helper (i k : ℕ) : under_seq i ≤ under_seq (i + k) :=
|
2015-07-27 22:33:34 +00:00
|
|
|
|
(nat.induction_on k
|
2015-10-23 02:18:14 +00:00
|
|
|
|
(by rewrite nat.add_zero; apply rat.le_refl)
|
2015-07-27 22:33:34 +00:00
|
|
|
|
(begin
|
|
|
|
|
intros a Ha,
|
|
|
|
|
rewrite [add_succ, under_succ],
|
2015-07-31 17:30:00 +00:00
|
|
|
|
cases em (ub (avg_seq (i + a))) with [Havg, Havg],
|
2015-07-27 22:33:34 +00:00
|
|
|
|
rewrite (if_pos Havg),
|
|
|
|
|
apply Ha,
|
|
|
|
|
rewrite [if_neg Havg, ↑avg_seq, ↑avg],
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply rat.le_trans,
|
2015-07-27 22:33:34 +00:00
|
|
|
|
apply Ha,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
rewrite -add_halves at {1},
|
|
|
|
|
apply add_le_add_right,
|
|
|
|
|
apply div_le_div_of_le_of_pos,
|
2015-07-27 22:33:34 +00:00
|
|
|
|
apply rat.le_of_lt,
|
|
|
|
|
apply under_seq_lt_over_seq,
|
|
|
|
|
apply dec_trivial
|
|
|
|
|
end))
|
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem under_seq_mono (i j : ℕ) (H : i ≤ j) : under_seq i ≤ under_seq j :=
|
2015-07-27 22:33:34 +00:00
|
|
|
|
begin
|
|
|
|
|
cases le.elim H with [k, Hk'],
|
|
|
|
|
rewrite -Hk',
|
|
|
|
|
apply under_seq_mono_helper
|
|
|
|
|
end
|
2015-10-13 22:09:02 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem over_seq_mono_helper (i k : ℕ) : over_seq (i + k) ≤ over_seq i :=
|
2015-07-27 22:33:34 +00:00
|
|
|
|
nat.induction_on k
|
2015-10-23 02:18:14 +00:00
|
|
|
|
(by rewrite nat.add_zero; apply rat.le_refl)
|
2015-07-27 22:33:34 +00:00
|
|
|
|
(begin
|
|
|
|
|
intros a Ha,
|
|
|
|
|
rewrite [add_succ, over_succ],
|
2015-07-31 17:30:00 +00:00
|
|
|
|
cases em (ub (avg_seq (i + a))) with [Havg, Havg],
|
2015-07-27 22:33:34 +00:00
|
|
|
|
rewrite [if_pos Havg, ↑avg_seq, ↑avg],
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply rat.le_trans,
|
2015-07-27 22:33:34 +00:00
|
|
|
|
rotate 1,
|
|
|
|
|
apply Ha,
|
|
|
|
|
rotate 1,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply add_le_of_le_sub_left,
|
|
|
|
|
rewrite sub_self_div_two,
|
|
|
|
|
apply div_le_div_of_le_of_pos,
|
2015-07-27 22:33:34 +00:00
|
|
|
|
apply rat.le_of_lt,
|
|
|
|
|
apply under_seq_lt_over_seq,
|
|
|
|
|
apply dec_trivial,
|
|
|
|
|
rewrite [if_neg Havg],
|
|
|
|
|
apply Ha
|
|
|
|
|
end)
|
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem over_seq_mono (i j : ℕ) (H : i ≤ j) : over_seq j ≤ over_seq i :=
|
2015-07-27 22:33:34 +00:00
|
|
|
|
begin
|
|
|
|
|
cases le.elim H with [k, Hk'],
|
|
|
|
|
rewrite -Hk',
|
|
|
|
|
apply over_seq_mono_helper
|
|
|
|
|
end
|
2015-07-27 21:49:26 +00:00
|
|
|
|
|
2015-10-13 19:59:57 +00:00
|
|
|
|
private theorem rat_power_two_inv_ge (k : ℕ+) : 1 / 2^k~ ≤ k⁻¹ :=
|
|
|
|
|
one_div_le_one_div_of_le !rat_of_pnat_is_pos !rat_power_two_le
|
2015-07-27 21:49:26 +00:00
|
|
|
|
|
2015-09-11 03:00:18 +00:00
|
|
|
|
open rat_seq
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem regular_lemma_helper {s : seq} {m n : ℕ+} (Hm : m ≤ n)
|
2015-07-28 03:28:35 +00:00
|
|
|
|
(H : ∀ n i : ℕ+, i ≥ n → under_seq' n~ ≤ s i ∧ s i ≤ over_seq' n~) :
|
2015-10-13 19:59:57 +00:00
|
|
|
|
abs (s m - s n) ≤ m⁻¹ + n⁻¹ :=
|
2015-07-27 21:49:26 +00:00
|
|
|
|
begin
|
2015-07-31 17:30:00 +00:00
|
|
|
|
cases H m n Hm with [T1under, T1over],
|
2015-10-23 02:18:14 +00:00
|
|
|
|
cases H m m (!pnat.le_refl) with [T2under, T2over],
|
|
|
|
|
apply rat.le_trans,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply dist_bdd_within_interval,
|
2015-07-27 21:49:26 +00:00
|
|
|
|
apply under_seq'_lt_over_seq'_single,
|
|
|
|
|
rotate 1,
|
|
|
|
|
repeat assumption,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply rat.le_trans,
|
2015-07-27 21:49:26 +00:00
|
|
|
|
apply width',
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply rat.le_trans,
|
2015-07-27 21:49:26 +00:00
|
|
|
|
apply rat_power_two_inv_ge,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply le_add_of_nonneg_right,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply rat.le_of_lt (!pnat.inv_pos)
|
2015-07-27 21:49:26 +00:00
|
|
|
|
end
|
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem regular_lemma (s : seq) (H : ∀ n i : ℕ+, i ≥ n → under_seq' n~ ≤ s i ∧ s i ≤ over_seq' n~) :
|
2015-07-27 21:49:26 +00:00
|
|
|
|
regular s :=
|
|
|
|
|
begin
|
|
|
|
|
rewrite ↑regular,
|
|
|
|
|
intros,
|
2015-07-31 17:30:00 +00:00
|
|
|
|
cases em (m ≤ n) with [Hm, Hn],
|
2015-07-27 21:49:26 +00:00
|
|
|
|
apply regular_lemma_helper Hm H,
|
|
|
|
|
let T := regular_lemma_helper (pnat.le_of_lt (pnat.lt_of_not_le Hn)) H,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
rewrite [abs_sub at T, {n⁻¹ + _}add.comm at T],
|
2015-07-27 21:49:26 +00:00
|
|
|
|
exact T
|
|
|
|
|
end
|
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private noncomputable definition p_under_seq : seq := λ n : ℕ+, under_seq' n~
|
2015-07-27 21:49:26 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private noncomputable definition p_over_seq : seq := λ n : ℕ+, over_seq' n~
|
2015-07-27 21:49:26 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem under_seq_regular : regular p_under_seq :=
|
2015-07-27 21:49:26 +00:00
|
|
|
|
begin
|
|
|
|
|
apply regular_lemma,
|
|
|
|
|
intros n i Hni,
|
|
|
|
|
apply and.intro,
|
|
|
|
|
apply under_seq_mono,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply add_le_add_right,
|
|
|
|
|
apply Hni,
|
2015-07-27 21:49:26 +00:00
|
|
|
|
apply rat.le_of_lt,
|
|
|
|
|
apply under_seq_lt_over_seq
|
|
|
|
|
end
|
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem over_seq_regular : regular p_over_seq :=
|
2015-07-27 21:49:26 +00:00
|
|
|
|
begin
|
|
|
|
|
apply regular_lemma,
|
|
|
|
|
intros n i Hni,
|
|
|
|
|
apply and.intro,
|
|
|
|
|
apply rat.le_of_lt,
|
|
|
|
|
apply under_seq_lt_over_seq,
|
|
|
|
|
apply over_seq_mono,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply add_le_add_right,
|
|
|
|
|
apply Hni
|
2015-07-27 21:49:26 +00:00
|
|
|
|
end
|
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private noncomputable definition sup_over : ℝ := quot.mk (reg_seq.mk p_over_seq over_seq_regular)
|
2015-07-27 21:49:26 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private noncomputable definition sup_under : ℝ := quot.mk (reg_seq.mk p_under_seq under_seq_regular)
|
2015-07-27 21:49:26 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem over_bound : ub sup_over :=
|
2015-07-27 15:11:14 +00:00
|
|
|
|
begin
|
2015-07-27 21:49:26 +00:00
|
|
|
|
rewrite ↑ub,
|
|
|
|
|
intros y Hy,
|
|
|
|
|
apply le_of_le_reprs,
|
|
|
|
|
intro n,
|
|
|
|
|
apply PB,
|
|
|
|
|
apply Hy
|
|
|
|
|
end
|
2015-07-27 15:11:14 +00:00
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem under_lowest_bound : ∀ y : ℝ, ub y → sup_under ≤ y :=
|
2015-07-27 21:49:26 +00:00
|
|
|
|
begin
|
|
|
|
|
intros y Hy,
|
|
|
|
|
apply le_of_reprs_le,
|
|
|
|
|
intro n,
|
2015-07-31 17:30:00 +00:00
|
|
|
|
cases exists_not_of_not_forall (PA _) with [x, Hx],
|
|
|
|
|
cases iff.mp not_implies_iff_and_not Hx with [HXx, Hxn],
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply algebra.le.trans,
|
|
|
|
|
apply algebra.le_of_lt,
|
2015-07-27 21:49:26 +00:00
|
|
|
|
apply lt_of_not_ge Hxn,
|
|
|
|
|
apply Hy,
|
|
|
|
|
apply HXx
|
2015-07-27 15:11:14 +00:00
|
|
|
|
end
|
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem under_over_equiv : p_under_seq ≡ p_over_seq :=
|
2015-07-27 21:49:26 +00:00
|
|
|
|
begin
|
|
|
|
|
intros,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply rat.le_trans,
|
2015-07-27 21:49:26 +00:00
|
|
|
|
have H : p_under_seq n < p_over_seq n, from !under_seq_lt_over_seq,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
rewrite [abs_of_neg (iff.mpr !sub_neg_iff_lt H), neg_sub],
|
2015-07-27 21:49:26 +00:00
|
|
|
|
apply width',
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply rat.le_trans,
|
2015-07-27 21:49:26 +00:00
|
|
|
|
apply rat_power_two_inv_ge,
|
2015-10-13 19:59:57 +00:00
|
|
|
|
apply le_add_of_nonneg_left,
|
2015-10-23 02:18:14 +00:00
|
|
|
|
apply rat.le_of_lt !pnat.inv_pos
|
2015-07-27 21:49:26 +00:00
|
|
|
|
end
|
|
|
|
|
|
2015-09-14 17:39:42 +00:00
|
|
|
|
private theorem under_over_eq : sup_under = sup_over := quot.sound under_over_equiv
|
2015-07-27 21:49:26 +00:00
|
|
|
|
|
2015-09-13 00:35:43 +00:00
|
|
|
|
theorem exists_is_sup_of_inh_of_bdd : ∃ x : ℝ, is_sup x :=
|
2015-07-27 21:49:26 +00:00
|
|
|
|
exists.intro sup_over (and.intro over_bound (under_over_eq ▸ under_lowest_bound))
|
|
|
|
|
|
2015-07-27 15:11:14 +00:00
|
|
|
|
end supremum
|
2015-07-31 17:30:00 +00:00
|
|
|
|
definition bounding_set (X : ℝ → Prop) (x : ℝ) : Prop := ∀ y : ℝ, X y → x ≤ y
|
|
|
|
|
|
2015-09-13 00:35:43 +00:00
|
|
|
|
theorem exists_is_inf_of_inh_of_bdd (X : ℝ → Prop) (elt : ℝ) (inh : X elt) (bound : ℝ)
|
|
|
|
|
(bdd : lb X bound) : ∃ x : ℝ, is_inf X x :=
|
2015-07-31 17:30:00 +00:00
|
|
|
|
begin
|
|
|
|
|
have Hinh : bounding_set X bound, begin
|
|
|
|
|
intros y Hy,
|
|
|
|
|
apply bdd,
|
|
|
|
|
apply Hy
|
|
|
|
|
end,
|
|
|
|
|
have Hub : ub (bounding_set X) elt, begin
|
|
|
|
|
intros y Hy,
|
|
|
|
|
apply Hy,
|
|
|
|
|
apply inh
|
|
|
|
|
end,
|
2015-09-13 00:35:43 +00:00
|
|
|
|
cases exists_is_sup_of_inh_of_bdd _ _ Hinh _ Hub with [supr, Hsupr],
|
2015-07-31 17:30:00 +00:00
|
|
|
|
existsi supr,
|
|
|
|
|
cases Hsupr with [Hubs1, Hubs2],
|
|
|
|
|
apply and.intro,
|
|
|
|
|
intros,
|
|
|
|
|
apply Hubs2,
|
|
|
|
|
intros z Hz,
|
|
|
|
|
apply Hz,
|
|
|
|
|
apply a,
|
|
|
|
|
intros y Hlby,
|
|
|
|
|
apply Hubs1,
|
|
|
|
|
intros z Hz,
|
|
|
|
|
apply Hlby,
|
|
|
|
|
apply Hz
|
|
|
|
|
end
|
|
|
|
|
|
2015-06-09 05:39:28 +00:00
|
|
|
|
end real
|