| author | wenzelm | 
| Tue, 17 Aug 1999 22:13:23 +0200 | |
| changeset 7238 | 36e58620ffc8 | 
| parent 7220 | da6f387ca482 | 
| child 7357 | d0e16da40ea2 | 
| 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  | 
||
9  | 
HOL = CPure +  | 
|
10  | 
||
| 2260 | 11  | 
|
12  | 
(** Core syntax **)  | 
|
13  | 
||
| 3947 | 14  | 
global  | 
15  | 
||
| 923 | 16  | 
classes  | 
17  | 
term < logic  | 
|
18  | 
||
19  | 
default  | 
|
20  | 
term  | 
|
21  | 
||
22  | 
types  | 
|
23  | 
bool  | 
|
24  | 
||
25  | 
arities  | 
|
26  | 
fun :: (term, term) term  | 
|
27  | 
bool :: term  | 
|
28  | 
||
29  | 
||
30  | 
consts  | 
|
31  | 
||
32  | 
(* Constants *)  | 
|
33  | 
||
| 
1370
 
7361ac9b024d
removed quotes from types in consts and syntax sections
 
clasohm 
parents: 
1273 
diff
changeset
 | 
34  | 
  Trueprop      :: bool => prop                     ("(_)" 5)
 | 
| 2720 | 35  | 
  Not           :: bool => bool                     ("~ _" [40] 40)
 | 
| 
1370
 
7361ac9b024d
removed quotes from types in consts and syntax sections
 
clasohm 
parents: 
1273 
diff
changeset
 | 
36  | 
True, False :: bool  | 
| 
 
7361ac9b024d
removed quotes from types in consts and syntax sections
 
clasohm 
parents: 
1273 
diff
changeset
 | 
37  | 
  If            :: [bool, 'a, 'a] => 'a   ("(if (_)/ then (_)/ else (_))" 10)
 | 
| 3947 | 38  | 
arbitrary :: 'a  | 
| 923 | 39  | 
|
40  | 
(* Binders *)  | 
|
41  | 
||
| 
1370
 
7361ac9b024d
removed quotes from types in consts and syntax sections
 
clasohm 
parents: 
1273 
diff
changeset
 | 
