author  paulson 
Tue, 05 Sep 2000 10:14:36 +0200  
changeset 9839  da5ca8b30244 
parent 9736  332fab43628f 
child 9852  6ca7fcac3e23 
permissions  rwrr 
923  1 
(* Title: HOL/HOL.thy 
2 
ID: $Id$ 

3 
Author: Tobias Nipkow 

4 
Copyright 1993 University of Cambridge 

5 

2260  6 
HigherOrder Logic. 
923  7 
*) 
8 

7357  9 
theory HOL = CPure 
9839
da5ca8b30244
loads Tools/meson.ML: meson_tac installed by default
paulson
parents:
9736
diff
changeset

10 
files ("HOL_lemmas.ML") ("cladata.ML") ("blastdata.ML") ("simpdata.ML") 
da5ca8b30244
loads Tools/meson.ML: meson_tac installed by default
paulson
parents:
9736
diff
changeset

11 
("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 

28 
consts 

29 

30 
(* Constants *) 

31 

7357  32 
Trueprop :: "bool => prop" ("(_)" 5) 
33 
Not :: "bool => bool" ("~ _" [40] 40) 

34 
True :: bool 

35 
False :: bool 

36 
If :: "[bool, 'a, 'a] => 'a" ("(if (_)/ then (_)/ else (_))" 10) 

3947  37 
arbitrary :: 'a 
923  38 

39 
(* Binders *) 

40 

7357  41 
Eps :: "('a => bool) => 'a" 
42 
All :: "('a => bool) => bool" (binder "ALL " 10) 

43 
Ex :: "('a => bool) => bool" (binder "EX " 10) 

44 
Ex1 :: "('a => bool) => bool" (binder "EX! " 10) 

45 
Let :: "['a, 'a => 'b] => 'b" 

923  46 

47 
(* Infixes *) 

48 

7357  49 
"=" :: "['a, 'a] => bool" (infixl 50) 
50 
& :: "[bool, bool] => bool" (infixr 35) 

51 
"" :: "[bool, bool] => bool" (infixr 30) 

52 
> :: "[bool, bool] => bool" (infixr 25) 

923  53 

2260  54 

55 
(* Overloaded Constants *) 

56 

8940  57 
axclass zero < "term" 
58 
axclass plus < "term" 

7357  59 
axclass minus < "term" 
60 
axclass times < "term" 

61 
axclass power < "term" 

3370
5c5fdce3a4e4
Overloading of "^" requires new type class "power", with types "nat" and
paulson
parents:
3320
diff
changeset

62 

2260  63 
consts 
8940  64 
"0" :: "('a::zero)" ("0") 
7357  65 
"+" :: "['a::plus, 'a] => 'a" (infixl 65) 
66 
 :: "['a::minus, 'a] => 'a" (infixl 65) 

67 
uminus :: "['a::minus] => 'a" (" _" [81] 80) 

8800  68 
abs :: "('a::minus) => 'a" 
7426  69 
* :: "['a::times, 'a] => 'a" (infixl 70) 
3370
5c5fdce3a4e4
Overloading of "^" requires new type class "power", with types "nat" and
paulson
parents:
3320
diff
changeset

70 
(*See Nat.thy for "^"*) 
2260  71 

8959  72 
axclass plus_ac0 < plus, zero 
73 
commute: "x + y = y + x" 

74 
assoc: "(x + y) + z = x + (y + z)" 

75 
zero: "0 + x = x" 

3820  76 

7238
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
7220
diff
changeset

77 

2260  78 
(** Additional concrete syntax **) 
79 

4868  80 
nonterminals 
923  81 
letbinds letbind 
82 
case_syn cases_syn 

83 

84 
syntax 

7357  85 
~= :: "['a, 'a] => bool" (infixl 50) 
86 
"_Eps" :: "[pttrn, bool] => 'a" ("(3SOME _./ _)" [0, 10] 10) 

923  87 

88 
(* Let expressions *) 

89 

7357  90 
"_bind" :: "[pttrn, 'a] => letbind" ("(2_ =/ _)" 10) 
91 
"" :: "letbind => letbinds" ("_") 

92 
"_binds" :: "[letbind, letbinds] => letbinds" ("_;/ _") 

93 
"_Let" :: "[letbinds, 'a] => 'a" ("(let (_)/ in (_))" 10) 

923  94 

95 
(* Case expressions *) 

96 

9060
b0dd884b1848
rename @case to _case_syntax (improves on lowlevel errors);
wenzelm
parents:
8959
diff
changeset

97 
"_case_syntax":: "['a, cases_syn] => 'b" ("(case _ of/ _)" 10) 
b0dd884b1848
rename @case to _case_syntax (improves on lowlevel errors);
wenzelm
parents:
8959
diff
changeset

98 
"_case1" :: "['a, 'b] => case_syn" ("(2_ =>/ _)" 10) 
7357  99 
"" :: "case_syn => cases_syn" ("_") 
9060
b0dd884b1848
rename @case to _case_syntax (improves on lowlevel errors);
wenzelm
parents:
8959
diff
changeset

100 
"_case2" :: "[case_syn, cases_syn] => cases_syn" ("_/  _") 
923  101 

102 
translations 

7238
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
7220
diff
changeset

103 
"x ~= y" == "~ (x = y)" 
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
7220
diff
changeset

104 
"SOME x. P" == "Eps (%x. P)" 
923  105 
"_Let (_binds b bs) e" == "_Let b (_Let bs e)" 
1114  106 
"let x = a in e" == "Let a (%x. e)" 
923  107 

3820  108 
syntax ("" output) 
7357  109 
"op =" :: "['a, 'a] => bool" ("(_ =/ _)" [51, 51] 50) 
110 
"op ~=" :: "['a, 'a] => bool" ("(_ ~=/ _)" [51, 51] 50) 

2260  111 

112 
syntax (symbols) 

7357  113 
Not :: "bool => bool" ("\\<not> _" [40] 40) 
114 
"op &" :: "[bool, bool] => bool" (infixr "\\<and>" 35) 

115 
"op " :: "[bool, bool] => bool" (infixr "\\<or>" 30) 

116 
"op >" :: "[bool, bool] => bool" (infixr "\\<midarrow>\\<rightarrow>" 25) 

117 
"op ~=" :: "['a, 'a] => bool" (infixl "\\<noteq>" 50) 

118 
"_Eps" :: "[pttrn, bool] => 'a" ("(3\\<epsilon>_./ _)" [0, 10] 10) 

119 
"ALL " :: "[idts, bool] => bool" ("(3\\<forall>_./ _)" [0, 10] 10) 

120 
"EX " :: "[idts, bool] => bool" ("(3\\<exists>_./ _)" [0, 10] 10) 

121 
"EX! " :: "[idts, bool] => bool" ("(3\\<exists>!_./ _)" [0, 10] 10) 

9060
b0dd884b1848
rename @case to _case_syntax (improves on lowlevel errors);
wenzelm
parents:
8959
diff
changeset

122 
"_case1" :: "['a, 'b] => case_syn" ("(2_ \\<Rightarrow>/ _)" 10) 
b0dd884b1848
rename @case to _case_syntax (improves on lowlevel errors);
wenzelm
parents:
8959
diff
changeset

123 
(*"_case2" :: "[case_syn, cases_syn] => cases_syn" ("_/ \\<orelse> _")*) 
2372  124 

3820  125 
syntax (symbols output) 
7357  126 
"op ~=" :: "['a, 'a] => bool" ("(_ \\<noteq>/ _)" [51, 51] 50) 
3820  127 

6027
9dd06eeda95c
added new print_mode "xsymbols" for extended symbol support
oheimb
parents:
5786
diff
changeset

128 
syntax (xsymbols) 
7357  129 
"op >" :: "[bool, bool] => bool" (infixr "\\<longrightarrow>" 25) 
2260  130 

6340  131 
syntax (HTML output) 
7357  132 
Not :: "bool => bool" ("\\<not> _" [40] 40) 
6340  133 

7238
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
7220
diff
changeset

134 
syntax (HOL) 
7357  135 
"_Eps" :: "[pttrn, bool] => 'a" ("(3@ _./ _)" [0, 10] 10) 
136 
"ALL " :: "[idts, bool] => bool" ("(3! _./ _)" [0, 10] 10) 

137 
"EX " :: "[idts, bool] => bool" ("(3? _./ _)" [0, 10] 10) 

138 
"EX! " :: "[idts, bool] => bool" ("(3?! _./ _)" [0, 10] 10) 

7238
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
7220
diff
changeset

139 

36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
7220
diff
changeset

140 

6340  141 

2260  142 
(** Rules and definitions **) 
143 

3947  144 
local 
145 

7357  146 
axioms 
923  147 

7357  148 
eq_reflection: "(x=y) ==> (x==y)" 
923  149 

150 
(* Basic Rules *) 

151 

7357  152 
refl: "t = (t::'a)" 
153 
subst: "[ s = t; P(s) ] ==> P(t::'a)" 

6289  154 

155 
(*Extensionality is built into the metalogic, and this rule expresses 

156 
a related property. It is an etaexpanded version of the traditional 

157 
rule, and similar to the ABS rule of HOL.*) 

7357  158 
ext: "(!!x::'a. (f x ::'b) = g x) ==> (%x. f x) = (%x. g x)" 
6289  159 

7357  160 
selectI: "P (x::'a) ==> P (@x. P x)" 
923  161 

7357  162 
impI: "(P ==> Q) ==> P>Q" 
163 
mp: "[ P>Q; P ] ==> Q" 

923  164 

165 
defs 

166 

7357  167 
True_def: "True == ((%x::bool. x) = (%x. x))" 
168 
All_def: "All(P) == (P = (%x. True))" 

169 
Ex_def: "Ex(P) == P(@x. P(x))" 

170 
False_def: "False == (!P. P)" 

171 
not_def: "~ P == P>False" 

172 
and_def: "P & Q == !R. (P>Q>R) > R" 

173 
or_def: "P  Q == !R. (P>R) > (Q>R) > R" 

174 
Ex1_def: "Ex1(P) == ? x. P(x) & (! y. P(y) > y=x)" 

923  175 

7357  176 
axioms 
923  177 
(* Axioms *) 
178 

7357  179 
iff: "(P>Q) > (Q>P) > (P=Q)" 
180 
True_or_False: "(P=True)  (P=False)" 

923  181 

182 
defs 

5069  183 
(*misc definitions*) 
7357  184 
Let_def: "Let s f == f(s)" 
185 
if_def: "If P x y == @z::'a. (P=True > z=x) & (P=False > z=y)" 

5069  186 

187 
(*arbitrary is completely unspecified, but is made to appear as a 

188 
definition syntactically*) 

7357  189 
arbitrary_def: "False ==> arbitrary == (@x. False)" 
923  190 

3320  191 

4868  192 

7357  193 
(* theory and package setup *) 
4868  194 

9736  195 
use "HOL_lemmas.ML" 
9529  196 
use "cladata.ML" setup hypsubst_setup setup Classical.setup setup clasetup 
9488  197 

198 
lemma all_eq: "(!!x. P x) == Trueprop (ALL x. P x)" 

199 
proof (rule equal_intr_rule) 

200 
assume "!!x. P x" 

201 
show "ALL x. P x" .. 

202 
next 

203 
assume "ALL x. P x" 

204 
thus "!!x. P x" .. 

205 
qed 

206 

207 
lemma imp_eq: "(A ==> B) == Trueprop (A > B)" 

208 
proof (rule equal_intr_rule) 

209 
assume r: "A ==> B" 

210 
show "A > B" 

211 
by (rule) (rule r) 

212 
next 

213 
assume "A > B" and A 

214 
thus B .. 

215 
qed 

216 

9529  217 
lemmas atomize = all_eq imp_eq 
218 

7357  219 
use "blastdata.ML" setup Blast.setup 
8473  220 
use "simpdata.ML" setup Simplifier.setup 
9713  221 
setup "Simplifier.method_setup Splitter.split_modifiers" setup simpsetup 
8640  222 
setup Splitter.setup setup Clasimp.setup setup iff_attrib_setup 
9736  223 
setup attrib_setup 
4868  224 

9839
da5ca8b30244
loads Tools/meson.ML: meson_tac installed by default
paulson
parents:
9736
diff
changeset

225 
use "Tools/meson.ML" 
da5ca8b30244
loads Tools/meson.ML: meson_tac installed by default
paulson
parents:
9736
diff
changeset

226 

923  227 
end 