src/HOL/Tools/ATP/atp_util.ML
changeset 52125 ac7830871177
parent 52077 788b27dfaefa
child 52196 2281f33e8da6
equal deleted inserted replaced
52124:c54170ee898b 52125:ac7830871177
    47   val unextensionalize_def : term -> term
    47   val unextensionalize_def : term -> term
    48   val is_legitimate_tptp_def : term -> bool
    48   val is_legitimate_tptp_def : term -> bool
    49   val transform_elim_prop : term -> term
    49   val transform_elim_prop : term -> term
    50   val specialize_type : theory -> (string * typ) -> term -> term
    50   val specialize_type : theory -> (string * typ) -> term -> term
    51   val strip_subgoal :
    51   val strip_subgoal :
    52     Proof.context -> thm -> int -> (string * typ) list * term list * term
    52     thm -> int -> Proof.context
       
    53     -> ((string * typ) list * term list * term) * Proof.context
    53 end;
    54 end;
    54 
    55 
    55 structure ATP_Util : ATP_UTIL =
    56 structure ATP_Util : ATP_UTIL =
    56 struct
    57 struct
    57 
    58 
   427     case subst_for t of
   428     case subst_for t of
   428       SOME subst => monomorphic_term subst t
   429       SOME subst => monomorphic_term subst t
   429     | NONE => raise Type.TYPE_MATCH
   430     | NONE => raise Type.TYPE_MATCH
   430   end
   431   end
   431 
   432 
   432 fun strip_subgoal ctxt goal i =
   433 fun strip_subgoal goal i ctxt =
   433   let
   434   let
   434     val (t, (frees, params)) =
   435     val (t, ((frees, params), ctxt)) =
   435       Logic.goal_params (prop_of goal) i
   436       Logic.goal_params (prop_of goal) i
   436       ||> (map dest_Free #> Variable.variant_frees ctxt [] #> `(map Free))
   437       ||> map dest_Free
       
   438       ||> map (fn (s, T) => (Binding.name s, SOME T, NoSyn))
       
   439       ||> (fn fixes =>
       
   440               ctxt |> Variable.set_body false
       
   441                    |> Proof_Context.add_fixes fixes
       
   442                    |>> map2 (fn (_, SOME T, _) => fn s => (s, T)) fixes)
       
   443       ||> apfst (`(map Free))
   437     val hyp_ts = t |> Logic.strip_assums_hyp |> map (curry subst_bounds frees)
   444     val hyp_ts = t |> Logic.strip_assums_hyp |> map (curry subst_bounds frees)
   438     val concl_t = t |> Logic.strip_assums_concl |> curry subst_bounds frees
   445     val concl_t = t |> Logic.strip_assums_concl |> curry subst_bounds frees
   439   in (rev params, hyp_ts, concl_t) end
   446   in ((rev params, hyp_ts, concl_t), ctxt) end
   440 
   447 
   441 end;
   448 end;