src/HOL/Tools/Sledgehammer/sledgehammer_run.ML
author blanchet
Fri, 10 Jun 2011 12:01:15 +0200
changeset 44217 b19d95b4d736
parent 44177 03e6da81aee6
child 44461 0940a64beca2
permissions -rw-r--r--
compute the set of base facts only once (instead of three times in parallel) -- this saves about .5 s of CPU time, albeit much less clock wall time
blanchet@41335
     1
(*  Title:      HOL/Tools/Sledgehammer/sledgehammer_run.ML
wenzelm@28477
     2
    Author:     Fabian Immler, TU Muenchen
wenzelm@32996
     3
    Author:     Makarius
blanchet@35967
     4
    Author:     Jasmin Blanchette, TU Muenchen
wenzelm@28477
     5
blanchet@38255
     6
Sledgehammer's heart.
wenzelm@28477
     7
*)
wenzelm@28477
     8
blanchet@41335
     9
signature SLEDGEHAMMER_RUN =
wenzelm@28477
    10
sig
blanchet@43926
    11
  type minimize_command = ATP_Reconstruct.minimize_command
blanchet@39232
    12
  type relevance_override = Sledgehammer_Filter.relevance_override
blanchet@43862
    13
  type mode = Sledgehammer_Provers.mode
blanchet@41335
    14
  type params = Sledgehammer_Provers.params
blanchet@41511
    15
  type prover = Sledgehammer_Provers.prover
blanchet@39733
    16
blanchet@43861
    17
  val someN : string
blanchet@43861
    18
  val noneN : string
blanchet@43861
    19
  val timeoutN : string
blanchet@43861
    20
  val unknownN : string
blanchet@44177
    21
  val auto_min_min_facts : int Config.T
blanchet@44177
    22
  val auto_min_max_time : real Config.T
blanchet@43862
    23
  val get_minimizing_prover : Proof.context -> mode -> string -> prover
blanchet@38290
    24
  val run_sledgehammer :
blanchet@43862
    25
    params -> mode -> int -> relevance_override -> (string -> minimize_command)
blanchet@43861
    26
    -> Proof.state -> bool * (string * Proof.state)
wenzelm@28477
    27
end;
wenzelm@28477
    28
blanchet@41335
    29
structure Sledgehammer_Run : SLEDGEHAMMER_RUN =
wenzelm@28477
    30
struct
wenzelm@28477
    31
blanchet@43926
    32
open ATP_Util
blanchet@43926
    33
open ATP_Translate
blanchet@43926
    34
open ATP_Reconstruct
blanchet@38257
    35
open Sledgehammer_Util
blanchet@39232
    36
open Sledgehammer_Filter
blanchet@41335
    37
open Sledgehammer_Provers
blanchet@41339
    38
open Sledgehammer_Minimize
blanchet@40253
    39
blanchet@43861
    40
val someN = "some"
blanchet@43861
    41
val noneN = "none"
blanchet@43861
    42
val timeoutN = "timeout"
blanchet@43861
    43
val unknownN = "unknown"
blanchet@43861
    44
blanchet@43861
    45
val ordered_outcome_codes = [someN, unknownN, timeoutN, noneN]
blanchet@43861
    46
blanchet@43861
    47
fun max_outcome_code codes =
blanchet@43861
    48
  NONE
blanchet@43861
    49
  |> fold (fn candidate =>
blanchet@43861
    50
              fn accum as SOME _ => accum
blanchet@43861
    51
               | NONE => if member (op =) codes candidate then SOME candidate
blanchet@43861
    52
                         else NONE)
blanchet@43861
    53
          ordered_outcome_codes
blanchet@43861
    54
  |> the_default unknownN
blanchet@43861
    55
blanchet@41456
    56
fun prover_description ctxt ({verbose, blocking, ...} : params) name num_facts i
blanchet@41337
    57
                       n goal =
blanchet@43846
    58
  (name,
blanchet@43846
    59
   (if verbose then
blanchet@43846
    60
      " with " ^ string_of_int num_facts ^ " fact" ^ plural_s num_facts
blanchet@43846
    61
    else
blanchet@43846
    62
      "") ^
blanchet@43846
    63
   " on " ^ (if n = 1 then "goal" else "subgoal " ^ string_of_int i) ^
blanchet@43846
    64
   (if blocking then
blanchet@43846
    65
      "."
blanchet@43846
    66
    else
blanchet@43878
    67
      "\n" ^ Syntax.string_of_term ctxt (Thm.term_of (Thm.cprem_of goal i))))
