equal
deleted
inserted
replaced
|
1 (* Title: HOL/Library/cconv.ML |
|
2 Author: Christoph Traut, Lars Noschinski, TU Muenchen |
|
3 |
|
4 FIXME!? |
|
5 *) |
|
6 |
1 infix 1 then_cconv |
7 infix 1 then_cconv |
2 infix 0 else_cconv |
8 infix 0 else_cconv |
3 |
9 |
4 type cconv = conv |
10 type cconv = conv |
5 |
11 |
168 Fix this! *) |
174 Fix this! *) |
169 (*rewrite the A's in A1 Pure.imp ... Pure.imp An Pure.imp B*) |
175 (*rewrite the A's in A1 Pure.imp ... Pure.imp An Pure.imp B*) |
170 fun prems_cconv 0 cv ct = cv ct |
176 fun prems_cconv 0 cv ct = cv ct |
171 | prems_cconv n cv ct = |
177 | prems_cconv n cv ct = |
172 (case ct |> Thm.term_of of |
178 (case ct |> Thm.term_of of |
173 (Const (@{const_name "Pure.imp"}, _) $ _) $ _ => ((if n = 1 then fun_cconv else I) o arg_cconv) (prems_cconv (n-1) cv) ct |
179 (Const (@{const_name "Pure.imp"}, _) $ _) $ _ => |
|
180 ((if n = 1 then fun_cconv else I) o arg_cconv) (prems_cconv (n-1) cv) ct |
174 | _ => cv ct) |
181 | _ => cv ct) |
175 |
182 |
176 (*rewrite B in A1 Pure.imp ... Pure.imp An Pure.imp B*) |
183 (*rewrite B in A1 Pure.imp ... Pure.imp An Pure.imp B*) |
177 fun concl_cconv 0 cv ct = cv ct |
184 fun concl_cconv 0 cv ct = cv ct |
178 | concl_cconv n cv ct = |
185 | concl_cconv n cv ct = |
210 if Thm.is_reflexive eq then th |
217 if Thm.is_reflexive eq then th |
211 else with_subgoal i (fconv_rule (arg1_cconv (K eq))) th |
218 else with_subgoal i (fconv_rule (arg1_cconv (K eq))) th |
212 end |
219 end |
213 | NONE => raise THM ("gconv_rule", i, [th])) |
220 | NONE => raise THM ("gconv_rule", i, [th])) |
214 |
221 |
215 (* Conditional conversions as tactics. *) |
222 (* Conditional conversions as tactics. *) |
216 fun CCONVERSION cv i st = Seq.single (gconv_rule cv i st) |
223 fun CCONVERSION cv i st = Seq.single (gconv_rule cv i st) |
217 handle THM _ => Seq.empty |
224 handle THM _ => Seq.empty |
218 | CTERM _ => Seq.empty |
225 | CTERM _ => Seq.empty |
219 | TERM _ => Seq.empty |
226 | TERM _ => Seq.empty |
220 | TYPE _ => Seq.empty |
227 | TYPE _ => Seq.empty |