Skip to content

Commit f27645e

Browse files
committed
Rename Real.is{Pos,Neg}
1 parent bd166f0 commit f27645e

2 files changed

Lines changed: 45 additions & 46 deletions

File tree

analysis/Analysis/Section_5_4.lean

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -65,95 +65,94 @@ theorem BoundedAwayZero.boundedAwayNeg {a:ℕ → ℚ} (ha: BoundedAwayNeg a) :
6565
theorem not_boundedAwayPos_boundedAwayNeg {a:ℕ → ℚ} : ¬ (BoundedAwayPos a ∧ BoundedAwayNeg a) := by
6666
intro ⟨ ⟨ _, _, h2⟩ , ⟨ _, _, h4 ⟩ ⟩; linarith [h2 0, h4 0]
6767

68-
abbrev Real.isPos (x:Real) : Prop :=
68+
abbrev Real.IsPos (x:Real) : Prop :=
6969
∃ a:ℕ → ℚ, BoundedAwayPos a ∧ (a:Sequence).IsCauchy ∧ x = LIM a
7070

71-
abbrev Real.isNeg (x:Real) : Prop :=
71+
abbrev Real.IsNeg (x:Real) : Prop :=
7272
∃ a:ℕ → ℚ, BoundedAwayNeg a ∧ (a:Sequence).IsCauchy ∧ x = LIM a
7373

7474
theorem Real.isPos_def (x:Real) :
75-
Real.isPos x ↔ ∃ a:ℕ → ℚ, BoundedAwayPos a ∧ (a:Sequence).IsCauchy ∧ x = LIM a := by rfl
75+
Real.IsPos x ↔ ∃ a:ℕ → ℚ, BoundedAwayPos a ∧ (a:Sequence).IsCauchy ∧ x = LIM a := by rfl
7676

7777
theorem Real.isNeg_def (x:Real) :
78-
Real.isNeg x ↔ ∃ a:ℕ → ℚ, BoundedAwayNeg a ∧ (a:Sequence).IsCauchy ∧ x = LIM a := by rfl
78+
Real.IsNeg x ↔ ∃ a:ℕ → ℚ, BoundedAwayNeg a ∧ (a:Sequence).IsCauchy ∧ x = LIM a := by rfl
7979

8080
/-- Proposition 5.4.4 (basic properties of positive reals) / Exercise 5.4.1 -/
81-
theorem Real.trichotomous (x:Real) : x = 0 ∨ x.isPos ∨ x.isNeg := by sorry
81+
theorem Real.trichotomous (x:Real) : x = 0 ∨ x.IsPos ∨ x.IsNeg := by sorry
8282

8383
/-- Proposition 5.4.4 (basic properties of positive reals) / Exercise 5.4.1 -/
84-
theorem Real.not_zero_pos (x:Real) : ¬ (x = 0 ∧ x.isPos) := by sorry
84+
theorem Real.not_zero_pos (x:Real) : ¬ (x = 0 ∧ x.IsPos) := by sorry
8585

86-
theorem Real.nonzero_of_pos {x:Real} (hx: x.isPos) : x ≠ 0 := by
86+
theorem Real.nonzero_of_pos {x:Real} (hx: x.IsPos) : x ≠ 0 := by
8787
have := not_zero_pos x
8888
simpa [hx] using this
8989

9090
/-- Proposition 5.4.4 (basic properties of positive reals) / Exercise 5.4.1 -/
91-
theorem Real.not_zero_neg (x:Real) : ¬ (x = 0 ∧ x.isNeg) := by sorry
91+
theorem Real.not_zero_neg (x:Real) : ¬ (x = 0 ∧ x.IsNeg) := by sorry
9292

93-
theorem Real.nonzero_of_neg {x:Real} (hx: x.isNeg) : x ≠ 0 := by
93+
theorem Real.nonzero_of_neg {x:Real} (hx: x.IsNeg) : x ≠ 0 := by
9494
have := not_zero_neg x
9595
simpa [hx] using this
9696

9797
/-- Proposition 5.4.4 (basic properties of positive reals) / Exercise 5.4.1 -/
98-
theorem Real.not_pos_neg (x:Real) : ¬ (x.isPos ∧ x.isNeg) := by sorry
98+
theorem Real.not_pos_neg (x:Real) : ¬ (x.IsPos ∧ x.IsNeg) := by sorry
9999

