src/HOL/TPTP/mash_eval.ML
changeset 50587 bd6582be1562
parent 50563 3a4785d64ecb
child 50589 42f3630a6a0f
equal deleted inserted replaced
50586:e31ee2076db1 50587:bd6582be1562
    45     val sugg_path = sugg_file_name |> Path.explode
    45     val sugg_path = sugg_file_name |> Path.explode
    46     val lines = sugg_path |> File.read_lines
    46     val lines = sugg_path |> File.read_lines
    47     val css = clasimpset_rule_table_of ctxt
    47     val css = clasimpset_rule_table_of ctxt
    48     val facts = all_facts ctxt true false Symtab.empty [] [] css
    48     val facts = all_facts ctxt true false Symtab.empty [] [] css
    49     val all_names = build_all_names nickname_of facts
    49     val all_names = build_all_names nickname_of facts
    50     val mepo_ok = Unsynchronized.ref 0
    50     val mepo_ok = Synchronized.var "mepo_ok" 0
    51     val mash_ok = Unsynchronized.ref 0
    51     val mash_ok = Synchronized.var "mash_ok" 0
    52     val mesh_ok = Unsynchronized.ref 0
    52     val mesh_ok = Synchronized.var "mesh_ok" 0
    53     val isar_ok = Unsynchronized.ref 0
    53     val isar_ok = Synchronized.var "isar_ok" 0
    54     fun with_index facts s = (find_index (curry (op =) s) facts + 1, s)
    54     fun with_index facts s = (find_index (curry (op =) s) facts + 1, s)
    55     fun index_string (j, s) = s ^ "@" ^ string_of_int j
    55     fun index_string (j, s) = s ^ "@" ^ string_of_int j
    56     fun str_of_res label facts ({outcome, run_time, used_facts, ...}
    56     fun str_of_res label facts ({outcome, run_time, used_facts, ...}
    57                                 : prover_result) =
    57                                 : prover_result) =
    58       let val facts = facts |> map (fn ((name, _), _) => name ()) in
    58       let val facts = facts |> map (fn ((name, _), _) => name ()) in
   118                 |> maybe_instantiate_inducts ctxt hyp_ts concl_t
   118                 |> maybe_instantiate_inducts ctxt hyp_ts concl_t
   119                 |> take (the max_facts)
   119                 |> take (the max_facts)
   120               val ctxt = ctxt |> set_file_name heading prob_dir_name
   120               val ctxt = ctxt |> set_file_name heading prob_dir_name
   121               val res as {outcome, ...} =
   121               val res as {outcome, ...} =
   122                 run_prover_for_mash ctxt params prover facts goal
   122                 run_prover_for_mash ctxt params prover facts goal
   123               val _ = if is_none outcome then ok := !ok + 1 else ()
   123               val _ =
       
   124                 if is_none outcome then Synchronized.change ok (Integer.add 1)
       
   125                 else ()
   124             in str_of_res heading facts res end
   126             in str_of_res heading facts res end
   125           val [mepo_s, mash_s, mesh_s, isar_s] =
   127           val [mepo_s, mash_s, mesh_s, isar_s] =
   126             [fn () => prove mepo_ok MePoN fst mepo_facts,
   128             [fn () => prove mepo_ok MePoN fst mepo_facts,
   127              fn () => prove mash_ok MaShN fst mash_facts,
   129              fn () => prove mash_ok MaShN fst mash_facts,
   128              fn () => prove mesh_ok MeShN I mesh_facts,
   130              fn () => prove mesh_ok MeShN I mesh_facts,
   129              fn () => prove isar_ok IsarN fst isar_facts]
   131              fn () => prove isar_ok IsarN fst isar_facts]
   130             |> (* Par_List. *) map (fn f => f ())
   132             |> (* Par_List. *) map (fn f => f ())
   131         in
   133         in
   132           ["Goal " ^ string_of_int j ^ ": " ^ name, mepo_s, mash_s, mesh_s,
   134           ["Goal " ^ string_of_int j ^ ": " ^ name, mepo_s, mash_s, mesh_s,
   133            isar_s]
   135            isar_s]
   134           |> cat_lines |> print
   136           |> cat_lines |> print;
       
   137           1
   135         end
   138         end
   136       else
   139       else
   137         ()
   140         0
   138     fun total_of heading ok n =
   141     fun total_of heading ok n =
   139       "  " ^ heading ^ ": " ^ string_of_int (!ok) ^ " (" ^
   142       let val ok_val = Synchronized.value ok in
   140       Real.fmt (StringCvt.FIX (SOME 1))
   143         "  " ^ heading ^ ": " ^ string_of_int ok_val ^ " (" ^
   141                (100.0 * Real.fromInt (!ok) / Real.fromInt n) ^ "%)"
   144         Real.fmt (StringCvt.FIX (SOME 1))
       
   145                  (100.0 * Real.fromInt ok_val / Real.fromInt n) ^ "%)"
       
   146       end
   142     val inst_inducts = Config.get ctxt instantiate_inducts
   147     val inst_inducts = Config.get ctxt instantiate_inducts
   143     val options =
   148     val options =
   144       [prover, string_of_int (the max_facts) ^ " facts",
   149       [prover, string_of_int (the max_facts) ^ " facts",
   145        "slice" |> not slice ? prefix "dont_", the_default "smart" type_enc,
   150        "slice" |> not slice ? prefix "dont_", the_default "smart" type_enc,
   146        the_default "smart" lam_trans,
   151        the_default "smart" lam_trans,
   147        ATP_Util.string_from_time (timeout |> the_default one_year),
   152        ATP_Util.string_from_time (timeout |> the_default one_year),
   148        "instantiate_inducts" |> not inst_inducts ? prefix "dont_"]
   153        "instantiate_inducts" |> not inst_inducts ? prefix "dont_"]
   149     val n = length lines
   154     val _ = print " * * *";
       
   155     val _ = print ("Options: " ^ commas options);
       
   156     val n = Integer.sum (Par_List.map solve_goal (tag_list 1 lines))
   150   in
   157   in
   151     print " * * *";
       
   152     print ("Options: " ^ commas options);
       
   153     Par_List.map solve_goal (tag_list 1 lines);
       
   154     ["Successes (of " ^ string_of_int n ^ " goals)",
   158     ["Successes (of " ^ string_of_int n ^ " goals)",
   155      total_of MePoN mepo_ok n,
   159      total_of MePoN mepo_ok n,
   156      total_of MaShN mash_ok n,
   160      total_of MaShN mash_ok n,
   157      total_of MeShN mesh_ok n,
   161      total_of MeShN mesh_ok n,
   158      total_of IsarN isar_ok n]
   162      total_of IsarN isar_ok n]