blanchet@41337
    68
blanchet@44177
    69
val auto_min_min_facts =
blanchet@44177
    70
  Attrib.setup_config_int @{binding sledgehammer_auto_min_min_facts}
blanchet@43809
    71
      (fn generic => Config.get_generic generic binary_min_facts)
blanchet@44177
    72
val auto_min_max_time =
blanchet@44177
    73
  Attrib.setup_config_real @{binding sledgehammer_auto_min_max_time} (K 0.0) (*###*)
blanchet@43893
    74
blanchet@44006
    75
fun minimize ctxt mode name (params as {debug, verbose, isar_proof, ...})
blanchet@44005
    76
             ({state, subgoal, subgoal_count, facts, ...} : prover_problem)
blanchet@44005
    77
             (result as {outcome, used_facts, run_time_in_msecs, preplay,
blanchet@44102
    78
                         message, message_tail} : prover_result) =
blanchet@44150
    79
  if is_some outcome orelse null used_facts then
blanchet@44005
    80
    result
blanchet@44005
    81
  else
blanchet@44005
    82
    let
blanchet@44005
    83
      val num_facts = length used_facts
blanchet@44005
    84
      val ((minimize, minimize_name), preplay) =
blanchet@44005
    85
        if mode = Normal then
blanchet@44177
    86
          if num_facts >= Config.get ctxt auto_min_min_facts then
blanchet@44005
    87
            ((true, name), preplay)
blanchet@44005
    88
          else
blanchet@44006
    89
            let
blanchet@44006
    90
              fun can_min_fast_enough msecs =
blanchet@44006
    91
                0.001 * Real.fromInt ((num_facts + 2) * msecs)
blanchet@44177
    92
                <= Config.get ctxt auto_min_max_time
blanchet@44006
    93
              val prover_fast_enough =
blanchet@44006
    94
                run_time_in_msecs |> Option.map can_min_fast_enough
blanchet@44006
    95
                                  |> the_default false
blanchet@44006
    96
            in
blanchet@44006
    97
              if isar_proof then
blanchet@44006
    98
                ((prover_fast_enough, name), preplay)
blanchet@44006
    99
              else
blanchet@44006
   100
                let val preplay = preplay () in
blanchet@44006
   101
                  (case preplay of
blanchet@44006
   102
                     Played (reconstructor, timeout) =>
blanchet@44006
   103
                     if can_min_fast_enough (Time.toMilliseconds timeout) then
blanchet@44074
   104
                       (true, prover_name_for_reconstructor reconstructor
blanchet@44074
   105
                              |> the_default name)
blanchet@44006
   106
                     else
blanchet@44006
   107
                       (prover_fast_enough, name)
blanchet@44006
   108
                   | _ => (prover_fast_enough, name),
blanchet@44006
   109
                   K preplay)
blanchet@44006
   110
                end
blanchet@44005
   111
            end
blanchet@44005
   112
        else
blanchet@44005
   113
          ((false, name), preplay)
blanchet@44102
   114
      val (used_facts, (preplay, message, _)) =
blanchet@44005
   115
        if minimize then
blanchet@44005
   116
          minimize_facts minimize_name params (not verbose) subgoal
blanchet@44005
   117
                         subgoal_count state
blanchet@44005
   118
                         (filter_used_facts used_facts
blanchet@44005
   119
                              (map (apsnd single o untranslated_fact) facts))
blanchet@44005
   120
          |>> Option.map (map fst)
blanchet@44005
   121
        else
blanchet@44102
   122
          (SOME used_facts, (preplay, message, ""))
blanchet@44005
   123
    in
blanchet@44005
   124
      case used_facts of
blanchet@44005
   125
        SOME used_facts =>
blanchet@44005
   126
        (if debug andalso not (null used_facts) then
blanchet@44005
   127
           facts ~~ (0 upto length facts - 1)
blanchet@44005
   128
           |> map (fn (fact, j) => fact |> untranslated_fact |> apsnd (K j))
blanchet@44005
   129
           |> filter_used_facts used_facts
blanchet@44005
   130
           |> map (fn ((name, _), j) => name ^ "@" ^ string_of_int j)
blanchet@44005
   131
           |> commas
blanchet@44005
   132
           |> enclose ("Fact" ^ plural_s (length facts) ^ " in " ^ quote name ^
blanchet@44005
   133
                       " proof (of " ^ string_of_int (length facts) ^ "): ") "."
blanchet@44005
   134
           |> Output.urgent_message
blanchet@44005
   135
         else
blanchet@44005
   136
           ();
blanchet@44005
   137
         {outcome = NONE, used_facts = used_facts,
blanchet@44005
   138
          run_time_in_msecs = run_time_in_msecs, preplay = preplay,
blanchet@44102
   139
          message = message, message_tail = message_tail})
blanchet@44005
   140
      | NONE => result
blanchet@44005
   141
    end
blanchet@44005
   142
blanchet@44005
   143
fun get_minimizing_prover ctxt mode name params minimize_command problem =
blanchet@43862
   144
  get_prover ctxt mode name params minimize_command problem
blanchet@44005
   145
  |> minimize ctxt mode name params problem
blanchet@41510
   146
blanchet@43900
   147
fun launch_prover (params as {debug, verbose, blocking, max_relevant, slicing,
blanchet@43900
   148
                              timeout, expect, ...})
blanchet@43862
   149
        mode minimize_command only
blanchet@42612
   150
        {state, goal, subgoal, subgoal_count, facts, smt_filter} name =
blanchet@41337
   151
  let
blanchet@41337
   152
    val ctxt = Proof.context_of state
blanchet@43719
   153
    val hard_timeout = Time.+ (timeout, timeout)
blanchet@41337
   154
    val birth_time = Time.now ()
blanchet@43719
   155
    val death_time = Time.+ (birth_time, hard_timeout)
blanchet@41337
   156
    val max_relevant =
blanchet@43314
   157
      max_relevant
blanchet@43314
   158
      |> the_default (default_max_relevant_for_prover ctxt slicing name)
blanchet@41337
   159
    val num_facts = length facts |> not only ? Integer.min max_relevant
blanchet@43847
   160
    fun desc () =
blanchet@41337
   161
      prover_description ctxt params name num_facts subgoal subgoal_count goal
blanchet@41337
   162
    val problem =
blanchet@41337
   163
      {state = state, goal = goal, subgoal = subgoal,
blanchet@43509
   164
       subgoal_count = subgoal_count, facts = facts |> take num_facts,
blanchet@42612
   165
       smt_filter = smt_filter}
blanchet@41501
   166
    fun really_go () =
blanchet@41511
   167
      problem
blanchet@43892
   168
      |> get_minimizing_prover ctxt mode name params minimize_command
blanchet@44102
   169
      |> (fn {outcome, preplay, message, message_tail, ...} =>
blanchet@43846
   170
             (if outcome = SOME ATP_Proof.TimedOut then timeoutN
blanchet@43846
   171
              else if is_some outcome then noneN
blanchet@44102
   172
              else someN, fn () => message (preplay ()) ^ message_tail))
blanchet@41337
   173
    fun go () =
blanchet@41337
   174
      let
blanchet@41337
   175
        val (outcome_code, message) =
blanchet@41337
   176
          if debug then
blanchet@41337
   177
            really_go ()
blanchet@41337
   178
          else
blanchet@41337
   179
            (really_go ()
blanchet@43893
   180
             handle ERROR msg => (unknownN, fn () => "Error: " ^ msg ^ "\n")
blanchet@41337
   181
                  | exn =>
blanchet@41337
   182
                    if Exn.is_interrupt exn then
blanchet@41337
   183
                      reraise exn
blanchet@41337
   184
                    else
blanchet@43893
   185
                      (unknownN, fn () => "Internal error:\n" ^
blanchet@43893
   186
                                          ML_Compiler.exn_message exn ^ "\n"))
blanchet@41337
   187
        val _ =
blanchet@41390
   188
          (* The "expect" argument is deliberately ignored if the prover is
blanchet@41390
   189
             missing so that the "Metis_Examples" can be processed on any
blanchet@41390
   190
             machine. *)
blanchet@41390
   191
          if expect = "" orelse outcome_code = expect orelse
blanchet@41390
   192
             not (is_prover_installed ctxt name) then
blanchet@41337
   193
            ()
blanchet@41337
   194
          else if blocking then
blanchet@41337
   195
            error ("Unexpected outcome: " ^ quote outcome_code ^ ".")
blanchet@41337
   196
          else
blanchet@41337
   197
            warning ("Unexpected outcome: " ^ quote outcome_code ^ ".");
blanchet@43846
   198
      in (outcome_code, message) end
blanchet@41337
   199
  in
blanchet@43862
   200
    if mode = Auto_Try then
blanchet@43847
   201
      let val (outcome_code, message) = TimeLimit.timeLimit timeout go () in
blanchet@43847
   202
        (outcome_code,
blanchet@43847
   203
         state
blanchet@43847
   204
         |> outcome_code = someN
blanchet@43847
   205
            ? Proof.goal_message (fn () =>
blanchet@43847
   206
                  [Pretty.str "",
blanchet@43893
   207
                   Pretty.mark Markup.hilite (Pretty.str (message ()))]
blanchet@43847
   208
                  |> Pretty.chunks))
blanchet@41337
   209
      end
blanchet@41337
   210
    else if blocking then
blanchet@43847
   211
      let
blanchet@43847
   212
        val (outcome_code, message) = TimeLimit.timeLimit hard_timeout go ()
blanchet@43847
   213
      in
blanchet@43899
   214
        (if outcome_code = someN orelse mode = Normal then
blanchet@43899
   215
           quote name ^ ": " ^ message ()
blanchet@43899
   216
         else
blanchet@43899
   217
           "")
blanchet@43846
   218
        |> Async_Manager.break_into_chunks
blanchet@43846
   219
        |> List.app Output.urgent_message;
blanchet@43847
   220
        (outcome_code, state)
blanchet@41337
   221
      end
blanchet@41337
   222
    else
blanchet@43847
   223
      (Async_Manager.launch das_tool birth_time death_time (desc ())
blanchet@43893
   224
                            ((fn (outcome_code, message) =>
blanchet@43900
   225
                                 (verbose orelse outcome_code = someN,
blanchet@43900
   226
                                  message ())) o go);
blanchet@43847
   227
       (unknownN, state))
blanchet@41337
   228
  end
blanchet@41337
   229
blanchet@41483
   230
fun class_of_smt_solver ctxt name =
blanchet@41483
   231
  ctxt |> select_smt_solver name
blanchet@41483
   232
       |> SMT_Config.solver_class_of |> SMT_Utils.string_of_class
blanchet@41483
   233
blanchet@43884
   234
(* Makes backtraces more transparent and might well be more efficient as
blanchet@43884
   235
   well. *)
blanchet@41483
   236
fun smart_par_list_map _ [] = []
blanchet@41483
   237
  | smart_par_list_map f [x] = [f x]
blanchet@41483
   238
  | smart_par_list_map f xs = Par_List.map f xs
blanchet@41483
   239
blanchet@41502
   240
fun dest_SMT_Weighted_Fact (SMT_Weighted_Fact p) = p
blanchet@41502
   241
  | dest_SMT_Weighted_Fact _ = raise Fail "dest_SMT_Weighted_Fact"
blanchet@41502
   242
blanchet@43862
   243
val auto_try_max_relevant_divisor = 2 (* FUDGE *)
blanchet@40241
   244
blanchet@43787
   245
fun run_sledgehammer (params as {debug, verbose, blocking, provers,
blanchet@43787
   246
                                 relevance_thresholds, max_relevant, slicing,
blanchet@43787
   247
                                 timeout, ...})
blanchet@43862
   248
        mode i (relevance_override as {only, ...}) minimize_command state =
blanchet@40240
   249
  if null provers then
blanchet@40240
   250
    error "No prover is set."
blanchet@39564
   251
  else case subgoal_count state of
blanchet@43861
   252
    0 => (Output.urgent_message "No subgoal!"; (false, (noneN, state)))
blanchet@39564
   253
  | n =>
blanchet@39564
   254
    let
blanchet@39610
   255
      val _ = Proof.assert_backward state
blanchet@43862
   256
      val print = if mode = Normal then Output.urgent_message else K ()
blanchet@41483
   257
      val state =
blanchet@41483
   258
        state |> Proof.map_context (Config.put SMT_Config.verbose debug)
blanchet@40441
   259
      val ctxt = Proof.context_of state
blanchet@40441
   260
      val {facts = chained_ths, goal, ...} = Proof.goal state
blanchet@43884
   261
      val chained_ths = chained_ths |> normalize_chained_theorems
blanchet@43845
   262
      val (_, hyp_ts, concl_t) = strip_subgoal ctxt goal i
blanchet@44217
   263
      val facts = nearly_all_facts ctxt relevance_override chained_ths hyp_ts
blanchet@44217
   264
                                   concl_t
blanchet@40240
   265
      val _ = () |> not blocking ? kill_provers
blanchet@42591
   266
      val _ = case find_first (not o is_prover_supported ctxt) provers of
blanchet@41189
   267
                SOME name => error ("No such prover: " ^ name ^ ".")
blanchet@41189
   268
              | NONE => ()
blanchet@42644
   269
      val _ = print "Sledgehammering..."
blanchet@43785
   270
      val (smts, (ueq_atps, full_atps)) =
blanchet@43785
   271
        provers |> List.partition (is_smt_prover ctxt)
blanchet@43785
   272
                ||> List.partition (is_unit_equational_atp ctxt)
blanchet@42612
   273
      fun launch_provers state get_facts translate maybe_smt_filter provers =
blanchet@41502
   274
        let
blanchet@41502
   275
          val facts = get_facts ()
blanchet@41502
   276
          val num_facts = length facts
blanchet@41502
   277
          val facts = facts ~~ (0 upto num_facts - 1)
blanchet@41502
   278
                      |> map (translate num_facts)
blanchet@41502
   279
          val problem =
blanchet@41502
   280
            {state = state, goal = goal, subgoal = i, subgoal_count = n,
blanchet@41502
   281
             facts = facts,
blanchet@42612
   282
             smt_filter = maybe_smt_filter
blanchet@41502
   283
                  (fn () => map_filter (try dest_SMT_Weighted_Fact) facts) i}
blanchet@43862
   284
          val launch = launch_prover params mode minimize_command only
blanchet@41502
   285
        in
blanchet@43862
   286
          if mode = Auto_Try orelse mode = Try then
blanchet@43861
   287
            (unknownN, state)
blanchet@43862
   288
            |> fold (fn prover => fn accum as (outcome_code, _) =>
blanchet@43861
   289
                        if outcome_code = someN then accum
blanchet@43861
   290
                        else launch problem prover)
blanchet@43861
   291
                    provers
blanchet@41502
   292
          else
blanchet@41502
   293
            provers
blanchet@43861
   294
            |> (if blocking then smart_par_list_map else map)
blanchet@43861
   295
                   (launch problem #> fst)
blanchet@43861
   296
            |> max_outcome_code |> rpair state
blanchet@41502
   297
        end
blanchet@43793
   298
      fun get_facts label is_appropriate_prop relevance_fudge provers =
blanchet@41483
   299
        let
blanchet@41483
   300
          val max_max_relevant =
blanchet@41483
   301
            case max_relevant of
blanchet@41483
   302
              SOME n => n
blanchet@41483
   303
            | NONE =>
blanchet@43314
   304
              0 |> fold (Integer.max
blanchet@43314
   305
                         o default_max_relevant_for_prover ctxt slicing)
blanchet@41483
   306
                        provers
blanchet@43862
   307
                |> mode = Auto_Try
blanchet@43862
   308
                   ? (fn n => n div auto_try_max_relevant_divisor)
blanchet@41483
   309
          val is_built_in_const =
blanchet@41483
   310
            is_built_in_const_for_prover ctxt (hd provers)
blanchet@41483
   311
        in
blanchet@44217
   312
          facts
blanchet@44217
   313
          |> (case is_appropriate_prop of
blanchet@44217
   314
                SOME is_app => filter (is_app o prop_of o snd)
blanchet@44217
   315
              | NONE => I)
blanchet@44217
   316
          |> relevant_facts ctxt relevance_thresholds max_max_relevant
blanchet@44217
   317
                            is_built_in_const relevance_fudge relevance_override
blanchet@44217
   318
                            chained_ths hyp_ts concl_t
blanchet@41483
   319
          |> tap (fn facts =>
blanchet@41483
   320
                     if debug then
blanchet@41483
   321
                       label ^ plural_s (length provers) ^ ": " ^
blanchet@41483
   322
                       (if null facts then
blanchet@41483
   323
                          "Found no relevant facts."
blanchet@41483
   324
                        else
blanchet@41483
   325
                          "Including (up to) " ^ string_of_int (length facts) ^
blanchet@41483
   326
                          " relevant fact" ^ plural_s (length facts) ^ ":\n" ^
blanchet@41483
   327
                          (facts |> map (fst o fst) |> space_implode " ") ^ ".")
blanchet@42644
   328
                       |> print
blanchet@41483
   329
                     else
blanchet@41483
   330
                       ())
blanchet@41483
   331
        end
blanchet@43793
   332
      fun launch_atps label is_appropriate_prop atps accum =
blanchet@43787
   333
        if null atps then
blanchet@41502
   334
          accum
blanchet@44217
   335
        else if is_some is_appropriate_prop andalso
blanchet@44217
   336
                not (the is_appropriate_prop concl_t) then
blanchet@43787
   337
          (if verbose orelse length atps = length provers then
blanchet@43787
   338
             "Goal outside the scope of " ^
blanchet@43787
   339
             space_implode " " (serial_commas "and" (map quote atps)) ^ "."
blanchet@43787
   340
             |> Output.urgent_message
blanchet@43787
   341
           else
blanchet@43787
   342
             ();
blanchet@43787
   343
           accum)
blanchet@41502
   344
        else
blanchet@43785
   345
          launch_provers state
blanchet@43793
   346
              (get_facts label is_appropriate_prop atp_relevance_fudge o K atps)
blanchet@43785
   347
              (K (Untranslated_Fact o fst)) (K (K NONE)) atps
blanchet@42617
   348
      fun launch_smts accum =
blanchet@42617
   349
        if null smts then
blanchet@41483
   350
          accum
blanchet@41483
   351
        else
blanchet@41483
   352
          let
blanchet@44217
   353
            val facts = get_facts "SMT solver" NONE smt_relevance_fudge smts
blanchet@43517
   354
            val weight = SMT_Weighted_Fact oo weight_smt_fact ctxt
blanchet@42612
   355
            fun smt_filter facts =
blanchet@42659
   356
              (if debug then curry (op o) SOME
blanchet@42659
   357
               else TimeLimit.timeLimit timeout o try)
boehmes@41680
   358
                  (SMT_Solver.smt_filter_preprocess state (facts ()))
blanchet@41483
   359
          in
blanchet@41483
   360
            smts |> map (`(class_of_smt_solver ctxt))
blanchet@41483
   361
                 |> AList.group (op =)
blanchet@43861
   362
                 |> map (snd #> launch_provers state (K facts) weight smt_filter
blanchet@43861
   363
                             #> fst)
blanchet@43861
   364
                 |> max_outcome_code |> rpair state
blanchet@41483
   365
          end
blanchet@44217
   366
      val launch_full_atps = launch_atps "ATP" NONE full_atps
blanchet@43785
   367
      val launch_ueq_atps =
blanchet@44217
   368
        launch_atps "Unit equational provers" (SOME is_unit_equality) ueq_atps
blanchet@41510
   369
      fun launch_atps_and_smt_solvers () =
blanchet@43884
   370
        [launch_full_atps, launch_smts, launch_ueq_atps]
blanchet@43862
   371
        |> smart_par_list_map (fn f => ignore (f (unknownN, state)))
blanchet@42644
   372
        handle ERROR msg => (print ("Error: " ^ msg); error msg)
blanchet@43862
   373
      fun maybe f (accum as (outcome_code, _)) =
blanchet@43862
   374
        accum |> (mode = Normal orelse outcome_code <> someN) ? f
blanchet@40241
   375
    in
blanchet@43861
   376
      (unknownN, state)
blanchet@43785
   377
      |> (if blocking then
blanchet@43862
   378
            launch_full_atps
blanchet@43862
   379
            #> mode <> Auto_Try ? (maybe launch_ueq_atps #> maybe launch_smts)
blanchet@43785
   380
          else
blanchet@43785
   381
            (fn p => Future.fork (tap launch_atps_and_smt_solvers) |> K p))
blanchet@42644
   382
      handle TimeLimit.TimeOut =>
blanchet@43861
   383
             (print "Sledgehammer ran out of time."; (unknownN, state))
blanchet@40241
   384
    end
blanchet@43861
   385
    |> `(fn (outcome_code, _) => outcome_code = someN)
blanchet@38290
   386
wenzelm@28582
   387
end;