author | wenzelm |
Fri, 01 Dec 2000 19:43:06 +0100 | |
changeset 10569 | e8346dad78e1 |
parent 10489 | a4684cf28edf |
child 11432 | 8a203ae6efe3 |
permissions | -rw-r--r-- |
923 | 1 |
(* Title: HOL/HOL.thy |
2 |
ID: $Id$ |
|
3 |
Author: Tobias Nipkow |
|
4 |
Copyright 1993 University of Cambridge |
|
5 |
||
2260 | 6 |
Higher-Order Logic. |
923 | 7 |
*) |
8 |
||
7357 | 9 |
theory HOL = CPure |
9869 | 10 |
files ("HOL_lemmas.ML") ("cladata.ML") ("blastdata.ML") ("simpdata.ML") |
11 |
("meson_lemmas.ML") ("Tools/meson.ML"): |
|
923 | 12 |
|
2260 | 13 |
|
14 |
(** Core syntax **) |
|
15 |
||
3947 | 16 |
global |
17 |
||
7357 | 18 |
classes "term" < logic |
19 |
defaultsort "term" |
|
923 | 20 |
|
7357 | 21 |
typedecl bool |
923 | 22 |
|
23 |
arities |
|
7357 | 24 |
bool :: "term" |
25 |
fun :: ("term", "term") "term" |
|
923 | 26 |
|
27 |
consts |
|
28 |
||
29 |
(* Constants *) |
|
30 |
||
7357 | 31 |
Trueprop :: "bool => prop" ("(_)" 5) |
32 |
Not :: "bool => bool" ("~ _" [40] 40) |
|
33 |
True :: bool |
|
34 |
False :: bool |
|
35 |
If :: "[bool, 'a, 'a] => 'a" ("(if (_)/ then (_)/ else (_))" 10) |
|
3947 | 36 |
arbitrary :: 'a |
923 | 37 |
|
38 |
(* Binders *) |
|
39 |
||
7357 | 40 |
Eps :: "('a => bool) => 'a" |
41 |
All :: "('a => bool) => bool" (binder "ALL " 10) |
|
42 |
Ex :: "('a => bool) => bool" (binder "EX " 10) |
|
43 |
Ex1 :: "('a => bool) => bool" (binder "EX! " 10) |
|
44 |
Let :: "['a, 'a => 'b] => 'b" |
|
923 | 45 |
|
46 |
(* Infixes *) |
|
47 |
||
7357 | 48 |
"=" :: "['a, 'a] => bool" (infixl 50) |
49 |
& :: "[bool, bool] => bool" (infixr 35) |
|
50 |
"|" :: "[bool, bool] => bool" (infixr 30) |
|
51 |
--> :: "[bool, bool] => bool" (infixr 25) |
|
923 | 52 |
|
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
53 |
local |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
54 |
|
2260 | 55 |
|
56 |
(* Overloaded Constants *) |
|
57 |
||
9869 | 58 |
axclass zero < "term" |
8940 | 59 |
axclass plus < "term" |
7357 | 60 |
axclass minus < "term" |
61 |
axclass times < "term" |
|
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
62 |
axclass inverse < "term" |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
63 |
|
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
64 |
global |
3370
5c5fdce3a4e4
Overloading of "^" requires new type class "power", with types "nat" and
paulson
parents:
3320
diff
changeset
|
65 |
|
2260 | 66 |
consts |
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
67 |
"0" :: "'a::zero" ("0") |
7357 | 68 |
"+" :: "['a::plus, 'a] => 'a" (infixl 65) |
69 |
- :: "['a::minus, 'a] => 'a" (infixl 65) |
|
70 |
uminus :: "['a::minus] => 'a" ("- _" [81] 80) |
|
7426 | 71 |
* :: "['a::times, 'a] => 'a" (infixl 70) |
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
72 |
|
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
73 |
local |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
74 |
|
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
75 |
consts |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
76 |
abs :: "'a::minus => 'a" |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
77 |
inverse :: "'a::inverse => 'a" |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
78 |
divide :: "['a::inverse, 'a] => 'a" (infixl "'/" 70) |
2260 | 79 |
|
10489 | 80 |
syntax (xsymbols) |
81 |
abs :: "'a::minus => 'a" ("\<bar>_\<bar>") |
|
82 |
syntax (HTML output) |
|
83 |
abs :: "'a::minus => 'a" ("\<bar>_\<bar>") |
|
84 |
||
8959 | 85 |
axclass plus_ac0 < plus, zero |
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
86 |
commute: "x + y = y + x" |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
87 |
assoc: "(x + y) + z = x + (y + z)" |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
88 |
zero: "0 + x = x" |
3820 | 89 |
|
7238
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
7220
diff
changeset
|
90 |
|
2260 | 91 |
(** Additional concrete syntax **) |
92 |
||
4868 | 93 |
nonterminals |
923 | 94 |
letbinds letbind |
95 |
case_syn cases_syn |
|
96 |
||
97 |
syntax |
|
7357 | 98 |
~= :: "['a, 'a] => bool" (infixl 50) |
99 |
"_Eps" :: "[pttrn, bool] => 'a" ("(3SOME _./ _)" [0, 10] 10) |
|
923 | 100 |
|
101 |
(* Let expressions *) |
|
102 |
||
7357 | 103 |
"_bind" :: "[pttrn, 'a] => letbind" ("(2_ =/ _)" 10) |
104 |
"" :: "letbind => letbinds" ("_") |
|
105 |
"_binds" :: "[letbind, letbinds] => letbinds" ("_;/ _") |
|
106 |
"_Let" :: "[letbinds, 'a] => 'a" ("(let (_)/ in (_))" 10) |
|
923 | 107 |
|
108 |
(* Case expressions *) |
|
109 |
||
9060
b0dd884b1848
rename @case to _case_syntax (improves on low-level errors);
wenzelm
parents:
8959
diff
changeset
|
110 |
"_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
|
111 |
"_case1" :: "['a, 'b] => case_syn" ("(2_ =>/ _)" 10) |
7357 | 112 |
"" :: "case_syn => cases_syn" ("_") |
9060
b0dd884b1848
rename @case to _case_syntax (improves on low-level errors);
wenzelm
parents:
8959
diff
changeset
|
113 |
"_case2" :: "[case_syn, cases_syn] => cases_syn" ("_/ | _") |
923 | 114 |
|
115 |
translations |
|
7238
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
7220
diff
changeset
|
116 |
"x ~= y" == "~ (x = y)" |
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
7220
diff
changeset
|
117 |
"SOME x. P" == "Eps (%x. P)" |
923 | 118 |
"_Let (_binds b bs) e" == "_Let b (_Let bs e)" |
1114 | 119 |
"let x = a in e" == "Let a (%x. e)" |
923 | 120 |
|
3820 | 121 |
syntax ("" output) |
7357 | 122 |
"op =" :: "['a, 'a] => bool" ("(_ =/ _)" [51, 51] 50) |
123 |
"op ~=" :: "['a, 'a] => bool" ("(_ ~=/ _)" [51, 51] 50) |
|
2260 | 124 |
|
125 |
syntax (symbols) |
|
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
126 |
Not :: "bool => bool" ("\<not> _" [40] 40) |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
127 |
"op &" :: "[bool, bool] => bool" (infixr "\<and>" 35) |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
128 |
"op |" :: "[bool, bool] => bool" (infixr "\<or>" 30) |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
129 |
"op -->" :: "[bool, bool] => bool" (infixr "\<midarrow>\<rightarrow>" 25) |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
130 |
"op ~=" :: "['a, 'a] => bool" (infixl "\<noteq>" 50) |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
131 |
"ALL " :: "[idts, bool] => bool" ("(3\<forall>_./ _)" [0, 10] 10) |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
132 |
"EX " :: "[idts, bool] => bool" ("(3\<exists>_./ _)" [0, 10] 10) |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
133 |
"EX! " :: "[idts, bool] => bool" ("(3\<exists>!_./ _)" [0, 10] 10) |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
134 |
"_case1" :: "['a, 'b] => case_syn" ("(2_ \<Rightarrow>/ _)" 10) |
9060
b0dd884b1848
rename @case to _case_syntax (improves on low-level errors);
wenzelm
parents:
8959
diff
changeset
|
135 |
(*"_case2" :: "[case_syn, cases_syn] => cases_syn" ("_/ \\<orelse> _")*) |
2372 | 136 |
|
9950 | 137 |
syntax (input) |
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
138 |
"_Eps" :: "[pttrn, bool] => 'a" ("(3\<epsilon>_./ _)" [0, 10] 10) |
9950 | 139 |
|
3820 | 140 |
syntax (symbols output) |
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
141 |
"op ~=" :: "['a, 'a] => bool" ("(_ \<noteq>/ _)" [51, 51] 50) |
3820 | 142 |
|
6027
9dd06eeda95c
added new print_mode "xsymbols" for extended symbol support
oheimb
parents:
5786
diff
changeset
|
143 |
syntax (xsymbols) |
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
144 |
"op -->" :: "[bool, bool] => bool" (infixr "\<longrightarrow>" 25) |
2260 | 145 |
|
6340 | 146 |
syntax (HTML output) |
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
147 |
Not :: "bool => bool" ("\<not> _" [40] 40) |
6340 | 148 |
|
7238
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
7220
diff
changeset
|
149 |
syntax (HOL) |
7357 | 150 |
"_Eps" :: "[pttrn, bool] => 'a" ("(3@ _./ _)" [0, 10] 10) |
151 |
"ALL " :: "[idts, bool] => bool" ("(3! _./ _)" [0, 10] 10) |
|
152 |
"EX " :: "[idts, bool] => bool" ("(3? _./ _)" [0, 10] 10) |
|
153 |
"EX! " :: "[idts, bool] => bool" ("(3?! _./ _)" [0, 10] 10) |
|
7238
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
7220
diff
changeset
|
154 |
|
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
7220
diff
changeset
|
155 |
|
6340 | 156 |
|
2260 | 157 |
(** Rules and definitions **) |
158 |
||
7357 | 159 |
axioms |
923 | 160 |
|
7357 | 161 |
eq_reflection: "(x=y) ==> (x==y)" |
923 | 162 |
|
163 |
(* Basic Rules *) |
|
164 |
||
7357 | 165 |
refl: "t = (t::'a)" |
166 |
subst: "[| s = t; P(s) |] ==> P(t::'a)" |
|
6289 | 167 |
|
168 |
(*Extensionality is built into the meta-logic, and this rule expresses |
|
169 |
a related property. It is an eta-expanded version of the traditional |
|
170 |
rule, and similar to the ABS rule of HOL.*) |
|
7357 | 171 |
ext: "(!!x::'a. (f x ::'b) = g x) ==> (%x. f x) = (%x. g x)" |
6289 | 172 |
|
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
173 |
someI: "P (x::'a) ==> P (SOME x. P x)" |
923 | 174 |
|
7357 | 175 |
impI: "(P ==> Q) ==> P-->Q" |
176 |
mp: "[| P-->Q; P |] ==> Q" |
|
923 | 177 |
|
178 |
defs |
|
179 |
||
7357 | 180 |
True_def: "True == ((%x::bool. x) = (%x. x))" |
181 |
All_def: "All(P) == (P = (%x. True))" |
|
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
182 |
Ex_def: "Ex(P) == P (SOME x. P x)" |
7357 | 183 |
False_def: "False == (!P. P)" |
184 |
not_def: "~ P == P-->False" |
|
185 |
and_def: "P & Q == !R. (P-->Q-->R) --> R" |
|
186 |
or_def: "P | Q == !R. (P-->R) --> (Q-->R) --> R" |
|
187 |
Ex1_def: "Ex1(P) == ? x. P(x) & (! y. P(y) --> y=x)" |
|
923 | 188 |
|
7357 | 189 |
axioms |
923 | 190 |
(* Axioms *) |
191 |
||
7357 | 192 |
iff: "(P-->Q) --> (Q-->P) --> (P=Q)" |
193 |
True_or_False: "(P=True) | (P=False)" |
|
923 | 194 |
|
195 |
defs |
|
5069 | 196 |
(*misc definitions*) |
7357 | 197 |
Let_def: "Let s f == f(s)" |
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
198 |
if_def: "If P x y == SOME z::'a. (P=True --> z=x) & (P=False --> z=y)" |
5069 | 199 |
|
200 |
(*arbitrary is completely unspecified, but is made to appear as a |
|
201 |
definition syntactically*) |
|
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
202 |
arbitrary_def: "False ==> arbitrary == (SOME x. False)" |
923 | 203 |
|
3320 | 204 |
|
4868 | 205 |
|
7357 | 206 |
(* theory and package setup *) |
4868 | 207 |
|
9736 | 208 |
use "HOL_lemmas.ML" |
9869 | 209 |
|
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
210 |
lemma atomize_all: "(!!x. P x) == Trueprop (ALL x. P x)" |
9488 | 211 |
proof (rule equal_intr_rule) |
212 |
assume "!!x. P x" |
|
10383 | 213 |
show "ALL x. P x" by (rule allI) |
9488 | 214 |
next |
215 |
assume "ALL x. P x" |
|
10383 | 216 |
thus "!!x. P x" by (rule allE) |
9488 | 217 |
qed |
218 |
||
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
219 |
lemma atomize_imp: "(A ==> B) == Trueprop (A --> B)" |
9488 | 220 |
proof (rule equal_intr_rule) |
221 |
assume r: "A ==> B" |
|
10383 | 222 |
show "A --> B" by (rule impI) (rule r) |
9488 | 223 |
next |
224 |
assume "A --> B" and A |
|
10383 | 225 |
thus B by (rule mp) |
9488 | 226 |
qed |
227 |
||
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
228 |
lemma atomize_eq: "(x == y) == Trueprop (x = y)" |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
229 |
proof (rule equal_intr_rule) |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
230 |
assume "x == y" |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
231 |
show "x = y" by (unfold prems) (rule refl) |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
232 |
next |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
233 |
assume "x = y" |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
234 |
thus "x == y" by (rule eq_reflection) |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
235 |
qed |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
236 |
|
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
237 |
lemmas atomize = atomize_all atomize_imp |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
238 |
lemmas atomize' = atomize atomize_eq |
9529 | 239 |
|
10383 | 240 |
use "cladata.ML" |
241 |
setup hypsubst_setup |
|
242 |
setup Classical.setup |
|
243 |
setup clasetup |
|
244 |
||
9869 | 245 |
use "blastdata.ML" |
246 |
setup Blast.setup |
|
4868 | 247 |
|
9869 | 248 |
use "simpdata.ML" |
249 |
setup Simplifier.setup |
|
250 |
setup "Simplifier.method_setup Splitter.split_modifiers" setup simpsetup |
|
251 |
setup Splitter.setup setup Clasimp.setup |
|
252 |
||
253 |
use "meson_lemmas.ML" |
|
9839
da5ca8b30244
loads Tools/meson.ML: meson_tac installed by default
paulson
parents:
9736
diff
changeset
|
254 |
use "Tools/meson.ML" |
9869 | 255 |
setup meson_setup |
9839
da5ca8b30244
loads Tools/meson.ML: meson_tac installed by default
paulson
parents:
9736
diff
changeset
|
256 |
|
923 | 257 |
end |