author | wenzelm |
Tue, 15 Oct 2019 13:34:50 +0200 | |
changeset 70880 | de2e2382bc0d |
parent 70432 | 495881aadbff |
child 71839 | 0bbe0866b7e6 |
permissions | -rw-r--r-- |
1268 | 1 |
(* Title: FOL/IFOL.thy |
11677 | 2 |
Author: Lawrence C Paulson and Markus Wenzel |
3 |
*) |
|
35 | 4 |
|
60770 | 5 |
section \<open>Intuitionistic first-order logic\<close> |
35 | 6 |
|
15481 | 7 |
theory IFOL |
8 |
imports Pure |
|
9 |
begin |
|
7355
4c43090659ca
proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents:
6340
diff
changeset
|
10 |
|
69605 | 11 |
ML_file \<open>~~/src/Tools/misc_legacy.ML\<close> |
12 |
ML_file \<open>~~/src/Provers/splitter.ML\<close> |
|
13 |
ML_file \<open>~~/src/Provers/hypsubst.ML\<close> |
|
14 |
ML_file \<open>~~/src/Tools/IsaPlanner/zipper.ML\<close> |
|
15 |
ML_file \<open>~~/src/Tools/IsaPlanner/isand.ML\<close> |
|
16 |
ML_file \<open>~~/src/Tools/IsaPlanner/rw_inst.ML\<close> |
|
17 |
ML_file \<open>~~/src/Provers/quantifier1.ML\<close> |
|
18 |
ML_file \<open>~~/src/Tools/intuitionistic.ML\<close> |
|
19 |
ML_file \<open>~~/src/Tools/project_rule.ML\<close> |
|
20 |
ML_file \<open>~~/src/Tools/atomize_elim.ML\<close> |
|
48891 | 21 |
|
0 | 22 |
|
60770 | 23 |
subsection \<open>Syntax and axiomatic basis\<close> |
11677 | 24 |
|
39557
fe5722fce758
renamed structure PureThy to Pure_Thy and moved most content to Global_Theory, to emphasize that this is global-only;
wenzelm
parents:
39159
diff
changeset
|
25 |
setup Pure_Thy.old_appl_syntax_setup |
70880 | 26 |
setup \<open>Proofterm.set_preproc (Proof_Rewrite_Rules.standard_preproc [])\<close> |
26956
1309a6a0a29f
setup PureThy.old_appl_syntax_setup -- theory Pure provides regular application syntax by default;
wenzelm
parents:
26580
diff
changeset
|
27 |
|
55380
4de48353034e
prefer vacuous definitional type classes over axiomatic ones;
wenzelm
parents:
52241
diff
changeset
|
28 |
class "term" |
69590 | 29 |
default_sort \<open>term\<close> |
0 | 30 |
|
7355
4c43090659ca
proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents:
6340
diff
changeset
|
31 |
typedecl o |
79 | 32 |
|
11747 | 33 |
judgment |
69590 | 34 |
Trueprop :: \<open>o \<Rightarrow> prop\<close> (\<open>(_)\<close> 5) |
0 | 35 |
|
79 | 36 |
|
60770 | 37 |
subsubsection \<open>Equality\<close> |
35 | 38 |
|
46972 | 39 |
axiomatization |
69590 | 40 |
eq :: \<open>['a, 'a] \<Rightarrow> o\<close> (infixl \<open>=\<close> 50) |
46972 | 41 |
where |
69590 | 42 |
refl: \<open>a = a\<close> and |
43 |
subst: \<open>a = b \<Longrightarrow> P(a) \<Longrightarrow> P(b)\<close> |
|
79 | 44 |
|
0 | 45 |
|
60770 | 46 |
subsubsection \<open>Propositional logic\<close> |
46972 | 47 |
|
48 |
axiomatization |
|
69590 | 49 |
False :: \<open>o\<close> and |
50 |
conj :: \<open>[o, o] => o\<close> (infixr \<open>\<and>\<close> 35) and |
|
51 |
disj :: \<open>[o, o] => o\<close> (infixr \<open>\<or>\<close> 30) and |
|
52 |
imp :: \<open>[o, o] => o\<close> (infixr \<open>\<longrightarrow>\<close> 25) |
|
46972 | 53 |
where |
69590 | 54 |
conjI: \<open>\<lbrakk>P; Q\<rbrakk> \<Longrightarrow> P \<and> Q\<close> and |
55 |
conjunct1: \<open>P \<and> Q \<Longrightarrow> P\<close> and |
|
56 |
conjunct2: \<open>P \<and> Q \<Longrightarrow> Q\<close> and |
|
46972 | 57 |
|
69590 | 58 |
disjI1: \<open>P \<Longrightarrow> P \<or> Q\<close> and |
59 |
disjI2: \<open>Q \<Longrightarrow> P \<or> Q\<close> and |
|
60 |
disjE: \<open>\<lbrakk>P \<or> Q; P \<Longrightarrow> R; Q \<Longrightarrow> R\<rbrakk> \<Longrightarrow> R\<close> and |
|
46972 | 61 |
|
69590 | 62 |
impI: \<open>(P \<Longrightarrow> Q) \<Longrightarrow> P \<longrightarrow> Q\<close> and |
63 |
mp: \<open>\<lbrakk>P \<longrightarrow> Q; P\<rbrakk> \<Longrightarrow> Q\<close> and |
|
46972 | 64 |
|
69590 | 65 |
FalseE: \<open>False \<Longrightarrow> P\<close> |
46972 | 66 |
|
67 |
||
60770 | 68 |
subsubsection \<open>Quantifiers\<close> |
46972 | 69 |
|
70 |
axiomatization |
|
69590 | 71 |
All :: \<open>('a \<Rightarrow> o) \<Rightarrow> o\<close> (binder \<open>\<forall>\<close> 10) and |
72 |
Ex :: \<open>('a \<Rightarrow> o) \<Rightarrow> o\<close> (binder \<open>\<exists>\<close> 10) |
|
46972 | 73 |
where |
69590 | 74 |
allI: \<open>(\<And>x. P(x)) \<Longrightarrow> (\<forall>x. P(x))\<close> and |
75 |
spec: \<open>(\<forall>x. P(x)) \<Longrightarrow> P(x)\<close> and |
|
76 |
exI: \<open>P(x) \<Longrightarrow> (\<exists>x. P(x))\<close> and |
|
77 |
exE: \<open>\<lbrakk>\<exists>x. P(x); \<And>x. P(x) \<Longrightarrow> R\<rbrakk> \<Longrightarrow> R\<close> |
|
46972 | 78 |
|
79 |
||
60770 | 80 |
subsubsection \<open>Definitions\<close> |
46972 | 81 |
|
69590 | 82 |
definition \<open>True \<equiv> False \<longrightarrow> False\<close> |
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
83 |
|
69587 | 84 |
definition Not (\<open>\<not> _\<close> [40] 40) |
69590 | 85 |
where not_def: \<open>\<not> P \<equiv> P \<longrightarrow> False\<close> |
46972 | 86 |
|
69587 | 87 |
definition iff (infixr \<open>\<longleftrightarrow>\<close> 25) |
69590 | 88 |
where \<open>P \<longleftrightarrow> Q \<equiv> (P \<longrightarrow> Q) \<and> (Q \<longrightarrow> P)\<close> |
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
89 |
|
69590 | 90 |
definition Ex1 :: \<open>('a \<Rightarrow> o) \<Rightarrow> o\<close> (binder \<open>\<exists>!\<close> 10) |
91 |
where ex1_def: \<open>\<exists>!x. P(x) \<equiv> \<exists>x. P(x) \<and> (\<forall>y. P(y) \<longrightarrow> y = x)\<close> |
|
46972 | 92 |
|
62020 | 93 |
axiomatization where \<comment> \<open>Reflection, admissible\<close> |
69590 | 94 |
eq_reflection: \<open>(x = y) \<Longrightarrow> (x \<equiv> y)\<close> and |
95 |
iff_reflection: \<open>(P \<longleftrightarrow> Q) \<Longrightarrow> (P \<equiv> Q)\<close> |
|
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
96 |
|
69590 | 97 |
abbreviation not_equal :: \<open>['a, 'a] \<Rightarrow> o\<close> (infixl \<open>\<noteq>\<close> 50) |
98 |
where \<open>x \<noteq> y \<equiv> \<not> (x = y)\<close> |
|
46972 | 99 |
|
100 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
101 |
subsubsection \<open>Old-style ASCII syntax\<close> |
79 | 102 |
|
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
103 |
notation (ASCII) |
69587 | 104 |
not_equal (infixl \<open>~=\<close> 50) and |
105 |
Not (\<open>~ _\<close> [40] 40) and |
|
106 |
conj (infixr \<open>&\<close> 35) and |
|
107 |
disj (infixr \<open>|\<close> 30) and |
|
108 |
All (binder \<open>ALL \<close> 10) and |
|
109 |
Ex (binder \<open>EX \<close> 10) and |
|
110 |
Ex1 (binder \<open>EX! \<close> 10) and |
|
111 |
imp (infixr \<open>-->\<close> 25) and |
|
112 |
iff (infixr \<open><->\<close> 25) |
|
35 | 113 |
|
13779 | 114 |
|
60770 | 115 |
subsection \<open>Lemmas and proof tools\<close> |
11677 | 116 |
|
46972 | 117 |
lemmas strip = impI allI |
118 |
||
69590 | 119 |
lemma TrueI: \<open>True\<close> |
21539 | 120 |
unfolding True_def by (rule impI) |
121 |
||
122 |
||
62020 | 123 |
subsubsection \<open>Sequent-style elimination rules for \<open>\<and>\<close> \<open>\<longrightarrow>\<close> and \<open>\<forall>\<close>\<close> |
21539 | 124 |
|
125 |
lemma conjE: |
|
69590 | 126 |
assumes major: \<open>P \<and> Q\<close> |
127 |
and r: \<open>\<lbrakk>P; Q\<rbrakk> \<Longrightarrow> R\<close> |
|
128 |
shows \<open>R\<close> |
|
21539 | 129 |
apply (rule r) |
130 |
apply (rule major [THEN conjunct1]) |
|
131 |
apply (rule major [THEN conjunct2]) |
|
132 |
done |
|
133 |
||
134 |
lemma impE: |
|
69590 | 135 |
assumes major: \<open>P \<longrightarrow> Q\<close> |
136 |
and \<open>P\<close> |
|
137 |
and r: \<open>Q \<Longrightarrow> R\<close> |
|
138 |
shows \<open>R\<close> |
|
21539 | 139 |
apply (rule r) |
140 |
apply (rule major [THEN mp]) |
|
60770 | 141 |
apply (rule \<open>P\<close>) |
21539 | 142 |
done |
143 |
||
144 |
lemma allE: |
|
69590 | 145 |
assumes major: \<open>\<forall>x. P(x)\<close> |
146 |
and r: \<open>P(x) \<Longrightarrow> R\<close> |
|
147 |
shows \<open>R\<close> |
|
21539 | 148 |
apply (rule r) |
149 |
apply (rule major [THEN spec]) |
|
150 |
done |
|
151 |
||
69593 | 152 |
text \<open>Duplicates the quantifier; for use with \<^ML>\<open>eresolve_tac\<close>.\<close> |
21539 | 153 |
lemma all_dupE: |
69590 | 154 |
assumes major: \<open>\<forall>x. P(x)\<close> |
155 |
and r: \<open>\<lbrakk>P(x); \<forall>x. P(x)\<rbrakk> \<Longrightarrow> R\<close> |
|
156 |
shows \<open>R\<close> |
|
21539 | 157 |
apply (rule r) |
158 |
apply (rule major [THEN spec]) |
|
159 |
apply (rule major) |
|
160 |
done |
|
161 |
||
162 |
||
62020 | 163 |
subsubsection \<open>Negation rules, which translate between \<open>\<not> P\<close> and \<open>P \<longrightarrow> False\<close>\<close> |
21539 | 164 |
|
69590 | 165 |
lemma notI: \<open>(P \<Longrightarrow> False) \<Longrightarrow> \<not> P\<close> |
21539 | 166 |
unfolding not_def by (erule impI) |
167 |
||
69590 | 168 |
lemma notE: \<open>\<lbrakk>\<not> P; P\<rbrakk> \<Longrightarrow> R\<close> |
21539 | 169 |
unfolding not_def by (erule mp [THEN FalseE]) |
170 |
||
69590 | 171 |
lemma rev_notE: \<open>\<lbrakk>P; \<not> P\<rbrakk> \<Longrightarrow> R\<close> |
21539 | 172 |
by (erule notE) |
173 |
||
62020 | 174 |
text \<open>This is useful with the special implication rules for each kind of \<open>P\<close>.\<close> |
21539 | 175 |
lemma not_to_imp: |
69590 | 176 |
assumes \<open>\<not> P\<close> |
177 |
and r: \<open>P \<longrightarrow> False \<Longrightarrow> Q\<close> |
|
178 |
shows \<open>Q\<close> |
|
21539 | 179 |
apply (rule r) |
180 |
apply (rule impI) |
|
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
181 |
apply (erule notE [OF \<open>\<not> P\<close>]) |
21539 | 182 |
done |
183 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
184 |
text \<open> |
62020 | 185 |
For substitution into an assumption \<open>P\<close>, reduce \<open>Q\<close> to \<open>P \<longrightarrow> Q\<close>, substitute into this implication, then apply \<open>impI\<close> to |
186 |
move \<open>P\<close> back into the assumptions. |
|
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
187 |
\<close> |
69590 | 188 |
lemma rev_mp: \<open>\<lbrakk>P; P \<longrightarrow> Q\<rbrakk> \<Longrightarrow> Q\<close> |
21539 | 189 |
by (erule mp) |
190 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
191 |
text \<open>Contrapositive of an inference rule.\<close> |
21539 | 192 |
lemma contrapos: |
69590 | 193 |
assumes major: \<open>\<not> Q\<close> |
194 |
and minor: \<open>P \<Longrightarrow> Q\<close> |
|
195 |
shows \<open>\<not> P\<close> |
|
21539 | 196 |
apply (rule major [THEN notE, THEN notI]) |
197 |
apply (erule minor) |
|
198 |
done |
|
199 |
||
200 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
201 |
subsubsection \<open>Modus Ponens Tactics\<close> |
21539 | 202 |
|
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
203 |
text \<open> |
62020 | 204 |
Finds \<open>P \<longrightarrow> Q\<close> and P in the assumptions, replaces implication by |
205 |
\<open>Q\<close>. |
|
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
206 |
\<close> |
60770 | 207 |
ML \<open> |
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
208 |
fun mp_tac ctxt i = |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
209 |
eresolve_tac ctxt @{thms notE impE} i THEN assume_tac ctxt i; |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
210 |
fun eq_mp_tac ctxt i = |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
211 |
eresolve_tac ctxt @{thms notE impE} i THEN eq_assume_tac i; |
60770 | 212 |
\<close> |
21539 | 213 |
|
214 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
215 |
subsection \<open>If-and-only-if\<close> |
21539 | 216 |
|
69590 | 217 |
lemma iffI: \<open>\<lbrakk>P \<Longrightarrow> Q; Q \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P \<longleftrightarrow> Q\<close> |
21539 | 218 |
apply (unfold iff_def) |
219 |
apply (rule conjI) |
|
220 |
apply (erule impI) |
|
221 |
apply (erule impI) |
|
222 |
done |
|
223 |
||
224 |
lemma iffE: |
|
69590 | 225 |
assumes major: \<open>P \<longleftrightarrow> Q\<close> |
226 |
and r: \<open>P \<longrightarrow> Q \<Longrightarrow> Q \<longrightarrow> P \<Longrightarrow> R\<close> |
|
227 |
shows \<open>R\<close> |
|
21539 | 228 |
apply (insert major, unfold iff_def) |
229 |
apply (erule conjE) |
|
230 |
apply (erule r) |
|
231 |
apply assumption |
|
232 |
done |
|
233 |
||
234 |
||
62020 | 235 |
subsubsection \<open>Destruct rules for \<open>\<longleftrightarrow>\<close> similar to Modus Ponens\<close> |
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
236 |
|
69590 | 237 |
lemma iffD1: \<open>\<lbrakk>P \<longleftrightarrow> Q; P\<rbrakk> \<Longrightarrow> Q\<close> |
21539 | 238 |
apply (unfold iff_def) |
239 |
apply (erule conjunct1 [THEN mp]) |
|
240 |
apply assumption |
|
241 |
done |
|
242 |
||
69590 | 243 |
lemma iffD2: \<open>\<lbrakk>P \<longleftrightarrow> Q; Q\<rbrakk> \<Longrightarrow> P\<close> |
21539 | 244 |
apply (unfold iff_def) |
245 |
apply (erule conjunct2 [THEN mp]) |
|
246 |
apply assumption |
|
247 |
done |
|
248 |
||
69590 | 249 |
lemma rev_iffD1: \<open>\<lbrakk>P; P \<longleftrightarrow> Q\<rbrakk> \<Longrightarrow> Q\<close> |
21539 | 250 |
apply (erule iffD1) |
251 |
apply assumption |
|
252 |
done |
|
253 |
||
69590 | 254 |
lemma rev_iffD2: \<open>\<lbrakk>Q; P \<longleftrightarrow> Q\<rbrakk> \<Longrightarrow> P\<close> |
21539 | 255 |
apply (erule iffD2) |
256 |
apply assumption |
|
257 |
done |
|
258 |
||
69590 | 259 |
lemma iff_refl: \<open>P \<longleftrightarrow> P\<close> |
21539 | 260 |
by (rule iffI) |
261 |
||
69590 | 262 |
lemma iff_sym: \<open>Q \<longleftrightarrow> P \<Longrightarrow> P \<longleftrightarrow> Q\<close> |
21539 | 263 |
apply (erule iffE) |
264 |
apply (rule iffI) |
|
265 |
apply (assumption | erule mp)+ |
|
266 |
done |
|
267 |
||
69590 | 268 |
lemma iff_trans: \<open>\<lbrakk>P \<longleftrightarrow> Q; Q \<longleftrightarrow> R\<rbrakk> \<Longrightarrow> P \<longleftrightarrow> R\<close> |
21539 | 269 |
apply (rule iffI) |
270 |
apply (assumption | erule iffE | erule (1) notE impE)+ |
|
271 |
done |
|
272 |
||
273 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
274 |
subsection \<open>Unique existence\<close> |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
275 |
|
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
276 |
text \<open> |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
277 |
NOTE THAT the following 2 quantifications: |
21539 | 278 |
|
63906
fa799a8e4adc
repair LaTeX dropout from f83ef97d8d7d
Lars Hupel <lars.hupel@mytum.de>
parents:
63901
diff
changeset
|
279 |
\<^item> \<open>\<exists>!x\<close> such that [\<open>\<exists>!y\<close> such that P(x,y)] (sequential) |
fa799a8e4adc
repair LaTeX dropout from f83ef97d8d7d
Lars Hupel <lars.hupel@mytum.de>
parents:
63901
diff
changeset
|
280 |
\<^item> \<open>\<exists>!x,y\<close> such that P(x,y) (simultaneous) |
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
281 |
|
63906
fa799a8e4adc
repair LaTeX dropout from f83ef97d8d7d
Lars Hupel <lars.hupel@mytum.de>
parents:
63901
diff
changeset
|
282 |
do NOT mean the same thing. The parser treats \<open>\<exists>!x y.P(x,y)\<close> as sequential. |
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
283 |
\<close> |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
284 |
|
69590 | 285 |
lemma ex1I: \<open>P(a) \<Longrightarrow> (\<And>x. P(x) \<Longrightarrow> x = a) \<Longrightarrow> \<exists>!x. P(x)\<close> |
21539 | 286 |
apply (unfold ex1_def) |
23393 | 287 |
apply (assumption | rule exI conjI allI impI)+ |
21539 | 288 |
done |
289 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
290 |
text \<open>Sometimes easier to use: the premises have no shared variables. Safe!\<close> |
69590 | 291 |
lemma ex_ex1I: \<open>\<exists>x. P(x) \<Longrightarrow> (\<And>x y. \<lbrakk>P(x); P(y)\<rbrakk> \<Longrightarrow> x = y) \<Longrightarrow> \<exists>!x. P(x)\<close> |
23393 | 292 |
apply (erule exE) |
293 |
apply (rule ex1I) |
|
294 |
apply assumption |
|
295 |
apply assumption |
|
21539 | 296 |
done |
297 |
||
69590 | 298 |
lemma ex1E: \<open>\<exists>! x. P(x) \<Longrightarrow> (\<And>x. \<lbrakk>P(x); \<forall>y. P(y) \<longrightarrow> y = x\<rbrakk> \<Longrightarrow> R) \<Longrightarrow> R\<close> |
23393 | 299 |
apply (unfold ex1_def) |
21539 | 300 |
apply (assumption | erule exE conjE)+ |
301 |
done |
|
302 |
||
303 |
||
62020 | 304 |
subsubsection \<open>\<open>\<longleftrightarrow>\<close> congruence rules for simplification\<close> |
21539 | 305 |
|
62020 | 306 |
text \<open>Use \<open>iffE\<close> on a premise. For \<open>conj_cong\<close>, \<open>imp_cong\<close>, \<open>all_cong\<close>, \<open>ex_cong\<close>.\<close> |
60770 | 307 |
ML \<open> |
59529 | 308 |
fun iff_tac ctxt prems i = |
309 |
resolve_tac ctxt (prems RL @{thms iffE}) i THEN |
|
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
310 |
REPEAT1 (eresolve_tac ctxt @{thms asm_rl mp} i); |
60770 | 311 |
\<close> |
21539 | 312 |
|
59529 | 313 |
method_setup iff = |
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
314 |
\<open>Attrib.thms >> |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
315 |
(fn prems => fn ctxt => SIMPLE_METHOD' (iff_tac ctxt prems))\<close> |
59529 | 316 |
|
21539 | 317 |
lemma conj_cong: |
69590 | 318 |
assumes \<open>P \<longleftrightarrow> P'\<close> |
319 |
and \<open>P' \<Longrightarrow> Q \<longleftrightarrow> Q'\<close> |
|
320 |
shows \<open>(P \<and> Q) \<longleftrightarrow> (P' \<and> Q')\<close> |
|
21539 | 321 |
apply (insert assms) |
59529 | 322 |
apply (assumption | rule iffI conjI | erule iffE conjE mp | iff assms)+ |
21539 | 323 |
done |
324 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
325 |
text \<open>Reversed congruence rule! Used in ZF/Order.\<close> |
21539 | 326 |
lemma conj_cong2: |
69590 | 327 |
assumes \<open>P \<longleftrightarrow> P'\<close> |
328 |
and \<open>P' \<Longrightarrow> Q \<longleftrightarrow> Q'\<close> |
|
329 |
shows \<open>(Q \<and> P) \<longleftrightarrow> (Q' \<and> P')\<close> |
|
21539 | 330 |
apply (insert assms) |
59529 | 331 |
apply (assumption | rule iffI conjI | erule iffE conjE mp | iff assms)+ |
21539 | 332 |
done |
333 |
||
334 |
lemma disj_cong: |
|
69590 | 335 |
assumes \<open>P \<longleftrightarrow> P'\<close> and \<open>Q \<longleftrightarrow> Q'\<close> |
336 |
shows \<open>(P \<or> Q) \<longleftrightarrow> (P' \<or> Q')\<close> |
|
21539 | 337 |
apply (insert assms) |
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
338 |
apply (erule iffE disjE disjI1 disjI2 | |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
339 |
assumption | rule iffI | erule (1) notE impE)+ |
21539 | 340 |
done |
341 |
||
342 |
lemma imp_cong: |
|
69590 | 343 |
assumes \<open>P \<longleftrightarrow> P'\<close> |
344 |
and \<open>P' \<Longrightarrow> Q \<longleftrightarrow> Q'\<close> |
|
345 |
shows \<open>(P \<longrightarrow> Q) \<longleftrightarrow> (P' \<longrightarrow> Q')\<close> |
|
21539 | 346 |
apply (insert assms) |
59529 | 347 |
apply (assumption | rule iffI impI | erule iffE | erule (1) notE impE | iff assms)+ |
21539 | 348 |
done |
349 |
||
69590 | 350 |
lemma iff_cong: \<open>\<lbrakk>P \<longleftrightarrow> P'; Q \<longleftrightarrow> Q'\<rbrakk> \<Longrightarrow> (P \<longleftrightarrow> Q) \<longleftrightarrow> (P' \<longleftrightarrow> Q')\<close> |
21539 | 351 |
apply (erule iffE | assumption | rule iffI | erule (1) notE impE)+ |
352 |
done |
|
353 |
||
69590 | 354 |
lemma not_cong: \<open>P \<longleftrightarrow> P' \<Longrightarrow> \<not> P \<longleftrightarrow> \<not> P'\<close> |
21539 | 355 |
apply (assumption | rule iffI notI | erule (1) notE impE | erule iffE notE)+ |
356 |
done |
|
357 |
||
358 |
lemma all_cong: |
|
69590 | 359 |
assumes \<open>\<And>x. P(x) \<longleftrightarrow> Q(x)\<close> |
360 |
shows \<open>(\<forall>x. P(x)) \<longleftrightarrow> (\<forall>x. Q(x))\<close> |
|
59529 | 361 |
apply (assumption | rule iffI allI | erule (1) notE impE | erule allE | iff assms)+ |
21539 | 362 |
done |
363 |
||
364 |
lemma ex_cong: |
|
69590 | 365 |
assumes \<open>\<And>x. P(x) \<longleftrightarrow> Q(x)\<close> |
366 |
shows \<open>(\<exists>x. P(x)) \<longleftrightarrow> (\<exists>x. Q(x))\<close> |
|
59529 | 367 |
apply (erule exE | assumption | rule iffI exI | erule (1) notE impE | iff assms)+ |
21539 | 368 |
done |
369 |
||
370 |
lemma ex1_cong: |
|
69590 | 371 |
assumes \<open>\<And>x. P(x) \<longleftrightarrow> Q(x)\<close> |
372 |
shows \<open>(\<exists>!x. P(x)) \<longleftrightarrow> (\<exists>!x. Q(x))\<close> |
|
59529 | 373 |
apply (erule ex1E spec [THEN mp] | assumption | rule iffI ex1I | erule (1) notE impE | iff assms)+ |
21539 | 374 |
done |
375 |
||
376 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
377 |
subsection \<open>Equality rules\<close> |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
378 |
|
69590 | 379 |
lemma sym: \<open>a = b \<Longrightarrow> b = a\<close> |
21539 | 380 |
apply (erule subst) |
381 |
apply (rule refl) |
|
382 |
done |
|
383 |
||
69590 | 384 |
lemma trans: \<open>\<lbrakk>a = b; b = c\<rbrakk> \<Longrightarrow> a = c\<close> |
21539 | 385 |
apply (erule subst, assumption) |
386 |
done |
|
387 |
||
69590 | 388 |
lemma not_sym: \<open>b \<noteq> a \<Longrightarrow> a \<noteq> b\<close> |
21539 | 389 |
apply (erule contrapos) |
390 |
apply (erule sym) |
|
391 |
done |
|
392 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
393 |
text \<open> |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
394 |
Two theorems for rewriting only one instance of a definition: |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
395 |
the first for definitions of formulae and the second for terms. |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
396 |
\<close> |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
397 |
|
69590 | 398 |
lemma def_imp_iff: \<open>(A \<equiv> B) \<Longrightarrow> A \<longleftrightarrow> B\<close> |
21539 | 399 |
apply unfold |
400 |
apply (rule iff_refl) |
|
401 |
done |
|
402 |
||
69590 | 403 |
lemma meta_eq_to_obj_eq: \<open>(A \<equiv> B) \<Longrightarrow> A = B\<close> |
21539 | 404 |
apply unfold |
405 |
apply (rule refl) |
|
406 |
done |
|
407 |
||
69590 | 408 |
lemma meta_eq_to_iff: \<open>x \<equiv> y \<Longrightarrow> x \<longleftrightarrow> y\<close> |
21539 | 409 |
by unfold (rule iff_refl) |
410 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
411 |
text \<open>Substitution.\<close> |
69590 | 412 |
lemma ssubst: \<open>\<lbrakk>b = a; P(a)\<rbrakk> \<Longrightarrow> P(b)\<close> |
21539 | 413 |
apply (drule sym) |
414 |
apply (erule (1) subst) |
|
415 |
done |
|
416 |
||
62020 | 417 |
text \<open>A special case of \<open>ex1E\<close> that would otherwise need quantifier |
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
418 |
expansion.\<close> |
69590 | 419 |
lemma ex1_equalsE: \<open>\<lbrakk>\<exists>!x. P(x); P(a); P(b)\<rbrakk> \<Longrightarrow> a = b\<close> |
21539 | 420 |
apply (erule ex1E) |
421 |
apply (rule trans) |
|
422 |
apply (rule_tac [2] sym) |
|
423 |
apply (assumption | erule spec [THEN mp])+ |
|
424 |
done |
|
425 |
||
426 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
427 |
subsubsection \<open>Polymorphic congruence rules\<close> |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
428 |
|
69590 | 429 |
lemma subst_context: \<open>a = b \<Longrightarrow> t(a) = t(b)\<close> |
21539 | 430 |
apply (erule ssubst) |
431 |
apply (rule refl) |
|
432 |
done |
|
433 |
||
69590 | 434 |
lemma subst_context2: \<open>\<lbrakk>a = b; c = d\<rbrakk> \<Longrightarrow> t(a,c) = t(b,d)\<close> |
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
435 |
apply (erule ssubst)+ |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
436 |
apply (rule refl) |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
437 |
done |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
438 |
|
69590 | 439 |
lemma subst_context3: \<open>\<lbrakk>a = b; c = d; e = f\<rbrakk> \<Longrightarrow> t(a,c,e) = t(b,d,f)\<close> |
21539 | 440 |
apply (erule ssubst)+ |
441 |
apply (rule refl) |
|
442 |
done |
|
443 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
444 |
text \<open> |
69593 | 445 |
Useful with \<^ML>\<open>eresolve_tac\<close> for proving equalities from known |
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
446 |
equalities. |
21539 | 447 |
|
448 |
a = b |
|
449 |
| | |
|
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
450 |
c = d |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
451 |
\<close> |
69590 | 452 |
lemma box_equals: \<open>\<lbrakk>a = b; a = c; b = d\<rbrakk> \<Longrightarrow> c = d\<close> |
21539 | 453 |
apply (rule trans) |
454 |
apply (rule trans) |
|
455 |
apply (rule sym) |
|
456 |
apply assumption+ |
|
457 |
done |
|
458 |
||
62020 | 459 |
text \<open>Dual of \<open>box_equals\<close>: for proving equalities backwards.\<close> |
69590 | 460 |
lemma simp_equals: \<open>\<lbrakk>a = c; b = d; c = d\<rbrakk> \<Longrightarrow> a = b\<close> |
21539 | 461 |
apply (rule trans) |
462 |
apply (rule trans) |
|
463 |
apply assumption+ |
|
464 |
apply (erule sym) |
|
465 |
done |
|
466 |
||
467 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
468 |
subsubsection \<open>Congruence rules for predicate letters\<close> |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
469 |
|
69590 | 470 |
lemma pred1_cong: \<open>a = a' \<Longrightarrow> P(a) \<longleftrightarrow> P(a')\<close> |
21539 | 471 |
apply (rule iffI) |
472 |
apply (erule (1) subst) |
|
473 |
apply (erule (1) ssubst) |
|
474 |
done |
|
475 |
||
69590 | 476 |
lemma pred2_cong: \<open>\<lbrakk>a = a'; b = b'\<rbrakk> \<Longrightarrow> P(a,b) \<longleftrightarrow> P(a',b')\<close> |
21539 | 477 |
apply (rule iffI) |
478 |
apply (erule subst)+ |
|
479 |
apply assumption |
|
480 |
apply (erule ssubst)+ |
|
481 |
apply assumption |
|
482 |
done |
|
483 |
||
69590 | 484 |
lemma pred3_cong: \<open>\<lbrakk>a = a'; b = b'; c = c'\<rbrakk> \<Longrightarrow> P(a,b,c) \<longleftrightarrow> P(a',b',c')\<close> |
21539 | 485 |
apply (rule iffI) |
486 |
apply (erule subst)+ |
|
487 |
apply assumption |
|
488 |
apply (erule ssubst)+ |
|
489 |
apply assumption |
|
490 |
done |
|
491 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
492 |
text \<open>Special case for the equality predicate!\<close> |
69590 | 493 |
lemma eq_cong: \<open>\<lbrakk>a = a'; b = b'\<rbrakk> \<Longrightarrow> a = b \<longleftrightarrow> a' = b'\<close> |
21539 | 494 |
apply (erule (1) pred2_cong) |
495 |
done |
|
496 |
||
497 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
498 |
subsection \<open>Simplifications of assumed implications\<close> |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
499 |
|
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
500 |
text \<open> |
62020 | 501 |
Roy Dyckhoff has proved that \<open>conj_impE\<close>, \<open>disj_impE\<close>, and |
69593 | 502 |
\<open>imp_impE\<close> used with \<^ML>\<open>mp_tac\<close> (restricted to atomic formulae) is |
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
503 |
COMPLETE for intuitionistic propositional logic. |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
504 |
|
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
505 |
See R. Dyckhoff, Contraction-free sequent calculi for intuitionistic logic |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
506 |
(preprint, University of St Andrews, 1991). |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
507 |
\<close> |
21539 | 508 |
|
509 |
lemma conj_impE: |
|
69590 | 510 |
assumes major: \<open>(P \<and> Q) \<longrightarrow> S\<close> |
511 |
and r: \<open>P \<longrightarrow> (Q \<longrightarrow> S) \<Longrightarrow> R\<close> |
|
512 |
shows \<open>R\<close> |
|
21539 | 513 |
by (assumption | rule conjI impI major [THEN mp] r)+ |
514 |
||
515 |
lemma disj_impE: |
|
69590 | 516 |
assumes major: \<open>(P \<or> Q) \<longrightarrow> S\<close> |
517 |
and r: \<open>\<lbrakk>P \<longrightarrow> S; Q \<longrightarrow> S\<rbrakk> \<Longrightarrow> R\<close> |
|
518 |
shows \<open>R\<close> |
|
21539 | 519 |
by (assumption | rule disjI1 disjI2 impI major [THEN mp] r)+ |
520 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
521 |
text \<open>Simplifies the implication. Classical version is stronger. |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
522 |
Still UNSAFE since Q must be provable -- backtracking needed.\<close> |
21539 | 523 |
lemma imp_impE: |
69590 | 524 |
assumes major: \<open>(P \<longrightarrow> Q) \<longrightarrow> S\<close> |
525 |
and r1: \<open>\<lbrakk>P; Q \<longrightarrow> S\<rbrakk> \<Longrightarrow> Q\<close> |
|
526 |
and r2: \<open>S \<Longrightarrow> R\<close> |
|
527 |
shows \<open>R\<close> |
|
21539 | 528 |
by (assumption | rule impI major [THEN mp] r1 r2)+ |
529 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
530 |
text \<open>Simplifies the implication. Classical version is stronger. |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
531 |
Still UNSAFE since ~P must be provable -- backtracking needed.\<close> |
69590 | 532 |
lemma not_impE: \<open>\<not> P \<longrightarrow> S \<Longrightarrow> (P \<Longrightarrow> False) \<Longrightarrow> (S \<Longrightarrow> R) \<Longrightarrow> R\<close> |
23393 | 533 |
apply (drule mp) |
534 |
apply (rule notI) |
|
535 |
apply assumption |
|
536 |
apply assumption |
|
21539 | 537 |
done |
538 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
539 |
text \<open>Simplifies the implication. UNSAFE.\<close> |
21539 | 540 |
lemma iff_impE: |
69590 | 541 |
assumes major: \<open>(P \<longleftrightarrow> Q) \<longrightarrow> S\<close> |
542 |
and r1: \<open>\<lbrakk>P; Q \<longrightarrow> S\<rbrakk> \<Longrightarrow> Q\<close> |
|
543 |
and r2: \<open>\<lbrakk>Q; P \<longrightarrow> S\<rbrakk> \<Longrightarrow> P\<close> |
|
544 |
and r3: \<open>S \<Longrightarrow> R\<close> |
|
545 |
shows \<open>R\<close> |
|
21539 | 546 |
apply (assumption | rule iffI impI major [THEN mp] r1 r2 r3)+ |
547 |
done |
|
548 |
||
62020 | 549 |
text \<open>What if \<open>(\<forall>x. \<not> \<not> P(x)) \<longrightarrow> \<not> \<not> (\<forall>x. P(x))\<close> is an assumption? |
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
550 |
UNSAFE.\<close> |
21539 | 551 |
lemma all_impE: |
69590 | 552 |
assumes major: \<open>(\<forall>x. P(x)) \<longrightarrow> S\<close> |
553 |
and r1: \<open>\<And>x. P(x)\<close> |
|
554 |
and r2: \<open>S \<Longrightarrow> R\<close> |
|
555 |
shows \<open>R\<close> |
|
23393 | 556 |
apply (rule allI impI major [THEN mp] r1 r2)+ |
21539 | 557 |
done |
558 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
559 |
text \<open> |
62020 | 560 |
Unsafe: \<open>\<exists>x. P(x)) \<longrightarrow> S\<close> is equivalent |
561 |
to \<open>\<forall>x. P(x) \<longrightarrow> S\<close>.\<close> |
|
21539 | 562 |
lemma ex_impE: |
69590 | 563 |
assumes major: \<open>(\<exists>x. P(x)) \<longrightarrow> S\<close> |
564 |
and r: \<open>P(x) \<longrightarrow> S \<Longrightarrow> R\<close> |
|
565 |
shows \<open>R\<close> |
|
21539 | 566 |
apply (assumption | rule exI impI major [THEN mp] r)+ |
567 |
done |
|
568 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
569 |
text \<open>Courtesy of Krzysztof Grabczewski.\<close> |
69590 | 570 |
lemma disj_imp_disj: \<open>P \<or> Q \<Longrightarrow> (P \<Longrightarrow> R) \<Longrightarrow> (Q \<Longrightarrow> S) \<Longrightarrow> R \<or> S\<close> |
23393 | 571 |
apply (erule disjE) |
21539 | 572 |
apply (rule disjI1) apply assumption |
573 |
apply (rule disjI2) apply assumption |
|
574 |
done |
|
11734 | 575 |
|
60770 | 576 |
ML \<open> |
32172 | 577 |
structure Project_Rule = Project_Rule |
578 |
( |
|
22139 | 579 |
val conjunct1 = @{thm conjunct1} |
580 |
val conjunct2 = @{thm conjunct2} |
|
581 |
val mp = @{thm mp} |
|
32172 | 582 |
) |
60770 | 583 |
\<close> |
18481 | 584 |
|
69605 | 585 |
ML_file \<open>fologic.ML\<close> |
21539 | 586 |
|
69590 | 587 |
lemma thin_refl: \<open>\<lbrakk>x = x; PROP W\<rbrakk> \<Longrightarrow> PROP W\<close> . |
21539 | 588 |
|
60770 | 589 |
ML \<open> |
42799 | 590 |
structure Hypsubst = Hypsubst |
591 |
( |
|
592 |
val dest_eq = FOLogic.dest_eq |
|
593 |
val dest_Trueprop = FOLogic.dest_Trueprop |
|
594 |
val dest_imp = FOLogic.dest_imp |
|
595 |
val eq_reflection = @{thm eq_reflection} |
|
596 |
val rev_eq_reflection = @{thm meta_eq_to_obj_eq} |
|
597 |
val imp_intr = @{thm impI} |
|
598 |
val rev_mp = @{thm rev_mp} |
|
599 |
val subst = @{thm subst} |
|
600 |
val sym = @{thm sym} |
|
601 |
val thin_refl = @{thm thin_refl} |
|
602 |
); |
|
603 |
open Hypsubst; |
|
60770 | 604 |
\<close> |
42799 | 605 |
|
69605 | 606 |
ML_file \<open>intprover.ML\<close> |
7355
4c43090659ca
proper bootstrap of IFOL/FOL theories and packages;
wenzelm
parents:
6340
diff
changeset
|
607 |
|
4092 | 608 |
|
60770 | 609 |
subsection \<open>Intuitionistic Reasoning\<close> |
12368 | 610 |
|
69593 | 611 |
setup \<open>Intuitionistic.method_setup \<^binding>\<open>iprover\<close>\<close> |
30165
6ee87f67d9cd
moved generic intuitionistic prover to src/Tools/intuitionistic.ML;
wenzelm
parents:
30160
diff
changeset
|
612 |
|
12349 | 613 |
lemma impE': |
69590 | 614 |
assumes 1: \<open>P \<longrightarrow> Q\<close> |
615 |
and 2: \<open>Q \<Longrightarrow> R\<close> |
|
616 |
and 3: \<open>P \<longrightarrow> Q \<Longrightarrow> P\<close> |
|
617 |
shows \<open>R\<close> |
|
12349 | 618 |
proof - |
69590 | 619 |
from 3 and 1 have \<open>P\<close> . |
620 |
with 1 have \<open>Q\<close> by (rule impE) |
|
621 |
with 2 show \<open>R\<close> . |
|
12349 | 622 |
qed |
623 |
||
624 |
lemma allE': |
|
69590 | 625 |
assumes 1: \<open>\<forall>x. P(x)\<close> |
626 |
and 2: \<open>P(x) \<Longrightarrow> \<forall>x. P(x) \<Longrightarrow> Q\<close> |
|
627 |
shows \<open>Q\<close> |
|
12349 | 628 |
proof - |
69590 | 629 |
from 1 have \<open>P(x)\<close> by (rule spec) |
630 |
from this and 1 show \<open>Q\<close> by (rule 2) |
|
12349 | 631 |
qed |
632 |
||
12937
0c4fd7529467
clarified syntax of ``long'' statements: fixes/assumes/shows;
wenzelm
parents:
12875
diff
changeset
|
633 |
lemma notE': |
69590 | 634 |
assumes 1: \<open>\<not> P\<close> |
635 |
and 2: \<open>\<not> P \<Longrightarrow> P\<close> |
|
636 |
shows \<open>R\<close> |
|
12349 | 637 |
proof - |
69590 | 638 |
from 2 and 1 have \<open>P\<close> . |
639 |
with 1 show \<open>R\<close> by (rule notE) |
|
12349 | 640 |
qed |
641 |
||
642 |
lemmas [Pure.elim!] = disjE iffE FalseE conjE exE |
|
643 |
and [Pure.intro!] = iffI conjI impI TrueI notI allI refl |
|
644 |
and [Pure.elim 2] = allE notE' impE' |
|
645 |
and [Pure.intro] = exI disjI2 disjI1 |
|
646 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
647 |
setup \<open> |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
648 |
Context_Rules.addSWrapper |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
649 |
(fn ctxt => fn tac => hyp_subst_tac ctxt ORELSE' tac) |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
650 |
\<close> |
12349 | 651 |
|
652 |
||
69590 | 653 |
lemma iff_not_sym: \<open>\<not> (Q \<longleftrightarrow> P) \<Longrightarrow> \<not> (P \<longleftrightarrow> Q)\<close> |
17591 | 654 |
by iprover |
12368 | 655 |
|
656 |
lemmas [sym] = sym iff_sym not_sym iff_not_sym |
|
657 |
and [Pure.elim?] = iffD1 iffD2 impE |
|
658 |
||
659 |
||
69590 | 660 |
lemma eq_commute: \<open>a = b \<longleftrightarrow> b = a\<close> |
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
661 |
apply (rule iffI) |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
662 |
apply (erule sym)+ |
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
663 |
done |
13435 | 664 |
|
665 |
||
60770 | 666 |
subsection \<open>Atomizing meta-level rules\<close> |
11677 | 667 |
|
69590 | 668 |
lemma atomize_all [atomize]: \<open>(\<And>x. P(x)) \<equiv> Trueprop (\<forall>x. P(x))\<close> |
11976 | 669 |
proof |
69590 | 670 |
assume \<open>\<And>x. P(x)\<close> |
671 |
then show \<open>\<forall>x. P(x)\<close> .. |
|
11677 | 672 |
next |
69590 | 673 |
assume \<open>\<forall>x. P(x)\<close> |
674 |
then show \<open>\<And>x. P(x)\<close> .. |
|
11677 | 675 |
qed |
676 |
||
69590 | 677 |
lemma atomize_imp [atomize]: \<open>(A \<Longrightarrow> B) \<equiv> Trueprop (A \<longrightarrow> B)\<close> |
11976 | 678 |
proof |
69590 | 679 |
assume \<open>A \<Longrightarrow> B\<close> |
680 |
then show \<open>A \<longrightarrow> B\<close> .. |
|
11677 | 681 |
next |
69590 | 682 |
assume \<open>A \<longrightarrow> B\<close> and \<open>A\<close> |
683 |
then show \<open>B\<close> by (rule mp) |
|
11677 | 684 |
qed |
685 |
||
69590 | 686 |
lemma atomize_eq [atomize]: \<open>(x \<equiv> y) \<equiv> Trueprop (x = y)\<close> |
11976 | 687 |
proof |
69590 | 688 |
assume \<open>x \<equiv> y\<close> |
689 |
show \<open>x = y\<close> unfolding \<open>x \<equiv> y\<close> by (rule refl) |
|
11677 | 690 |
next |
69590 | 691 |
assume \<open>x = y\<close> |
692 |
then show \<open>x \<equiv> y\<close> by (rule eq_reflection) |
|
11677 | 693 |
qed |
694 |
||
69590 | 695 |
lemma atomize_iff [atomize]: \<open>(A \<equiv> B) \<equiv> Trueprop (A \<longleftrightarrow> B)\<close> |
18813 | 696 |
proof |
69590 | 697 |
assume \<open>A \<equiv> B\<close> |
698 |
show \<open>A \<longleftrightarrow> B\<close> unfolding \<open>A \<equiv> B\<close> by (rule iff_refl) |
|
18813 | 699 |
next |
69590 | 700 |
assume \<open>A \<longleftrightarrow> B\<close> |
701 |
then show \<open>A \<equiv> B\<close> by (rule iff_reflection) |
|
18813 | 702 |
qed |
703 |
||
69590 | 704 |
lemma atomize_conj [atomize]: \<open>(A &&& B) \<equiv> Trueprop (A \<and> B)\<close> |
11976 | 705 |
proof |
69590 | 706 |
assume conj: \<open>A &&& B\<close> |
707 |
show \<open>A \<and> B\<close> |
|
19120
353d349740de
not_equal: replaced syntax translation by abbreviation;
wenzelm
parents:
18861
diff
changeset
|
708 |
proof (rule conjI) |
69590 | 709 |
from conj show \<open>A\<close> by (rule conjunctionD1) |
710 |
from conj show \<open>B\<close> by (rule conjunctionD2) |
|
19120
353d349740de
not_equal: replaced syntax translation by abbreviation;
wenzelm
parents:
18861
diff
changeset
|
711 |
qed |
11953 | 712 |
next |
69590 | 713 |
assume conj: \<open>A \<and> B\<close> |
714 |
show \<open>A &&& B\<close> |
|
19120
353d349740de
not_equal: replaced syntax translation by abbreviation;
wenzelm
parents:
18861
diff
changeset
|
715 |
proof - |
69590 | 716 |
from conj show \<open>A\<close> .. |
717 |
from conj show \<open>B\<close> .. |
|
11953 | 718 |
qed |
719 |
qed |
|
720 |
||
12368 | 721 |
lemmas [symmetric, rulify] = atomize_all atomize_imp |
18861 | 722 |
and [symmetric, defn] = atomize_all atomize_imp atomize_eq atomize_iff |
11771 | 723 |
|
11848 | 724 |
|
60770 | 725 |
subsection \<open>Atomizing elimination rules\<close> |
26580
c3e597a476fd
Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents:
26286
diff
changeset
|
726 |
|
69590 | 727 |
lemma atomize_exL[atomize_elim]: \<open>(\<And>x. P(x) \<Longrightarrow> Q) \<equiv> ((\<exists>x. P(x)) \<Longrightarrow> Q)\<close> |
57948 | 728 |
by rule iprover+ |
26580
c3e597a476fd
Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents:
26286
diff
changeset
|
729 |
|
69590 | 730 |
lemma atomize_conjL[atomize_elim]: \<open>(A \<Longrightarrow> B \<Longrightarrow> C) \<equiv> (A \<and> B \<Longrightarrow> C)\<close> |
57948 | 731 |
by rule iprover+ |
26580
c3e597a476fd
Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents:
26286
diff
changeset
|
732 |
|
69590 | 733 |
lemma atomize_disjL[atomize_elim]: \<open>((A \<Longrightarrow> C) \<Longrightarrow> (B \<Longrightarrow> C) \<Longrightarrow> C) \<equiv> ((A \<or> B \<Longrightarrow> C) \<Longrightarrow> C)\<close> |
57948 | 734 |
by rule iprover+ |
26580
c3e597a476fd
Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents:
26286
diff
changeset
|
735 |
|
69590 | 736 |
lemma atomize_elimL[atomize_elim]: \<open>(\<And>B. (A \<Longrightarrow> B) \<Longrightarrow> B) \<equiv> Trueprop(A)\<close> .. |
26580
c3e597a476fd
Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents:
26286
diff
changeset
|
737 |
|
c3e597a476fd
Generic conversion and tactic "atomize_elim" to convert elimination rules
krauss
parents:
26286
diff
changeset
|
738 |
|
60770 | 739 |
subsection \<open>Calculational rules\<close> |
11848 | 740 |
|
69590 | 741 |
lemma forw_subst: \<open>a = b \<Longrightarrow> P(b) \<Longrightarrow> P(a)\<close> |
11848 | 742 |
by (rule ssubst) |
743 |
||
69590 | 744 |
lemma back_subst: \<open>P(a) \<Longrightarrow> a = b \<Longrightarrow> P(b)\<close> |
11848 | 745 |
by (rule subst) |
746 |
||
60770 | 747 |
text \<open> |
11848 | 748 |
Note that this list of rules is in reverse order of priorities. |
60770 | 749 |
\<close> |
11848 | 750 |
|
12019 | 751 |
lemmas basic_trans_rules [trans] = |
11848 | 752 |
forw_subst |
753 |
back_subst |
|
754 |
rev_mp |
|
755 |
mp |
|
756 |
trans |
|
757 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
758 |
|
60770 | 759 |
subsection \<open>``Let'' declarations\<close> |
13779 | 760 |
|
41229
d797baa3d57c
replaced command 'nonterminals' by slightly modernized version 'nonterminal';
wenzelm
parents:
39557
diff
changeset
|
761 |
nonterminal letbinds and letbind |
13779 | 762 |
|
69590 | 763 |
definition Let :: \<open>['a::{}, 'a => 'b] \<Rightarrow> ('b::{})\<close> |
764 |
where \<open>Let(s, f) \<equiv> f(s)\<close> |
|
13779 | 765 |
|
766 |
syntax |
|
69590 | 767 |
"_bind" :: \<open>[pttrn, 'a] => letbind\<close> (\<open>(2_ =/ _)\<close> 10) |
768 |
"" :: \<open>letbind => letbinds\<close> (\<open>_\<close>) |
|
769 |
"_binds" :: \<open>[letbind, letbinds] => letbinds\<close> (\<open>_;/ _\<close>) |
|
770 |
"_Let" :: \<open>[letbinds, 'a] => 'a\<close> (\<open>(let (_)/ in (_))\<close> 10) |
|
13779 | 771 |
|
772 |
translations |
|
773 |
"_Let(_binds(b, bs), e)" == "_Let(b, _Let(bs, e))" |
|
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
774 |
"let x = a in e" == "CONST Let(a, \<lambda>x. e)" |
13779 | 775 |
|
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
776 |
lemma LetI: |
69590 | 777 |
assumes \<open>\<And>x. x = t \<Longrightarrow> P(u(x))\<close> |
778 |
shows \<open>P(let x = t in u(x))\<close> |
|
21539 | 779 |
apply (unfold Let_def) |
780 |
apply (rule refl [THEN assms]) |
|
781 |
done |
|
782 |
||
783 |
||
60770 | 784 |
subsection \<open>Intuitionistic simplification rules\<close> |
26286 | 785 |
|
786 |
lemma conj_simps: |
|
69590 | 787 |
\<open>P \<and> True \<longleftrightarrow> P\<close> |
788 |
\<open>True \<and> P \<longleftrightarrow> P\<close> |
|
789 |
\<open>P \<and> False \<longleftrightarrow> False\<close> |
|
790 |
\<open>False \<and> P \<longleftrightarrow> False\<close> |
|
791 |
\<open>P \<and> P \<longleftrightarrow> P\<close> |
|
792 |
\<open>P \<and> P \<and> Q \<longleftrightarrow> P \<and> Q\<close> |
|
793 |
\<open>P \<and> \<not> P \<longleftrightarrow> False\<close> |
|
794 |
\<open>\<not> P \<and> P \<longleftrightarrow> False\<close> |
|
795 |
\<open>(P \<and> Q) \<and> R \<longleftrightarrow> P \<and> (Q \<and> R)\<close> |
|
26286 | 796 |
by iprover+ |
797 |
||
798 |
lemma disj_simps: |
|
69590 | 799 |
\<open>P \<or> True \<longleftrightarrow> True\<close> |
800 |
\<open>True \<or> P \<longleftrightarrow> True\<close> |
|
801 |
\<open>P \<or> False \<longleftrightarrow> P\<close> |
|
802 |
\<open>False \<or> P \<longleftrightarrow> P\<close> |
|
803 |
\<open>P \<or> P \<longleftrightarrow> P\<close> |
|
804 |
\<open>P \<or> P \<or> Q \<longleftrightarrow> P \<or> Q\<close> |
|
805 |
\<open>(P \<or> Q) \<or> R \<longleftrightarrow> P \<or> (Q \<or> R)\<close> |
|
26286 | 806 |
by iprover+ |
807 |
||
808 |
lemma not_simps: |
|
69590 | 809 |
\<open>\<not> (P \<or> Q) \<longleftrightarrow> \<not> P \<and> \<not> Q\<close> |
810 |
\<open>\<not> False \<longleftrightarrow> True\<close> |
|
811 |
\<open>\<not> True \<longleftrightarrow> False\<close> |
|
26286 | 812 |
by iprover+ |
813 |
||
814 |
lemma imp_simps: |
|
69590 | 815 |
\<open>(P \<longrightarrow> False) \<longleftrightarrow> \<not> P\<close> |
816 |
\<open>(P \<longrightarrow> True) \<longleftrightarrow> True\<close> |
|
817 |
\<open>(False \<longrightarrow> P) \<longleftrightarrow> True\<close> |
|
818 |
\<open>(True \<longrightarrow> P) \<longleftrightarrow> P\<close> |
|
819 |
\<open>(P \<longrightarrow> P) \<longleftrightarrow> True\<close> |
|
820 |
\<open>(P \<longrightarrow> \<not> P) \<longleftrightarrow> \<not> P\<close> |
|
26286 | 821 |
by iprover+ |
822 |
||
823 |
lemma iff_simps: |
|
69590 | 824 |
\<open>(True \<longleftrightarrow> P) \<longleftrightarrow> P\<close> |
825 |
\<open>(P \<longleftrightarrow> True) \<longleftrightarrow> P\<close> |
|
826 |
\<open>(P \<longleftrightarrow> P) \<longleftrightarrow> True\<close> |
|
827 |
\<open>(False \<longleftrightarrow> P) \<longleftrightarrow> \<not> P\<close> |
|
828 |
\<open>(P \<longleftrightarrow> False) \<longleftrightarrow> \<not> P\<close> |
|
26286 | 829 |
by iprover+ |
830 |
||
62020 | 831 |
text \<open>The \<open>x = t\<close> versions are needed for the simplification |
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
832 |
procedures.\<close> |
26286 | 833 |
lemma quant_simps: |
69590 | 834 |
\<open>\<And>P. (\<forall>x. P) \<longleftrightarrow> P\<close> |
835 |
\<open>(\<forall>x. x = t \<longrightarrow> P(x)) \<longleftrightarrow> P(t)\<close> |
|
836 |
\<open>(\<forall>x. t = x \<longrightarrow> P(x)) \<longleftrightarrow> P(t)\<close> |
|
837 |
\<open>\<And>P. (\<exists>x. P) \<longleftrightarrow> P\<close> |
|
838 |
\<open>\<exists>x. x = t\<close> |
|
839 |
\<open>\<exists>x. t = x\<close> |
|
840 |
\<open>(\<exists>x. x = t \<and> P(x)) \<longleftrightarrow> P(t)\<close> |
|
841 |
\<open>(\<exists>x. t = x \<and> P(x)) \<longleftrightarrow> P(t)\<close> |
|
26286 | 842 |
by iprover+ |
843 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
844 |
text \<open>These are NOT supplied by default!\<close> |
26286 | 845 |
lemma distrib_simps: |
69590 | 846 |
\<open>P \<and> (Q \<or> R) \<longleftrightarrow> P \<and> Q \<or> P \<and> R\<close> |
847 |
\<open>(Q \<or> R) \<and> P \<longleftrightarrow> Q \<and> P \<or> R \<and> P\<close> |
|
848 |
\<open>(P \<or> Q \<longrightarrow> R) \<longleftrightarrow> (P \<longrightarrow> R) \<and> (Q \<longrightarrow> R)\<close> |
|
26286 | 849 |
by iprover+ |
850 |
||
851 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
852 |
subsubsection \<open>Conversion into rewrite rules\<close> |
26286 | 853 |
|
69590 | 854 |
lemma P_iff_F: \<open>\<not> P \<Longrightarrow> (P \<longleftrightarrow> False)\<close> |
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
855 |
by iprover |
69590 | 856 |
lemma iff_reflection_F: \<open>\<not> P \<Longrightarrow> (P \<equiv> False)\<close> |
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
857 |
by (rule P_iff_F [THEN iff_reflection]) |
26286 | 858 |
|
69590 | 859 |
lemma P_iff_T: \<open>P \<Longrightarrow> (P \<longleftrightarrow> True)\<close> |
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
860 |
by iprover |
69590 | 861 |
lemma iff_reflection_T: \<open>P \<Longrightarrow> (P \<equiv> True)\<close> |
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
862 |
by (rule P_iff_T [THEN iff_reflection]) |
26286 | 863 |
|
864 |
||
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
865 |
subsubsection \<open>More rewrite rules\<close> |
26286 | 866 |
|
69590 | 867 |
lemma conj_commute: \<open>P \<and> Q \<longleftrightarrow> Q \<and> P\<close> by iprover |
868 |
lemma conj_left_commute: \<open>P \<and> (Q \<and> R) \<longleftrightarrow> Q \<and> (P \<and> R)\<close> by iprover |
|
26286 | 869 |
lemmas conj_comms = conj_commute conj_left_commute |
870 |
||
69590 | 871 |
lemma disj_commute: \<open>P \<or> Q \<longleftrightarrow> Q \<or> P\<close> by iprover |
872 |
lemma disj_left_commute: \<open>P \<or> (Q \<or> R) \<longleftrightarrow> Q \<or> (P \<or> R)\<close> by iprover |
|
26286 | 873 |
lemmas disj_comms = disj_commute disj_left_commute |
874 |
||
69590 | 875 |
lemma conj_disj_distribL: \<open>P \<and> (Q \<or> R) \<longleftrightarrow> (P \<and> Q \<or> P \<and> R)\<close> by iprover |
876 |
lemma conj_disj_distribR: \<open>(P \<or> Q) \<and> R \<longleftrightarrow> (P \<and> R \<or> Q \<and> R)\<close> by iprover |
|
26286 | 877 |
|
69590 | 878 |
lemma disj_conj_distribL: \<open>P \<or> (Q \<and> R) \<longleftrightarrow> (P \<or> Q) \<and> (P \<or> R)\<close> by iprover |
879 |
lemma disj_conj_distribR: \<open>(P \<and> Q) \<or> R \<longleftrightarrow> (P \<or> R) \<and> (Q \<or> R)\<close> by iprover |
|
26286 | 880 |
|
69590 | 881 |
lemma imp_conj_distrib: \<open>(P \<longrightarrow> (Q \<and> R)) \<longleftrightarrow> (P \<longrightarrow> Q) \<and> (P \<longrightarrow> R)\<close> by iprover |
882 |
lemma imp_conj: \<open>((P \<and> Q) \<longrightarrow> R) \<longleftrightarrow> (P \<longrightarrow> (Q \<longrightarrow> R))\<close> by iprover |
|
883 |
lemma imp_disj: \<open>(P \<or> Q \<longrightarrow> R) \<longleftrightarrow> (P \<longrightarrow> R) \<and> (Q \<longrightarrow> R)\<close> by iprover |
|
26286 | 884 |
|
69590 | 885 |
lemma de_Morgan_disj: \<open>(\<not> (P \<or> Q)) \<longleftrightarrow> (\<not> P \<and> \<not> Q)\<close> by iprover |
26286 | 886 |
|
69590 | 887 |
lemma not_ex: \<open>(\<not> (\<exists>x. P(x))) \<longleftrightarrow> (\<forall>x. \<not> P(x))\<close> by iprover |
888 |
lemma imp_ex: \<open>((\<exists>x. P(x)) \<longrightarrow> Q) \<longleftrightarrow> (\<forall>x. P(x) \<longrightarrow> Q)\<close> by iprover |
|
26286 | 889 |
|
69590 | 890 |
lemma ex_disj_distrib: \<open>(\<exists>x. P(x) \<or> Q(x)) \<longleftrightarrow> ((\<exists>x. P(x)) \<or> (\<exists>x. Q(x)))\<close> |
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
891 |
by iprover |
26286 | 892 |
|
69590 | 893 |
lemma all_conj_distrib: \<open>(\<forall>x. P(x) \<and> Q(x)) \<longleftrightarrow> ((\<forall>x. P(x)) \<and> (\<forall>x. Q(x)))\<close> |
61487
f8cb97e0fd0b
more symbols, with swapped defaults: old-style ASCII syntax uses "ASCII" print mode;
wenzelm
parents:
61378
diff
changeset
|
894 |
by iprover |
26286 | 895 |
|
4854 | 896 |
end |