-
Notifications
You must be signed in to change notification settings - Fork 232
Expand file tree
/
Copy pathSection_5_3.lean
More file actions
469 lines (379 loc) · 18.2 KB
/
Section_5_3.lean
File metadata and controls
469 lines (379 loc) · 18.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
import Mathlib.Tactic
import Analysis.Section_5_2
import Mathlib.Algebra.Group.MinimalAxioms
/-!
# Analysis I, Section 5.3: The construction of the real numbers
I have attempted to make the translation as faithful a paraphrasing as possible of the original
text. When there is a choice between a more idiomatic Lean solution and a more faithful
translation, I have generally chosen the latter. In particular, there will be places where the
Lean code could be "golfed" to be more elegant and idiomatic, but I have consciously avoided
doing so.
Main constructions and results of this section:
- Notion of a formal limit of a Cauchy sequence.
- Construction of a real number type `Chapter5.Real`.
- Basic arithmetic operations and properties.
## Tips from past users
Users of the companion who have completed the exercises in this section are welcome to send their tips for future users in this section as PRs.
- (Add tip here)
-/
namespace Chapter5
/-- A class of Cauchy sequences that start at zero. -/
@[ext]
class CauchySequence extends Sequence where
zero : n₀ = 0
cauchy : toSequence.IsCauchy
theorem CauchySequence.ext' {a b: CauchySequence} (h: a.seq = b.seq) : a = b := by
apply CauchySequence.ext _ h
rw [a.zero, b.zero]
/-- A sequence starting at zero that is Cauchy, can be viewed as a {name}`CauchySequence`. -/
abbrev CauchySequence.mk' {a:ℕ → ℚ} (ha: (a:Sequence).IsCauchy) : CauchySequence where
n₀ := 0
seq := (a:Sequence).seq
vanish := by aesop
zero := rfl
cauchy := ha
@[simp]
theorem CauchySequence.coe_eq {a:ℕ → ℚ} (ha: (a:Sequence).IsCauchy) :
(mk' ha).toSequence = (a:Sequence) := rfl
instance CauchySequence.instCoeFun : CoeFun CauchySequence (fun _ ↦ ℕ → ℚ) where
coe a n := a.toSequence (n:ℤ)
@[simp]
theorem CauchySequence.coe_to_sequence (a: CauchySequence) :
((a:ℕ → ℚ):Sequence) = a.toSequence := by
apply Sequence.ext (by simp [Sequence.n0_coe, a.zero])
ext n; by_cases h:n ≥ 0 <;> simp_all
rw [a.vanish]; rwa [a.zero]
@[simp]
theorem CauchySequence.coe_coe {a:ℕ → ℚ} (ha: (a:Sequence).IsCauchy) : mk' ha = a := by rfl
/-- Proposition 5.3.3 / Exercise 5.3.1 -/
theorem Sequence.equiv_trans {a b c:ℕ → ℚ} (hab: Equiv a b) (hbc: Equiv b c) :
Equiv a c := by sorry
/-- Proposition 5.3.3 / Exercise 5.3.1 -/
instance CauchySequence.instSetoid : Setoid CauchySequence where
r := fun a b ↦ Sequence.Equiv a b
iseqv := {
refl := sorry
symm := sorry
trans := sorry
}
theorem CauchySequence.equiv_iff (a b: CauchySequence) : a ≈ b ↔ Sequence.Equiv a b := by rfl
/-- Every constant sequence is Cauchy. -/
theorem Sequence.IsCauchy.const (a:ℚ) : ((fun _:ℕ ↦ a):Sequence).IsCauchy := by sorry
instance CauchySequence.instZero : Zero CauchySequence where
zero := CauchySequence.mk' (a := fun _: ℕ ↦ 0) (Sequence.IsCauchy.const (0:ℚ))
abbrev Real := Quotient CauchySequence.instSetoid
open Classical in
/--
It is convenient in Lean to assign the "dummy" value of {lean}`0` to {lean}`LIM a` when {lean}`a` is not Cauchy.
This requires classical logic, because the property of being Cauchy is not computable or
decidable.
-/
noncomputable abbrev LIM (a:ℕ → ℚ) : Real :=
Quotient.mk _ (if h : (a:Sequence).IsCauchy then CauchySequence.mk' h else (0:CauchySequence))
theorem LIM_def {a:ℕ → ℚ} (ha: (a:Sequence).IsCauchy) :
LIM a = Quotient.mk _ (CauchySequence.mk' ha) := by
rw [LIM, dif_pos ha]
/-- Definition 5.3.1 (Real numbers) -/
theorem Real.eq_lim (x:Real) : ∃ (a:ℕ → ℚ), (a:Sequence).IsCauchy ∧ x = LIM a := by
apply Quotient.ind _ x; intro a; use (a:ℕ → ℚ)
observe : ((a:ℕ → ℚ):Sequence) = a.toSequence
rw [this, LIM_def (by convert a.cauchy)]
refine ⟨ a.cauchy, ?_ ⟩
congr; ext n; simp; replace := congr($this n); simp_all
/-- Definition 5.3.1 (Real numbers) -/
theorem Real.LIM_eq_LIM {a b:ℕ → ℚ} (ha: (a:Sequence).IsCauchy) (hb: (b:Sequence).IsCauchy) :
LIM a = LIM b ↔ Sequence.Equiv a b := by
constructor
. intro h; replace h := Quotient.exact h
rwa [dif_pos ha, dif_pos hb, CauchySequence.equiv_iff] at h
intro h; apply Quotient.sound
rwa [dif_pos ha, dif_pos hb, CauchySequence.equiv_iff]
/--Lemma 5.3.6 (Sum of Cauchy sequences is Cauchy)-/
theorem Sequence.IsCauchy.add {a b:ℕ → ℚ} (ha: (a:Sequence).IsCauchy) (hb: (b:Sequence).IsCauchy) :
(a + b:Sequence).IsCauchy := by
-- This proof is written to follow the structure of the original text.
rw [coe] at *
intro ε hε
choose N1 ha using ha _ (half_pos hε)
choose N2 hb using hb _ (half_pos hε)
use max N1 N2
intro j hj k hk
have h1 := ha j ?_ k ?_ <;> try omega
have h2 := hb j ?_ k ?_ <;> try omega
simp [Section_4_3.dist] at *; rw [←Rat.Close] at *
convert Section_4_3.add_close h1 h2
linarith
/--Lemma 5.3.7 (Sum of equivalent sequences is equivalent)-/
theorem Sequence.add_equiv_left {a a':ℕ → ℚ} (b:ℕ → ℚ) (haa': Equiv a a') :
Equiv (a + b) (a' + b) := by
-- This proof is written to follow the structure of the original text.
rw [equiv_def] at *
peel 2 haa' with ε hε haa'
rw [Rat.eventuallyClose_def] at *
choose N haa' using haa'; use N
simp [Rat.closeSeq_def] at *
peel 5 haa' with n hn hN _ _ haa'
simp [hn, hN] at *
convert Section_4_3.add_close haa' (Section_4_3.close_refl (b n.toNat))
simp
/--Lemma 5.3.7 (Sum of equivalent sequences is equivalent)-/
theorem Sequence.add_equiv_right {b b':ℕ → ℚ} (a:ℕ → ℚ) (hbb': Equiv b b') :
Equiv (a + b) (a + b') := by simp_rw [add_comm]; exact add_equiv_left _ hbb'
/--Lemma 5.3.7 (Sum of equivalent sequences is equivalent)-/
theorem Sequence.add_equiv {a b a' b':ℕ → ℚ} (haa': Equiv a a')
(hbb': Equiv b b') :
Equiv (a + b) (a' + b') :=
equiv_trans (add_equiv_left _ haa') (add_equiv_right _ hbb')
/-- Definition 5.3.4 (Addition of reals) -/
noncomputable instance Real.add_inst : Add Real where
add := fun x y ↦
Quotient.liftOn₂ x y (fun a b ↦ LIM (a + b)) (by
intro a b a' b' _ _
change LIM ((a:ℕ → ℚ) + (b:ℕ → ℚ)) = LIM ((a':ℕ → ℚ) + (b':ℕ → ℚ))
rw [LIM_eq_LIM]
. solve_by_elim [Sequence.add_equiv]
all_goals apply Sequence.IsCauchy.add <;> rw [CauchySequence.coe_to_sequence] <;> convert @CauchySequence.cauchy ?_
)
/-- Definition 5.3.4 (Addition of reals) -/
theorem Real.LIM_add {a b:ℕ → ℚ} (ha: (a:Sequence).IsCauchy) (hb: (b:Sequence).IsCauchy) :
LIM a + LIM b = LIM (a + b) := by
simp_rw [LIM_def ha, LIM_def hb, LIM_def (Sequence.IsCauchy.add ha hb)]
convert Quotient.liftOn₂_mk _ _ _ _ using 1
simp [LIM]; grind
/-- Proposition 5.3.10 (Product of Cauchy sequences is Cauchy) -/
theorem Sequence.IsCauchy.mul {a b:ℕ → ℚ} (ha: (a:Sequence).IsCauchy) (hb: (b:Sequence).IsCauchy) :
(a * b:Sequence).IsCauchy := by
sorry
/-- Proposition 5.3.10 (Product of equivalent sequences is equivalent) / Exercise 5.3.2 -/
theorem Sequence.mul_equiv_left {a a':ℕ → ℚ} (b:ℕ → ℚ) (hb : (b:Sequence).IsCauchy) (haa': Equiv a a') :
Equiv (a * b) (a' * b) := by
sorry
/--Proposition 5.3.10 (Product of equivalent sequences is equivalent) / Exercise 5.3.2 -/
theorem Sequence.mul_equiv_right {b b':ℕ → ℚ} (a:ℕ → ℚ) (ha : (a:Sequence).IsCauchy) (hbb': Equiv b b') :
Equiv (a * b) (a * b') := by simp_rw [mul_comm]; exact mul_equiv_left a ha hbb'
/--Proposition 5.3.10 (Product of equivalent sequences is equivalent) / Exercise 5.3.2 -/
theorem Sequence.mul_equiv
{a b a' b':ℕ → ℚ}
(ha : (a:Sequence).IsCauchy)
(hb' : (b':Sequence).IsCauchy)
(haa': Equiv a a')
(hbb': Equiv b b') : Equiv (a * b) (a' * b') :=
equiv_trans (mul_equiv_right _ ha hbb') (mul_equiv_left _ hb' haa')
/-- Definition 5.3.9 (Product of reals) -/
noncomputable instance Real.mul_inst : Mul Real where
mul := fun x y ↦
Quotient.liftOn₂ x y (fun a b ↦ LIM (a * b)) (by
intro a b a' b' haa' hbb'
change LIM ((a:ℕ → ℚ) * (b:ℕ → ℚ)) = LIM ((a':ℕ → ℚ) * (b':ℕ → ℚ))
rw [LIM_eq_LIM]
. exact Sequence.mul_equiv (by rw [CauchySequence.coe_to_sequence]; exact a.cauchy) (by rw [CauchySequence.coe_to_sequence]; exact b'.cauchy) haa' hbb'
all_goals apply Sequence.IsCauchy.mul <;> rw [CauchySequence.coe_to_sequence] <;> convert @CauchySequence.cauchy ?_
)
theorem Real.LIM_mul {a b:ℕ → ℚ} (ha: (a:Sequence).IsCauchy) (hb: (b:Sequence).IsCauchy) :
LIM a * LIM b = LIM (a * b) := by
simp_rw [LIM_def ha, LIM_def hb, LIM_def (Sequence.IsCauchy.mul ha hb)]
convert Quotient.liftOn₂_mk _ _ _ _ using 1
simp [LIM]; grind
instance Real.instRatCast : RatCast Real where
ratCast := fun q ↦
Quotient.mk _ (CauchySequence.mk' (a := fun _ ↦ q) (Sequence.IsCauchy.const q))
theorem Real.ratCast_def (q:ℚ) : (q:Real) = LIM (fun _ ↦ q) := by rw [LIM_def]; rfl
/-- Exercise 5.3.3 -/
@[simp]
theorem Real.ratCast_inj (q r:ℚ) : (q:Real) = (r:Real) ↔ q = r := by
sorry
instance Real.instOfNat {n:ℕ} : OfNat Real n where
ofNat := ((n:ℚ):Real)
instance Real.instNatCast : NatCast Real where
natCast n := ((n:ℚ):Real)
@[simp]
theorem Real.LIM.zero : LIM (fun _ ↦ (0:ℚ)) = 0 := by rw [←ratCast_def 0]; rfl
instance Real.instIntCast : IntCast Real where
intCast n := ((n:ℚ):Real)
/-- {name (full := RatCast.ratCast)}`ratCast` distributes over addition -/
theorem Real.ratCast_add (a b:ℚ) : (a:Real) + (b:Real) = (a+b:ℚ) := by sorry
/-- {name (full := RatCast.ratCast)}`ratCast` distributes over multiplication -/
theorem Real.ratCast_mul (a b:ℚ) : (a:Real) * (b:Real) = (a*b:ℚ) := by sorry
noncomputable instance Real.instNeg : Neg Real where
neg x := ((-1:ℚ):Real) * x
/-- {name (full := RatCast.ratCast)}`ratCast` commutes with negation -/
theorem Real.neg_ratCast (a:ℚ) : -(a:Real) = (-a:ℚ) := by sorry
/-- It may be possible to omit the {name (full := Sequence.IsCauchy)}`IsCauchy` hypothesis here. -/
theorem Real.neg_LIM (a:ℕ → ℚ) (ha: (a:Sequence).IsCauchy) : -LIM a = LIM (-a) := by sorry
theorem Sequence.IsCauchy.neg (a:ℕ → ℚ) (ha: (a:Sequence).IsCauchy) :
((-a:ℕ → ℚ):Sequence).IsCauchy := by sorry
/-- Proposition 5.3.11 (laws of algebra) -/
noncomputable instance Real.addGroup_inst : AddGroup Real :=
AddGroup.ofLeftAxioms (by sorry) (by sorry) (by sorry)
theorem Real.sub_eq_add_neg (x y:Real) : x - y = x + (-y) := rfl
theorem Sequence.IsCauchy.sub {a b:ℕ → ℚ} (ha: (a:Sequence).IsCauchy) (hb: (b:Sequence).IsCauchy) :
((a-b:ℕ → ℚ):Sequence).IsCauchy := by sorry
/-- {name}`LIM` distributes over subtraction -/
theorem Real.LIM_sub {a b:ℕ → ℚ} (ha: (a:Sequence).IsCauchy) (hb: (b:Sequence).IsCauchy) :
LIM a - LIM b = LIM (a - b) := by sorry
/-- {name (full := RatCast.ratCast)}`ratCast` distributes over subtraction -/
theorem Real.ratCast_sub (a b:ℚ) : (a:Real) - (b:Real) = (a-b:ℚ) := by sorry
/-- Proposition 5.3.11 (laws of algebra) -/
noncomputable instance Real.instAddCommGroup : AddCommGroup Real where
add_comm := by sorry
/-- Proposition 5.3.11 (laws of algebra) -/
noncomputable instance Real.instCommMonoid : CommMonoid Real where
mul_comm := by sorry
mul_assoc := by sorry
one_mul := by sorry
mul_one := by sorry
/-- Proposition 5.3.11 (laws of algebra) -/
noncomputable instance Real.instCommRing : CommRing Real where
left_distrib := by sorry
right_distrib := by sorry
zero_mul := by sorry
mul_zero := by sorry
mul_assoc := by sorry
natCast_succ := by sorry
intCast_negSucc := by sorry
abbrev Real.ratCast_hom : ℚ →+* Real where
toFun := RatCast.ratCast
map_zero' := by sorry
map_one' := by sorry
map_add' := by sorry
map_mul' := by sorry
/--
Definition 5.3.12 (sequences bounded away from zero). Sequences are indexed to start from zero
as this is more convenient for Mathlib purposes.
-/
abbrev BoundedAwayZero (a:ℕ → ℚ) : Prop :=
∃ (c:ℚ), c > 0 ∧ ∀ n, |a n| ≥ c
theorem bounded_away_zero_def (a:ℕ → ℚ) : BoundedAwayZero a ↔
∃ (c:ℚ), c > 0 ∧ ∀ n, |a n| ≥ c := by rfl
/-- Examples 5.3.13 -/
example : BoundedAwayZero (fun n ↦ (-1)^n) := by use 1; simp
/-- Examples 5.3.13 -/
example : ¬ BoundedAwayZero (fun n ↦ 10^(-(n:ℤ)-1)) := by sorry
/-- Examples 5.3.13 -/
example : ¬ BoundedAwayZero (fun n ↦ 1 - 10^(-(n:ℤ))) := by sorry
/-- Examples 5.3.13 -/
example : BoundedAwayZero (fun n ↦ 10^(n+1)) := by
use 1, by norm_num
intro n; dsimp
rw [abs_of_nonneg (by positivity), show (1:ℚ) = 10^0 by norm_num]
gcongr <;> grind
/-- Examples 5.3.13 -/
example : ¬ ((fun (n:ℕ) ↦ (10:ℚ)^(n+1)):Sequence).IsBounded := by sorry
/-- Lemma 5.3.14 -/
theorem Real.boundedAwayZero_of_nonzero {x:Real} (hx: x ≠ 0) :
∃ a:ℕ → ℚ, (a:Sequence).IsCauchy ∧ BoundedAwayZero a ∧ x = LIM a := by
-- This proof is written to follow the structure of the original text.
obtain ⟨ b, hb, rfl ⟩ := eq_lim x
simp only [←LIM.zero, ne_eq] at hx
rw [LIM_eq_LIM hb (by convert Sequence.IsCauchy.const 0), Sequence.equiv_iff] at hx
simp at hx
choose ε hε hx using hx
choose N hb' using (Sequence.IsCauchy.coe _).mp hb _ (half_pos hε)
choose n₀ hn₀ hx using hx N
have how : ∀ j ≥ N, |b j| ≥ ε/2 := by sorry
set a : ℕ → ℚ := fun n ↦ if n < n₀ then ε/2 else b n
have not_hard : Sequence.Equiv a b := by sorry
have ha := (Sequence.isCauchy_of_equiv not_hard).mpr hb
refine ⟨ a, ha, ?_, by rw [(LIM_eq_LIM ha hb).mpr not_hard] ⟩
rw [bounded_away_zero_def]
use ε/2, half_pos hε
intro n; by_cases hn: n < n₀ <;> simp [a, hn, le_abs_self _]
grind
/--
This result was not explicitly stated in the text, but is needed in the theory. It's a good
exercise, so I'm setting it as such.
-/
theorem Real.lim_of_boundedAwayZero {a:ℕ → ℚ} (ha: BoundedAwayZero a)
(ha_cauchy: (a:Sequence).IsCauchy) :
LIM a ≠ 0 := by sorry
theorem Real.nonzero_of_boundedAwayZero {a:ℕ → ℚ} (ha: BoundedAwayZero a) (n: ℕ) : a n ≠ 0 := by
choose c hc ha using ha; specialize ha n; contrapose! ha; simp [ha, hc]
/-- Lemma 5.3.15 -/
theorem Real.inv_isCauchy_of_boundedAwayZero {a:ℕ → ℚ} (ha: BoundedAwayZero a)
(ha_cauchy: (a:Sequence).IsCauchy) :
((a⁻¹:ℕ → ℚ):Sequence).IsCauchy := by
-- This proof is written to follow the structure of the original text.
have ha' (n:ℕ) : a n ≠ 0 := nonzero_of_boundedAwayZero ha n
rw [bounded_away_zero_def] at ha; choose c hc ha using ha
simp_rw [Sequence.IsCauchy.coe, Section_4_3.dist_eq] at ha_cauchy ⊢
intro ε hε; specialize ha_cauchy (c^2 * ε) (by positivity)
choose N ha_cauchy using ha_cauchy; use N;
peel 4 ha_cauchy with n hn m hm ha_cauchy
calc
_ = |(a m - a n) / (a m * a n)| := by
congr; simp only [Pi.inv_apply]; field_simp [ha' m, ha' n]
_ ≤ |a m - a n| / c^2 := by rw [abs_div, abs_mul, sq]; gcongr <;> solve_by_elim
_ = |a n - a m| / c^2 := by rw [abs_sub_comm]
_ ≤ (c^2 * ε) / c^2 := by gcongr
_ = ε := by field_simp [hc]
/-- Lemma 5.3.17 (Reciprocation is well-defined) -/
theorem Real.inv_of_equiv {a b:ℕ → ℚ} (ha: BoundedAwayZero a)
(ha_cauchy: (a:Sequence).IsCauchy) (hb: BoundedAwayZero b)
(hb_cauchy: (b:Sequence).IsCauchy) (hlim: LIM a = LIM b) :
LIM a⁻¹ = LIM b⁻¹ := by
-- This proof is written to follow the structure of the original text.
set P := LIM a⁻¹ * LIM a * LIM b⁻¹
have hainv_cauchy := Real.inv_isCauchy_of_boundedAwayZero ha ha_cauchy
have hbinv_cauchy := Real.inv_isCauchy_of_boundedAwayZero hb hb_cauchy
have haainv_cauchy := hainv_cauchy.mul ha_cauchy
have habinv_cauchy := hainv_cauchy.mul hb_cauchy
have claim1 : P = LIM b⁻¹ := by
simp only [P, LIM_mul hainv_cauchy ha_cauchy, LIM_mul haainv_cauchy hbinv_cauchy]
rcongr n; simp [nonzero_of_boundedAwayZero ha n]
have claim2 : P = LIM a⁻¹ := by
simp only [P, hlim, LIM_mul hainv_cauchy hb_cauchy, LIM_mul habinv_cauchy hbinv_cauchy]
rcongr n; simp [nonzero_of_boundedAwayZero hb n]
grind
open Classical in
/--
Definition 5.3.16 (Reciprocation of real numbers). Requires classical logic because we need to
assign a "junk" value to the inverse of 0.
-/
noncomputable instance Real.instInv : Inv Real where
inv x := if h: x ≠ 0 then LIM (boundedAwayZero_of_nonzero h).choose⁻¹ else 0
theorem Real.inv_def {a:ℕ → ℚ} (h: BoundedAwayZero a) (hc: (a:Sequence).IsCauchy) :
(LIM a)⁻¹ = LIM a⁻¹ := by
observe hx : LIM a ≠ 0
set x := LIM a
have ⟨ h1, h2, h3 ⟩ := (boundedAwayZero_of_nonzero hx).choose_spec
simp [Inv.inv, hx]
exact inv_of_equiv h2 h1 h hc h3.symm
@[simp]
theorem Real.inv_zero : (0:Real)⁻¹ = 0 := by simp [Inv.inv]
theorem Real.self_mul_inv {x:Real} (hx: x ≠ 0) : x * x⁻¹ = 1 := by
sorry
theorem Real.inv_mul_self {x:Real} (hx: x ≠ 0) : x⁻¹ * x = 1 := by
sorry
lemma BoundedAwayZero.const {q : ℚ} (hq : q ≠ 0) : BoundedAwayZero fun _ ↦ q := by
use |q|; simp [hq]
theorem Real.inv_ratCast (q:ℚ) : (q:Real)⁻¹ = (q⁻¹:ℚ) := by
by_cases h : q = 0
. rw [h, ← show (0:Real) = (0:ℚ) by norm_cast]; norm_num; norm_cast
simp_rw [ratCast_def, inv_def (BoundedAwayZero.const h) (by apply Sequence.IsCauchy.const)]; congr
/-- Default definition of division. -/
noncomputable instance Real.instDivInvMonoid : DivInvMonoid Real where
theorem Real.div_eq (x y:Real) : x/y = x * y⁻¹ := rfl
noncomputable instance Real.instField : Field Real where
exists_pair_ne := by sorry
mul_inv_cancel := by sorry
inv_zero := by sorry
ratCast_def := by sorry
qsmul := _
nnqsmul := _
theorem Real.mul_right_cancel₀ {x y z:Real} (hz: z ≠ 0) (h: x * z = y * z) : x = y := by sorry
theorem Real.mul_right_nocancel : ¬ ∀ (x y z:Real), (hz: z = 0) → (x * z = y * z) → x = y := by
sorry
/-- Exercise 5.3.4 -/
theorem Real.IsBounded.equiv {a b:ℕ → ℚ} (ha: (a:Sequence).IsBounded) (hab: Sequence.Equiv a b) :
(b:Sequence).IsBounded := by sorry
/--
Same as {name}`Sequence.IsCauchy.harmonic` but reindexing the sequence as a₀ = 1, a₁ = 1/2, ...
This form is more convenient for the upcoming proof of Theorem 5.5.9.
-/
theorem Sequence.IsCauchy.harmonic' : ((fun n ↦ 1/((n:ℚ)+1): ℕ → ℚ):Sequence).IsCauchy := by
rw [coe]; intro ε hε; choose N h1 h2 using (mk _).mp harmonic ε hε
use N.toNat; intro j _ k _; specialize h2 (j+1) _ (k+1) _ <;> try omega
simp_all
/-- Exercise 5.3.5 -/
theorem Real.LIM.harmonic : LIM (fun n ↦ 1/((n:ℚ)+1)) = 0 := by sorry
end Chapter5