src/Pure/Isar/obtain.ML
changeset 24920 2a45e400fdad
parent 22568 ed7aa5a350ef
child 28080 4723eb2456ce
equal deleted inserted replaced
24919:ad3a8569759c 24920:2a45e400fdad
    69     val vs = map (dest_Free o Thm.term_of) xs;
    69     val vs = map (dest_Free o Thm.term_of) xs;
    70     val bads = Term.fold_aterms (fn t as Free v =>
    70     val bads = Term.fold_aterms (fn t as Free v =>
    71       if member (op =) vs v then insert (op aconv) t else I | _ => I) tm [];
    71       if member (op =) vs v then insert (op aconv) t else I | _ => I) tm [];
    72     val _ = null bads orelse
    72     val _ = null bads orelse
    73       error ("Result contains obtained parameters: " ^
    73       error ("Result contains obtained parameters: " ^
    74         space_implode " " (map (ProofContext.string_of_term ctxt) bads));
    74         space_implode " " (map (Syntax.string_of_term ctxt) bads));
    75   in tm end;
    75   in tm end;
    76 
    76 
    77 fun eliminate fix_ctxt rule xs As thm =
    77 fun eliminate fix_ctxt rule xs As thm =
    78   let
    78   let
    79     val thy = ProofContext.theory_of fix_ctxt;
    79     val thy = ProofContext.theory_of fix_ctxt;
   215 fun unify_params vars thesis_var raw_rule ctxt =
   215 fun unify_params vars thesis_var raw_rule ctxt =
   216   let
   216   let
   217     val thy = ProofContext.theory_of ctxt;
   217     val thy = ProofContext.theory_of ctxt;
   218     val certT = Thm.ctyp_of thy;
   218     val certT = Thm.ctyp_of thy;
   219     val cert = Thm.cterm_of thy;
   219     val cert = Thm.cterm_of thy;
   220     val string_of_typ = ProofContext.string_of_typ ctxt;
   220     val string_of_typ = Syntax.string_of_typ ctxt;
   221     val string_of_term = setmp show_types true (ProofContext.string_of_term ctxt);
   221     val string_of_term = setmp show_types true (Syntax.string_of_term ctxt);
   222 
   222 
   223     fun err msg th = error (msg ^ ":\n" ^ ProofContext.string_of_thm ctxt th);
   223     fun err msg th = error (msg ^ ":\n" ^ ProofContext.string_of_thm ctxt th);
   224 
   224 
   225     val maxidx = fold (Term.maxidx_typ o snd o fst) vars ~1;
   225     val maxidx = fold (Term.maxidx_typ o snd o fst) vars ~1;
   226     val rule = Thm.incr_indexes (maxidx + 1) raw_rule;
   226     val rule = Thm.incr_indexes (maxidx + 1) raw_rule;