equal
deleted
inserted
replaced
529 |
529 |
530 fun copy_prems_tac [] ns i = |
530 fun copy_prems_tac [] ns i = |
531 if forall (curry (op =) 1) ns then all_tac else copy_prems_tac (rev ns) [] i |
531 if forall (curry (op =) 1) ns then all_tac else copy_prems_tac (rev ns) [] i |
532 | copy_prems_tac (1 :: ms) ns i = rotate_tac 1 i THEN copy_prems_tac ms (1 :: ns) i |
532 | copy_prems_tac (1 :: ms) ns i = rotate_tac 1 i THEN copy_prems_tac ms (1 :: ns) i |
533 | copy_prems_tac (m :: ms) ns i = |
533 | copy_prems_tac (m :: ms) ns i = |
534 etac copy_prem i THEN copy_prems_tac ms (m div 2 :: (m + 1) div 2 :: ns) i |
534 eresolve_tac [copy_prem] i THEN copy_prems_tac ms (m div 2 :: (m + 1) div 2 :: ns) i |
535 |
535 |
536 (* Metis generates variables of the form _nnn. *) |
536 (* Metis generates variables of the form _nnn. *) |
537 val is_metis_fresh_variable = String.isPrefix "_" |
537 val is_metis_fresh_variable = String.isPrefix "_" |
538 |
538 |
539 fun instantiate_forall_tac thy t i st = |
539 fun instantiate_forall_tac thy t i st = |
576 in |
576 in |
577 Drule.instantiate_normalize (ty_inst, t_inst) th |
577 Drule.instantiate_normalize (ty_inst, t_inst) th |
578 end |
578 end |
579 | _ => raise Fail "expected a single non-zapped, non-Metis Var") |
579 | _ => raise Fail "expected a single non-zapped, non-Metis Var") |
580 in |
580 in |
581 (DETERM (etac @{thm allE} i THEN rotate_tac ~1 i) THEN PRIMITIVE do_instantiate) st |
581 (DETERM (eresolve_tac @{thms allE} i THEN rotate_tac ~1 i) THEN PRIMITIVE do_instantiate) st |
582 end |
582 end |
583 |
583 |
584 fun fix_exists_tac t = etac exE THEN' rename_tac [t |> dest_Var |> fst |> fst] |
584 fun fix_exists_tac t = eresolve_tac [exE] THEN' rename_tac [t |> dest_Var |> fst |> fst] |
585 |
585 |
586 fun release_quantifier_tac thy (skolem, t) = |
586 fun release_quantifier_tac thy (skolem, t) = |
587 (if skolem then fix_exists_tac else instantiate_forall_tac thy) t |
587 (if skolem then fix_exists_tac else instantiate_forall_tac thy) t |
588 |
588 |
589 fun release_clusters_tac _ _ _ [] = K all_tac |
589 fun release_clusters_tac _ _ _ [] = K all_tac |
728 val _ = tracing ("OUTER PARAMS: " ^ @{make_string} outer_param_names) |
728 val _ = tracing ("OUTER PARAMS: " ^ @{make_string} outer_param_names) |
729 val _ = tracing ("SUBSTS (" ^ string_of_int (length substs) ^ "):\n" ^ |
729 val _ = tracing ("SUBSTS (" ^ string_of_int (length substs) ^ "):\n" ^ |
730 cat_lines (map string_of_subst_info substs)) |
730 cat_lines (map string_of_subst_info substs)) |
731 *) |
731 *) |
732 |
732 |
733 fun cut_and_ex_tac axiom = cut_tac axiom 1 THEN TRY (REPEAT_ALL_NEW (etac @{thm exE}) 1) |
733 fun cut_and_ex_tac axiom = |
|
734 cut_tac axiom 1 THEN TRY (REPEAT_ALL_NEW (eresolve_tac @{thms exE}) 1) |
734 fun rotation_of_subgoal i = |
735 fun rotation_of_subgoal i = |
735 find_index (fn (_, (subgoal_no, _)) => subgoal_no = i) substs |
736 find_index (fn (_, (subgoal_no, _)) => subgoal_no = i) substs |
736 |
737 |
737 val ctxt' = fold Thm.declare_hyps (#hyps (Thm.crep_thm prems_imp_false)) ctxt |
738 val ctxt' = fold Thm.declare_hyps (#hyps (Thm.crep_thm prems_imp_false)) ctxt |
738 in |
739 in |
740 (K (DETERM (EVERY (map (cut_and_ex_tac o fst o the o nth axioms o fst o fst) ax_counts) |
741 (K (DETERM (EVERY (map (cut_and_ex_tac o fst o the o nth axioms o fst o fst) ax_counts) |
741 THEN rename_tac outer_param_names 1 |
742 THEN rename_tac outer_param_names 1 |
742 THEN copy_prems_tac (map snd ax_counts) [] 1) |
743 THEN copy_prems_tac (map snd ax_counts) [] 1) |
743 THEN release_clusters_tac thy ax_counts substs ordered_clusters 1 |
744 THEN release_clusters_tac thy ax_counts substs ordered_clusters 1 |
744 THEN match_tac [prems_imp_false] 1 |
745 THEN match_tac [prems_imp_false] 1 |
745 THEN ALLGOALS (fn i => rtac @{thm Meson.skolem_COMBK_I} i |
746 THEN ALLGOALS (fn i => resolve_tac @{thms Meson.skolem_COMBK_I} i |
746 THEN rotate_tac (rotation_of_subgoal i) i |
747 THEN rotate_tac (rotation_of_subgoal i) i |
747 THEN PRIMITIVE (unify_first_prem_with_concl thy i) |
748 THEN PRIMITIVE (unify_first_prem_with_concl thy i) |
748 THEN assume_tac i |
749 THEN assume_tac i |
749 THEN flexflex_tac))) |
750 THEN flexflex_tac))) |
750 handle ERROR msg => |
751 handle ERROR msg => |