author | nipkow |
Sun, 22 Dec 2002 10:43:43 +0100 | |
changeset 13763 | f94b569cd610 |
parent 12030 | 46d57d0290a2 |
child 14981 | e73f8140af78 |
permissions | -rw-r--r-- |
2640 | 1 |
(* Title: HOLCF/Ssum1.ML |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
2 |
ID: $Id$ |
1461 | 3 |
Author: Franz Regensburger |
12030 | 4 |
License: GPL (GNU GENERAL PUBLIC LICENSE) |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
5 |
|
9169 | 6 |
Partial ordering for the strict sum ++ |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
7 |
*) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
8 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
9 |
fun eq_left s1 s2 = |
1461 | 10 |
( |
11 |
(res_inst_tac [("s",s1),("t",s2)] (inject_Isinl RS subst) 1) |
|
12 |
THEN (rtac trans 1) |
|
13 |
THEN (atac 2) |
|
14 |
THEN (etac sym 1)); |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
15 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
16 |
fun eq_right s1 s2 = |
1461 | 17 |
( |
18 |
(res_inst_tac [("s",s1),("t",s2)] (inject_Isinr RS subst) 1) |
|
19 |
THEN (rtac trans 1) |
|
20 |
THEN (atac 2) |
|
21 |
THEN (etac sym 1)); |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
22 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
23 |
fun UU_left s1 = |
1461 | 24 |
( |
25 |
(res_inst_tac [("t",s1)](noteq_IsinlIsinr RS conjunct1 RS ssubst)1) |
|
26 |
THEN (rtac trans 1) |
|
27 |
THEN (atac 2) |
|
28 |
THEN (etac sym 1)); |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
29 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
30 |
fun UU_right s1 = |
1461 | 31 |
( |
32 |
(res_inst_tac [("t",s1)](noteq_IsinlIsinr RS conjunct2 RS ssubst)1) |
|
33 |
THEN (rtac trans 1) |
|
34 |
THEN (atac 2) |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
35 |
THEN (etac sym 1)); |
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
36 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
37 |
Goalw [less_ssum_def] |
9245 | 38 |
"[|s1=Isinl(x::'a); s2=Isinl(y::'a)|] ==> s1 << s2 = (x << y)"; |
9969 | 39 |
by (rtac some_equality 1); |
9245 | 40 |
by (dtac conjunct1 2); |
41 |
by (dtac spec 2); |
|
42 |
by (dtac spec 2); |
|
43 |
by (etac mp 2); |
|
44 |
by (fast_tac HOL_cs 2); |
|
45 |
by (rtac conjI 1); |
|
46 |
by (strip_tac 1); |
|
47 |
by (etac conjE 1); |
|
48 |
by (eq_left "x" "u"); |
|
49 |
by (eq_left "y" "xa"); |
|
50 |
by (rtac refl 1); |
|
51 |
by (rtac conjI 1); |
|
52 |
by (strip_tac 1); |
|
53 |
by (etac conjE 1); |
|
54 |
by (UU_left "x"); |
|
55 |
by (UU_right "v"); |
|
56 |
by (Simp_tac 1); |
|
57 |
by (rtac conjI 1); |
|
58 |
by (strip_tac 1); |
|
59 |
by (etac conjE 1); |
|
60 |
by (eq_left "x" "u"); |
|
61 |
by (UU_left "y"); |
|
62 |
by (rtac iffI 1); |
|
63 |
by (etac UU_I 1); |
|
64 |
by (res_inst_tac [("s","x"),("t","UU::'a")] subst 1); |
|
65 |
by (atac 1); |
|
66 |
by (rtac refl_less 1); |
|
67 |
by (strip_tac 1); |
|
68 |
by (etac conjE 1); |
|
69 |
by (UU_left "x"); |
|
70 |
by (UU_right "v"); |
|
71 |
by (Simp_tac 1); |
|
72 |
qed "less_ssum1a"; |
|
73 |
||
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
74 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
75 |
Goalw [less_ssum_def] |
9245 | 76 |
"[|s1=Isinr(x::'b); s2=Isinr(y::'b)|] ==> s1 << s2 = (x << y)"; |
9969 | 77 |
by (rtac some_equality 1); |
9245 | 78 |
by (dtac conjunct2 2); |
79 |
by (dtac conjunct1 2); |
|
80 |
by (dtac spec 2); |
|
81 |
by (dtac spec 2); |
|
82 |
by (etac mp 2); |
|
83 |
by (fast_tac HOL_cs 2); |
|
84 |
by (rtac conjI 1); |
|
85 |
by (strip_tac 1); |
|
86 |
by (etac conjE 1); |
|
87 |
by (UU_right "x"); |
|
88 |
by (UU_left "u"); |
|
89 |
by (Simp_tac 1); |
|
90 |
by (rtac conjI 1); |
|
91 |
by (strip_tac 1); |
|
92 |
by (etac conjE 1); |
|
93 |
by (eq_right "x" "v"); |
|
94 |
by (eq_right "y" "ya"); |
|
95 |
by (rtac refl 1); |
|
96 |
by (rtac conjI 1); |
|
97 |
by (strip_tac 1); |
|
98 |
by (etac conjE 1); |
|
99 |
by (UU_right "x"); |
|
100 |
by (UU_left "u"); |
|
101 |
by (Simp_tac 1); |
|
102 |
by (strip_tac 1); |
|
103 |
by (etac conjE 1); |
|
104 |
by (eq_right "x" "v"); |
|
105 |
by (UU_right "y"); |
|
106 |
by (rtac iffI 1); |
|
107 |
by (etac UU_I 1); |
|
108 |
by (res_inst_tac [("s","UU::'b"),("t","x")] subst 1); |
|
109 |
by (etac sym 1); |
|
110 |
by (rtac refl_less 1); |
|
111 |
qed "less_ssum1b"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
112 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
113 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
114 |
Goalw [less_ssum_def] |
9245 | 115 |
"[|s1=Isinl(x::'a); s2=Isinr(y::'b)|] ==> s1 << s2 = ((x::'a) = UU)"; |
9969 | 116 |
by (rtac some_equality 1); |
9245 | 117 |
by (rtac conjI 1); |
118 |
by (strip_tac 1); |
|
119 |
by (etac conjE 1); |
|
120 |
by (eq_left "x" "u"); |
|
121 |
by (UU_left "xa"); |
|
122 |
by (rtac iffI 1); |
|
123 |
by (res_inst_tac [("s","x"),("t","UU::'a")] subst 1); |
|
124 |
by (atac 1); |
|
125 |
by (rtac refl_less 1); |
|
126 |
by (etac UU_I 1); |
|
127 |
by (rtac conjI 1); |
|
128 |
by (strip_tac 1); |
|
129 |
by (etac conjE 1); |
|
130 |
by (UU_left "x"); |
|
131 |
by (UU_right "v"); |
|
132 |
by (Simp_tac 1); |
|
133 |
by (rtac conjI 1); |
|
134 |
by (strip_tac 1); |
|
135 |
by (etac conjE 1); |
|
136 |
by (eq_left "x" "u"); |
|
137 |
by (rtac refl 1); |
|
138 |
by (strip_tac 1); |
|
139 |
by (etac conjE 1); |
|
140 |
by (UU_left "x"); |
|
141 |
by (UU_right "v"); |
|
142 |
by (Simp_tac 1); |
|
143 |
by (dtac conjunct2 1); |
|
144 |
by (dtac conjunct2 1); |
|
145 |
by (dtac conjunct1 1); |
|
146 |
by (dtac spec 1); |
|
147 |
by (dtac spec 1); |
|
148 |
by (etac mp 1); |
|
149 |
by (fast_tac HOL_cs 1); |
|
150 |
qed "less_ssum1c"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
151 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
152 |
|
9248
e1dee89de037
massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents:
9245
diff
changeset
|
153 |
Goalw [less_ssum_def] |
9245 | 154 |
"[|s1=Isinr(x); s2=Isinl(y)|] ==> s1 << s2 = (x = UU)"; |
9969 | 155 |
by (rtac some_equality 1); |
9245 | 156 |
by (dtac conjunct2 2); |
157 |
by (dtac conjunct2 2); |
|
158 |
by (dtac conjunct2 2); |
|
159 |
by (dtac spec 2); |
|
160 |
by (dtac spec 2); |
|
161 |
by (etac mp 2); |
|
162 |
by (fast_tac HOL_cs 2); |
|
163 |
by (rtac conjI 1); |
|
164 |
by (strip_tac 1); |
|
165 |
by (etac conjE 1); |
|
166 |
by (UU_right "x"); |
|
167 |
by (UU_left "u"); |
|
168 |
by (Simp_tac 1); |
|
169 |
by (rtac conjI 1); |
|
170 |
by (strip_tac 1); |
|
171 |
by (etac conjE 1); |
|
172 |
by (UU_right "ya"); |
|
173 |
by (eq_right "x" "v"); |
|
174 |
by (rtac iffI 1); |
|
175 |
by (etac UU_I 2); |
|
176 |
by (res_inst_tac [("s","UU"),("t","x")] subst 1); |
|
177 |
by (etac sym 1); |
|
178 |
by (rtac refl_less 1); |
|
179 |
by (rtac conjI 1); |
|
180 |
by (strip_tac 1); |
|
181 |
by (etac conjE 1); |
|
182 |
by (UU_right "x"); |
|
183 |
by (UU_left "u"); |
|
184 |
by (Simp_tac 1); |
|
185 |
by (strip_tac 1); |
|
186 |
by (etac conjE 1); |
|
187 |
by (eq_right "x" "v"); |
|
188 |
by (rtac refl 1); |
|
189 |
qed "less_ssum1d"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
190 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
191 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
192 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
193 |
(* optimize lemmas about less_ssum *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
194 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
195 |
|
9169 | 196 |
Goal "(Isinl x) << (Isinl y) = (x << y)"; |
197 |
by (rtac less_ssum1a 1); |
|
198 |
by (rtac refl 1); |
|
199 |
by (rtac refl 1); |
|
200 |
qed "less_ssum2a"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
201 |
|
9169 | 202 |
Goal "(Isinr x) << (Isinr y) = (x << y)"; |
203 |
by (rtac less_ssum1b 1); |
|
204 |
by (rtac refl 1); |
|
205 |
by (rtac refl 1); |
|
206 |
qed "less_ssum2b"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
207 |
|
9169 | 208 |
Goal "(Isinl x) << (Isinr y) = (x = UU)"; |
209 |
by (rtac less_ssum1c 1); |
|
210 |
by (rtac refl 1); |
|
211 |
by (rtac refl 1); |
|
212 |
qed "less_ssum2c"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
213 |
|
9169 | 214 |
Goal "(Isinr x) << (Isinl y) = (x = UU)"; |
215 |
by (rtac less_ssum1d 1); |
|
216 |
by (rtac refl 1); |
|
217 |
by (rtac refl 1); |
|
218 |
qed "less_ssum2d"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
219 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
220 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
221 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
222 |
(* less_ssum is a partial order on ++ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
223 |
(* ------------------------------------------------------------------------ *) |
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
224 |
|
9169 | 225 |
Goal "(p::'a++'b) << p"; |
226 |
by (res_inst_tac [("p","p")] IssumE2 1); |
|
227 |
by (hyp_subst_tac 1); |
|
228 |
by (rtac (less_ssum2a RS iffD2) 1); |
|
229 |
by (rtac refl_less 1); |
|
230 |
by (hyp_subst_tac 1); |
|
231 |
by (rtac (less_ssum2b RS iffD2) 1); |
|
232 |
by (rtac refl_less 1); |
|
233 |
qed "refl_less_ssum"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
234 |
|
9169 | 235 |
Goal "[|(p1::'a++'b) << p2; p2 << p1|] ==> p1=p2"; |
236 |
by (res_inst_tac [("p","p1")] IssumE2 1); |
|
237 |
by (hyp_subst_tac 1); |
|
238 |
by (res_inst_tac [("p","p2")] IssumE2 1); |
|
239 |
by (hyp_subst_tac 1); |
|
240 |
by (res_inst_tac [("f","Isinl")] arg_cong 1); |
|
241 |
by (rtac antisym_less 1); |
|
242 |
by (etac (less_ssum2a RS iffD1) 1); |
|
243 |
by (etac (less_ssum2a RS iffD1) 1); |
|
244 |
by (hyp_subst_tac 1); |
|
245 |
by (etac (less_ssum2d RS iffD1 RS ssubst) 1); |
|
246 |
by (etac (less_ssum2c RS iffD1 RS ssubst) 1); |
|
247 |
by (rtac strict_IsinlIsinr 1); |
|
248 |
by (hyp_subst_tac 1); |
|
249 |
by (res_inst_tac [("p","p2")] IssumE2 1); |
|
250 |
by (hyp_subst_tac 1); |
|
251 |
by (etac (less_ssum2c RS iffD1 RS ssubst) 1); |
|
252 |
by (etac (less_ssum2d RS iffD1 RS ssubst) 1); |
|
253 |
by (rtac (strict_IsinlIsinr RS sym) 1); |
|
254 |
by (hyp_subst_tac 1); |
|
255 |
by (res_inst_tac [("f","Isinr")] arg_cong 1); |
|
256 |
by (rtac antisym_less 1); |
|
257 |
by (etac (less_ssum2b RS iffD1) 1); |
|
258 |
by (etac (less_ssum2b RS iffD1) 1); |
|
259 |
qed "antisym_less_ssum"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
260 |
|
9169 | 261 |
Goal "[|(p1::'a++'b) << p2; p2 << p3|] ==> p1 << p3"; |
262 |
by (res_inst_tac [("p","p1")] IssumE2 1); |
|
263 |
by (hyp_subst_tac 1); |
|
264 |
by (res_inst_tac [("p","p3")] IssumE2 1); |
|
265 |
by (hyp_subst_tac 1); |
|
266 |
by (rtac (less_ssum2a RS iffD2) 1); |
|
267 |
by (res_inst_tac [("p","p2")] IssumE2 1); |
|
268 |
by (hyp_subst_tac 1); |
|
269 |
by (rtac trans_less 1); |
|
270 |
by (etac (less_ssum2a RS iffD1) 1); |
|
271 |
by (etac (less_ssum2a RS iffD1) 1); |
|
272 |
by (hyp_subst_tac 1); |
|
273 |
by (etac (less_ssum2c RS iffD1 RS ssubst) 1); |
|
274 |
by (rtac minimal 1); |
|
275 |
by (hyp_subst_tac 1); |
|
276 |
by (rtac (less_ssum2c RS iffD2) 1); |
|
277 |
by (res_inst_tac [("p","p2")] IssumE2 1); |
|
278 |
by (hyp_subst_tac 1); |
|
279 |
by (rtac UU_I 1); |
|
280 |
by (rtac trans_less 1); |
|
281 |
by (etac (less_ssum2a RS iffD1) 1); |
|
282 |
by (rtac (antisym_less_inverse RS conjunct1) 1); |
|
283 |
by (etac (less_ssum2c RS iffD1) 1); |
|
284 |
by (hyp_subst_tac 1); |
|
285 |
by (etac (less_ssum2c RS iffD1) 1); |
|
286 |
by (hyp_subst_tac 1); |
|
287 |
by (res_inst_tac [("p","p3")] IssumE2 1); |
|
288 |
by (hyp_subst_tac 1); |
|
289 |
by (rtac (less_ssum2d RS iffD2) 1); |
|
290 |
by (res_inst_tac [("p","p2")] IssumE2 1); |
|
291 |
by (hyp_subst_tac 1); |
|
292 |
by (etac (less_ssum2d RS iffD1) 1); |
|
293 |
by (hyp_subst_tac 1); |
|
294 |
by (rtac UU_I 1); |
|
295 |
by (rtac trans_less 1); |
|
296 |
by (etac (less_ssum2b RS iffD1) 1); |
|
297 |
by (rtac (antisym_less_inverse RS conjunct1) 1); |
|
298 |
by (etac (less_ssum2d RS iffD1) 1); |
|
299 |
by (hyp_subst_tac 1); |
|
300 |
by (rtac (less_ssum2b RS iffD2) 1); |
|
301 |
by (res_inst_tac [("p","p2")] IssumE2 1); |
|
302 |
by (hyp_subst_tac 1); |
|
303 |
by (etac (less_ssum2d RS iffD1 RS ssubst) 1); |
|
304 |
by (rtac minimal 1); |
|
305 |
by (hyp_subst_tac 1); |
|
306 |
by (rtac trans_less 1); |
|
307 |
by (etac (less_ssum2b RS iffD1) 1); |
|
308 |
by (etac (less_ssum2b RS iffD1) 1); |
|
309 |
qed "trans_less_ssum"; |
|
243
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
310 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
311 |
|
c22b85994e17
Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff
changeset
|
312 |