Skip to content

Commit 6992847

Browse files
committed
a bit more work on Sec 5.3
1 parent f39b62b commit 6992847

File tree

2 files changed

+115
-4
lines changed

2 files changed

+115
-4
lines changed

Analysis/Section_4_2.lean

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ instance Rat.instLE : LE Rat where
255255
theorem Rat.lt_iff (x y:Rat) : x < y ↔ (x-y).isNeg := by rfl
256256
theorem Rat.le_iff (x y:Rat) : x ≤ y ↔ (x < y) ∨ (x = y) := by rfl
257257

258+
theorem Rat.gt_iff (x y:Rat) : x > y ↔ (x-y).isPos := by sorry
259+
theorem Rat.ge_iff (x y:Rat) : x ≥ y ↔ (x > y) ∨ (x = y) := by sorry
258260

259261
/-- Proposition 4.2.9(a) (order trichotomy) / Exercise 4.2.5 -/
260262
theorem Rat.trichotomous' (x y z:Rat) : x > y ∨ x < y ∨ x = y := by sorry
@@ -272,13 +274,13 @@ theorem Rat.not_lt_and_eq (x y:Rat) : ¬ (x < y ∧ x = y):= by sorry
272274
theorem Rat.antisymm (x y:Rat) : x < y ↔ (y - x).isPos := by sorry
273275

274276
/-- Proposition 4.2.9(c) (order is transitive) / Exercise 4.2.5 -/
275-
theorem Rat.lt_trans (x y z:Rat) (hxy: x < y) (hyz: y < z) : x < z := by sorry
277+
theorem Rat.lt_trans {x y z:Rat} (hxy: x < y) (hyz: y < z) : x < z := by sorry
276278

277279
/-- Proposition 4.2.9(d) (addition preserves order) / Exercise 4.2.5 -/
278-
theorem Rat.add_lt_add_right (x y z:Rat) (hxy: x < y) : x + z < y + z := by sorry
280+
theorem Rat.add_lt_add_right {x y:Rat} (z:Rat) (hxy: x < y) : x + z < y + z := by sorry
279281

280282
/-- Proposition 4.2.9(e) (positive multiplication preserves order) / Exercise 4.2.5 -/
281-
theorem Rat.mul_lt_mul_right (x y z:Rat) (hxy: x < y) (hz: z.isPos) : x * z < y * z := by sorry
283+
theorem Rat.mul_lt_mul_right {x y z:Rat} (hxy: x < y) (hz: z.isPos) : x * z < y * z := by sorry
282284

283285
/-- (Not from textbook) The order is decidable. This exercise is only recommended for Lean experts. Alternatively, one can establish this fact in classical logic via `classical; exact Classical.decRel _` -/
284286
instance Rat.decidableRel : DecidableRel (· ≤ · : Rat → Rat → Prop) := by

Analysis/Section_5_4.lean

Lines changed: 110 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,19 @@ theorem Real.trichotomous (x:Real) : x = 0 ∨ x.isPos ∨ x.isNeg := by sorry
5858
/-- Proposition 5.4.4 (basic properties of positive reals) / Exercise 5.4.1 -/
5959
theorem Real.not_zero_pos (x:Real) : ¬ (x = 0 ∧ x.isPos) := by sorry
6060

61+
theorem Real.nonzero_of_pos {x:Real} (hx: x.isPos) : x ≠ 0 := by
62+
have := not_zero_pos x
63+
simp [hx] at this ⊢
64+
assumption
65+
6166
/-- Proposition 5.4.4 (basic properties of positive reals) / Exercise 5.4.1 -/
6267
theorem Real.not_zero_neg (x:Real) : ¬ (x = 0 ∧ x.isNeg) := by sorry
6368

69+
theorem Real.nonzero_of_neg {x:Real} (hx: x.isNeg) : x ≠ 0 := by
70+
have := not_zero_neg x
71+
simp [hx] at this ⊢
72+
assumption
73+
6474
/-- Proposition 5.4.4 (basic properties of positive reals) / Exercise 5.4.1 -/
6575
theorem Real.not_pos_neg (x:Real) : ¬ (x.isPos ∧ x.isNeg) := by sorry
6676

@@ -101,4 +111,103 @@ theorem Real.abs_of_zero : Real.abs 0 = 0 := by
101111
have hneg: ¬ (0:Real).isNeg := by have := Real.not_zero_neg 0; simp only [true_and] at this; assumption
102112
simp [Real.abs, hpos, hneg]
103113

