author | nipkow |
Wed, 31 Jul 2002 16:10:24 +0200 | |
changeset 13438 | 527811f00c56 |
parent 12483 | 0a01efff43e9 |
child 13550 | 5a176b8dda84 |
permissions | -rw-r--r-- |
5588 | 1 |
(* Title : Real/RealDef.ML |
7219 | 2 |
ID : $Id$ |
5588 | 3 |
Author : Jacques D. Fleuriot |
4 |
Copyright : 1998 University of Cambridge |
|
5 |
Description : The reals |
|
6 |
*) |
|
7 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
8 |
(*Ensures that Blast_tac can cope with real*) |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
9 |
Blast.overloaded ("RealDef.real", domain_type); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
10 |
|
5588 | 11 |
(*** Proving that realrel is an equivalence relation ***) |
12 |
||
13 |
Goal "[| (x1::preal) + y2 = x2 + y1; x2 + y3 = x3 + y2 |] \ |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
14 |
\ ==> x1 + y3 = x3 + y1"; |
5588 | 15 |
by (res_inst_tac [("C","y2")] preal_add_right_cancel 1); |
16 |
by (rotate_tac 1 1 THEN dtac sym 1); |
|
17 |
by (asm_full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
18 |
by (rtac (preal_add_left_commute RS subst) 1); |
|
19 |
by (res_inst_tac [("x1","x1")] (preal_add_assoc RS subst) 1); |
|
20 |
by (asm_full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
21 |
qed "preal_trans_lemma"; |
|
22 |
||
23 |
(** Natural deduction for realrel **) |
|
24 |
||
25 |
Goalw [realrel_def] |
|
26 |
"(((x1,y1),(x2,y2)): realrel) = (x1 + y2 = x2 + y1)"; |
|
27 |
by (Blast_tac 1); |
|
28 |
qed "realrel_iff"; |
|
29 |
||
30 |
Goalw [realrel_def] |
|
31 |
"[| x1 + y2 = x2 + y1 |] ==> ((x1,y1),(x2,y2)): realrel"; |
|
32 |
by (Blast_tac 1); |
|
33 |
qed "realrelI"; |
|
34 |
||
35 |
Goalw [realrel_def] |
|
36 |
"p: realrel --> (EX x1 y1 x2 y2. \ |
|
37 |
\ p = ((x1,y1),(x2,y2)) & x1 + y2 = x2 + y1)"; |
|
38 |
by (Blast_tac 1); |
|
39 |
qed "realrelE_lemma"; |
|
40 |
||
9969 | 41 |
val [major,minor] = Goal |
5588 | 42 |
"[| p: realrel; \ |
43 |
\ !!x1 y1 x2 y2. [| p = ((x1,y1),(x2,y2)); x1+y2 = x2+y1 \ |
|
44 |
\ |] ==> Q |] ==> Q"; |
|
45 |
by (cut_facts_tac [major RS (realrelE_lemma RS mp)] 1); |
|
46 |
by (REPEAT (eresolve_tac [asm_rl,exE,conjE,minor] 1)); |
|
47 |
qed "realrelE"; |
|
48 |
||
49 |
Goal "(x,x): realrel"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
50 |
by (case_tac "x" 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
51 |
by (asm_simp_tac (simpset() addsimps [realrel_def]) 1); |
5588 | 52 |
qed "realrel_refl"; |
53 |
||
9391 | 54 |
Goalw [equiv_def, refl_def, sym_def, trans_def] "equiv UNIV realrel"; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
55 |
by (fast_tac (claset() addSIs [realrelI, realrel_refl] |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
56 |
addSEs [sym, realrelE, preal_trans_lemma]) 1); |
5588 | 57 |
qed "equiv_realrel"; |
58 |
||
10834 | 59 |
(* (realrel `` {x} = realrel `` {y}) = ((x,y) : realrel) *) |
9108 | 60 |
bind_thm ("equiv_realrel_iff", |
9391 | 61 |
[equiv_realrel, UNIV_I, UNIV_I] MRS eq_equiv_class_iff); |
5588 | 62 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
63 |
Goalw [REAL_def,realrel_def,quotient_def] "realrel``{(x,y)}: REAL"; |
5588 | 64 |
by (Blast_tac 1); |
65 |
qed "realrel_in_real"; |
|
66 |
||
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
67 |
Goal "inj_on Abs_REAL REAL"; |
5588 | 68 |
by (rtac inj_on_inverseI 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
69 |
by (etac Abs_REAL_inverse 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
70 |
qed "inj_on_Abs_REAL"; |
5588 | 71 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
72 |
Addsimps [equiv_realrel_iff,inj_on_Abs_REAL RS inj_on_iff, |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
73 |
realrel_iff, realrel_in_real, Abs_REAL_inverse]; |
5588 | 74 |
|
75 |
Addsimps [equiv_realrel RS eq_equiv_class_iff]; |
|
9108 | 76 |
bind_thm ("eq_realrelD", equiv_realrel RSN (2,eq_equiv_class)); |
5588 | 77 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
78 |
Goal "inj Rep_REAL"; |
5588 | 79 |
by (rtac inj_inverseI 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
80 |
by (rtac Rep_REAL_inverse 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
81 |
qed "inj_Rep_REAL"; |
5588 | 82 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
83 |
(** real_of_preal: the injection from preal to real **) |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
84 |
Goal "inj(real_of_preal)"; |
5588 | 85 |
by (rtac injI 1); |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
86 |
by (rewtac real_of_preal_def); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
87 |
by (dtac (inj_on_Abs_REAL RS inj_onD) 1); |
5588 | 88 |
by (REPEAT (rtac realrel_in_real 1)); |
89 |
by (dtac eq_equiv_class 1); |
|
90 |
by (rtac equiv_realrel 1); |
|
91 |
by (Blast_tac 1); |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
92 |
by (asm_full_simp_tac (simpset() addsimps [realrel_def]) 1); |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
93 |
qed "inj_real_of_preal"; |
5588 | 94 |
|
9969 | 95 |
val [prem] = Goal |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
96 |
"(!!x y. z = Abs_REAL(realrel``{(x,y)}) ==> P) ==> P"; |
5588 | 97 |
by (res_inst_tac [("x1","z")] |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
98 |
(rewrite_rule [REAL_def] Rep_REAL RS quotientE) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
99 |
by (dres_inst_tac [("f","Abs_REAL")] arg_cong 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
100 |
by (case_tac "x" 1); |
5588 | 101 |
by (rtac prem 1); |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
102 |
by (asm_full_simp_tac (simpset() addsimps [Rep_REAL_inverse]) 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
103 |
qed "eq_Abs_REAL"; |
5588 | 104 |
|
105 |
(**** real_minus: additive inverse on real ****) |
|
106 |
||
107 |
Goalw [congruent_def] |
|
10834 | 108 |
"congruent realrel (%p. (%(x,y). realrel``{(y,x)}) p)"; |
10232
529c65b5dcde
restoration of "equalityI"; renaming of contrapos rules
paulson
parents:
10043
diff
changeset
|
109 |
by (Clarify_tac 1); |
5588 | 110 |
by (asm_full_simp_tac (simpset() addsimps [preal_add_commute]) 1); |
111 |
qed "real_minus_congruent"; |
|
112 |
||
113 |
Goalw [real_minus_def] |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
114 |
"- (Abs_REAL(realrel``{(x,y)})) = Abs_REAL(realrel `` {(y,x)})"; |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
115 |
by (res_inst_tac [("f","Abs_REAL")] arg_cong 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
116 |
by (simp_tac (simpset() addsimps [realrel_in_real RS Abs_REAL_inverse, |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
117 |
[equiv_realrel, real_minus_congruent] MRS UN_equiv_class]) 1); |
5588 | 118 |
qed "real_minus"; |
119 |
||
120 |
Goal "- (- z) = (z::real)"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
121 |
by (res_inst_tac [("z","z")] eq_Abs_REAL 1); |
5588 | 122 |
by (asm_simp_tac (simpset() addsimps [real_minus]) 1); |
123 |
qed "real_minus_minus"; |
|
124 |
||
125 |
Addsimps [real_minus_minus]; |
|
126 |
||
127 |
Goal "inj(%r::real. -r)"; |
|
128 |
by (rtac injI 1); |
|
129 |
by (dres_inst_tac [("f","uminus")] arg_cong 1); |
|
130 |
by (asm_full_simp_tac (simpset() addsimps [real_minus_minus]) 1); |
|
131 |
qed "inj_real_minus"; |
|
132 |
||
11701
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents:
11655
diff
changeset
|
133 |
Goalw [real_zero_def] "- 0 = (0::real)"; |
5588 | 134 |
by (simp_tac (simpset() addsimps [real_minus]) 1); |
135 |
qed "real_minus_zero"; |
|
136 |
||
137 |
Addsimps [real_minus_zero]; |
|
138 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
139 |
Goal "(-x = 0) = (x = (0::real))"; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
140 |
by (res_inst_tac [("z","x")] eq_Abs_REAL 1); |
5588 | 141 |
by (auto_tac (claset(), |
142 |
simpset() addsimps [real_zero_def, real_minus] @ preal_add_ac)); |
|
143 |
qed "real_minus_zero_iff"; |
|
144 |
||
145 |
Addsimps [real_minus_zero_iff]; |
|
146 |
||
147 |
(*** Congruence property for addition ***) |
|
148 |
Goalw [congruent2_def] |
|
149 |
"congruent2 realrel (%p1 p2. \ |
|
10834 | 150 |
\ (%(x1,y1). (%(x2,y2). realrel``{(x1+x2, y1+y2)}) p2) p1)"; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
151 |
by (clarify_tac (claset() addSEs [realrelE]) 1); |
5588 | 152 |
by (asm_simp_tac (simpset() addsimps [preal_add_assoc]) 1); |
153 |
by (res_inst_tac [("z1.1","x1a")] (preal_add_left_commute RS ssubst) 1); |
|
154 |
by (asm_simp_tac (simpset() addsimps [preal_add_assoc RS sym]) 1); |
|
155 |
by (asm_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
156 |
qed "real_add_congruent2"; |
|
157 |
||
158 |
Goalw [real_add_def] |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
159 |
"Abs_REAL(realrel``{(x1,y1)}) + Abs_REAL(realrel``{(x2,y2)}) = \ |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
160 |
\ Abs_REAL(realrel``{(x1+x2, y1+y2)})"; |
9391 | 161 |
by (simp_tac (simpset() addsimps |
162 |
[[equiv_realrel, real_add_congruent2] MRS UN_equiv_class2]) 1); |
|
5588 | 163 |
qed "real_add"; |
164 |
||
165 |
Goal "(z::real) + w = w + z"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
166 |
by (res_inst_tac [("z","z")] eq_Abs_REAL 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
167 |
by (res_inst_tac [("z","w")] eq_Abs_REAL 1); |
5588 | 168 |
by (asm_simp_tac (simpset() addsimps preal_add_ac @ [real_add]) 1); |
169 |
qed "real_add_commute"; |
|
170 |
||
171 |
Goal "((z1::real) + z2) + z3 = z1 + (z2 + z3)"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
172 |
by (res_inst_tac [("z","z1")] eq_Abs_REAL 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
173 |
by (res_inst_tac [("z","z2")] eq_Abs_REAL 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
174 |
by (res_inst_tac [("z","z3")] eq_Abs_REAL 1); |
5588 | 175 |
by (asm_simp_tac (simpset() addsimps [real_add, preal_add_assoc]) 1); |
176 |
qed "real_add_assoc"; |
|
177 |
||
178 |
(*For AC rewriting*) |
|
179 |
Goal "(x::real)+(y+z)=y+(x+z)"; |
|
13438
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
12483
diff
changeset
|
180 |
by(rtac ([real_add_assoc,real_add_commute] MRS |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
12483
diff
changeset
|
181 |
read_instantiate[("f","op +")](thm"mk_left_commute")) 1); |
5588 | 182 |
qed "real_add_left_commute"; |
183 |
||
184 |
(* real addition is an AC operator *) |
|
7428 | 185 |
bind_thms ("real_add_ac", [real_add_assoc,real_add_commute,real_add_left_commute]); |
5588 | 186 |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
187 |
Goalw [real_of_preal_def,real_zero_def] "(0::real) + z = z"; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
188 |
by (res_inst_tac [("z","z")] eq_Abs_REAL 1); |
5588 | 189 |
by (asm_full_simp_tac (simpset() addsimps [real_add] @ preal_add_ac) 1); |
190 |
qed "real_add_zero_left"; |
|
191 |
Addsimps [real_add_zero_left]; |
|
192 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
193 |
Goal "z + (0::real) = z"; |
5588 | 194 |
by (simp_tac (simpset() addsimps [real_add_commute]) 1); |
195 |
qed "real_add_zero_right"; |
|
196 |
Addsimps [real_add_zero_right]; |
|
197 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
198 |
Goalw [real_zero_def] "z + (-z) = (0::real)"; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
199 |
by (res_inst_tac [("z","z")] eq_Abs_REAL 1); |
5588 | 200 |
by (asm_full_simp_tac (simpset() addsimps [real_minus, |
201 |
real_add, preal_add_commute]) 1); |
|
202 |
qed "real_add_minus"; |
|
203 |
Addsimps [real_add_minus]; |
|
204 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
205 |
Goal "(-z) + z = (0::real)"; |
5588 | 206 |
by (simp_tac (simpset() addsimps [real_add_commute]) 1); |
207 |
qed "real_add_minus_left"; |
|
208 |
Addsimps [real_add_minus_left]; |
|
209 |
||
210 |
||
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
211 |
Goal "z + ((- z) + w) = (w::real)"; |
5588 | 212 |
by (simp_tac (simpset() addsimps [real_add_assoc RS sym]) 1); |
213 |
qed "real_add_minus_cancel"; |
|
214 |
||
215 |
Goal "(-z) + (z + w) = (w::real)"; |
|
216 |
by (simp_tac (simpset() addsimps [real_add_assoc RS sym]) 1); |
|
217 |
qed "real_minus_add_cancel"; |
|
218 |
||
219 |
Addsimps [real_add_minus_cancel, real_minus_add_cancel]; |
|
220 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
221 |
Goal "EX y. (x::real) + y = 0"; |
5588 | 222 |
by (blast_tac (claset() addIs [real_add_minus]) 1); |
223 |
qed "real_minus_ex"; |
|
224 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
225 |
Goal "EX! y. (x::real) + y = 0"; |
5588 | 226 |
by (auto_tac (claset() addIs [real_add_minus],simpset())); |
227 |
by (dres_inst_tac [("f","%x. ya+x")] arg_cong 1); |
|
228 |
by (asm_full_simp_tac (simpset() addsimps [real_add_assoc RS sym]) 1); |
|
229 |
by (asm_full_simp_tac (simpset() addsimps [real_add_commute]) 1); |
|
230 |
qed "real_minus_ex1"; |
|
231 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
232 |
Goal "EX! y. y + (x::real) = 0"; |
5588 | 233 |
by (auto_tac (claset() addIs [real_add_minus_left],simpset())); |
234 |
by (dres_inst_tac [("f","%x. x+ya")] arg_cong 1); |
|
235 |
by (asm_full_simp_tac (simpset() addsimps [real_add_assoc]) 1); |
|
236 |
by (asm_full_simp_tac (simpset() addsimps [real_add_commute]) 1); |
|
237 |
qed "real_minus_left_ex1"; |
|
238 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
239 |
Goal "x + y = (0::real) ==> x = -y"; |
5588 | 240 |
by (cut_inst_tac [("z","y")] real_add_minus_left 1); |
241 |
by (res_inst_tac [("x1","y")] (real_minus_left_ex1 RS ex1E) 1); |
|
242 |
by (Blast_tac 1); |
|
243 |
qed "real_add_minus_eq_minus"; |
|
244 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
245 |
Goal "EX (y::real). x = -y"; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
246 |
by (cut_inst_tac [("x","x")] real_minus_ex 1); |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
247 |
by (etac exE 1 THEN dtac real_add_minus_eq_minus 1); |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
248 |
by (Fast_tac 1); |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
249 |
qed "real_as_add_inverse_ex"; |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
250 |
|
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
251 |
Goal "-(x + y) = (-x) + (- y :: real)"; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
252 |
by (res_inst_tac [("z","x")] eq_Abs_REAL 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
253 |
by (res_inst_tac [("z","y")] eq_Abs_REAL 1); |
5588 | 254 |
by (auto_tac (claset(),simpset() addsimps [real_minus,real_add])); |
255 |
qed "real_minus_add_distrib"; |
|
256 |
||
257 |
Addsimps [real_minus_add_distrib]; |
|
258 |
||
259 |
Goal "((x::real) + y = x + z) = (y = z)"; |
|
260 |
by (Step_tac 1); |
|
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
261 |
by (dres_inst_tac [("f","%t. (-x) + t")] arg_cong 1); |
5588 | 262 |
by (asm_full_simp_tac (simpset() addsimps [real_add_assoc RS sym]) 1); |
263 |
qed "real_add_left_cancel"; |
|
264 |
||
265 |
Goal "(y + (x::real)= z + x) = (y = z)"; |
|
266 |
by (simp_tac (simpset() addsimps [real_add_commute,real_add_left_cancel]) 1); |
|
267 |
qed "real_add_right_cancel"; |
|
268 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
269 |
Goal "(0::real) - x = -x"; |
5588 | 270 |
by (simp_tac (simpset() addsimps [real_diff_def]) 1); |
271 |
qed "real_diff_0"; |
|
272 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
273 |
Goal "x - (0::real) = x"; |
5588 | 274 |
by (simp_tac (simpset() addsimps [real_diff_def]) 1); |
275 |
qed "real_diff_0_right"; |
|
276 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
277 |
Goal "x - x = (0::real)"; |
5588 | 278 |
by (simp_tac (simpset() addsimps [real_diff_def]) 1); |
279 |
qed "real_diff_self"; |
|
280 |
||
281 |
Addsimps [real_diff_0, real_diff_0_right, real_diff_self]; |
|
282 |
||
283 |
||
284 |
(*** Congruence property for multiplication ***) |
|
285 |
||
286 |
Goal "!!(x1::preal). [| x1 + y2 = x2 + y1 |] ==> \ |
|
287 |
\ x * x1 + y * y1 + (x * y2 + x2 * y) = \ |
|
288 |
\ x * x2 + y * y2 + (x * y1 + x1 * y)"; |
|
289 |
by (asm_full_simp_tac (simpset() addsimps [preal_add_left_commute, |
|
290 |
preal_add_assoc RS sym,preal_add_mult_distrib2 RS sym]) 1); |
|
291 |
by (rtac (preal_mult_commute RS subst) 1); |
|
292 |
by (res_inst_tac [("y1","x2")] (preal_mult_commute RS subst) 1); |
|
293 |
by (asm_full_simp_tac (simpset() addsimps [preal_add_assoc, |
|
294 |
preal_add_mult_distrib2 RS sym]) 1); |
|
295 |
by (asm_full_simp_tac (simpset() addsimps [preal_add_commute]) 1); |
|
296 |
qed "real_mult_congruent2_lemma"; |
|
297 |
||
298 |
Goal |
|
299 |
"congruent2 realrel (%p1 p2. \ |
|
10834 | 300 |
\ (%(x1,y1). (%(x2,y2). realrel``{(x1*x2 + y1*y2, x1*y2+x2*y1)}) p2) p1)"; |
5588 | 301 |
by (rtac (equiv_realrel RS congruent2_commuteI) 1); |
10232
529c65b5dcde
restoration of "equalityI"; renaming of contrapos rules
paulson
parents:
10043
diff
changeset
|
302 |
by (Clarify_tac 1); |
5588 | 303 |
by (rewtac split_def); |
304 |
by (asm_simp_tac (simpset() addsimps [preal_mult_commute,preal_add_commute]) 1); |
|
305 |
by (auto_tac (claset(),simpset() addsimps [real_mult_congruent2_lemma])); |
|
306 |
qed "real_mult_congruent2"; |
|
307 |
||
308 |
Goalw [real_mult_def] |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
309 |
"Abs_REAL((realrel``{(x1,y1)})) * Abs_REAL((realrel``{(x2,y2)})) = \ |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
310 |
\ Abs_REAL(realrel `` {(x1*x2+y1*y2,x1*y2+x2*y1)})"; |
9391 | 311 |
by (simp_tac (simpset() addsimps |
312 |
[[equiv_realrel, real_mult_congruent2] MRS UN_equiv_class2]) 1); |
|
5588 | 313 |
qed "real_mult"; |
314 |
||
315 |
Goal "(z::real) * w = w * z"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
316 |
by (res_inst_tac [("z","z")] eq_Abs_REAL 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
317 |
by (res_inst_tac [("z","w")] eq_Abs_REAL 1); |
5588 | 318 |
by (asm_simp_tac |
319 |
(simpset() addsimps [real_mult] @ preal_add_ac @ preal_mult_ac) 1); |
|
320 |
qed "real_mult_commute"; |
|
321 |
||
322 |
Goal "((z1::real) * z2) * z3 = z1 * (z2 * z3)"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
323 |
by (res_inst_tac [("z","z1")] eq_Abs_REAL 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
324 |
by (res_inst_tac [("z","z2")] eq_Abs_REAL 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
325 |
by (res_inst_tac [("z","z3")] eq_Abs_REAL 1); |
5588 | 326 |
by (asm_simp_tac (simpset() addsimps [preal_add_mult_distrib2,real_mult] @ |
327 |
preal_add_ac @ preal_mult_ac) 1); |
|
328 |
qed "real_mult_assoc"; |
|
329 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
330 |
Goal "(z1::real) * (z2 * z3) = z2 * (z1 * z3)"; |
13438
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
12483
diff
changeset
|
331 |
by(rtac ([real_mult_assoc,real_mult_commute] MRS |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
12483
diff
changeset
|
332 |
read_instantiate[("f","op *")](thm"mk_left_commute")) 1); |
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
333 |
qed "real_mult_left_commute"; |
5588 | 334 |
|
335 |
(* real multiplication is an AC operator *) |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
336 |
bind_thms ("real_mult_ac", |
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
337 |
[real_mult_assoc, real_mult_commute, real_mult_left_commute]); |
5588 | 338 |
|
11713
883d559b0b8c
sane numerals (stage 3): provide generic "1" on all number types;
wenzelm
parents:
11701
diff
changeset
|
339 |
Goalw [real_one_def,pnat_one_def] "(1::real) * z = z"; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
340 |
by (res_inst_tac [("z","z")] eq_Abs_REAL 1); |
5588 | 341 |
by (asm_full_simp_tac |
342 |
(simpset() addsimps [real_mult, |
|
343 |
preal_add_mult_distrib2,preal_mult_1_right] |
|
344 |
@ preal_mult_ac @ preal_add_ac) 1); |
|
345 |
qed "real_mult_1"; |
|
346 |
||
347 |
Addsimps [real_mult_1]; |
|
348 |
||
11713
883d559b0b8c
sane numerals (stage 3): provide generic "1" on all number types;
wenzelm
parents:
11701
diff
changeset
|
349 |
Goal "z * (1::real) = z"; |
5588 | 350 |
by (simp_tac (simpset() addsimps [real_mult_commute]) 1); |
351 |
qed "real_mult_1_right"; |
|
352 |
||
353 |
Addsimps [real_mult_1_right]; |
|
354 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
355 |
Goalw [real_zero_def,pnat_one_def] "0 * z = (0::real)"; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
356 |
by (res_inst_tac [("z","z")] eq_Abs_REAL 1); |
5588 | 357 |
by (asm_full_simp_tac (simpset() addsimps [real_mult, |
358 |
preal_add_mult_distrib2,preal_mult_1_right] |
|
359 |
@ preal_mult_ac @ preal_add_ac) 1); |
|
360 |
qed "real_mult_0"; |
|
361 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
362 |
Goal "z * 0 = (0::real)"; |
5588 | 363 |
by (simp_tac (simpset() addsimps [real_mult_commute, real_mult_0]) 1); |
364 |
qed "real_mult_0_right"; |
|
365 |
||
366 |
Addsimps [real_mult_0_right, real_mult_0]; |
|
367 |
||
12483
0a01efff43e9
new rewrite rules for use by arith_tac to take care of uminus.
nipkow
parents:
12018
diff
changeset
|
368 |
Goal "(-x) * (y::real) = -(x * y)"; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
369 |
by (res_inst_tac [("z","x")] eq_Abs_REAL 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
370 |
by (res_inst_tac [("z","y")] eq_Abs_REAL 1); |
5588 | 371 |
by (auto_tac (claset(), |
372 |
simpset() addsimps [real_minus,real_mult] |
|
9391 | 373 |
@ preal_mult_ac @ preal_add_ac)); |
12483
0a01efff43e9
new rewrite rules for use by arith_tac to take care of uminus.
nipkow
parents:
12018
diff
changeset
|
374 |
qed "real_mult_minus_eq1"; |
0a01efff43e9
new rewrite rules for use by arith_tac to take care of uminus.
nipkow
parents:
12018
diff
changeset
|
375 |
Addsimps [real_mult_minus_eq1]; |
0a01efff43e9
new rewrite rules for use by arith_tac to take care of uminus.
nipkow
parents:
12018
diff
changeset
|
376 |
|
0a01efff43e9
new rewrite rules for use by arith_tac to take care of uminus.
nipkow
parents:
12018
diff
changeset
|
377 |
bind_thm("real_minus_mult_eq1", real_mult_minus_eq1 RS sym); |
5588 | 378 |
|
12483
0a01efff43e9
new rewrite rules for use by arith_tac to take care of uminus.
nipkow
parents:
12018
diff
changeset
|
379 |
Goal "x * (- y :: real) = -(x * y)"; |
0a01efff43e9
new rewrite rules for use by arith_tac to take care of uminus.
nipkow
parents:
12018
diff
changeset
|
380 |
by (simp_tac (simpset() addsimps [inst "z" "x" real_mult_commute]) 1); |
0a01efff43e9
new rewrite rules for use by arith_tac to take care of uminus.
nipkow
parents:
12018
diff
changeset
|
381 |
qed "real_mult_minus_eq2"; |
0a01efff43e9
new rewrite rules for use by arith_tac to take care of uminus.
nipkow
parents:
12018
diff
changeset
|
382 |
Addsimps [real_mult_minus_eq2]; |
5588 | 383 |
|
12483
0a01efff43e9
new rewrite rules for use by arith_tac to take care of uminus.
nipkow
parents:
12018
diff
changeset
|
384 |
bind_thm("real_minus_mult_eq2", real_mult_minus_eq2 RS sym); |
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
385 |
|
11713
883d559b0b8c
sane numerals (stage 3): provide generic "1" on all number types;
wenzelm
parents:
11701
diff
changeset
|
386 |
Goal "(- (1::real)) * z = -z"; |
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
387 |
by (Simp_tac 1); |
5588 | 388 |
qed "real_mult_minus_1"; |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
389 |
Addsimps [real_mult_minus_1]; |
5588 | 390 |
|
11713
883d559b0b8c
sane numerals (stage 3): provide generic "1" on all number types;
wenzelm
parents:
11701
diff
changeset
|
391 |
Goal "z * (- (1::real)) = -z"; |
5588 | 392 |
by (stac real_mult_commute 1); |
393 |
by (Simp_tac 1); |
|
394 |
qed "real_mult_minus_1_right"; |
|
395 |
Addsimps [real_mult_minus_1_right]; |
|
396 |
||
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
397 |
Goal "(-x) * (-y) = x * (y::real)"; |
12483
0a01efff43e9
new rewrite rules for use by arith_tac to take care of uminus.
nipkow
parents:
12018
diff
changeset
|
398 |
by (Simp_tac 1); |
5588 | 399 |
qed "real_minus_mult_cancel"; |
400 |
||
401 |
Addsimps [real_minus_mult_cancel]; |
|
402 |
||
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
403 |
Goal "(-x) * y = x * (- y :: real)"; |
12483
0a01efff43e9
new rewrite rules for use by arith_tac to take care of uminus.
nipkow
parents:
12018
diff
changeset
|
404 |
by (Simp_tac 1); |
5588 | 405 |
qed "real_minus_mult_commute"; |
406 |
||
407 |
(** Lemmas **) |
|
408 |
||
9266 | 409 |
Goal "(z::real) + v = z' + v' ==> z + (v + w) = z' + (v' + w)"; |
410 |
by (asm_simp_tac (simpset() addsimps [real_add_assoc RS sym]) 1); |
|
411 |
qed "real_add_assoc_cong"; |
|
5588 | 412 |
|
9266 | 413 |
Goal "(z::real) + (v + w) = v + (z + w)"; |
414 |
by (REPEAT (ares_tac [real_add_commute RS real_add_assoc_cong] 1)); |
|
415 |
qed "real_add_assoc_swap"; |
|
5588 | 416 |
|
417 |
Goal "((z1::real) + z2) * w = (z1 * w) + (z2 * w)"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
418 |
by (res_inst_tac [("z","z1")] eq_Abs_REAL 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
419 |
by (res_inst_tac [("z","z2")] eq_Abs_REAL 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
420 |
by (res_inst_tac [("z","w")] eq_Abs_REAL 1); |
5588 | 421 |
by (asm_simp_tac |
422 |
(simpset() addsimps [preal_add_mult_distrib2, real_add, real_mult] @ |
|
423 |
preal_add_ac @ preal_mult_ac) 1); |
|
424 |
qed "real_add_mult_distrib"; |
|
425 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
426 |
val real_mult_commute'= inst "z" "w" real_mult_commute; |
5588 | 427 |
|
428 |
Goal "(w::real) * (z1 + z2) = (w * z1) + (w * z2)"; |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
429 |
by (simp_tac (simpset() addsimps [real_mult_commute', |
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
430 |
real_add_mult_distrib]) 1); |
5588 | 431 |
qed "real_add_mult_distrib2"; |
432 |
||
8027 | 433 |
Goalw [real_diff_def] "((z1::real) - z2) * w = (z1 * w) - (z2 * w)"; |
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
434 |
by (simp_tac (simpset() addsimps [real_add_mult_distrib]) 1); |
8027 | 435 |
qed "real_diff_mult_distrib"; |
436 |
||
437 |
Goal "(w::real) * (z1 - z2) = (w * z1) - (w * z2)"; |
|
438 |
by (simp_tac (simpset() addsimps [real_mult_commute', |
|
439 |
real_diff_mult_distrib]) 1); |
|
440 |
qed "real_diff_mult_distrib2"; |
|
441 |
||
5588 | 442 |
(*** one and zero are distinct ***) |
11713
883d559b0b8c
sane numerals (stage 3): provide generic "1" on all number types;
wenzelm
parents:
11701
diff
changeset
|
443 |
Goalw [real_zero_def,real_one_def] "0 ~= (1::real)"; |
5588 | 444 |
by (auto_tac (claset(), |
445 |
simpset() addsimps [preal_self_less_add_left RS preal_not_refl2])); |
|
446 |
qed "real_zero_not_eq_one"; |
|
447 |
||
448 |
(*** existence of inverse ***) |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
449 |
(** lemma -- alternative definition of 0 **) |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
450 |
Goalw [real_zero_def] "0 = Abs_REAL (realrel `` {(x, x)})"; |
5588 | 451 |
by (auto_tac (claset(),simpset() addsimps [preal_add_commute])); |
452 |
qed "real_zero_iff"; |
|
453 |
||
454 |
Goalw [real_zero_def,real_one_def] |
|
11713
883d559b0b8c
sane numerals (stage 3): provide generic "1" on all number types;
wenzelm
parents:
11701
diff
changeset
|
455 |
"!!(x::real). x ~= 0 ==> EX y. x*y = (1::real)"; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
456 |
by (res_inst_tac [("z","x")] eq_Abs_REAL 1); |
5588 | 457 |
by (cut_inst_tac [("r1.0","xa"),("r2.0","y")] preal_linear 1); |
458 |
by (auto_tac (claset() addSDs [preal_less_add_left_Ex], |
|
459 |
simpset() addsimps [real_zero_iff RS sym])); |
|
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
460 |
by (res_inst_tac [("x", |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
461 |
"Abs_REAL (realrel `` \ |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
462 |
\ {(preal_of_prat(prat_of_pnat 1), \ |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
463 |
\ pinv(D) + preal_of_prat(prat_of_pnat 1))})")] exI 1); |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
464 |
by (res_inst_tac [("x", |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
465 |
"Abs_REAL (realrel `` \ |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
466 |
\ {(pinv(D) + preal_of_prat(prat_of_pnat 1),\ |
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
467 |
\ preal_of_prat(prat_of_pnat 1))})")] exI 2); |
5588 | 468 |
by (auto_tac (claset(), |
469 |
simpset() addsimps [real_mult, |
|
470 |
pnat_one_def,preal_mult_1_right,preal_add_mult_distrib2, |
|
471 |
preal_add_mult_distrib,preal_mult_1,preal_mult_inv_right] |
|
472 |
@ preal_add_ac @ preal_mult_ac)); |
|
473 |
qed "real_mult_inv_right_ex"; |
|
474 |
||
11713
883d559b0b8c
sane numerals (stage 3): provide generic "1" on all number types;
wenzelm
parents:
11701
diff
changeset
|
475 |
Goal "x ~= 0 ==> EX y. y*x = (1::real)"; |
10648 | 476 |
by (dtac real_mult_inv_right_ex 1); |
477 |
by (auto_tac (claset(), simpset() addsimps [real_mult_commute])); |
|
5588 | 478 |
qed "real_mult_inv_left_ex"; |
479 |
||
11713
883d559b0b8c
sane numerals (stage 3): provide generic "1" on all number types;
wenzelm
parents:
11701
diff
changeset
|
480 |
Goalw [real_inverse_def] "x ~= 0 ==> inverse(x)*x = (1::real)"; |
7499 | 481 |
by (ftac real_mult_inv_left_ex 1); |
5588 | 482 |
by (Step_tac 1); |
9969 | 483 |
by (rtac someI2 1); |
5588 | 484 |
by Auto_tac; |
485 |
qed "real_mult_inv_left"; |
|
10648 | 486 |
Addsimps [real_mult_inv_left]; |
5588 | 487 |
|
11713
883d559b0b8c
sane numerals (stage 3): provide generic "1" on all number types;
wenzelm
parents:
11701
diff
changeset
|
488 |
Goal "x ~= 0 ==> x*inverse(x) = (1::real)"; |
10648 | 489 |
by (stac real_mult_commute 1); |
490 |
by (auto_tac (claset(), simpset() addsimps [real_mult_inv_left])); |
|
5588 | 491 |
qed "real_mult_inv_right"; |
10648 | 492 |
Addsimps [real_mult_inv_right]; |
493 |
||
494 |
(** Inverse of zero! Useful to simplify certain equations **) |
|
495 |
||
496 |
Goalw [real_inverse_def] "inverse 0 = (0::real)"; |
|
497 |
by (rtac someI2 1); |
|
498 |
by (auto_tac (claset(), simpset() addsimps [real_zero_not_eq_one])); |
|
499 |
qed "INVERSE_ZERO"; |
|
500 |
||
501 |
Goal "a / (0::real) = 0"; |
|
502 |
by (simp_tac (simpset() addsimps [real_divide_def, INVERSE_ZERO]) 1); |
|
503 |
qed "DIVISION_BY_ZERO"; (*NOT for adding to default simpset*) |
|
504 |
||
505 |
fun real_div_undefined_case_tac s i = |
|
506 |
case_tac s i THEN |
|
507 |
asm_simp_tac (simpset() addsimps [DIVISION_BY_ZERO, INVERSE_ZERO]) i; |
|
508 |
||
5588 | 509 |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
510 |
Goal "(c::real) ~= 0 ==> (c*a=c*b) = (a=b)"; |
5588 | 511 |
by Auto_tac; |
10606 | 512 |
by (dres_inst_tac [("f","%x. x*inverse c")] arg_cong 1); |
10648 | 513 |
by (asm_full_simp_tac (simpset() addsimps real_mult_ac) 1); |
5588 | 514 |
qed "real_mult_left_cancel"; |
515 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
516 |
Goal "(c::real) ~= 0 ==> (a*c=b*c) = (a=b)"; |
5588 | 517 |
by (Step_tac 1); |
10606 | 518 |
by (dres_inst_tac [("f","%x. x*inverse c")] arg_cong 1); |
10648 | 519 |
by (asm_full_simp_tac (simpset() addsimps real_mult_ac) 1); |
5588 | 520 |
qed "real_mult_right_cancel"; |
521 |
||
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
522 |
Goal "c*a ~= c*b ==> a ~= b"; |
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
523 |
by Auto_tac; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
524 |
qed "real_mult_left_cancel_ccontr"; |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
525 |
|
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
526 |
Goal "a*c ~= b*c ==> a ~= b"; |
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
527 |
by Auto_tac; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
528 |
qed "real_mult_right_cancel_ccontr"; |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
529 |
|
10606 | 530 |
Goalw [real_inverse_def] "x ~= 0 ==> inverse(x::real) ~= 0"; |
7499 | 531 |
by (ftac real_mult_inv_left_ex 1); |
5588 | 532 |
by (etac exE 1); |
9969 | 533 |
by (rtac someI2 1); |
5588 | 534 |
by (auto_tac (claset(), |
10648 | 535 |
simpset() addsimps [real_mult_0, real_zero_not_eq_one])); |
10606 | 536 |
qed "real_inverse_not_zero"; |
5588 | 537 |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
538 |
Goal "[| x ~= 0; y ~= 0 |] ==> x * y ~= (0::real)"; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
539 |
by (Step_tac 1); |
10606 | 540 |
by (dres_inst_tac [("f","%z. inverse x*z")] arg_cong 1); |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
541 |
by (asm_full_simp_tac (simpset() addsimps [real_mult_assoc RS sym]) 1); |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
542 |
qed "real_mult_not_zero"; |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
543 |
|
10648 | 544 |
Goal "inverse(inverse (x::real)) = x"; |
545 |
by (real_div_undefined_case_tac "x=0" 1); |
|
10606 | 546 |
by (res_inst_tac [("c1","inverse x")] (real_mult_right_cancel RS iffD1) 1); |
547 |
by (etac real_inverse_not_zero 1); |
|
548 |
by (auto_tac (claset() addDs [real_inverse_not_zero],simpset())); |
|
549 |
qed "real_inverse_inverse"; |
|
10648 | 550 |
Addsimps [real_inverse_inverse]; |
5588 | 551 |
|
11713
883d559b0b8c
sane numerals (stage 3): provide generic "1" on all number types;
wenzelm
parents:
11701
diff
changeset
|
552 |
Goalw [real_inverse_def] "inverse((1::real)) = (1::real)"; |
5588 | 553 |
by (cut_facts_tac [real_zero_not_eq_one RS |
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
554 |
not_sym RS real_mult_inv_left_ex] 1); |
5588 | 555 |
by (auto_tac (claset(), |
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
556 |
simpset() addsimps [real_zero_not_eq_one RS not_sym])); |
10606 | 557 |
qed "real_inverse_1"; |
558 |
Addsimps [real_inverse_1]; |
|
5588 | 559 |
|
10648 | 560 |
Goal "inverse(-x) = -inverse(x::real)"; |
561 |
by (real_div_undefined_case_tac "x=0" 1); |
|
5588 | 562 |
by (res_inst_tac [("c1","-x")] (real_mult_right_cancel RS iffD1) 1); |
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
563 |
by (stac real_mult_inv_left 2); |
5588 | 564 |
by Auto_tac; |
10606 | 565 |
qed "real_minus_inverse"; |
5588 | 566 |
|
10648 | 567 |
Goal "inverse(x*y) = inverse(x)*inverse(y::real)"; |
568 |
by (real_div_undefined_case_tac "x=0" 1); |
|
569 |
by (real_div_undefined_case_tac "y=0" 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
570 |
by (forw_inst_tac [("y","y")] real_mult_not_zero 1 THEN assume_tac 1); |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
571 |
by (res_inst_tac [("c1","x")] (real_mult_left_cancel RS iffD1) 1); |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
572 |
by (auto_tac (claset(),simpset() addsimps [real_mult_assoc RS sym])); |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
573 |
by (res_inst_tac [("c1","y")] (real_mult_left_cancel RS iffD1) 1); |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
574 |
by (auto_tac (claset(),simpset() addsimps [real_mult_left_commute])); |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
575 |
by (asm_simp_tac (simpset() addsimps [real_mult_assoc RS sym]) 1); |
10606 | 576 |
qed "real_inverse_distrib"; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
577 |
|
10648 | 578 |
Goal "(x::real) * (y/z) = (x*y)/z"; |
579 |
by (simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 1); |
|
580 |
qed "real_times_divide1_eq"; |
|
581 |
||
582 |
Goal "(y/z) * (x::real) = (y*x)/z"; |
|
583 |
by (simp_tac (simpset() addsimps [real_divide_def]@real_mult_ac) 1); |
|
584 |
qed "real_times_divide2_eq"; |
|
585 |
||
586 |
Addsimps [real_times_divide1_eq, real_times_divide2_eq]; |
|
587 |
||
588 |
Goal "(x::real) / (y/z) = (x*z)/y"; |
|
589 |
by (simp_tac (simpset() addsimps [real_divide_def, real_inverse_distrib]@ |
|
590 |
real_mult_ac) 1); |
|
591 |
qed "real_divide_divide1_eq"; |
|
592 |
||
593 |
Goal "((x::real) / y) / z = x/(y*z)"; |
|
594 |
by (simp_tac (simpset() addsimps [real_divide_def, real_inverse_distrib, |
|
595 |
real_mult_assoc]) 1); |
|
596 |
qed "real_divide_divide2_eq"; |
|
597 |
||
598 |
Addsimps [real_divide_divide1_eq, real_divide_divide2_eq]; |
|
599 |
||
600 |
(** As with multiplication, pull minus signs OUT of the / operator **) |
|
601 |
||
602 |
Goal "(-x) / (y::real) = - (x/y)"; |
|
603 |
by (simp_tac (simpset() addsimps [real_divide_def]) 1); |
|
604 |
qed "real_minus_divide_eq"; |
|
605 |
Addsimps [real_minus_divide_eq]; |
|
606 |
||
607 |
Goal "(x / -(y::real)) = - (x/y)"; |
|
608 |
by (simp_tac (simpset() addsimps [real_divide_def, real_minus_inverse]) 1); |
|
609 |
qed "real_divide_minus_eq"; |
|
610 |
Addsimps [real_divide_minus_eq]; |
|
611 |
||
612 |
Goal "(x+y)/(z::real) = x/z + y/z"; |
|
613 |
by (simp_tac (simpset() addsimps [real_divide_def, real_add_mult_distrib]) 1); |
|
614 |
qed "real_add_divide_distrib"; |
|
615 |
||
616 |
(*The following would e.g. convert (x+y)/2 to x/2 + y/2. Sometimes that |
|
617 |
leads to cancellations in x or y, but is also prevents "multiplying out" |
|
618 |
the 2 in e.g. (x+y)/2 = 5. |
|
619 |
||
620 |
Addsimps [inst "z" "number_of ?w" real_add_divide_distrib]; |
|
621 |
**) |
|
622 |
||
623 |
||
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
624 |
(*--------------------------------------------------------- |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
625 |
Theorems for ordering |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
626 |
--------------------------------------------------------*) |
5588 | 627 |
(* prove introduction and elimination rules for real_less *) |
628 |
||
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
629 |
(* real_less is a strong order i.e. nonreflexive and transitive *) |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
630 |
|
5588 | 631 |
(*** lemmas ***) |
632 |
Goal "!!(x::preal). [| x = y; x1 = y1 |] ==> x + y1 = x1 + y"; |
|
633 |
by (asm_simp_tac (simpset() addsimps [preal_add_commute]) 1); |
|
634 |
qed "preal_lemma_eq_rev_sum"; |
|
635 |
||
636 |
Goal "!!(b::preal). x + (b + y) = x1 + (b + y1) ==> x + y = x1 + y1"; |
|
637 |
by (asm_full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
638 |
qed "preal_add_left_commute_cancel"; |
|
639 |
||
640 |
Goal "!!(x::preal). [| x + y2a = x2a + y; \ |
|
641 |
\ x + y2b = x2b + y |] \ |
|
642 |
\ ==> x2a + y2b = x2b + y2a"; |
|
643 |
by (dtac preal_lemma_eq_rev_sum 1); |
|
644 |
by (assume_tac 1); |
|
645 |
by (thin_tac "x + y2b = x2b + y" 1); |
|
646 |
by (asm_full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
647 |
by (dtac preal_add_left_commute_cancel 1); |
|
648 |
by (asm_full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
649 |
qed "preal_lemma_for_not_refl"; |
|
650 |
||
651 |
Goal "~ (R::real) < R"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
652 |
by (res_inst_tac [("z","R")] eq_Abs_REAL 1); |
5588 | 653 |
by (auto_tac (claset(),simpset() addsimps [real_less_def])); |
654 |
by (dtac preal_lemma_for_not_refl 1); |
|
10752
c4f1bf2acf4c
tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents:
10712
diff
changeset
|
655 |
by (assume_tac 1); |
c4f1bf2acf4c
tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents:
10712
diff
changeset
|
656 |
by Auto_tac; |
5588 | 657 |
qed "real_less_not_refl"; |
658 |
||
659 |
(*** y < y ==> P ***) |
|
660 |
bind_thm("real_less_irrefl", real_less_not_refl RS notE); |
|
661 |
AddSEs [real_less_irrefl]; |
|
662 |
||
663 |
Goal "!!(x::real). x < y ==> x ~= y"; |
|
664 |
by (auto_tac (claset(),simpset() addsimps [real_less_not_refl])); |
|
665 |
qed "real_not_refl2"; |
|
666 |
||
667 |
(* lemma re-arranging and eliminating terms *) |
|
668 |
Goal "!! (a::preal). [| a + b = c + d; \ |
|
669 |
\ x2b + d + (c + y2e) < a + y2b + (x2e + b) |] \ |
|
670 |
\ ==> x2b + y2e < x2e + y2b"; |
|
671 |
by (asm_full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
672 |
by (res_inst_tac [("C","c+d")] preal_add_left_less_cancel 1); |
|
673 |
by (asm_full_simp_tac (simpset() addsimps [preal_add_assoc RS sym]) 1); |
|
674 |
qed "preal_lemma_trans"; |
|
675 |
||
676 |
(** heavy re-writing involved*) |
|
677 |
Goal "!!(R1::real). [| R1 < R2; R2 < R3 |] ==> R1 < R3"; |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
678 |
by (res_inst_tac [("z","R1")] eq_Abs_REAL 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
679 |
by (res_inst_tac [("z","R2")] eq_Abs_REAL 1); |
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
680 |
by (res_inst_tac [("z","R3")] eq_Abs_REAL 1); |
5588 | 681 |
by (auto_tac (claset(),simpset() addsimps [real_less_def])); |
682 |
by (REPEAT(rtac exI 1)); |
|
683 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
684 |
by (REPEAT(Blast_tac 2)); |
|
685 |
by (dtac preal_lemma_for_not_refl 1 THEN assume_tac 1); |
|
686 |
by (blast_tac (claset() addDs [preal_add_less_mono] |
|
687 |
addIs [preal_lemma_trans]) 1); |
|
688 |
qed "real_less_trans"; |
|
689 |
||
9167 | 690 |
Goal "!! (R1::real). R1 < R2 ==> ~ (R2 < R1)"; |
691 |
by (rtac notI 1); |
|
5588 | 692 |
by (dtac real_less_trans 1 THEN assume_tac 1); |
693 |
by (asm_full_simp_tac (simpset() addsimps [real_less_not_refl]) 1); |
|
9167 | 694 |
qed "real_less_not_sym"; |
695 |
||
696 |
(* [| x < y; ~P ==> y < x |] ==> P *) |
|
10232
529c65b5dcde
restoration of "equalityI"; renaming of contrapos rules
paulson
parents:
10043
diff
changeset
|
697 |
bind_thm ("real_less_asym", real_less_not_sym RS contrapos_np); |
5588 | 698 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
699 |
Goalw [real_of_preal_def] |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
700 |
"real_of_preal ((z1::preal) + z2) = \ |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
701 |
\ real_of_preal z1 + real_of_preal z2"; |
5588 | 702 |
by (asm_simp_tac (simpset() addsimps [real_add, |
703 |
preal_add_mult_distrib,preal_mult_1] addsimps preal_add_ac) 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
704 |
qed "real_of_preal_add"; |
5588 | 705 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
706 |
Goalw [real_of_preal_def] |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
707 |
"real_of_preal ((z1::preal) * z2) = \ |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
708 |
\ real_of_preal z1* real_of_preal z2"; |
5588 | 709 |
by (full_simp_tac (simpset() addsimps [real_mult, |
710 |
preal_add_mult_distrib2,preal_mult_1, |
|
711 |
preal_mult_1_right,pnat_one_def] |
|
712 |
@ preal_add_ac @ preal_mult_ac) 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
713 |
qed "real_of_preal_mult"; |
5588 | 714 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
715 |
Goalw [real_of_preal_def] |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
716 |
"!!(x::preal). y < x ==> \ |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
717 |
\ EX m. Abs_REAL (realrel `` {(x,y)}) = real_of_preal m"; |
5588 | 718 |
by (auto_tac (claset() addSDs [preal_less_add_left_Ex], |
719 |
simpset() addsimps preal_add_ac)); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
720 |
qed "real_of_preal_ExI"; |
5588 | 721 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
722 |
Goalw [real_of_preal_def] |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
723 |
"!!(x::preal). EX m. Abs_REAL (realrel `` {(x,y)}) = \ |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
724 |
\ real_of_preal m ==> y < x"; |
5588 | 725 |
by (auto_tac (claset(), |
726 |
simpset() addsimps |
|
727 |
[preal_add_commute,preal_add_assoc])); |
|
728 |
by (asm_full_simp_tac (simpset() addsimps |
|
729 |
[preal_add_assoc RS sym,preal_self_less_add_left]) 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
730 |
qed "real_of_preal_ExD"; |
5588 | 731 |
|
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
732 |
Goal "(EX m. Abs_REAL (realrel `` {(x,y)}) = real_of_preal m) = (y < x)"; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
733 |
by (blast_tac (claset() addSIs [real_of_preal_ExI,real_of_preal_ExD]) 1); |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
734 |
qed "real_of_preal_iff"; |
5588 | 735 |
|
736 |
(*** Gleason prop 9-4.4 p 127 ***) |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
737 |
Goalw [real_of_preal_def,real_zero_def] |
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
738 |
"EX m. (x::real) = real_of_preal m | x = 0 | x = -(real_of_preal m)"; |
10919
144ede948e58
renamings: real_of_nat, real_of_int -> (overloaded) real
paulson
parents:
10834
diff
changeset
|
739 |
by (res_inst_tac [("z","x")] eq_Abs_REAL 1); |
5588 | 740 |
by (auto_tac (claset(),simpset() addsimps [real_minus] @ preal_add_ac)); |
741 |
by (cut_inst_tac [("r1.0","x"),("r2.0","y")] preal_linear 1); |
|
742 |
by (auto_tac (claset() addSDs [preal_less_add_left_Ex], |
|
743 |
simpset() addsimps [preal_add_assoc RS sym])); |
|
744 |
by (auto_tac (claset(),simpset() addsimps [preal_add_commute])); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
745 |
qed "real_of_preal_trichotomy"; |
5588 | 746 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
747 |
Goal "!!P. [| !!m. x = real_of_preal m ==> P; \ |
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
748 |
\ x = 0 ==> P; \ |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
749 |
\ !!m. x = -(real_of_preal m) ==> P |] ==> P"; |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
750 |
by (cut_inst_tac [("x","x")] real_of_preal_trichotomy 1); |
5588 | 751 |
by Auto_tac; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
752 |
qed "real_of_preal_trichotomyE"; |
5588 | 753 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
754 |
Goalw [real_of_preal_def] |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
755 |
"real_of_preal m1 < real_of_preal m2 ==> m1 < m2"; |
5588 | 756 |
by (auto_tac (claset(),simpset() addsimps [real_less_def] @ preal_add_ac)); |
757 |
by (auto_tac (claset(),simpset() addsimps [preal_add_assoc RS sym])); |
|
758 |
by (auto_tac (claset(),simpset() addsimps preal_add_ac)); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
759 |
qed "real_of_preal_lessD"; |
5588 | 760 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
761 |
Goal "m1 < m2 ==> real_of_preal m1 < real_of_preal m2"; |
5588 | 762 |
by (dtac preal_less_add_left_Ex 1); |
763 |
by (auto_tac (claset(), |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
764 |
simpset() addsimps [real_of_preal_add, |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
765 |
real_of_preal_def,real_less_def])); |
5588 | 766 |
by (REPEAT(rtac exI 1)); |
767 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
768 |
by (REPEAT(Blast_tac 2)); |
|
769 |
by (simp_tac (simpset() addsimps [preal_self_less_add_left] |
|
770 |
delsimps [preal_add_less_iff2]) 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
771 |
qed "real_of_preal_lessI"; |
5588 | 772 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
773 |
Goal "(real_of_preal m1 < real_of_preal m2) = (m1 < m2)"; |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
774 |
by (blast_tac (claset() addIs [real_of_preal_lessI,real_of_preal_lessD]) 1); |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
775 |
qed "real_of_preal_less_iff1"; |
5588 | 776 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
777 |
Addsimps [real_of_preal_less_iff1]; |
5588 | 778 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
779 |
Goal "- real_of_preal m < real_of_preal m"; |
5588 | 780 |
by (auto_tac (claset(), |
781 |
simpset() addsimps |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
782 |
[real_of_preal_def,real_less_def,real_minus])); |
5588 | 783 |
by (REPEAT(rtac exI 1)); |
784 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
785 |
by (REPEAT(Blast_tac 2)); |
|
786 |
by (full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
787 |
by (full_simp_tac (simpset() addsimps [preal_self_less_add_right, |
|
788 |
preal_add_assoc RS sym]) 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
789 |
qed "real_of_preal_minus_less_self"; |
5588 | 790 |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
791 |
Goalw [real_zero_def] "- real_of_preal m < 0"; |
5588 | 792 |
by (auto_tac (claset(), |
7292 | 793 |
simpset() addsimps [real_of_preal_def, |
794 |
real_less_def,real_minus])); |
|
5588 | 795 |
by (REPEAT(rtac exI 1)); |
796 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
797 |
by (REPEAT(Blast_tac 2)); |
|
798 |
by (full_simp_tac (simpset() addsimps |
|
799 |
[preal_self_less_add_right] @ preal_add_ac) 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
800 |
qed "real_of_preal_minus_less_zero"; |
5588 | 801 |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
802 |
Goal "~ 0 < - real_of_preal m"; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
803 |
by (cut_facts_tac [real_of_preal_minus_less_zero] 1); |
5588 | 804 |
by (fast_tac (claset() addDs [real_less_trans] |
805 |
addEs [real_less_irrefl]) 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
806 |
qed "real_of_preal_not_minus_gt_zero"; |
5588 | 807 |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
808 |
Goalw [real_zero_def] "0 < real_of_preal m"; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
809 |
by (auto_tac (claset(),simpset() addsimps |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
810 |
[real_of_preal_def,real_less_def,real_minus])); |
5588 | 811 |
by (REPEAT(rtac exI 1)); |
812 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
813 |
by (REPEAT(Blast_tac 2)); |
|
814 |
by (full_simp_tac (simpset() addsimps |
|
815 |
[preal_self_less_add_right] @ preal_add_ac) 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
816 |
qed "real_of_preal_zero_less"; |
5588 | 817 |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
818 |
Goal "~ real_of_preal m < 0"; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
819 |
by (cut_facts_tac [real_of_preal_zero_less] 1); |
5588 | 820 |
by (blast_tac (claset() addDs [real_less_trans] |
7292 | 821 |
addEs [real_less_irrefl]) 1); |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
822 |
qed "real_of_preal_not_less_zero"; |
5588 | 823 |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
824 |
Goal "0 < - (- real_of_preal m)"; |
5588 | 825 |
by (simp_tac (simpset() addsimps |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
826 |
[real_of_preal_zero_less]) 1); |
5588 | 827 |
qed "real_minus_minus_zero_less"; |
828 |
||
829 |
(* another lemma *) |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
830 |
Goalw [real_zero_def] |
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
831 |
"0 < real_of_preal m + real_of_preal m1"; |
5588 | 832 |
by (auto_tac (claset(), |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
833 |
simpset() addsimps [real_of_preal_def, |
7292 | 834 |
real_less_def,real_add])); |
5588 | 835 |
by (REPEAT(rtac exI 1)); |
836 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
837 |
by (REPEAT(Blast_tac 2)); |
|
838 |
by (full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
839 |
by (full_simp_tac (simpset() addsimps [preal_self_less_add_right, |
|
840 |
preal_add_assoc RS sym]) 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
841 |
qed "real_of_preal_sum_zero_less"; |
5588 | 842 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
843 |
Goal "- real_of_preal m < real_of_preal m1"; |
5588 | 844 |
by (auto_tac (claset(), |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
845 |
simpset() addsimps [real_of_preal_def, |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
846 |
real_less_def,real_minus])); |
5588 | 847 |
by (REPEAT(rtac exI 1)); |
848 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
849 |
by (REPEAT(Blast_tac 2)); |
|
850 |
by (full_simp_tac (simpset() addsimps preal_add_ac) 1); |
|
851 |
by (full_simp_tac (simpset() addsimps [preal_self_less_add_right, |
|
852 |
preal_add_assoc RS sym]) 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
853 |
qed "real_of_preal_minus_less_all"; |
5588 | 854 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
855 |
Goal "~ real_of_preal m < - real_of_preal m1"; |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
856 |
by (cut_facts_tac [real_of_preal_minus_less_all] 1); |
5588 | 857 |
by (blast_tac (claset() addDs [real_less_trans] |
858 |
addEs [real_less_irrefl]) 1); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
859 |
qed "real_of_preal_not_minus_gt_all"; |
5588 | 860 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
861 |
Goal "- real_of_preal m1 < - real_of_preal m2 \ |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
862 |
\ ==> real_of_preal m2 < real_of_preal m1"; |
5588 | 863 |
by (auto_tac (claset(), |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
864 |
simpset() addsimps [real_of_preal_def, |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
865 |
real_less_def,real_minus])); |
5588 | 866 |
by (REPEAT(rtac exI 1)); |
867 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
868 |
by (REPEAT(Blast_tac 2)); |
|
869 |
by (auto_tac (claset(),simpset() addsimps preal_add_ac)); |
|
870 |
by (asm_full_simp_tac (simpset() addsimps [preal_add_assoc RS sym]) 1); |
|
871 |
by (auto_tac (claset(),simpset() addsimps preal_add_ac)); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
872 |
qed "real_of_preal_minus_less_rev1"; |
5588 | 873 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
874 |
Goal "real_of_preal m1 < real_of_preal m2 \ |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
875 |
\ ==> - real_of_preal m2 < - real_of_preal m1"; |
5588 | 876 |
by (auto_tac (claset(), |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
877 |
simpset() addsimps [real_of_preal_def, |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
878 |
real_less_def,real_minus])); |
5588 | 879 |
by (REPEAT(rtac exI 1)); |
880 |
by (EVERY[rtac conjI 1, rtac conjI 2]); |
|
881 |
by (REPEAT(Blast_tac 2)); |
|
882 |
by (auto_tac (claset(),simpset() addsimps preal_add_ac)); |
|
883 |
by (asm_full_simp_tac (simpset() addsimps [preal_add_assoc RS sym]) 1); |
|
884 |
by (auto_tac (claset(),simpset() addsimps preal_add_ac)); |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
885 |
qed "real_of_preal_minus_less_rev2"; |
5588 | 886 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
887 |
Goal "(- real_of_preal m1 < - real_of_preal m2) = \ |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
888 |
\ (real_of_preal m2 < real_of_preal m1)"; |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
889 |
by (blast_tac (claset() addSIs [real_of_preal_minus_less_rev1, |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
890 |
real_of_preal_minus_less_rev2]) 1); |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
891 |
qed "real_of_preal_minus_less_rev_iff"; |
5588 | 892 |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
893 |
Addsimps [real_of_preal_minus_less_rev_iff]; |
5588 | 894 |
|
895 |
(*** linearity ***) |
|
896 |
Goal "(R1::real) < R2 | R1 = R2 | R2 < R1"; |
|
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
897 |
by (res_inst_tac [("x","R1")] real_of_preal_trichotomyE 1); |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
898 |
by (ALLGOALS(res_inst_tac [("x","R2")] real_of_preal_trichotomyE)); |
5588 | 899 |
by (auto_tac (claset() addSDs [preal_le_anti_sym], |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
900 |
simpset() addsimps [preal_less_le_iff,real_of_preal_minus_less_zero, |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
901 |
real_of_preal_zero_less,real_of_preal_minus_less_all])); |
5588 | 902 |
qed "real_linear"; |
903 |
||
904 |
Goal "!!w::real. (w ~= z) = (w<z | z<w)"; |
|
905 |
by (cut_facts_tac [real_linear] 1); |
|
906 |
by (Blast_tac 1); |
|
907 |
qed "real_neq_iff"; |
|
908 |
||
909 |
Goal "!!(R1::real). [| R1 < R2 ==> P; R1 = R2 ==> P; \ |
|
910 |
\ R2 < R1 ==> P |] ==> P"; |
|
911 |
by (cut_inst_tac [("R1.0","R1"),("R2.0","R2")] real_linear 1); |
|
912 |
by Auto_tac; |
|
913 |
qed "real_linear_less2"; |
|
914 |
||
915 |
(*** Properties of <= ***) |
|
916 |
||
917 |
Goalw [real_le_def] "~(w < z) ==> z <= (w::real)"; |
|
918 |
by (assume_tac 1); |
|
919 |
qed "real_leI"; |
|
920 |
||
921 |
Goalw [real_le_def] "z<=w ==> ~(w<(z::real))"; |
|
922 |
by (assume_tac 1); |
|
923 |
qed "real_leD"; |
|
924 |
||
7428 | 925 |
bind_thm ("real_leE", make_elim real_leD); |
5588 | 926 |
|
927 |
Goal "(~(w < z)) = (z <= (w::real))"; |
|
928 |
by (blast_tac (claset() addSIs [real_leI,real_leD]) 1); |
|
929 |
qed "real_less_le_iff"; |
|
930 |
||
931 |
Goalw [real_le_def] "~ z <= w ==> w<(z::real)"; |
|
932 |
by (Blast_tac 1); |
|
933 |
qed "not_real_leE"; |
|
934 |
||
935 |
Goalw [real_le_def] "!!(x::real). x <= y ==> x < y | x = y"; |
|
936 |
by (cut_facts_tac [real_linear] 1); |
|
937 |
by (blast_tac (claset() addEs [real_less_irrefl,real_less_asym]) 1); |
|
938 |
qed "real_le_imp_less_or_eq"; |
|
939 |
||
940 |
Goalw [real_le_def] "z<w | z=w ==> z <=(w::real)"; |
|
941 |
by (cut_facts_tac [real_linear] 1); |
|
942 |
by (fast_tac (claset() addEs [real_less_irrefl,real_less_asym]) 1); |
|
943 |
qed "real_less_or_eq_imp_le"; |
|
944 |
||
945 |
Goal "(x <= (y::real)) = (x < y | x=y)"; |
|
946 |
by (REPEAT(ares_tac [iffI, real_less_or_eq_imp_le, real_le_imp_less_or_eq] 1)); |
|
947 |
qed "real_le_less"; |
|
948 |
||
949 |
Goal "w <= (w::real)"; |
|
950 |
by (simp_tac (simpset() addsimps [real_le_less]) 1); |
|
951 |
qed "real_le_refl"; |
|
952 |
||
953 |
(* Axiom 'linorder_linear' of class 'linorder': *) |
|
954 |
Goal "(z::real) <= w | w <= z"; |
|
955 |
by (simp_tac (simpset() addsimps [real_le_less]) 1); |
|
956 |
by (cut_facts_tac [real_linear] 1); |
|
957 |
by (Blast_tac 1); |
|
958 |
qed "real_le_linear"; |
|
959 |
||
960 |
Goal "[| i <= j; j <= k |] ==> i <= (k::real)"; |
|
961 |
by (EVERY1 [dtac real_le_imp_less_or_eq, dtac real_le_imp_less_or_eq, |
|
10752
c4f1bf2acf4c
tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents:
10712
diff
changeset
|
962 |
rtac real_less_or_eq_imp_le, |
c4f1bf2acf4c
tidying, and separation of HOL-Hyperreal from HOL-Real
paulson
parents:
10712
diff
changeset
|
963 |
blast_tac (claset() addIs [real_less_trans])]); |
5588 | 964 |
qed "real_le_trans"; |
965 |
||
966 |
Goal "[| z <= w; w <= z |] ==> z = (w::real)"; |
|
967 |
by (EVERY1 [dtac real_le_imp_less_or_eq, dtac real_le_imp_less_or_eq, |
|
968 |
fast_tac (claset() addEs [real_less_irrefl,real_less_asym])]); |
|
969 |
qed "real_le_anti_sym"; |
|
970 |
||
971 |
Goal "[| ~ y < x; y ~= x |] ==> x < (y::real)"; |
|
972 |
by (rtac not_real_leE 1); |
|
973 |
by (blast_tac (claset() addDs [real_le_imp_less_or_eq]) 1); |
|
974 |
qed "not_less_not_eq_real_less"; |
|
975 |
||
976 |
(* Axiom 'order_less_le' of class 'order': *) |
|
11655 | 977 |
Goal "((w::real) < z) = (w <= z & w ~= z)"; |
5588 | 978 |
by (simp_tac (simpset() addsimps [real_le_def, real_neq_iff]) 1); |
979 |
by (blast_tac (claset() addSEs [real_less_asym]) 1); |
|
980 |
qed "real_less_le"; |
|
981 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
982 |
Goal "(0 < -R) = (R < (0::real))"; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
983 |
by (res_inst_tac [("x","R")] real_of_preal_trichotomyE 1); |
5588 | 984 |
by (auto_tac (claset(), |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
985 |
simpset() addsimps [real_of_preal_not_minus_gt_zero, |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
986 |
real_of_preal_not_less_zero,real_of_preal_zero_less, |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
987 |
real_of_preal_minus_less_zero])); |
5588 | 988 |
qed "real_minus_zero_less_iff"; |
989 |
Addsimps [real_minus_zero_less_iff]; |
|
990 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
991 |
Goal "(-R < 0) = ((0::real) < R)"; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
992 |
by (res_inst_tac [("x","R")] real_of_preal_trichotomyE 1); |
5588 | 993 |
by (auto_tac (claset(), |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
994 |
simpset() addsimps [real_of_preal_not_minus_gt_zero, |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
995 |
real_of_preal_not_less_zero,real_of_preal_zero_less, |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
996 |
real_of_preal_minus_less_zero])); |
5588 | 997 |
qed "real_minus_zero_less_iff2"; |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
998 |
Addsimps [real_minus_zero_less_iff2]; |
5588 | 999 |
|
1000 |
(*Alternative definition for real_less*) |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
1001 |
Goal "R < S ==> EX T::real. 0 < T & R + T = S"; |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1002 |
by (res_inst_tac [("x","R")] real_of_preal_trichotomyE 1); |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1003 |
by (ALLGOALS(res_inst_tac [("x","S")] real_of_preal_trichotomyE)); |
5588 | 1004 |
by (auto_tac (claset() addSDs [preal_less_add_left_Ex], |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1005 |
simpset() addsimps [real_of_preal_not_minus_gt_all, |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1006 |
real_of_preal_add, real_of_preal_not_less_zero, |
5588 | 1007 |
real_less_not_refl, |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1008 |
real_of_preal_not_minus_gt_zero])); |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1009 |
by (res_inst_tac [("x","real_of_preal D")] exI 1); |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1010 |
by (res_inst_tac [("x","real_of_preal m+real_of_preal ma")] exI 2); |
12018
ec054019c910
Numerals and simprocs for types real and hypreal. The abstract
paulson
parents:
11713
diff
changeset
|
1011 |
by (res_inst_tac [("x","real_of_preal D")] exI 3); |
5588 | 1012 |
by (auto_tac (claset(), |
7077
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1013 |
simpset() addsimps [real_of_preal_zero_less, |
60b098bb8b8a
heavily revised by Jacques: coercions have alphabetic names;
paulson
parents:
5588
diff
changeset
|
1014 |
real_of_preal_sum_zero_less,real_add_assoc])); |
5588 | 1015 |
qed "real_less_add_positive_left_Ex"; |
1016 |
||
1017 |
(** change naff name(s)! **) |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
1018 |
Goal "(W < S) ==> (0 < S + (-W::real))"; |
5588 | 1019 |
by (dtac real_less_add_positive_left_Ex 1); |
1020 |
by (auto_tac (claset(), |
|
1021 |
simpset() addsimps [real_add_minus, |
|
1022 |
real_add_zero_right] @ real_add_ac)); |
|
1023 |
qed "real_less_sum_gt_zero"; |
|
1024 |
||
7127
48e235179ffb
added parentheses to cope with a possible reduction of the precedence of unary
paulson
parents:
7077
diff
changeset
|
1025 |
Goal "!!S::real. T = S + W ==> S = T + (-W)"; |
5588 | 1026 |
by (asm_simp_tac (simpset() addsimps real_add_ac) 1); |
1027 |
qed "real_lemma_change_eq_subj"; |
|
1028 |
||
1029 |
(* FIXME: long! *) |
|
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
1030 |
Goal "(0 < S + (-W::real)) ==> (W < S)"; |
5588 | 1031 |
by (rtac ccontr 1); |
1032 |
by (dtac (real_leI RS real_le_imp_less_or_eq) 1); |
|
1033 |
by (auto_tac (claset(), |
|
1034 |
simpset() addsimps [real_less_not_refl])); |
|
1035 |
by (EVERY1[dtac real_less_add_positive_left_Ex, etac exE, etac conjE]); |
|
1036 |
by (Asm_full_simp_tac 1); |
|
1037 |
by (dtac real_lemma_change_eq_subj 1); |
|
1038 |
by Auto_tac; |
|
1039 |
by (dtac real_less_sum_gt_zero 1); |
|
1040 |
by (asm_full_simp_tac (simpset() addsimps real_add_ac) 1); |
|
1041 |
by (EVERY1[rotate_tac 1, dtac (real_add_left_commute RS ssubst)]); |
|
1042 |
by (auto_tac (claset() addEs [real_less_asym], simpset())); |
|
1043 |
qed "real_sum_gt_zero_less"; |
|
1044 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
1045 |
Goal "(0 < S + (-W::real)) = (W < S)"; |
5588 | 1046 |
by (blast_tac (claset() addIs [real_less_sum_gt_zero, |
1047 |
real_sum_gt_zero_less]) 1); |
|
1048 |
qed "real_less_sum_gt_0_iff"; |
|
1049 |
||
1050 |
||
9043
ca761fe227d8
First round of changes, towards installation of simprocs
paulson
parents:
8027
diff
changeset
|
1051 |
Goalw [real_diff_def] "(x<y) = (x-y < (0::real))"; |
5588 | 1052 |
by (stac (real_minus_zero_less_iff RS sym) 1); |
1053 |
by (simp_tac (simpset() addsimps [real_add_commute, |
|
1054 |
real_less_sum_gt_0_iff]) 1); |
|
1055 |
qed "real_less_eq_diff"; |
|
1056 |
||
1057 |
||
1058 |
(*** Subtraction laws ***) |
|
1059 |
||
1060 |
Goal "x + (y - z) = (x + y) - (z::real)"; |
|
1061 |
by (simp_tac (simpset() addsimps real_diff_def::real_add_ac) 1); |
|
1062 |
qed "real_add_diff_eq"; |
|
1063 |
||
1064 |
Goal "(x - y) + z = (x + z) - (y::real)"; |
|
1065 |
by (simp_tac (simpset() addsimps real_diff_def::real_add_ac) 1); |
|
1066 |
qed "real_diff_add_eq"; |
|
1067 |
||
1068 |
Goal "(x - y) - z = x - (y + (z::real))"; |
|
1069 |
by (simp_tac (simpset() addsimps real_diff_def::real_add_ac) 1); |
|
1070 |
qed "real_diff_diff_eq"; |
|
1071 |
||
1072 |
Goal "x - (y - z) = (x + z) - (y::real)"; |
|
1073 |
by (simp_tac (simpset() addsimps real_diff_def::real_add_ac) 1); |
|
1074 |
qed "real_diff_diff_eq2"; |
|
1075 |
||
1076 |
Goal "(x-y < z) = (x < z + (y::real))"; |
|
1077 |
by (stac real_less_eq_diff 1); |
|
1078 |
by (res_inst_tac [("y1", "z")] (real_less_eq_diff RS ssubst) 1); |
|
1079 |
by (simp_tac (simpset() addsimps real_diff_def::real_add_ac) 1); |
|
1080 |
qed "real_diff_less_eq"; |
|
1081 |
||
1082 |
Goal "(x < z-y) = (x + (y::real) < z)"; |
|
1083 |
by (stac real_less_eq_diff 1); |
|
1084 |
by (res_inst_tac [("y1", "z-y")] (real_less_eq_diff RS ssubst) 1); |
|
1085 |
by (simp_tac (simpset() addsimps real_diff_def::real_add_ac) 1); |
|
1086 |
qed "real_less_diff_eq"; |
|
1087 |
||
1088 |
Goalw [real_le_def] "(x-y <= z) = (x <= z + (y::real))"; |
|
1089 |
by (simp_tac (simpset() addsimps [real_less_diff_eq]) 1); |
|
1090 |
qed "real_diff_le_eq"; |
|
1091 |
||
1092 |
Goalw [real_le_def] "(x <= z-y) = (x + (y::real) <= z)"; |
|
1093 |
by (simp_tac (simpset() addsimps [real_diff_less_eq]) 1); |
|
1094 |
qed "real_le_diff_eq"; |
|
1095 |
||
1096 |
Goalw [real_diff_def] "(x-y = z) = (x = z + (y::real))"; |
|
1097 |
by (auto_tac (claset(), simpset() addsimps [real_add_assoc])); |
|
1098 |
qed "real_diff_eq_eq"; |
|
1099 |
||
1100 |
Goalw [real_diff_def] "(x = z-y) = (x + (y::real) = z)"; |
|
1101 |
by (auto_tac (claset(), simpset() addsimps [real_add_assoc])); |
|
1102 |
qed "real_eq_diff_eq"; |
|
1103 |
||
1104 |
(*This list of rewrites simplifies (in)equalities by bringing subtractions |
|
1105 |
to the top and then moving negative terms to the other side. |
|
1106 |
Use with real_add_ac*) |
|
9108 | 1107 |
bind_thms ("real_compare_rls", |
5588 | 1108 |
[symmetric real_diff_def, |
1109 |
real_add_diff_eq, real_diff_add_eq, real_diff_diff_eq, real_diff_diff_eq2, |
|
1110 |
real_diff_less_eq, real_less_diff_eq, real_diff_le_eq, real_le_diff_eq, |
|
9108 | 1111 |
real_diff_eq_eq, real_eq_diff_eq]); |
5588 | 1112 |
|
1113 |
||
1114 |
(** For the cancellation simproc. |
|
1115 |
The idea is to cancel like terms on opposite sides by subtraction **) |
|
1116 |
||
1117 |
Goal "(x::real) - y = x' - y' ==> (x<y) = (x'<y')"; |
|
1118 |
by (stac real_less_eq_diff 1); |
|
1119 |
by (res_inst_tac [("y1", "y")] (real_less_eq_diff RS ssubst) 1); |
|
1120 |
by (Asm_simp_tac 1); |
|
1121 |
qed "real_less_eqI"; |
|
1122 |
||
1123 |
Goal "(x::real) - y = x' - y' ==> (y<=x) = (y'<=x')"; |
|
1124 |
by (dtac real_less_eqI 1); |
|
1125 |
by (asm_simp_tac (simpset() addsimps [real_le_def]) 1); |
|
1126 |
qed "real_le_eqI"; |
|
1127 |
||
1128 |
Goal "(x::real) - y = x' - y' ==> (x=y) = (x'=y')"; |
|
1129 |
by Safe_tac; |
|
1130 |
by (ALLGOALS |
|
1131 |
(asm_full_simp_tac |
|
1132 |
(simpset() addsimps [real_eq_diff_eq, real_diff_eq_eq]))); |
|
1133 |
qed "real_eq_eqI"; |