author | paulson |
Sat, 13 Dec 2003 09:33:52 +0100 | |
changeset 14294 | f4d806fd72ce |
parent 14293 | 22542982bffd |
child 14295 | 7f115e5c5de4 |
permissions | -rw-r--r-- |
10722 | 1 |
theory RealArith = RealArith0 |
14275
031a5a051bb4
Converting more of the "real" development to Isar scripts
paulson
parents:
14270
diff
changeset
|
2 |
files ("real_arith.ML"): |
031a5a051bb4
Converting more of the "real" development to Isar scripts
paulson
parents:
14270
diff
changeset
|
3 |
|
031a5a051bb4
Converting more of the "real" development to Isar scripts
paulson
parents:
14270
diff
changeset
|
4 |
use "real_arith.ML" |
9436
62bb04ab4b01
rearranged setup of arithmetic procedures, avoiding global reference values;
wenzelm
parents:
diff
changeset
|
5 |
|
62bb04ab4b01
rearranged setup of arithmetic procedures, avoiding global reference values;
wenzelm
parents:
diff
changeset
|
6 |
setup real_arith_setup |
62bb04ab4b01
rearranged setup of arithmetic procedures, avoiding global reference values;
wenzelm
parents:
diff
changeset
|
7 |
|
14288 | 8 |
subsection{* Simprules combining x+y and 0: ARE THEY NEEDED?*} |
9 |
||
10 |
text{*Needed in this non-standard form by Hyperreal/Transcendental*} |
|
11 |
lemma real_0_le_divide_iff: |
|
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
12 |
"((0::real) \<le> x/y) = ((x \<le> 0 | 0 \<le> y) & (0 \<le> x | y \<le> 0))" |
14288 | 13 |
by (simp add: real_divide_def zero_le_mult_iff, auto) |
14 |
||
15 |
lemma real_add_minus_iff [simp]: "(x + - a = (0::real)) = (x=a)" |
|
16 |
by arith |
|
17 |
||
18 |
lemma real_add_eq_0_iff [iff]: "(x+y = (0::real)) = (y = -x)" |
|
19 |
by auto |
|
20 |
||
21 |
lemma real_add_less_0_iff [iff]: "(x+y < (0::real)) = (y < -x)" |
|
22 |
by auto |
|
23 |
||
24 |
lemma real_0_less_add_iff [iff]: "((0::real) < x+y) = (-x < y)" |
|
25 |
by auto |
|
26 |
||
27 |
lemma real_add_le_0_iff [iff]: "(x+y \<le> (0::real)) = (y \<le> -x)" |
|
28 |
by auto |
|
29 |
||
30 |
lemma real_0_le_add_iff [iff]: "((0::real) \<le> x+y) = (-x \<le> y)" |
|
31 |
by auto |
|
32 |
||
33 |
||
34 |
(** Simprules combining x-y and 0; see also real_less_iff_diff_less_0, etc., |
|
35 |
in RealBin |
|
36 |
**) |
|
37 |
||
38 |
lemma real_0_less_diff_iff [iff]: "((0::real) < x-y) = (y < x)" |
|
39 |
by auto |
|
40 |
||
41 |
lemma real_0_le_diff_iff [iff]: "((0::real) \<le> x-y) = (y \<le> x)" |
|
42 |
by auto |
|
43 |
||
44 |
(* |
|
45 |
FIXME: we should have this, as for type int, but many proofs would break. |
|
46 |
It replaces x+-y by x-y. |
|
47 |
Addsimps [symmetric real_diff_def] |
|
48 |
*) |
|
49 |
||
50 |
(** Division by 1, -1 **) |
|
51 |
||
52 |
lemma real_divide_minus1 [simp]: "x/-1 = -(x::real)" |
|
53 |
by simp |
|
54 |
||
55 |
lemma real_minus1_divide [simp]: "-1/(x::real) = - (1/x)" |
|
56 |
by (simp add: real_divide_def real_minus_inverse) |
|
57 |
||
58 |
lemma real_lbound_gt_zero: |
|
59 |
"[| (0::real) < d1; 0 < d2 |] ==> \<exists>e. 0 < e & e < d1 & e < d2" |
|
60 |
apply (rule_tac x = " (min d1 d2) /2" in exI) |
|
61 |
apply (simp add: min_def) |
|
62 |
done |
|
63 |
||
64 |
(*** Density of the Reals ***) |
|
65 |
||
14293 | 66 |
text{*Similar results are proved in @{text Ring_and_Field}*} |
14288 | 67 |
lemma real_less_half_sum: "x < y ==> x < (x+y) / (2::real)" |
14293 | 68 |
by auto |
14288 | 69 |
|
70 |
lemma real_gt_half_sum: "x < y ==> (x+y)/(2::real) < y" |
|
14293 | 71 |
by auto |
14288 | 72 |
|
73 |
lemma real_dense: "x < y ==> \<exists>r::real. x < r & r < y" |
|
14293 | 74 |
by (rule Ring_and_Field.dense) |
75 |
||
14288 | 76 |
|
14269 | 77 |
subsection{*Absolute Value Function for the Reals*} |
78 |
||
79 |
lemma abs_nat_number_of: |
|
80 |
"abs (number_of v :: real) = |
|
81 |
(if neg (number_of v) then number_of (bin_minus v) |
|
82 |
else number_of v)" |
|
83 |
apply (simp add: real_abs_def bin_arith_simps minus_real_number_of le_real_number_of_eq_not_less less_real_number_of real_of_int_le_iff) |
|
84 |
done |
|
85 |
||
86 |
declare abs_nat_number_of [simp] |
|
87 |
||
88 |
||
89 |
(*---------------------------------------------------------------------------- |
|
90 |
Properties of the absolute value function over the reals |
|
91 |
(adapted version of previously proved theorems about abs) |
|
92 |
----------------------------------------------------------------------------*) |
|
93 |
||
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
94 |
text{*FIXME: these should go!*} |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
95 |
lemma abs_eqI1: "(0::real)\<le>x ==> abs x = x" |
14269 | 96 |
by (unfold real_abs_def, simp) |
97 |
||
98 |
lemma abs_eqI2: "(0::real) < x ==> abs x = x" |
|
99 |
by (unfold real_abs_def, simp) |
|
100 |
||
101 |
lemma abs_minus_eqI2: "x < (0::real) ==> abs x = -x" |
|
102 |
by (unfold real_abs_def real_le_def, simp) |
|
103 |
||
104 |
lemma abs_mult_inverse: "abs (x * inverse y) = (abs x) * inverse (abs (y::real))" |
|
105 |
by (simp add: abs_mult abs_inverse) |
|
106 |
||
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
107 |
text{*Much easier to prove using arithmetic than abstractly!!*} |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
108 |
lemma abs_triangle_ineq: "abs(x+y) \<le> abs x + abs (y::real)" |
14269 | 109 |
by (unfold real_abs_def, simp) |
110 |
||
111 |
(*Unused, but perhaps interesting as an example*) |
|
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
112 |
lemma abs_triangle_ineq_four: "abs(w + x + y + z) \<le> abs(w) + abs(x) + abs(y) + abs(z::real)" |
14269 | 113 |
by (simp add: abs_triangle_ineq [THEN order_trans]) |
114 |
||
115 |
lemma abs_minus_add_cancel: "abs(x + (-y)) = abs (y + (-(x::real)))" |
|
116 |
by (unfold real_abs_def, simp) |
|
117 |
||
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
118 |
lemma abs_triangle_minus_ineq: "abs(x + (-y)) \<le> abs x + abs (y::real)" |
14269 | 119 |
by (unfold real_abs_def, simp) |
120 |
||
121 |
lemma abs_add_less [rule_format (no_asm)]: "abs x < r --> abs y < s --> abs(x+y) < r+(s::real)" |
|
122 |
by (unfold real_abs_def, simp) |
|
123 |
||
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
124 |
lemma abs_add_minus_less: |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
125 |
"abs x < r --> abs y < s --> abs(x+ (-y)) < r+(s::real)" |
14269 | 126 |
by (unfold real_abs_def, simp) |
127 |
||
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
128 |
lemma abs_minus_one [simp]: "abs (-1) = (1::real)" |
14269 | 129 |
by (unfold real_abs_def, simp) |
130 |
||
131 |
lemma abs_interval_iff: "(abs x < r) = (-r < x & x < (r::real))" |
|
132 |
by (unfold real_abs_def, auto) |
|
133 |
||
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
134 |
lemma abs_le_interval_iff: "(abs x \<le> r) = (-r\<le>x & x\<le>(r::real))" |
14269 | 135 |
by (unfold real_abs_def, auto) |
136 |
||
137 |
lemma abs_add_pos_gt_zero: "(0::real) < k ==> 0 < k + abs(x)" |
|
138 |
by (unfold real_abs_def, auto) |
|
139 |
||
140 |
lemma abs_add_one_gt_zero: "(0::real) < 1 + abs(x)" |
|
141 |
by (unfold real_abs_def, auto) |
|
142 |
declare abs_add_one_gt_zero [simp] |
|
143 |
||
144 |
lemma abs_circle: "abs h < abs y - abs x ==> abs (x + h) < abs (y::real)" |
|
145 |
by (auto intro: abs_triangle_ineq [THEN order_le_less_trans]) |
|
146 |
||
147 |
lemma abs_real_of_nat_cancel: "abs (real x) = real (x::nat)" |
|
148 |
by (auto intro: abs_eqI1 simp add: real_of_nat_ge_zero) |
|
149 |
declare abs_real_of_nat_cancel [simp] |
|
150 |
||
151 |
lemma abs_add_one_not_less_self: "~ abs(x) + (1::real) < x" |
|
152 |
apply (rule real_leD) |
|
153 |
apply (auto intro: abs_ge_self [THEN order_trans]) |
|
154 |
done |
|
155 |
declare abs_add_one_not_less_self [simp] |
|
156 |
||
157 |
(* used in vector theory *) |
|
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
158 |
lemma abs_triangle_ineq_three: "abs(w + x + (y::real)) \<le> abs(w) + abs(x) + abs(y)" |
14270 | 159 |
by (auto intro!: abs_triangle_ineq [THEN order_trans] real_add_left_mono |
160 |
simp add: real_add_assoc) |
|
14269 | 161 |
|
162 |
lemma abs_diff_less_imp_gt_zero: "abs(x - y) < y ==> (0::real) < y" |
|
163 |
apply (unfold real_abs_def) |
|
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
164 |
apply (case_tac "0 \<le> x - y", auto) |
14269 | 165 |
done |
166 |
||
167 |
lemma abs_diff_less_imp_gt_zero2: "abs(x - y) < x ==> (0::real) < x" |
|
168 |
apply (unfold real_abs_def) |
|
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
169 |
apply (case_tac "0 \<le> x - y", auto) |
14269 | 170 |
done |
171 |
||
172 |
lemma abs_diff_less_imp_gt_zero3: "abs(x - y) < y ==> (0::real) < x" |
|
173 |
by (auto simp add: abs_interval_iff) |
|
174 |
||
175 |
lemma abs_diff_less_imp_gt_zero4: "abs(x - y) < -y ==> x < (0::real)" |
|
176 |
by (auto simp add: abs_interval_iff) |
|
177 |
||
178 |
lemma abs_triangle_ineq_minus_cancel: |
|
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
179 |
"abs(x) \<le> abs(x + (-y)) + abs((y::real))" |
14269 | 180 |
apply (unfold real_abs_def, auto) |
181 |
done |
|
182 |
||
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
183 |
lemma abs_sum_triangle_ineq: "abs ((x::real) + y + (-l + -m)) \<le> abs(x + -l) + abs(y + -m)" |
14269 | 184 |
apply (simp add: real_add_assoc) |
185 |
apply (rule_tac x1 = y in real_add_left_commute [THEN ssubst]) |
|
186 |
apply (rule real_add_assoc [THEN subst]) |
|
187 |
apply (rule abs_triangle_ineq) |
|
188 |
done |
|
189 |
||
14288 | 190 |
|
14290 | 191 |
|
14269 | 192 |
ML |
193 |
{* |
|
14288 | 194 |
val real_0_le_divide_iff = thm"real_0_le_divide_iff"; |
195 |
val real_add_minus_iff = thm"real_add_minus_iff"; |
|
196 |
val real_add_eq_0_iff = thm"real_add_eq_0_iff"; |
|
197 |
val real_add_less_0_iff = thm"real_add_less_0_iff"; |
|
198 |
val real_0_less_add_iff = thm"real_0_less_add_iff"; |
|
199 |
val real_add_le_0_iff = thm"real_add_le_0_iff"; |
|
200 |
val real_0_le_add_iff = thm"real_0_le_add_iff"; |
|
201 |
val real_0_less_diff_iff = thm"real_0_less_diff_iff"; |
|
202 |
val real_0_le_diff_iff = thm"real_0_le_diff_iff"; |
|
203 |
val real_divide_minus1 = thm"real_divide_minus1"; |
|
204 |
val real_minus1_divide = thm"real_minus1_divide"; |
|
205 |
val real_lbound_gt_zero = thm"real_lbound_gt_zero"; |
|
206 |
val real_less_half_sum = thm"real_less_half_sum"; |
|
207 |
val real_gt_half_sum = thm"real_gt_half_sum"; |
|
208 |
val real_dense = thm"real_dense"; |
|
209 |
||
14269 | 210 |
val abs_nat_number_of = thm"abs_nat_number_of"; |
211 |
val abs_split = thm"abs_split"; |
|
212 |
val abs_zero = thm"abs_zero"; |
|
213 |
val abs_eqI1 = thm"abs_eqI1"; |
|
214 |
val abs_eqI2 = thm"abs_eqI2"; |
|
215 |
val abs_minus_eqI2 = thm"abs_minus_eqI2"; |
|
216 |
val abs_ge_zero = thm"abs_ge_zero"; |
|
217 |
val abs_idempotent = thm"abs_idempotent"; |
|
218 |
val abs_zero_iff = thm"abs_zero_iff"; |
|
219 |
val abs_ge_self = thm"abs_ge_self"; |
|
220 |
val abs_ge_minus_self = thm"abs_ge_minus_self"; |
|
221 |
val abs_mult = thm"abs_mult"; |
|
222 |
val abs_inverse = thm"abs_inverse"; |
|
223 |
val abs_mult_inverse = thm"abs_mult_inverse"; |
|
224 |
val abs_triangle_ineq = thm"abs_triangle_ineq"; |
|
225 |
val abs_triangle_ineq_four = thm"abs_triangle_ineq_four"; |
|
226 |
val abs_minus_cancel = thm"abs_minus_cancel"; |
|
227 |
val abs_minus_add_cancel = thm"abs_minus_add_cancel"; |
|
228 |
val abs_triangle_minus_ineq = thm"abs_triangle_minus_ineq"; |
|
229 |
val abs_add_less = thm"abs_add_less"; |
|
230 |
val abs_add_minus_less = thm"abs_add_minus_less"; |
|
231 |
val abs_minus_one = thm"abs_minus_one"; |
|
232 |
val abs_interval_iff = thm"abs_interval_iff"; |
|
233 |
val abs_le_interval_iff = thm"abs_le_interval_iff"; |
|
234 |
val abs_add_pos_gt_zero = thm"abs_add_pos_gt_zero"; |
|
235 |
val abs_add_one_gt_zero = thm"abs_add_one_gt_zero"; |
|
236 |
val abs_circle = thm"abs_circle"; |
|
237 |
val abs_le_zero_iff = thm"abs_le_zero_iff"; |
|
238 |
val abs_real_of_nat_cancel = thm"abs_real_of_nat_cancel"; |
|
239 |
val abs_add_one_not_less_self = thm"abs_add_one_not_less_self"; |
|
240 |
val abs_triangle_ineq_three = thm"abs_triangle_ineq_three"; |
|
241 |
val abs_diff_less_imp_gt_zero = thm"abs_diff_less_imp_gt_zero"; |
|
242 |
val abs_diff_less_imp_gt_zero2 = thm"abs_diff_less_imp_gt_zero2"; |
|
243 |
val abs_diff_less_imp_gt_zero3 = thm"abs_diff_less_imp_gt_zero3"; |
|
244 |
val abs_diff_less_imp_gt_zero4 = thm"abs_diff_less_imp_gt_zero4"; |
|
245 |
val abs_triangle_ineq_minus_cancel = thm"abs_triangle_ineq_minus_cancel"; |
|
246 |
val abs_sum_triangle_ineq = thm"abs_sum_triangle_ineq"; |
|
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
247 |
|
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
248 |
val abs_mult_less = thm"abs_mult_less"; |
14269 | 249 |
*} |
250 |
||
9436
62bb04ab4b01
rearranged setup of arithmetic procedures, avoiding global reference values;
wenzelm
parents:
diff
changeset
|
251 |
end |