author | paulson |
Wed, 28 Jul 2004 10:49:29 +0200 | |
changeset 15079 | 2ef899e4526d |
parent 14981 | e73f8140af78 |
child 15103 | 79846e8792eb |
permissions | -rw-r--r-- |
923 | 1 |
(* Title: HOL/HOL.thy |
2 |
ID: $Id$ |
|
11750 | 3 |
Author: Tobias Nipkow, Markus Wenzel, and Larry Paulson |
4 |
*) |
|
923 | 5 |
|
11750 | 6 |
header {* The basis of Higher-Order Logic *} |
923 | 7 |
|
7357 | 8 |
theory HOL = CPure |
11451
8abfb4f7bd02
partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
11438
diff
changeset
|
9 |
files ("HOL_lemmas.ML") ("cladata.ML") ("blastdata.ML") ("simpdata.ML"): |
923 | 10 |
|
2260 | 11 |
|
11750 | 12 |
subsection {* Primitive logic *} |
13 |
||
14 |
subsubsection {* Core syntax *} |
|
2260 | 15 |
|
14854 | 16 |
classes type |
12338
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
12281
diff
changeset
|
17 |
defaultsort type |
3947 | 18 |
|
12338
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
12281
diff
changeset
|
19 |
global |
923 | 20 |
|
7357 | 21 |
typedecl bool |
923 | 22 |
|
23 |
arities |
|
12338
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
12281
diff
changeset
|
24 |
bool :: type |
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
12281
diff
changeset
|
25 |
fun :: (type, type) type |
923 | 26 |
|
11750 | 27 |
judgment |
28 |
Trueprop :: "bool => prop" ("(_)" 5) |
|
923 | 29 |
|
11750 | 30 |
consts |
7357 | 31 |
Not :: "bool => bool" ("~ _" [40] 40) |
32 |
True :: bool |
|
33 |
False :: bool |
|
34 |
If :: "[bool, 'a, 'a] => 'a" ("(if (_)/ then (_)/ else (_))" 10) |
|
3947 | 35 |
arbitrary :: 'a |
923 | 36 |
|
11432
8a203ae6efe3
added "The" (definite description operator) (by Larry);
wenzelm
parents:
10489
diff
changeset
|
37 |
The :: "('a => bool) => 'a" |
7357 | 38 |
All :: "('a => bool) => bool" (binder "ALL " 10) |
39 |
Ex :: "('a => bool) => bool" (binder "EX " 10) |
|
40 |
Ex1 :: "('a => bool) => bool" (binder "EX! " 10) |
|
41 |
Let :: "['a, 'a => 'b] => 'b" |
|
923 | 42 |
|
7357 | 43 |
"=" :: "['a, 'a] => bool" (infixl 50) |
44 |
& :: "[bool, bool] => bool" (infixr 35) |
|
45 |
"|" :: "[bool, bool] => bool" (infixr 30) |
|
46 |
--> :: "[bool, bool] => bool" (infixr 25) |
|
923 | 47 |
|
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
48 |
local |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
49 |
|
2260 | 50 |
|
11750 | 51 |
subsubsection {* Additional concrete syntax *} |
2260 | 52 |
|
4868 | 53 |
nonterminals |
923 | 54 |
letbinds letbind |
55 |
case_syn cases_syn |
|
56 |
||
57 |
syntax |
|
12650 | 58 |
"_not_equal" :: "['a, 'a] => bool" (infixl "~=" 50) |
11432
8a203ae6efe3
added "The" (definite description operator) (by Larry);
wenzelm
parents:
10489
diff
changeset
|
59 |
"_The" :: "[pttrn, bool] => 'a" ("(3THE _./ _)" [0, 10] 10) |
923 | 60 |
|
7357 | 61 |
"_bind" :: "[pttrn, 'a] => letbind" ("(2_ =/ _)" 10) |
62 |
"" :: "letbind => letbinds" ("_") |
|
63 |
"_binds" :: "[letbind, letbinds] => letbinds" ("_;/ _") |
|
64 |
"_Let" :: "[letbinds, 'a] => 'a" ("(let (_)/ in (_))" 10) |
|
923 | 65 |
|
9060
b0dd884b1848
rename @case to _case_syntax (improves on low-level errors);
wenzelm
parents:
8959
diff
changeset
|
66 |
"_case_syntax":: "['a, cases_syn] => 'b" ("(case _ of/ _)" 10) |
b0dd884b1848
rename @case to _case_syntax (improves on low-level errors);
wenzelm
parents:
8959
diff
changeset
|
67 |
"_case1" :: "['a, 'b] => case_syn" ("(2_ =>/ _)" 10) |
7357 | 68 |
"" :: "case_syn => cases_syn" ("_") |
9060
b0dd884b1848
rename @case to _case_syntax (improves on low-level errors);
wenzelm
parents:
8959
diff
changeset
|
69 |
"_case2" :: "[case_syn, cases_syn] => cases_syn" ("_/ | _") |
923 | 70 |
|
71 |
translations |
|
7238
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
7220
diff
changeset
|
72 |
"x ~= y" == "~ (x = y)" |
13764 | 73 |
"THE x. P" == "The (%x. P)" |
923 | 74 |
"_Let (_binds b bs) e" == "_Let b (_Let bs e)" |
1114 | 75 |
"let x = a in e" == "Let a (%x. e)" |
923 | 76 |
|
13763
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13723
diff
changeset
|
77 |
print_translation {* |
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13723
diff
changeset
|
78 |
(* To avoid eta-contraction of body: *) |
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13723
diff
changeset
|
79 |
[("The", fn [Abs abs] => |
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13723
diff
changeset
|
80 |
let val (x,t) = atomic_abs_tr' abs |
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13723
diff
changeset
|
81 |
in Syntax.const "_The" $ x $ t end)] |
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13723
diff
changeset
|
82 |
*} |
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13723
diff
changeset
|
83 |
|
12633 | 84 |
syntax (output) |
11687 | 85 |
"=" :: "['a, 'a] => bool" (infix 50) |
12650 | 86 |
"_not_equal" :: "['a, 'a] => bool" (infix "~=" 50) |
2260 | 87 |
|
12114
a8e860c86252
eliminated old "symbols" syntax, use "xsymbols" instead;
wenzelm
parents:
12023
diff
changeset
|
88 |
syntax (xsymbols) |
11687 | 89 |
Not :: "bool => bool" ("\<not> _" [40] 40) |
90 |
"op &" :: "[bool, bool] => bool" (infixr "\<and>" 35) |
|
91 |
"op |" :: "[bool, bool] => bool" (infixr "\<or>" 30) |
|
12114
a8e860c86252
eliminated old "symbols" syntax, use "xsymbols" instead;
wenzelm
parents:
12023
diff
changeset
|
92 |
"op -->" :: "[bool, bool] => bool" (infixr "\<longrightarrow>" 25) |
12650 | 93 |
"_not_equal" :: "['a, 'a] => bool" (infix "\<noteq>" 50) |
11687 | 94 |
"ALL " :: "[idts, bool] => bool" ("(3\<forall>_./ _)" [0, 10] 10) |
95 |
"EX " :: "[idts, bool] => bool" ("(3\<exists>_./ _)" [0, 10] 10) |
|
96 |
"EX! " :: "[idts, bool] => bool" ("(3\<exists>!_./ _)" [0, 10] 10) |
|
97 |
"_case1" :: "['a, 'b] => case_syn" ("(2_ \<Rightarrow>/ _)" 10) |
|
14361
ad2f5da643b4
* Support for raw latex output in control symbols: \<^raw...>
schirmer
parents:
14357
diff
changeset
|
98 |
(*"_case2" :: "[case_syn, cases_syn] => cases_syn" ("_/ \<orelse> _")*) |
2372 | 99 |
|
12114
a8e860c86252
eliminated old "symbols" syntax, use "xsymbols" instead;
wenzelm
parents:
12023
diff
changeset
|
100 |
syntax (xsymbols output) |
12650 | 101 |
"_not_equal" :: "['a, 'a] => bool" (infix "\<noteq>" 50) |
3820 | 102 |
|
6340 | 103 |
syntax (HTML output) |
14565 | 104 |
"_not_equal" :: "['a, 'a] => bool" (infix "\<noteq>" 50) |
11687 | 105 |
Not :: "bool => bool" ("\<not> _" [40] 40) |
14565 | 106 |
"op &" :: "[bool, bool] => bool" (infixr "\<and>" 35) |
107 |
"op |" :: "[bool, bool] => bool" (infixr "\<or>" 30) |
|
108 |
"_not_equal" :: "['a, 'a] => bool" (infix "\<noteq>" 50) |
|
109 |
"ALL " :: "[idts, bool] => bool" ("(3\<forall>_./ _)" [0, 10] 10) |
|
110 |
"EX " :: "[idts, bool] => bool" ("(3\<exists>_./ _)" [0, 10] 10) |
|
111 |
"EX! " :: "[idts, bool] => bool" ("(3\<exists>!_./ _)" [0, 10] 10) |
|
6340 | 112 |
|
7238
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
7220
diff
changeset
|
113 |
syntax (HOL) |
7357 | 114 |
"ALL " :: "[idts, bool] => bool" ("(3! _./ _)" [0, 10] 10) |
115 |
"EX " :: "[idts, bool] => bool" ("(3? _./ _)" [0, 10] 10) |
|
116 |
"EX! " :: "[idts, bool] => bool" ("(3?! _./ _)" [0, 10] 10) |
|
7238
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
7220
diff
changeset
|
117 |
|
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
7220
diff
changeset
|
118 |
|
11750 | 119 |
subsubsection {* Axioms and basic definitions *} |
2260 | 120 |
|
7357 | 121 |
axioms |
122 |
eq_reflection: "(x=y) ==> (x==y)" |
|
923 | 123 |
|
7357 | 124 |
refl: "t = (t::'a)" |
125 |
subst: "[| s = t; P(s) |] ==> P(t::'a)" |
|
6289 | 126 |
|
7357 | 127 |
ext: "(!!x::'a. (f x ::'b) = g x) ==> (%x. f x) = (%x. g x)" |
11750 | 128 |
-- {* Extensionality is built into the meta-logic, and this rule expresses *} |
129 |
-- {* a related property. It is an eta-expanded version of the traditional *} |
|
130 |
-- {* rule, and similar to the ABS rule of HOL *} |
|
6289 | 131 |
|
11432
8a203ae6efe3
added "The" (definite description operator) (by Larry);
wenzelm
parents:
10489
diff
changeset
|
132 |
the_eq_trivial: "(THE x. x = a) = (a::'a)" |
923 | 133 |
|
7357 | 134 |
impI: "(P ==> Q) ==> P-->Q" |
135 |
mp: "[| P-->Q; P |] ==> Q" |
|
923 | 136 |
|
137 |
defs |
|
7357 | 138 |
True_def: "True == ((%x::bool. x) = (%x. x))" |
139 |
All_def: "All(P) == (P = (%x. True))" |
|
11451
8abfb4f7bd02
partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
11438
diff
changeset
|
140 |
Ex_def: "Ex(P) == !Q. (!x. P x --> Q) --> Q" |
7357 | 141 |
False_def: "False == (!P. P)" |
142 |
not_def: "~ P == P-->False" |
|
143 |
and_def: "P & Q == !R. (P-->Q-->R) --> R" |
|
144 |
or_def: "P | Q == !R. (P-->R) --> (Q-->R) --> R" |
|
145 |
Ex1_def: "Ex1(P) == ? x. P(x) & (! y. P(y) --> y=x)" |
|
923 | 146 |
|
7357 | 147 |
axioms |
148 |
iff: "(P-->Q) --> (Q-->P) --> (P=Q)" |
|
149 |
True_or_False: "(P=True) | (P=False)" |
|
923 | 150 |
|
151 |
defs |
|
7357 | 152 |
Let_def: "Let s f == f(s)" |
11451
8abfb4f7bd02
partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
11438
diff
changeset
|
153 |
if_def: "If P x y == THE z::'a. (P=True --> z=x) & (P=False --> z=y)" |
5069 | 154 |
|
14223
0ee05eef881b
Added support for making constants final, that is, ensuring that no
skalberg
parents:
14208
diff
changeset
|
155 |
finalconsts |
0ee05eef881b
Added support for making constants final, that is, ensuring that no
skalberg
parents:
14208
diff
changeset
|
156 |
"op =" |
0ee05eef881b
Added support for making constants final, that is, ensuring that no
skalberg
parents:
14208
diff
changeset
|
157 |
"op -->" |
0ee05eef881b
Added support for making constants final, that is, ensuring that no
skalberg
parents:
14208
diff
changeset
|
158 |
The |
0ee05eef881b
Added support for making constants final, that is, ensuring that no
skalberg
parents:
14208
diff
changeset
|
159 |
arbitrary |
3320 | 160 |
|
11750 | 161 |
subsubsection {* Generic algebraic operations *} |
4868 | 162 |
|
12338
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
12281
diff
changeset
|
163 |
axclass zero < type |
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
12281
diff
changeset
|
164 |
axclass one < type |
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
12281
diff
changeset
|
165 |
axclass plus < type |
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
12281
diff
changeset
|
166 |
axclass minus < type |
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
12281
diff
changeset
|
167 |
axclass times < type |
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
12281
diff
changeset
|
168 |
axclass inverse < type |
11750 | 169 |
|
170 |
global |
|
171 |
||
172 |
consts |
|
173 |
"0" :: "'a::zero" ("0") |
|
174 |
"1" :: "'a::one" ("1") |
|
175 |
"+" :: "['a::plus, 'a] => 'a" (infixl 65) |
|
176 |
- :: "['a::minus, 'a] => 'a" (infixl 65) |
|
177 |
uminus :: "['a::minus] => 'a" ("- _" [81] 80) |
|
178 |
* :: "['a::times, 'a] => 'a" (infixl 70) |
|
179 |
||
13456
42601eb7553f
special syntax for index "1" (plain numeral hidden by "1" symbol in HOL);
wenzelm
parents:
13438
diff
changeset
|
180 |
syntax |
42601eb7553f
special syntax for index "1" (plain numeral hidden by "1" symbol in HOL);
wenzelm
parents:
13438
diff
changeset
|
181 |
"_index1" :: index ("\<^sub>1") |
42601eb7553f
special syntax for index "1" (plain numeral hidden by "1" symbol in HOL);
wenzelm
parents:
13438
diff
changeset
|
182 |
translations |
14690 | 183 |
(index) "\<^sub>1" => (index) "\<^bsub>\<struct>\<^esub>" |
13456
42601eb7553f
special syntax for index "1" (plain numeral hidden by "1" symbol in HOL);
wenzelm
parents:
13438
diff
changeset
|
184 |
|
11750 | 185 |
local |
186 |
||
187 |
typed_print_translation {* |
|
188 |
let |
|
189 |
fun tr' c = (c, fn show_sorts => fn T => fn ts => |
|
190 |
if T = dummyT orelse not (! show_types) andalso can Term.dest_Type T then raise Match |
|
191 |
else Syntax.const Syntax.constrainC $ Syntax.const c $ Syntax.term_of_typ show_sorts T); |
|
192 |
in [tr' "0", tr' "1"] end; |
|
193 |
*} -- {* show types that are presumably too general *} |
|
194 |
||
195 |
||
196 |
consts |
|
197 |
abs :: "'a::minus => 'a" |
|
198 |
inverse :: "'a::inverse => 'a" |
|
199 |
divide :: "['a::inverse, 'a] => 'a" (infixl "'/" 70) |
|
200 |
||
201 |
syntax (xsymbols) |
|
202 |
abs :: "'a::minus => 'a" ("\<bar>_\<bar>") |
|
203 |
syntax (HTML output) |
|
204 |
abs :: "'a::minus => 'a" ("\<bar>_\<bar>") |
|
205 |
||
206 |
||
207 |
subsection {* Theory and package setup *} |
|
208 |
||
209 |
subsubsection {* Basic lemmas *} |
|
4868 | 210 |
|
9736 | 211 |
use "HOL_lemmas.ML" |
11687 | 212 |
theorems case_split = case_split_thm [case_names True False] |
9869 | 213 |
|
12386 | 214 |
|
215 |
subsubsection {* Intuitionistic Reasoning *} |
|
216 |
||
217 |
lemma impE': |
|
12937
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
218 |
assumes 1: "P --> Q" |
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
219 |
and 2: "Q ==> R" |
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
220 |
and 3: "P --> Q ==> P" |
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
221 |
shows R |
12386 | 222 |
proof - |
223 |
from 3 and 1 have P . |
|
224 |
with 1 have Q by (rule impE) |
|
225 |
with 2 show R . |
|
226 |
qed |
|
227 |
||
228 |
lemma allE': |
|
12937
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
229 |
assumes 1: "ALL x. P x" |
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
230 |
and 2: "P x ==> ALL x. P x ==> Q" |
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
231 |
shows Q |
12386 | 232 |
proof - |
233 |
from 1 have "P x" by (rule spec) |
|
234 |
from this and 1 show Q by (rule 2) |
|
235 |
qed |
|
236 |
||
12937
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
237 |
lemma notE': |
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
238 |
assumes 1: "~ P" |
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
239 |
and 2: "~ P ==> P" |
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
240 |
shows R |
12386 | 241 |
proof - |
242 |
from 2 and 1 have P . |
|
243 |
with 1 show R by (rule notE) |
|
244 |
qed |
|
245 |
||
246 |
lemmas [CPure.elim!] = disjE iffE FalseE conjE exE |
|
247 |
and [CPure.intro!] = iffI conjI impI TrueI notI allI refl |
|
248 |
and [CPure.elim 2] = allE notE' impE' |
|
249 |
and [CPure.intro] = exI disjI2 disjI1 |
|
250 |
||
251 |
lemmas [trans] = trans |
|
252 |
and [sym] = sym not_sym |
|
253 |
and [CPure.elim?] = iffD1 iffD2 impE |
|
11750 | 254 |
|
11438
3d9222b80989
declare trans [trans] (*overridden in theory Calculation*);
wenzelm
parents:
11432
diff
changeset
|
255 |
|
11750 | 256 |
subsubsection {* Atomizing meta-level connectives *} |
257 |
||
258 |
lemma atomize_all [atomize]: "(!!x. P x) == Trueprop (ALL x. P x)" |
|
12003 | 259 |
proof |
9488 | 260 |
assume "!!x. P x" |
10383 | 261 |
show "ALL x. P x" by (rule allI) |
9488 | 262 |
next |
263 |
assume "ALL x. P x" |
|
10383 | 264 |
thus "!!x. P x" by (rule allE) |
9488 | 265 |
qed |
266 |
||
11750 | 267 |
lemma atomize_imp [atomize]: "(A ==> B) == Trueprop (A --> B)" |
12003 | 268 |
proof |
9488 | 269 |
assume r: "A ==> B" |
10383 | 270 |
show "A --> B" by (rule impI) (rule r) |
9488 | 271 |
next |
272 |
assume "A --> B" and A |
|
10383 | 273 |
thus B by (rule mp) |
9488 | 274 |
qed |
275 |
||
14749 | 276 |
lemma atomize_not: "(A ==> False) == Trueprop (~A)" |
277 |
proof |
|
278 |
assume r: "A ==> False" |
|
279 |
show "~A" by (rule notI) (rule r) |
|
280 |
next |
|
281 |
assume "~A" and A |
|
282 |
thus False by (rule notE) |
|
283 |
qed |
|
284 |
||
11750 | 285 |
lemma atomize_eq [atomize]: "(x == y) == Trueprop (x = y)" |
12003 | 286 |
proof |
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
287 |
assume "x == y" |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
288 |
show "x = y" by (unfold prems) (rule refl) |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
289 |
next |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
290 |
assume "x = y" |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
291 |
thus "x == y" by (rule eq_reflection) |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
292 |
qed |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
293 |
|
12023 | 294 |
lemma atomize_conj [atomize]: |
295 |
"(!!C. (A ==> B ==> PROP C) ==> PROP C) == Trueprop (A & B)" |
|
12003 | 296 |
proof |
11953 | 297 |
assume "!!C. (A ==> B ==> PROP C) ==> PROP C" |
298 |
show "A & B" by (rule conjI) |
|
299 |
next |
|
300 |
fix C |
|
301 |
assume "A & B" |
|
302 |
assume "A ==> B ==> PROP C" |
|
303 |
thus "PROP C" |
|
304 |
proof this |
|
305 |
show A by (rule conjunct1) |
|
306 |
show B by (rule conjunct2) |
|
307 |
qed |
|
308 |
qed |
|
309 |
||
12386 | 310 |
lemmas [symmetric, rulify] = atomize_all atomize_imp |
311 |
||
11750 | 312 |
|
313 |
subsubsection {* Classical Reasoner setup *} |
|
9529 | 314 |
|
10383 | 315 |
use "cladata.ML" |
316 |
setup hypsubst_setup |
|
11977 | 317 |
|
12386 | 318 |
ML_setup {* |
319 |
Context.>> (ContextRules.addSWrapper (fn tac => hyp_subst_tac' ORELSE' tac)); |
|
320 |
*} |
|
11977 | 321 |
|
10383 | 322 |
setup Classical.setup |
323 |
setup clasetup |
|
324 |
||
12386 | 325 |
lemmas [intro?] = ext |
326 |
and [elim?] = ex1_implies_ex |
|
11977 | 327 |
|
9869 | 328 |
use "blastdata.ML" |
329 |
setup Blast.setup |
|
4868 | 330 |
|
11750 | 331 |
|
332 |
subsubsection {* Simplifier setup *} |
|
333 |
||
12281 | 334 |
lemma meta_eq_to_obj_eq: "x == y ==> x = y" |
335 |
proof - |
|
336 |
assume r: "x == y" |
|
337 |
show "x = y" by (unfold r) (rule refl) |
|
338 |
qed |
|
339 |
||
340 |
lemma eta_contract_eq: "(%s. f s) = f" .. |
|
341 |
||
342 |
lemma simp_thms: |
|
12937
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
343 |
shows not_not: "(~ ~ P) = P" |
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
344 |
and |
12436
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
345 |
"(P ~= Q) = (P = (~Q))" |
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
346 |
"(P | ~P) = True" "(~P | P) = True" |
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
347 |
"((~P) = (~Q)) = (P=Q)" |
12281 | 348 |
"(x = x) = True" |
349 |
"(~True) = False" "(~False) = True" |
|
12436
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
350 |
"(~P) ~= P" "P ~= (~P)" |
12281 | 351 |
"(True=P) = P" "(P=True) = P" "(False=P) = (~P)" "(P=False) = (~P)" |
352 |
"(True --> P) = P" "(False --> P) = True" |
|
353 |
"(P --> True) = True" "(P --> P) = True" |
|
354 |
"(P --> False) = (~P)" "(P --> ~P) = (~P)" |
|
355 |
"(P & True) = P" "(True & P) = P" |
|
356 |
"(P & False) = False" "(False & P) = False" |
|
357 |
"(P & P) = P" "(P & (P & Q)) = (P & Q)" |
|
358 |
"(P & ~P) = False" "(~P & P) = False" |
|
359 |
"(P | True) = True" "(True | P) = True" |
|
360 |
"(P | False) = P" "(False | P) = P" |
|
12436
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
361 |
"(P | P) = P" "(P | (P | Q)) = (P | Q)" and |
12281 | 362 |
"(ALL x. P) = P" "(EX x. P) = P" "EX x. x=t" "EX x. t=x" |
363 |
-- {* needed for the one-point-rule quantifier simplification procs *} |
|
364 |
-- {* essential for termination!! *} and |
|
365 |
"!!P. (EX x. x=t & P(x)) = P(t)" |
|
366 |
"!!P. (EX x. t=x & P(x)) = P(t)" |
|
367 |
"!!P. (ALL x. x=t --> P(x)) = P(t)" |
|
12937
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
368 |
"!!P. (ALL x. t=x --> P(x)) = P(t)" |
12436
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
369 |
by (blast, blast, blast, blast, blast, rules+) |
13421 | 370 |
|
12281 | 371 |
lemma imp_cong: "(P = P') ==> (P' ==> (Q = Q')) ==> ((P --> Q) = (P' --> Q'))" |
12354 | 372 |
by rules |
12281 | 373 |
|
374 |
lemma ex_simps: |
|
375 |
"!!P Q. (EX x. P x & Q) = ((EX x. P x) & Q)" |
|
376 |
"!!P Q. (EX x. P & Q x) = (P & (EX x. Q x))" |
|
377 |
"!!P Q. (EX x. P x | Q) = ((EX x. P x) | Q)" |
|
378 |
"!!P Q. (EX x. P | Q x) = (P | (EX x. Q x))" |
|
379 |
"!!P Q. (EX x. P x --> Q) = ((ALL x. P x) --> Q)" |
|
380 |
"!!P Q. (EX x. P --> Q x) = (P --> (EX x. Q x))" |
|
381 |
-- {* Miniscoping: pushing in existential quantifiers. *} |
|
12436
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
382 |
by (rules | blast)+ |
12281 | 383 |
|
384 |
lemma all_simps: |
|
385 |
"!!P Q. (ALL x. P x & Q) = ((ALL x. P x) & Q)" |
|
386 |
"!!P Q. (ALL x. P & Q x) = (P & (ALL x. Q x))" |
|
387 |
"!!P Q. (ALL x. P x | Q) = ((ALL x. P x) | Q)" |
|
388 |
"!!P Q. (ALL x. P | Q x) = (P | (ALL x. Q x))" |
|
389 |
"!!P Q. (ALL x. P x --> Q) = ((EX x. P x) --> Q)" |
|
390 |
"!!P Q. (ALL x. P --> Q x) = (P --> (ALL x. Q x))" |
|
391 |
-- {* Miniscoping: pushing in universal quantifiers. *} |
|
12436
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
392 |
by (rules | blast)+ |
12281 | 393 |
|
14201 | 394 |
lemma disj_absorb: "(A | A) = A" |
395 |
by blast |
|
396 |
||
397 |
lemma disj_left_absorb: "(A | (A | B)) = (A | B)" |
|
398 |
by blast |
|
399 |
||
400 |
lemma conj_absorb: "(A & A) = A" |
|
401 |
by blast |
|
402 |
||
403 |
lemma conj_left_absorb: "(A & (A & B)) = (A & B)" |
|
404 |
by blast |
|
405 |
||
12281 | 406 |
lemma eq_ac: |
12937
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
407 |
shows eq_commute: "(a=b) = (b=a)" |
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
408 |
and eq_left_commute: "(P=(Q=R)) = (Q=(P=R))" |
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
409 |
and eq_assoc: "((P=Q)=R) = (P=(Q=R))" by (rules, blast+) |
12436
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
410 |
lemma neq_commute: "(a~=b) = (b~=a)" by rules |
12281 | 411 |
|
412 |
lemma conj_comms: |
|
12937
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
413 |
shows conj_commute: "(P&Q) = (Q&P)" |
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
414 |
and conj_left_commute: "(P&(Q&R)) = (Q&(P&R))" by rules+ |
12436
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
415 |
lemma conj_assoc: "((P&Q)&R) = (P&(Q&R))" by rules |
12281 | 416 |
|
417 |
lemma disj_comms: |
|
12937
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
418 |
shows disj_commute: "(P|Q) = (Q|P)" |
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
419 |
and disj_left_commute: "(P|(Q|R)) = (Q|(P|R))" by rules+ |
12436
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
420 |
lemma disj_assoc: "((P|Q)|R) = (P|(Q|R))" by rules |
12281 | 421 |
|
12436
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
422 |
lemma conj_disj_distribL: "(P&(Q|R)) = (P&Q | P&R)" by rules |
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
423 |
lemma conj_disj_distribR: "((P|Q)&R) = (P&R | Q&R)" by rules |
12281 | 424 |
|
12436
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
425 |
lemma disj_conj_distribL: "(P|(Q&R)) = ((P|Q) & (P|R))" by rules |
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
426 |
lemma disj_conj_distribR: "((P&Q)|R) = ((P|R) & (Q|R))" by rules |
12281 | 427 |
|
12436
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
428 |
lemma imp_conjR: "(P --> (Q&R)) = ((P-->Q) & (P-->R))" by rules |
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
429 |
lemma imp_conjL: "((P&Q) -->R) = (P --> (Q --> R))" by rules |
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
430 |
lemma imp_disjL: "((P|Q) --> R) = ((P-->R)&(Q-->R))" by rules |
12281 | 431 |
|
432 |
text {* These two are specialized, but @{text imp_disj_not1} is useful in @{text "Auth/Yahalom"}. *} |
|
433 |
lemma imp_disj_not1: "(P --> Q | R) = (~Q --> P --> R)" by blast |
|
434 |
lemma imp_disj_not2: "(P --> Q | R) = (~R --> P --> Q)" by blast |
|
435 |
||
436 |
lemma imp_disj1: "((P-->Q)|R) = (P--> Q|R)" by blast |
|
437 |
lemma imp_disj2: "(Q|(P-->R)) = (P--> Q|R)" by blast |
|
438 |
||
12436
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
439 |
lemma de_Morgan_disj: "(~(P | Q)) = (~P & ~Q)" by rules |
12281 | 440 |
lemma de_Morgan_conj: "(~(P & Q)) = (~P | ~Q)" by blast |
441 |
lemma not_imp: "(~(P --> Q)) = (P & ~Q)" by blast |
|
442 |
lemma not_iff: "(P~=Q) = (P = (~Q))" by blast |
|
443 |
lemma disj_not1: "(~P | Q) = (P --> Q)" by blast |
|
444 |
lemma disj_not2: "(P | ~Q) = (Q --> P)" -- {* changes orientation :-( *} |
|
445 |
by blast |
|
446 |
lemma imp_conv_disj: "(P --> Q) = ((~P) | Q)" by blast |
|
447 |
||
12436
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
448 |
lemma iff_conv_conj_imp: "(P = Q) = ((P --> Q) & (Q --> P))" by rules |
12281 | 449 |
|
450 |
||
451 |
lemma cases_simp: "((P --> Q) & (~P --> Q)) = Q" |
|
452 |
-- {* Avoids duplication of subgoals after @{text split_if}, when the true and false *} |
|
453 |
-- {* cases boil down to the same thing. *} |
|
454 |
by blast |
|
455 |
||
456 |
lemma not_all: "(~ (! x. P(x))) = (? x.~P(x))" by blast |
|
457 |
lemma imp_all: "((! x. P x) --> Q) = (? x. P x --> Q)" by blast |
|
12436
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
458 |
lemma not_ex: "(~ (? x. P(x))) = (! x.~P(x))" by rules |
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
459 |
lemma imp_ex: "((? x. P x) --> Q) = (! x. P x --> Q)" by rules |
12281 | 460 |
|
12436
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
461 |
lemma ex_disj_distrib: "(? x. P(x) | Q(x)) = ((? x. P(x)) | (? x. Q(x)))" by rules |
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
462 |
lemma all_conj_distrib: "(!x. P(x) & Q(x)) = ((! x. P(x)) & (! x. Q(x)))" by rules |
12281 | 463 |
|
464 |
text {* |
|
465 |
\medskip The @{text "&"} congruence rule: not included by default! |
|
466 |
May slow rewrite proofs down by as much as 50\% *} |
|
467 |
||
468 |
lemma conj_cong: |
|
469 |
"(P = P') ==> (P' ==> (Q = Q')) ==> ((P & Q) = (P' & Q'))" |
|
12354 | 470 |
by rules |
12281 | 471 |
|
472 |
lemma rev_conj_cong: |
|
473 |
"(Q = Q') ==> (Q' ==> (P = P')) ==> ((P & Q) = (P' & Q'))" |
|
12354 | 474 |
by rules |
12281 | 475 |
|
476 |
text {* The @{text "|"} congruence rule: not included by default! *} |
|
477 |
||
478 |
lemma disj_cong: |
|
479 |
"(P = P') ==> (~P' ==> (Q = Q')) ==> ((P | Q) = (P' | Q'))" |
|
480 |
by blast |
|
481 |
||
482 |
lemma eq_sym_conv: "(x = y) = (y = x)" |
|
12354 | 483 |
by rules |
12281 | 484 |
|
485 |
||
486 |
text {* \medskip if-then-else rules *} |
|
487 |
||
488 |
lemma if_True: "(if True then x else y) = x" |
|
489 |
by (unfold if_def) blast |
|
490 |
||
491 |
lemma if_False: "(if False then x else y) = y" |
|
492 |
by (unfold if_def) blast |
|
493 |
||
494 |
lemma if_P: "P ==> (if P then x else y) = x" |
|
495 |
by (unfold if_def) blast |
|
496 |
||
497 |
lemma if_not_P: "~P ==> (if P then x else y) = y" |
|
498 |
by (unfold if_def) blast |
|
499 |
||
500 |
lemma split_if: "P (if Q then x else y) = ((Q --> P(x)) & (~Q --> P(y)))" |
|
501 |
apply (rule case_split [of Q]) |
|
502 |
apply (subst if_P) |
|
14208 | 503 |
prefer 3 apply (subst if_not_P, blast+) |
12281 | 504 |
done |
505 |
||
506 |
lemma split_if_asm: "P (if Q then x else y) = (~((Q & ~P x) | (~Q & ~P y)))" |
|
14208 | 507 |
by (subst split_if, blast) |
12281 | 508 |
|
509 |
lemmas if_splits = split_if split_if_asm |
|
510 |
||
511 |
lemma if_def2: "(if Q then x else y) = ((Q --> x) & (~ Q --> y))" |
|
512 |
by (rule split_if) |
|
513 |
||
514 |
lemma if_cancel: "(if c then x else x) = x" |
|
14208 | 515 |
by (subst split_if, blast) |
12281 | 516 |
|
517 |
lemma if_eq_cancel: "(if x = y then y else x) = x" |
|
14208 | 518 |
by (subst split_if, blast) |
12281 | 519 |
|
520 |
lemma if_bool_eq_conj: "(if P then Q else R) = ((P-->Q) & (~P-->R))" |
|
521 |
-- {* This form is useful for expanding @{text if}s on the RIGHT of the @{text "==>"} symbol. *} |
|
522 |
by (rule split_if) |
|
523 |
||
524 |
lemma if_bool_eq_disj: "(if P then Q else R) = ((P&Q) | (~P&R))" |
|
525 |
-- {* And this form is useful for expanding @{text if}s on the LEFT. *} |
|
14208 | 526 |
apply (subst split_if, blast) |
12281 | 527 |
done |
528 |
||
12436
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
529 |
lemma Eq_TrueI: "P ==> P == True" by (unfold atomize_eq) rules |
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
530 |
lemma Eq_FalseI: "~P ==> P == False" by (unfold atomize_eq) rules |
12281 | 531 |
|
14201 | 532 |
subsubsection {* Actual Installation of the Simplifier *} |
533 |
||
9869 | 534 |
use "simpdata.ML" |
535 |
setup Simplifier.setup |
|
536 |
setup "Simplifier.method_setup Splitter.split_modifiers" setup simpsetup |
|
537 |
setup Splitter.setup setup Clasimp.setup |
|
538 |
||
14201 | 539 |
declare disj_absorb [simp] conj_absorb [simp] |
540 |
||
13723 | 541 |
lemma ex1_eq[iff]: "EX! x. x = t" "EX! x. t = x" |
542 |
by blast+ |
|
543 |
||
13638 | 544 |
theorem choice_eq: "(ALL x. EX! y. P x y) = (EX! f. ALL x. P x (f x))" |
545 |
apply (rule iffI) |
|
546 |
apply (rule_tac a = "%x. THE y. P x y" in ex1I) |
|
547 |
apply (fast dest!: theI') |
|
548 |
apply (fast intro: ext the1_equality [symmetric]) |
|
549 |
apply (erule ex1E) |
|
550 |
apply (rule allI) |
|
551 |
apply (rule ex1I) |
|
552 |
apply (erule spec) |
|
553 |
apply (erule_tac x = "%z. if z = x then y else f z" in allE) |
|
554 |
apply (erule impE) |
|
555 |
apply (rule allI) |
|
556 |
apply (rule_tac P = "xa = x" in case_split_thm) |
|
14208 | 557 |
apply (drule_tac [3] x = x in fun_cong, simp_all) |
13638 | 558 |
done |
559 |
||
13438
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
560 |
text{*Needs only HOL-lemmas:*} |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
561 |
lemma mk_left_commute: |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
562 |
assumes a: "\<And>x y z. f (f x y) z = f x (f y z)" and |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
563 |
c: "\<And>x y. f x y = f y x" |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
564 |
shows "f x (f y z) = f y (f x z)" |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
565 |
by(rule trans[OF trans[OF c a] arg_cong[OF c, of "f y"]]) |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
566 |
|
11750 | 567 |
|
11824
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
568 |
subsubsection {* Generic cases and induction *} |
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
569 |
|
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
570 |
constdefs |
11989 | 571 |
induct_forall :: "('a => bool) => bool" |
572 |
"induct_forall P == \<forall>x. P x" |
|
573 |
induct_implies :: "bool => bool => bool" |
|
574 |
"induct_implies A B == A --> B" |
|
575 |
induct_equal :: "'a => 'a => bool" |
|
576 |
"induct_equal x y == x = y" |
|
577 |
induct_conj :: "bool => bool => bool" |
|
578 |
"induct_conj A B == A & B" |
|
11824
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
579 |
|
11989 | 580 |
lemma induct_forall_eq: "(!!x. P x) == Trueprop (induct_forall (\<lambda>x. P x))" |
581 |
by (simp only: atomize_all induct_forall_def) |
|
11824
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
582 |
|
11989 | 583 |
lemma induct_implies_eq: "(A ==> B) == Trueprop (induct_implies A B)" |
584 |
by (simp only: atomize_imp induct_implies_def) |
|
11824
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
585 |
|
11989 | 586 |
lemma induct_equal_eq: "(x == y) == Trueprop (induct_equal x y)" |
587 |
by (simp only: atomize_eq induct_equal_def) |
|
11824
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
588 |
|
11989 | 589 |
lemma induct_forall_conj: "induct_forall (\<lambda>x. induct_conj (A x) (B x)) = |
590 |
induct_conj (induct_forall A) (induct_forall B)" |
|
12354 | 591 |
by (unfold induct_forall_def induct_conj_def) rules |
11824
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
592 |
|
11989 | 593 |
lemma induct_implies_conj: "induct_implies C (induct_conj A B) = |
594 |
induct_conj (induct_implies C A) (induct_implies C B)" |
|
12354 | 595 |
by (unfold induct_implies_def induct_conj_def) rules |
11989 | 596 |
|
13598
8bc77b17f59f
Fixed problem with induct_conj_curry: variable C should have type prop.
berghofe
parents:
13596
diff
changeset
|
597 |
lemma induct_conj_curry: "(induct_conj A B ==> PROP C) == (A ==> B ==> PROP C)" |
8bc77b17f59f
Fixed problem with induct_conj_curry: variable C should have type prop.
berghofe
parents:
13596
diff
changeset
|
598 |
proof |
8bc77b17f59f
Fixed problem with induct_conj_curry: variable C should have type prop.
berghofe
parents:
13596
diff
changeset
|
599 |
assume r: "induct_conj A B ==> PROP C" and A B |
8bc77b17f59f
Fixed problem with induct_conj_curry: variable C should have type prop.
berghofe
parents:
13596
diff
changeset
|
600 |
show "PROP C" by (rule r) (simp! add: induct_conj_def) |
8bc77b17f59f
Fixed problem with induct_conj_curry: variable C should have type prop.
berghofe
parents:
13596
diff
changeset
|
601 |
next |
8bc77b17f59f
Fixed problem with induct_conj_curry: variable C should have type prop.
berghofe
parents:
13596
diff
changeset
|
602 |
assume r: "A ==> B ==> PROP C" and "induct_conj A B" |
8bc77b17f59f
Fixed problem with induct_conj_curry: variable C should have type prop.
berghofe
parents:
13596
diff
changeset
|
603 |
show "PROP C" by (rule r) (simp! add: induct_conj_def)+ |
8bc77b17f59f
Fixed problem with induct_conj_curry: variable C should have type prop.
berghofe
parents:
13596
diff
changeset
|
604 |
qed |
11824
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
605 |
|
11989 | 606 |
lemma induct_impliesI: "(A ==> B) ==> induct_implies A B" |
607 |
by (simp add: induct_implies_def) |
|
11824
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
608 |
|
12161 | 609 |
lemmas induct_atomize = atomize_conj induct_forall_eq induct_implies_eq induct_equal_eq |
610 |
lemmas induct_rulify1 [symmetric, standard] = induct_forall_eq induct_implies_eq induct_equal_eq |
|
611 |
lemmas induct_rulify2 = induct_forall_def induct_implies_def induct_equal_def induct_conj_def |
|
11989 | 612 |
lemmas induct_conj = induct_forall_conj induct_implies_conj induct_conj_curry |
11824
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
613 |
|
11989 | 614 |
hide const induct_forall induct_implies induct_equal induct_conj |
11824
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
615 |
|
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
616 |
|
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
617 |
text {* Method setup. *} |
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
618 |
|
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
619 |
ML {* |
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
620 |
structure InductMethod = InductMethodFun |
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
621 |
(struct |
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
622 |
val dest_concls = HOLogic.dest_concls; |
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
623 |
val cases_default = thm "case_split"; |
11989 | 624 |
val local_impI = thm "induct_impliesI"; |
11824
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
625 |
val conjI = thm "conjI"; |
11989 | 626 |
val atomize = thms "induct_atomize"; |
627 |
val rulify1 = thms "induct_rulify1"; |
|
628 |
val rulify2 = thms "induct_rulify2"; |
|
12240 | 629 |
val localize = [Thm.symmetric (thm "induct_implies_def")]; |
11824
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
630 |
end); |
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
631 |
*} |
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
632 |
|
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
633 |
setup InductMethod.setup |
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
634 |
|
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
635 |
|
11750 | 636 |
subsection {* Order signatures and orders *} |
637 |
||
638 |
axclass |
|
12338
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
12281
diff
changeset
|
639 |
ord < type |
11750 | 640 |
|
641 |
syntax |
|
642 |
"op <" :: "['a::ord, 'a] => bool" ("op <") |
|
643 |
"op <=" :: "['a::ord, 'a] => bool" ("op <=") |
|
644 |
||
645 |
global |
|
646 |
||
647 |
consts |
|
648 |
"op <" :: "['a::ord, 'a] => bool" ("(_/ < _)" [50, 51] 50) |
|
649 |
"op <=" :: "['a::ord, 'a] => bool" ("(_/ <= _)" [50, 51] 50) |
|
650 |
||
651 |
local |
|
652 |
||
12114
a8e860c86252
eliminated old "symbols" syntax, use "xsymbols" instead;
wenzelm
parents:
12023
diff
changeset
|
653 |
syntax (xsymbols) |
11750 | 654 |
"op <=" :: "['a::ord, 'a] => bool" ("op \<le>") |
655 |
"op <=" :: "['a::ord, 'a] => bool" ("(_/ \<le> _)" [50, 51] 50) |
|
656 |
||
14565 | 657 |
syntax (HTML output) |
658 |
"op <=" :: "['a::ord, 'a] => bool" ("op \<le>") |
|
659 |
"op <=" :: "['a::ord, 'a] => bool" ("(_/ \<le> _)" [50, 51] 50) |
|
660 |
||
11750 | 661 |
|
14295 | 662 |
lemma Not_eq_iff: "((~P) = (~Q)) = (P = Q)" |
663 |
by blast |
|
664 |
||
11750 | 665 |
subsubsection {* Monotonicity *} |
666 |
||
13412 | 667 |
locale mono = |
668 |
fixes f |
|
669 |
assumes mono: "A <= B ==> f A <= f B" |
|
11750 | 670 |
|
13421 | 671 |
lemmas monoI [intro?] = mono.intro |
13412 | 672 |
and monoD [dest?] = mono.mono |
11750 | 673 |
|
674 |
constdefs |
|
675 |
min :: "['a::ord, 'a] => 'a" |
|
676 |
"min a b == (if a <= b then a else b)" |
|
677 |
max :: "['a::ord, 'a] => 'a" |
|
678 |
"max a b == (if a <= b then b else a)" |
|
679 |
||
680 |
lemma min_leastL: "(!!x. least <= x) ==> min least x = least" |
|
681 |
by (simp add: min_def) |
|
682 |
||
683 |
lemma min_of_mono: |
|
684 |
"ALL x y. (f x <= f y) = (x <= y) ==> min (f m) (f n) = f (min m n)" |
|
685 |
by (simp add: min_def) |
|
686 |
||
687 |
lemma max_leastL: "(!!x. least <= x) ==> max least x = x" |
|
688 |
by (simp add: max_def) |
|
689 |
||
690 |
lemma max_of_mono: |
|
691 |
"ALL x y. (f x <= f y) = (x <= y) ==> max (f m) (f n) = f (max m n)" |
|
692 |
by (simp add: max_def) |
|
693 |
||
694 |
||
695 |
subsubsection "Orders" |
|
696 |
||
697 |
axclass order < ord |
|
698 |
order_refl [iff]: "x <= x" |
|
699 |
order_trans: "x <= y ==> y <= z ==> x <= z" |
|
700 |
order_antisym: "x <= y ==> y <= x ==> x = y" |
|
701 |
order_less_le: "(x < y) = (x <= y & x ~= y)" |
|
702 |
||
703 |
||
704 |
text {* Reflexivity. *} |
|
705 |
||
706 |
lemma order_eq_refl: "!!x::'a::order. x = y ==> x <= y" |
|
707 |
-- {* This form is useful with the classical reasoner. *} |
|
708 |
apply (erule ssubst) |
|
709 |
apply (rule order_refl) |
|
710 |
done |
|
711 |
||
13553 | 712 |
lemma order_less_irrefl [iff]: "~ x < (x::'a::order)" |
11750 | 713 |
by (simp add: order_less_le) |
714 |
||
715 |
lemma order_le_less: "((x::'a::order) <= y) = (x < y | x = y)" |
|
716 |
-- {* NOT suitable for iff, since it can cause PROOF FAILED. *} |
|
14208 | 717 |
apply (simp add: order_less_le, blast) |
11750 | 718 |
done |
719 |
||
720 |
lemmas order_le_imp_less_or_eq = order_le_less [THEN iffD1, standard] |
|
721 |
||
722 |
lemma order_less_imp_le: "!!x::'a::order. x < y ==> x <= y" |
|
723 |
by (simp add: order_less_le) |
|
724 |
||
725 |
||
726 |
text {* Asymmetry. *} |
|
727 |
||
728 |
lemma order_less_not_sym: "(x::'a::order) < y ==> ~ (y < x)" |
|
729 |
by (simp add: order_less_le order_antisym) |
|
730 |
||
731 |
lemma order_less_asym: "x < (y::'a::order) ==> (~P ==> y < x) ==> P" |
|
732 |
apply (drule order_less_not_sym) |
|
14208 | 733 |
apply (erule contrapos_np, simp) |
11750 | 734 |
done |
735 |
||
14295 | 736 |
lemma order_eq_iff: "!!x::'a::order. (x = y) = (x \<le> y & y \<le> x)" |
737 |
by (blast intro: order_antisym) |
|
738 |
||
11750 | 739 |
|
740 |
text {* Transitivity. *} |
|
741 |
||
742 |
lemma order_less_trans: "!!x::'a::order. [| x < y; y < z |] ==> x < z" |
|
743 |
apply (simp add: order_less_le) |
|
744 |
apply (blast intro: order_trans order_antisym) |
|
745 |
done |
|
746 |
||
747 |
lemma order_le_less_trans: "!!x::'a::order. [| x <= y; y < z |] ==> x < z" |
|
748 |
apply (simp add: order_less_le) |
|
749 |
apply (blast intro: order_trans order_antisym) |
|
750 |
done |
|
751 |
||
752 |
lemma order_less_le_trans: "!!x::'a::order. [| x < y; y <= z |] ==> x < z" |
|
753 |
apply (simp add: order_less_le) |
|
754 |
apply (blast intro: order_trans order_antisym) |
|
755 |
done |
|
756 |
||
757 |
||
758 |
text {* Useful for simplification, but too risky to include by default. *} |
|
759 |
||
760 |
lemma order_less_imp_not_less: "(x::'a::order) < y ==> (~ y < x) = True" |
|
761 |
by (blast elim: order_less_asym) |
|
762 |
||
763 |
lemma order_less_imp_triv: "(x::'a::order) < y ==> (y < x --> P) = True" |
|
764 |
by (blast elim: order_less_asym) |
|
765 |
||
766 |
lemma order_less_imp_not_eq: "(x::'a::order) < y ==> (x = y) = False" |
|
767 |
by auto |
|
768 |
||
769 |
lemma order_less_imp_not_eq2: "(x::'a::order) < y ==> (y = x) = False" |
|
770 |
by auto |
|
771 |
||
772 |
||
773 |
text {* Other operators. *} |
|
774 |
||
775 |
lemma min_leastR: "(!!x::'a::order. least <= x) ==> min x least = least" |
|
776 |
apply (simp add: min_def) |
|
777 |
apply (blast intro: order_antisym) |
|
778 |
done |
|
779 |
||
780 |
lemma max_leastR: "(!!x::'a::order. least <= x) ==> max x least = x" |
|
781 |
apply (simp add: max_def) |
|
782 |
apply (blast intro: order_antisym) |
|
783 |
done |
|
784 |
||
785 |
||
786 |
subsubsection {* Least value operator *} |
|
787 |
||
788 |
constdefs |
|
789 |
Least :: "('a::ord => bool) => 'a" (binder "LEAST " 10) |
|
790 |
"Least P == THE x. P x & (ALL y. P y --> x <= y)" |
|
791 |
-- {* We can no longer use LeastM because the latter requires Hilbert-AC. *} |
|
792 |
||
793 |
lemma LeastI2: |
|
794 |
"[| P (x::'a::order); |
|
795 |
!!y. P y ==> x <= y; |
|
796 |
!!x. [| P x; ALL y. P y --> x \<le> y |] ==> Q x |] |
|
12281 | 797 |
==> Q (Least P)" |
11750 | 798 |
apply (unfold Least_def) |
799 |
apply (rule theI2) |
|
800 |
apply (blast intro: order_antisym)+ |
|
801 |
done |
|
802 |
||
803 |
lemma Least_equality: |
|
12281 | 804 |
"[| P (k::'a::order); !!x. P x ==> k <= x |] ==> (LEAST x. P x) = k" |
11750 | 805 |
apply (simp add: Least_def) |
806 |
apply (rule the_equality) |
|
807 |
apply (auto intro!: order_antisym) |
|
808 |
done |
|
809 |
||
810 |
||
811 |
subsubsection "Linear / total orders" |
|
812 |
||
813 |
axclass linorder < order |
|
814 |
linorder_linear: "x <= y | y <= x" |
|
815 |
||
816 |
lemma linorder_less_linear: "!!x::'a::linorder. x<y | x=y | y<x" |
|
817 |
apply (simp add: order_less_le) |
|
14208 | 818 |
apply (insert linorder_linear, blast) |
11750 | 819 |
done |
820 |
||
15079
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14981
diff
changeset
|
821 |
lemma linorder_le_less_linear: "!!x::'a::linorder. x\<le>y | y<x" |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14981
diff
changeset
|
822 |
by (simp add: order_le_less linorder_less_linear) |
2ef899e4526d
conversion of Hyperreal/MacLaurin_lemmas to Isar script
paulson
parents:
14981
diff
changeset
|
823 |
|
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14361
diff
changeset
|
824 |
lemma linorder_le_cases [case_names le ge]: |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14361
diff
changeset
|
825 |
"((x::'a::linorder) \<le> y ==> P) ==> (y \<le> x ==> P) ==> P" |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14361
diff
changeset
|
826 |
by (insert linorder_linear, blast) |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14361
diff
changeset
|
827 |
|
11750 | 828 |
lemma linorder_cases [case_names less equal greater]: |
829 |
"((x::'a::linorder) < y ==> P) ==> (x = y ==> P) ==> (y < x ==> P) ==> P" |
|
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14361
diff
changeset
|
830 |
by (insert linorder_less_linear, blast) |
11750 | 831 |
|
832 |
lemma linorder_not_less: "!!x::'a::linorder. (~ x < y) = (y <= x)" |
|
833 |
apply (simp add: order_less_le) |
|
834 |
apply (insert linorder_linear) |
|
835 |
apply (blast intro: order_antisym) |
|
836 |
done |
|
837 |
||
838 |
lemma linorder_not_le: "!!x::'a::linorder. (~ x <= y) = (y < x)" |
|
839 |
apply (simp add: order_less_le) |
|
840 |
apply (insert linorder_linear) |
|
841 |
apply (blast intro: order_antisym) |
|
842 |
done |
|
843 |
||
844 |
lemma linorder_neq_iff: "!!x::'a::linorder. (x ~= y) = (x<y | y<x)" |
|
14208 | 845 |
by (cut_tac x = x and y = y in linorder_less_linear, auto) |
11750 | 846 |
|
847 |
lemma linorder_neqE: "x ~= (y::'a::linorder) ==> (x < y ==> R) ==> (y < x ==> R) ==> R" |
|
14208 | 848 |
by (simp add: linorder_neq_iff, blast) |
11750 | 849 |
|
850 |
||
851 |
subsubsection "Min and max on (linear) orders" |
|
852 |
||
853 |
lemma min_same [simp]: "min (x::'a::order) x = x" |
|
854 |
by (simp add: min_def) |
|
855 |
||
856 |
lemma max_same [simp]: "max (x::'a::order) x = x" |
|
857 |
by (simp add: max_def) |
|
858 |
||
859 |
lemma le_max_iff_disj: "!!z::'a::linorder. (z <= max x y) = (z <= x | z <= y)" |
|
860 |
apply (simp add: max_def) |
|
861 |
apply (insert linorder_linear) |
|
862 |
apply (blast intro: order_trans) |
|
863 |
done |
|
864 |
||
865 |
lemma le_maxI1: "(x::'a::linorder) <= max x y" |
|
866 |
by (simp add: le_max_iff_disj) |
|
867 |
||
868 |
lemma le_maxI2: "(y::'a::linorder) <= max x y" |
|
869 |
-- {* CANNOT use with @{text "[intro!]"} because blast will give PROOF FAILED. *} |
|
870 |
by (simp add: le_max_iff_disj) |
|
871 |
||
872 |
lemma less_max_iff_disj: "!!z::'a::linorder. (z < max x y) = (z < x | z < y)" |
|
873 |
apply (simp add: max_def order_le_less) |
|
874 |
apply (insert linorder_less_linear) |
|
875 |
apply (blast intro: order_less_trans) |
|
876 |
done |
|
877 |
||
878 |
lemma max_le_iff_conj [simp]: |
|
879 |
"!!z::'a::linorder. (max x y <= z) = (x <= z & y <= z)" |
|
880 |
apply (simp add: max_def) |
|
881 |
apply (insert linorder_linear) |
|
882 |
apply (blast intro: order_trans) |
|
883 |
done |
|
884 |
||
885 |
lemma max_less_iff_conj [simp]: |
|
886 |
"!!z::'a::linorder. (max x y < z) = (x < z & y < z)" |
|
887 |
apply (simp add: order_le_less max_def) |
|
888 |
apply (insert linorder_less_linear) |
|
889 |
apply (blast intro: order_less_trans) |
|
890 |
done |
|
891 |
||
892 |
lemma le_min_iff_conj [simp]: |
|
893 |
"!!z::'a::linorder. (z <= min x y) = (z <= x & z <= y)" |
|
12892 | 894 |
-- {* @{text "[iff]"} screws up a @{text blast} in MiniML *} |
11750 | 895 |
apply (simp add: min_def) |
896 |
apply (insert linorder_linear) |
|
897 |
apply (blast intro: order_trans) |
|
898 |
done |
|
899 |
||
900 |
lemma min_less_iff_conj [simp]: |
|
901 |
"!!z::'a::linorder. (z < min x y) = (z < x & z < y)" |
|
902 |
apply (simp add: order_le_less min_def) |
|
903 |
apply (insert linorder_less_linear) |
|
904 |
apply (blast intro: order_less_trans) |
|
905 |
done |
|
906 |
||
907 |
lemma min_le_iff_disj: "!!z::'a::linorder. (min x y <= z) = (x <= z | y <= z)" |
|
908 |
apply (simp add: min_def) |
|
909 |
apply (insert linorder_linear) |
|
910 |
apply (blast intro: order_trans) |
|
911 |
done |
|
912 |
||
913 |
lemma min_less_iff_disj: "!!z::'a::linorder. (min x y < z) = (x < z | y < z)" |
|
914 |
apply (simp add: min_def order_le_less) |
|
915 |
apply (insert linorder_less_linear) |
|
916 |
apply (blast intro: order_less_trans) |
|
917 |
done |
|
918 |
||
13438
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
919 |
lemma max_assoc: "!!x::'a::linorder. max (max x y) z = max x (max y z)" |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
920 |
apply(simp add:max_def) |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
921 |
apply(rule conjI) |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
922 |
apply(blast intro:order_trans) |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
923 |
apply(simp add:linorder_not_le) |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
924 |
apply(blast dest: order_less_trans order_le_less_trans) |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
925 |
done |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
926 |
|
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
927 |
lemma max_commute: "!!x::'a::linorder. max x y = max y x" |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
928 |
apply(simp add:max_def) |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
929 |
apply(rule conjI) |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
930 |
apply(blast intro:order_antisym) |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
931 |
apply(simp add:linorder_not_le) |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
932 |
apply(blast dest: order_less_trans) |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
933 |
done |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
934 |
|
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
935 |
lemmas max_ac = max_assoc max_commute |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
936 |
mk_left_commute[of max,OF max_assoc max_commute] |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
937 |
|
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
938 |
lemma min_assoc: "!!x::'a::linorder. min (min x y) z = min x (min y z)" |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
939 |
apply(simp add:min_def) |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
940 |
apply(rule conjI) |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
941 |
apply(blast intro:order_trans) |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
942 |
apply(simp add:linorder_not_le) |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
943 |
apply(blast dest: order_less_trans order_le_less_trans) |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
944 |
done |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
945 |
|
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
946 |
lemma min_commute: "!!x::'a::linorder. min x y = min y x" |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
947 |
apply(simp add:min_def) |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
948 |
apply(rule conjI) |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
949 |
apply(blast intro:order_antisym) |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
950 |
apply(simp add:linorder_not_le) |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
951 |
apply(blast dest: order_less_trans) |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
952 |
done |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
953 |
|
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
954 |
lemmas min_ac = min_assoc min_commute |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
955 |
mk_left_commute[of min,OF min_assoc min_commute] |
527811f00c56
added mk_left_commute to HOL.thy and used it "everywhere"
nipkow
parents:
13421
diff
changeset
|
956 |
|
11750 | 957 |
lemma split_min: |
958 |
"P (min (i::'a::linorder) j) = ((i <= j --> P(i)) & (~ i <= j --> P(j)))" |
|
959 |
by (simp add: min_def) |
|
960 |
||
961 |
lemma split_max: |
|
962 |
"P (max (i::'a::linorder) j) = ((i <= j --> P(j)) & (~ i <= j --> P(i)))" |
|
963 |
by (simp add: max_def) |
|
964 |
||
965 |
||
14398
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
966 |
subsubsection {* Transitivity rules for calculational reasoning *} |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
967 |
|
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
968 |
|
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
969 |
lemma order_neq_le_trans: "a ~= b ==> (a::'a::order) <= b ==> a < b" |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
970 |
by (simp add: order_less_le) |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
971 |
|
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
972 |
lemma order_le_neq_trans: "(a::'a::order) <= b ==> a ~= b ==> a < b" |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
973 |
by (simp add: order_less_le) |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
974 |
|
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
975 |
lemma order_less_asym': "(a::'a::order) < b ==> b < a ==> P" |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
976 |
by (rule order_less_asym) |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
977 |
|
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
978 |
|
14444
24724afce166
Added documentation for transitivity solver setup.
ballarin
parents:
14430
diff
changeset
|
979 |
subsubsection {* Setup of transitivity reasoner as Solver *} |
14398
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
980 |
|
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
981 |
lemma less_imp_neq: "[| (x::'a::order) < y |] ==> x ~= y" |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
982 |
by (erule contrapos_pn, erule subst, rule order_less_irrefl) |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
983 |
|
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
984 |
lemma eq_neq_eq_imp_neq: "[| x = a ; a ~= b; b = y |] ==> x ~= y" |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
985 |
by (erule subst, erule ssubst, assumption) |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
986 |
|
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
987 |
ML_setup {* |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
988 |
|
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
989 |
structure Trans_Tac = Trans_Tac_Fun ( |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
990 |
struct |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
991 |
val less_reflE = thm "order_less_irrefl" RS thm "notE"; |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
992 |
val le_refl = thm "order_refl"; |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
993 |
val less_imp_le = thm "order_less_imp_le"; |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
994 |
val not_lessI = thm "linorder_not_less" RS thm "iffD2"; |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
995 |
val not_leI = thm "linorder_not_le" RS thm "iffD2"; |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
996 |
val not_lessD = thm "linorder_not_less" RS thm "iffD1"; |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
997 |
val not_leD = thm "linorder_not_le" RS thm "iffD1"; |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
998 |
val eqI = thm "order_antisym"; |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
999 |
val eqD1 = thm "order_eq_refl"; |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1000 |
val eqD2 = thm "sym" RS thm "order_eq_refl"; |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1001 |
val less_trans = thm "order_less_trans"; |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1002 |
val less_le_trans = thm "order_less_le_trans"; |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1003 |
val le_less_trans = thm "order_le_less_trans"; |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1004 |
val le_trans = thm "order_trans"; |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1005 |
val le_neq_trans = thm "order_le_neq_trans"; |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1006 |
val neq_le_trans = thm "order_neq_le_trans"; |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1007 |
val less_imp_neq = thm "less_imp_neq"; |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1008 |
val eq_neq_eq_imp_neq = thm "eq_neq_eq_imp_neq"; |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1009 |
|
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1010 |
fun decomp_gen sort sign (Trueprop $ t) = |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1011 |
let fun of_sort t = Sign.of_sort sign (type_of t, sort) |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1012 |
fun dec (Const ("Not", _) $ t) = ( |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1013 |
case dec t of |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1014 |
None => None |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1015 |
| Some (t1, rel, t2) => Some (t1, "~" ^ rel, t2)) |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1016 |
| dec (Const ("op =", _) $ t1 $ t2) = |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1017 |
if of_sort t1 |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1018 |
then Some (t1, "=", t2) |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1019 |
else None |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1020 |
| dec (Const ("op <=", _) $ t1 $ t2) = |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1021 |
if of_sort t1 |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1022 |
then Some (t1, "<=", t2) |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1023 |
else None |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1024 |
| dec (Const ("op <", _) $ t1 $ t2) = |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1025 |
if of_sort t1 |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1026 |
then Some (t1, "<", t2) |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1027 |
else None |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1028 |
| dec _ = None |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1029 |
in dec t end; |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1030 |
|
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1031 |
val decomp_part = decomp_gen ["HOL.order"]; |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1032 |
val decomp_lin = decomp_gen ["HOL.linorder"]; |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1033 |
|
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1034 |
end); (* struct *) |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1035 |
|
14590 | 1036 |
simpset_ref() := simpset () |
14398
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1037 |
addSolver (mk_solver "Trans_linear" (fn _ => Trans_Tac.linear_tac)) |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1038 |
addSolver (mk_solver "Trans_partial" (fn _ => Trans_Tac.partial_tac)); |
14444
24724afce166
Added documentation for transitivity solver setup.
ballarin
parents:
14430
diff
changeset
|
1039 |
(* Adding the transitivity reasoners also as safe solvers showed a slight |
24724afce166
Added documentation for transitivity solver setup.
ballarin
parents:
14430
diff
changeset
|
1040 |
speed up, but the reasoning strength appears to be not higher (at least |
24724afce166
Added documentation for transitivity solver setup.
ballarin
parents:
14430
diff
changeset
|
1041 |
no breaking of additional proofs in the entire HOL distribution, as |
24724afce166
Added documentation for transitivity solver setup.
ballarin
parents:
14430
diff
changeset
|
1042 |
of 5 March 2004, was observed). *) |
14398
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1043 |
*} |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1044 |
|
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1045 |
(* Optional methods |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1046 |
|
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1047 |
method_setup trans_partial = |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1048 |
{* Method.no_args (Method.SIMPLE_METHOD' HEADGOAL (trans_tac_partial)) *} |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1049 |
{* simple transitivity reasoner *} |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1050 |
method_setup trans_linear = |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1051 |
{* Method.no_args (Method.SIMPLE_METHOD' HEADGOAL (trans_tac_linear)) *} |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1052 |
{* simple transitivity reasoner *} |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1053 |
*) |
c5c47703f763
Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents:
14365
diff
changeset
|
1054 |
|
14444
24724afce166
Added documentation for transitivity solver setup.
ballarin
parents:
14430
diff
changeset
|
1055 |
(* |
24724afce166
Added documentation for transitivity solver setup.
ballarin
parents:
14430
diff
changeset
|
1056 |
declare order.order_refl [simp del] order_less_irrefl [simp del] |
24724afce166
Added documentation for transitivity solver setup.
ballarin
parents:
14430
diff
changeset
|
1057 |
*) |
24724afce166
Added documentation for transitivity solver setup.
ballarin
parents:
14430
diff
changeset
|
1058 |
|
11750 | 1059 |
subsubsection "Bounded quantifiers" |
1060 |
||
1061 |
syntax |
|
1062 |
"_lessAll" :: "[idt, 'a, bool] => bool" ("(3ALL _<_./ _)" [0, 0, 10] 10) |
|
1063 |
"_lessEx" :: "[idt, 'a, bool] => bool" ("(3EX _<_./ _)" [0, 0, 10] 10) |
|
1064 |
"_leAll" :: "[idt, 'a, bool] => bool" ("(3ALL _<=_./ _)" [0, 0, 10] 10) |
|
1065 |
"_leEx" :: "[idt, 'a, bool] => bool" ("(3EX _<=_./ _)" [0, 0, 10] 10) |
|
1066 |
||
12114
a8e860c86252
eliminated old "symbols" syntax, use "xsymbols" instead;
wenzelm
parents:
12023
diff
changeset
|
1067 |
syntax (xsymbols) |
11750 | 1068 |
"_lessAll" :: "[idt, 'a, bool] => bool" ("(3\<forall>_<_./ _)" [0, 0, 10] 10) |
1069 |
"_lessEx" :: "[idt, 'a, bool] => bool" ("(3\<exists>_<_./ _)" [0, 0, 10] 10) |
|
1070 |
"_leAll" :: "[idt, 'a, bool] => bool" ("(3\<forall>_\<le>_./ _)" [0, 0, 10] 10) |
|
1071 |
"_leEx" :: "[idt, 'a, bool] => bool" ("(3\<exists>_\<le>_./ _)" [0, 0, 10] 10) |
|
1072 |
||
1073 |
syntax (HOL) |
|
1074 |
"_lessAll" :: "[idt, 'a, bool] => bool" ("(3! _<_./ _)" [0, 0, 10] 10) |
|
1075 |
"_lessEx" :: "[idt, 'a, bool] => bool" ("(3? _<_./ _)" [0, 0, 10] 10) |
|
1076 |
"_leAll" :: "[idt, 'a, bool] => bool" ("(3! _<=_./ _)" [0, 0, 10] 10) |
|
1077 |
"_leEx" :: "[idt, 'a, bool] => bool" ("(3? _<=_./ _)" [0, 0, 10] 10) |
|
1078 |
||
14565 | 1079 |
syntax (HTML output) |
1080 |
"_lessAll" :: "[idt, 'a, bool] => bool" ("(3\<forall>_<_./ _)" [0, 0, 10] 10) |
|
1081 |
"_lessEx" :: "[idt, 'a, bool] => bool" ("(3\<exists>_<_./ _)" [0, 0, 10] 10) |
|
1082 |
"_leAll" :: "[idt, 'a, bool] => bool" ("(3\<forall>_\<le>_./ _)" [0, 0, 10] 10) |
|
1083 |
"_leEx" :: "[idt, 'a, bool] => bool" ("(3\<exists>_\<le>_./ _)" [0, 0, 10] 10) |
|
1084 |
||
11750 | 1085 |
translations |
1086 |
"ALL x<y. P" => "ALL x. x < y --> P" |
|
1087 |
"EX x<y. P" => "EX x. x < y & P" |
|
1088 |
"ALL x<=y. P" => "ALL x. x <= y --> P" |
|
1089 |
"EX x<=y. P" => "EX x. x <= y & P" |
|
1090 |
||
14357 | 1091 |
print_translation {* |
1092 |
let |
|
1093 |
fun all_tr' [Const ("_bound",_) $ Free (v,_), |
|
1094 |
Const("op -->",_) $ (Const ("op <",_) $ (Const ("_bound",_) $ Free (v',_)) $ n ) $ P] = |
|
1095 |
(if v=v' then Syntax.const "_lessAll" $ Syntax.mark_bound v' $ n $ P else raise Match) |
|
1096 |
||
1097 |
| all_tr' [Const ("_bound",_) $ Free (v,_), |
|
1098 |
Const("op -->",_) $ (Const ("op <=",_) $ (Const ("_bound",_) $ Free (v',_)) $ n ) $ P] = |
|
1099 |
(if v=v' then Syntax.const "_leAll" $ Syntax.mark_bound v' $ n $ P else raise Match); |
|
1100 |
||
1101 |
fun ex_tr' [Const ("_bound",_) $ Free (v,_), |
|
1102 |
Const("op &",_) $ (Const ("op <",_) $ (Const ("_bound",_) $ Free (v',_)) $ n ) $ P] = |
|
1103 |
(if v=v' then Syntax.const "_lessEx" $ Syntax.mark_bound v' $ n $ P else raise Match) |
|
1104 |
||
1105 |
| ex_tr' [Const ("_bound",_) $ Free (v,_), |
|
1106 |
Const("op &",_) $ (Const ("op <=",_) $ (Const ("_bound",_) $ Free (v',_)) $ n ) $ P] = |
|
1107 |
(if v=v' then Syntax.const "_leEx" $ Syntax.mark_bound v' $ n $ P else raise Match) |
|
1108 |
in |
|
1109 |
[("ALL ", all_tr'), ("EX ", ex_tr')] |
|
923 | 1110 |
end |
14357 | 1111 |
*} |
1112 |
||
1113 |
end |