src/Tools/IsaPlanner/rw_inst.ML
changeset 29270 0eade173f77e
parent 29265 5b4247055bd7
child 30190 479806475f3c
equal deleted inserted replaced
29269:5c25a2012975 29270:0eade173f77e
    69     let val rep = Thm.rep_thm th
    69     let val rep = Thm.rep_thm th
    70       val hyps = #hyps rep
    70       val hyps = #hyps rep
    71       val (tpairl,tpairr) = Library.split_list (#tpairs rep)
    71       val (tpairl,tpairr) = Library.split_list (#tpairs rep)
    72       val prop = #prop rep
    72       val prop = #prop rep
    73     in
    73     in
    74       List.foldr Term.add_term_names [] (prop :: (tpairl @ (tpairr @ hyps)))
    74       List.foldr OldTerm.add_term_names [] (prop :: (tpairl @ (tpairr @ hyps)))
    75     end;
    75     end;
    76 
    76 
    77 (* Given a list of variables that were bound, and a that has been
    77 (* Given a list of variables that were bound, and a that has been
    78 instantiated with free variable placeholders for the bound vars, it
    78 instantiated with free variable placeholders for the bound vars, it
    79 creates an abstracted version of the theorem, with local bound vars as
    79 creates an abstracted version of the theorem, with local bound vars as
   134       other uninstantiated vars in the hyps of the rule 
   134       other uninstantiated vars in the hyps of the rule 
   135       ie ?z in C ?z ?x ==> A ?x ?y = B ?x ?y *)
   135       ie ?z in C ?z ?x ==> A ?x ?y = B ?x ?y *)
   136 fun mk_renamings tgt rule_inst = 
   136 fun mk_renamings tgt rule_inst = 
   137     let
   137     let
   138       val rule_conds = Thm.prems_of rule_inst
   138       val rule_conds = Thm.prems_of rule_inst
   139       val names = foldr Term.add_term_names [] (tgt :: rule_conds);
   139       val names = foldr OldTerm.add_term_names [] (tgt :: rule_conds);
   140       val (conds_tyvs,cond_vs) = 
   140       val (conds_tyvs,cond_vs) = 
   141           Library.foldl (fn ((tyvs, vs), t) => 
   141           Library.foldl (fn ((tyvs, vs), t) => 
   142                     (Library.union
   142                     (Library.union
   143                        (Term.term_tvars t, tyvs),
   143                        (OldTerm.term_tvars t, tyvs),
   144                      Library.union 
   144                      Library.union 
   145                        (map Term.dest_Var (OldTerm.term_vars t), vs))) 
   145                        (map Term.dest_Var (OldTerm.term_vars t), vs))) 
   146                 (([],[]), rule_conds);
   146                 (([],[]), rule_conds);
   147       val termvars = map Term.dest_Var (OldTerm.term_vars tgt); 
   147       val termvars = map Term.dest_Var (OldTerm.term_vars tgt); 
   148       val vars_to_fix = Library.union (termvars, cond_vs);
   148       val vars_to_fix = Library.union (termvars, cond_vs);
   165 fun mk_fixtvar_tyinsts ignore_insts ts = 
   165 fun mk_fixtvar_tyinsts ignore_insts ts = 
   166     let 
   166     let 
   167       val ignore_ixs = map fst ignore_insts;
   167       val ignore_ixs = map fst ignore_insts;
   168       val (tvars, tfrees) = 
   168       val (tvars, tfrees) = 
   169             foldr (fn (t, (varixs, tfrees)) => 
   169             foldr (fn (t, (varixs, tfrees)) => 
   170                       (Term.add_term_tvars (t,varixs),
   170                       (OldTerm.add_term_tvars (t,varixs),
   171                        Term.add_term_tfrees (t,tfrees)))
   171                        OldTerm.add_term_tfrees (t,tfrees)))
   172                   ([],[]) ts;
   172                   ([],[]) ts;
   173         val unfixed_tvars = 
   173         val unfixed_tvars = 
   174             List.filter (fn (ix,s) => not (member (op =) ignore_ixs ix)) tvars;
   174             List.filter (fn (ix,s) => not (member (op =) ignore_ixs ix)) tvars;
   175         val (fixtyinsts, _) = foldr new_tfree ([], map fst tfrees) unfixed_tvars
   175         val (fixtyinsts, _) = foldr new_tfree ([], map fst tfrees) unfixed_tvars
   176     in (fixtyinsts, tfrees) end;
   176     in (fixtyinsts, tfrees) end;