24 |
24 |
25 lemma ccontr: "(\<not> P \<Longrightarrow> False) \<Longrightarrow> P" |
25 lemma ccontr: "(\<not> P \<Longrightarrow> False) \<Longrightarrow> P" |
26 by (erule FalseE [THEN classical]) |
26 by (erule FalseE [THEN classical]) |
27 |
27 |
28 |
28 |
29 subsubsection \<open>Classical introduction rules for @{text "\<or>"} and @{text "\<exists>"}\<close> |
29 subsubsection \<open>Classical introduction rules for \<open>\<or>\<close> and \<open>\<exists>\<close>\<close> |
30 |
30 |
31 lemma disjCI: "(\<not> Q \<Longrightarrow> P) \<Longrightarrow> P \<or> Q" |
31 lemma disjCI: "(\<not> Q \<Longrightarrow> P) \<Longrightarrow> P \<or> Q" |
32 apply (rule classical) |
32 apply (rule classical) |
33 apply (assumption | erule meta_mp | rule disjI1 notI)+ |
33 apply (assumption | erule meta_mp | rule disjI1 notI)+ |
34 apply (erule notE disjI2)+ |
34 apply (erule notE disjI2)+ |
35 done |
35 done |
36 |
36 |
37 text \<open>Introduction rule involving only @{text "\<exists>"}\<close> |
37 text \<open>Introduction rule involving only \<open>\<exists>\<close>\<close> |
38 lemma ex_classical: |
38 lemma ex_classical: |
39 assumes r: "\<not> (\<exists>x. P(x)) \<Longrightarrow> P(a)" |
39 assumes r: "\<not> (\<exists>x. P(x)) \<Longrightarrow> P(a)" |
40 shows "\<exists>x. P(x)" |
40 shows "\<exists>x. P(x)" |
41 apply (rule classical) |
41 apply (rule classical) |
42 apply (rule exI, erule r) |
42 apply (rule exI, erule r) |
43 done |
43 done |
44 |
44 |
45 text \<open>Version of above, simplifying @{text "\<not>\<exists>"} to @{text "\<forall>\<not>"}.\<close> |
45 text \<open>Version of above, simplifying \<open>\<not>\<exists>\<close> to \<open>\<forall>\<not>\<close>.\<close> |
46 lemma exCI: |
46 lemma exCI: |
47 assumes r: "\<forall>x. \<not> P(x) \<Longrightarrow> P(a)" |
47 assumes r: "\<forall>x. \<not> P(x) \<Longrightarrow> P(a)" |
48 shows "\<exists>x. P(x)" |
48 shows "\<exists>x. P(x)" |
49 apply (rule ex_classical) |
49 apply (rule ex_classical) |
50 apply (rule notI [THEN allI, THEN r]) |
50 apply (rule notI [THEN allI, THEN r]) |
77 \<close> "case_tac emulation (dynamic instantiation!)" |
77 \<close> "case_tac emulation (dynamic instantiation!)" |
78 |
78 |
79 |
79 |
80 subsection \<open>Special elimination rules\<close> |
80 subsection \<open>Special elimination rules\<close> |
81 |
81 |
82 text \<open>Classical implies (@{text "\<longrightarrow>"}) elimination.\<close> |
82 text \<open>Classical implies (\<open>\<longrightarrow>\<close>) elimination.\<close> |
83 lemma impCE: |
83 lemma impCE: |
84 assumes major: "P \<longrightarrow> Q" |
84 assumes major: "P \<longrightarrow> Q" |
85 and r1: "\<not> P \<Longrightarrow> R" |
85 and r1: "\<not> P \<Longrightarrow> R" |
86 and r2: "Q \<Longrightarrow> R" |
86 and r2: "Q \<Longrightarrow> R" |
87 shows R |
87 shows R |
90 apply (rule r2) |
90 apply (rule r2) |
91 apply (erule major [THEN mp]) |
91 apply (erule major [THEN mp]) |
92 done |
92 done |
93 |
93 |
94 text \<open> |
94 text \<open> |
95 This version of @{text "\<longrightarrow>"} elimination works on @{text Q} before @{text |
95 This version of \<open>\<longrightarrow>\<close> elimination works on \<open>Q\<close> before \<open>P\<close>. It works best for those cases in which P holds ``almost everywhere''. |
96 P}. It works best for those cases in which P holds ``almost everywhere''. |
|
97 Can't install as default: would break old proofs. |
96 Can't install as default: would break old proofs. |
98 \<close> |
97 \<close> |
99 lemma impCE': |
98 lemma impCE': |
100 assumes major: "P \<longrightarrow> Q" |
99 assumes major: "P \<longrightarrow> Q" |
101 and r1: "Q \<Longrightarrow> R" |
100 and r1: "Q \<Longrightarrow> R" |
122 |
121 |
123 |
122 |
124 subsubsection \<open>Tactics for implication and contradiction\<close> |
123 subsubsection \<open>Tactics for implication and contradiction\<close> |
125 |
124 |
126 text \<open> |
125 text \<open> |
127 Classical @{text "\<longleftrightarrow>"} elimination. Proof substitutes @{text "P = Q"} in |
126 Classical \<open>\<longleftrightarrow>\<close> elimination. Proof substitutes \<open>P = Q\<close> in |
128 @{text "\<not> P \<Longrightarrow> \<not> Q"} and @{text "P \<Longrightarrow> Q"}. |
127 \<open>\<not> P \<Longrightarrow> \<not> Q\<close> and \<open>P \<Longrightarrow> Q\<close>. |
129 \<close> |
128 \<close> |
130 lemma iffCE: |
129 lemma iffCE: |
131 assumes major: "P \<longleftrightarrow> Q" |
130 assumes major: "P \<longleftrightarrow> Q" |
132 and r1: "\<lbrakk>P; Q\<rbrakk> \<Longrightarrow> R" |
131 and r1: "\<lbrakk>P; Q\<rbrakk> \<Longrightarrow> R" |
133 and r2: "\<lbrakk>\<not> P; \<not> Q\<rbrakk> \<Longrightarrow> R" |
132 and r2: "\<lbrakk>\<not> P; \<not> Q\<rbrakk> \<Longrightarrow> R" |
216 |
215 |
217 |
216 |
218 lemma ex1_functional: "\<lbrakk>\<exists>! z. P(a,z); P(a,b); P(a,c)\<rbrakk> \<Longrightarrow> b = c" |
217 lemma ex1_functional: "\<lbrakk>\<exists>! z. P(a,z); P(a,b); P(a,c)\<rbrakk> \<Longrightarrow> b = c" |
219 by blast |
218 by blast |
220 |
219 |
221 text \<open>Elimination of @{text True} from assumptions:\<close> |
220 text \<open>Elimination of \<open>True\<close> from assumptions:\<close> |
222 lemma True_implies_equals: "(True \<Longrightarrow> PROP P) \<equiv> PROP P" |
221 lemma True_implies_equals: "(True \<Longrightarrow> PROP P) \<equiv> PROP P" |
223 proof |
222 proof |
224 assume "True \<Longrightarrow> PROP P" |
223 assume "True \<Longrightarrow> PROP P" |
225 from this and TrueI show "PROP P" . |
224 from this and TrueI show "PROP P" . |
226 next |
225 next |
246 |
245 |
247 |
246 |
248 subsection \<open>Classical simplification rules\<close> |
247 subsection \<open>Classical simplification rules\<close> |
249 |
248 |
250 text \<open> |
249 text \<open> |
251 Avoids duplication of subgoals after @{text expand_if}, when the true and |
250 Avoids duplication of subgoals after \<open>expand_if\<close>, when the true and |
252 false cases boil down to the same thing. |
251 false cases boil down to the same thing. |
253 \<close> |
252 \<close> |
254 |
253 |
255 lemma cases_simp: "(P \<longrightarrow> Q) \<and> (\<not> P \<longrightarrow> Q) \<longleftrightarrow> Q" |
254 lemma cases_simp: "(P \<longrightarrow> Q) \<and> (\<not> P \<longrightarrow> Q) \<longleftrightarrow> Q" |
256 by blast |
255 by blast |
257 |
256 |
258 |
257 |
259 subsubsection \<open>Miniscoping: pushing quantifiers in\<close> |
258 subsubsection \<open>Miniscoping: pushing quantifiers in\<close> |
260 |
259 |
261 text \<open> |
260 text \<open> |
262 We do NOT distribute of @{text "\<forall>"} over @{text "\<and>"}, or dually that of |
261 We do NOT distribute of \<open>\<forall>\<close> over \<open>\<and>\<close>, or dually that of |
263 @{text "\<exists>"} over @{text "\<or>"}. |
262 \<open>\<exists>\<close> over \<open>\<or>\<close>. |
264 |
263 |
265 Baaz and Leitsch, On Skolemization and Proof Complexity (1994) show that |
264 Baaz and Leitsch, On Skolemization and Proof Complexity (1994) show that |
266 this step can increase proof length! |
265 this step can increase proof length! |
267 \<close> |
266 \<close> |
268 |
267 |
312 lemma not_all: "(\<not> (\<forall>x. P(x))) \<longleftrightarrow> (\<exists>x. \<not> P(x))" by blast |
311 lemma not_all: "(\<not> (\<forall>x. P(x))) \<longleftrightarrow> (\<exists>x. \<not> P(x))" by blast |
313 lemma imp_all: "((\<forall>x. P(x)) \<longrightarrow> Q) \<longleftrightarrow> (\<exists>x. P(x) \<longrightarrow> Q)" by blast |
312 lemma imp_all: "((\<forall>x. P(x)) \<longrightarrow> Q) \<longleftrightarrow> (\<exists>x. P(x) \<longrightarrow> Q)" by blast |
314 |
313 |
315 |
314 |
316 lemmas meta_simps = |
315 lemmas meta_simps = |
317 triv_forall_equality -- \<open>prunes params\<close> |
316 triv_forall_equality \<comment> \<open>prunes params\<close> |
318 True_implies_equals -- \<open>prune asms @{text True}\<close> |
317 True_implies_equals \<comment> \<open>prune asms \<open>True\<close>\<close> |
319 |
318 |
320 lemmas IFOL_simps = |
319 lemmas IFOL_simps = |
321 refl [THEN P_iff_T] conj_simps disj_simps not_simps |
320 refl [THEN P_iff_T] conj_simps disj_simps not_simps |
322 imp_simps iff_simps quant_simps |
321 imp_simps iff_simps quant_simps |
323 |
322 |