100100
/-- Proposition 5.4.4 (basic properties of positive reals) / Exercise 5.4.1 -/
101101
@[simp]
102-
theorem Real.neg_iff_pos_of_neg (x:Real) : x.isNeg ↔ (-x).isPos := by sorry
102+
theorem Real.neg_iff_pos_of_neg (x:Real) : x.IsNeg ↔ (-x).IsPos := by sorry
103103

104104
/-- Proposition 5.4.4 (basic properties of positive reals) / Exercise 5.4.1-/
105-
theorem Real.pos_add {x y:Real} (hx: x.isPos) (hy: y.isPos) : (x+y).isPos := by sorry
105+
theorem Real.pos_add {x y:Real} (hx: x.IsPos) (hy: y.IsPos) : (x+y).IsPos := by sorry
106106

107107
/-- Proposition 5.4.4 (basic properties of positive reals) / Exercise 5.4.1 -/
108-
theorem Real.pos_mul {x y:Real} (hx: x.isPos) (hy: y.isPos) : (x*y).isPos := by sorry
108+
theorem Real.pos_mul {x y:Real} (hx: x.IsPos) (hy: y.IsPos) : (x*y).IsPos := by sorry
109109

110-
theorem Real.pos_of_coe (q:ℚ) : (q:Real).isPos ↔ q > 0 := by sorry
110+
theorem Real.pos_of_coe (q:ℚ) : (q:Real).IsPos ↔ q > 0 := by sorry
111111

112-
113-
theorem Real.neg_of_coe (q:ℚ) : (q:Real).isNeg ↔ q < 0 := by sorry
112+
theorem Real.neg_of_coe (q:ℚ) : (q:Real).IsNeg ↔ q < 0 := by sorry
114113

115114
open Classical in
116115
/-- Need to use classical logic here because isPos and isNeg are not decidable -/
117-
noncomputable abbrev Real.abs (x:Real) : Real := if x.isPos then x else (if x.isNeg then -x else 0)
116+
noncomputable abbrev Real.abs (x:Real) : Real := if x.IsPos then x else (if x.IsNeg then -x else 0)
118117

119118
/-- Definition 5.4.5 (absolute value) -/
120119
@[simp]
121-
theorem Real.abs_of_pos (x:Real) (hx: x.isPos) : Real.abs x = x := by
120+
theorem Real.abs_of_pos (x:Real) (hx: x.IsPos) : Real.abs x = x := by
122121
simp [Real.abs, hx]
123122

124123
/-- Definition 5.4.5 (absolute value) -/
125124
@[simp]
126-
theorem Real.abs_of_neg (x:Real) (hx: x.isNeg) : Real.abs x = -x := by
127-
have : ¬ x.isPos := by have := Real.not_pos_neg x; simpa [hx] using this
125+
theorem Real.abs_of_neg (x:Real) (hx: x.IsNeg) : Real.abs x = -x := by
126+
have : ¬ x.IsPos := by have := Real.not_pos_neg x; simpa [hx] using this
128127
simp [Real.abs, hx, this]
129128

130129
/-- Definition 5.4.5 (absolute value) -/
131130
@[simp]
132131
theorem Real.abs_of_zero : Real.abs 0 = 0 := by
133-
have hpos: ¬ (0:Real).isPos := by have := Real.not_zero_pos 0; simpa using this
134-
have hneg: ¬ (0:Real).isNeg := by have := Real.not_zero_neg 0; simpa using this
132+
have hpos: ¬ (0:Real).IsPos := by have := Real.not_zero_pos 0; simpa using this
133+
have hneg: ¬ (0:Real).IsNeg := by have := Real.not_zero_neg 0; simpa using this
135134
simp [Real.abs, hpos, hneg]
136135

137136
/-- Definition 5.4.6 (Ordering of the reals) -/
138137
instance Real.instLT : LT Real where
139-
lt x y := (x-y).isNeg
138+
lt x y := (x-y).IsNeg
140139

141140
/-- Definition 5.4.6 (Ordering of the reals) -/
142141
instance Real.instLE : LE Real where
143142
le x y := (x < y) ∨ (x = y)
144143

