equal
deleted
inserted
replaced
175 |
175 |
176 (*Apply every tactic to 1*) |
176 (*Apply every tactic to 1*) |
177 fun EVERY1 tacs = EVERY' tacs 1; |
177 fun EVERY1 tacs = EVERY' tacs 1; |
178 |
178 |
179 (* FIRST [tac1,...,tacn] equals tac1 ORELSE ... ORELSE tacn *) |
179 (* FIRST [tac1,...,tacn] equals tac1 ORELSE ... ORELSE tacn *) |
180 fun FIRST tacs = foldr (op ORELSE) no_tac tacs; |
180 fun FIRST tacs = fold_rev (curry op ORELSE) tacs no_tac; |
181 |
181 |
182 (* FIRST' [tac1,...,tacn] i equals tac1 i ORELSE ... ORELSE tacn i *) |
182 (* FIRST' [tac1,...,tacn] i equals tac1 i ORELSE ... ORELSE tacn i *) |
183 fun FIRST' tacs = foldr (op ORELSE') (K no_tac) tacs; |
183 fun FIRST' tacs = fold_rev (curry op ORELSE') tacs (K no_tac); |
184 |
184 |
185 (*Apply first tactic to 1*) |
185 (*Apply first tactic to 1*) |
186 fun FIRST1 tacs = FIRST' tacs 1; |
186 fun FIRST1 tacs = FIRST' tacs 1; |
187 |
187 |
188 (*Apply tactics on consecutive subgoals*) |
188 (*Apply tactics on consecutive subgoals*) |
411 in |
411 in |
412 |
412 |
413 (*Common code for METAHYPS and metahyps_thms*) |
413 (*Common code for METAHYPS and metahyps_thms*) |
414 fun metahyps_split_prem prem = |
414 fun metahyps_split_prem prem = |
415 let (*find all vars in the hyps -- should find tvars also!*) |
415 let (*find all vars in the hyps -- should find tvars also!*) |
416 val hyps_vars = foldr add_term_vars [] (Logic.strip_assums_hyp prem) |
416 val hyps_vars = List.foldr add_term_vars [] (Logic.strip_assums_hyp prem) |
417 val insts = map mk_inst hyps_vars |
417 val insts = map mk_inst hyps_vars |
418 (*replace the hyps_vars by Frees*) |
418 (*replace the hyps_vars by Frees*) |
419 val prem' = subst_atomic insts prem |
419 val prem' = subst_atomic insts prem |
420 val (params,hyps,concl) = strip_context prem' |
420 val (params,hyps,concl) = strip_context prem' |
421 in (insts,params,hyps,concl) end; |
421 in (insts,params,hyps,concl) end; |
451 fun elim Bhyp = implies_elim_list (forall_elim_list cparams Bhyp) hypths |
451 fun elim Bhyp = implies_elim_list (forall_elim_list cparams Bhyp) hypths |
452 (*A form of lifting that discharges assumptions.*) |
452 (*A form of lifting that discharges assumptions.*) |
453 fun relift st = |
453 fun relift st = |
454 let val prop = Thm.prop_of st |
454 let val prop = Thm.prop_of st |
455 val subgoal_vars = (*Vars introduced in the subgoals*) |
455 val subgoal_vars = (*Vars introduced in the subgoals*) |
456 foldr add_term_vars [] (Logic.strip_imp_prems prop) |
456 List.foldr add_term_vars [] (Logic.strip_imp_prems prop) |
457 and concl_vars = add_term_vars (Logic.strip_imp_concl prop, []) |
457 and concl_vars = add_term_vars (Logic.strip_imp_concl prop, []) |
458 val subgoal_insts = map (mk_subgoal_inst concl_vars) subgoal_vars |
458 val subgoal_insts = map (mk_subgoal_inst concl_vars) subgoal_vars |
459 val st' = Thm.instantiate ([], map mk_ctpair subgoal_insts) st |
459 val st' = Thm.instantiate ([], map mk_ctpair subgoal_insts) st |
460 val emBs = map (cterm o embed) (prems_of st') |
460 val emBs = map (cterm o embed) (prems_of st') |
461 val Cth = implies_elim_list st' (map (elim o assume) emBs) |
461 val Cth = implies_elim_list st' (map (elim o assume) emBs) |