src/HOL/Tools/Function/function_lib.ML
changeset 60328 9c94e6a30d29
parent 59625 aacdce52b2fc
child 61121 efe8b18306b7
equal deleted inserted replaced
60327:a3f565b8ba76 60328:9c94e6a30d29
    16   val rename_bound: string -> term -> term
    16   val rename_bound: string -> term -> term
    17   val mk_forall_rename: (string * term) -> term -> term
    17   val mk_forall_rename: (string * term) -> term -> term
    18   val forall_intr_rename: (string * cterm) -> thm -> thm
    18   val forall_intr_rename: (string * cterm) -> thm -> thm
    19 
    19 
    20   datatype proof_attempt = Solved of thm | Stuck of thm | Fail
    20   datatype proof_attempt = Solved of thm | Stuck of thm | Fail
    21   val try_proof: cterm -> tactic -> proof_attempt
    21   val try_proof: Proof.context -> cterm -> tactic -> proof_attempt
    22 
    22 
    23   val dest_binop_list: string -> term -> term list
    23   val dest_binop_list: string -> term -> term list
    24   val regroup_conv: Proof.context -> string -> string -> thm list -> int list -> conv
    24   val regroup_conv: Proof.context -> string -> string -> thm list -> int list -> conv
    25   val regroup_union_conv: Proof.context -> int list -> conv
    25   val regroup_union_conv: Proof.context -> int list -> conv
    26 
    26 
    66   in Thm.rename_boundvars abs (Abs (n, dummyT, Term.dummy)) allthm end
    66   in Thm.rename_boundvars abs (Abs (n, dummyT, Term.dummy)) allthm end
    67 
    67 
    68 
    68 
    69 datatype proof_attempt = Solved of thm | Stuck of thm | Fail
    69 datatype proof_attempt = Solved of thm | Stuck of thm | Fail
    70 
    70 
    71 fun try_proof cgoal tac =
    71 fun try_proof ctxt cgoal tac =
    72   case SINGLE tac (Goal.init cgoal) of
    72   (case SINGLE tac (Goal.init cgoal) of
    73     NONE => Fail
    73     NONE => Fail
    74   | SOME st =>
    74   | SOME st =>
    75     if Thm.no_prems st
    75       if Thm.no_prems st
    76     then Solved (Goal.finish (Syntax.init_pretty_global (Thm.theory_of_cterm cgoal)) st)
    76       then Solved (Goal.finish ctxt st)
    77     else Stuck st
    77       else Stuck st)
    78 
    78 
    79 
    79 
    80 fun dest_binop_list cn (t as (Const (n, _) $ a $ b)) =
    80 fun dest_binop_list cn (t as (Const (n, _) $ a $ b)) =
    81   if cn = n then dest_binop_list cn a @ dest_binop_list cn b else [ t ]
    81   if cn = n then dest_binop_list cn a @ dest_binop_list cn b else [ t ]
    82   | dest_binop_list _ t = [ t ]
    82   | dest_binop_list _ t = [ t ]