author | haftmann |
Thu, 04 Oct 2007 19:54:44 +0200 | |
changeset 24844 | 98c006a30218 |
parent 24842 | 2bdf31a97362 |
child 24901 | d3cbf79769b9 |
permissions | -rw-r--r-- |
923 | 1 |
(* Title: HOL/HOL.thy |
2 |
ID: $Id$ |
|
11750 | 3 |
Author: Tobias Nipkow, Markus Wenzel, and Larry Paulson |
4 |
*) |
|
923 | 5 |
|
11750 | 6 |
header {* The basis of Higher-Order Logic *} |
923 | 7 |
|
15131 | 8 |
theory HOL |
15140 | 9 |
imports CPure |
23163 | 10 |
uses |
23553 | 11 |
("hologic.ML") |
23171 | 12 |
"~~/src/Tools/IsaPlanner/zipper.ML" |
13 |
"~~/src/Tools/IsaPlanner/isand.ML" |
|
14 |
"~~/src/Tools/IsaPlanner/rw_tools.ML" |
|
15 |
"~~/src/Tools/IsaPlanner/rw_inst.ML" |
|
23263 | 16 |
"~~/src/Provers/project_rule.ML" |
17 |
"~~/src/Provers/hypsubst.ML" |
|
18 |
"~~/src/Provers/splitter.ML" |
|
23163 | 19 |
"~~/src/Provers/classical.ML" |
20 |
"~~/src/Provers/blast.ML" |
|
21 |
"~~/src/Provers/clasimp.ML" |
|
23263 | 22 |
"~~/src/Provers/eqsubst.ML" |
23163 | 23 |
"~~/src/Provers/quantifier1.ML" |
24 |
("simpdata.ML") |
|
24280 | 25 |
"~~/src/Tools/code/code_name.ML" |
26 |
"~~/src/Tools/code/code_funcgr.ML" |
|
27 |
"~~/src/Tools/code/code_thingol.ML" |
|
28 |
"~~/src/Tools/code/code_target.ML" |
|
29 |
"~~/src/Tools/code/code_package.ML" |
|
24166 | 30 |
"~~/src/Tools/nbe.ML" |
24830
a7b3ab44d993
moved Pure/Isar/induct_attrib.ML and Provers/induct_method.ML to Tools/induct.ML;
wenzelm
parents:
24748
diff
changeset
|
31 |
"~~/src/Tools/induct.ML" |
15131 | 32 |
begin |
2260 | 33 |
|
11750 | 34 |
subsection {* Primitive logic *} |
35 |
||
36 |
subsubsection {* Core syntax *} |
|
2260 | 37 |
|
14854 | 38 |
classes type |
12338
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
12281
diff
changeset
|
39 |
defaultsort type |
3947 | 40 |
|
12338
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
12281
diff
changeset
|
41 |
global |
923 | 42 |
|
7357 | 43 |
typedecl bool |
923 | 44 |
|
45 |
arities |
|
12338
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
12281
diff
changeset
|
46 |
bool :: type |
20590
bf92900995f8
introduced syntactic classes; moved some setup to Pure/codegen, Pure/nbe or OperationalEquality.thy
haftmann
parents:
20453
diff
changeset
|
47 |
"fun" :: (type, type) type |
923 | 48 |
|
11750 | 49 |
judgment |
50 |
Trueprop :: "bool => prop" ("(_)" 5) |
|
923 | 51 |
|
11750 | 52 |
consts |
7357 | 53 |
Not :: "bool => bool" ("~ _" [40] 40) |
54 |
True :: bool |
|
55 |
False :: bool |
|
3947 | 56 |
arbitrary :: 'a |
923 | 57 |
|
11432
8a203ae6efe3
added "The" (definite description operator) (by Larry);
wenzelm
parents:
10489
diff
changeset
|
58 |
The :: "('a => bool) => 'a" |
7357 | 59 |
All :: "('a => bool) => bool" (binder "ALL " 10) |
60 |
Ex :: "('a => bool) => bool" (binder "EX " 10) |
|
61 |
Ex1 :: "('a => bool) => bool" (binder "EX! " 10) |
|
62 |
Let :: "['a, 'a => 'b] => 'b" |
|
923 | 63 |
|
22839 | 64 |
"op =" :: "['a, 'a] => bool" (infixl "=" 50) |
65 |
"op &" :: "[bool, bool] => bool" (infixr "&" 35) |
|
66 |
"op |" :: "[bool, bool] => bool" (infixr "|" 30) |
|
67 |
"op -->" :: "[bool, bool] => bool" (infixr "-->" 25) |
|
923 | 68 |
|
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
69 |
local |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
70 |
|
16587 | 71 |
consts |
72 |
If :: "[bool, 'a, 'a] => 'a" ("(if (_)/ then (_)/ else (_))" 10) |
|
2260 | 73 |
|
19656
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19607
diff
changeset
|
74 |
|
11750 | 75 |
subsubsection {* Additional concrete syntax *} |
2260 | 76 |
|
21210 | 77 |
notation (output) |
19656
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19607
diff
changeset
|
78 |
"op =" (infix "=" 50) |
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19607
diff
changeset
|
79 |
|
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19607
diff
changeset
|
80 |
abbreviation |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21250
diff
changeset
|
81 |
not_equal :: "['a, 'a] => bool" (infixl "~=" 50) where |
19656
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19607
diff
changeset
|
82 |
"x ~= y == ~ (x = y)" |
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19607
diff
changeset
|
83 |
|
21210 | 84 |
notation (output) |
19656
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19607
diff
changeset
|
85 |
not_equal (infix "~=" 50) |
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19607
diff
changeset
|
86 |
|
21210 | 87 |
notation (xsymbols) |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21250
diff
changeset
|
88 |
Not ("\<not> _" [40] 40) and |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21250
diff
changeset
|
89 |
"op &" (infixr "\<and>" 35) and |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21250
diff
changeset
|
90 |
"op |" (infixr "\<or>" 30) and |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21250
diff
changeset
|
91 |
"op -->" (infixr "\<longrightarrow>" 25) and |
19656
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19607
diff
changeset
|
92 |
not_equal (infix "\<noteq>" 50) |
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19607
diff
changeset
|
93 |
|
21210 | 94 |
notation (HTML output) |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21250
diff
changeset
|
95 |
Not ("\<not> _" [40] 40) and |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21250
diff
changeset
|
96 |
"op &" (infixr "\<and>" 35) and |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21250
diff
changeset
|
97 |
"op |" (infixr "\<or>" 30) and |
19656
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19607
diff
changeset
|
98 |
not_equal (infix "\<noteq>" 50) |
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19607
diff
changeset
|
99 |
|
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19607
diff
changeset
|
100 |
abbreviation (iff) |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21250
diff
changeset
|
101 |
iff :: "[bool, bool] => bool" (infixr "<->" 25) where |
19656
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19607
diff
changeset
|
102 |
"A <-> B == A = B" |
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19607
diff
changeset
|
103 |
|
21210 | 104 |
notation (xsymbols) |
19656
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19607
diff
changeset
|
105 |
iff (infixr "\<longleftrightarrow>" 25) |
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19607
diff
changeset
|
106 |
|
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19607
diff
changeset
|
107 |
|
4868 | 108 |
nonterminals |
923 | 109 |
letbinds letbind |
110 |
case_syn cases_syn |
|
111 |
||
112 |
syntax |
|
11432
8a203ae6efe3
added "The" (definite description operator) (by Larry);
wenzelm
parents:
10489
diff
changeset
|
113 |
"_The" :: "[pttrn, bool] => 'a" ("(3THE _./ _)" [0, 10] 10) |
923 | 114 |
|
7357 | 115 |
"_bind" :: "[pttrn, 'a] => letbind" ("(2_ =/ _)" 10) |
116 |
"" :: "letbind => letbinds" ("_") |
|
117 |
"_binds" :: "[letbind, letbinds] => letbinds" ("_;/ _") |
|
118 |
"_Let" :: "[letbinds, 'a] => 'a" ("(let (_)/ in (_))" 10) |
|
923 | 119 |
|
9060
b0dd884b1848
rename @case to _case_syntax (improves on low-level errors);
wenzelm
parents:
8959
diff
changeset
|
120 |
"_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
|
121 |
"_case1" :: "['a, 'b] => case_syn" ("(2_ =>/ _)" 10) |
7357 | 122 |
"" :: "case_syn => cases_syn" ("_") |
9060
b0dd884b1848
rename @case to _case_syntax (improves on low-level errors);
wenzelm
parents:
8959
diff
changeset
|
123 |
"_case2" :: "[case_syn, cases_syn] => cases_syn" ("_/ | _") |
923 | 124 |
|
125 |
translations |
|
13764 | 126 |
"THE x. P" == "The (%x. P)" |
923 | 127 |
"_Let (_binds b bs) e" == "_Let b (_Let bs e)" |
1114 | 128 |
"let x = a in e" == "Let a (%x. e)" |
923 | 129 |
|
13763
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13723
diff
changeset
|
130 |
print_translation {* |
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13723
diff
changeset
|
131 |
(* To avoid eta-contraction of body: *) |
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13723
diff
changeset
|
132 |
[("The", fn [Abs abs] => |
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13723
diff
changeset
|
133 |
let val (x,t) = atomic_abs_tr' abs |
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13723
diff
changeset
|
134 |
in Syntax.const "_The" $ x $ t end)] |
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13723
diff
changeset
|
135 |
*} |
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13723
diff
changeset
|
136 |
|
12114
a8e860c86252
eliminated old "symbols" syntax, use "xsymbols" instead;
wenzelm
parents:
12023
diff
changeset
|
137 |
syntax (xsymbols) |
11687 | 138 |
"_case1" :: "['a, 'b] => case_syn" ("(2_ \<Rightarrow>/ _)" 10) |
21524 | 139 |
|
140 |
notation (xsymbols) |
|
141 |
All (binder "\<forall>" 10) and |
|
142 |
Ex (binder "\<exists>" 10) and |
|
143 |
Ex1 (binder "\<exists>!" 10) |
|
2372 | 144 |
|
21524 | 145 |
notation (HTML output) |
146 |
All (binder "\<forall>" 10) and |
|
147 |
Ex (binder "\<exists>" 10) and |
|
148 |
Ex1 (binder "\<exists>!" 10) |
|
6340 | 149 |
|
21524 | 150 |
notation (HOL) |
151 |
All (binder "! " 10) and |
|
152 |
Ex (binder "? " 10) and |
|
153 |
Ex1 (binder "?! " 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 |
|
11750 | 156 |
subsubsection {* Axioms and basic definitions *} |
2260 | 157 |
|
7357 | 158 |
axioms |
15380 | 159 |
eq_reflection: "(x=y) ==> (x==y)" |
923 | 160 |
|
15380 | 161 |
refl: "t = (t::'a)" |
6289 | 162 |
|
15380 | 163 |
ext: "(!!x::'a. (f x ::'b) = g x) ==> (%x. f x) = (%x. g x)" |
164 |
-- {*Extensionality is built into the meta-logic, and this rule expresses |
|
165 |
a related property. It is an eta-expanded version of the traditional |
|
166 |
rule, and similar to the ABS rule of HOL*} |
|
6289 | 167 |
|
11432
8a203ae6efe3
added "The" (definite description operator) (by Larry);
wenzelm
parents:
10489
diff
changeset
|
168 |
the_eq_trivial: "(THE x. x = a) = (a::'a)" |
923 | 169 |
|
15380 | 170 |
impI: "(P ==> Q) ==> P-->Q" |
171 |
mp: "[| P-->Q; P |] ==> Q" |
|
172 |
||
173 |
||
923 | 174 |
defs |
7357 | 175 |
True_def: "True == ((%x::bool. x) = (%x. x))" |
176 |
All_def: "All(P) == (P = (%x. True))" |
|
11451
8abfb4f7bd02
partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
11438
diff
changeset
|
177 |
Ex_def: "Ex(P) == !Q. (!x. P x --> Q) --> Q" |
7357 | 178 |
False_def: "False == (!P. P)" |
179 |
not_def: "~ P == P-->False" |
|
180 |
and_def: "P & Q == !R. (P-->Q-->R) --> R" |
|
181 |
or_def: "P | Q == !R. (P-->R) --> (Q-->R) --> R" |
|
182 |
Ex1_def: "Ex1(P) == ? x. P(x) & (! y. P(y) --> y=x)" |
|
923 | 183 |
|
7357 | 184 |
axioms |
185 |
iff: "(P-->Q) --> (Q-->P) --> (P=Q)" |
|
186 |
True_or_False: "(P=True) | (P=False)" |
|
923 | 187 |
|
188 |
defs |
|
24219 | 189 |
Let_def: "Let s f == f(s)" |
11451
8abfb4f7bd02
partial restructuring to reduce dependence on Axiom of Choice
paulson
parents:
11438
diff
changeset
|
190 |
if_def: "If P x y == THE z::'a. (P=True --> z=x) & (P=False --> z=y)" |
5069 | 191 |
|
14223
0ee05eef881b
Added support for making constants final, that is, ensuring that no
skalberg
parents:
14208
diff
changeset
|
192 |
finalconsts |
0ee05eef881b
Added support for making constants final, that is, ensuring that no
skalberg
parents:
14208
diff
changeset
|
193 |
"op =" |
0ee05eef881b
Added support for making constants final, that is, ensuring that no
skalberg
parents:
14208
diff
changeset
|
194 |
"op -->" |
0ee05eef881b
Added support for making constants final, that is, ensuring that no
skalberg
parents:
14208
diff
changeset
|
195 |
The |
0ee05eef881b
Added support for making constants final, that is, ensuring that no
skalberg
parents:
14208
diff
changeset
|
196 |
arbitrary |
22481
79c2724c36b5
added class "default" and expansion axioms for undefined
haftmann
parents:
22473
diff
changeset
|
197 |
|
79c2724c36b5
added class "default" and expansion axioms for undefined
haftmann
parents:
22473
diff
changeset
|
198 |
axiomatization |
79c2724c36b5
added class "default" and expansion axioms for undefined
haftmann
parents:
22473
diff
changeset
|
199 |
undefined :: 'a |
79c2724c36b5
added class "default" and expansion axioms for undefined
haftmann
parents:
22473
diff
changeset
|
200 |
|
22744
5cbe966d67a2
Isar definitions are now added explicitly to code theorem table
haftmann
parents:
22481
diff
changeset
|
201 |
axiomatization where |
22481
79c2724c36b5
added class "default" and expansion axioms for undefined
haftmann
parents:
22473
diff
changeset
|
202 |
undefined_fun: "undefined x = undefined" |
3320 | 203 |
|
19656
09be06943252
tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents:
19607
diff
changeset
|
204 |
|
22481
79c2724c36b5
added class "default" and expansion axioms for undefined
haftmann
parents:
22473
diff
changeset
|
205 |
subsubsection {* Generic classes and algebraic operations *} |
79c2724c36b5
added class "default" and expansion axioms for undefined
haftmann
parents:
22473
diff
changeset
|
206 |
|
79c2724c36b5
added class "default" and expansion axioms for undefined
haftmann
parents:
22473
diff
changeset
|
207 |
class default = type + |
79c2724c36b5
added class "default" and expansion axioms for undefined
haftmann
parents:
22473
diff
changeset
|
208 |
fixes default :: "'a" |
4868 | 209 |
|
22473 | 210 |
class zero = type + |
21524 | 211 |
fixes zero :: "'a" ("\<^loc>0") |
20713
823967ef47f1
renamed 0 and 1 to HOL.zero and HOL.one respectivly; introduced corresponding syntactic classes
haftmann
parents:
20698
diff
changeset
|
212 |
|
22473 | 213 |
class one = type + |
21524 | 214 |
fixes one :: "'a" ("\<^loc>1") |
20713
823967ef47f1
renamed 0 and 1 to HOL.zero and HOL.one respectivly; introduced corresponding syntactic classes
haftmann
parents:
20698
diff
changeset
|
215 |
|
823967ef47f1
renamed 0 and 1 to HOL.zero and HOL.one respectivly; introduced corresponding syntactic classes
haftmann
parents:
20698
diff
changeset
|
216 |
hide (open) const zero one |
20590
bf92900995f8
introduced syntactic classes; moved some setup to Pure/codegen, Pure/nbe or OperationalEquality.thy
haftmann
parents:
20453
diff
changeset
|
217 |
|
22473 | 218 |
class plus = type + |
21524 | 219 |
fixes plus :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "\<^loc>+" 65) |
11750 | 220 |
|
22473 | 221 |
class minus = type + |
20590
bf92900995f8
introduced syntactic classes; moved some setup to Pure/codegen, Pure/nbe or OperationalEquality.thy
haftmann
parents:
20453
diff
changeset
|
222 |
fixes uminus :: "'a \<Rightarrow> 'a" |
21524 | 223 |
and minus :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "\<^loc>-" 65) |
20590
bf92900995f8
introduced syntactic classes; moved some setup to Pure/codegen, Pure/nbe or OperationalEquality.thy
haftmann
parents:
20453
diff
changeset
|
224 |
|
22473 | 225 |
class times = type + |
20713
823967ef47f1
renamed 0 and 1 to HOL.zero and HOL.one respectivly; introduced corresponding syntactic classes
haftmann
parents:
20698
diff
changeset
|
226 |
fixes times :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "\<^loc>*" 70) |
20590
bf92900995f8
introduced syntactic classes; moved some setup to Pure/codegen, Pure/nbe or OperationalEquality.thy
haftmann
parents:
20453
diff
changeset
|
227 |
|
22473 | 228 |
class inverse = type + |
20590
bf92900995f8
introduced syntactic classes; moved some setup to Pure/codegen, Pure/nbe or OperationalEquality.thy
haftmann
parents:
20453
diff
changeset
|
229 |
fixes inverse :: "'a \<Rightarrow> 'a" |
21524 | 230 |
and divide :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "\<^loc>'/" 70) |
231 |
||
23878 | 232 |
class abs = type + |
233 |
fixes abs :: "'a \<Rightarrow> 'a" |
|
234 |
||
24506 | 235 |
class sgn = type + |
236 |
fixes sgn :: "'a \<Rightarrow> 'a" |
|
237 |
||
21524 | 238 |
notation |
239 |
uminus ("- _" [81] 80) |
|
240 |
||
241 |
notation (xsymbols) |
|
242 |
abs ("\<bar>_\<bar>") |
|
243 |
notation (HTML output) |
|
244 |
abs ("\<bar>_\<bar>") |
|
11750 | 245 |
|
23878 | 246 |
class ord = type + |
24748 | 247 |
fixes less_eq :: "'a \<Rightarrow> 'a \<Rightarrow> bool" |
248 |
and less :: "'a \<Rightarrow> 'a \<Rightarrow> bool" |
|
23878 | 249 |
begin |
250 |
||
251 |
notation |
|
252 |
less_eq ("op \<^loc><=") and |
|
253 |
less_eq ("(_/ \<^loc><= _)" [51, 51] 50) and |
|
254 |
less ("op \<^loc><") and |
|
255 |
less ("(_/ \<^loc>< _)" [51, 51] 50) |
|
256 |
||
257 |
notation (xsymbols) |
|
258 |
less_eq ("op \<^loc>\<le>") and |
|
259 |
less_eq ("(_/ \<^loc>\<le> _)" [51, 51] 50) |
|
260 |
||
261 |
notation (HTML output) |
|
262 |
less_eq ("op \<^loc>\<le>") and |
|
263 |
less_eq ("(_/ \<^loc>\<le> _)" [51, 51] 50) |
|
264 |
||
265 |
abbreviation (input) |
|
266 |
greater_eq (infix "\<^loc>>=" 50) where |
|
267 |
"x \<^loc>>= y \<equiv> y \<^loc><= x" |
|
268 |
||
269 |
notation (input) |
|
270 |
greater_eq (infix "\<^loc>\<ge>" 50) |
|
271 |
||
24842 | 272 |
abbreviation (input) |
273 |
greater (infix "\<^loc>>" 50) where |
|
274 |
"x \<^loc>> y \<equiv> y \<^loc>< x" |
|
275 |
||
23878 | 276 |
definition |
277 |
Least :: "('a \<Rightarrow> bool) \<Rightarrow> 'a" (binder "\<^loc>LEAST " 10) |
|
278 |
where |
|
279 |
"Least P == (THE x. P x \<and> (\<forall>y. P y \<longrightarrow> x \<^loc>\<le> y))" |
|
280 |
||
281 |
end |
|
282 |
||
283 |
notation |
|
284 |
less_eq ("op <=") and |
|
285 |
less_eq ("(_/ <= _)" [51, 51] 50) and |
|
286 |
less ("op <") and |
|
287 |
less ("(_/ < _)" [51, 51] 50) |
|
288 |
||
289 |
notation (xsymbols) |
|
290 |
less_eq ("op \<le>") and |
|
291 |
less_eq ("(_/ \<le> _)" [51, 51] 50) |
|
292 |
||
293 |
notation (HTML output) |
|
294 |
less_eq ("op \<le>") and |
|
295 |
less_eq ("(_/ \<le> _)" [51, 51] 50) |
|
296 |
||
24842 | 297 |
notation (input) |
298 |
greater (infix ">" 50) |
|
23878 | 299 |
|
300 |
notation (input) |
|
24842 | 301 |
greater_eq (infix ">=" 50) |
302 |
and |
|
23878 | 303 |
greater_eq (infix "\<ge>" 50) |
304 |
||
13456
42601eb7553f
special syntax for index "1" (plain numeral hidden by "1" symbol in HOL);
wenzelm
parents:
13438
diff
changeset
|
305 |
syntax |
42601eb7553f
special syntax for index "1" (plain numeral hidden by "1" symbol in HOL);
wenzelm
parents:
13438
diff
changeset
|
306 |
"_index1" :: index ("\<^sub>1") |
42601eb7553f
special syntax for index "1" (plain numeral hidden by "1" symbol in HOL);
wenzelm
parents:
13438
diff
changeset
|
307 |
translations |
14690 | 308 |
(index) "\<^sub>1" => (index) "\<^bsub>\<struct>\<^esub>" |
13456
42601eb7553f
special syntax for index "1" (plain numeral hidden by "1" symbol in HOL);
wenzelm
parents:
13438
diff
changeset
|
309 |
|
11750 | 310 |
typed_print_translation {* |
20713
823967ef47f1
renamed 0 and 1 to HOL.zero and HOL.one respectivly; introduced corresponding syntactic classes
haftmann
parents:
20698
diff
changeset
|
311 |
let |
823967ef47f1
renamed 0 and 1 to HOL.zero and HOL.one respectivly; introduced corresponding syntactic classes
haftmann
parents:
20698
diff
changeset
|
312 |
fun tr' c = (c, fn show_sorts => fn T => fn ts => |
823967ef47f1
renamed 0 and 1 to HOL.zero and HOL.one respectivly; introduced corresponding syntactic classes
haftmann
parents:
20698
diff
changeset
|
313 |
if T = dummyT orelse not (! show_types) andalso can Term.dest_Type T then raise Match |
823967ef47f1
renamed 0 and 1 to HOL.zero and HOL.one respectivly; introduced corresponding syntactic classes
haftmann
parents:
20698
diff
changeset
|
314 |
else Syntax.const Syntax.constrainC $ Syntax.const c $ Syntax.term_of_typ show_sorts T); |
22993 | 315 |
in map tr' [@{const_syntax HOL.one}, @{const_syntax HOL.zero}] end; |
11750 | 316 |
*} -- {* show types that are presumably too general *} |
317 |
||
318 |
||
20944 | 319 |
subsection {* Fundamental rules *} |
320 |
||
20973 | 321 |
subsubsection {* Equality *} |
20944 | 322 |
|
323 |
text {* Thanks to Stephan Merz *} |
|
324 |
lemma subst: |
|
325 |
assumes eq: "s = t" and p: "P s" |
|
326 |
shows "P t" |
|
327 |
proof - |
|
328 |
from eq have meta: "s \<equiv> t" |
|
329 |
by (rule eq_reflection) |
|
330 |
from p show ?thesis |
|
331 |
by (unfold meta) |
|
332 |
qed |
|
15411 | 333 |
|
18457 | 334 |
lemma sym: "s = t ==> t = s" |
335 |
by (erule subst) (rule refl) |
|
15411 | 336 |
|
18457 | 337 |
lemma ssubst: "t = s ==> P s ==> P t" |
338 |
by (drule sym) (erule subst) |
|
15411 | 339 |
|
340 |
lemma trans: "[| r=s; s=t |] ==> r=t" |
|
18457 | 341 |
by (erule subst) |
15411 | 342 |
|
20944 | 343 |
lemma meta_eq_to_obj_eq: |
344 |
assumes meq: "A == B" |
|
345 |
shows "A = B" |
|
346 |
by (unfold meq) (rule refl) |
|
15411 | 347 |
|
21502 | 348 |
text {* Useful with @{text erule} for proving equalities from known equalities. *} |
20944 | 349 |
(* a = b |
15411 | 350 |
| | |
351 |
c = d *) |
|
352 |
lemma box_equals: "[| a=b; a=c; b=d |] ==> c=d" |
|
353 |
apply (rule trans) |
|
354 |
apply (rule trans) |
|
355 |
apply (rule sym) |
|
356 |
apply assumption+ |
|
357 |
done |
|
358 |
||
15524
2ef571f80a55
Moved oderings from HOL into the new Orderings.thy
nipkow
parents:
15481
diff
changeset
|
359 |
text {* For calculational reasoning: *} |
2ef571f80a55
Moved oderings from HOL into the new Orderings.thy
nipkow
parents:
15481
diff
changeset
|
360 |
|
2ef571f80a55
Moved oderings from HOL into the new Orderings.thy
nipkow
parents:
15481
diff
changeset
|
361 |
lemma forw_subst: "a = b ==> P b ==> P a" |
2ef571f80a55
Moved oderings from HOL into the new Orderings.thy
nipkow
parents:
15481
diff
changeset
|
362 |
by (rule ssubst) |
2ef571f80a55
Moved oderings from HOL into the new Orderings.thy
nipkow
parents:
15481
diff
changeset
|
363 |
|
2ef571f80a55
Moved oderings from HOL into the new Orderings.thy
nipkow
parents:
15481
diff
changeset
|
364 |
lemma back_subst: "P a ==> a = b ==> P b" |
2ef571f80a55
Moved oderings from HOL into the new Orderings.thy
nipkow
parents:
15481
diff
changeset
|
365 |
by (rule subst) |
2ef571f80a55
Moved oderings from HOL into the new Orderings.thy
nipkow
parents:
15481
diff
changeset
|
366 |
|
15411 | 367 |
|
20944 | 368 |
subsubsection {*Congruence rules for application*} |
15411 | 369 |
|
370 |
(*similar to AP_THM in Gordon's HOL*) |
|
371 |
lemma fun_cong: "(f::'a=>'b) = g ==> f(x)=g(x)" |
|
372 |
apply (erule subst) |
|
373 |
apply (rule refl) |
|
374 |
done |
|
375 |
||
376 |
(*similar to AP_TERM in Gordon's HOL and FOL's subst_context*) |
|
377 |
lemma arg_cong: "x=y ==> f(x)=f(y)" |
|
378 |
apply (erule subst) |
|
379 |
apply (rule refl) |
|
380 |
done |
|
381 |
||
15655 | 382 |
lemma arg_cong2: "\<lbrakk> a = b; c = d \<rbrakk> \<Longrightarrow> f a c = f b d" |
383 |
apply (erule ssubst)+ |
|
384 |
apply (rule refl) |
|
385 |
done |
|
386 |
||
15411 | 387 |
lemma cong: "[| f = g; (x::'a) = y |] ==> f(x) = g(y)" |
388 |
apply (erule subst)+ |
|
389 |
apply (rule refl) |
|
390 |
done |
|
391 |
||
392 |
||
20944 | 393 |
subsubsection {*Equality of booleans -- iff*} |
15411 | 394 |
|
21504 | 395 |
lemma iffI: assumes "P ==> Q" and "Q ==> P" shows "P=Q" |
396 |
by (iprover intro: iff [THEN mp, THEN mp] impI assms) |
|
15411 | 397 |
|
398 |
lemma iffD2: "[| P=Q; Q |] ==> P" |
|
18457 | 399 |
by (erule ssubst) |
15411 | 400 |
|
401 |
lemma rev_iffD2: "[| Q; P=Q |] ==> P" |
|
18457 | 402 |
by (erule iffD2) |
15411 | 403 |
|
21504 | 404 |
lemma iffD1: "Q = P \<Longrightarrow> Q \<Longrightarrow> P" |
405 |
by (drule sym) (rule iffD2) |
|
406 |
||
407 |
lemma rev_iffD1: "Q \<Longrightarrow> Q = P \<Longrightarrow> P" |
|
408 |
by (drule sym) (rule rev_iffD2) |
|
15411 | 409 |
|
410 |
lemma iffE: |
|
411 |
assumes major: "P=Q" |
|
21504 | 412 |
and minor: "[| P --> Q; Q --> P |] ==> R" |
18457 | 413 |
shows R |
414 |
by (iprover intro: minor impI major [THEN iffD2] major [THEN iffD1]) |
|
15411 | 415 |
|
416 |
||
20944 | 417 |
subsubsection {*True*} |
15411 | 418 |
|
419 |
lemma TrueI: "True" |
|
21504 | 420 |
unfolding True_def by (rule refl) |
15411 | 421 |
|
21504 | 422 |
lemma eqTrueI: "P ==> P = True" |
18457 | 423 |
by (iprover intro: iffI TrueI) |
15411 | 424 |
|
21504 | 425 |
lemma eqTrueE: "P = True ==> P" |
426 |
by (erule iffD2) (rule TrueI) |
|
15411 | 427 |
|
428 |
||
20944 | 429 |
subsubsection {*Universal quantifier*} |
15411 | 430 |
|
21504 | 431 |
lemma allI: assumes "!!x::'a. P(x)" shows "ALL x. P(x)" |
432 |
unfolding All_def by (iprover intro: ext eqTrueI assms) |
|
15411 | 433 |
|
434 |
lemma spec: "ALL x::'a. P(x) ==> P(x)" |
|
435 |
apply (unfold All_def) |
|
436 |
apply (rule eqTrueE) |
|
437 |
apply (erule fun_cong) |
|
438 |
done |
|
439 |
||
440 |
lemma allE: |
|
441 |
assumes major: "ALL x. P(x)" |
|
21504 | 442 |
and minor: "P(x) ==> R" |
443 |
shows R |
|
444 |
by (iprover intro: minor major [THEN spec]) |
|
15411 | 445 |
|
446 |
lemma all_dupE: |
|
447 |
assumes major: "ALL x. P(x)" |
|
21504 | 448 |
and minor: "[| P(x); ALL x. P(x) |] ==> R" |
449 |
shows R |
|
450 |
by (iprover intro: minor major major [THEN spec]) |
|
15411 | 451 |
|
452 |
||
21504 | 453 |
subsubsection {* False *} |
454 |
||
455 |
text {* |
|
456 |
Depends upon @{text spec}; it is impossible to do propositional |
|
457 |
logic before quantifiers! |
|
458 |
*} |
|
15411 | 459 |
|
460 |
lemma FalseE: "False ==> P" |
|
21504 | 461 |
apply (unfold False_def) |
462 |
apply (erule spec) |
|
463 |
done |
|
15411 | 464 |
|
21504 | 465 |
lemma False_neq_True: "False = True ==> P" |
466 |
by (erule eqTrueE [THEN FalseE]) |
|
15411 | 467 |
|
468 |
||
21504 | 469 |
subsubsection {* Negation *} |
15411 | 470 |
|
471 |
lemma notI: |
|
21504 | 472 |
assumes "P ==> False" |
15411 | 473 |
shows "~P" |
21504 | 474 |
apply (unfold not_def) |
475 |
apply (iprover intro: impI assms) |
|
476 |
done |
|
15411 | 477 |
|
478 |
lemma False_not_True: "False ~= True" |
|
21504 | 479 |
apply (rule notI) |
480 |
apply (erule False_neq_True) |
|
481 |
done |
|
15411 | 482 |
|
483 |
lemma True_not_False: "True ~= False" |
|
21504 | 484 |
apply (rule notI) |
485 |
apply (drule sym) |
|
486 |
apply (erule False_neq_True) |
|
487 |
done |
|
15411 | 488 |
|
489 |
lemma notE: "[| ~P; P |] ==> R" |
|
21504 | 490 |
apply (unfold not_def) |
491 |
apply (erule mp [THEN FalseE]) |
|
492 |
apply assumption |
|
493 |
done |
|
15411 | 494 |
|
21504 | 495 |
lemma notI2: "(P \<Longrightarrow> \<not> Pa) \<Longrightarrow> (P \<Longrightarrow> Pa) \<Longrightarrow> \<not> P" |
496 |
by (erule notE [THEN notI]) (erule meta_mp) |
|
15411 | 497 |
|
498 |
||
20944 | 499 |
subsubsection {*Implication*} |
15411 | 500 |
|
501 |
lemma impE: |
|
502 |
assumes "P-->Q" "P" "Q ==> R" |
|
503 |
shows "R" |
|
23553 | 504 |
by (iprover intro: assms mp) |
15411 | 505 |
|
506 |
(* Reduces Q to P-->Q, allowing substitution in P. *) |
|
507 |
lemma rev_mp: "[| P; P --> Q |] ==> Q" |
|
17589 | 508 |
by (iprover intro: mp) |
15411 | 509 |
|
510 |
lemma contrapos_nn: |
|
511 |
assumes major: "~Q" |
|
512 |
and minor: "P==>Q" |
|
513 |
shows "~P" |
|
17589 | 514 |
by (iprover intro: notI minor major [THEN notE]) |
15411 | 515 |
|
516 |
(*not used at all, but we already have the other 3 combinations *) |
|
517 |
lemma contrapos_pn: |
|
518 |
assumes major: "Q" |
|
519 |
and minor: "P ==> ~Q" |
|
520 |
shows "~P" |
|
17589 | 521 |
by (iprover intro: notI minor major notE) |
15411 | 522 |
|
523 |
lemma not_sym: "t ~= s ==> s ~= t" |
|
21250 | 524 |
by (erule contrapos_nn) (erule sym) |
525 |
||
526 |
lemma eq_neq_eq_imp_neq: "[| x = a ; a ~= b; b = y |] ==> x ~= y" |
|
527 |
by (erule subst, erule ssubst, assumption) |
|
15411 | 528 |
|
529 |
(*still used in HOLCF*) |
|
530 |
lemma rev_contrapos: |
|
531 |
assumes pq: "P ==> Q" |
|
532 |
and nq: "~Q" |
|
533 |
shows "~P" |
|
534 |
apply (rule nq [THEN contrapos_nn]) |
|
535 |
apply (erule pq) |
|
536 |
done |
|
537 |
||
20944 | 538 |
subsubsection {*Existential quantifier*} |
15411 | 539 |
|
540 |
lemma exI: "P x ==> EX x::'a. P x" |
|
541 |
apply (unfold Ex_def) |
|
17589 | 542 |
apply (iprover intro: allI allE impI mp) |
15411 | 543 |
done |
544 |
||
545 |
lemma exE: |
|
546 |
assumes major: "EX x::'a. P(x)" |
|
547 |
and minor: "!!x. P(x) ==> Q" |
|
548 |
shows "Q" |
|
549 |
apply (rule major [unfolded Ex_def, THEN spec, THEN mp]) |
|
17589 | 550 |
apply (iprover intro: impI [THEN allI] minor) |
15411 | 551 |
done |
552 |
||
553 |
||
20944 | 554 |
subsubsection {*Conjunction*} |
15411 | 555 |
|
556 |
lemma conjI: "[| P; Q |] ==> P&Q" |
|
557 |
apply (unfold and_def) |
|
17589 | 558 |
apply (iprover intro: impI [THEN allI] mp) |
15411 | 559 |
done |
560 |
||
561 |
lemma conjunct1: "[| P & Q |] ==> P" |
|
562 |
apply (unfold and_def) |
|
17589 | 563 |
apply (iprover intro: impI dest: spec mp) |
15411 | 564 |
done |
565 |
||
566 |
lemma conjunct2: "[| P & Q |] ==> Q" |
|
567 |
apply (unfold and_def) |
|
17589 | 568 |
apply (iprover intro: impI dest: spec mp) |
15411 | 569 |
done |
570 |
||
571 |
lemma conjE: |
|
572 |
assumes major: "P&Q" |
|
573 |
and minor: "[| P; Q |] ==> R" |
|
574 |
shows "R" |
|
575 |
apply (rule minor) |
|
576 |
apply (rule major [THEN conjunct1]) |
|
577 |
apply (rule major [THEN conjunct2]) |
|
578 |
done |
|
579 |
||
580 |
lemma context_conjI: |
|
23553 | 581 |
assumes "P" "P ==> Q" shows "P & Q" |
582 |
by (iprover intro: conjI assms) |
|
15411 | 583 |
|
584 |
||
20944 | 585 |
subsubsection {*Disjunction*} |
15411 | 586 |
|
587 |
lemma disjI1: "P ==> P|Q" |
|
588 |
apply (unfold or_def) |
|
17589 | 589 |
apply (iprover intro: allI impI mp) |
15411 | 590 |
done |
591 |
||
592 |
lemma disjI2: "Q ==> P|Q" |
|
593 |
apply (unfold or_def) |
|
17589 | 594 |
apply (iprover intro: allI impI mp) |
15411 | 595 |
done |
596 |
||
597 |
lemma disjE: |
|
598 |
assumes major: "P|Q" |
|
599 |
and minorP: "P ==> R" |
|
600 |
and minorQ: "Q ==> R" |
|
601 |
shows "R" |
|
17589 | 602 |
by (iprover intro: minorP minorQ impI |
15411 | 603 |
major [unfolded or_def, THEN spec, THEN mp, THEN mp]) |
604 |
||
605 |
||
20944 | 606 |
subsubsection {*Classical logic*} |
15411 | 607 |
|
608 |
lemma classical: |
|
609 |
assumes prem: "~P ==> P" |
|
610 |
shows "P" |
|
611 |
apply (rule True_or_False [THEN disjE, THEN eqTrueE]) |
|
612 |
apply assumption |
|
613 |
apply (rule notI [THEN prem, THEN eqTrueI]) |
|
614 |
apply (erule subst) |
|
615 |
apply assumption |
|
616 |
done |
|
617 |
||
618 |
lemmas ccontr = FalseE [THEN classical, standard] |
|
619 |
||
620 |
(*notE with premises exchanged; it discharges ~R so that it can be used to |
|
621 |
make elimination rules*) |
|
622 |
lemma rev_notE: |
|
623 |
assumes premp: "P" |
|
624 |
and premnot: "~R ==> ~P" |
|
625 |
shows "R" |
|
626 |
apply (rule ccontr) |
|
627 |
apply (erule notE [OF premnot premp]) |
|
628 |
done |
|
629 |
||
630 |
(*Double negation law*) |
|
631 |
lemma notnotD: "~~P ==> P" |
|
632 |
apply (rule classical) |
|
633 |
apply (erule notE) |
|
634 |
apply assumption |
|
635 |
done |
|
636 |
||
637 |
lemma contrapos_pp: |
|
638 |
assumes p1: "Q" |
|
639 |
and p2: "~P ==> ~Q" |
|
640 |
shows "P" |
|
17589 | 641 |
by (iprover intro: classical p1 p2 notE) |
15411 | 642 |
|
643 |
||
20944 | 644 |
subsubsection {*Unique existence*} |
15411 | 645 |
|
646 |
lemma ex1I: |
|
23553 | 647 |
assumes "P a" "!!x. P(x) ==> x=a" |
15411 | 648 |
shows "EX! x. P(x)" |
23553 | 649 |
by (unfold Ex1_def, iprover intro: assms exI conjI allI impI) |
15411 | 650 |
|
651 |
text{*Sometimes easier to use: the premises have no shared variables. Safe!*} |
|
652 |
lemma ex_ex1I: |
|
653 |
assumes ex_prem: "EX x. P(x)" |
|
654 |
and eq: "!!x y. [| P(x); P(y) |] ==> x=y" |
|
655 |
shows "EX! x. P(x)" |
|
17589 | 656 |
by (iprover intro: ex_prem [THEN exE] ex1I eq) |
15411 | 657 |
|
658 |
lemma ex1E: |
|
659 |
assumes major: "EX! x. P(x)" |
|
660 |
and minor: "!!x. [| P(x); ALL y. P(y) --> y=x |] ==> R" |
|
661 |
shows "R" |
|
662 |
apply (rule major [unfolded Ex1_def, THEN exE]) |
|
663 |
apply (erule conjE) |
|
17589 | 664 |
apply (iprover intro: minor) |
15411 | 665 |
done |
666 |
||
667 |
lemma ex1_implies_ex: "EX! x. P x ==> EX x. P x" |
|
668 |
apply (erule ex1E) |
|
669 |
apply (rule exI) |
|
670 |
apply assumption |
|
671 |
done |
|
672 |
||
673 |
||
20944 | 674 |
subsubsection {*THE: definite description operator*} |
15411 | 675 |
|
676 |
lemma the_equality: |
|
677 |
assumes prema: "P a" |
|
678 |
and premx: "!!x. P x ==> x=a" |
|
679 |
shows "(THE x. P x) = a" |
|
680 |
apply (rule trans [OF _ the_eq_trivial]) |
|
681 |
apply (rule_tac f = "The" in arg_cong) |
|
682 |
apply (rule ext) |
|
683 |
apply (rule iffI) |
|
684 |
apply (erule premx) |
|
685 |
apply (erule ssubst, rule prema) |
|
686 |
done |
|
687 |
||
688 |
lemma theI: |
|
689 |
assumes "P a" and "!!x. P x ==> x=a" |
|
690 |
shows "P (THE x. P x)" |
|
23553 | 691 |
by (iprover intro: assms the_equality [THEN ssubst]) |
15411 | 692 |
|
693 |
lemma theI': "EX! x. P x ==> P (THE x. P x)" |
|
694 |
apply (erule ex1E) |
|
695 |
apply (erule theI) |
|
696 |
apply (erule allE) |
|
697 |
apply (erule mp) |
|
698 |
apply assumption |
|
699 |
done |
|
700 |
||
701 |
(*Easier to apply than theI: only one occurrence of P*) |
|
702 |
lemma theI2: |
|
703 |
assumes "P a" "!!x. P x ==> x=a" "!!x. P x ==> Q x" |
|
704 |
shows "Q (THE x. P x)" |
|
23553 | 705 |
by (iprover intro: assms theI) |
15411 | 706 |
|
24553 | 707 |
lemma the1I2: assumes "EX! x. P x" "\<And>x. P x \<Longrightarrow> Q x" shows "Q (THE x. P x)" |
708 |
by(iprover intro:assms(2) theI2[where P=P and Q=Q] ex1E[OF assms(1)] |
|
709 |
elim:allE impE) |
|
710 |
||
18697 | 711 |
lemma the1_equality [elim?]: "[| EX!x. P x; P a |] ==> (THE x. P x) = a" |
15411 | 712 |
apply (rule the_equality) |
713 |
apply assumption |
|
714 |
apply (erule ex1E) |
|
715 |
apply (erule all_dupE) |
|
716 |
apply (drule mp) |
|
717 |
apply assumption |
|
718 |
apply (erule ssubst) |
|
719 |
apply (erule allE) |
|
720 |
apply (erule mp) |
|
721 |
apply assumption |
|
722 |
done |
|
723 |
||
724 |
lemma the_sym_eq_trivial: "(THE y. x=y) = x" |
|
725 |
apply (rule the_equality) |
|
726 |
apply (rule refl) |
|
727 |
apply (erule sym) |
|
728 |
done |
|
729 |
||
730 |
||
20944 | 731 |
subsubsection {*Classical intro rules for disjunction and existential quantifiers*} |
15411 | 732 |
|
733 |
lemma disjCI: |
|
734 |
assumes "~Q ==> P" shows "P|Q" |
|
735 |
apply (rule classical) |
|
23553 | 736 |
apply (iprover intro: assms disjI1 disjI2 notI elim: notE) |
15411 | 737 |
done |
738 |
||
739 |
lemma excluded_middle: "~P | P" |
|
17589 | 740 |
by (iprover intro: disjCI) |
15411 | 741 |
|
20944 | 742 |
text {* |
743 |
case distinction as a natural deduction rule. |
|
744 |
Note that @{term "~P"} is the second case, not the first |
|
745 |
*} |
|
15411 | 746 |
lemma case_split_thm: |
747 |
assumes prem1: "P ==> Q" |
|
748 |
and prem2: "~P ==> Q" |
|
749 |
shows "Q" |
|
750 |
apply (rule excluded_middle [THEN disjE]) |
|
751 |
apply (erule prem2) |
|
752 |
apply (erule prem1) |
|
753 |
done |
|
20944 | 754 |
lemmas case_split = case_split_thm [case_names True False] |
15411 | 755 |
|
756 |
(*Classical implies (-->) elimination. *) |
|
757 |
lemma impCE: |
|
758 |
assumes major: "P-->Q" |
|
759 |
and minor: "~P ==> R" "Q ==> R" |
|
760 |
shows "R" |
|
761 |
apply (rule excluded_middle [of P, THEN disjE]) |
|
17589 | 762 |
apply (iprover intro: minor major [THEN mp])+ |
15411 | 763 |
done |
764 |
||
765 |
(*This version of --> elimination works on Q before P. It works best for |
|
766 |
those cases in which P holds "almost everywhere". Can't install as |
|
767 |
default: would break old proofs.*) |
|
768 |
lemma impCE': |
|
769 |
assumes major: "P-->Q" |
|
770 |
and minor: "Q ==> R" "~P ==> R" |
|
771 |
shows "R" |
|
772 |
apply (rule excluded_middle [of P, THEN disjE]) |
|
17589 | 773 |
apply (iprover intro: minor major [THEN mp])+ |
15411 | 774 |
done |
775 |
||
776 |
(*Classical <-> elimination. *) |
|
777 |
lemma iffCE: |
|
778 |
assumes major: "P=Q" |
|
779 |
and minor: "[| P; Q |] ==> R" "[| ~P; ~Q |] ==> R" |
|
780 |
shows "R" |
|
781 |
apply (rule major [THEN iffE]) |
|
17589 | 782 |
apply (iprover intro: minor elim: impCE notE) |
15411 | 783 |
done |
784 |
||
785 |
lemma exCI: |
|
786 |
assumes "ALL x. ~P(x) ==> P(a)" |
|
787 |
shows "EX x. P(x)" |
|
788 |
apply (rule ccontr) |
|
23553 | 789 |
apply (iprover intro: assms exI allI notI notE [of "\<exists>x. P x"]) |
15411 | 790 |
done |
791 |
||
792 |
||
12386 | 793 |
subsubsection {* Intuitionistic Reasoning *} |
794 |
||
795 |
lemma impE': |
|
12937
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
796 |
assumes 1: "P --> Q" |
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
797 |
and 2: "Q ==> R" |
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
798 |
and 3: "P --> Q ==> P" |
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
799 |
shows R |
12386 | 800 |
proof - |
801 |
from 3 and 1 have P . |
|
802 |
with 1 have Q by (rule impE) |
|
803 |
with 2 show R . |
|
804 |
qed |
|
805 |
||
806 |
lemma allE': |
|
12937
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
807 |
assumes 1: "ALL x. P x" |
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
808 |
and 2: "P x ==> ALL x. P x ==> Q" |
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
809 |
shows Q |
12386 | 810 |
proof - |
811 |
from 1 have "P x" by (rule spec) |
|
812 |
from this and 1 show Q by (rule 2) |
|
813 |
qed |
|
814 |
||
12937
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
815 |
lemma notE': |
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
816 |
assumes 1: "~ P" |
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
817 |
and 2: "~ P ==> P" |
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
818 |
shows R |
12386 | 819 |
proof - |
820 |
from 2 and 1 have P . |
|
821 |
with 1 show R by (rule notE) |
|
822 |
qed |
|
823 |
||
22444
fb80fedd192d
added safe intro rules for removing "True" subgoals as well as "~ False" ones.
dixon
parents:
22377
diff
changeset
|
824 |
lemma TrueE: "True ==> P ==> P" . |
fb80fedd192d
added safe intro rules for removing "True" subgoals as well as "~ False" ones.
dixon
parents:
22377
diff
changeset
|
825 |
lemma notFalseE: "~ False ==> P ==> P" . |
fb80fedd192d
added safe intro rules for removing "True" subgoals as well as "~ False" ones.
dixon
parents:
22377
diff
changeset
|
826 |
|
22467
c9357ef01168
TrueElim and notTrueElim tested and added as safe elim rules.
dixon
parents:
22445
diff
changeset
|
827 |
lemmas [Pure.elim!] = disjE iffE FalseE conjE exE TrueE notFalseE |
15801 | 828 |
and [Pure.intro!] = iffI conjI impI TrueI notI allI refl |
829 |
and [Pure.elim 2] = allE notE' impE' |
|
830 |
and [Pure.intro] = exI disjI2 disjI1 |
|
12386 | 831 |
|
832 |
lemmas [trans] = trans |
|
833 |
and [sym] = sym not_sym |
|
15801 | 834 |
and [Pure.elim?] = iffD1 iffD2 impE |
11750 | 835 |
|
23553 | 836 |
use "hologic.ML" |
837 |
||
11438
3d9222b80989
declare trans [trans] (*overridden in theory Calculation*);
wenzelm
parents:
11432
diff
changeset
|
838 |
|
11750 | 839 |
subsubsection {* Atomizing meta-level connectives *} |
840 |
||
841 |
lemma atomize_all [atomize]: "(!!x. P x) == Trueprop (ALL x. P x)" |
|
12003 | 842 |
proof |
9488 | 843 |
assume "!!x. P x" |
23389 | 844 |
then show "ALL x. P x" .. |
9488 | 845 |
next |
846 |
assume "ALL x. P x" |
|
23553 | 847 |
then show "!!x. P x" by (rule allE) |
9488 | 848 |
qed |
849 |
||
11750 | 850 |
lemma atomize_imp [atomize]: "(A ==> B) == Trueprop (A --> B)" |
12003 | 851 |
proof |
9488 | 852 |
assume r: "A ==> B" |
10383 | 853 |
show "A --> B" by (rule impI) (rule r) |
9488 | 854 |
next |
855 |
assume "A --> B" and A |
|
23553 | 856 |
then show B by (rule mp) |
9488 | 857 |
qed |
858 |
||
14749 | 859 |
lemma atomize_not: "(A ==> False) == Trueprop (~A)" |
860 |
proof |
|
861 |
assume r: "A ==> False" |
|
862 |
show "~A" by (rule notI) (rule r) |
|
863 |
next |
|
864 |
assume "~A" and A |
|
23553 | 865 |
then show False by (rule notE) |
14749 | 866 |
qed |
867 |
||
11750 | 868 |
lemma atomize_eq [atomize]: "(x == y) == Trueprop (x = y)" |
12003 | 869 |
proof |
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
870 |
assume "x == y" |
23553 | 871 |
show "x = y" by (unfold `x == y`) (rule refl) |
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
872 |
next |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
873 |
assume "x = y" |
23553 | 874 |
then show "x == y" by (rule eq_reflection) |
10432
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
875 |
qed |
3dfbc913d184
added axclass inverse and consts inverse, divide (infix "/");
wenzelm
parents:
10383
diff
changeset
|
876 |
|
12023 | 877 |
lemma atomize_conj [atomize]: |
19121 | 878 |
includes meta_conjunction_syntax |
879 |
shows "(A && B) == Trueprop (A & B)" |
|
12003 | 880 |
proof |
19121 | 881 |
assume conj: "A && B" |
882 |
show "A & B" |
|
883 |
proof (rule conjI) |
|
884 |
from conj show A by (rule conjunctionD1) |
|
885 |
from conj show B by (rule conjunctionD2) |
|
886 |
qed |
|
11953 | 887 |
next |
19121 | 888 |
assume conj: "A & B" |
889 |
show "A && B" |
|
890 |
proof - |
|
891 |
from conj show A .. |
|
892 |
from conj show B .. |
|
11953 | 893 |
qed |
894 |
qed |
|
895 |
||
12386 | 896 |
lemmas [symmetric, rulify] = atomize_all atomize_imp |
18832 | 897 |
and [symmetric, defn] = atomize_all atomize_imp atomize_eq |
12386 | 898 |
|
11750 | 899 |
|
20944 | 900 |
subsection {* Package setup *} |
901 |
||
11750 | 902 |
subsubsection {* Classical Reasoner setup *} |
9529 | 903 |
|
20944 | 904 |
lemma thin_refl: |
905 |
"\<And>X. \<lbrakk> x=x; PROP W \<rbrakk> \<Longrightarrow> PROP W" . |
|
906 |
||
21151 | 907 |
ML {* |
908 |
structure Hypsubst = HypsubstFun( |
|
909 |
struct |
|
910 |
structure Simplifier = Simplifier |
|
21218 | 911 |
val dest_eq = HOLogic.dest_eq |
21151 | 912 |
val dest_Trueprop = HOLogic.dest_Trueprop |
913 |
val dest_imp = HOLogic.dest_imp |
|
22129 | 914 |
val eq_reflection = @{thm HOL.eq_reflection} |
22218 | 915 |
val rev_eq_reflection = @{thm HOL.meta_eq_to_obj_eq} |
22129 | 916 |
val imp_intr = @{thm HOL.impI} |
917 |
val rev_mp = @{thm HOL.rev_mp} |
|
918 |
val subst = @{thm HOL.subst} |
|
919 |
val sym = @{thm HOL.sym} |
|
920 |
val thin_refl = @{thm thin_refl}; |
|
21151 | 921 |
end); |
21671 | 922 |
open Hypsubst; |
21151 | 923 |
|
924 |
structure Classical = ClassicalFun( |
|
925 |
struct |
|
22129 | 926 |
val mp = @{thm HOL.mp} |
927 |
val not_elim = @{thm HOL.notE} |
|
928 |
val classical = @{thm HOL.classical} |
|
21151 | 929 |
val sizef = Drule.size_of_thm |
930 |
val hyp_subst_tacs = [Hypsubst.hyp_subst_tac] |
|
931 |
end); |
|
932 |
||
933 |
structure BasicClassical: BASIC_CLASSICAL = Classical; |
|
21671 | 934 |
open BasicClassical; |
22129 | 935 |
|
936 |
ML_Context.value_antiq "claset" |
|
937 |
(Scan.succeed ("claset", "Classical.local_claset_of (ML_Context.the_local_context ())")); |
|
24035 | 938 |
|
939 |
structure ResAtpset = NamedThmsFun(val name = "atp" val description = "ATP rules"); |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
24280
diff
changeset
|
940 |
|
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
24280
diff
changeset
|
941 |
structure ResBlacklist = NamedThmsFun(val name = "noatp" val description = "Theorems blacklisted for ATP"); |
21151 | 942 |
*} |
943 |
||
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
24280
diff
changeset
|
944 |
(*ResBlacklist holds theorems blacklisted to sledgehammer. |
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
24280
diff
changeset
|
945 |
These theorems typically produce clauses that are prolific (match too many equality or |
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
24280
diff
changeset
|
946 |
membership literals) and relate to seldom-used facts. Some duplicate other rules.*) |
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
24280
diff
changeset
|
947 |
|
21009 | 948 |
setup {* |
949 |
let |
|
950 |
(*prevent substitution on bool*) |
|
951 |
fun hyp_subst_tac' i thm = if i <= Thm.nprems_of thm andalso |
|
952 |
Term.exists_Const (fn ("op =", Type (_, [T, _])) => T <> Type ("bool", []) | _ => false) |
|
953 |
(nth (Thm.prems_of thm) (i - 1)) then Hypsubst.hyp_subst_tac i thm else no_tac thm; |
|
954 |
in |
|
21151 | 955 |
Hypsubst.hypsubst_setup |
956 |
#> ContextRules.addSWrapper (fn tac => hyp_subst_tac' ORELSE' tac) |
|
957 |
#> Classical.setup |
|
958 |
#> ResAtpset.setup |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
24280
diff
changeset
|
959 |
#> ResBlacklist.setup |
21009 | 960 |
end |
961 |
*} |
|
962 |
||
963 |
declare iffI [intro!] |
|
964 |
and notI [intro!] |
|
965 |
and impI [intro!] |
|
966 |
and disjCI [intro!] |
|
967 |
and conjI [intro!] |
|
968 |
and TrueI [intro!] |
|
969 |
and refl [intro!] |
|
970 |
||
971 |
declare iffCE [elim!] |
|
972 |
and FalseE [elim!] |
|
973 |
and impCE [elim!] |
|
974 |
and disjE [elim!] |
|
975 |
and conjE [elim!] |
|
976 |
and conjE [elim!] |
|
977 |
||
978 |
declare ex_ex1I [intro!] |
|
979 |
and allI [intro!] |
|
980 |
and the_equality [intro] |
|
981 |
and exI [intro] |
|
982 |
||
983 |
declare exE [elim!] |
|
984 |
allE [elim] |
|
985 |
||
22377 | 986 |
ML {* val HOL_cs = @{claset} *} |
19162 | 987 |
|
20223 | 988 |
lemma contrapos_np: "~ Q ==> (~ P ==> Q) ==> P" |
989 |
apply (erule swap) |
|
990 |
apply (erule (1) meta_mp) |
|
991 |
done |
|
10383 | 992 |
|
18689
a50587cd8414
prefer ex1I over ex_ex1I in single-step reasoning;
wenzelm
parents:
18595
diff
changeset
|
993 |
declare ex_ex1I [rule del, intro! 2] |
a50587cd8414
prefer ex1I over ex_ex1I in single-step reasoning;
wenzelm
parents:
18595
diff
changeset
|
994 |
and ex1I [intro] |
a50587cd8414
prefer ex1I over ex_ex1I in single-step reasoning;
wenzelm
parents:
18595
diff
changeset
|
995 |
|
12386 | 996 |
lemmas [intro?] = ext |
997 |
and [elim?] = ex1_implies_ex |
|
11977 | 998 |
|
20944 | 999 |
(*Better then ex1E for classical reasoner: needs no quantifier duplication!*) |
20973 | 1000 |
lemma alt_ex1E [elim!]: |
20944 | 1001 |
assumes major: "\<exists>!x. P x" |
1002 |
and prem: "\<And>x. \<lbrakk> P x; \<forall>y y'. P y \<and> P y' \<longrightarrow> y = y' \<rbrakk> \<Longrightarrow> R" |
|
1003 |
shows R |
|
1004 |
apply (rule ex1E [OF major]) |
|
1005 |
apply (rule prem) |
|
22129 | 1006 |
apply (tactic {* ares_tac @{thms allI} 1 *})+ |
1007 |
apply (tactic {* etac (Classical.dup_elim @{thm allE}) 1 *}) |
|
1008 |
apply iprover |
|
1009 |
done |
|
20944 | 1010 |
|
21151 | 1011 |
ML {* |
1012 |
structure Blast = BlastFun( |
|
1013 |
struct |
|
1014 |
type claset = Classical.claset |
|
22744
5cbe966d67a2
Isar definitions are now added explicitly to code theorem table
haftmann
parents:
22481
diff
changeset
|
1015 |
val equality_name = @{const_name "op ="} |
22993 | 1016 |
val not_name = @{const_name Not} |
22129 | 1017 |
val notE = @{thm HOL.notE} |
1018 |
val ccontr = @{thm HOL.ccontr} |
|
21151 | 1019 |
val contr_tac = Classical.contr_tac |
1020 |
val dup_intr = Classical.dup_intr |
|
1021 |
val hyp_subst_tac = Hypsubst.blast_hyp_subst_tac |
|
21671 | 1022 |
val claset = Classical.claset |
21151 | 1023 |
val rep_cs = Classical.rep_cs |
1024 |
val cla_modifiers = Classical.cla_modifiers |
|
1025 |
val cla_meth' = Classical.cla_meth' |
|
1026 |
end); |
|
21671 | 1027 |
val Blast_tac = Blast.Blast_tac; |
1028 |
val blast_tac = Blast.blast_tac; |
|
20944 | 1029 |
*} |
1030 |
||
21151 | 1031 |
setup Blast.setup |
1032 |
||
20944 | 1033 |
|
1034 |
subsubsection {* Simplifier *} |
|
12281 | 1035 |
|
1036 |
lemma eta_contract_eq: "(%s. f s) = f" .. |
|
1037 |
||
1038 |
lemma simp_thms: |
|
12937
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
1039 |
shows not_not: "(~ ~ P) = P" |
15354 | 1040 |
and Not_eq_iff: "((~P) = (~Q)) = (P = Q)" |
12937
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
1041 |
and |
12436
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
1042 |
"(P ~= Q) = (P = (~Q))" |
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
1043 |
"(P | ~P) = True" "(~P | P) = True" |
12281 | 1044 |
"(x = x) = True" |
20944 | 1045 |
and not_True_eq_False: "(\<not> True) = False" |
1046 |
and not_False_eq_True: "(\<not> False) = True" |
|
1047 |
and |
|
12436
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
1048 |
"(~P) ~= P" "P ~= (~P)" |
20944 | 1049 |
"(True=P) = P" |
1050 |
and eq_True: "(P = True) = P" |
|
1051 |
and "(False=P) = (~P)" |
|
1052 |
and eq_False: "(P = False) = (\<not> P)" |
|
1053 |
and |
|
12281 | 1054 |
"(True --> P) = P" "(False --> P) = True" |
1055 |
"(P --> True) = True" "(P --> P) = True" |
|
1056 |
"(P --> False) = (~P)" "(P --> ~P) = (~P)" |
|
1057 |
"(P & True) = P" "(True & P) = P" |
|
1058 |
"(P & False) = False" "(False & P) = False" |
|
1059 |
"(P & P) = P" "(P & (P & Q)) = (P & Q)" |
|
1060 |
"(P & ~P) = False" "(~P & P) = False" |
|
1061 |
"(P | True) = True" "(True | P) = True" |
|
1062 |
"(P | False) = P" "(False | P) = P" |
|
12436
a2df07fefed7
Replaced several occurrences of "blast" by "rules".
berghofe
parents:
12386
diff
changeset
|
1063 |
"(P | P) = P" "(P | (P | Q)) = (P | Q)" and |
12281 | 1064 |
"(ALL x. P) = P" "(EX x. P) = P" "EX x. x=t" "EX x. t=x" |
1065 |
-- {* needed for the one-point-rule quantifier simplification procs *} |
|
1066 |
-- {* essential for termination!! *} and |
|
1067 |
"!!P. (EX x. x=t & P(x)) = P(t)" |
|
1068 |
"!!P. (EX x. t=x & P(x)) = P(t)" |
|
1069 |
"!!P. (ALL x. x=t --> P(x)) = P(t)" |
|
12937
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
1070 |
"!!P. (ALL x. t=x --> P(x)) = P(t)" |
17589 | 1071 |
by (blast, blast, blast, blast, blast, iprover+) |
13421 | 1072 |
|
14201 | 1073 |
lemma disj_absorb: "(A | A) = A" |
1074 |
by blast |
|
1075 |
||
1076 |
lemma disj_left_absorb: "(A | (A | B)) = (A | B)" |
|
1077 |
by blast |
|
1078 |
||
1079 |
lemma conj_absorb: "(A & A) = A" |
|
1080 |
by blast |
|
1081 |
||
1082 |
lemma conj_left_absorb: "(A & (A & B)) = (A & B)" |
|
1083 |
by blast |
|
1084 |
||
12281 | 1085 |
lemma eq_ac: |
12937
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
1086 |
shows eq_commute: "(a=b) = (b=a)" |
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
1087 |
and eq_left_commute: "(P=(Q=R)) = (Q=(P=R))" |
17589 | 1088 |
and eq_assoc: "((P=Q)=R) = (P=(Q=R))" by (iprover, blast+) |
1089 |
lemma neq_commute: "(a~=b) = (b~=a)" by iprover |
|
12281 | 1090 |
|
1091 |
lemma conj_comms: |
|
12937
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
1092 |
shows conj_commute: "(P&Q) = (Q&P)" |
17589 | 1093 |
and conj_left_commute: "(P&(Q&R)) = (Q&(P&R))" by iprover+ |
1094 |
lemma conj_assoc: "((P&Q)&R) = (P&(Q&R))" by iprover |
|
12281 | 1095 |
|
19174 | 1096 |
lemmas conj_ac = conj_commute conj_left_commute conj_assoc |
1097 |
||
12281 | 1098 |
lemma disj_comms: |
12937
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12892
diff
changeset
|
1099 |
shows disj_commute: "(P|Q) = (Q|P)" |
17589 | 1100 |
and disj_left_commute: "(P|(Q|R)) = (Q|(P|R))" by iprover+ |
1101 |
lemma disj_assoc: "((P|Q)|R) = (P|(Q|R))" by iprover |
|
12281 | 1102 |
|
19174 | 1103 |
lemmas disj_ac = disj_commute disj_left_commute disj_assoc |
1104 |
||
17589 | 1105 |
lemma conj_disj_distribL: "(P&(Q|R)) = (P&Q | P&R)" by iprover |
1106 |
lemma conj_disj_distribR: "((P|Q)&R) = (P&R | Q&R)" by iprover |
|
12281 | 1107 |
|
17589 | 1108 |
lemma disj_conj_distribL: "(P|(Q&R)) = ((P|Q) & (P|R))" by iprover |
1109 |
lemma disj_conj_distribR: "((P&Q)|R) = ((P|R) & (Q|R))" by iprover |
|
12281 | 1110 |
|
17589 | 1111 |
lemma imp_conjR: "(P --> (Q&R)) = ((P-->Q) & (P-->R))" by iprover |
1112 |
lemma imp_conjL: "((P&Q) -->R) = (P --> (Q --> R))" by iprover |
|
1113 |
lemma imp_disjL: "((P|Q) --> R) = ((P-->R)&(Q-->R))" by iprover |
|
12281 | 1114 |
|
1115 |
text {* These two are specialized, but @{text imp_disj_not1} is useful in @{text "Auth/Yahalom"}. *} |
|
1116 |
lemma imp_disj_not1: "(P --> Q | R) = (~Q --> P --> R)" by blast |
|
1117 |
lemma imp_disj_not2: "(P --> Q | R) = (~R --> P --> Q)" by blast |
|
1118 |
||
1119 |
lemma imp_disj1: "((P-->Q)|R) = (P--> Q|R)" by blast |
|
1120 |
lemma imp_disj2: "(Q|(P-->R)) = (P--> Q|R)" by blast |
|
1121 |
||
21151 | 1122 |
lemma imp_cong: "(P = P') ==> (P' ==> (Q = Q')) ==> ((P --> Q) = (P' --> Q'))" |
1123 |
by iprover |
|
1124 |
||
17589 | 1125 |
lemma de_Morgan_disj: "(~(P | Q)) = (~P & ~Q)" by iprover |
12281 | 1126 |
lemma de_Morgan_conj: "(~(P & Q)) = (~P | ~Q)" by blast |
1127 |
lemma not_imp: "(~(P --> Q)) = (P & ~Q)" by blast |
|
1128 |
lemma not_iff: "(P~=Q) = (P = (~Q))" by blast |
|
1129 |
lemma disj_not1: "(~P | Q) = (P --> Q)" by blast |
|
1130 |
lemma disj_not2: "(P | ~Q) = (Q --> P)" -- {* changes orientation :-( *} |
|
1131 |
by blast |
|
1132 |
lemma imp_conv_disj: "(P --> Q) = ((~P) | Q)" by blast |
|
1133 |
||
17589 | 1134 |
lemma iff_conv_conj_imp: "(P = Q) = ((P --> Q) & (Q --> P))" by iprover |
12281 | 1135 |
|
1136 |
||
1137 |
lemma cases_simp: "((P --> Q) & (~P --> Q)) = Q" |
|
1138 |
-- {* Avoids duplication of subgoals after @{text split_if}, when the true and false *} |
|
1139 |
-- {* cases boil down to the same thing. *} |
|
1140 |
by blast |
|
1141 |
||
1142 |
lemma not_all: "(~ (! x. P(x))) = (? x.~P(x))" by blast |
|
1143 |
lemma imp_all: "((! x. P x) --> Q) = (? x. P x --> Q)" by blast |
|
17589 | 1144 |
lemma not_ex: "(~ (? x. P(x))) = (! x.~P(x))" by iprover |
1145 |
lemma imp_ex: "((? x. P x) --> Q) = (! x. P x --> Q)" by iprover |
|
23403 | 1146 |
lemma all_not_ex: "(ALL x. P x) = (~ (EX x. ~ P x ))" by blast |
12281 | 1147 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
24280
diff
changeset
|
1148 |
declare All_def [noatp] |
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
24280
diff
changeset
|
1149 |
|
17589 | 1150 |
lemma ex_disj_distrib: "(? x. P(x) | Q(x)) = ((? x. P(x)) | (? x. Q(x)))" by iprover |
1151 |
lemma all_conj_distrib: "(!x. P(x) & Q(x)) = ((! x. P(x)) & (! x. Q(x)))" by iprover |
|
12281 | 1152 |
|
1153 |
text {* |
|
1154 |
\medskip The @{text "&"} congruence rule: not included by default! |
|
1155 |
May slow rewrite proofs down by as much as 50\% *} |
|
1156 |
||
1157 |
lemma conj_cong: |
|
1158 |
"(P = P') ==> (P' ==> (Q = Q')) ==> ((P & Q) = (P' & Q'))" |
|
17589 | 1159 |
by iprover |
12281 | 1160 |
|
1161 |
lemma rev_conj_cong: |
|
1162 |
"(Q = Q') ==> (Q' ==> (P = P')) ==> ((P & Q) = (P' & Q'))" |
|
17589 | 1163 |
by iprover |
12281 | 1164 |
|
1165 |
text {* The @{text "|"} congruence rule: not included by default! *} |
|
1166 |
||
1167 |
lemma disj_cong: |
|
1168 |
"(P = P') ==> (~P' ==> (Q = Q')) ==> ((P | Q) = (P' | Q'))" |
|
1169 |
by blast |
|
1170 |
||
1171 |
||
1172 |
text {* \medskip if-then-else rules *} |
|
1173 |
||
1174 |
lemma if_True: "(if True then x else y) = x" |
|
1175 |
by (unfold if_def) blast |
|
1176 |
||
1177 |
lemma if_False: "(if False then x else y) = y" |
|
1178 |
by (unfold if_def) blast |
|
1179 |
||
1180 |
lemma if_P: "P ==> (if P then x else y) = x" |
|
1181 |
by (unfold if_def) blast |
|
1182 |
||
1183 |
lemma if_not_P: "~P ==> (if P then x else y) = y" |
|
1184 |
by (unfold if_def) blast |
|
1185 |
||
1186 |
lemma split_if: "P (if Q then x else y) = ((Q --> P(x)) & (~Q --> P(y)))" |
|
1187 |
apply (rule case_split [of Q]) |
|
15481 | 1188 |
apply (simplesubst if_P) |
1189 |
prefer 3 apply (simplesubst if_not_P, blast+) |
|
12281 | 1190 |
done |
1191 |
||
1192 |
lemma split_if_asm: "P (if Q then x else y) = (~((Q & ~P x) | (~Q & ~P y)))" |
|
15481 | 1193 |
by (simplesubst split_if, blast) |
12281 | 1194 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
24280
diff
changeset
|
1195 |
lemmas if_splits [noatp] = split_if split_if_asm |
12281 | 1196 |
|
1197 |
lemma if_cancel: "(if c then x else x) = x" |
|
15481 | 1198 |
by (simplesubst split_if, blast) |
12281 | 1199 |
|
1200 |
lemma if_eq_cancel: "(if x = y then y else x) = x" |
|
15481 | 1201 |
by (simplesubst split_if, blast) |
12281 | 1202 |
|
1203 |
lemma if_bool_eq_conj: "(if P then Q else R) = ((P-->Q) & (~P-->R))" |
|
19796 | 1204 |
-- {* This form is useful for expanding @{text "if"}s on the RIGHT of the @{text "==>"} symbol. *} |
12281 | 1205 |
by (rule split_if) |
1206 |
||
1207 |
lemma if_bool_eq_disj: "(if P then Q else R) = ((P&Q) | (~P&R))" |
|
19796 | 1208 |
-- {* And this form is useful for expanding @{text "if"}s on the LEFT. *} |
15481 | 1209 |
apply (simplesubst split_if, blast) |
12281 | 1210 |
done |
1211 |
||
17589 | 1212 |
lemma Eq_TrueI: "P ==> P == True" by (unfold atomize_eq) iprover |
1213 |
lemma Eq_FalseI: "~P ==> P == False" by (unfold atomize_eq) iprover |
|
12281 | 1214 |
|
15423 | 1215 |
text {* \medskip let rules for simproc *} |
1216 |
||
1217 |
lemma Let_folded: "f x \<equiv> g x \<Longrightarrow> Let x f \<equiv> Let x g" |
|
1218 |
by (unfold Let_def) |
|
1219 |
||
1220 |
lemma Let_unfold: "f x \<equiv> g \<Longrightarrow> Let x f \<equiv> g" |
|
1221 |
by (unfold Let_def) |
|
1222 |
||
16633
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1223 |
text {* |
16999 | 1224 |
The following copy of the implication operator is useful for |
1225 |
fine-tuning congruence rules. It instructs the simplifier to simplify |
|
1226 |
its premise. |
|
16633
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1227 |
*} |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1228 |
|
17197 | 1229 |
constdefs |
1230 |
simp_implies :: "[prop, prop] => prop" (infixr "=simp=>" 1) |
|
1231 |
"simp_implies \<equiv> op ==>" |
|
16633
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1232 |
|
18457 | 1233 |
lemma simp_impliesI: |
16633
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1234 |
assumes PQ: "(PROP P \<Longrightarrow> PROP Q)" |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1235 |
shows "PROP P =simp=> PROP Q" |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1236 |
apply (unfold simp_implies_def) |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1237 |
apply (rule PQ) |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1238 |
apply assumption |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1239 |
done |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1240 |
|
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1241 |
lemma simp_impliesE: |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1242 |
assumes PQ:"PROP P =simp=> PROP Q" |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1243 |
and P: "PROP P" |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1244 |
and QR: "PROP Q \<Longrightarrow> PROP R" |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1245 |
shows "PROP R" |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1246 |
apply (rule QR) |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1247 |
apply (rule PQ [unfolded simp_implies_def]) |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1248 |
apply (rule P) |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1249 |
done |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1250 |
|
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1251 |
lemma simp_implies_cong: |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1252 |
assumes PP' :"PROP P == PROP P'" |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1253 |
and P'QQ': "PROP P' ==> (PROP Q == PROP Q')" |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1254 |
shows "(PROP P =simp=> PROP Q) == (PROP P' =simp=> PROP Q')" |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1255 |
proof (unfold simp_implies_def, rule equal_intr_rule) |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1256 |
assume PQ: "PROP P \<Longrightarrow> PROP Q" |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1257 |
and P': "PROP P'" |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1258 |
from PP' [symmetric] and P' have "PROP P" |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1259 |
by (rule equal_elim_rule1) |
23553 | 1260 |
then have "PROP Q" by (rule PQ) |
16633
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1261 |
with P'QQ' [OF P'] show "PROP Q'" by (rule equal_elim_rule1) |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1262 |
next |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1263 |
assume P'Q': "PROP P' \<Longrightarrow> PROP Q'" |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1264 |
and P: "PROP P" |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1265 |
from PP' and P have P': "PROP P'" by (rule equal_elim_rule1) |
23553 | 1266 |
then have "PROP Q'" by (rule P'Q') |
16633
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1267 |
with P'QQ' [OF P', symmetric] show "PROP Q" |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1268 |
by (rule equal_elim_rule1) |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1269 |
qed |
208ebc9311f2
Implemented trick (due to Tobias Nipkow) for fine-tuning simplification
berghofe
parents:
16587
diff
changeset
|
1270 |
|
20944 | 1271 |
lemma uncurry: |
1272 |
assumes "P \<longrightarrow> Q \<longrightarrow> R" |
|
1273 |
shows "P \<and> Q \<longrightarrow> R" |
|
23553 | 1274 |
using assms by blast |
20944 | 1275 |
|
1276 |
lemma iff_allI: |
|
1277 |
assumes "\<And>x. P x = Q x" |
|
1278 |
shows "(\<forall>x. P x) = (\<forall>x. Q x)" |
|
23553 | 1279 |
using assms by blast |
20944 | 1280 |
|
1281 |
lemma iff_exI: |
|
1282 |
assumes "\<And>x. P x = Q x" |
|
1283 |
shows "(\<exists>x. P x) = (\<exists>x. Q x)" |
|
23553 | 1284 |
using assms by blast |
20944 | 1285 |
|
1286 |
lemma all_comm: |
|
1287 |
"(\<forall>x y. P x y) = (\<forall>y x. P x y)" |
|
1288 |
by blast |
|
1289 |
||
1290 |
lemma ex_comm: |
|
1291 |
"(\<exists>x y. P x y) = (\<exists>y x. P x y)" |
|
1292 |
by blast |
|
1293 |
||
9869 | 1294 |
use "simpdata.ML" |
21671 | 1295 |
ML {* open Simpdata *} |
1296 |
||
21151 | 1297 |
setup {* |
1298 |
Simplifier.method_setup Splitter.split_modifiers |
|
21547
9c9fdf4c2949
moved order arities for fun and bool to Fun/Orderings
haftmann
parents:
21524
diff
changeset
|
1299 |
#> (fn thy => (change_simpset_of thy (fn _ => Simpdata.simpset_simprocs); thy)) |
21151 | 1300 |
#> Splitter.setup |
1301 |
#> Clasimp.setup |
|
1302 |
#> EqSubst.setup |
|
1303 |
*} |
|
1304 |
||
24035 | 1305 |
text {* Simproc for proving @{text "(y = x) == False"} from premise @{text "~(x = y)"}: *} |
1306 |
||
1307 |
simproc_setup neq ("x = y") = {* fn _ => |
|
1308 |
let |
|
1309 |
val neq_to_EQ_False = @{thm not_sym} RS @{thm Eq_FalseI}; |
|
1310 |
fun is_neq eq lhs rhs thm = |
|
1311 |
(case Thm.prop_of thm of |
|
1312 |
_ $ (Not $ (eq' $ l' $ r')) => |
|
1313 |
Not = HOLogic.Not andalso eq' = eq andalso |
|
1314 |
r' aconv lhs andalso l' aconv rhs |
|
1315 |
| _ => false); |
|
1316 |
fun proc ss ct = |
|
1317 |
(case Thm.term_of ct of |
|
1318 |
eq $ lhs $ rhs => |
|
1319 |
(case find_first (is_neq eq lhs rhs) (Simplifier.prems_of_ss ss) of |
|
1320 |
SOME thm => SOME (thm RS neq_to_EQ_False) |
|
1321 |
| NONE => NONE) |
|
1322 |
| _ => NONE); |
|
1323 |
in proc end; |
|
1324 |
*} |
|
1325 |
||
1326 |
simproc_setup let_simp ("Let x f") = {* |
|
1327 |
let |
|
1328 |
val (f_Let_unfold, x_Let_unfold) = |
|
1329 |
let val [(_$(f$x)$_)] = prems_of @{thm Let_unfold} |
|
1330 |
in (cterm_of @{theory} f, cterm_of @{theory} x) end |
|
1331 |
val (f_Let_folded, x_Let_folded) = |
|
1332 |
let val [(_$(f$x)$_)] = prems_of @{thm Let_folded} |
|
1333 |
in (cterm_of @{theory} f, cterm_of @{theory} x) end; |
|
1334 |
val g_Let_folded = |
|
1335 |
let val [(_$_$(g$_))] = prems_of @{thm Let_folded} in cterm_of @{theory} g end; |
|
1336 |
||
1337 |
fun proc _ ss ct = |
|
1338 |
let |
|
1339 |
val ctxt = Simplifier.the_context ss; |
|
1340 |
val thy = ProofContext.theory_of ctxt; |
|
1341 |
val t = Thm.term_of ct; |
|
1342 |
val ([t'], ctxt') = Variable.import_terms false [t] ctxt; |
|
1343 |
in Option.map (hd o Variable.export ctxt' ctxt o single) |
|
1344 |
(case t' of Const ("Let",_) $ x $ f => (* x and f are already in normal form *) |
|
1345 |
if is_Free x orelse is_Bound x orelse is_Const x |
|
1346 |
then SOME @{thm Let_def} |
|
1347 |
else |
|
1348 |
let |
|
1349 |
val n = case f of (Abs (x,_,_)) => x | _ => "x"; |
|
1350 |
val cx = cterm_of thy x; |
|
1351 |
val {T=xT,...} = rep_cterm cx; |
|
1352 |
val cf = cterm_of thy f; |
|
1353 |
val fx_g = Simplifier.rewrite ss (Thm.capply cf cx); |
|
1354 |
val (_$_$g) = prop_of fx_g; |
|
1355 |
val g' = abstract_over (x,g); |
|
1356 |
in (if (g aconv g') |
|
1357 |
then |
|
1358 |
let |
|
1359 |
val rl = |
|
1360 |
cterm_instantiate [(f_Let_unfold,cf),(x_Let_unfold,cx)] @{thm Let_unfold}; |
|
1361 |
in SOME (rl OF [fx_g]) end |
|
1362 |
else if Term.betapply (f,x) aconv g then NONE (*avoid identity conversion*) |
|
1363 |
else let |
|
1364 |
val abs_g'= Abs (n,xT,g'); |
|
1365 |
val g'x = abs_g'$x; |
|
1366 |
val g_g'x = symmetric (beta_conversion false (cterm_of thy g'x)); |
|
1367 |
val rl = cterm_instantiate |
|
1368 |
[(f_Let_folded,cterm_of thy f),(x_Let_folded,cx), |
|
1369 |
(g_Let_folded,cterm_of thy abs_g')] |
|
1370 |
@{thm Let_folded}; |
|
1371 |
in SOME (rl OF [transitive fx_g g_g'x]) |
|
1372 |
end) |
|
1373 |
end |
|
1374 |
| _ => NONE) |
|
1375 |
end |
|
1376 |
in proc end *} |
|
1377 |
||
1378 |
||
21151 | 1379 |
lemma True_implies_equals: "(True \<Longrightarrow> PROP P) \<equiv> PROP P" |
1380 |
proof |
|
23389 | 1381 |
assume "True \<Longrightarrow> PROP P" |
1382 |
from this [OF TrueI] show "PROP P" . |
|
21151 | 1383 |
next |
1384 |
assume "PROP P" |
|
23389 | 1385 |
then show "PROP P" . |
21151 | 1386 |
qed |
1387 |
||
1388 |
lemma ex_simps: |
|
1389 |
"!!P Q. (EX x. P x & Q) = ((EX x. P x) & Q)" |
|
1390 |
"!!P Q. (EX x. P & Q x) = (P & (EX x. Q x))" |
|
1391 |
"!!P Q. (EX x. P x | Q) = ((EX x. P x) | Q)" |
|
1392 |
"!!P Q. (EX x. P | Q x) = (P | (EX x. Q x))" |
|
1393 |
"!!P Q. (EX x. P x --> Q) = ((ALL x. P x) --> Q)" |
|
1394 |
"!!P Q. (EX x. P --> Q x) = (P --> (EX x. Q x))" |
|
1395 |
-- {* Miniscoping: pushing in existential quantifiers. *} |
|
1396 |
by (iprover | blast)+ |
|
1397 |
||
1398 |
lemma all_simps: |
|
1399 |
"!!P Q. (ALL x. P x & Q) = ((ALL x. P x) & Q)" |
|
1400 |
"!!P Q. (ALL x. P & Q x) = (P & (ALL x. Q x))" |
|
1401 |
"!!P Q. (ALL x. P x | Q) = ((ALL x. P x) | Q)" |
|
1402 |
"!!P Q. (ALL x. P | Q x) = (P | (ALL x. Q x))" |
|
1403 |
"!!P Q. (ALL x. P x --> Q) = ((EX x. P x) --> Q)" |
|
1404 |
"!!P Q. (ALL x. P --> Q x) = (P --> (ALL x. Q x))" |
|
1405 |
-- {* Miniscoping: pushing in universal quantifiers. *} |
|
1406 |
by (iprover | blast)+ |
|
15481 | 1407 |
|
21671 | 1408 |
lemmas [simp] = |
1409 |
triv_forall_equality (*prunes params*) |
|
1410 |
True_implies_equals (*prune asms `True'*) |
|
1411 |
if_True |
|
1412 |
if_False |
|
1413 |
if_cancel |
|
1414 |
if_eq_cancel |
|
1415 |
imp_disjL |
|
20973 | 1416 |
(*In general it seems wrong to add distributive laws by default: they |
1417 |
might cause exponential blow-up. But imp_disjL has been in for a while |
|
1418 |
and cannot be removed without affecting existing proofs. Moreover, |
|
1419 |
rewriting by "(P|Q --> R) = ((P-->R)&(Q-->R))" might be justified on the |
|
1420 |
grounds that it allows simplification of R in the two cases.*) |
|
21671 | 1421 |
conj_assoc |
1422 |
disj_assoc |
|
1423 |
de_Morgan_conj |
|
1424 |
de_Morgan_disj |
|
1425 |
imp_disj1 |
|
1426 |
imp_disj2 |
|
1427 |
not_imp |
|
1428 |
disj_not1 |
|
1429 |
not_all |
|
1430 |
not_ex |
|
1431 |
cases_simp |
|
1432 |
the_eq_trivial |
|
1433 |
the_sym_eq_trivial |
|
1434 |
ex_simps |
|
1435 |
all_simps |
|
1436 |
simp_thms |
|
1437 |
||
1438 |
lemmas [cong] = imp_cong simp_implies_cong |
|
1439 |
lemmas [split] = split_if |
|
20973 | 1440 |
|
22377 | 1441 |
ML {* val HOL_ss = @{simpset} *} |
20973 | 1442 |
|
20944 | 1443 |
text {* Simplifies x assuming c and y assuming ~c *} |
1444 |
lemma if_cong: |
|
1445 |
assumes "b = c" |
|
1446 |
and "c \<Longrightarrow> x = u" |
|
1447 |
and "\<not> c \<Longrightarrow> y = v" |
|
1448 |
shows "(if b then x else y) = (if c then u else v)" |
|
23553 | 1449 |
unfolding if_def using assms by simp |
20944 | 1450 |
|
1451 |
text {* Prevents simplification of x and y: |
|
1452 |
faster and allows the execution of functional programs. *} |
|
1453 |
lemma if_weak_cong [cong]: |
|
1454 |
assumes "b = c" |
|
1455 |
shows "(if b then x else y) = (if c then x else y)" |
|
23553 | 1456 |
using assms by (rule arg_cong) |
20944 | 1457 |
|
1458 |
text {* Prevents simplification of t: much faster *} |
|
1459 |
lemma let_weak_cong: |
|
1460 |
assumes "a = b" |
|
1461 |
shows "(let x = a in t x) = (let x = b in t x)" |
|
23553 | 1462 |
using assms by (rule arg_cong) |
20944 | 1463 |
|
1464 |
text {* To tidy up the result of a simproc. Only the RHS will be simplified. *} |
|
1465 |
lemma eq_cong2: |
|
1466 |
assumes "u = u'" |
|
1467 |
shows "(t \<equiv> u) \<equiv> (t \<equiv> u')" |
|
23553 | 1468 |
using assms by simp |
20944 | 1469 |
|
1470 |
lemma if_distrib: |
|
1471 |
"f (if c then x else y) = (if c then f x else f y)" |
|
1472 |
by simp |
|
1473 |
||
1474 |
text {* This lemma restricts the effect of the rewrite rule u=v to the left-hand |
|
21502 | 1475 |
side of an equality. Used in @{text "{Integ,Real}/simproc.ML"} *} |
20944 | 1476 |
lemma restrict_to_left: |
1477 |
assumes "x = y" |
|
1478 |
shows "(x = z) = (y = z)" |
|
23553 | 1479 |
using assms by simp |
20944 | 1480 |
|
17459 | 1481 |
|
20944 | 1482 |
subsubsection {* Generic cases and induction *} |
17459 | 1483 |
|
20944 | 1484 |
text {* Rule projections: *} |
18887 | 1485 |
|
20944 | 1486 |
ML {* |
1487 |
structure ProjectRule = ProjectRuleFun |
|
1488 |
(struct |
|
22129 | 1489 |
val conjunct1 = @{thm conjunct1}; |
1490 |
val conjunct2 = @{thm conjunct2}; |
|
1491 |
val mp = @{thm mp}; |
|
20944 | 1492 |
end) |
17459 | 1493 |
*} |
1494 |
||
11824
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
1495 |
constdefs |
18457 | 1496 |
induct_forall where "induct_forall P == \<forall>x. P x" |
1497 |
induct_implies where "induct_implies A B == A \<longrightarrow> B" |
|
1498 |
induct_equal where "induct_equal x y == x = y" |
|
1499 |
induct_conj where "induct_conj A B == A \<and> B" |
|
11824
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
1500 |
|
11989 | 1501 |
lemma induct_forall_eq: "(!!x. P x) == Trueprop (induct_forall (\<lambda>x. P x))" |
18457 | 1502 |
by (unfold atomize_all induct_forall_def) |
11824
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
1503 |
|
11989 | 1504 |
lemma induct_implies_eq: "(A ==> B) == Trueprop (induct_implies A B)" |
18457 | 1505 |
by (unfold atomize_imp induct_implies_def) |
11824
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
1506 |
|
11989 | 1507 |
lemma induct_equal_eq: "(x == y) == Trueprop (induct_equal x y)" |
18457 | 1508 |
by (unfold atomize_eq induct_equal_def) |
1509 |
||
1510 |
lemma induct_conj_eq: |
|
1511 |
includes meta_conjunction_syntax |
|
1512 |
shows "(A && B) == Trueprop (induct_conj A B)" |
|
1513 |
by (unfold atomize_conj induct_conj_def) |
|
1514 |
||
1515 |
lemmas induct_atomize = induct_forall_eq induct_implies_eq induct_equal_eq induct_conj_eq |
|
1516 |
lemmas induct_rulify [symmetric, standard] = induct_atomize |
|
1517 |
lemmas induct_rulify_fallback = |
|
1518 |
induct_forall_def induct_implies_def induct_equal_def induct_conj_def |
|
1519 |
||
11824
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
1520 |
|
11989 | 1521 |
lemma induct_forall_conj: "induct_forall (\<lambda>x. induct_conj (A x) (B x)) = |
1522 |
induct_conj (induct_forall A) (induct_forall B)" |
|
17589 | 1523 |
by (unfold induct_forall_def induct_conj_def) iprover |
11824
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
1524 |
|
11989 | 1525 |
lemma induct_implies_conj: "induct_implies C (induct_conj A B) = |
1526 |
induct_conj (induct_implies C A) (induct_implies C B)" |
|
17589 | 1527 |
by (unfold induct_implies_def induct_conj_def) iprover |
11989 | 1528 |
|
13598
8bc77b17f59f
Fixed problem with induct_conj_curry: variable C should have type prop.
berghofe
parents:
13596
diff
changeset
|
1529 |
lemma induct_conj_curry: "(induct_conj A B ==> PROP C) == (A ==> B ==> PROP C)" |
8bc77b17f59f
Fixed problem with induct_conj_curry: variable C should have type prop.
berghofe
parents:
13596
diff
changeset
|
1530 |
proof |
8bc77b17f59f
Fixed problem with induct_conj_curry: variable C should have type prop.
berghofe
parents:
13596
diff
changeset
|
1531 |
assume r: "induct_conj A B ==> PROP C" and A B |
18457 | 1532 |
show "PROP C" by (rule r) (simp add: induct_conj_def `A` `B`) |
13598
8bc77b17f59f
Fixed problem with induct_conj_curry: variable C should have type prop.
berghofe
parents:
13596
diff
changeset
|
1533 |
next |
8bc77b17f59f
Fixed problem with induct_conj_curry: variable C should have type prop.
berghofe
parents:
13596
diff
changeset
|
1534 |
assume r: "A ==> B ==> PROP C" and "induct_conj A B" |
18457 | 1535 |
show "PROP C" by (rule r) (simp_all add: `induct_conj A B` [unfolded induct_conj_def]) |
13598
8bc77b17f59f
Fixed problem with induct_conj_curry: variable C should have type prop.
berghofe
parents:
13596
diff
changeset
|
1536 |
qed |
11824
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
1537 |
|
11989 | 1538 |
lemmas induct_conj = induct_forall_conj induct_implies_conj induct_conj_curry |
11824
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
1539 |
|
11989 | 1540 |
hide const induct_forall induct_implies induct_equal induct_conj |
11824
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
1541 |
|
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
1542 |
text {* Method setup. *} |
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
1543 |
|
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
1544 |
ML {* |
24830
a7b3ab44d993
moved Pure/Isar/induct_attrib.ML and Provers/induct_method.ML to Tools/induct.ML;
wenzelm
parents:
24748
diff
changeset
|
1545 |
structure Induct = InductFun |
a7b3ab44d993
moved Pure/Isar/induct_attrib.ML and Provers/induct_method.ML to Tools/induct.ML;
wenzelm
parents:
24748
diff
changeset
|
1546 |
( |
22129 | 1547 |
val cases_default = @{thm case_split} |
1548 |
val atomize = @{thms induct_atomize} |
|
1549 |
val rulify = @{thms induct_rulify} |
|
1550 |
val rulify_fallback = @{thms induct_rulify_fallback} |
|
24830
a7b3ab44d993
moved Pure/Isar/induct_attrib.ML and Provers/induct_method.ML to Tools/induct.ML;
wenzelm
parents:
24748
diff
changeset
|
1551 |
); |
11824
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
1552 |
*} |
f4c1882dde2c
setup generic cases and induction (from Inductive.thy);
wenzelm
parents:
11770
diff
changeset
|
1553 |
|
24830
a7b3ab44d993
moved Pure/Isar/induct_attrib.ML and Provers/induct_method.ML to Tools/induct.ML;
wenzelm
parents:
24748
diff
changeset
|
1554 |
setup Induct.setup |
18457 | 1555 |
|
20944 | 1556 |
|
1557 |
subsection {* Other simple lemmas and lemma duplicates *} |
|
1558 |
||
24166 | 1559 |
lemma Let_0 [simp]: "Let 0 f = f 0" |
1560 |
unfolding Let_def .. |
|
1561 |
||
1562 |
lemma Let_1 [simp]: "Let 1 f = f 1" |
|
1563 |
unfolding Let_def .. |
|
1564 |
||
20944 | 1565 |
lemma ex1_eq [iff]: "EX! x. x = t" "EX! x. t = x" |
1566 |
by blast+ |
|
1567 |
||
1568 |
lemma choice_eq: "(ALL x. EX! y. P x y) = (EX! f. ALL x. P x (f x))" |
|
1569 |
apply (rule iffI) |
|
1570 |
apply (rule_tac a = "%x. THE y. P x y" in ex1I) |
|
1571 |
apply (fast dest!: theI') |
|
1572 |
apply (fast intro: ext the1_equality [symmetric]) |
|
1573 |
apply (erule ex1E) |
|
1574 |
apply (rule allI) |
|
1575 |
apply (rule ex1I) |
|
1576 |
apply (erule spec) |
|
1577 |
apply (erule_tac x = "%z. if z = x then y else f z" in allE) |
|
1578 |
apply (erule impE) |
|
1579 |
apply (rule allI) |
|
1580 |
apply (rule_tac P = "xa = x" in case_split_thm) |
|
1581 |
apply (drule_tac [3] x = x in fun_cong, simp_all) |
|
1582 |
done |
|
1583 |
||
1584 |
lemma mk_left_commute: |
|
21547
9c9fdf4c2949
moved order arities for fun and bool to Fun/Orderings
haftmann
parents:
21524
diff
changeset
|
1585 |
fixes f (infix "\<otimes>" 60) |
9c9fdf4c2949
moved order arities for fun and bool to Fun/Orderings
haftmann
parents:
21524
diff
changeset
|
1586 |
assumes a: "\<And>x y z. (x \<otimes> y) \<otimes> z = x \<otimes> (y \<otimes> z)" and |
9c9fdf4c2949
moved order arities for fun and bool to Fun/Orderings
haftmann
parents:
21524
diff
changeset
|
1587 |
c: "\<And>x y. x \<otimes> y = y \<otimes> x" |
9c9fdf4c2949
moved order arities for fun and bool to Fun/Orderings
haftmann
parents:
21524
diff
changeset
|
1588 |
shows "x \<otimes> (y \<otimes> z) = y \<otimes> (x \<otimes> z)" |
20944 | 1589 |
by (rule trans [OF trans [OF c a] arg_cong [OF c, of "f y"]]) |
1590 |
||
22218 | 1591 |
lemmas eq_sym_conv = eq_commute |
1592 |
||
23037
6c72943a71b1
added a set of NNF normalization lemmas and nnf_conv
chaieb
parents:
22993
diff
changeset
|
1593 |
lemma nnf_simps: |
6c72943a71b1
added a set of NNF normalization lemmas and nnf_conv
chaieb
parents:
22993
diff
changeset
|
1594 |
"(\<not>(P \<and> Q)) = (\<not> P \<or> \<not> Q)" "(\<not> (P \<or> Q)) = (\<not> P \<and> \<not>Q)" "(P \<longrightarrow> Q) = (\<not>P \<or> Q)" |
6c72943a71b1
added a set of NNF normalization lemmas and nnf_conv
chaieb
parents:
22993
diff
changeset
|
1595 |
"(P = Q) = ((P \<and> Q) \<or> (\<not>P \<and> \<not> Q))" "(\<not>(P = Q)) = ((P \<and> \<not> Q) \<or> (\<not>P \<and> Q))" |
6c72943a71b1
added a set of NNF normalization lemmas and nnf_conv
chaieb
parents:
22993
diff
changeset
|
1596 |
"(\<not> \<not>(P)) = P" |
6c72943a71b1
added a set of NNF normalization lemmas and nnf_conv
chaieb
parents:
22993
diff
changeset
|
1597 |
by blast+ |
6c72943a71b1
added a set of NNF normalization lemmas and nnf_conv
chaieb
parents:
22993
diff
changeset
|
1598 |
|
21671 | 1599 |
|
1600 |
subsection {* Basic ML bindings *} |
|
1601 |
||
1602 |
ML {* |
|
22129 | 1603 |
val FalseE = @{thm FalseE} |
1604 |
val Let_def = @{thm Let_def} |
|
1605 |
val TrueI = @{thm TrueI} |
|
1606 |
val allE = @{thm allE} |
|
1607 |
val allI = @{thm allI} |
|
1608 |
val all_dupE = @{thm all_dupE} |
|
1609 |
val arg_cong = @{thm arg_cong} |
|
1610 |
val box_equals = @{thm box_equals} |
|
1611 |
val ccontr = @{thm ccontr} |
|
1612 |
val classical = @{thm classical} |
|
1613 |
val conjE = @{thm conjE} |
|
1614 |
val conjI = @{thm conjI} |
|
1615 |
val conjunct1 = @{thm conjunct1} |
|
1616 |
val conjunct2 = @{thm conjunct2} |
|
1617 |
val disjCI = @{thm disjCI} |
|
1618 |
val disjE = @{thm disjE} |
|
1619 |
val disjI1 = @{thm disjI1} |
|
1620 |
val disjI2 = @{thm disjI2} |
|
1621 |
val eq_reflection = @{thm eq_reflection} |
|
1622 |
val ex1E = @{thm ex1E} |
|
1623 |
val ex1I = @{thm ex1I} |
|
1624 |
val ex1_implies_ex = @{thm ex1_implies_ex} |
|
1625 |
val exE = @{thm exE} |
|
1626 |
val exI = @{thm exI} |
|
1627 |
val excluded_middle = @{thm excluded_middle} |
|
1628 |
val ext = @{thm ext} |
|
1629 |
val fun_cong = @{thm fun_cong} |
|
1630 |
val iffD1 = @{thm iffD1} |
|
1631 |
val iffD2 = @{thm iffD2} |
|
1632 |
val iffI = @{thm iffI} |
|
1633 |
val impE = @{thm impE} |
|
1634 |
val impI = @{thm impI} |
|
1635 |
val meta_eq_to_obj_eq = @{thm meta_eq_to_obj_eq} |
|
1636 |
val mp = @{thm mp} |
|
1637 |
val notE = @{thm notE} |
|
1638 |
val notI = @{thm notI} |
|
1639 |
val not_all = @{thm not_all} |
|
1640 |
val not_ex = @{thm not_ex} |
|
1641 |
val not_iff = @{thm not_iff} |
|
1642 |
val not_not = @{thm not_not} |
|
1643 |
val not_sym = @{thm not_sym} |
|
1644 |
val refl = @{thm refl} |
|
1645 |
val rev_mp = @{thm rev_mp} |
|
1646 |
val spec = @{thm spec} |
|
1647 |
val ssubst = @{thm ssubst} |
|
1648 |
val subst = @{thm subst} |
|
1649 |
val sym = @{thm sym} |
|
1650 |
val trans = @{thm trans} |
|
21671 | 1651 |
*} |
1652 |
||
1653 |
||
24280 | 1654 |
subsection {* Code generator basic setup -- see further @{text Code_Setup.thy} *} |
23247 | 1655 |
|
24462 | 1656 |
setup "CodeName.setup #> CodeTarget.setup #> Nbe.setup" |
23247 | 1657 |
|
1658 |
class eq (attach "op =") = type |
|
1659 |
||
1660 |
code_datatype True False |
|
1661 |
||
1662 |
lemma [code func]: |
|
24280 | 1663 |
shows "False \<and> x \<longleftrightarrow> False" |
1664 |
and "True \<and> x \<longleftrightarrow> x" |
|
1665 |
and "x \<and> False \<longleftrightarrow> False" |
|
1666 |
and "x \<and> True \<longleftrightarrow> x" by simp_all |
|
23247 | 1667 |
|
1668 |
lemma [code func]: |
|
24280 | 1669 |
shows "False \<or> x \<longleftrightarrow> x" |
1670 |
and "True \<or> x \<longleftrightarrow> True" |
|
1671 |
and "x \<or> False \<longleftrightarrow> x" |
|
1672 |
and "x \<or> True \<longleftrightarrow> True" by simp_all |
|
23247 | 1673 |
|
1674 |
lemma [code func]: |
|
24280 | 1675 |
shows "\<not> True \<longleftrightarrow> False" |
1676 |
and "\<not> False \<longleftrightarrow> True" by (rule HOL.simp_thms)+ |
|
23247 | 1677 |
|
1678 |
instance bool :: eq .. |
|
1679 |
||
1680 |
lemma [code func]: |
|
24280 | 1681 |
shows "False = P \<longleftrightarrow> \<not> P" |
1682 |
and "True = P \<longleftrightarrow> P" |
|
1683 |
and "P = False \<longleftrightarrow> \<not> P" |
|
1684 |
and "P = True \<longleftrightarrow> P" by simp_all |
|
23247 | 1685 |
|
1686 |
code_datatype Trueprop "prop" |
|
1687 |
||
1688 |
code_datatype "TYPE('a)" |
|
1689 |
||
24844
98c006a30218
certificates for code generator case expressions
haftmann
parents:
24842
diff
changeset
|
1690 |
lemma Let_case_cert: |
98c006a30218
certificates for code generator case expressions
haftmann
parents:
24842
diff
changeset
|
1691 |
assumes "CASE \<equiv> (\<lambda>x. Let x f)" |
98c006a30218
certificates for code generator case expressions
haftmann
parents:
24842
diff
changeset
|
1692 |
shows "CASE x \<equiv> f x" |
98c006a30218
certificates for code generator case expressions
haftmann
parents:
24842
diff
changeset
|
1693 |
using assms by simp_all |
98c006a30218
certificates for code generator case expressions
haftmann
parents:
24842
diff
changeset
|
1694 |
|
98c006a30218
certificates for code generator case expressions
haftmann
parents:
24842
diff
changeset
|
1695 |
lemma If_case_cert: |
98c006a30218
certificates for code generator case expressions
haftmann
parents:
24842
diff
changeset
|
1696 |
includes meta_conjunction_syntax |
98c006a30218
certificates for code generator case expressions
haftmann
parents:
24842
diff
changeset
|
1697 |
assumes "CASE \<equiv> (\<lambda>b. If b f g)" |
98c006a30218
certificates for code generator case expressions
haftmann
parents:
24842
diff
changeset
|
1698 |
shows "(CASE True \<equiv> f) && (CASE False \<equiv> g)" |
98c006a30218
certificates for code generator case expressions
haftmann
parents:
24842
diff
changeset
|
1699 |
using assms by simp_all |
98c006a30218
certificates for code generator case expressions
haftmann
parents:
24842
diff
changeset
|
1700 |
|
98c006a30218
certificates for code generator case expressions
haftmann
parents:
24842
diff
changeset
|
1701 |
setup {* |
98c006a30218
certificates for code generator case expressions
haftmann
parents:
24842
diff
changeset
|
1702 |
Code.add_case @{thm Let_case_cert} |
98c006a30218
certificates for code generator case expressions
haftmann
parents:
24842
diff
changeset
|
1703 |
#> Code.add_case @{thm If_case_cert} |
98c006a30218
certificates for code generator case expressions
haftmann
parents:
24842
diff
changeset
|
1704 |
#> Code.add_undefined @{const_name undefined} |
98c006a30218
certificates for code generator case expressions
haftmann
parents:
24842
diff
changeset
|
1705 |
*} |
98c006a30218
certificates for code generator case expressions
haftmann
parents:
24842
diff
changeset
|
1706 |
|
23247 | 1707 |
|
22839 | 1708 |
subsection {* Legacy tactics and ML bindings *} |
21671 | 1709 |
|
1710 |
ML {* |
|
1711 |
fun strip_tac i = REPEAT (resolve_tac [impI, allI] i); |
|
1712 |
||
1713 |
(* combination of (spec RS spec RS ...(j times) ... spec RS mp) *) |
|
1714 |
local |
|
1715 |
fun wrong_prem (Const ("All", _) $ (Abs (_, _, t))) = wrong_prem t |
|
1716 |
| wrong_prem (Bound _) = true |
|
1717 |
| wrong_prem _ = false; |
|
1718 |
val filter_right = filter (not o wrong_prem o HOLogic.dest_Trueprop o hd o Thm.prems_of); |
|
1719 |
in |
|
1720 |
fun smp i = funpow i (fn m => filter_right ([spec] RL m)) ([mp]); |
|
1721 |
fun smp_tac j = EVERY'[dresolve_tac (smp j), atac]; |
|
1722 |
end; |
|
22839 | 1723 |
|
1724 |
val all_conj_distrib = thm "all_conj_distrib"; |
|
1725 |
val all_simps = thms "all_simps"; |
|
1726 |
val atomize_not = thm "atomize_not"; |
|
24830
a7b3ab44d993
moved Pure/Isar/induct_attrib.ML and Provers/induct_method.ML to Tools/induct.ML;
wenzelm
parents:
24748
diff
changeset
|
1727 |
val case_split = thm "case_split"; |
22839 | 1728 |
val case_split_thm = thm "case_split_thm" |
1729 |
val cases_simp = thm "cases_simp"; |
|
1730 |
val choice_eq = thm "choice_eq" |
|
1731 |
val cong = thm "cong" |
|
1732 |
val conj_comms = thms "conj_comms"; |
|
1733 |
val conj_cong = thm "conj_cong"; |
|
1734 |
val de_Morgan_conj = thm "de_Morgan_conj"; |
|
1735 |
val de_Morgan_disj = thm "de_Morgan_disj"; |
|
1736 |
val disj_assoc = thm "disj_assoc"; |
|
1737 |
val disj_comms = thms "disj_comms"; |
|
1738 |
val disj_cong = thm "disj_cong"; |
|
1739 |
val eq_ac = thms "eq_ac"; |
|
1740 |
val eq_cong2 = thm "eq_cong2" |
|
1741 |
val Eq_FalseI = thm "Eq_FalseI"; |
|
1742 |
val Eq_TrueI = thm "Eq_TrueI"; |
|
1743 |
val Ex1_def = thm "Ex1_def" |
|
1744 |
val ex_disj_distrib = thm "ex_disj_distrib"; |
|
1745 |
val ex_simps = thms "ex_simps"; |
|
1746 |
val if_cancel = thm "if_cancel"; |
|
1747 |
val if_eq_cancel = thm "if_eq_cancel"; |
|
1748 |
val if_False = thm "if_False"; |
|
1749 |
val iff_conv_conj_imp = thm "iff_conv_conj_imp"; |
|
1750 |
val iff = thm "iff" |
|
1751 |
val if_splits = thms "if_splits"; |
|
1752 |
val if_True = thm "if_True"; |
|
1753 |
val if_weak_cong = thm "if_weak_cong" |
|
1754 |
val imp_all = thm "imp_all"; |
|
1755 |
val imp_cong = thm "imp_cong"; |
|
1756 |
val imp_conjL = thm "imp_conjL"; |
|
1757 |
val imp_conjR = thm "imp_conjR"; |
|
1758 |
val imp_conv_disj = thm "imp_conv_disj"; |
|
1759 |
val simp_implies_def = thm "simp_implies_def"; |
|
1760 |
val simp_thms = thms "simp_thms"; |
|
1761 |
val split_if = thm "split_if"; |
|
1762 |
val the1_equality = thm "the1_equality" |
|
1763 |
val theI = thm "theI" |
|
1764 |
val theI' = thm "theI'" |
|
1765 |
val True_implies_equals = thm "True_implies_equals"; |
|
23037
6c72943a71b1
added a set of NNF normalization lemmas and nnf_conv
chaieb
parents:
22993
diff
changeset
|
1766 |
val nnf_conv = Simplifier.rewrite (HOL_basic_ss addsimps simp_thms @ @{thms "nnf_simps"}) |
6c72943a71b1
added a set of NNF normalization lemmas and nnf_conv
chaieb
parents:
22993
diff
changeset
|
1767 |
|
21671 | 1768 |
*} |
1769 |
||
14357 | 1770 |
end |