src/HOL/Mirabelle/Tools/mirabelle.ML
changeset 35592 768d17f54125
parent 34052 b2e6245fb3da
child 36001 992839c4be90
equal deleted inserted replaced
35591:ad7d2f9cc47d 35592:768d17f54125
    25   val register : action -> theory -> theory
    25   val register : action -> theory -> theory
    26   val step_hook : Toplevel.transition -> Toplevel.state -> Toplevel.state ->
    26   val step_hook : Toplevel.transition -> Toplevel.state -> Toplevel.state ->
    27     unit
    27     unit
    28 
    28 
    29   (*utility functions*)
    29   (*utility functions*)
    30   val goal_thm_of : Proof.state -> thm
       
    31   val can_apply : Time.time -> (Proof.context -> int -> tactic) ->
    30   val can_apply : Time.time -> (Proof.context -> int -> tactic) ->
    32     Proof.state -> bool
    31     Proof.state -> bool
    33   val theorems_in_proof_term : thm -> thm list
    32   val theorems_in_proof_term : thm -> thm list
    34   val theorems_of_sucessful_proof : Toplevel.state option -> thm list
    33   val theorems_of_sucessful_proof : Toplevel.state option -> thm list
    35   val get_setting : (string * string) list -> string * string -> string
    34   val get_setting : (string * string) list -> string * string -> string
   153 
   152 
   154 
   153 
   155 
   154 
   156 (* Mirabelle utility functions *)
   155 (* Mirabelle utility functions *)
   157 
   156 
   158 val goal_thm_of = #goal o Proof.raw_goal  (* FIXME ?? *)
       
   159 
       
   160 fun can_apply time tac st =
   157 fun can_apply time tac st =
   161   let
   158   let
   162     val {context = ctxt, facts, goal} = Proof.raw_goal st   (* FIXME ?? *)
   159     val {context = ctxt, facts, goal} = Proof.goal st
   163     val full_tac = HEADGOAL (Method.insert_tac facts THEN' tac ctxt)
   160     val full_tac = HEADGOAL (Method.insert_tac facts THEN' tac ctxt)
   164   in
   161   in
   165     (case TimeLimit.timeLimit time (Seq.pull o full_tac) goal of
   162     (case TimeLimit.timeLimit time (Seq.pull o full_tac) goal of
   166       SOME (thm, _) => true
   163       SOME (thm, _) => true
   167     | NONE => false)
   164     | NONE => false)
   199 fun theorems_of_sucessful_proof state =
   196 fun theorems_of_sucessful_proof state =
   200   (case state of
   197   (case state of
   201     NONE => []
   198     NONE => []
   202   | SOME st =>
   199   | SOME st =>
   203       if not (Toplevel.is_proof st) then []
   200       if not (Toplevel.is_proof st) then []
   204       else theorems_in_proof_term (goal_thm_of (Toplevel.proof_of st)))
   201       else theorems_in_proof_term (#goal (Proof.goal (Toplevel.proof_of st))))
   205 
   202 
   206 fun get_setting settings (key, default) =
   203 fun get_setting settings (key, default) =
   207   the_default default (AList.lookup (op =) settings key)
   204   the_default default (AList.lookup (op =) settings key)
   208 
   205 
   209 fun get_int_setting settings (key, default) =
   206 fun get_int_setting settings (key, default) =