author  wenzelm 
Fri, 03 Nov 2000 21:31:11 +0100  
changeset 10383  a092ae7bb2a6 
parent 9970  dfe4747c8318 
child 10432  3dfbc913d184 
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 
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 

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 

9869  57 
axclass zero < "term" 
8940  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) 

9869  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 
"ALL " :: "[idts, bool] => bool" ("(3\\<forall>_./ _)" [0, 10] 10) 

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

120 
"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

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

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

9950  124 
syntax (input) 
125 
"_Eps" :: "[pttrn, bool] => 'a" ("(3\\<epsilon>_./ _)" [0, 10] 10) 

126 

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

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

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

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

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

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

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

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

7238
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 

7357  148 
axioms 
923  149 

7357  150 
eq_reflection: "(x=y) ==> (x==y)" 
923  151 

152 
(* Basic Rules *) 

153 

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

6289  156 

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

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

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

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

9970  162 
someI: "P (x::'a) ==> P (@x. P x)" 
923  163 

7357  164 
impI: "(P ==> Q) ==> P>Q" 
165 
mp: "[ P>Q; P ] ==> Q" 

923  166 

167 
defs 

168 

7357  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)" 

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)" 

923  177 

7357  178 
axioms 
923  179 
(* Axioms *) 
180 

7357  181 
iff: "(P>Q) > (Q>P) > (P=Q)" 
182 
True_or_False: "(P=True)  (P=False)" 

923  183 

184 
defs 

5069  185 
(*misc definitions*) 
7357  186 
Let_def: "Let s f == f(s)" 
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*) 

7357  191 
arbitrary_def: "False ==> arbitrary == (@x. False)" 
923  192 

3320  193 

4868  194 

7357  195 
(* theory and package setup *) 
4868  196 

9736  197 
use "HOL_lemmas.ML" 
9869  198 

9488  199 
lemma all_eq: "(!!x. P x) == Trueprop (ALL x. P x)" 
200 
proof (rule equal_intr_rule) 

201 
assume "!!x. P x" 

10383  202 
show "ALL x. P x" by (rule allI) 
9488  203 
next 
204 
assume "ALL x. P x" 

10383  205 
thus "!!x. P x" by (rule allE) 
9488  206 
qed 
207 

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

209 
proof (rule equal_intr_rule) 

210 
assume r: "A ==> B" 

10383  211 
show "A > B" by (rule impI) (rule r) 
9488  212 
next 
213 
assume "A > B" and A 

10383  214 
thus B by (rule mp) 
9488  215 
qed 
216 

9529  217 
lemmas atomize = all_eq imp_eq 
218 

10383  219 
use "cladata.ML" 
220 
setup hypsubst_setup 

221 
setup Classical.setup 

222 
setup clasetup 

223 

9869  224 
use "blastdata.ML" 
225 
setup Blast.setup 

4868  226 

9869  227 
use "simpdata.ML" 
228 
setup Simplifier.setup 

229 
setup "Simplifier.method_setup Splitter.split_modifiers" setup simpsetup 

230 
setup Splitter.setup setup Clasimp.setup 

231 

232 
use "meson_lemmas.ML" 

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

233 
use "Tools/meson.ML" 
9869  234 
setup meson_setup 
9839
da5ca8b30244
loads Tools/meson.ML: meson_tac installed by default
paulson
parents:
9736
diff
changeset

235 

923  236 
end 