81 | _ $ (Const("op =",_)$_$_) => th RS eq_reflection |
81 | _ $ (Const("op =",_)$_$_) => th RS eq_reflection |
82 | _ $ (Const("op <->",_)$_$_) => th RS iff_reflection |
82 | _ $ (Const("op <->",_)$_$_) => th RS iff_reflection |
83 | _ $ (Const("Not",_)$_) => th RS iff_reflection_F |
83 | _ $ (Const("Not",_)$_) => th RS iff_reflection_F |
84 | _ => th RS iff_reflection_T; |
84 | _ => th RS iff_reflection_T; |
85 |
85 |
86 structure Induction = InductionFun(struct val spec=IFOL.spec end); |
86 |
87 |
87 (*** Classical laws ***) |
88 open Simplifier Induction; |
88 |
89 |
|
90 (*Add congruence rules for = or <-> (instead of ==) *) |
|
91 infix 4 addcongs; |
|
92 fun ss addcongs congs = |
|
93 ss addeqcongs (congs RL [eq_reflection,iff_reflection]); |
|
94 |
|
95 (*Add a simpset to a classical set!*) |
|
96 infix 4 addss; |
|
97 fun cs addss ss = cs addbefore asm_full_simp_tac ss 1; |
|
98 |
|
99 |
|
100 val IFOL_simps = |
|
101 [refl RS P_iff_T] @ conj_simps @ disj_simps @ not_simps @ |
|
102 imp_simps @ iff_simps @ quant_simps; |
|
103 |
|
104 val notFalseI = int_prove_fun "~False"; |
|
105 val triv_rls = [TrueI,refl,iff_refl,notFalseI]; |
|
106 |
|
107 val IFOL_ss = |
|
108 empty_ss |
|
109 setmksimps (map mk_meta_eq o atomize o gen_all) |
|
110 setsolver (fn prems => resolve_tac (triv_rls@prems) |
|
111 ORELSE' assume_tac |
|
112 ORELSE' etac FalseE) |
|
113 setsubgoaler asm_simp_tac |
|
114 addsimps IFOL_simps |
|
115 addcongs [imp_cong]; |
|
116 |
|
117 (*Classical version...*) |
|
118 fun prove_fun s = |
89 fun prove_fun s = |
119 (writeln s; |
90 (writeln s; |
120 prove_goal FOL.thy s |
91 prove_goal FOL.thy s |
121 (fn prems => [ (cut_facts_tac prems 1), |
92 (fn prems => [ (cut_facts_tac prems 1), |
122 (Cla.fast_tac FOL_cs 1) ])); |
93 (Cla.fast_tac FOL_cs 1) ])); |
123 |
94 |
124 (*Avoids duplication of subgoals after expand_if, when the true and false |
95 (*Avoids duplication of subgoals after expand_if, when the true and false |
125 cases boil down to the same thing.*) |
96 cases boil down to the same thing.*) |
126 val cases_simp = prove_fun "(P --> Q) & (~P --> Q) <-> Q"; |
97 val cases_simp = prove_fun "(P --> Q) & (~P --> Q) <-> Q"; |
127 |
|
128 val cla_simps = |
|
129 cases_simp:: |
|
130 map prove_fun |
|
131 ["~(P&Q) <-> ~P | ~Q", |
|
132 "P | ~P", "~P | P", |
|
133 "~ ~ P <-> P", "(~P --> P) <-> P", |
|
134 "(~P <-> ~Q) <-> (P<->Q)"]; |
|
135 |
98 |
136 (*At present, miniscoping is for classical logic only. We do NOT include |
99 (*At present, miniscoping is for classical logic only. We do NOT include |
137 distribution of ALL over &, or dually that of EX over |.*) |
100 distribution of ALL over &, or dually that of EX over |.*) |
138 |
101 |
139 (*Miniscoping: pushing in existential quantifiers*) |
102 (*Miniscoping: pushing in existential quantifiers*) |
156 "(ALL x. P(x) | Q) <-> (ALL x.P(x)) | Q", |
119 "(ALL x. P(x) | Q) <-> (ALL x.P(x)) | Q", |
157 "(ALL x. P | Q(x)) <-> P | (ALL x.Q(x))", |
120 "(ALL x. P | Q(x)) <-> P | (ALL x.Q(x))", |
158 "(ALL x. P(x) --> Q) <-> (EX x.P(x)) --> Q", |
121 "(ALL x. P(x) --> Q) <-> (EX x.P(x)) --> Q", |
159 "(ALL x. P --> Q(x)) <-> P --> (ALL x.Q(x))"]; |
122 "(ALL x. P --> Q(x)) <-> P --> (ALL x.Q(x))"]; |
160 |
123 |
161 val FOL_ss = IFOL_ss addsimps (cla_simps @ ex_simps @ all_simps); |
|
162 |
|
163 fun int_prove nm thm = qed_goal nm IFOL.thy thm |
124 fun int_prove nm thm = qed_goal nm IFOL.thy thm |
164 (fn prems => [ (cut_facts_tac prems 1), |
125 (fn prems => [ (cut_facts_tac prems 1), |
165 (Int.fast_tac 1) ]); |
126 (Int.fast_tac 1) ]); |
166 |
127 |
167 fun prove nm thm = qed_goal nm FOL.thy thm (fn _ => [fast_tac FOL_cs 1]); |
128 fun prove nm thm = qed_goal nm FOL.thy thm (fn _ => [fast_tac FOL_cs 1]); |
218 in |
179 in |
219 fun split_inside_tac splits = mktac (map mk_meta_eq splits) |
180 fun split_inside_tac splits = mktac (map mk_meta_eq splits) |
220 end; |
181 end; |
221 |
182 |
222 |
183 |
|
184 (*** Standard simpsets ***) |
|
185 |
|
186 structure Induction = InductionFun(struct val spec=IFOL.spec end); |
|
187 |
|
188 open Simplifier Induction; |
|
189 |
|
190 (*Add congruence rules for = or <-> (instead of ==) *) |
|
191 infix 4 addcongs; |
|
192 fun ss addcongs congs = |
|
193 ss addeqcongs (congs RL [eq_reflection,iff_reflection]); |
|
194 |
|
195 (*Add a simpset to a classical set!*) |
|
196 infix 4 addss; |
|
197 fun cs addss ss = cs addbefore asm_full_simp_tac ss 1; |
|
198 |
|
199 val IFOL_simps = |
|
200 [refl RS P_iff_T] @ conj_simps @ disj_simps @ not_simps @ |
|
201 imp_simps @ iff_simps @ quant_simps; |
|
202 |
|
203 val notFalseI = int_prove_fun "~False"; |
|
204 val triv_rls = [TrueI,refl,iff_refl,notFalseI]; |
|
205 |
|
206 val IFOL_ss = |
|
207 empty_ss |
|
208 setmksimps (map mk_meta_eq o atomize o gen_all) |
|
209 setsolver (fn prems => resolve_tac (triv_rls@prems) |
|
210 ORELSE' assume_tac |
|
211 ORELSE' etac FalseE) |
|
212 setsubgoaler asm_simp_tac |
|
213 addsimps IFOL_simps |
|
214 addcongs [imp_cong]; |
|
215 |
|
216 val cla_simps = |
|
217 [de_Morgan_conj, de_Morgan_disj, not_all, not_ex, cases_simp] @ |
|
218 map prove_fun |
|
219 ["~(P&Q) <-> ~P | ~Q", |
|
220 "P | ~P", "~P | P", |
|
221 "~ ~ P <-> P", "(~P --> P) <-> P", |
|
222 "(~P <-> ~Q) <-> (P<->Q)"]; |
|
223 |
|
224 val FOL_ss = IFOL_ss addsimps (cla_simps @ ex_simps @ all_simps); |
|
225 |