42  | 
  Eps           :: ('a => bool) => 'a
 | 
| 
7238
 
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
 
wenzelm 
parents: 
7220 
diff
changeset
 | 
43  | 
  All           :: ('a => bool) => bool             (binder "ALL " 10)
 | 
| 
 
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
 
wenzelm 
parents: 
7220 
diff
changeset
 | 
44  | 
  Ex            :: ('a => bool) => bool             (binder "EX " 10)
 | 
| 
 
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
 
wenzelm 
parents: 
7220 
diff
changeset
 | 
45  | 
  Ex1           :: ('a => bool) => bool             (binder "EX! " 10)
 | 
| 
1370
 
7361ac9b024d
removed quotes from types in consts and syntax sections
 
clasohm 
parents: 
1273 
diff
changeset
 | 
46  | 
Let :: ['a, 'a => 'b] => 'b  | 
| 923 | 47  | 
|
48  | 
(* Infixes *)  | 
|
49  | 
||
| 
1370
 
7361ac9b024d
removed quotes from types in consts and syntax sections
 
clasohm 
parents: 
1273 
diff
changeset
 | 
50  | 
"=" :: ['a, 'a] => bool (infixl 50)  | 
| 
 
7361ac9b024d
removed quotes from types in consts and syntax sections
 
clasohm 
parents: 
1273 
diff
changeset
 | 
51  | 
"&" :: [bool, bool] => bool (infixr 35)  | 
| 
 
7361ac9b024d
removed quotes from types in consts and syntax sections
 
clasohm 
parents: 
1273 
diff
changeset
 | 
52  | 
"|" :: [bool, bool] => bool (infixr 30)  | 
| 
 
7361ac9b024d
removed quotes from types in consts and syntax sections
 
clasohm 
parents: 
1273 
diff
changeset
 | 
53  | 
"-->" :: [bool, bool] => bool (infixr 25)  | 
| 923 | 54  | 
|
| 2260 | 55  | 
|
56  | 
(* Overloaded Constants *)  | 
|
57  | 
||
58  | 
axclass  | 
|
59  | 
plus < term  | 
|
| 923 | 60  | 
|
| 2260 | 61  | 
axclass  | 
62  | 
minus < term  | 
|
63  | 
||
64  | 
axclass  | 
|
65  | 
times < term  | 
|
66  | 
||
| 
3370
 
5c5fdce3a4e4
Overloading of "^" requires new type class "power", with types "nat" and
 
paulson 
parents: 
3320 
diff
changeset
 | 
67  | 
axclass  | 
| 
 
5c5fdce3a4e4
Overloading of "^" requires new type class "power", with types "nat" and
 
paulson 
parents: 
3320 
diff
changeset
 | 
68  | 
power < term  | 
| 
 
5c5fdce3a4e4
Overloading of "^" requires new type class "power", with types "nat" and
 
paulson 
parents: 
3320 
diff
changeset
 | 
69  | 
|
| 2260 | 70  | 
consts  | 
| 
3370
 
5c5fdce3a4e4
Overloading of "^" requires new type class "power", with types "nat" and
 
paulson 
parents: 
3320 
diff
changeset
 | 
71  | 
"+" :: ['a::plus, 'a] => 'a (infixl 65)  | 
| 
1370
 
7361ac9b024d
removed quotes from types in consts and syntax sections
 
clasohm 
parents: 
1273 
diff
changeset
 | 
72  | 
"-" :: ['a::minus, 'a] => 'a (infixl 65)  | 
| 7220 | 73  | 
  uminus        :: ['a::minus] => 'a                ("- _" [81] 80)
 | 
| 
1370
 
7361ac9b024d
removed quotes from types in consts and syntax sections
 
clasohm 
parents: 
1273 
diff
changeset
 | 
74  | 
"*" :: ['a::times, 'a] => 'a (infixl 70)  | 
| 
3370
 
5c5fdce3a4e4
Overloading of "^" requires new type class "power", with types "nat" and
 
paulson 
parents: 
3320 
diff
changeset
 | 
75  | 
(*See Nat.thy for "^"*)  | 
| 2260 | 76  | 
|
| 3820 | 77  | 
|
| 
7238
 
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
 
wenzelm 
parents: 
7220 
diff
changeset
 | 
78  | 
|
| 2260 | 79  | 
(** Additional concrete syntax **)  | 
80  | 
||
| 4868 | 81  | 
nonterminals  | 
| 923 | 82  | 
letbinds letbind  | 
83  | 
case_syn cases_syn  | 
|
84  | 
||
85  | 
syntax  | 
|
| 
1370
 
7361ac9b024d
removed quotes from types in consts and syntax sections
 
clasohm 
parents: 
1273 
diff
changeset
 | 
86  | 
"~=" :: ['a, 'a] => bool (infixl 50)  | 
| 
7238
 
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
 
wenzelm 
parents: 
7220 
diff
changeset
 | 
87  | 
  "_Eps"        :: [pttrn, bool] => 'a              ("(3SOME _./ _)" [0, 10] 10)
 | 
| 923 | 88  | 
|
89  | 
(* Let expressions *)  | 
|
90  | 
||
| 
1370
 
7361ac9b024d
removed quotes from types in consts and syntax sections
 
clasohm 
parents: 
1273 
diff
changeset
 | 
91  | 
  "_bind"       :: [pttrn, 'a] => letbind           ("(2_ =/ _)" 10)
 | 
| 
 
7361ac9b024d
removed quotes from types in consts and syntax sections
 
clasohm 
parents: 
1273 
diff
changeset
 | 
92  | 
  ""            :: letbind => letbinds              ("_")
 | 
| 
 
7361ac9b024d
removed quotes from types in consts and syntax sections
 
clasohm 
parents: 
1273 
diff
changeset
 | 
93  | 
  "_binds"      :: [letbind, letbinds] => letbinds  ("_;/ _")
 | 
| 
 
7361ac9b024d
removed quotes from types in consts and syntax sections
 
clasohm 
parents: 
1273 
diff
changeset
 | 
94  | 
  "_Let"        :: [letbinds, 'a] => 'a             ("(let (_)/ in (_))" 10)
 | 
| 923 | 95  | 
|
96  | 
(* Case expressions *)  | 
|
97  | 
||
| 
1370
 
7361ac9b024d
removed quotes from types in consts and syntax sections
 
clasohm 
parents: 
1273 
diff
changeset
 | 
98  | 
  "@case"       :: ['a, cases_syn] => 'b            ("(case _ of/ _)" 10)
 | 
| 
 
7361ac9b024d
removed quotes from types in consts and syntax sections
 
clasohm 
parents: 
1273 
diff
changeset
 | 
99  | 
  "@case1"      :: ['a, 'b] => case_syn             ("(2_ =>/ _)" 10)
 | 
| 
 
7361ac9b024d
removed quotes from types in consts and syntax sections
 
clasohm 
parents: 
1273 
diff
changeset
 | 
100  | 
  ""            :: case_syn => cases_syn            ("_")
 | 
| 
 
7361ac9b024d
removed quotes from types in consts and syntax sections
 
clasohm 
parents: 
1273 
diff
changeset
 | 
101  | 
  "@case2"      :: [case_syn, cases_syn] => cases_syn   ("_/ | _")
 | 
| 923 | 102  | 
|
103  | 
translations  | 
|
| 
7238
 
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
 
wenzelm 
parents: 
7220 
diff
changeset
 | 
104  | 
"x ~= y" == "~ (x = y)"  | 
| 
 
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
 
wenzelm 
parents: 
7220 
diff
changeset
 | 
105  | 
"SOME x. P" == "Eps (%x. P)"  | 
| 923 | 106  | 
"_Let (_binds b bs) e" == "_Let b (_Let bs e)"  | 
| 1114 | 107  | 
"let x = a in e" == "Let a (%x. e)"  | 
| 923 | 108  | 
|
| 3820 | 109  | 
syntax ("" output)
 | 
110  | 
  "op ="        :: ['a, 'a] => bool                 ("(_ =/ _)" [51, 51] 50)
 | 
|
111  | 
  "op ~="       :: ['a, 'a] => bool                 ("(_ ~=/ _)" [51, 51] 50)
 | 
|
| 2260 | 112  | 
|
113  | 
syntax (symbols)  | 
|
| 2762 | 114  | 
  Not           :: bool => bool                     ("\\<not> _" [40] 40)
 | 
| 2260 | 115  | 
"op &" :: [bool, bool] => bool (infixr "\\<and>" 35)  | 
116  | 
"op |" :: [bool, bool] => bool (infixr "\\<or>" 30)  | 
|
117  | 
"op -->" :: [bool, bool] => bool (infixr "\\<midarrow>\\<rightarrow>" 25)  | 
|
118  | 
"op o" :: ['b => 'c, 'a => 'b, 'a] => 'c (infixl "\\<circ>" 55)  | 
|
119  | 
"op ~=" :: ['a, 'a] => bool (infixl "\\<noteq>" 50)  | 
|
| 
7238
 
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
 
wenzelm 
parents: 
7220 
diff
changeset
 | 
120  | 
  "_Eps"        :: [pttrn, bool] => 'a              ("(3\\<epsilon>_./ _)" [0, 10] 10)
 | 
| 
 
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
 
wenzelm 
parents: 
7220 
diff
changeset
 | 
121  | 
  "ALL "        :: [idts, bool] => bool             ("(3\\<forall>_./ _)" [0, 10] 10)
 | 
| 
 
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
 
wenzelm 
parents: 
7220 
diff
changeset
 | 
122  | 
  "EX "         :: [idts, bool] => bool             ("(3\\<exists>_./ _)" [0, 10] 10)
 | 
| 
 
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
 
wenzelm 
parents: 
7220 
diff
changeset
 | 
123  | 
  "EX! "        :: [idts, bool] => bool             ("(3\\<exists>!_./ _)" [0, 10] 10)
 | 
| 2552 | 124  | 
  "@case1"      :: ['a, 'b] => case_syn             ("(2_ \\<Rightarrow>/ _)" 10)
 | 
| 
3068
 
b7562e452816
deactivated new symbols (not yet printable on xterm, emacs);
 
wenzelm 
parents: 
3066 
diff
changeset
 | 
125  | 
(*"@case2"      :: [case_syn, cases_syn] => cases_syn   ("_/ \\<orelse> _")*)
 | 
| 2372 | 126  | 
|
| 3820 | 127  | 
syntax (symbols output)  | 
128  | 
  "op ~="       :: ['a, 'a] => bool                 ("(_ \\<noteq>/ _)" [51, 51] 50)
 | 
|
129  | 
||
| 
6027
 
9dd06eeda95c
added new print_mode "xsymbols" for extended symbol support
 
oheimb 
parents: 
5786 
diff
changeset
 | 
130  | 
syntax (xsymbols)  | 
| 
 
9dd06eeda95c
added new print_mode "xsymbols" for extended symbol support
 
oheimb 
parents: 
5786 
diff
changeset
 | 
131  | 
"op -->" :: [bool, bool] => bool (infixr "\\<longrightarrow>" 25)  | 
| 2260 | 132  | 
|
| 6340 | 133  | 
syntax (HTML output)  | 
134  | 
  Not           :: bool => bool                     ("\\<not> _" [40] 40)
 | 
|
135  | 
||
| 
7238
 
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
 
wenzelm 
parents: 
7220 
diff
changeset
 | 
136  | 
syntax (HOL)  | 
| 
 
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
 
wenzelm 
parents: 
7220 
diff
changeset
 | 
137  | 
  "_Eps"        :: [pttrn, bool] => 'a              ("(3@ _./ _)" [0, 10] 10)
 | 
| 
 
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
 
wenzelm 
parents: 
7220 
diff
changeset
 | 
138  | 
  "ALL "        :: [idts, bool] => bool             ("(3! _./ _)" [0, 10] 10)
 | 
| 
 
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
 
wenzelm 
parents: 
7220 
diff
changeset
 | 
139  | 
  "EX "         :: [idts, bool] => bool             ("(3? _./ _)" [0, 10] 10)
 | 
| 
 
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
 
wenzelm 
parents: 
7220 
diff
changeset
 | 
140  | 
  "EX! "        :: [idts, bool] => bool             ("(3?! _./ _)" [0, 10] 10)
 | 
| 
 
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
 
wenzelm 
parents: 
7220 
diff
changeset
 | 
141  | 
|
| 
 
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
 
wenzelm 
parents: 
7220 
diff
changeset
 | 
142  | 
|
| 6340 | 143  | 
|
| 2260 | 144  | 
(** Rules and definitions **)  | 
145  | 
||
| 3947 | 146  | 
local  | 
147  | 
||
| 923 | 148  | 
rules  | 
149  | 
||
150  | 
eq_reflection "(x=y) ==> (x==y)"  | 
|
151  | 
||
152  | 
(* Basic Rules *)  | 
|
153  | 
||
154  | 
refl "t = (t::'a)"  | 
|
155  | 
subst "[| s = t; P(s) |] ==> P(t::'a)"  | 
|
| 6289 | 156  | 
|
157  | 
(*Extensionality is built into the meta-logic, and this rule expresses  | 
|
158  | 
a related property. It is an eta-expanded version of the traditional  | 
|
159  | 
rule, and similar to the ABS rule of HOL.*)  | 
|
| 3842 | 160  | 
ext "(!!x::'a. (f x ::'b) = g x) ==> (%x. f x) = (%x. g x)"  | 
| 6289 | 161  | 
|
| 3842 | 162  | 
selectI "P (x::'a) ==> P (@x. P x)"  | 
| 923 | 163  | 
|
164  | 
impI "(P ==> Q) ==> P-->Q"  | 
|
165  | 
mp "[| P-->Q; P |] ==> Q"  | 
|
166  | 
||
167  | 
defs  | 
|
168  | 
||
| 3842 | 169  | 
True_def "True == ((%x::bool. x) = (%x. x))"  | 
170  | 
All_def "All(P) == (P = (%x. True))"  | 
|
171  | 
Ex_def "Ex(P) == P(@x. P(x))"  | 
|
172  | 
False_def "False == (!P. P)"  | 
|
| 923 | 173  | 
not_def "~ P == P-->False"  | 
174  | 
and_def "P & Q == !R. (P-->Q-->R) --> R"  | 
|
175  | 
or_def "P | Q == !R. (P-->R) --> (Q-->R) --> R"  | 
|
176  | 
Ex1_def "Ex1(P) == ? x. P(x) & (! y. P(y) --> y=x)"  | 
|
177  | 
||
178  | 
rules  | 
|
179  | 
(* Axioms *)  | 
|
180  | 
||
181  | 
iff "(P-->Q) --> (Q-->P) --> (P=Q)"  | 
|
182  | 
True_or_False "(P=True) | (P=False)"  | 
|
183  | 
||
184  | 
defs  | 
|
| 5069 | 185  | 
(*misc definitions*)  | 
| 923 | 186  | 
Let_def "Let s f == f(s)"  | 
| 973 | 187  | 
if_def "If P x y == @z::'a. (P=True --> z=x) & (P=False --> z=y)"  | 
| 5069 | 188  | 
|
189  | 
(*arbitrary is completely unspecified, but is made to appear as a  | 
|
190  | 
definition syntactically*)  | 
|
| 
4371
 
8755cdbbf6b3
improved arbitrary_def: we now really don't know nothing about it!
 
wenzelm 
parents: 
4083 
diff
changeset
 | 
191  | 
arbitrary_def "False ==> arbitrary == (@x. False)"  | 
| 923 | 192  | 
|
| 3320 | 193  | 
|
| 4868 | 194  | 
|
195  | 
(** initial HOL theory setup **)  | 
|
196  | 
||
197  | 
setup Simplifier.setup  | 
|
198  | 
setup ClasetThyData.setup  | 
|
199  | 
||
200  | 
||
| 923 | 201  | 
end  |