src/HOL/Tools/Sledgehammer/sledgehammer_prover_atp.ML
changeset 55249 0ff946f0b764
parent 55248 235205726737
child 55257 abfd7b90bba2
equal deleted inserted replaced
55248:235205726737 55249:0ff946f0b764
   172       | NONE => error ("The environment variable " ^ quote (List.last (fst exec)) ^ " is not set."))
   172       | NONE => error ("The environment variable " ^ quote (List.last (fst exec)) ^ " is not set."))
   173 
   173 
   174     fun split_time s =
   174     fun split_time s =
   175       let
   175       let
   176         val split = String.tokens (fn c => str c = "\n")
   176         val split = String.tokens (fn c => str c = "\n")
   177         val (output, t) =
   177         val (output, t) = s |> split |> (try split_last #> the_default ([], "0")) |>> cat_lines
   178           s |> split |> (try split_last #> the_default ([], "0"))
   178         val num = Scan.many1 Symbol.is_ascii_digit >> (fst o read_int)
   179             |>> cat_lines
       
   180         fun as_num f = f >> (fst o read_int)
       
   181         val num = as_num (Scan.many1 Symbol.is_ascii_digit)
       
   182         val digit = Scan.one Symbol.is_ascii_digit
   179         val digit = Scan.one Symbol.is_ascii_digit
   183         val num3 = as_num (digit ::: digit ::: (digit >> single))
   180         val num3 = digit ::: digit ::: (digit >> single) >> (fst o read_int)
   184         val time = num --| Scan.$$ "." -- num3 >> (fn (a, b) => a * 1000 + b)
   181         val time = num --| Scan.$$ "." -- num3 >> (fn (a, b) => a * 1000 + b)
   185         val as_time =
   182         val as_time = raw_explode #> Scan.read Symbol.stopper time #> the_default 0
   186           raw_explode #> Scan.read Symbol.stopper time #> the_default 0
       
   187       in (output, as_time t |> Time.fromMilliseconds) end
   183       in (output, as_time t |> Time.fromMilliseconds) end
   188 
   184 
   189     fun run () =
   185     fun run () =
   190       let
   186       let
   191         (* If slicing is disabled, we expand the last slice to fill the entire time available. *)
   187         (* If slicing is disabled, we expand the last slice to fill the entire time available. *)
   218             |> maps (fn (name, rths) => map (pair name o zero_var_indexes o snd) rths)
   214             |> maps (fn (name, rths) => map (pair name o zero_var_indexes o snd) rths)
   219           end
   215           end
   220 
   216 
   221         fun run_slice time_left (cache_key, cache_value) (slice, (time_frac,
   217         fun run_slice time_left (cache_key, cache_value) (slice, (time_frac,
   222             (key as ((best_max_facts, best_fact_filter), format, best_type_enc, best_lam_trans,
   218             (key as ((best_max_facts, best_fact_filter), format, best_type_enc, best_lam_trans,
   223                      best_uncurried_aliases),
   219                best_uncurried_aliases),
   224              extra))) =
   220              extra))) =
   225           let
   221           let
   226             val effective_fact_filter = fact_filter |> the_default best_fact_filter
   222             val effective_fact_filter = fact_filter |> the_default best_fact_filter
   227             val facts = get_facts_of_filter effective_fact_filter factss
   223             val facts = get_facts_of_filter effective_fact_filter factss
   228             val num_facts =
   224             val num_facts =