clasohm@923
|
1 |
(* Title: HOL/HOL.thy
|
clasohm@923
|
2 |
ID: $Id$
|
clasohm@923
|
3 |
Author: Tobias Nipkow
|
clasohm@923
|
4 |
Copyright 1993 University of Cambridge
|
clasohm@923
|
5 |
|
wenzelm@2260
|
6 |
Higher-Order Logic.
|
clasohm@923
|
7 |
*)
|
clasohm@923
|
8 |
|
wenzelm@7357
|
9 |
theory HOL = CPure
|
wenzelm@7357
|
10 |
files ("HOL_lemmas.ML") ("cladata.ML") ("blastdata.ML") ("simpdata.ML"):
|
clasohm@923
|
11 |
|
wenzelm@2260
|
12 |
|
wenzelm@2260
|
13 |
(** Core syntax **)
|
wenzelm@2260
|
14 |
|
wenzelm@3947
|
15 |
global
|
wenzelm@3947
|
16 |
|
wenzelm@7357
|
17 |
classes "term" < logic
|
wenzelm@7357
|
18 |
defaultsort "term"
|
clasohm@923
|
19 |
|
wenzelm@7357
|
20 |
typedecl bool
|
clasohm@923
|
21 |
|
clasohm@923
|
22 |
arities
|
wenzelm@7357
|
23 |
bool :: "term"
|
wenzelm@7357
|
24 |
fun :: ("term", "term") "term"
|
clasohm@923
|
25 |
|
clasohm@923
|
26 |
|
clasohm@923
|
27 |
consts
|
clasohm@923
|
28 |
|
clasohm@923
|
29 |
(* Constants *)
|
clasohm@923
|
30 |
|
wenzelm@7357
|
31 |
Trueprop :: "bool => prop" ("(_)" 5)
|
wenzelm@7357
|
32 |
Not :: "bool => bool" ("~ _" [40] 40)
|
wenzelm@7357
|
33 |
True :: bool
|
wenzelm@7357
|
34 |
False :: bool
|
wenzelm@7357
|
35 |
If :: "[bool, 'a, 'a] => 'a" ("(if (_)/ then (_)/ else (_))" 10)
|
wenzelm@3947
|
36 |
arbitrary :: 'a
|
clasohm@923
|
37 |
|
clasohm@923
|
38 |
(* Binders *)
|
clasohm@923
|
39 |
|
wenzelm@7357
|
40 |
Eps :: "('a => bool) => 'a"
|
wenzelm@7357
|
41 |
All :: "('a => bool) => bool" (binder "ALL " 10)
|
wenzelm@7357
|
42 |
Ex :: "('a => bool) => bool" (binder "EX " 10)
|
wenzelm@7357
|
43 |
Ex1 :: "('a => bool) => bool" (binder "EX! " 10)
|
wenzelm@7357
|
44 |
Let :: "['a, 'a => 'b] => 'b"
|
clasohm@923
|
45 |
|
clasohm@923
|
46 |
(* Infixes *)
|
clasohm@923
|
47 |
|
wenzelm@7357
|
48 |
"=" :: "['a, 'a] => bool" (infixl 50)
|
wenzelm@7357
|
49 |
& :: "[bool, bool] => bool" (infixr 35)
|
wenzelm@7357
|
50 |
"|" :: "[bool, bool] => bool" (infixr 30)
|
wenzelm@7357
|
51 |
--> :: "[bool, bool] => bool" (infixr 25)
|
clasohm@923
|
52 |
|
clasohm@923
|
53 |
|
wenzelm@2260
|
54 |
(* Overloaded Constants *)
|
wenzelm@2260
|
55 |
|
wenzelm@7357
|
56 |
axclass plus < "term"
|
wenzelm@7357
|
57 |
axclass minus < "term"
|
wenzelm@7357
|
58 |
axclass times < "term"
|
wenzelm@7357
|
59 |
axclass power < "term"
|
paulson@3370
|
60 |
|
wenzelm@2260
|
61 |
consts
|
wenzelm@7357
|
62 |
"+" :: "['a::plus, 'a] => 'a" (infixl 65)
|
wenzelm@7357
|
63 |
- :: "['a::minus, 'a] => 'a" (infixl 65)
|
wenzelm@7357
|
64 |
uminus :: "['a::minus] => 'a" ("- _" [81] 80)
|
wenzelm@7357
|
65 |
"*" :: "['a::times, 'a] => 'a" (infixl 70)
|
paulson@3370
|
66 |
(*See Nat.thy for "^"*)
|
wenzelm@2260
|
67 |
|
wenzelm@3820
|
68 |
|
wenzelm@7238
|
69 |
|
wenzelm@2260
|
70 |
(** Additional concrete syntax **)
|
wenzelm@2260
|
71 |
|
wenzelm@4868
|
72 |
nonterminals
|
clasohm@923
|
73 |
letbinds letbind
|
clasohm@923
|
74 |
case_syn cases_syn
|
clasohm@923
|
75 |
|
clasohm@923
|
76 |
syntax
|
wenzelm@7357
|
77 |
~= :: "['a, 'a] => bool" (infixl 50)
|
wenzelm@7357
|
78 |
"_Eps" :: "[pttrn, bool] => 'a" ("(3SOME _./ _)" [0, 10] 10)
|
clasohm@923
|
79 |
|
clasohm@923
|
80 |
(* Let expressions *)
|
clasohm@923
|
81 |
|
wenzelm@7357
|
82 |
"_bind" :: "[pttrn, 'a] => letbind" ("(2_ =/ _)" 10)
|
wenzelm@7357
|
83 |
"" :: "letbind => letbinds" ("_")
|
wenzelm@7357
|
84 |
"_binds" :: "[letbind, letbinds] => letbinds" ("_;/ _")
|
wenzelm@7357
|
85 |
"_Let" :: "[letbinds, 'a] => 'a" ("(let (_)/ in (_))" 10)
|
clasohm@923
|
86 |
|
clasohm@923
|
87 |
(* Case expressions *)
|
clasohm@923
|
88 |
|
wenzelm@7357
|
89 |
"@case" :: "['a, cases_syn] => 'b" ("(case _ of/ _)" 10)
|
wenzelm@7357
|
90 |
"@case1" :: "['a, 'b] => case_syn" ("(2_ =>/ _)" 10)
|
wenzelm@7357
|
91 |
"" :: "case_syn => cases_syn" ("_")
|
wenzelm@7357
|
92 |
"@case2" :: "[case_syn, cases_syn] => cases_syn" ("_/ | _")
|
clasohm@923
|
93 |
|
clasohm@923
|
94 |
translations
|
wenzelm@7238
|
95 |
"x ~= y" == "~ (x = y)"
|
wenzelm@7238
|
96 |
"SOME x. P" == "Eps (%x. P)"
|
clasohm@923
|
97 |
"_Let (_binds b bs) e" == "_Let b (_Let bs e)"
|
nipkow@1114
|
98 |
"let x = a in e" == "Let a (%x. e)"
|
clasohm@923
|
99 |
|
wenzelm@3820
|
100 |
syntax ("" output)
|
wenzelm@7357
|
101 |
"op =" :: "['a, 'a] => bool" ("(_ =/ _)" [51, 51] 50)
|
wenzelm@7357
|
102 |
"op ~=" :: "['a, 'a] => bool" ("(_ ~=/ _)" [51, 51] 50)
|
wenzelm@2260
|
103 |
|
wenzelm@2260
|
104 |
syntax (symbols)
|
wenzelm@7357
|
105 |
Not :: "bool => bool" ("\\<not> _" [40] 40)
|
wenzelm@7357
|
106 |
"op &" :: "[bool, bool] => bool" (infixr "\\<and>" 35)
|
wenzelm@7357
|
107 |
"op |" :: "[bool, bool] => bool" (infixr "\\<or>" 30)
|
wenzelm@7357
|
108 |
"op -->" :: "[bool, bool] => bool" (infixr "\\<midarrow>\\<rightarrow>" 25)
|
wenzelm@7357
|
109 |
"op o" :: "['b => 'c, 'a => 'b, 'a] => 'c" (infixl "\\<circ>" 55)
|
wenzelm@7357
|
110 |
"op ~=" :: "['a, 'a] => bool" (infixl "\\<noteq>" 50)
|
wenzelm@7357
|
111 |
"_Eps" :: "[pttrn, bool] => 'a" ("(3\\<epsilon>_./ _)" [0, 10] 10)
|
wenzelm@7357
|
112 |
"ALL " :: "[idts, bool] => bool" ("(3\\<forall>_./ _)" [0, 10] 10)
|
wenzelm@7357
|
113 |
"EX " :: "[idts, bool] => bool" ("(3\\<exists>_./ _)" [0, 10] 10)
|
wenzelm@7357
|
114 |
"EX! " :: "[idts, bool] => bool" ("(3\\<exists>!_./ _)" [0, 10] 10)
|
wenzelm@7357
|
115 |
"@case1" :: "['a, 'b] => case_syn" ("(2_ \\<Rightarrow>/ _)" 10)
|
wenzelm@7357
|
116 |
(*"@case2" :: "[case_syn, cases_syn] => cases_syn" ("_/ \\<orelse> _")*)
|
wenzelm@2372
|
117 |
|
wenzelm@3820
|
118 |
syntax (symbols output)
|
wenzelm@7357
|
119 |
"op ~=" :: "['a, 'a] => bool" ("(_ \\<noteq>/ _)" [51, 51] 50)
|
wenzelm@3820
|
120 |
|
oheimb@6027
|
121 |
syntax (xsymbols)
|
wenzelm@7357
|
122 |
"op -->" :: "[bool, bool] => bool" (infixr "\\<longrightarrow>" 25)
|
wenzelm@2260
|
123 |
|
wenzelm@6340
|
124 |
syntax (HTML output)
|
wenzelm@7357
|
125 |
Not :: "bool => bool" ("\\<not> _" [40] 40)
|
wenzelm@6340
|
126 |
|
wenzelm@7238
|
127 |
syntax (HOL)
|
wenzelm@7357
|
128 |
"_Eps" :: "[pttrn, bool] => 'a" ("(3@ _./ _)" [0, 10] 10)
|
wenzelm@7357
|
129 |
"ALL " :: "[idts, bool] => bool" ("(3! _./ _)" [0, 10] 10)
|
wenzelm@7357
|
130 |
"EX " :: "[idts, bool] => bool" ("(3? _./ _)" [0, 10] 10)
|
wenzelm@7357
|
131 |
"EX! " :: "[idts, bool] => bool" ("(3?! _./ _)" [0, 10] 10)
|
wenzelm@7238
|
132 |
|
wenzelm@7238
|
133 |
|
wenzelm@6340
|
134 |
|
wenzelm@2260
|
135 |
(** Rules and definitions **)
|
wenzelm@2260
|
136 |
|
wenzelm@3947
|
137 |
local
|
wenzelm@3947
|
138 |
|
wenzelm@7357
|
139 |
axioms
|
clasohm@923
|
140 |
|
wenzelm@7357
|
141 |
eq_reflection: "(x=y) ==> (x==y)"
|
clasohm@923
|
142 |
|
clasohm@923
|
143 |
(* Basic Rules *)
|
clasohm@923
|
144 |
|
wenzelm@7357
|
145 |
refl: "t = (t::'a)"
|
wenzelm@7357
|
146 |
subst: "[| s = t; P(s) |] ==> P(t::'a)"
|
paulson@6289
|
147 |
|
paulson@6289
|
148 |
(*Extensionality is built into the meta-logic, and this rule expresses
|
paulson@6289
|
149 |
a related property. It is an eta-expanded version of the traditional
|
paulson@6289
|
150 |
rule, and similar to the ABS rule of HOL.*)
|
wenzelm@7357
|
151 |
ext: "(!!x::'a. (f x ::'b) = g x) ==> (%x. f x) = (%x. g x)"
|
paulson@6289
|
152 |
|
wenzelm@7357
|
153 |
selectI: "P (x::'a) ==> P (@x. P x)"
|
clasohm@923
|
154 |
|
wenzelm@7357
|
155 |
impI: "(P ==> Q) ==> P-->Q"
|
wenzelm@7357
|
156 |
mp: "[| P-->Q; P |] ==> Q"
|
clasohm@923
|
157 |
|
clasohm@923
|
158 |
defs
|
clasohm@923
|
159 |
|
wenzelm@7357
|
160 |
True_def: "True == ((%x::bool. x) = (%x. x))"
|
wenzelm@7357
|
161 |
All_def: "All(P) == (P = (%x. True))"
|
wenzelm@7357
|
162 |
Ex_def: "Ex(P) == P(@x. P(x))"
|
wenzelm@7357
|
163 |
False_def: "False == (!P. P)"
|
wenzelm@7357
|
164 |
not_def: "~ P == P-->False"
|
wenzelm@7357
|
165 |
and_def: "P & Q == !R. (P-->Q-->R) --> R"
|
wenzelm@7357
|
166 |
or_def: "P | Q == !R. (P-->R) --> (Q-->R) --> R"
|
wenzelm@7357
|
167 |
Ex1_def: "Ex1(P) == ? x. P(x) & (! y. P(y) --> y=x)"
|
clasohm@923
|
168 |
|
wenzelm@7357
|
169 |
axioms
|
clasohm@923
|
170 |
(* Axioms *)
|
clasohm@923
|
171 |
|
wenzelm@7357
|
172 |
iff: "(P-->Q) --> (Q-->P) --> (P=Q)"
|
wenzelm@7357
|
173 |
True_or_False: "(P=True) | (P=False)"
|
clasohm@923
|
174 |
|
clasohm@923
|
175 |
defs
|
wenzelm@5069
|
176 |
(*misc definitions*)
|
wenzelm@7357
|
177 |
Let_def: "Let s f == f(s)"
|
wenzelm@7357
|
178 |
if_def: "If P x y == @z::'a. (P=True --> z=x) & (P=False --> z=y)"
|
wenzelm@5069
|
179 |
|
wenzelm@5069
|
180 |
(*arbitrary is completely unspecified, but is made to appear as a
|
wenzelm@5069
|
181 |
definition syntactically*)
|
wenzelm@7357
|
182 |
arbitrary_def: "False ==> arbitrary == (@x. False)"
|
clasohm@923
|
183 |
|
nipkow@3320
|
184 |
|
wenzelm@4793
|
185 |
|
wenzelm@7357
|
186 |
(* theory and package setup *)
|
wenzelm@4793
|
187 |
|
wenzelm@7357
|
188 |
use "HOL_lemmas.ML" setup attrib_setup
|
wenzelm@7357
|
189 |
use "cladata.ML" setup Classical.setup setup clasetup
|
wenzelm@7357
|
190 |
use "blastdata.ML" setup Blast.setup
|
wenzelm@7357
|
191 |
use "simpdata.ML" setup Simplifier.setup setup simpsetup setup Clasimp.setup
|
wenzelm@4868
|
192 |
|
wenzelm@4868
|
193 |
|
wenzelm@4868
|
194 |
end
|