Skip to content

Commit 1d4e8c3

Browse files
authored
Merge pull request #439 from ggrandi/5-epilogue-scaffolding
scaffolding for 5 epilogue
2 parents d304e55 + a513473 commit 1d4e8c3

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

analysis/Analysis/Section_5_epilogue.lean

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Users of the companion who have completed the exercises in this section are welc
2727
namespace Chapter5
2828

2929

30+
@[ext]
3031
structure DedekindCut where
3132
E : Set ℚ
3233
nonempty : E.Nonempty
@@ -130,13 +131,115 @@ lemma Real.equivR_iff (x : Real) (y : ℝ) : y = Real.equivR x ↔ y.toCut = x.t
130131
simp only [equivR, Equiv.trans_apply, ←Equiv.apply_eq_iff_eq_symm_apply]
131132
rfl
132133

134+
-- In order to use this definition, we need some machinery
135+
-----
136+
137+
-- We start by showing it works for ratCasts
138+
theorem Real.equivR_ratCast {q: ℚ} : equivR q = (q: ℝ) := by
139+
sorry
140+
141+
lemma Real.equivR_nat {n: ℕ} : equivR n = (n: ℝ) := equivR_ratCast
142+
lemma Real.equivR_int {n: ℤ} : equivR n = (n: ℝ) := equivR_ratCast
143+
144+
----
145+
146+
-- We then want to set up a way to convert from the Real `LIM` to the ℝ `Real.mk`
147+
-- To do this we need a few things:
148+
149+
-- Convertion between the notions of Cauchy Sequences
150+
theorem Sequence.IsCauchy.to_IsCauSeq {a: ℕ → ℚ} (ha: IsCauchy a) : IsCauSeq _root_.abs a := by
151+
sorry
152+
153+
-- Convertion of an `IsCauchy` to a `CauSeq`
154+
abbrev Sequence.IsCauchy.CauSeq {a: ℕ → ℚ} : (ha: IsCauchy a) → CauSeq ℚ _root_.abs :=
155+
(⟨a, ·.to_IsCauSeq⟩)
156+
157+
-- We then set up the conversion from Sequence.Equiv to CauSeq.LimZero because
158+
-- it is the equivalence relation
159+
example {a b: CauSeq ℚ abs} : a ≈ b ↔ CauSeq.LimZero (a - b) := by rfl
160+
161+
theorem Sequence.Equiv.LimZero {a b: ℕ → ℚ} (ha: IsCauchy a) (hb: IsCauchy b) (h:Equiv a b)
162+
: CauSeq.LimZero (ha.CauSeq - hb.CauSeq) := by
163+
sorry
164+
165+
-- We can now use it to convert between different functions in Real.mk
166+
theorem Real.mk_eq_mk {a b: ℕ → ℚ} (ha : Sequence.IsCauchy a) (hb : Sequence.IsCauchy b) (hab: Sequence.Equiv a b)
167+
: Real.mk ha.CauSeq = Real.mk hb.CauSeq := Real.mk_eq.mpr (hab.LimZero ha hb)
168+
169+
-- Both directions of the equivalence
170+
theorem Sequence.Equiv_iff_LimZero {a b: ℕ → ℚ} (ha: IsCauchy a) (hb: IsCauchy b)
171+
: Equiv a b ↔ CauSeq.LimZero (ha.CauSeq - hb.CauSeq) := by
172+
refine ⟨(·.LimZero ha hb), ?_⟩
173+
sorry
174+
175+
----
176+
-- We create some cauchy sequences with useful properties
177+
178+
-- We show that for any sequence, it will eventually be arbitrarily close to its LIM
179+
open Real in
180+
theorem Sequence.difference_approaches_zero {a: ℕ → ℚ} (ha: Sequence.IsCauchy a) :
181+
∀ε > 0, ∃N, ∀n ≥ N, |LIM a - a n| ≤ (ε: ℚ) := by
182+
sorry
183+
184+
-- There exists a Cauchy sequence entirely above the LIM
185+
theorem Real.exists_equiv_above {a: ℕ → ℚ} (ha: Sequence.IsCauchy a)
186+
: ∃(b: ℕ → ℚ), Sequence.IsCauchy b ∧ Sequence.Equiv a b ∧ ∀n, LIM a ≤ b n := by
187+
sorry
188+
189+
-- There exists a Cauchy sequence entirely below the LIM
190+
theorem Real.exists_equiv_below {a: ℕ → ℚ} (ha: Sequence.IsCauchy a)
191+
: ∃(b: ℕ → ℚ), Sequence.IsCauchy b ∧ Sequence.Equiv a b ∧ ∀n, b n ≤ LIM a := by
192+
sorry
193+
194+
----
195+
196+
-- useful theorems for the following proof
197+
#check Real.mk_le
198+
#check Real.mk_le_of_forall_le
199+
#check Real.mk_const
200+
201+
-- Transform a `Real` to an `ℝ` by going through Cauchy Sequences
202+
-- we can use the conversion of Real.mk_eq to use different sequences to show different parts
203+
theorem Real.equivR_eq' {a: ℕ → ℚ} (ha: Sequence.IsCauchy a)
204+
: (LIM a).equivR = Real.mk ha.CauSeq := by
205+
by_cases hq: ∃(q: ℚ), q = LIM a
206+
· sorry
207+
show sSup (Rat.cast '' (LIM a).toSet_Rat) = _
208+
refine IsLUB.csSup_eq ⟨?_, ?_⟩ (Set.Nonempty.image _ <| Real.toSet_Rat_nonempty _)
209+
· -- show that `Real.mk ha.CauSeq` is an upper bound
210+
intro _ hy
211+
obtain ⟨y, hy, h⟩ := Set.mem_image _ _ _ |>.mp hy
212+
rw [← h, show (y: ℝ) = Real.mk (CauSeq.const _ y) from rfl]
213+
sorry
214+
-- show that for any other upper bound, `Real.mk ha.CauSeq` is smaller
215+
intro M hM
216+
sorry
217+
218+
lemma Real.equivR_eq (x: Real) : ∃(a : ℕ → ℚ) (ha: Sequence.IsCauchy a),
219+
x = LIM a ∧ x.equivR = Real.mk ha.CauSeq := by
220+
obtain ⟨a, ha, rfl⟩ := x.eq_lim
221+
exact ⟨a, ha, rfl, equivR_eq' ha⟩
222+
133223
/-- The isomorphism preserves order and ring operations -/
134224
noncomputable abbrev Real.equivR_ordered_ring : Real ≃+*o ℝ where
135225
toEquiv := equivR
136226
map_add' := by sorry
137227
map_mul' := by sorry
138228
map_le_map_iff' := by sorry
139229

230+
-- helpers for converting properties between Real and ℝ
231+
lemma Real.equivR_map_mul {x y : Real} : equivR (x * y) = equivR x * equivR y :=
232+
equivR_ordered_ring.map_mul _ _
233+
234+
lemma Real.equivR_map_inv {x: Real} : equivR (x⁻¹) = (equivR x)⁻¹ :=
235+
map_inv₀ equivR_ordered_ring _
236+
237+
theorem Real.equivR_map_pos {x: Real} : 0 < x ↔ 0 < equivR x := by sorry
238+
239+
theorem Real.equivR_map_nonneg {x: Real} : 0 ≤ x ↔ 0 ≤ equivR x := by sorry
240+
241+
242+
-- Showing equivalence of the different pows
140243
theorem Real.pow_of_equivR (x:Real) (n:ℕ) : equivR (x^n) = (equivR x)^n := by
141244
sorry
142245

0 commit comments

Comments
 (0)