paulson@7219
|
1 |
(* Title : PReal.thy
|
paulson@7219
|
2 |
ID : $Id$
|
paulson@5078
|
3 |
Author : Jacques D. Fleuriot
|
paulson@5078
|
4 |
Copyright : 1998 University of Cambridge
|
paulson@5078
|
5 |
Description : The positive reals as Dedekind sections of positive
|
paulson@14335
|
6 |
rationals. Fundamentals of Abstract Analysis [Gleason- p. 121]
|
paulson@5078
|
7 |
provides some of the definitions.
|
paulson@5078
|
8 |
*)
|
paulson@5078
|
9 |
|
paulson@14387
|
10 |
theory PReal = Rational:
|
paulson@5078
|
11 |
|
paulson@14365
|
12 |
text{*Could be generalized and moved to @{text Ring_and_Field}*}
|
paulson@14365
|
13 |
lemma add_eq_exists: "\<exists>x. a+x = (b::rat)"
|
paulson@14365
|
14 |
by (rule_tac x="b-a" in exI, simp)
|
paulson@14335
|
15 |
|
paulson@14365
|
16 |
text{*As a special case, the sum of two positives is positive. One of the
|
paulson@14365
|
17 |
premises could be weakened to the relation @{text "\<le>"}.*}
|
paulson@14365
|
18 |
lemma pos_add_strict: "[|0<a; b<c|] ==> b < a + (c::'a::ordered_semiring)"
|
paulson@14365
|
19 |
by (insert add_strict_mono [of 0 a b c], simp)
|
paulson@14365
|
20 |
|
paulson@14365
|
21 |
lemma interval_empty_iff:
|
paulson@14365
|
22 |
"({y::'a::ordered_field. x < y & y < z} = {}) = (~(x < z))"
|
paulson@14365
|
23 |
by (blast dest: dense intro: order_less_trans)
|
paulson@14365
|
24 |
|
paulson@14365
|
25 |
|
paulson@14365
|
26 |
constdefs
|
paulson@14365
|
27 |
cut :: "rat set => bool"
|
paulson@14365
|
28 |
"cut A == {} \<subset> A &
|
paulson@14365
|
29 |
A < {r. 0 < r} &
|
paulson@14365
|
30 |
(\<forall>y \<in> A. ((\<forall>z. 0<z & z < y --> z \<in> A) & (\<exists>u \<in> A. y < u)))"
|
paulson@14365
|
31 |
|
paulson@14365
|
32 |
|
paulson@14365
|
33 |
lemma cut_of_rat:
|
paulson@14365
|
34 |
assumes q: "0 < q" shows "cut {r::rat. 0 < r & r < q}"
|
paulson@14365
|
35 |
proof -
|
paulson@14365
|
36 |
let ?A = "{r::rat. 0 < r & r < q}"
|
paulson@14365
|
37 |
from q have pos: "?A < {r. 0 < r}" by force
|
paulson@14365
|
38 |
have nonempty: "{} \<subset> ?A"
|
paulson@14365
|
39 |
proof
|
paulson@14365
|
40 |
show "{} \<subseteq> ?A" by simp
|
paulson@14365
|
41 |
show "{} \<noteq> ?A"
|
paulson@14365
|
42 |
by (force simp only: q eq_commute [of "{}"] interval_empty_iff)
|
paulson@14365
|
43 |
qed
|
paulson@14365
|
44 |
show ?thesis
|
paulson@14365
|
45 |
by (simp add: cut_def pos nonempty,
|
paulson@14365
|
46 |
blast dest: dense intro: order_less_trans)
|
paulson@14365
|
47 |
qed
|
paulson@14365
|
48 |
|
paulson@14365
|
49 |
|
paulson@14365
|
50 |
typedef preal = "{A. cut A}"
|
paulson@14365
|
51 |
by (blast intro: cut_of_rat [OF zero_less_one])
|
paulson@14335
|
52 |
|
paulson@14335
|
53 |
instance preal :: ord ..
|
paulson@14335
|
54 |
instance preal :: plus ..
|
paulson@14365
|
55 |
instance preal :: minus ..
|
paulson@14335
|
56 |
instance preal :: times ..
|
paulson@14365
|
57 |
instance preal :: inverse ..
|
paulson@14335
|
58 |
|
paulson@5078
|
59 |
|
paulson@5078
|
60 |
constdefs
|
paulson@14365
|
61 |
preal_of_rat :: "rat => preal"
|
paulson@14365
|
62 |
"preal_of_rat q == Abs_preal({x::rat. 0 < x & x < q})"
|
paulson@5078
|
63 |
|
paulson@14335
|
64 |
psup :: "preal set => preal"
|
paulson@14365
|
65 |
"psup(P) == Abs_preal(\<Union>X \<in> P. Rep_preal(X))"
|
paulson@14365
|
66 |
|
paulson@14365
|
67 |
add_set :: "[rat set,rat set] => rat set"
|
paulson@14365
|
68 |
"add_set A B == {w. \<exists>x \<in> A. \<exists>y \<in> B. w = x + y}"
|
paulson@14365
|
69 |
|
paulson@14365
|
70 |
diff_set :: "[rat set,rat set] => rat set"
|
paulson@14365
|
71 |
"diff_set A B == {w. \<exists>x. 0 < w & 0 < x & x \<notin> B & x + w \<in> A}"
|
paulson@14365
|
72 |
|
paulson@14365
|
73 |
mult_set :: "[rat set,rat set] => rat set"
|
paulson@14365
|
74 |
"mult_set A B == {w. \<exists>x \<in> A. \<exists>y \<in> B. w = x * y}"
|
paulson@14365
|
75 |
|
paulson@14365
|
76 |
inverse_set :: "rat set => rat set"
|
paulson@14365
|
77 |
"inverse_set A == {x. \<exists>y. 0 < x & x < y & inverse y \<notin> A}"
|
paulson@14365
|
78 |
|
paulson@5078
|
79 |
|
paulson@14335
|
80 |
defs (overloaded)
|
paulson@5078
|
81 |
|
paulson@14365
|
82 |
preal_less_def:
|
paulson@14365
|
83 |
"R < (S::preal) == Rep_preal R < Rep_preal S"
|
paulson@14365
|
84 |
|
paulson@14365
|
85 |
preal_le_def:
|
paulson@14365
|
86 |
"R \<le> (S::preal) == Rep_preal R \<subseteq> Rep_preal S"
|
paulson@14365
|
87 |
|
paulson@14335
|
88 |
preal_add_def:
|
paulson@14365
|
89 |
"R + S == Abs_preal (add_set (Rep_preal R) (Rep_preal S))"
|
paulson@14365
|
90 |
|
paulson@14365
|
91 |
preal_diff_def:
|
paulson@14365
|
92 |
"R - S == Abs_preal (diff_set (Rep_preal R) (Rep_preal S))"
|
paulson@5078
|
93 |
|
paulson@14335
|
94 |
preal_mult_def:
|
paulson@14365
|
95 |
"R * S == Abs_preal(mult_set (Rep_preal R) (Rep_preal S))"
|
paulson@5078
|
96 |
|
paulson@14365
|
97 |
preal_inverse_def:
|
paulson@14365
|
98 |
"inverse R == Abs_preal(inverse_set (Rep_preal R))"
|
paulson@14335
|
99 |
|
paulson@14335
|
100 |
|
paulson@14335
|
101 |
lemma inj_on_Abs_preal: "inj_on Abs_preal preal"
|
paulson@14335
|
102 |
apply (rule inj_on_inverseI)
|
paulson@14335
|
103 |
apply (erule Abs_preal_inverse)
|
paulson@14335
|
104 |
done
|
paulson@14335
|
105 |
|
paulson@14335
|
106 |
declare inj_on_Abs_preal [THEN inj_on_iff, simp]
|
paulson@14335
|
107 |
|
paulson@14335
|
108 |
lemma inj_Rep_preal: "inj(Rep_preal)"
|
paulson@14335
|
109 |
apply (rule inj_on_inverseI)
|
paulson@14335
|
110 |
apply (rule Rep_preal_inverse)
|
paulson@14335
|
111 |
done
|
paulson@14335
|
112 |
|
paulson@14365
|
113 |
lemma preal_nonempty: "A \<in> preal ==> \<exists>x\<in>A. 0 < x"
|
paulson@14365
|
114 |
by (unfold preal_def cut_def, blast)
|
paulson@14335
|
115 |
|
paulson@14365
|
116 |
lemma preal_imp_psubset_positives: "A \<in> preal ==> A < {r. 0 < r}"
|
paulson@14365
|
117 |
by (force simp add: preal_def cut_def)
|
paulson@14335
|
118 |
|
paulson@14365
|
119 |
lemma preal_exists_bound: "A \<in> preal ==> \<exists>x. 0 < x & x \<notin> A"
|
paulson@14365
|
120 |
by (drule preal_imp_psubset_positives, auto)
|
paulson@14335
|
121 |
|
paulson@14365
|
122 |
lemma preal_exists_greater: "[| A \<in> preal; y \<in> A |] ==> \<exists>u \<in> A. y < u"
|
paulson@14365
|
123 |
by (unfold preal_def cut_def, blast)
|
paulson@14335
|
124 |
|
paulson@14335
|
125 |
lemma mem_Rep_preal_Ex: "\<exists>x. x \<in> Rep_preal X"
|
paulson@14365
|
126 |
apply (insert Rep_preal [of X])
|
paulson@14365
|
127 |
apply (unfold preal_def cut_def, blast)
|
paulson@14335
|
128 |
done
|
paulson@14335
|
129 |
|
paulson@14335
|
130 |
declare Abs_preal_inverse [simp]
|
paulson@14335
|
131 |
|
paulson@14365
|
132 |
lemma preal_downwards_closed: "[| A \<in> preal; y \<in> A; 0 < z; z < y |] ==> z \<in> A"
|
paulson@14365
|
133 |
by (unfold preal_def cut_def, blast)
|
paulson@14335
|
134 |
|
paulson@14365
|
135 |
text{*Relaxing the final premise*}
|
paulson@14365
|
136 |
lemma preal_downwards_closed':
|
paulson@14365
|
137 |
"[| A \<in> preal; y \<in> A; 0 < z; z \<le> y |] ==> z \<in> A"
|
paulson@14365
|
138 |
apply (simp add: order_le_less)
|
paulson@14365
|
139 |
apply (blast intro: preal_downwards_closed)
|
paulson@14365
|
140 |
done
|
paulson@14335
|
141 |
|
paulson@14365
|
142 |
lemma Rep_preal_exists_bound: "\<exists>x. 0 < x & x \<notin> Rep_preal X"
|
paulson@14335
|
143 |
apply (cut_tac x = X in Rep_preal)
|
paulson@14365
|
144 |
apply (drule preal_imp_psubset_positives)
|
paulson@14335
|
145 |
apply (auto simp add: psubset_def)
|
paulson@14335
|
146 |
done
|
paulson@14335
|
147 |
|
paulson@14335
|
148 |
|
paulson@14335
|
149 |
subsection{*@{term preal_of_prat}: the Injection from prat to preal*}
|
paulson@14335
|
150 |
|
paulson@14365
|
151 |
lemma rat_less_set_mem_preal: "0 < y ==> {u::rat. 0 < u & u < y} \<in> preal"
|
paulson@14365
|
152 |
apply (auto simp add: preal_def cut_def intro: order_less_trans)
|
paulson@14365
|
153 |
apply (force simp only: eq_commute [of "{}"] interval_empty_iff)
|
paulson@14365
|
154 |
apply (blast dest: dense intro: order_less_trans)
|
paulson@14335
|
155 |
done
|
paulson@14335
|
156 |
|
paulson@14365
|
157 |
lemma rat_subset_imp_le:
|
paulson@14365
|
158 |
"[|{u::rat. 0 < u & u < x} \<subseteq> {u. 0 < u & u < y}; 0<x|] ==> x \<le> y"
|
paulson@14365
|
159 |
apply (simp add: linorder_not_less [symmetric])
|
paulson@14365
|
160 |
apply (blast dest: dense intro: order_less_trans)
|
paulson@14335
|
161 |
done
|
paulson@14335
|
162 |
|
paulson@14365
|
163 |
lemma rat_set_eq_imp_eq:
|
paulson@14365
|
164 |
"[|{u::rat. 0 < u & u < x} = {u. 0 < u & u < y};
|
paulson@14365
|
165 |
0 < x; 0 < y|] ==> x = y"
|
paulson@14365
|
166 |
by (blast intro: rat_subset_imp_le order_antisym)
|
paulson@14365
|
167 |
|
paulson@14335
|
168 |
|
paulson@14335
|
169 |
|
paulson@14335
|
170 |
subsection{*Theorems for Ordering*}
|
paulson@14335
|
171 |
|
paulson@14335
|
172 |
text{*A positive fraction not in a positive real is an upper bound.
|
paulson@14335
|
173 |
Gleason p. 122 - Remark (1)*}
|
paulson@14335
|
174 |
|
paulson@14365
|
175 |
lemma not_in_preal_ub:
|
paulson@14365
|
176 |
assumes A: "A \<in> preal"
|
paulson@14365
|
177 |
and notx: "x \<notin> A"
|
paulson@14365
|
178 |
and y: "y \<in> A"
|
paulson@14365
|
179 |
and pos: "0 < x"
|
paulson@14365
|
180 |
shows "y < x"
|
paulson@14365
|
181 |
proof (cases rule: linorder_cases)
|
paulson@14365
|
182 |
assume "x<y"
|
paulson@14365
|
183 |
with notx show ?thesis
|
paulson@14365
|
184 |
by (simp add: preal_downwards_closed [OF A y] pos)
|
paulson@14365
|
185 |
next
|
paulson@14365
|
186 |
assume "x=y"
|
paulson@14365
|
187 |
with notx and y show ?thesis by simp
|
paulson@14365
|
188 |
next
|
paulson@14365
|
189 |
assume "y<x"
|
paulson@14365
|
190 |
thus ?thesis by assumption
|
paulson@14365
|
191 |
qed
|
paulson@14365
|
192 |
|
paulson@14365
|
193 |
lemmas not_in_Rep_preal_ub = not_in_preal_ub [OF Rep_preal]
|
paulson@14365
|
194 |
|
paulson@14365
|
195 |
|
paulson@14365
|
196 |
subsection{*The @{text "\<le>"} Ordering*}
|
paulson@14365
|
197 |
|
paulson@14365
|
198 |
lemma preal_le_refl: "w \<le> (w::preal)"
|
paulson@14365
|
199 |
by (simp add: preal_le_def)
|
paulson@14365
|
200 |
|
paulson@14365
|
201 |
lemma preal_le_trans: "[| i \<le> j; j \<le> k |] ==> i \<le> (k::preal)"
|
paulson@14365
|
202 |
by (force simp add: preal_le_def)
|
paulson@14365
|
203 |
|
paulson@14365
|
204 |
lemma preal_le_anti_sym: "[| z \<le> w; w \<le> z |] ==> z = (w::preal)"
|
paulson@14365
|
205 |
apply (simp add: preal_le_def)
|
paulson@14365
|
206 |
apply (rule Rep_preal_inject [THEN iffD1], blast)
|
paulson@14335
|
207 |
done
|
paulson@14335
|
208 |
|
paulson@14365
|
209 |
(* Axiom 'order_less_le' of class 'order': *)
|
paulson@14365
|
210 |
lemma preal_less_le: "((w::preal) < z) = (w \<le> z & w \<noteq> z)"
|
paulson@14365
|
211 |
by (simp add: preal_le_def preal_less_def Rep_preal_inject psubset_def)
|
paulson@14335
|
212 |
|
paulson@14365
|
213 |
instance preal :: order
|
paulson@14365
|
214 |
proof qed
|
paulson@14365
|
215 |
(assumption |
|
paulson@14365
|
216 |
rule preal_le_refl preal_le_trans preal_le_anti_sym preal_less_le)+
|
paulson@14335
|
217 |
|
paulson@14365
|
218 |
lemma preal_imp_pos: "[|A \<in> preal; r \<in> A|] ==> 0 < r"
|
paulson@14365
|
219 |
by (insert preal_imp_psubset_positives, blast)
|
paulson@14365
|
220 |
|
paulson@14365
|
221 |
lemma preal_le_linear: "x <= y | y <= (x::preal)"
|
paulson@14365
|
222 |
apply (auto simp add: preal_le_def)
|
paulson@14365
|
223 |
apply (rule ccontr)
|
paulson@14365
|
224 |
apply (blast dest: not_in_Rep_preal_ub intro: preal_imp_pos [OF Rep_preal]
|
paulson@14365
|
225 |
elim: order_less_asym)
|
paulson@14335
|
226 |
done
|
paulson@14335
|
227 |
|
paulson@14365
|
228 |
instance preal :: linorder
|
paulson@14365
|
229 |
by (intro_classes, rule preal_le_linear)
|
paulson@14335
|
230 |
|
paulson@14335
|
231 |
|
paulson@14335
|
232 |
|
paulson@14335
|
233 |
subsection{*Properties of Addition*}
|
paulson@14335
|
234 |
|
paulson@14335
|
235 |
lemma preal_add_commute: "(x::preal) + y = y + x"
|
paulson@14365
|
236 |
apply (unfold preal_add_def add_set_def)
|
paulson@14335
|
237 |
apply (rule_tac f = Abs_preal in arg_cong)
|
paulson@14365
|
238 |
apply (force simp add: add_commute)
|
paulson@14335
|
239 |
done
|
paulson@14335
|
240 |
|
paulson@14365
|
241 |
text{*Lemmas for proving that addition of two positive reals gives
|
paulson@14365
|
242 |
a positive real*}
|
paulson@14335
|
243 |
|
paulson@14365
|
244 |
lemma empty_psubset_nonempty: "a \<in> A ==> {} \<subset> A"
|
paulson@14365
|
245 |
by blast
|
paulson@14335
|
246 |
|
paulson@14335
|
247 |
text{*Part 1 of Dedekind sections definition*}
|
paulson@14365
|
248 |
lemma add_set_not_empty:
|
paulson@14365
|
249 |
"[|A \<in> preal; B \<in> preal|] ==> {} \<subset> add_set A B"
|
paulson@14365
|
250 |
apply (insert preal_nonempty [of A] preal_nonempty [of B])
|
paulson@14365
|
251 |
apply (auto simp add: add_set_def)
|
paulson@14335
|
252 |
done
|
paulson@14335
|
253 |
|
paulson@14365
|
254 |
text{*Part 2 of Dedekind sections definition. A structured version of
|
paulson@14365
|
255 |
this proof is @{text preal_not_mem_mult_set_Ex} below.*}
|
paulson@14335
|
256 |
lemma preal_not_mem_add_set_Ex:
|
paulson@14365
|
257 |
"[|A \<in> preal; B \<in> preal|] ==> \<exists>q. 0 < q & q \<notin> add_set A B"
|
paulson@14365
|
258 |
apply (insert preal_exists_bound [of A] preal_exists_bound [of B], auto)
|
paulson@14335
|
259 |
apply (rule_tac x = "x+xa" in exI)
|
paulson@14365
|
260 |
apply (simp add: add_set_def, clarify)
|
paulson@14365
|
261 |
apply (drule not_in_preal_ub, assumption+)+
|
paulson@14365
|
262 |
apply (force dest: add_strict_mono)
|
paulson@14335
|
263 |
done
|
paulson@14335
|
264 |
|
paulson@14365
|
265 |
lemma add_set_not_rat_set:
|
paulson@14365
|
266 |
assumes A: "A \<in> preal"
|
paulson@14365
|
267 |
and B: "B \<in> preal"
|
paulson@14365
|
268 |
shows "add_set A B < {r. 0 < r}"
|
paulson@14365
|
269 |
proof
|
paulson@14365
|
270 |
from preal_imp_pos [OF A] preal_imp_pos [OF B]
|
paulson@14365
|
271 |
show "add_set A B \<subseteq> {r. 0 < r}" by (force simp add: add_set_def)
|
paulson@14365
|
272 |
next
|
paulson@14365
|
273 |
show "add_set A B \<noteq> {r. 0 < r}"
|
paulson@14365
|
274 |
by (insert preal_not_mem_add_set_Ex [OF A B], blast)
|
paulson@14365
|
275 |
qed
|
paulson@14365
|
276 |
|
paulson@14365
|
277 |
text{*Part 3 of Dedekind sections definition*}
|
paulson@14365
|
278 |
lemma add_set_lemma3:
|
paulson@14365
|
279 |
"[|A \<in> preal; B \<in> preal; u \<in> add_set A B; 0 < z; z < u|]
|
paulson@14365
|
280 |
==> z \<in> add_set A B"
|
paulson@14365
|
281 |
proof (unfold add_set_def, clarify)
|
paulson@14365
|
282 |
fix x::rat and y::rat
|
paulson@14365
|
283 |
assume A: "A \<in> preal"
|
paulson@14365
|
284 |
and B: "B \<in> preal"
|
paulson@14365
|
285 |
and [simp]: "0 < z"
|
paulson@14365
|
286 |
and zless: "z < x + y"
|
paulson@14365
|
287 |
and x: "x \<in> A"
|
paulson@14365
|
288 |
and y: "y \<in> B"
|
paulson@14365
|
289 |
have xpos [simp]: "0<x" by (rule preal_imp_pos [OF A x])
|
paulson@14365
|
290 |
have ypos [simp]: "0<y" by (rule preal_imp_pos [OF B y])
|
paulson@14365
|
291 |
have xypos [simp]: "0 < x+y" by (simp add: pos_add_strict)
|
paulson@14365
|
292 |
let ?f = "z/(x+y)"
|
paulson@14365
|
293 |
have fless: "?f < 1" by (simp add: zless pos_divide_less_eq)
|
paulson@14365
|
294 |
show "\<exists>x' \<in> A. \<exists>y'\<in>B. z = x' + y'"
|
paulson@14365
|
295 |
proof
|
paulson@14365
|
296 |
show "\<exists>y' \<in> B. z = x*?f + y'"
|
paulson@14365
|
297 |
proof
|
paulson@14365
|
298 |
show "z = x*?f + y*?f"
|
paulson@14430
|
299 |
by (simp add: left_distrib [symmetric] divide_inverse mult_ac
|
paulson@14365
|
300 |
order_less_imp_not_eq2)
|
paulson@14365
|
301 |
next
|
paulson@14365
|
302 |
show "y * ?f \<in> B"
|
paulson@14365
|
303 |
proof (rule preal_downwards_closed [OF B y])
|
paulson@14365
|
304 |
show "0 < y * ?f"
|
paulson@14430
|
305 |
by (simp add: divide_inverse zero_less_mult_iff)
|
paulson@14365
|
306 |
next
|
paulson@14365
|
307 |
show "y * ?f < y"
|
paulson@14365
|
308 |
by (insert mult_strict_left_mono [OF fless ypos], simp)
|
paulson@14365
|
309 |
qed
|
paulson@14365
|
310 |
qed
|
paulson@14365
|
311 |
next
|
paulson@14365
|
312 |
show "x * ?f \<in> A"
|
paulson@14365
|
313 |
proof (rule preal_downwards_closed [OF A x])
|
paulson@14365
|
314 |
show "0 < x * ?f"
|
paulson@14430
|
315 |
by (simp add: divide_inverse zero_less_mult_iff)
|
paulson@14365
|
316 |
next
|
paulson@14365
|
317 |
show "x * ?f < x"
|
paulson@14365
|
318 |
by (insert mult_strict_left_mono [OF fless xpos], simp)
|
paulson@14365
|
319 |
qed
|
paulson@14365
|
320 |
qed
|
paulson@14365
|
321 |
qed
|
paulson@14365
|
322 |
|
paulson@14365
|
323 |
text{*Part 4 of Dedekind sections definition*}
|
paulson@14365
|
324 |
lemma add_set_lemma4:
|
paulson@14365
|
325 |
"[|A \<in> preal; B \<in> preal; y \<in> add_set A B|] ==> \<exists>u \<in> add_set A B. y < u"
|
paulson@14365
|
326 |
apply (auto simp add: add_set_def)
|
paulson@14365
|
327 |
apply (frule preal_exists_greater [of A], auto)
|
paulson@14365
|
328 |
apply (rule_tac x="u + y" in exI)
|
paulson@14365
|
329 |
apply (auto intro: add_strict_left_mono)
|
paulson@14335
|
330 |
done
|
paulson@14335
|
331 |
|
paulson@14365
|
332 |
lemma mem_add_set:
|
paulson@14365
|
333 |
"[|A \<in> preal; B \<in> preal|] ==> add_set A B \<in> preal"
|
paulson@14365
|
334 |
apply (simp (no_asm_simp) add: preal_def cut_def)
|
paulson@14365
|
335 |
apply (blast intro!: add_set_not_empty add_set_not_rat_set
|
paulson@14365
|
336 |
add_set_lemma3 add_set_lemma4)
|
paulson@14335
|
337 |
done
|
paulson@14335
|
338 |
|
paulson@14335
|
339 |
lemma preal_add_assoc: "((x::preal) + y) + z = x + (y + z)"
|
paulson@14365
|
340 |
apply (simp add: preal_add_def mem_add_set Rep_preal)
|
paulson@14365
|
341 |
apply (force simp add: add_set_def add_ac)
|
paulson@14335
|
342 |
done
|
paulson@14335
|
343 |
|
paulson@14335
|
344 |
lemma preal_add_left_commute: "x + (y + z) = y + ((x + z)::preal)"
|
paulson@14335
|
345 |
apply (rule mk_left_commute [of "op +"])
|
paulson@14335
|
346 |
apply (rule preal_add_assoc)
|
paulson@14335
|
347 |
apply (rule preal_add_commute)
|
paulson@14335
|
348 |
done
|
paulson@14335
|
349 |
|
paulson@14365
|
350 |
text{* Positive Real addition is an AC operator *}
|
paulson@14335
|
351 |
lemmas preal_add_ac = preal_add_assoc preal_add_commute preal_add_left_commute
|
paulson@14335
|
352 |
|
paulson@14335
|
353 |
|
paulson@14335
|
354 |
subsection{*Properties of Multiplication*}
|
paulson@14335
|
355 |
|
paulson@14335
|
356 |
text{*Proofs essentially same as for addition*}
|
paulson@14335
|
357 |
|
paulson@14335
|
358 |
lemma preal_mult_commute: "(x::preal) * y = y * x"
|
paulson@14365
|
359 |
apply (unfold preal_mult_def mult_set_def)
|
paulson@14335
|
360 |
apply (rule_tac f = Abs_preal in arg_cong)
|
paulson@14365
|
361 |
apply (force simp add: mult_commute)
|
paulson@14335
|
362 |
done
|
paulson@14335
|
363 |
|
paulson@14335
|
364 |
text{*Multiplication of two positive reals gives a positive real.}
|
paulson@14335
|
365 |
|
paulson@14335
|
366 |
text{*Lemmas for proving positive reals multiplication set in @{typ preal}*}
|
paulson@14335
|
367 |
|
paulson@14335
|
368 |
text{*Part 1 of Dedekind sections definition*}
|
paulson@14365
|
369 |
lemma mult_set_not_empty:
|
paulson@14365
|
370 |
"[|A \<in> preal; B \<in> preal|] ==> {} \<subset> mult_set A B"
|
paulson@14365
|
371 |
apply (insert preal_nonempty [of A] preal_nonempty [of B])
|
paulson@14365
|
372 |
apply (auto simp add: mult_set_def)
|
paulson@14335
|
373 |
done
|
paulson@14335
|
374 |
|
paulson@14335
|
375 |
text{*Part 2 of Dedekind sections definition*}
|
paulson@14335
|
376 |
lemma preal_not_mem_mult_set_Ex:
|
paulson@14365
|
377 |
assumes A: "A \<in> preal"
|
paulson@14365
|
378 |
and B: "B \<in> preal"
|
paulson@14365
|
379 |
shows "\<exists>q. 0 < q & q \<notin> mult_set A B"
|
paulson@14365
|
380 |
proof -
|
paulson@14365
|
381 |
from preal_exists_bound [OF A]
|
paulson@14365
|
382 |
obtain x where [simp]: "0 < x" "x \<notin> A" by blast
|
paulson@14365
|
383 |
from preal_exists_bound [OF B]
|
paulson@14365
|
384 |
obtain y where [simp]: "0 < y" "y \<notin> B" by blast
|
paulson@14365
|
385 |
show ?thesis
|
paulson@14365
|
386 |
proof (intro exI conjI)
|
paulson@14365
|
387 |
show "0 < x*y" by (simp add: mult_pos)
|
paulson@14365
|
388 |
show "x * y \<notin> mult_set A B"
|
paulson@14377
|
389 |
proof -
|
paulson@14377
|
390 |
{ fix u::rat and v::rat
|
kleing@14550
|
391 |
assume "u \<in> A" and "v \<in> B" and "x*y = u*v"
|
kleing@14550
|
392 |
moreover
|
kleing@14550
|
393 |
with prems have "u<x" and "v<y" by (blast dest: not_in_preal_ub)+
|
kleing@14550
|
394 |
moreover
|
kleing@14550
|
395 |
with prems have "0\<le>v"
|
kleing@14550
|
396 |
by (blast intro: preal_imp_pos [OF B] order_less_imp_le prems)
|
kleing@14550
|
397 |
moreover
|
kleing@14550
|
398 |
from calculation
|
kleing@14550
|
399 |
have "u*v < x*y" by (blast intro: mult_strict_mono prems)
|
kleing@14550
|
400 |
ultimately have False by force }
|
paulson@14377
|
401 |
thus ?thesis by (auto simp add: mult_set_def)
|
paulson@14365
|
402 |
qed
|
paulson@14365
|
403 |
qed
|
paulson@14365
|
404 |
qed
|
paulson@14365
|
405 |
|
paulson@14365
|
406 |
lemma mult_set_not_rat_set:
|
paulson@14365
|
407 |
assumes A: "A \<in> preal"
|
paulson@14365
|
408 |
and B: "B \<in> preal"
|
paulson@14365
|
409 |
shows "mult_set A B < {r. 0 < r}"
|
paulson@14365
|
410 |
proof
|
paulson@14365
|
411 |
show "mult_set A B \<subseteq> {r. 0 < r}"
|
paulson@14365
|
412 |
by (force simp add: mult_set_def
|
paulson@14365
|
413 |
intro: preal_imp_pos [OF A] preal_imp_pos [OF B] mult_pos)
|
paulson@14365
|
414 |
next
|
paulson@14365
|
415 |
show "mult_set A B \<noteq> {r. 0 < r}"
|
paulson@14365
|
416 |
by (insert preal_not_mem_mult_set_Ex [OF A B], blast)
|
paulson@14365
|
417 |
qed
|
paulson@14365
|
418 |
|
paulson@14365
|
419 |
|
paulson@14365
|
420 |
|
paulson@14365
|
421 |
text{*Part 3 of Dedekind sections definition*}
|
paulson@14365
|
422 |
lemma mult_set_lemma3:
|
paulson@14365
|
423 |
"[|A \<in> preal; B \<in> preal; u \<in> mult_set A B; 0 < z; z < u|]
|
paulson@14365
|
424 |
==> z \<in> mult_set A B"
|
paulson@14365
|
425 |
proof (unfold mult_set_def, clarify)
|
paulson@14365
|
426 |
fix x::rat and y::rat
|
paulson@14365
|
427 |
assume A: "A \<in> preal"
|
paulson@14365
|
428 |
and B: "B \<in> preal"
|
paulson@14365
|
429 |
and [simp]: "0 < z"
|
paulson@14365
|
430 |
and zless: "z < x * y"
|
paulson@14365
|
431 |
and x: "x \<in> A"
|
paulson@14365
|
432 |
and y: "y \<in> B"
|
paulson@14365
|
433 |
have [simp]: "0<y" by (rule preal_imp_pos [OF B y])
|
paulson@14365
|
434 |
show "\<exists>x' \<in> A. \<exists>y' \<in> B. z = x' * y'"
|
paulson@14365
|
435 |
proof
|
paulson@14365
|
436 |
show "\<exists>y'\<in>B. z = (z/y) * y'"
|
paulson@14365
|
437 |
proof
|
paulson@14365
|
438 |
show "z = (z/y)*y"
|
paulson@14430
|
439 |
by (simp add: divide_inverse mult_commute [of y] mult_assoc
|
paulson@14365
|
440 |
order_less_imp_not_eq2)
|
paulson@14365
|
441 |
show "y \<in> B" .
|
paulson@14365
|
442 |
qed
|
paulson@14365
|
443 |
next
|
paulson@14365
|
444 |
show "z/y \<in> A"
|
paulson@14365
|
445 |
proof (rule preal_downwards_closed [OF A x])
|
paulson@14365
|
446 |
show "0 < z/y"
|
paulson@14365
|
447 |
by (simp add: zero_less_divide_iff)
|
paulson@14365
|
448 |
show "z/y < x" by (simp add: pos_divide_less_eq zless)
|
paulson@14365
|
449 |
qed
|
paulson@14365
|
450 |
qed
|
paulson@14365
|
451 |
qed
|
paulson@14365
|
452 |
|
paulson@14365
|
453 |
text{*Part 4 of Dedekind sections definition*}
|
paulson@14365
|
454 |
lemma mult_set_lemma4:
|
paulson@14365
|
455 |
"[|A \<in> preal; B \<in> preal; y \<in> mult_set A B|] ==> \<exists>u \<in> mult_set A B. y < u"
|
paulson@14365
|
456 |
apply (auto simp add: mult_set_def)
|
paulson@14365
|
457 |
apply (frule preal_exists_greater [of A], auto)
|
paulson@14365
|
458 |
apply (rule_tac x="u * y" in exI)
|
paulson@14365
|
459 |
apply (auto intro: preal_imp_pos [of A] preal_imp_pos [of B]
|
paulson@14365
|
460 |
mult_strict_right_mono)
|
paulson@14335
|
461 |
done
|
paulson@14335
|
462 |
|
paulson@14335
|
463 |
|
paulson@14365
|
464 |
lemma mem_mult_set:
|
paulson@14365
|
465 |
"[|A \<in> preal; B \<in> preal|] ==> mult_set A B \<in> preal"
|
paulson@14365
|
466 |
apply (simp (no_asm_simp) add: preal_def cut_def)
|
paulson@14365
|
467 |
apply (blast intro!: mult_set_not_empty mult_set_not_rat_set
|
paulson@14365
|
468 |
mult_set_lemma3 mult_set_lemma4)
|
paulson@14335
|
469 |
done
|
paulson@14335
|
470 |
|
paulson@14335
|
471 |
lemma preal_mult_assoc: "((x::preal) * y) * z = x * (y * z)"
|
paulson@14365
|
472 |
apply (simp add: preal_mult_def mem_mult_set Rep_preal)
|
paulson@14365
|
473 |
apply (force simp add: mult_set_def mult_ac)
|
paulson@14335
|
474 |
done
|
paulson@14335
|
475 |
|
paulson@14335
|
476 |
lemma preal_mult_left_commute: "x * (y * z) = y * ((x * z)::preal)"
|
paulson@14335
|
477 |
apply (rule mk_left_commute [of "op *"])
|
paulson@14335
|
478 |
apply (rule preal_mult_assoc)
|
paulson@14335
|
479 |
apply (rule preal_mult_commute)
|
paulson@14335
|
480 |
done
|
paulson@14335
|
481 |
|
paulson@14365
|
482 |
|
paulson@14365
|
483 |
text{* Positive Real multiplication is an AC operator *}
|
paulson@14335
|
484 |
lemmas preal_mult_ac =
|
paulson@14335
|
485 |
preal_mult_assoc preal_mult_commute preal_mult_left_commute
|
paulson@14335
|
486 |
|
paulson@14335
|
487 |
|
paulson@14365
|
488 |
text{* Positive real 1 is the multiplicative identity element *}
|
paulson@14365
|
489 |
|
paulson@14365
|
490 |
lemma rat_mem_preal: "0 < q ==> {r::rat. 0 < r & r < q} \<in> preal"
|
paulson@14365
|
491 |
by (simp add: preal_def cut_of_rat)
|
paulson@14365
|
492 |
|
paulson@14365
|
493 |
lemma preal_mult_1: "(preal_of_rat 1) * z = z"
|
paulson@14365
|
494 |
proof (induct z)
|
paulson@14365
|
495 |
fix A :: "rat set"
|
paulson@14365
|
496 |
assume A: "A \<in> preal"
|
paulson@14365
|
497 |
have "{w. \<exists>u. 0 < u \<and> u < 1 & (\<exists>v \<in> A. w = u * v)} = A" (is "?lhs = A")
|
paulson@14365
|
498 |
proof
|
paulson@14365
|
499 |
show "?lhs \<subseteq> A"
|
paulson@14365
|
500 |
proof clarify
|
paulson@14365
|
501 |
fix x::rat and u::rat and v::rat
|
paulson@14365
|
502 |
assume upos: "0<u" and "u<1" and v: "v \<in> A"
|
paulson@14365
|
503 |
have vpos: "0<v" by (rule preal_imp_pos [OF A v])
|
paulson@14365
|
504 |
hence "u*v < 1*v" by (simp only: mult_strict_right_mono prems)
|
paulson@14365
|
505 |
thus "u * v \<in> A"
|
paulson@14365
|
506 |
by (force intro: preal_downwards_closed [OF A v] mult_pos upos vpos)
|
paulson@14365
|
507 |
qed
|
paulson@14365
|
508 |
next
|
paulson@14365
|
509 |
show "A \<subseteq> ?lhs"
|
paulson@14365
|
510 |
proof clarify
|
paulson@14365
|
511 |
fix x::rat
|
paulson@14365
|
512 |
assume x: "x \<in> A"
|
paulson@14365
|
513 |
have xpos: "0<x" by (rule preal_imp_pos [OF A x])
|
paulson@14365
|
514 |
from preal_exists_greater [OF A x]
|
paulson@14365
|
515 |
obtain v where v: "v \<in> A" and xlessv: "x < v" ..
|
paulson@14365
|
516 |
have vpos: "0<v" by (rule preal_imp_pos [OF A v])
|
paulson@14365
|
517 |
show "\<exists>u. 0 < u \<and> u < 1 \<and> (\<exists>v\<in>A. x = u * v)"
|
paulson@14365
|
518 |
proof (intro exI conjI)
|
paulson@14365
|
519 |
show "0 < x/v"
|
paulson@14365
|
520 |
by (simp add: zero_less_divide_iff xpos vpos)
|
paulson@14365
|
521 |
show "x / v < 1"
|
paulson@14365
|
522 |
by (simp add: pos_divide_less_eq vpos xlessv)
|
paulson@14365
|
523 |
show "\<exists>v'\<in>A. x = (x / v) * v'"
|
paulson@14365
|
524 |
proof
|
paulson@14365
|
525 |
show "x = (x/v)*v"
|
paulson@14430
|
526 |
by (simp add: divide_inverse mult_assoc vpos
|
paulson@14365
|
527 |
order_less_imp_not_eq2)
|
paulson@14365
|
528 |
show "v \<in> A" .
|
paulson@14365
|
529 |
qed
|
paulson@14365
|
530 |
qed
|
paulson@14365
|
531 |
qed
|
paulson@14365
|
532 |
qed
|
paulson@14365
|
533 |
thus "preal_of_rat 1 * Abs_preal A = Abs_preal A"
|
paulson@14365
|
534 |
by (simp add: preal_of_rat_def preal_mult_def mult_set_def
|
paulson@14365
|
535 |
rat_mem_preal A)
|
paulson@14365
|
536 |
qed
|
paulson@14365
|
537 |
|
paulson@14365
|
538 |
|
paulson@14365
|
539 |
lemma preal_mult_1_right: "z * (preal_of_rat 1) = z"
|
paulson@14335
|
540 |
apply (rule preal_mult_commute [THEN subst])
|
paulson@14335
|
541 |
apply (rule preal_mult_1)
|
paulson@14335
|
542 |
done
|
paulson@14335
|
543 |
|
paulson@14335
|
544 |
|
paulson@14335
|
545 |
subsection{*Distribution of Multiplication across Addition*}
|
paulson@14335
|
546 |
|
paulson@14335
|
547 |
lemma mem_Rep_preal_add_iff:
|
paulson@14365
|
548 |
"(z \<in> Rep_preal(R+S)) = (\<exists>x \<in> Rep_preal R. \<exists>y \<in> Rep_preal S. z = x + y)"
|
paulson@14365
|
549 |
apply (simp add: preal_add_def mem_add_set Rep_preal)
|
paulson@14365
|
550 |
apply (simp add: add_set_def)
|
paulson@14335
|
551 |
done
|
paulson@14335
|
552 |
|
paulson@14335
|
553 |
lemma mem_Rep_preal_mult_iff:
|
paulson@14365
|
554 |
"(z \<in> Rep_preal(R*S)) = (\<exists>x \<in> Rep_preal R. \<exists>y \<in> Rep_preal S. z = x * y)"
|
paulson@14365
|
555 |
apply (simp add: preal_mult_def mem_mult_set Rep_preal)
|
paulson@14365
|
556 |
apply (simp add: mult_set_def)
|
paulson@14335
|
557 |
done
|
paulson@14335
|
558 |
|
paulson@14365
|
559 |
lemma distrib_subset1:
|
paulson@14365
|
560 |
"Rep_preal (w * (x + y)) \<subseteq> Rep_preal (w * x + w * y)"
|
paulson@14365
|
561 |
apply (auto simp add: Bex_def mem_Rep_preal_add_iff mem_Rep_preal_mult_iff)
|
paulson@14365
|
562 |
apply (force simp add: right_distrib)
|
paulson@14335
|
563 |
done
|
paulson@14335
|
564 |
|
paulson@14365
|
565 |
lemma linorder_le_cases [case_names le ge]:
|
paulson@14365
|
566 |
"((x::'a::linorder) <= y ==> P) ==> (y <= x ==> P) ==> P"
|
paulson@14365
|
567 |
apply (insert linorder_linear, blast)
|
paulson@14365
|
568 |
done
|
paulson@14365
|
569 |
|
paulson@14365
|
570 |
lemma preal_add_mult_distrib_mean:
|
paulson@14365
|
571 |
assumes a: "a \<in> Rep_preal w"
|
paulson@14365
|
572 |
and b: "b \<in> Rep_preal w"
|
paulson@14365
|
573 |
and d: "d \<in> Rep_preal x"
|
paulson@14365
|
574 |
and e: "e \<in> Rep_preal y"
|
paulson@14365
|
575 |
shows "\<exists>c \<in> Rep_preal w. a * d + b * e = c * (d + e)"
|
paulson@14365
|
576 |
proof
|
paulson@14365
|
577 |
let ?c = "(a*d + b*e)/(d+e)"
|
paulson@14365
|
578 |
have [simp]: "0<a" "0<b" "0<d" "0<e" "0<d+e"
|
paulson@14365
|
579 |
by (blast intro: preal_imp_pos [OF Rep_preal] a b d e pos_add_strict)+
|
paulson@14365
|
580 |
have cpos: "0 < ?c"
|
paulson@14365
|
581 |
by (simp add: zero_less_divide_iff zero_less_mult_iff pos_add_strict)
|
paulson@14365
|
582 |
show "a * d + b * e = ?c * (d + e)"
|
paulson@14430
|
583 |
by (simp add: divide_inverse mult_assoc order_less_imp_not_eq2)
|
paulson@14365
|
584 |
show "?c \<in> Rep_preal w"
|
paulson@14365
|
585 |
proof (cases rule: linorder_le_cases)
|
paulson@14365
|
586 |
assume "a \<le> b"
|
paulson@14365
|
587 |
hence "?c \<le> b"
|
paulson@14365
|
588 |
by (simp add: pos_divide_le_eq right_distrib mult_right_mono
|
paulson@14365
|
589 |
order_less_imp_le)
|
paulson@14365
|
590 |
thus ?thesis by (rule preal_downwards_closed' [OF Rep_preal b cpos])
|
paulson@14365
|
591 |
next
|
paulson@14365
|
592 |
assume "b \<le> a"
|
paulson@14365
|
593 |
hence "?c \<le> a"
|
paulson@14365
|
594 |
by (simp add: pos_divide_le_eq right_distrib mult_right_mono
|
paulson@14365
|
595 |
order_less_imp_le)
|
paulson@14365
|
596 |
thus ?thesis by (rule preal_downwards_closed' [OF Rep_preal a cpos])
|
paulson@14365
|
597 |
qed
|
paulson@14365
|
598 |
qed
|
paulson@14365
|
599 |
|
paulson@14365
|
600 |
lemma distrib_subset2:
|
paulson@14365
|
601 |
"Rep_preal (w * x + w * y) \<subseteq> Rep_preal (w * (x + y))"
|
paulson@14365
|
602 |
apply (auto simp add: Bex_def mem_Rep_preal_add_iff mem_Rep_preal_mult_iff)
|
paulson@14365
|
603 |
apply (drule_tac w=w and x=x and y=y in preal_add_mult_distrib_mean, auto)
|
paulson@14335
|
604 |
done
|
paulson@14335
|
605 |
|
paulson@14365
|
606 |
lemma preal_add_mult_distrib2: "(w * ((x::preal) + y)) = (w * x) + (w * y)"
|
paulson@14365
|
607 |
apply (rule inj_Rep_preal [THEN injD])
|
paulson@14365
|
608 |
apply (rule equalityI [OF distrib_subset1 distrib_subset2])
|
paulson@14365
|
609 |
done
|
paulson@14365
|
610 |
|
paulson@14365
|
611 |
lemma preal_add_mult_distrib: "(((x::preal) + y) * w) = (x * w) + (y * w)"
|
paulson@14365
|
612 |
by (simp add: preal_mult_commute preal_add_mult_distrib2)
|
paulson@14365
|
613 |
|
paulson@14335
|
614 |
|
paulson@14335
|
615 |
subsection{*Existence of Inverse, a Positive Real*}
|
paulson@14335
|
616 |
|
paulson@14365
|
617 |
lemma mem_inv_set_ex:
|
paulson@14365
|
618 |
assumes A: "A \<in> preal" shows "\<exists>x y. 0 < x & x < y & inverse y \<notin> A"
|
paulson@14365
|
619 |
proof -
|
paulson@14365
|
620 |
from preal_exists_bound [OF A]
|
paulson@14365
|
621 |
obtain x where [simp]: "0<x" "x \<notin> A" by blast
|
paulson@14365
|
622 |
show ?thesis
|
paulson@14365
|
623 |
proof (intro exI conjI)
|
paulson@14365
|
624 |
show "0 < inverse (x+1)"
|
paulson@14365
|
625 |
by (simp add: order_less_trans [OF _ less_add_one])
|
paulson@14365
|
626 |
show "inverse(x+1) < inverse x"
|
paulson@14365
|
627 |
by (simp add: less_imp_inverse_less less_add_one)
|
paulson@14365
|
628 |
show "inverse (inverse x) \<notin> A"
|
paulson@14365
|
629 |
by (simp add: order_less_imp_not_eq2)
|
paulson@14365
|
630 |
qed
|
paulson@14365
|
631 |
qed
|
paulson@14335
|
632 |
|
paulson@14335
|
633 |
text{*Part 1 of Dedekind sections definition*}
|
paulson@14365
|
634 |
lemma inverse_set_not_empty:
|
paulson@14365
|
635 |
"A \<in> preal ==> {} \<subset> inverse_set A"
|
paulson@14365
|
636 |
apply (insert mem_inv_set_ex [of A])
|
paulson@14365
|
637 |
apply (auto simp add: inverse_set_def)
|
paulson@14335
|
638 |
done
|
paulson@14335
|
639 |
|
paulson@14335
|
640 |
text{*Part 2 of Dedekind sections definition*}
|
paulson@14365
|
641 |
|
paulson@14365
|
642 |
lemma preal_not_mem_inverse_set_Ex:
|
paulson@14365
|
643 |
assumes A: "A \<in> preal" shows "\<exists>q. 0 < q & q \<notin> inverse_set A"
|
paulson@14365
|
644 |
proof -
|
paulson@14365
|
645 |
from preal_nonempty [OF A]
|
paulson@14365
|
646 |
obtain x where x: "x \<in> A" and xpos [simp]: "0<x" ..
|
paulson@14365
|
647 |
show ?thesis
|
paulson@14365
|
648 |
proof (intro exI conjI)
|
paulson@14365
|
649 |
show "0 < inverse x" by simp
|
paulson@14365
|
650 |
show "inverse x \<notin> inverse_set A"
|
paulson@14377
|
651 |
proof -
|
paulson@14377
|
652 |
{ fix y::rat
|
paulson@14377
|
653 |
assume ygt: "inverse x < y"
|
paulson@14377
|
654 |
have [simp]: "0 < y" by (simp add: order_less_trans [OF _ ygt])
|
paulson@14377
|
655 |
have iyless: "inverse y < x"
|
paulson@14377
|
656 |
by (simp add: inverse_less_imp_less [of x] ygt)
|
paulson@14377
|
657 |
have "inverse y \<in> A"
|
paulson@14377
|
658 |
by (simp add: preal_downwards_closed [OF A x] iyless)}
|
paulson@14377
|
659 |
thus ?thesis by (auto simp add: inverse_set_def)
|
paulson@14365
|
660 |
qed
|
paulson@14365
|
661 |
qed
|
paulson@14365
|
662 |
qed
|
paulson@14365
|
663 |
|
paulson@14365
|
664 |
lemma inverse_set_not_rat_set:
|
paulson@14365
|
665 |
assumes A: "A \<in> preal" shows "inverse_set A < {r. 0 < r}"
|
paulson@14365
|
666 |
proof
|
paulson@14365
|
667 |
show "inverse_set A \<subseteq> {r. 0 < r}" by (force simp add: inverse_set_def)
|
paulson@14365
|
668 |
next
|
paulson@14365
|
669 |
show "inverse_set A \<noteq> {r. 0 < r}"
|
paulson@14365
|
670 |
by (insert preal_not_mem_inverse_set_Ex [OF A], blast)
|
paulson@14365
|
671 |
qed
|
paulson@14365
|
672 |
|
paulson@14365
|
673 |
text{*Part 3 of Dedekind sections definition*}
|
paulson@14365
|
674 |
lemma inverse_set_lemma3:
|
paulson@14365
|
675 |
"[|A \<in> preal; u \<in> inverse_set A; 0 < z; z < u|]
|
paulson@14365
|
676 |
==> z \<in> inverse_set A"
|
paulson@14365
|
677 |
apply (auto simp add: inverse_set_def)
|
paulson@14365
|
678 |
apply (auto intro: order_less_trans)
|
paulson@14335
|
679 |
done
|
paulson@14335
|
680 |
|
paulson@14365
|
681 |
text{*Part 4 of Dedekind sections definition*}
|
paulson@14365
|
682 |
lemma inverse_set_lemma4:
|
paulson@14365
|
683 |
"[|A \<in> preal; y \<in> inverse_set A|] ==> \<exists>u \<in> inverse_set A. y < u"
|
paulson@14365
|
684 |
apply (auto simp add: inverse_set_def)
|
paulson@14365
|
685 |
apply (drule dense [of y])
|
paulson@14365
|
686 |
apply (blast intro: order_less_trans)
|
paulson@14335
|
687 |
done
|
paulson@14335
|
688 |
|
paulson@14365
|
689 |
|
paulson@14365
|
690 |
lemma mem_inverse_set:
|
paulson@14365
|
691 |
"A \<in> preal ==> inverse_set A \<in> preal"
|
paulson@14365
|
692 |
apply (simp (no_asm_simp) add: preal_def cut_def)
|
paulson@14365
|
693 |
apply (blast intro!: inverse_set_not_empty inverse_set_not_rat_set
|
paulson@14365
|
694 |
inverse_set_lemma3 inverse_set_lemma4)
|
paulson@14335
|
695 |
done
|
paulson@14335
|
696 |
|
paulson@14335
|
697 |
|
paulson@14335
|
698 |
subsection{*Gleason's Lemma 9-3.4, page 122*}
|
paulson@14335
|
699 |
|
paulson@14365
|
700 |
lemma Gleason9_34_exists:
|
paulson@14365
|
701 |
assumes A: "A \<in> preal"
|
paulson@14369
|
702 |
and "\<forall>x\<in>A. x + u \<in> A"
|
paulson@14369
|
703 |
and "0 \<le> z"
|
paulson@14378
|
704 |
shows "\<exists>b\<in>A. b + (of_int z) * u \<in> A"
|
paulson@14369
|
705 |
proof (cases z rule: int_cases)
|
paulson@14369
|
706 |
case (nonneg n)
|
paulson@14365
|
707 |
show ?thesis
|
paulson@14365
|
708 |
proof (simp add: prems, induct n)
|
paulson@14365
|
709 |
case 0
|
paulson@14365
|
710 |
from preal_nonempty [OF A]
|
paulson@14365
|
711 |
show ?case by force
|
paulson@14365
|
712 |
case (Suc k)
|
paulson@14378
|
713 |
from this obtain b where "b \<in> A" "b + of_int (int k) * u \<in> A" ..
|
paulson@14378
|
714 |
hence "b + of_int (int k)*u + u \<in> A" by (simp add: prems)
|
paulson@14365
|
715 |
thus ?case by (force simp add: left_distrib add_ac prems)
|
paulson@14365
|
716 |
qed
|
paulson@14365
|
717 |
next
|
paulson@14369
|
718 |
case (neg n)
|
paulson@14369
|
719 |
with prems show ?thesis by simp
|
paulson@14365
|
720 |
qed
|
paulson@14335
|
721 |
|
paulson@14365
|
722 |
lemma Gleason9_34_contra:
|
paulson@14365
|
723 |
assumes A: "A \<in> preal"
|
paulson@14365
|
724 |
shows "[|\<forall>x\<in>A. x + u \<in> A; 0 < u; 0 < y; y \<notin> A|] ==> False"
|
paulson@14365
|
725 |
proof (induct u, induct y)
|
paulson@14365
|
726 |
fix a::int and b::int
|
paulson@14365
|
727 |
fix c::int and d::int
|
paulson@14365
|
728 |
assume bpos [simp]: "0 < b"
|
paulson@14365
|
729 |
and dpos [simp]: "0 < d"
|
paulson@14365
|
730 |
and closed: "\<forall>x\<in>A. x + (Fract c d) \<in> A"
|
paulson@14365
|
731 |
and upos: "0 < Fract c d"
|
paulson@14365
|
732 |
and ypos: "0 < Fract a b"
|
paulson@14365
|
733 |
and notin: "Fract a b \<notin> A"
|
paulson@14365
|
734 |
have cpos [simp]: "0 < c"
|
paulson@14365
|
735 |
by (simp add: zero_less_Fract_iff [OF dpos, symmetric] upos)
|
paulson@14365
|
736 |
have apos [simp]: "0 < a"
|
paulson@14365
|
737 |
by (simp add: zero_less_Fract_iff [OF bpos, symmetric] ypos)
|
paulson@14365
|
738 |
let ?k = "a*d"
|
paulson@14378
|
739 |
have frle: "Fract a b \<le> Fract ?k 1 * (Fract c d)"
|
paulson@14365
|
740 |
proof -
|
paulson@14365
|
741 |
have "?thesis = ((a * d * b * d) \<le> c * b * (a * d * b * d))"
|
paulson@14378
|
742 |
by (simp add: mult_rat le_rat order_less_imp_not_eq2 mult_ac)
|
paulson@14365
|
743 |
moreover
|
paulson@14365
|
744 |
have "(1 * (a * d * b * d)) \<le> c * b * (a * d * b * d)"
|
paulson@14365
|
745 |
by (rule mult_mono,
|
paulson@14365
|
746 |
simp_all add: int_one_le_iff_zero_less zero_less_mult_iff
|
paulson@14365
|
747 |
order_less_imp_le)
|
paulson@14365
|
748 |
ultimately
|
paulson@14365
|
749 |
show ?thesis by simp
|
paulson@14365
|
750 |
qed
|
paulson@14365
|
751 |
have k: "0 \<le> ?k" by (simp add: order_less_imp_le zero_less_mult_iff)
|
paulson@14365
|
752 |
from Gleason9_34_exists [OF A closed k]
|
paulson@14365
|
753 |
obtain z where z: "z \<in> A"
|
paulson@14378
|
754 |
and mem: "z + of_int ?k * Fract c d \<in> A" ..
|
paulson@14378
|
755 |
have less: "z + of_int ?k * Fract c d < Fract a b"
|
paulson@14365
|
756 |
by (rule not_in_preal_ub [OF A notin mem ypos])
|
paulson@14365
|
757 |
have "0<z" by (rule preal_imp_pos [OF A z])
|
paulson@14378
|
758 |
with frle and less show False by (simp add: Fract_of_int_eq)
|
paulson@14365
|
759 |
qed
|
paulson@14335
|
760 |
|
paulson@14365
|
761 |
|
paulson@14365
|
762 |
lemma Gleason9_34:
|
paulson@14365
|
763 |
assumes A: "A \<in> preal"
|
paulson@14365
|
764 |
and upos: "0 < u"
|
paulson@14365
|
765 |
shows "\<exists>r \<in> A. r + u \<notin> A"
|
paulson@14365
|
766 |
proof (rule ccontr, simp)
|
paulson@14365
|
767 |
assume closed: "\<forall>r\<in>A. r + u \<in> A"
|
paulson@14365
|
768 |
from preal_exists_bound [OF A]
|
paulson@14365
|
769 |
obtain y where y: "y \<notin> A" and ypos: "0 < y" by blast
|
paulson@14365
|
770 |
show False
|
paulson@14365
|
771 |
by (rule Gleason9_34_contra [OF A closed upos ypos y])
|
paulson@14365
|
772 |
qed
|
paulson@14365
|
773 |
|
paulson@14335
|
774 |
|
paulson@14335
|
775 |
|
paulson@14335
|
776 |
subsection{*Gleason's Lemma 9-3.6*}
|
paulson@14335
|
777 |
|
paulson@14365
|
778 |
lemma lemma_gleason9_36:
|
paulson@14365
|
779 |
assumes A: "A \<in> preal"
|
paulson@14365
|
780 |
and x: "1 < x"
|
paulson@14365
|
781 |
shows "\<exists>r \<in> A. r*x \<notin> A"
|
paulson@14365
|
782 |
proof -
|
paulson@14365
|
783 |
from preal_nonempty [OF A]
|
paulson@14365
|
784 |
obtain y where y: "y \<in> A" and ypos: "0<y" ..
|
paulson@14365
|
785 |
show ?thesis
|
paulson@14365
|
786 |
proof (rule classical)
|
paulson@14365
|
787 |
assume "~(\<exists>r\<in>A. r * x \<notin> A)"
|
paulson@14365
|
788 |
with y have ymem: "y * x \<in> A" by blast
|
paulson@14365
|
789 |
from ypos mult_strict_left_mono [OF x]
|
paulson@14365
|
790 |
have yless: "y < y*x" by simp
|
paulson@14365
|
791 |
let ?d = "y*x - y"
|
paulson@14365
|
792 |
from yless have dpos: "0 < ?d" and eq: "y + ?d = y*x" by auto
|
paulson@14365
|
793 |
from Gleason9_34 [OF A dpos]
|
paulson@14365
|
794 |
obtain r where r: "r\<in>A" and notin: "r + ?d \<notin> A" ..
|
paulson@14365
|
795 |
have rpos: "0<r" by (rule preal_imp_pos [OF A r])
|
paulson@14365
|
796 |
with dpos have rdpos: "0 < r + ?d" by arith
|
paulson@14365
|
797 |
have "~ (r + ?d \<le> y + ?d)"
|
paulson@14365
|
798 |
proof
|
paulson@14365
|
799 |
assume le: "r + ?d \<le> y + ?d"
|
paulson@14365
|
800 |
from ymem have yd: "y + ?d \<in> A" by (simp add: eq)
|
paulson@14365
|
801 |
have "r + ?d \<in> A" by (rule preal_downwards_closed' [OF A yd rdpos le])
|
paulson@14365
|
802 |
with notin show False by simp
|
paulson@14365
|
803 |
qed
|
paulson@14365
|
804 |
hence "y < r" by simp
|
paulson@14365
|
805 |
with ypos have dless: "?d < (r * ?d)/y"
|
paulson@14365
|
806 |
by (simp add: pos_less_divide_eq mult_commute [of ?d]
|
paulson@14365
|
807 |
mult_strict_right_mono dpos)
|
paulson@14365
|
808 |
have "r + ?d < r*x"
|
paulson@14365
|
809 |
proof -
|
paulson@14365
|
810 |
have "r + ?d < r + (r * ?d)/y" by (simp add: dless)
|
paulson@14365
|
811 |
also with ypos have "... = (r/y) * (y + ?d)"
|
paulson@14430
|
812 |
by (simp only: right_distrib divide_inverse mult_ac, simp)
|
paulson@14365
|
813 |
also have "... = r*x" using ypos
|
paulson@14365
|
814 |
by simp
|
paulson@14365
|
815 |
finally show "r + ?d < r*x" .
|
paulson@14365
|
816 |
qed
|
paulson@14365
|
817 |
with r notin rdpos
|
paulson@14365
|
818 |
show "\<exists>r\<in>A. r * x \<notin> A" by (blast dest: preal_downwards_closed [OF A])
|
paulson@14365
|
819 |
qed
|
paulson@14365
|
820 |
qed
|
paulson@14365
|
821 |
|
paulson@14365
|
822 |
subsection{*Existence of Inverse: Part 2*}
|
paulson@14365
|
823 |
|
paulson@14365
|
824 |
lemma mem_Rep_preal_inverse_iff:
|
paulson@14365
|
825 |
"(z \<in> Rep_preal(inverse R)) =
|
paulson@14365
|
826 |
(0 < z \<and> (\<exists>y. z < y \<and> inverse y \<notin> Rep_preal R))"
|
paulson@14365
|
827 |
apply (simp add: preal_inverse_def mem_inverse_set Rep_preal)
|
paulson@14365
|
828 |
apply (simp add: inverse_set_def)
|
paulson@14335
|
829 |
done
|
paulson@14335
|
830 |
|
paulson@14365
|
831 |
lemma Rep_preal_of_rat:
|
paulson@14365
|
832 |
"0 < q ==> Rep_preal (preal_of_rat q) = {x. 0 < x \<and> x < q}"
|
paulson@14365
|
833 |
by (simp add: preal_of_rat_def rat_mem_preal)
|
paulson@14365
|
834 |
|
paulson@14365
|
835 |
lemma subset_inverse_mult_lemma:
|
paulson@14365
|
836 |
assumes xpos: "0 < x" and xless: "x < 1"
|
paulson@14365
|
837 |
shows "\<exists>r u y. 0 < r & r < y & inverse y \<notin> Rep_preal R &
|
paulson@14365
|
838 |
u \<in> Rep_preal R & x = r * u"
|
paulson@14365
|
839 |
proof -
|
paulson@14365
|
840 |
from xpos and xless have "1 < inverse x" by (simp add: one_less_inverse_iff)
|
paulson@14365
|
841 |
from lemma_gleason9_36 [OF Rep_preal this]
|
paulson@14365
|
842 |
obtain r where r: "r \<in> Rep_preal R"
|
paulson@14365
|
843 |
and notin: "r * (inverse x) \<notin> Rep_preal R" ..
|
paulson@14365
|
844 |
have rpos: "0<r" by (rule preal_imp_pos [OF Rep_preal r])
|
paulson@14365
|
845 |
from preal_exists_greater [OF Rep_preal r]
|
paulson@14365
|
846 |
obtain u where u: "u \<in> Rep_preal R" and rless: "r < u" ..
|
paulson@14365
|
847 |
have upos: "0<u" by (rule preal_imp_pos [OF Rep_preal u])
|
paulson@14365
|
848 |
show ?thesis
|
paulson@14365
|
849 |
proof (intro exI conjI)
|
paulson@14365
|
850 |
show "0 < x/u" using xpos upos
|
paulson@14365
|
851 |
by (simp add: zero_less_divide_iff)
|
paulson@14365
|
852 |
show "x/u < x/r" using xpos upos rpos
|
paulson@14430
|
853 |
by (simp add: divide_inverse mult_less_cancel_left rless)
|
paulson@14365
|
854 |
show "inverse (x / r) \<notin> Rep_preal R" using notin
|
paulson@14430
|
855 |
by (simp add: divide_inverse mult_commute)
|
paulson@14365
|
856 |
show "u \<in> Rep_preal R" by (rule u)
|
paulson@14365
|
857 |
show "x = x / u * u" using upos
|
paulson@14430
|
858 |
by (simp add: divide_inverse mult_commute)
|
paulson@14365
|
859 |
qed
|
paulson@14365
|
860 |
qed
|
paulson@14365
|
861 |
|
paulson@14365
|
862 |
lemma subset_inverse_mult:
|
paulson@14365
|
863 |
"Rep_preal(preal_of_rat 1) \<subseteq> Rep_preal(inverse R * R)"
|
paulson@14365
|
864 |
apply (auto simp add: Bex_def Rep_preal_of_rat mem_Rep_preal_inverse_iff
|
paulson@14365
|
865 |
mem_Rep_preal_mult_iff)
|
paulson@14365
|
866 |
apply (blast dest: subset_inverse_mult_lemma)
|
paulson@14335
|
867 |
done
|
paulson@14335
|
868 |
|
paulson@14365
|
869 |
lemma inverse_mult_subset_lemma:
|
paulson@14365
|
870 |
assumes rpos: "0 < r"
|
paulson@14365
|
871 |
and rless: "r < y"
|
paulson@14365
|
872 |
and notin: "inverse y \<notin> Rep_preal R"
|
paulson@14365
|
873 |
and q: "q \<in> Rep_preal R"
|
paulson@14365
|
874 |
shows "r*q < 1"
|
paulson@14365
|
875 |
proof -
|
paulson@14365
|
876 |
have "q < inverse y" using rpos rless
|
paulson@14365
|
877 |
by (simp add: not_in_preal_ub [OF Rep_preal notin] q)
|
paulson@14365
|
878 |
hence "r * q < r/y" using rpos
|
paulson@14430
|
879 |
by (simp add: divide_inverse mult_less_cancel_left)
|
paulson@14365
|
880 |
also have "... \<le> 1" using rpos rless
|
paulson@14365
|
881 |
by (simp add: pos_divide_le_eq)
|
paulson@14365
|
882 |
finally show ?thesis .
|
paulson@14365
|
883 |
qed
|
paulson@14365
|
884 |
|
paulson@14365
|
885 |
lemma inverse_mult_subset:
|
paulson@14365
|
886 |
"Rep_preal(inverse R * R) \<subseteq> Rep_preal(preal_of_rat 1)"
|
paulson@14365
|
887 |
apply (auto simp add: Bex_def Rep_preal_of_rat mem_Rep_preal_inverse_iff
|
paulson@14365
|
888 |
mem_Rep_preal_mult_iff)
|
paulson@14365
|
889 |
apply (simp add: zero_less_mult_iff preal_imp_pos [OF Rep_preal])
|
paulson@14365
|
890 |
apply (blast intro: inverse_mult_subset_lemma)
|
paulson@14335
|
891 |
done
|
paulson@14335
|
892 |
|
paulson@14365
|
893 |
lemma preal_mult_inverse:
|
paulson@14365
|
894 |
"inverse R * R = (preal_of_rat 1)"
|
paulson@14365
|
895 |
apply (rule inj_Rep_preal [THEN injD])
|
paulson@14365
|
896 |
apply (rule equalityI [OF inverse_mult_subset subset_inverse_mult])
|
paulson@14335
|
897 |
done
|
paulson@14335
|
898 |
|
paulson@14365
|
899 |
lemma preal_mult_inverse_right:
|
paulson@14365
|
900 |
"R * inverse R = (preal_of_rat 1)"
|
paulson@14365
|
901 |
apply (rule preal_mult_commute [THEN subst])
|
paulson@14365
|
902 |
apply (rule preal_mult_inverse)
|
paulson@14335
|
903 |
done
|
paulson@14335
|
904 |
|
paulson@14335
|
905 |
|
paulson@14365
|
906 |
text{*Theorems needing @{text Gleason9_34}*}
|
paulson@14335
|
907 |
|
paulson@14365
|
908 |
lemma Rep_preal_self_subset: "Rep_preal (R) \<subseteq> Rep_preal(R + S)"
|
paulson@14365
|
909 |
proof
|
paulson@14365
|
910 |
fix r
|
paulson@14365
|
911 |
assume r: "r \<in> Rep_preal R"
|
paulson@14365
|
912 |
have rpos: "0<r" by (rule preal_imp_pos [OF Rep_preal r])
|
paulson@14365
|
913 |
from mem_Rep_preal_Ex
|
paulson@14365
|
914 |
obtain y where y: "y \<in> Rep_preal S" ..
|
paulson@14365
|
915 |
have ypos: "0<y" by (rule preal_imp_pos [OF Rep_preal y])
|
paulson@14365
|
916 |
have ry: "r+y \<in> Rep_preal(R + S)" using r y
|
paulson@14365
|
917 |
by (auto simp add: mem_Rep_preal_add_iff)
|
paulson@14365
|
918 |
show "r \<in> Rep_preal(R + S)" using r ypos rpos
|
paulson@14365
|
919 |
by (simp add: preal_downwards_closed [OF Rep_preal ry])
|
paulson@14365
|
920 |
qed
|
paulson@14335
|
921 |
|
paulson@14365
|
922 |
lemma Rep_preal_sum_not_subset: "~ Rep_preal (R + S) \<subseteq> Rep_preal(R)"
|
paulson@14365
|
923 |
proof -
|
paulson@14365
|
924 |
from mem_Rep_preal_Ex
|
paulson@14365
|
925 |
obtain y where y: "y \<in> Rep_preal S" ..
|
paulson@14365
|
926 |
have ypos: "0<y" by (rule preal_imp_pos [OF Rep_preal y])
|
paulson@14365
|
927 |
from Gleason9_34 [OF Rep_preal ypos]
|
paulson@14365
|
928 |
obtain r where r: "r \<in> Rep_preal R" and notin: "r + y \<notin> Rep_preal R" ..
|
paulson@14365
|
929 |
have "r + y \<in> Rep_preal (R + S)" using r y
|
paulson@14365
|
930 |
by (auto simp add: mem_Rep_preal_add_iff)
|
paulson@14365
|
931 |
thus ?thesis using notin by blast
|
paulson@14365
|
932 |
qed
|
paulson@14335
|
933 |
|
paulson@14365
|
934 |
lemma Rep_preal_sum_not_eq: "Rep_preal (R + S) \<noteq> Rep_preal(R)"
|
paulson@14365
|
935 |
by (insert Rep_preal_sum_not_subset, blast)
|
paulson@14335
|
936 |
|
paulson@14335
|
937 |
text{*at last, Gleason prop. 9-3.5(iii) page 123*}
|
paulson@14365
|
938 |
lemma preal_self_less_add_left: "(R::preal) < R + S"
|
paulson@14335
|
939 |
apply (unfold preal_less_def psubset_def)
|
paulson@14335
|
940 |
apply (simp add: Rep_preal_self_subset Rep_preal_sum_not_eq [THEN not_sym])
|
paulson@14335
|
941 |
done
|
paulson@14335
|
942 |
|
paulson@14365
|
943 |
lemma preal_self_less_add_right: "(R::preal) < S + R"
|
paulson@14365
|
944 |
by (simp add: preal_add_commute preal_self_less_add_left)
|
paulson@14335
|
945 |
|
paulson@14365
|
946 |
lemma preal_not_eq_self: "x \<noteq> x + (y::preal)"
|
paulson@14365
|
947 |
by (insert preal_self_less_add_left [of x y], auto)
|
paulson@14335
|
948 |
|
paulson@14335
|
949 |
|
paulson@14365
|
950 |
subsection{*Subtraction for Positive Reals*}
|
paulson@14335
|
951 |
|
paulson@14365
|
952 |
text{*Gleason prop. 9-3.5(iv), page 123: proving @{term "A < B ==> \<exists>D. A + D =
|
paulson@14365
|
953 |
B"}. We define the claimed @{term D} and show that it is a positive real*}
|
paulson@14335
|
954 |
|
paulson@14335
|
955 |
text{*Part 1 of Dedekind sections definition*}
|
paulson@14365
|
956 |
lemma diff_set_not_empty:
|
paulson@14365
|
957 |
"R < S ==> {} \<subset> diff_set (Rep_preal S) (Rep_preal R)"
|
paulson@14365
|
958 |
apply (auto simp add: preal_less_def diff_set_def elim!: equalityE)
|
paulson@14365
|
959 |
apply (frule_tac x1 = S in Rep_preal [THEN preal_exists_greater])
|
paulson@14365
|
960 |
apply (drule preal_imp_pos [OF Rep_preal], clarify)
|
paulson@14365
|
961 |
apply (cut_tac a=x and b=u in add_eq_exists, force)
|
paulson@14335
|
962 |
done
|
paulson@14335
|
963 |
|
paulson@14335
|
964 |
text{*Part 2 of Dedekind sections definition*}
|
paulson@14365
|
965 |
lemma diff_set_nonempty:
|
paulson@14365
|
966 |
"\<exists>q. 0 < q & q \<notin> diff_set (Rep_preal S) (Rep_preal R)"
|
paulson@14365
|
967 |
apply (cut_tac X = S in Rep_preal_exists_bound)
|
paulson@14335
|
968 |
apply (erule exE)
|
paulson@14335
|
969 |
apply (rule_tac x = x in exI, auto)
|
paulson@14365
|
970 |
apply (simp add: diff_set_def)
|
paulson@14365
|
971 |
apply (auto dest: Rep_preal [THEN preal_downwards_closed])
|
paulson@14335
|
972 |
done
|
paulson@14335
|
973 |
|
paulson@14365
|
974 |
lemma diff_set_not_rat_set:
|
paulson@14365
|
975 |
"diff_set (Rep_preal S) (Rep_preal R) < {r. 0 < r}" (is "?lhs < ?rhs")
|
paulson@14365
|
976 |
proof
|
paulson@14365
|
977 |
show "?lhs \<subseteq> ?rhs" by (auto simp add: diff_set_def)
|
paulson@14365
|
978 |
show "?lhs \<noteq> ?rhs" using diff_set_nonempty by blast
|
paulson@14365
|
979 |
qed
|
paulson@14365
|
980 |
|
paulson@14365
|
981 |
text{*Part 3 of Dedekind sections definition*}
|
paulson@14365
|
982 |
lemma diff_set_lemma3:
|
paulson@14365
|
983 |
"[|R < S; u \<in> diff_set (Rep_preal S) (Rep_preal R); 0 < z; z < u|]
|
paulson@14365
|
984 |
==> z \<in> diff_set (Rep_preal S) (Rep_preal R)"
|
paulson@14365
|
985 |
apply (auto simp add: diff_set_def)
|
paulson@14365
|
986 |
apply (rule_tac x=x in exI)
|
paulson@14365
|
987 |
apply (drule Rep_preal [THEN preal_downwards_closed], auto)
|
paulson@14335
|
988 |
done
|
paulson@14335
|
989 |
|
paulson@14365
|
990 |
text{*Part 4 of Dedekind sections definition*}
|
paulson@14365
|
991 |
lemma diff_set_lemma4:
|
paulson@14365
|
992 |
"[|R < S; y \<in> diff_set (Rep_preal S) (Rep_preal R)|]
|
paulson@14365
|
993 |
==> \<exists>u \<in> diff_set (Rep_preal S) (Rep_preal R). y < u"
|
paulson@14365
|
994 |
apply (auto simp add: diff_set_def)
|
paulson@14365
|
995 |
apply (drule Rep_preal [THEN preal_exists_greater], clarify)
|
paulson@14365
|
996 |
apply (cut_tac a="x+y" and b=u in add_eq_exists, clarify)
|
paulson@14365
|
997 |
apply (rule_tac x="y+xa" in exI)
|
paulson@14365
|
998 |
apply (auto simp add: add_ac)
|
paulson@14335
|
999 |
done
|
paulson@14335
|
1000 |
|
paulson@14365
|
1001 |
lemma mem_diff_set:
|
paulson@14365
|
1002 |
"R < S ==> diff_set (Rep_preal S) (Rep_preal R) \<in> preal"
|
paulson@14365
|
1003 |
apply (unfold preal_def cut_def)
|
paulson@14365
|
1004 |
apply (blast intro!: diff_set_not_empty diff_set_not_rat_set
|
paulson@14365
|
1005 |
diff_set_lemma3 diff_set_lemma4)
|
paulson@14335
|
1006 |
done
|
paulson@14335
|
1007 |
|
paulson@14365
|
1008 |
lemma mem_Rep_preal_diff_iff:
|
paulson@14365
|
1009 |
"R < S ==>
|
paulson@14365
|
1010 |
(z \<in> Rep_preal(S-R)) =
|
paulson@14365
|
1011 |
(\<exists>x. 0 < x & 0 < z & x \<notin> Rep_preal R & x + z \<in> Rep_preal S)"
|
paulson@14365
|
1012 |
apply (simp add: preal_diff_def mem_diff_set Rep_preal)
|
paulson@14365
|
1013 |
apply (force simp add: diff_set_def)
|
paulson@14335
|
1014 |
done
|
paulson@14335
|
1015 |
|
paulson@14365
|
1016 |
|
paulson@14365
|
1017 |
text{*proving that @{term "R + D \<le> S"}*}
|
paulson@14365
|
1018 |
|
paulson@14365
|
1019 |
lemma less_add_left_lemma:
|
paulson@14365
|
1020 |
assumes Rless: "R < S"
|
paulson@14365
|
1021 |
and a: "a \<in> Rep_preal R"
|
paulson@14365
|
1022 |
and cb: "c + b \<in> Rep_preal S"
|
paulson@14365
|
1023 |
and "c \<notin> Rep_preal R"
|
paulson@14365
|
1024 |
and "0 < b"
|
paulson@14365
|
1025 |
and "0 < c"
|
paulson@14365
|
1026 |
shows "a + b \<in> Rep_preal S"
|
paulson@14365
|
1027 |
proof -
|
paulson@14365
|
1028 |
have "0<a" by (rule preal_imp_pos [OF Rep_preal a])
|
paulson@14365
|
1029 |
moreover
|
paulson@14365
|
1030 |
have "a < c" using prems
|
paulson@14365
|
1031 |
by (blast intro: not_in_Rep_preal_ub )
|
paulson@14365
|
1032 |
ultimately show ?thesis using prems
|
paulson@14365
|
1033 |
by (simp add: preal_downwards_closed [OF Rep_preal cb])
|
paulson@14365
|
1034 |
qed
|
paulson@14365
|
1035 |
|
paulson@14365
|
1036 |
lemma less_add_left_le1:
|
paulson@14365
|
1037 |
"R < (S::preal) ==> R + (S-R) \<le> S"
|
paulson@14365
|
1038 |
apply (auto simp add: Bex_def preal_le_def mem_Rep_preal_add_iff
|
paulson@14365
|
1039 |
mem_Rep_preal_diff_iff)
|
paulson@14365
|
1040 |
apply (blast intro: less_add_left_lemma)
|
paulson@14335
|
1041 |
done
|
paulson@14335
|
1042 |
|
paulson@14365
|
1043 |
subsection{*proving that @{term "S \<le> R + D"} --- trickier*}
|
paulson@14335
|
1044 |
|
paulson@14335
|
1045 |
lemma lemma_sum_mem_Rep_preal_ex:
|
paulson@14365
|
1046 |
"x \<in> Rep_preal S ==> \<exists>e. 0 < e & x + e \<in> Rep_preal S"
|
paulson@14365
|
1047 |
apply (drule Rep_preal [THEN preal_exists_greater], clarify)
|
paulson@14365
|
1048 |
apply (cut_tac a=x and b=u in add_eq_exists, auto)
|
paulson@14335
|
1049 |
done
|
paulson@14335
|
1050 |
|
paulson@14365
|
1051 |
lemma less_add_left_lemma2:
|
paulson@14365
|
1052 |
assumes Rless: "R < S"
|
paulson@14365
|
1053 |
and x: "x \<in> Rep_preal S"
|
paulson@14365
|
1054 |
and xnot: "x \<notin> Rep_preal R"
|
paulson@14365
|
1055 |
shows "\<exists>u v z. 0 < v & 0 < z & u \<in> Rep_preal R & z \<notin> Rep_preal R &
|
paulson@14365
|
1056 |
z + v \<in> Rep_preal S & x = u + v"
|
paulson@14365
|
1057 |
proof -
|
paulson@14365
|
1058 |
have xpos: "0<x" by (rule preal_imp_pos [OF Rep_preal x])
|
paulson@14365
|
1059 |
from lemma_sum_mem_Rep_preal_ex [OF x]
|
paulson@14365
|
1060 |
obtain e where epos: "0 < e" and xe: "x + e \<in> Rep_preal S" by blast
|
paulson@14365
|
1061 |
from Gleason9_34 [OF Rep_preal epos]
|
paulson@14365
|
1062 |
obtain r where r: "r \<in> Rep_preal R" and notin: "r + e \<notin> Rep_preal R" ..
|
paulson@14365
|
1063 |
with x xnot xpos have rless: "r < x" by (blast intro: not_in_Rep_preal_ub)
|
paulson@14365
|
1064 |
from add_eq_exists [of r x]
|
paulson@14365
|
1065 |
obtain y where eq: "x = r+y" by auto
|
paulson@14365
|
1066 |
show ?thesis
|
paulson@14365
|
1067 |
proof (intro exI conjI)
|
paulson@14365
|
1068 |
show "r \<in> Rep_preal R" by (rule r)
|
paulson@14365
|
1069 |
show "r + e \<notin> Rep_preal R" by (rule notin)
|
paulson@14365
|
1070 |
show "r + e + y \<in> Rep_preal S" using xe eq by (simp add: add_ac)
|
paulson@14365
|
1071 |
show "x = r + y" by (simp add: eq)
|
paulson@14365
|
1072 |
show "0 < r + e" using epos preal_imp_pos [OF Rep_preal r]
|
paulson@14365
|
1073 |
by simp
|
paulson@14365
|
1074 |
show "0 < y" using rless eq by arith
|
paulson@14365
|
1075 |
qed
|
paulson@14365
|
1076 |
qed
|
paulson@14365
|
1077 |
|
paulson@14365
|
1078 |
lemma less_add_left_le2: "R < (S::preal) ==> S \<le> R + (S-R)"
|
paulson@14365
|
1079 |
apply (auto simp add: preal_le_def)
|
paulson@14365
|
1080 |
apply (case_tac "x \<in> Rep_preal R")
|
paulson@14365
|
1081 |
apply (cut_tac Rep_preal_self_subset [of R], force)
|
paulson@14365
|
1082 |
apply (auto simp add: Bex_def mem_Rep_preal_add_iff mem_Rep_preal_diff_iff)
|
paulson@14365
|
1083 |
apply (blast dest: less_add_left_lemma2)
|
paulson@14335
|
1084 |
done
|
paulson@14335
|
1085 |
|
paulson@14365
|
1086 |
lemma less_add_left: "R < (S::preal) ==> R + (S-R) = S"
|
paulson@14365
|
1087 |
by (blast intro: preal_le_anti_sym [OF less_add_left_le1 less_add_left_le2])
|
paulson@14335
|
1088 |
|
paulson@14365
|
1089 |
lemma less_add_left_Ex: "R < (S::preal) ==> \<exists>D. R + D = S"
|
paulson@14365
|
1090 |
by (fast dest: less_add_left)
|
paulson@14335
|
1091 |
|
paulson@14365
|
1092 |
lemma preal_add_less2_mono1: "R < (S::preal) ==> R + T < S + T"
|
paulson@14365
|
1093 |
apply (auto dest!: less_add_left_Ex simp add: preal_add_assoc)
|
paulson@14335
|
1094 |
apply (rule_tac y1 = D in preal_add_commute [THEN subst])
|
paulson@14335
|
1095 |
apply (auto intro: preal_self_less_add_left simp add: preal_add_assoc [symmetric])
|
paulson@14335
|
1096 |
done
|
paulson@14335
|
1097 |
|
paulson@14365
|
1098 |
lemma preal_add_less2_mono2: "R < (S::preal) ==> T + R < T + S"
|
paulson@14365
|
1099 |
by (auto intro: preal_add_less2_mono1 simp add: preal_add_commute [of T])
|
paulson@14335
|
1100 |
|
paulson@14365
|
1101 |
lemma preal_add_right_less_cancel: "R + T < S + T ==> R < (S::preal)"
|
paulson@14365
|
1102 |
apply (insert linorder_less_linear [of R S], auto)
|
paulson@14365
|
1103 |
apply (drule_tac R = S and T = T in preal_add_less2_mono1)
|
paulson@14365
|
1104 |
apply (blast dest: order_less_trans)
|
paulson@14335
|
1105 |
done
|
paulson@14335
|
1106 |
|
paulson@14365
|
1107 |
lemma preal_add_left_less_cancel: "T + R < T + S ==> R < (S::preal)"
|
paulson@14365
|
1108 |
by (auto elim: preal_add_right_less_cancel simp add: preal_add_commute [of T])
|
paulson@14335
|
1109 |
|
paulson@14365
|
1110 |
lemma preal_add_less_cancel_right: "((R::preal) + T < S + T) = (R < S)"
|
paulson@14335
|
1111 |
by (blast intro: preal_add_less2_mono1 preal_add_right_less_cancel)
|
paulson@14335
|
1112 |
|
paulson@14365
|
1113 |
lemma preal_add_less_cancel_left: "(T + (R::preal) < T + S) = (R < S)"
|
paulson@14335
|
1114 |
by (blast intro: preal_add_less2_mono2 preal_add_left_less_cancel)
|
paulson@14335
|
1115 |
|
paulson@14365
|
1116 |
lemma preal_add_le_cancel_right: "((R::preal) + T \<le> S + T) = (R \<le> S)"
|
paulson@14365
|
1117 |
by (simp add: linorder_not_less [symmetric] preal_add_less_cancel_right)
|
paulson@14365
|
1118 |
|
paulson@14365
|
1119 |
lemma preal_add_le_cancel_left: "(T + (R::preal) \<le> T + S) = (R \<le> S)"
|
paulson@14365
|
1120 |
by (simp add: linorder_not_less [symmetric] preal_add_less_cancel_left)
|
paulson@14365
|
1121 |
|
paulson@14335
|
1122 |
lemma preal_add_less_mono:
|
paulson@14335
|
1123 |
"[| x1 < y1; x2 < y2 |] ==> x1 + x2 < y1 + (y2::preal)"
|
paulson@14365
|
1124 |
apply (auto dest!: less_add_left_Ex simp add: preal_add_ac)
|
paulson@14335
|
1125 |
apply (rule preal_add_assoc [THEN subst])
|
paulson@14335
|
1126 |
apply (rule preal_self_less_add_right)
|
paulson@14335
|
1127 |
done
|
paulson@14335
|
1128 |
|
paulson@14365
|
1129 |
lemma preal_add_right_cancel: "(R::preal) + T = S + T ==> R = S"
|
paulson@14365
|
1130 |
apply (insert linorder_less_linear [of R S], safe)
|
paulson@14365
|
1131 |
apply (drule_tac [!] T = T in preal_add_less2_mono1, auto)
|
paulson@14335
|
1132 |
done
|
paulson@14335
|
1133 |
|
paulson@14365
|
1134 |
lemma preal_add_left_cancel: "C + A = C + B ==> A = (B::preal)"
|
paulson@14335
|
1135 |
by (auto intro: preal_add_right_cancel simp add: preal_add_commute)
|
paulson@14335
|
1136 |
|
paulson@14365
|
1137 |
lemma preal_add_left_cancel_iff: "(C + A = C + B) = ((A::preal) = B)"
|
paulson@14335
|
1138 |
by (fast intro: preal_add_left_cancel)
|
paulson@14335
|
1139 |
|
paulson@14365
|
1140 |
lemma preal_add_right_cancel_iff: "(A + C = B + C) = ((A::preal) = B)"
|
paulson@14335
|
1141 |
by (fast intro: preal_add_right_cancel)
|
paulson@14335
|
1142 |
|
paulson@14365
|
1143 |
lemmas preal_cancels =
|
paulson@14365
|
1144 |
preal_add_less_cancel_right preal_add_less_cancel_left
|
paulson@14365
|
1145 |
preal_add_le_cancel_right preal_add_le_cancel_left
|
paulson@14365
|
1146 |
preal_add_left_cancel_iff preal_add_right_cancel_iff
|
paulson@14335
|
1147 |
|
paulson@14335
|
1148 |
|
paulson@14335
|
1149 |
subsection{*Completeness of type @{typ preal}*}
|
paulson@14335
|
1150 |
|
paulson@14335
|
1151 |
text{*Prove that supremum is a cut*}
|
paulson@14335
|
1152 |
|
paulson@14365
|
1153 |
text{*Part 1 of Dedekind sections definition*}
|
paulson@14365
|
1154 |
|
paulson@14365
|
1155 |
lemma preal_sup_set_not_empty:
|
paulson@14365
|
1156 |
"P \<noteq> {} ==> {} \<subset> (\<Union>X \<in> P. Rep_preal(X))"
|
paulson@14365
|
1157 |
apply auto
|
paulson@14365
|
1158 |
apply (cut_tac X = x in mem_Rep_preal_Ex, auto)
|
paulson@14335
|
1159 |
done
|
paulson@14335
|
1160 |
|
paulson@14365
|
1161 |
|
paulson@14365
|
1162 |
text{*Part 2 of Dedekind sections definition*}
|
paulson@14365
|
1163 |
|
paulson@14365
|
1164 |
lemma preal_sup_not_exists:
|
paulson@14365
|
1165 |
"\<forall>X \<in> P. X \<le> Y ==> \<exists>q. 0 < q & q \<notin> (\<Union>X \<in> P. Rep_preal(X))"
|
paulson@14365
|
1166 |
apply (cut_tac X = Y in Rep_preal_exists_bound)
|
paulson@14365
|
1167 |
apply (auto simp add: preal_le_def)
|
paulson@14335
|
1168 |
done
|
paulson@14335
|
1169 |
|
paulson@14365
|
1170 |
lemma preal_sup_set_not_rat_set:
|
paulson@14365
|
1171 |
"\<forall>X \<in> P. X \<le> Y ==> (\<Union>X \<in> P. Rep_preal(X)) < {r. 0 < r}"
|
paulson@14365
|
1172 |
apply (drule preal_sup_not_exists)
|
paulson@14365
|
1173 |
apply (blast intro: preal_imp_pos [OF Rep_preal])
|
paulson@14335
|
1174 |
done
|
paulson@14335
|
1175 |
|
paulson@14335
|
1176 |
text{*Part 3 of Dedekind sections definition*}
|
paulson@14335
|
1177 |
lemma preal_sup_set_lemma3:
|
paulson@14365
|
1178 |
"[|P \<noteq> {}; \<forall>X \<in> P. X \<le> Y; u \<in> (\<Union>X \<in> P. Rep_preal(X)); 0 < z; z < u|]
|
paulson@14365
|
1179 |
==> z \<in> (\<Union>X \<in> P. Rep_preal(X))"
|
paulson@14365
|
1180 |
by (auto elim: Rep_preal [THEN preal_downwards_closed])
|
paulson@14365
|
1181 |
|
paulson@14365
|
1182 |
text{*Part 4 of Dedekind sections definition*}
|
paulson@14365
|
1183 |
lemma preal_sup_set_lemma4:
|
paulson@14365
|
1184 |
"[|P \<noteq> {}; \<forall>X \<in> P. X \<le> Y; y \<in> (\<Union>X \<in> P. Rep_preal(X)) |]
|
paulson@14365
|
1185 |
==> \<exists>u \<in> (\<Union>X \<in> P. Rep_preal(X)). y < u"
|
paulson@14365
|
1186 |
by (blast dest: Rep_preal [THEN preal_exists_greater])
|
paulson@14365
|
1187 |
|
paulson@14365
|
1188 |
lemma preal_sup:
|
paulson@14365
|
1189 |
"[|P \<noteq> {}; \<forall>X \<in> P. X \<le> Y|] ==> (\<Union>X \<in> P. Rep_preal(X)) \<in> preal"
|
paulson@14365
|
1190 |
apply (unfold preal_def cut_def)
|
paulson@14365
|
1191 |
apply (blast intro!: preal_sup_set_not_empty preal_sup_set_not_rat_set
|
paulson@14365
|
1192 |
preal_sup_set_lemma3 preal_sup_set_lemma4)
|
paulson@14335
|
1193 |
done
|
paulson@14335
|
1194 |
|
paulson@14365
|
1195 |
lemma preal_psup_le:
|
paulson@14365
|
1196 |
"[| \<forall>X \<in> P. X \<le> Y; x \<in> P |] ==> x \<le> psup P"
|
paulson@14365
|
1197 |
apply (simp (no_asm_simp) add: preal_le_def)
|
paulson@14365
|
1198 |
apply (subgoal_tac "P \<noteq> {}")
|
paulson@14365
|
1199 |
apply (auto simp add: psup_def preal_sup)
|
paulson@14335
|
1200 |
done
|
paulson@14335
|
1201 |
|
paulson@14365
|
1202 |
lemma psup_le_ub: "[| P \<noteq> {}; \<forall>X \<in> P. X \<le> Y |] ==> psup P \<le> Y"
|
paulson@14365
|
1203 |
apply (simp (no_asm_simp) add: preal_le_def)
|
paulson@14365
|
1204 |
apply (simp add: psup_def preal_sup)
|
paulson@14335
|
1205 |
apply (auto simp add: preal_le_def)
|
paulson@14335
|
1206 |
done
|
paulson@14335
|
1207 |
|
paulson@14335
|
1208 |
text{*Supremum property*}
|
paulson@14335
|
1209 |
lemma preal_complete:
|
paulson@14365
|
1210 |
"[| P \<noteq> {}; \<forall>X \<in> P. X \<le> Y |] ==> (\<exists>X \<in> P. Z < X) = (Z < psup P)"
|
paulson@14365
|
1211 |
apply (simp add: preal_less_def psup_def preal_sup)
|
paulson@14365
|
1212 |
apply (auto simp add: preal_le_def)
|
paulson@14365
|
1213 |
apply (rename_tac U)
|
paulson@14365
|
1214 |
apply (cut_tac x = U and y = Z in linorder_less_linear)
|
paulson@14365
|
1215 |
apply (auto simp add: preal_less_def)
|
paulson@14335
|
1216 |
done
|
paulson@14335
|
1217 |
|
paulson@14335
|
1218 |
|
paulson@14365
|
1219 |
subsection{*The Embadding from @{typ rat} into @{typ preal}*}
|
paulson@14335
|
1220 |
|
paulson@14365
|
1221 |
lemma preal_of_rat_add_lemma1:
|
paulson@14365
|
1222 |
"[|x < y + z; 0 < x; 0 < y|] ==> x * y * inverse (y + z) < (y::rat)"
|
paulson@14365
|
1223 |
apply (frule_tac c = "y * inverse (y + z) " in mult_strict_right_mono)
|
paulson@14365
|
1224 |
apply (simp add: zero_less_mult_iff)
|
paulson@14365
|
1225 |
apply (simp add: mult_ac)
|
paulson@14335
|
1226 |
done
|
paulson@14335
|
1227 |
|
paulson@14365
|
1228 |
lemma preal_of_rat_add_lemma2:
|
paulson@14365
|
1229 |
assumes "u < x + y"
|
paulson@14365
|
1230 |
and "0 < x"
|
paulson@14365
|
1231 |
and "0 < y"
|
paulson@14365
|
1232 |
and "0 < u"
|
paulson@14365
|
1233 |
shows "\<exists>v w::rat. w < y & 0 < v & v < x & 0 < w & u = v + w"
|
paulson@14365
|
1234 |
proof (intro exI conjI)
|
paulson@14365
|
1235 |
show "u * x * inverse(x+y) < x" using prems
|
paulson@14365
|
1236 |
by (simp add: preal_of_rat_add_lemma1)
|
paulson@14365
|
1237 |
show "u * y * inverse(x+y) < y" using prems
|
paulson@14365
|
1238 |
by (simp add: preal_of_rat_add_lemma1 add_commute [of x])
|
paulson@14365
|
1239 |
show "0 < u * x * inverse (x + y)" using prems
|
paulson@14365
|
1240 |
by (simp add: zero_less_mult_iff)
|
paulson@14365
|
1241 |
show "0 < u * y * inverse (x + y)" using prems
|
paulson@14365
|
1242 |
by (simp add: zero_less_mult_iff)
|
paulson@14365
|
1243 |
show "u = u * x * inverse (x + y) + u * y * inverse (x + y)" using prems
|
paulson@14365
|
1244 |
by (simp add: left_distrib [symmetric] right_distrib [symmetric] mult_ac)
|
paulson@14365
|
1245 |
qed
|
paulson@14365
|
1246 |
|
paulson@14365
|
1247 |
lemma preal_of_rat_add:
|
paulson@14365
|
1248 |
"[| 0 < x; 0 < y|]
|
paulson@14365
|
1249 |
==> preal_of_rat ((x::rat) + y) = preal_of_rat x + preal_of_rat y"
|
paulson@14365
|
1250 |
apply (unfold preal_of_rat_def preal_add_def)
|
paulson@14365
|
1251 |
apply (simp add: rat_mem_preal)
|
paulson@14365
|
1252 |
apply (rule_tac f = Abs_preal in arg_cong)
|
paulson@14365
|
1253 |
apply (auto simp add: add_set_def)
|
paulson@14365
|
1254 |
apply (blast dest: preal_of_rat_add_lemma2)
|
paulson@14335
|
1255 |
done
|
paulson@14335
|
1256 |
|
paulson@14365
|
1257 |
lemma preal_of_rat_mult_lemma1:
|
paulson@14365
|
1258 |
"[|x < y; 0 < x; 0 < z|] ==> x * z * inverse y < (z::rat)"
|
paulson@14365
|
1259 |
apply (frule_tac c = "z * inverse y" in mult_strict_right_mono)
|
paulson@14365
|
1260 |
apply (simp add: zero_less_mult_iff)
|
paulson@14365
|
1261 |
apply (subgoal_tac "y * (z * inverse y) = z * (y * inverse y)")
|
paulson@14365
|
1262 |
apply (simp_all add: mult_ac)
|
paulson@14335
|
1263 |
done
|
paulson@14335
|
1264 |
|
paulson@14365
|
1265 |
lemma preal_of_rat_mult_lemma2:
|
paulson@14365
|
1266 |
assumes xless: "x < y * z"
|
paulson@14365
|
1267 |
and xpos: "0 < x"
|
paulson@14365
|
1268 |
and ypos: "0 < y"
|
paulson@14365
|
1269 |
shows "x * z * inverse y * inverse z < (z::rat)"
|
paulson@14365
|
1270 |
proof -
|
paulson@14365
|
1271 |
have "0 < y * z" using prems by simp
|
paulson@14365
|
1272 |
hence zpos: "0 < z" using prems by (simp add: zero_less_mult_iff)
|
paulson@14365
|
1273 |
have "x * z * inverse y * inverse z = x * inverse y * (z * inverse z)"
|
paulson@14365
|
1274 |
by (simp add: mult_ac)
|
paulson@14365
|
1275 |
also have "... = x/y" using zpos
|
paulson@14430
|
1276 |
by (simp add: divide_inverse)
|
paulson@14365
|
1277 |
also have "... < z"
|
paulson@14365
|
1278 |
by (simp add: pos_divide_less_eq [OF ypos] mult_commute)
|
paulson@14365
|
1279 |
finally show ?thesis .
|
paulson@14365
|
1280 |
qed
|
paulson@14365
|
1281 |
|
paulson@14365
|
1282 |
lemma preal_of_rat_mult_lemma3:
|
paulson@14365
|
1283 |
assumes uless: "u < x * y"
|
paulson@14365
|
1284 |
and "0 < x"
|
paulson@14365
|
1285 |
and "0 < y"
|
paulson@14365
|
1286 |
and "0 < u"
|
paulson@14365
|
1287 |
shows "\<exists>v w::rat. v < x & w < y & 0 < v & 0 < w & u = v * w"
|
paulson@14365
|
1288 |
proof -
|
paulson@14365
|
1289 |
from dense [OF uless]
|
paulson@14365
|
1290 |
obtain r where "u < r" "r < x * y" by blast
|
paulson@14365
|
1291 |
thus ?thesis
|
paulson@14365
|
1292 |
proof (intro exI conjI)
|
paulson@14365
|
1293 |
show "u * x * inverse r < x" using prems
|
paulson@14365
|
1294 |
by (simp add: preal_of_rat_mult_lemma1)
|
paulson@14365
|
1295 |
show "r * y * inverse x * inverse y < y" using prems
|
paulson@14365
|
1296 |
by (simp add: preal_of_rat_mult_lemma2)
|
paulson@14365
|
1297 |
show "0 < u * x * inverse r" using prems
|
paulson@14365
|
1298 |
by (simp add: zero_less_mult_iff)
|
paulson@14365
|
1299 |
show "0 < r * y * inverse x * inverse y" using prems
|
paulson@14365
|
1300 |
by (simp add: zero_less_mult_iff)
|
paulson@14365
|
1301 |
have "u * x * inverse r * (r * y * inverse x * inverse y) =
|
paulson@14365
|
1302 |
u * (r * inverse r) * (x * inverse x) * (y * inverse y)"
|
paulson@14365
|
1303 |
by (simp only: mult_ac)
|
paulson@14365
|
1304 |
thus "u = u * x * inverse r * (r * y * inverse x * inverse y)" using prems
|
paulson@14365
|
1305 |
by simp
|
paulson@14365
|
1306 |
qed
|
paulson@14365
|
1307 |
qed
|
paulson@14365
|
1308 |
|
paulson@14365
|
1309 |
lemma preal_of_rat_mult:
|
paulson@14365
|
1310 |
"[| 0 < x; 0 < y|]
|
paulson@14365
|
1311 |
==> preal_of_rat ((x::rat) * y) = preal_of_rat x * preal_of_rat y"
|
paulson@14365
|
1312 |
apply (unfold preal_of_rat_def preal_mult_def)
|
paulson@14365
|
1313 |
apply (simp add: rat_mem_preal)
|
paulson@14365
|
1314 |
apply (rule_tac f = Abs_preal in arg_cong)
|
paulson@14365
|
1315 |
apply (auto simp add: zero_less_mult_iff mult_strict_mono mult_set_def)
|
paulson@14365
|
1316 |
apply (blast dest: preal_of_rat_mult_lemma3)
|
paulson@14335
|
1317 |
done
|
paulson@14335
|
1318 |
|
paulson@14365
|
1319 |
lemma preal_of_rat_less_iff:
|
paulson@14365
|
1320 |
"[| 0 < x; 0 < y|] ==> (preal_of_rat x < preal_of_rat y) = (x < y)"
|
paulson@14365
|
1321 |
by (force simp add: preal_of_rat_def preal_less_def rat_mem_preal)
|
paulson@14335
|
1322 |
|
paulson@14365
|
1323 |
lemma preal_of_rat_le_iff:
|
paulson@14365
|
1324 |
"[| 0 < x; 0 < y|] ==> (preal_of_rat x \<le> preal_of_rat y) = (x \<le> y)"
|
paulson@14365
|
1325 |
by (simp add: preal_of_rat_less_iff linorder_not_less [symmetric])
|
paulson@14335
|
1326 |
|
paulson@14365
|
1327 |
lemma preal_of_rat_eq_iff:
|
paulson@14365
|
1328 |
"[| 0 < x; 0 < y|] ==> (preal_of_rat x = preal_of_rat y) = (x = y)"
|
paulson@14365
|
1329 |
by (simp add: preal_of_rat_le_iff order_eq_iff)
|
paulson@14335
|
1330 |
|
paulson@14335
|
1331 |
|
paulson@14335
|
1332 |
ML
|
paulson@14335
|
1333 |
{*
|
paulson@14335
|
1334 |
val inj_on_Abs_preal = thm"inj_on_Abs_preal";
|
paulson@14335
|
1335 |
val inj_Rep_preal = thm"inj_Rep_preal";
|
paulson@14335
|
1336 |
val mem_Rep_preal_Ex = thm"mem_Rep_preal_Ex";
|
paulson@14335
|
1337 |
val preal_add_commute = thm"preal_add_commute";
|
paulson@14335
|
1338 |
val preal_add_assoc = thm"preal_add_assoc";
|
paulson@14335
|
1339 |
val preal_add_left_commute = thm"preal_add_left_commute";
|
paulson@14335
|
1340 |
val preal_mult_commute = thm"preal_mult_commute";
|
paulson@14335
|
1341 |
val preal_mult_assoc = thm"preal_mult_assoc";
|
paulson@14335
|
1342 |
val preal_mult_left_commute = thm"preal_mult_left_commute";
|
paulson@14335
|
1343 |
val preal_add_mult_distrib2 = thm"preal_add_mult_distrib2";
|
paulson@14335
|
1344 |
val preal_add_mult_distrib = thm"preal_add_mult_distrib";
|
paulson@14335
|
1345 |
val preal_self_less_add_left = thm"preal_self_less_add_left";
|
paulson@14335
|
1346 |
val preal_self_less_add_right = thm"preal_self_less_add_right";
|
paulson@14365
|
1347 |
val less_add_left = thm"less_add_left";
|
paulson@14335
|
1348 |
val preal_add_less2_mono1 = thm"preal_add_less2_mono1";
|
paulson@14335
|
1349 |
val preal_add_less2_mono2 = thm"preal_add_less2_mono2";
|
paulson@14335
|
1350 |
val preal_add_right_less_cancel = thm"preal_add_right_less_cancel";
|
paulson@14335
|
1351 |
val preal_add_left_less_cancel = thm"preal_add_left_less_cancel";
|
paulson@14335
|
1352 |
val preal_add_right_cancel = thm"preal_add_right_cancel";
|
paulson@14335
|
1353 |
val preal_add_left_cancel = thm"preal_add_left_cancel";
|
paulson@14335
|
1354 |
val preal_add_left_cancel_iff = thm"preal_add_left_cancel_iff";
|
paulson@14335
|
1355 |
val preal_add_right_cancel_iff = thm"preal_add_right_cancel_iff";
|
paulson@14365
|
1356 |
val preal_psup_le = thm"preal_psup_le";
|
paulson@14335
|
1357 |
val psup_le_ub = thm"psup_le_ub";
|
paulson@14335
|
1358 |
val preal_complete = thm"preal_complete";
|
paulson@14365
|
1359 |
val preal_of_rat_add = thm"preal_of_rat_add";
|
paulson@14365
|
1360 |
val preal_of_rat_mult = thm"preal_of_rat_mult";
|
paulson@14335
|
1361 |
|
paulson@14335
|
1362 |
val preal_add_ac = thms"preal_add_ac";
|
paulson@14335
|
1363 |
val preal_mult_ac = thms"preal_mult_ac";
|
paulson@14335
|
1364 |
*}
|
paulson@14335
|
1365 |
|
paulson@5078
|
1366 |
end
|