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