676 Not if it resembles x=t[x], since substitution does not eliminate x. |
676 Not if it resembles x=t[x], since substitution does not eliminate x. |
677 Not if it resembles ?x=0; another goal could instantiate ?x to Suc(i) |
677 Not if it resembles ?x=0; another goal could instantiate ?x to Suc(i) |
678 Prefer to eliminate Bound variables if possible. |
678 Prefer to eliminate Bound variables if possible. |
679 Result: true = use as is, false = reorient first *) |
679 Result: true = use as is, false = reorient first *) |
680 |
680 |
681 (*Does t occur in u? For substitution. |
681 (*Can t occur in u? For substitution. |
682 Does NOT check args of Skolem terms: substitution does not affect them. |
682 Does NOT examine the args of Skolem terms: substitution does not affect them. |
683 REFLEXIVE because hyp_subst_tac fails on x=x.*) |
683 REFLEXIVE because hyp_subst_tac fails on x=x.*) |
684 fun substOccur t = |
684 fun substOccur t = |
685 let fun occEq u = (t aconv u) orelse occ u |
685 let (*NO vars are permitted in u except the arguments of t, if it is |
686 and occ (Var(ref None)) = false |
686 a Skolem term. This ensures that no equations are deleted that could |
687 | occ (Var(ref(Some u))) = occEq u |
687 be instantiated to a cycle. For example, x=?a is rejected because ?a |
688 | occ (Abs(_,u)) = occEq u |
688 could be instantiated to Suc(x).*) |
|
689 val vars = case t of |
|
690 Skolem(_,vars) => vars |
|
691 | _ => [] |
|
692 fun occEq u = (t aconv u) orelse occ u |
|
693 and occ (Var(ref(Some u))) = occEq u |
|
694 | occ (Var v) = not (mem_var (v, vars)) |
|
695 | occ (Abs(_,u)) = occEq u |
689 | occ (f$u) = occEq u orelse occEq f |
696 | occ (f$u) = occEq u orelse occEq f |
690 | occ (_) = false; |
697 | occ (_) = false; |
691 in occEq end; |
698 in occEq end; |
692 |
699 |
693 exception DEST_EQ; |
700 exception DEST_EQ; |
987 handle CLOSEF => closeF (map fst haz) |
994 handle CLOSEF => closeF (map fst haz) |
988 handle CLOSEF => closeFl pairs |
995 handle CLOSEF => closeFl pairs |
989 in tracing sign brs0; |
996 in tracing sign brs0; |
990 if lim<0 then (traceMsg "Limit reached. "; backtrack choices) |
997 if lim<0 then (traceMsg "Limit reached. "; backtrack choices) |
991 else |
998 else |
992 prv ((TRY o Data.vars_gen_hyp_subst_tac false) :: tacs, |
999 prv (Data.vars_gen_hyp_subst_tac false :: tacs, |
993 (*The TRY above allows the substitution to fail, e.g. if |
|
994 the real version is z = f(?x z). Rest of proof might |
|
995 still succeed!*) |
|
996 brs0::trs, choices, |
1000 brs0::trs, choices, |
997 equalSubst sign (G, (br,haz)::pairs, lits, vars, lim) :: brs) |
1001 equalSubst sign (G, (br,haz)::pairs, lits, vars, lim) :: brs) |
998 handle DEST_EQ => closeF lits |
1002 handle DEST_EQ => closeF lits |
999 handle CLOSEF => closeFl ((br,haz)::pairs) |
1003 handle CLOSEF => closeFl ((br,haz)::pairs) |
1000 handle CLOSEF => deeper rules |
1004 handle CLOSEF => deeper rules |