145-
theorem Real.lt_iff (x y:Real) : x < y ↔ (x-y).isNeg := by rfl
144+
theorem Real.lt_iff (x y:Real) : x < y ↔ (x-y).IsNeg := by rfl
146145
theorem Real.le_iff (x y:Real) : x ≤ y ↔ (x < y) ∨ (x = y) := by rfl
147146

148-
theorem Real.gt_iff (x y:Real) : x > y ↔ (x-y).isPos := by sorry
147+
theorem Real.gt_iff (x y:Real) : x > y ↔ (x-y).IsPos := by sorry
149148
theorem Real.ge_iff (x y:Real) : x ≥ y ↔ (x > y) ∨ (x = y) := by sorry
150149

151150
theorem Real.lt_of_coe (q q':ℚ): q < q' ↔ (q:Real) < (q':Real) := by sorry
152151

153152
theorem Real.gt_of_coe (q q':ℚ): q > q' ↔ (q:Real) > (q':Real) := Real.lt_of_coe _ _
154153

155-
theorem Real.isPos_iff (x:Real) : x.isPos ↔ x > 0 := by sorry
156-
theorem Real.isNeg_iff (x:Real) : x.isNeg ↔ x < 0 := by sorry
154+
theorem Real.isPos_iff (x:Real) : x.IsPos ↔ x > 0 := by sorry
155+
theorem Real.isNeg_iff (x:Real) : x.IsNeg ↔ x < 0 := by sorry
157156

158157
/-- Proposition 5.4.7(a) (order trichotomy) / Exercise 5.4.2 -/
159158
theorem Real.trichotomous' (x y:Real) : x > y ∨ x < y ∨ x = y := by sorry
@@ -168,7 +167,7 @@ theorem Real.not_gt_and_eq (x y:Real) : ¬ (x > y ∧ x = y):= by sorry
168167
theorem Real.not_lt_and_eq (x y:Real) : ¬ (x < y ∧ x = y):= by sorry
169168

170169
/-- Proposition 5.4.7(b) (order is anti-symmetric) / Exercise 5.4.2 -/
171-
theorem Real.antisymm (x y:Real) : x < y ↔ (y - x).isPos := by sorry
170+
theorem Real.antisymm (x y:Real) : x < y ↔ (y - x).IsPos := by sorry
172171

173172
/-- Proposition 5.4.7(c) (order is transitive) / Exercise 5.4.2 -/
174173
theorem Real.lt_trans {x y z:Real} (hxy: x < y) (hyz: y < z) : x < z := by sorry
@@ -177,13 +176,13 @@ theorem Real.lt_trans {x y z:Real} (hxy: x < y) (hyz: y < z) : x < z := by sorry
177176
theorem Real.add_lt_add_right {x y:Real} (z:Real) (hxy: x < y) : x + z < y + z := by sorry
178177

179178
/-- Proposition 5.4.7(e) (positive multiplication preserves order) / Exercise 5.4.2 -/
180-
theorem Real.mul_lt_mul_right {x y z:Real} (hxy: x < y) (hz: z.isPos) : x * z < y * z := by
179+
theorem Real.mul_lt_mul_right {x y z:Real} (hxy: x < y) (hz: z.IsPos) : x * z < y * z := by
181180
rw [antisymm] at hxy ⊢; convert pos_mul hxy hz using 1; ring
182181

183182
/-- Proposition 5.4.7(e) (positive multiplication preserves order) / Exercise 5.4.2 -/
184-
theorem Real.mul_le_mul_left {x y z:Real} (hxy: x ≤ y) (hz: z.isPos) : z * x ≤ z * y := by sorry
183+
theorem Real.mul_le_mul_left {x y z:Real} (hxy: x ≤ y) (hz: z.IsPos) : z * x ≤ z * y := by sorry
185184

186-
theorem Real.mul_pos_neg {x y:Real} (hx: x.isPos) (hy: y.isNeg) : (x * y).isNeg := by
185+
theorem Real.mul_pos_neg {x y:Real} (hx: x.IsPos) (hy: y.IsNeg) : (x * y).IsNeg := by
187186
sorry
188187

189188
open Classical in
@@ -200,25 +199,25 @@ noncomputable instance Real.instLinearOrder : LinearOrder Real where
200199
toDecidableLE := Classical.decRel _
201200

202201
/-- Proposition 5.4.8 -/
203-
theorem Real.inv_of_pos {x:Real} (hx: x.isPos) : x⁻¹.isPos := by
202+
theorem Real.inv_of_pos {x:Real} (hx: x.IsPos) : x⁻¹.IsPos := by
204203
observe hnon: x ≠ 0
205204
observe hident : x⁻¹ * x = 1
206205
have hinv_non: x⁻¹ ≠ 0 := by contrapose! hident; simp [hident]
207-
have hnonneg : ¬ x⁻¹.isNeg := by
206+
have hnonneg : ¬ x⁻¹.IsNeg := by
208207
intro h
209-
observe : (x * x⁻¹).isNeg
208+
observe : (x * x⁻¹).IsNeg
210209
have id : -(1:Real) = (-1:ℚ) := by simp
211210
simp only [hident, neg_iff_pos_of_neg, id, pos_of_coe, self_mul_inv hnon] at this
212211
linarith
213212
have trich := Real.trichotomous x⁻¹
214213
simpa [hinv_non, hnonneg] using trich
215214

216-
theorem Real.div_of_pos {x y:Real} (hx: x.isPos) (hy: y.isPos) : (x/y).isPos := by sorry
215+
theorem Real.div_of_pos {x y:Real} (hx: x.IsPos) (hy: y.IsPos) : (x/y).IsPos := by sorry
217216

218-
theorem Real.inv_of_gt {x y:Real} (hx: x.isPos) (hy: y.isPos) (hxy: x > y) : x⁻¹ < y⁻¹ := by
217+
theorem Real.inv_of_gt {x y:Real} (hx: x.IsPos) (hy: y.IsPos) (hxy: x > y) : x⁻¹ < y⁻¹ := by
219218
observe hxnon: x ≠ 0
220219
observe hynon: y ≠ 0
221-
observe hxinv : x⁻¹.isPos
220+
observe hxinv : x⁻¹.IsPos
222221
by_contra! this
223222
have : (1:Real) > 1 := calc
224223
1 = x * x⁻¹ := (self_mul_inv hxnon).symm
@@ -282,7 +281,7 @@ theorem Real.LIM_mono_fail :
282281
sorry
283282

284283
/-- Proposition 5.4.12 (Bounding reals by rationals) -/
285-
theorem Real.exists_rat_le_and_nat_ge {x:Real} (hx: x.isPos) :
284+
theorem Real.exists_rat_le_and_nat_ge {x:Real} (hx: x.IsPos) :
286285
(∃ q:ℚ, q > 0 ∧ (q:Real) ≤ x) ∧ ∃ N:ℕ, x < (N:Real) := by
287286
-- This proof is written to follow the structure of the original text.
288287
rw [isPos_def] at hx; obtain ⟨ a, hbound, hcauchy, heq ⟩ := hx
@@ -304,7 +303,7 @@ theorem Real.exists_rat_le_and_nat_ge {x:Real} (hx: x.isPos) :
304303
_ = N := rfl
305304

306305
/-- Corollary 5.4.13 (Archimedean property ) -/
307-
theorem Real.le_mul {ε:Real} (hε: ε.isPos) (x:Real) : ∃ M:ℕ, M > 0 ∧ M * ε > x := by
306+
theorem Real.le_mul {ε:Real} (hε: ε.IsPos) (x:Real) : ∃ M:ℕ, M > 0 ∧ M * ε > x := by
308307
-- This proof is written to follow the structure of the original text.
309308
rcases trichotomous x with rfl | hx | hx
310309
. use 1; simpa [isPos_iff] using
@@ -324,7 +323,7 @@ theorem Real.rat_between {x y:Real} (hxy: x < y) : ∃ q:ℚ, x < (q:Real) ∧ (
324323
theorem Real.floor_exist (x:Real) : ∃ n:ℤ, (n:Real) ≤ x ∧ x < (n:Real)+1 := by sorry
325324

326325
/-- Exercise 5.4.4 -/
327-
theorem Real.exist_inv_nat_le {x:Real} (hx: x.isPos) : ∃ N, N>0 ∧ (N:Real)⁻¹ < x := by sorry
326+
theorem Real.exist_inv_nat_le {x:Real} (hx: x.IsPos) : ∃ N, N>0 ∧ (N:Real)⁻¹ < x := by sorry
328327

329328
/-- Exercise 5.4.6 -/
330329
theorem Real.dist_lt_iff (ε x y:Real) : |x-y| < ε ↔ y-ε < x ∧ x < y+ε := by sorry
@@ -366,7 +365,7 @@ theorem Real.max_self (x:Real) : max x x = x := by sorry
366365
theorem Real.max_add (x y z:Real) : max (x + z) (y + z) = max x y + z := by sorry
367366

368367
/-- Exercise 5.4.9 -/
369-
theorem Real.max_mul (x y :Real) {z:Real} (hz: z.isPos) : max (x * z) (y * z) = max x y * z := by
368+
theorem Real.max_mul (x y :Real) {z:Real} (hz: z.IsPos) : max (x * z) (y * z) = max x y * z := by
370369
sorry
371370
/- Additional exercise: What happens if z is negative? -/
372371

@@ -380,14 +379,14 @@ theorem Real.min_self (x:Real) : min x x = x := by sorry
380379
theorem Real.min_add (x y z:Real) : min (x + z) (y + z) = min x y + z := by sorry
381380

382381
/-- Exercise 5.4.9 -/
383-
theorem Real.min_mul (x y :Real) {z:Real} (hz: z.isPos) : min (x * z) (y * z) = min x y * z := by
382+
theorem Real.min_mul (x y :Real) {z:Real} (hz: z.IsPos) : min (x * z) (y * z) = min x y * z := by
384383
sorry
385384

386385
/-- Exercise 5.4.9 -/
387-
theorem Real.inv_max {x y :Real} (hx:x.isPos) (hy:y.isPos) : (max x y)⁻¹ = min x⁻¹ y⁻¹ := by sorry
386+
theorem Real.inv_max {x y :Real} (hx:x.IsPos) (hy:y.IsPos) : (max x y)⁻¹ = min x⁻¹ y⁻¹ := by sorry
388387

389388
/-- Exercise 5.4.9 -/
390-
theorem Real.inv_min {x y :Real} (hx:x.isPos) (hy:y.isPos) : (min x y)⁻¹ = max x⁻¹ y⁻¹ := by sorry
389+
theorem Real.inv_min {x y :Real} (hx:x.IsPos) (hy:y.IsPos) : (min x y)⁻¹ = max x⁻¹ y⁻¹ := by sorry
391390

392391
/-- Not from textbook: the rationals map as an ordered ring homomorphism into the reals. -/
393392
abbrev Real.ratCast_ordered_hom : ℚ →+*o Real where

analysis/Analysis/Section_5_5.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ lemma Real.LUB_claim1 (n : ℕ) {E: Set Real} (hE: Set.Nonempty E) (hbound: BddA
103103
observe hx₀ : x₀ ∈ E
104104

105105
set ε := ((1/(n+1):ℚ):Real)
106-
have hpos : ε.isPos := by simp [isPos_iff, ε, ←lt_of_coe]; positivity
106+
have hpos : ε.IsPos := by simp [isPos_iff, ε, ←lt_of_coe]; positivity
107107
apply existsUnique_of_exists_of_unique
108108
. rw [bddAbove_def] at hbound; obtain ⟨ M, hbound ⟩ := hbound
109109
obtain ⟨ K, _, hK ⟩ := le_mul hpos M
@@ -251,7 +251,7 @@ theorem Real.exist_sqrt_two : ∃ x:Real, x^2 = 2 := by
251251
have claim3 : IsLUB E x := by solve_by_elim [ExtendedReal.sup_of_bounded]
252252
have claim4 : x ≥ 1 := by rw [isLUB_def, upperBound_def] at claim3; solve_by_elim [claim3.1]
253253
have claim5 : x ≤ 2 := by rw [isLUB_def] at claim3; solve_by_elim [claim3.2]
254-
have claim6 : x.isPos := by rw [isPos_iff]; linarith
254+
have claim6 : x.IsPos := by rw [isPos_iff]; linarith
255255
use x
256256
rcases trichotomous' (x^2) 2 with h | h | h
257257
. have claim11: ∃ ε, 0 < ε ∧ ε < 1 ∧ x^2 - 4*ε > 2 := by

0 commit comments

Comments
 (0)