104-
114+
/-- Definition 5.4.6 (Ordering of the reals) -/
115+
instance Real.instLT : LT Real where
116+
lt x y := (x-y).isNeg
117+
118+
/-- Definition 5.4.6 (Ordering of the reals) -/
119+
instance Real.instLE : LE Real where
120+
le x y := (x < y) ∨ (x = y)
121+
122+
theorem Real.lt_iff (x y:Real) : x < y ↔ (x-y).isNeg := by rfl
123+
theorem Real.le_iff (x y:Real) : x ≤ y ↔ (x < y) ∨ (x = y) := by rfl
124+
125+
theorem Real.gt_iff (x y:Real) : x > y ↔ (x-y).isPos := by sorry
126+
theorem Real.ge_iff (x y:Real) : x ≥ y ↔ (x > y) ∨ (x = y) := by sorry
127+
128+
theorem Real.lt_of_coe (q q':ℚ): q < q' ↔ (q:Real) < (q':Real) := by sorry
129+
130+
theorem Real.gt_of_coe (q q':ℚ): q > q' ↔ (q:Real) > (q':Real) := Real.lt_of_coe _ _
131+
132+
/-- Proposition 5.4.7(a) (order trichotomy) / Exercise 5.4.2 -/
133+
theorem Real.trichotomous' (x y z:Real) : x > y ∨ x < y ∨ x = y := by sorry
134+
135+
/-- Proposition 5.4.7(a) (order trichotomy) / Exercise 5.4.2 -/
136+
theorem Real.not_gt_and_lt (x y:Real) : ¬ (x > y ∧ x < y):= by sorry
137+
138+
/-- Proposition 5.4.7(a) (order trichotomy) / Exercise 5.4.2 -/
139+
theorem Real.not_gt_and_eq (x y:Real) : ¬ (x > y ∧ x = y):= by sorry
140+
141+
/-- Proposition 5.4.7(a) (order trichotomy) / Exercise 5.4.2 -/
142+
theorem Real.not_lt_and_eq (x y:Real) : ¬ (x < y ∧ x = y):= by sorry
143+
144+
/-- Proposition 5.4.7(b) (order is anti-symmetric) / Exercise 5.4.2 -/
145+
theorem Real.antisymm (x y:Real) : x < y ↔ (y - x).isPos := by sorry
146+
147+
/-- Proposition 5.4.7(c) (order is transitive) / Exercise 5.4.2 -/
148+
theorem Real.lt_trans {x y z:Real} (hxy: x < y) (hyz: y < z) : x < z := by sorry
149+
150+
/-- Proposition 5.4.7(d) (addition preserves order) / Exercise 5.4.2 -/
151+
theorem Real.add_lt_add_right {x y:Real} (z:Real) (hxy: x < y) : x + z < y + z := by sorry
152+
153+
/-- Proposition 5.4.7(e) (positive multiplication preserves order) / Exercise 5.4.2 -/
154+
theorem Real.mul_lt_mul_right {x y z:Real} (hxy: x < y) (hz: z.isPos) : x * z < y * z := by
155+
rw [antisymm] at hxy ⊢
156+
convert pos_mul hxy hz using 1
157+
ring
158+
159+
/-- Proposition 5.4.7(e) (positive multiplication preserves order) / Exercise 5.4.2 -/
160+
theorem Real.mul_le_mul_left {x y z:Real} (hxy: x ≤ y) (hz: z.isPos) : z * x ≤ z * y := by sorry
161+
162+
theorem Real.mul_pos_neg {x y:Real} (hx: x.isPos) (hy: y.isNeg) : (x * y).isNeg := by
163+
sorry
164+
165+
/-- (Not from textbook) Real has the structure of a linear ordering. The order is not computable, and so classical logic is required to impose decidability.-/
166+
noncomputable instance Real.instLinearOrder : LinearOrder Real where
167+
le_refl := sorry
168+
le_trans := sorry
169+
lt_iff_le_not_le := sorry
170+
le_antisymm := sorry
171+
le_total := sorry
172+
toDecidableLE := by
173+
classical
174+
exact Classical.decRel _
175+
176+
/-- Proposition 5.4.8 -/
177+
theorem Real.inv_of_pos {x:Real} (hx: x.isPos) : x⁻¹.isPos := by
178+
have hnon: x ≠ 0 := nonzero_of_pos hx
179+
have hident := inv_mul_self hnon
180+
have hinv_non: x⁻¹ ≠ 0 := by contrapose! hident; simp [hident]
181+
have hnonneg : ¬ x⁻¹.isNeg := by
182+
intro h
183+
have := mul_pos_neg hx h
184+
have id : -(1:Real) = (-1:ℚ) := by simp
185+
simp only [hident, neg_iff_pos_of_neg, id, pos_of_coe] at this
186+
linarith
187+
have trich := Real.trichotomous x⁻¹
188+
simp [hinv_non, hnonneg] at trich
189+
assumption
190+
191+
theorem Real.inv_of_gt {x y:Real} (hx: x.isPos) (hy: y.isPos) (hxy: x > y) : x⁻¹ < y⁻¹ := by
192+
have hxnon: x ≠ 0 := nonzero_of_pos hx
193+
have hynon: y ≠ 0 := nonzero_of_pos hy
194+
have hxinv : x⁻¹.isPos := inv_of_pos hx
195+
have hyinv : y⁻¹.isPos := inv_of_pos hy
196+
by_contra! this
197+
have : (1:Real) > 1 := calc
198+
1 = x * x⁻¹ := (inv_mul_self hxnon).symm
199+
_ > y * x⁻¹ := mul_lt_mul_right hxy hxinv
200+
_ ≥ y * y⁻¹ := mul_le_mul_left this hy
201+
_ = _ := inv_mul_self hynon
202+
simp at this
203+
204+
/-- (Not from textbook) Real has the structure of a strict ordered ring. -/
205+
instance Real.instIsStrictOrderedRing : IsStrictOrderedRing Real where
206+
add_le_add_left := by sorry
207+
add_le_add_right := by sorry
208+
mul_lt_mul_of_pos_left := by sorry
209+
mul_lt_mul_of_pos_right := by sorry
210+
le_of_add_le_add_left := by sorry
211+
zero_le_one := by sorry
212+
213+

0 commit comments

Comments
 (0)