@@ -11,14 +11,17 @@ import order.conditionally_complete_lattice data.real.cau_seq_completion
11
11
12
12
def real := @cau_seq.completion.Cauchy ℚ _ _ _ abs _
13
13
notation `ℝ ` := real
14
- local attribute [reducible] real
15
14
16
15
namespace real
17
16
open cau_seq cau_seq.completion
18
17
19
18
def of_rat (x : ℚ) : ℝ := of_rat x
20
19
21
- instance : comm_ring ℝ := cau_seq.completion.comm_ring
20
+ def mk (x : cau_seq ℚ abs) : ℝ := cau_seq.completion.mk x
21
+
22
+ def comm_ring_aux : comm_ring ℝ := cau_seq.completion.comm_ring
23
+
24
+ instance : comm_ring ℝ := { ..comm_ring_aux }
22
25
23
26
/- Extra instances to short-circuit type class resolution -/
24
27
instance : ring ℝ := by apply_instance
@@ -49,6 +52,12 @@ instance : has_lt ℝ :=
49
52
50
53
@[simp] theorem mk_lt {f g : cau_seq ℚ abs} : mk f < mk g ↔ f < g := iff.rfl
51
54
55
+ theorem mk_eq {f g : cau_seq ℚ abs} : mk f = mk g ↔ f ≈ g := mk_eq
56
+
57
+ theorem quotient_mk_eq_mk (f : cau_seq ℚ abs) : ⟦f⟧ = mk f := rfl
58
+
59
+ theorem mk_eq_mk {f : cau_seq ℚ abs} : cau_seq.completion.mk f = mk f := rfl
60
+
52
61
@[simp] theorem mk_pos {f : cau_seq ℚ abs} : 0 < mk f ↔ pos f :=
53
62
iff_of_eq (congr_arg pos (sub_zero f))
54
63
@@ -66,13 +75,13 @@ instance : linear_order ℝ :=
66
75
{ le := (≤), lt := (<),
67
76
le_refl := λ a, or.inr rfl,
68
77
le_trans := λ a b c, quotient.induction_on₃ a b c $
69
- λ f g h, by simpa using le_trans,
78
+ λ f g h, by simpa [quotient_mk_eq_mk] using le_trans,
70
79
lt_iff_le_not_le := λ a b, quotient.induction_on₂ a b $
71
- λ f g, by simpa using lt_iff_le_not_le,
80
+ λ f g, by simpa [quotient_mk_eq_mk] using lt_iff_le_not_le,
72
81
le_antisymm := λ a b, quotient.induction_on₂ a b $
73
- λ f g, by simpa [mk_eq] using @cau_seq.le_antisymm _ _ f g,
82
+ λ f g, by simpa [mk_eq, quotient_mk_eq_mk ] using @cau_seq.le_antisymm _ _ f g,
74
83
le_total := λ a b, quotient.induction_on₂ a b $
75
- λ f g, by simpa using le_total f g }
84
+ λ f g, by simpa [quotient_mk_eq_mk] using le_total f g }
76
85
77
86
instance : partial_order ℝ := by apply_instance
78
87
instance : preorder ℝ := by apply_instance
@@ -82,7 +91,9 @@ theorem of_rat_lt {x y : ℚ} : of_rat x < of_rat y ↔ x < y := const_lt
82
91
protected theorem zero_lt_one : (0 : ℝ) < 1 := of_rat_lt.2 zero_lt_one
83
92
84
93
protected theorem mul_pos {a b : ℝ} : 0 < a → 0 < b → 0 < a * b :=
85
- quotient.induction_on₂ a b $ λ f g, by simpa using cau_seq.mul_pos
94
+ quotient.induction_on₂ a b $ λ f g,
95
+ show pos (f - 0 ) → pos (g - 0 ) → pos (f * g - 0 ),
96
+ by simpa using cau_seq.mul_pos
86
97
87
98
instance : linear_ordered_comm_ring ℝ :=
88
99
{ add_le_add_left := λ a b h c,
@@ -112,19 +123,18 @@ instance : domain ℝ := by apply_instance
112
123
local attribute [instance] classical.prop_decidable
113
124
114
125
noncomputable instance : discrete_linear_ordered_field ℝ :=
115
- { inv := has_inv.inv,
116
- inv_mul_cancel := @cau_seq.completion.inv_mul_cancel _ _ _ _ _ _,
117
- mul_inv_cancel := λ x x0, by rw [mul_comm, cau_seq.completion.inv_mul_cancel x0],
118
- inv_zero := inv_zero,
119
- decidable_le := by apply_instance,
120
- ..real.linear_ordered_comm_ring }
126
+ { decidable_le := by apply_instance,
127
+ ..real.linear_ordered_comm_ring,
128
+ ..real.domain,
129
+ ..cau_seq.completion.discrete_field }
121
130
122
131
/- Extra instances to short-circuit type class resolution -/
132
+
123
133
noncomputable instance : linear_ordered_field ℝ := by apply_instance
124
134
noncomputable instance : decidable_linear_ordered_comm_ring ℝ := by apply_instance
125
135
noncomputable instance : decidable_linear_ordered_semiring ℝ := by apply_instance
126
136
noncomputable instance : decidable_linear_ordered_comm_group ℝ := by apply_instance
127
- noncomputable instance real. discrete_field : discrete_field ℝ := by apply_instance
137
+ noncomputable instance discrete_field : discrete_field ℝ := by apply_instance
128
138
noncomputable instance : field ℝ := by apply_instance
129
139
noncomputable instance : division_ring ℝ := by apply_instance
130
140
noncomputable instance : integral_domain ℝ := by apply_instance
159
169
160
170
theorem mk_le_of_forall_le {f : cau_seq ℚ abs} {x : ℝ} :
161
171
(∃ i, ∀ j ≥ i, (f j : ℝ) ≤ x) → mk f ≤ x
162
- | ⟨i, H⟩ := by rw [← neg_le_neg_iff, mk_neg]; exact
172
+ | ⟨i, H⟩ := by rw [← neg_le_neg_iff, ← mk_eq_mk, mk_neg]; exact
163
173
le_mk_of_forall_le ⟨i, λ j ij, by simp [H _ ij]⟩
164
174
165
175
theorem mk_near_of_forall_near {f : cau_seq ℚ abs} {x : ℝ} {ε : ℝ}
@@ -176,6 +186,12 @@ let ⟨M, M0, H⟩ := f.bounded' 0 in
176
186
⟨M, mk_le_of_forall_le ⟨0 , λ i _,
177
187
rat.cast_le.2 $ le_of_lt (abs_lt.1 (H i)).2 ⟩⟩
178
188
189
+ /- mark `real` irreducible in order to prevent `auto_cases` unfolding reals,
190
+ since users rarely want to consider real numbers as Cauchy sequences.
191
+ Marking `comm_ring_aux` `irreducible` is done to ensure that there are no problems
192
+ with non definitionally equal instances, caused by making `real` irreducible-/
193
+ attribute [irreducible] real comm_ring_aux
194
+
179
195
noncomputable instance : floor_ring ℝ := archimedean.floor_ring _
180
196
181
197
theorem is_cau_seq_iff_lift {f : ℕ → ℚ} : is_cau_seq abs f ↔ is_cau_seq abs (λ i, (f i : ℝ)) :=
@@ -188,7 +204,7 @@ theorem is_cau_seq_iff_lift {f : ℕ → ℚ} : is_cau_seq abs f ↔ is_cau_seq
188
204
189
205
theorem of_near (f : ℕ → ℚ) (x : ℝ)
190
206
(h : ∀ ε > 0 , ∃ i, ∀ j ≥ i, abs ((f j : ℝ) - x) < ε) :
191
- ∃ h', cau_seq.completion .mk ⟨f, h'⟩ = x :=
207
+ ∃ h', real .mk ⟨f, h'⟩ = x :=
192
208
⟨is_cau_seq_iff_lift.2 (of_near _ (const abs x) h),
193
209
sub_eq_zero.1 $ abs_eq_zero.1 $
194
210
eq_of_le_of_forall_le_of_dense (abs_nonneg _) $ λ ε ε0 ,
0 commit comments