equal
deleted
inserted
replaced
9 signature SLEDGEHAMMER_PROVERS = |
9 signature SLEDGEHAMMER_PROVERS = |
10 sig |
10 sig |
11 type failure = ATP_Proof.failure |
11 type failure = ATP_Proof.failure |
12 type locality = ATP_Translate.locality |
12 type locality = ATP_Translate.locality |
13 type relevance_fudge = Sledgehammer_Filter.relevance_fudge |
13 type relevance_fudge = Sledgehammer_Filter.relevance_fudge |
14 type translated_formula = ATP_Translate.translated_formula |
|
15 type type_sys = ATP_Translate.type_sys |
14 type type_sys = ATP_Translate.type_sys |
16 type play = ATP_Reconstruct.play |
15 type play = ATP_Reconstruct.play |
17 type minimize_command = ATP_Reconstruct.minimize_command |
16 type minimize_command = ATP_Reconstruct.minimize_command |
18 |
17 |
19 datatype mode = Auto_Try | Try | Normal | Minimize |
18 datatype mode = Auto_Try | Try | Normal | Minimize |
386 (info, (smt_fact_weight ctxt j num_facts, th |> Thm.transfer thy)) |
385 (info, (smt_fact_weight ctxt j num_facts, th |> Thm.transfer thy)) |
387 end |
386 end |
388 |
387 |
389 fun untranslated_fact (Untranslated_Fact p) = p |
388 fun untranslated_fact (Untranslated_Fact p) = p |
390 | untranslated_fact (SMT_Weighted_Fact (info, (_, th))) = (info, th) |
389 | untranslated_fact (SMT_Weighted_Fact (info, (_, th))) = (info, th) |
391 fun atp_translated_fact ctxt format type_sys fact = |
|
392 translate_atp_fact ctxt format type_sys false (untranslated_fact fact) |
|
393 fun smt_weighted_fact _ _ (SMT_Weighted_Fact p, _) = p |
390 fun smt_weighted_fact _ _ (SMT_Weighted_Fact p, _) = p |
394 | smt_weighted_fact ctxt num_facts (fact, j) = |
391 | smt_weighted_fact ctxt num_facts (fact, j) = |
395 (untranslated_fact fact, j) |> weight_smt_fact ctxt num_facts |
392 (untranslated_fact fact, j) |> weight_smt_fact ctxt num_facts |
396 |
393 |
397 fun overlord_file_location_for_prover prover = |
394 fun overlord_file_location_for_prover prover = |
591 val actual_slices = |
588 val actual_slices = |
592 get_slices (length facts) slicing (best_slices ctxt) |
589 get_slices (length facts) slicing (best_slices ctxt) |
593 val num_actual_slices = length actual_slices |
590 val num_actual_slices = length actual_slices |
594 fun monomorphize_facts facts = |
591 fun monomorphize_facts facts = |
595 let |
592 let |
596 val facts = facts |> map untranslated_fact |
|
597 (* pseudo-theorem involving the same constants as the subgoal *) |
593 (* pseudo-theorem involving the same constants as the subgoal *) |
598 val subgoal_th = |
594 val subgoal_th = |
599 Logic.list_implies (hyp_ts, concl_t) |
595 Logic.list_implies (hyp_ts, concl_t) |
600 |> Skip_Proof.make_thm thy |
596 |> Skip_Proof.make_thm thy |
601 val indexed_facts = |
597 val indexed_facts = |
605 ctxt |> repair_smt_monomorph_context debug max_mono_iters |
601 ctxt |> repair_smt_monomorph_context debug max_mono_iters |
606 max_mono_instances |
602 max_mono_instances |
607 |> SMT_Monomorph.monomorph indexed_facts |
603 |> SMT_Monomorph.monomorph indexed_facts |
608 |> fst |> sort (int_ord o pairself fst) |
604 |> fst |> sort (int_ord o pairself fst) |
609 |> filter_out (curry (op =) ~1 o fst) |
605 |> filter_out (curry (op =) ~1 o fst) |
610 |> map (Untranslated_Fact o apfst (fst o nth facts)) |
606 |> map (apfst (fst o nth facts)) |
611 end |
607 end |
612 fun run_slice blacklist (slice, (time_frac, (complete, |
608 fun run_slice blacklist (slice, (time_frac, (complete, |
613 (best_max_relevant, best_type_systems)))) |
609 (best_max_relevant, best_type_systems)))) |
614 time_left = |
610 time_left = |
615 let |
611 let |
618 ? Integer.min best_max_relevant |
614 ? Integer.min best_max_relevant |
619 val (format, type_sys) = |
615 val (format, type_sys) = |
620 choose_format_and_type_sys best_type_systems formats type_sys |
616 choose_format_and_type_sys best_type_systems formats type_sys |
621 val fairly_sound = is_type_sys_fairly_sound type_sys |
617 val fairly_sound = is_type_sys_fairly_sound type_sys |
622 val facts = |
618 val facts = |
623 facts |> not fairly_sound |
619 facts |> map untranslated_fact |
624 ? filter_out (is_dangerous_prop ctxt o prop_of o snd |
620 |> not fairly_sound |
625 o untranslated_fact) |
621 ? filter_out (is_dangerous_prop ctxt o prop_of o snd) |
626 |> take num_facts |
622 |> take num_facts |
627 |> not (null blacklist) |
623 |> not (null blacklist) |
628 ? filter_out (member (op =) blacklist o fst |
624 ? filter_out (member (op =) blacklist o fst) |
629 o untranslated_fact) |
|
630 |> polymorphism_of_type_sys type_sys <> Polymorphic |
625 |> polymorphism_of_type_sys type_sys <> Polymorphic |
631 ? monomorphize_facts |
626 ? monomorphize_facts |
632 |> map (atp_translated_fact ctxt format type_sys) |
|
633 val real_ms = Real.fromInt o Time.toMilliseconds |
627 val real_ms = Real.fromInt o Time.toMilliseconds |
634 val slice_timeout = |
628 val slice_timeout = |
635 ((real_ms time_left |
629 ((real_ms time_left |
636 |> (if slice < num_actual_slices - 1 then |
630 |> (if slice < num_actual_slices - 1 then |
637 curry Real.min (time_frac * real_ms timeout) |
631 curry Real.min (time_frac * real_ms timeout) |