src/HOL/TPTP/TPTP_Proof_Reconstruction_Test.thy
changeset 60925 90659d0215bd
parent 60649 e007aa6a8aa2
child 60926 0ccb5fb83c24
equal deleted inserted replaced
60924:610794dff23c 60925:90659d0215bd
    86         [Pretty.str (n ^ " "),
    86         [Pretty.str (n ^ " "),
    87          Syntax.pretty_term ctxt (#fmla data),
    87          Syntax.pretty_term ctxt (#fmla data),
    88          Pretty.str (
    88          Pretty.str (
    89           if is_none (#source_inf_opt data) then ""
    89           if is_none (#source_inf_opt data) then ""
    90           else ("\n\tannotation: " ^
    90           else ("\n\tannotation: " ^
    91            PolyML.makestring (the (#source_inf_opt data : TPTP_Proof.source_info option))))])
    91            @{make_string} (the (#source_inf_opt data : TPTP_Proof.source_info option))))])
    92     ) (rev fms);
    92     ) (rev fms);
    93 
    93 
    94 (*FIXME hack for testing*)
    94 (*FIXME hack for testing*)
    95 fun test_fmla thy =
    95 fun test_fmla thy =
    96   TPTP_Reconstruct.get_fmlas_of_prob thy (hd prob_names);
    96   TPTP_Reconstruct.get_fmlas_of_prob thy (hd prob_names);
   130   end
   130   end
   131 
   131 
   132 val step_range_tester_tracing =
   132 val step_range_tester_tracing =
   133   step_range_tester
   133   step_range_tester
   134    (fn x => tracing ("@step " ^ Int.toString x))
   134    (fn x => tracing ("@step " ^ Int.toString x))
   135    (fn e => tracing ("!!" ^ PolyML.makestring e))
   135    (fn e => tracing ("!!" ^ @{make_string} e))
   136 *}
   136 *}
   137 
   137 
   138 ML {*
   138 ML {*
   139 (*try to reconstruct each inference step*)
   139 (*try to reconstruct each inference step*)
   140 if test_all @{context} orelse prob_names = []
   140 if test_all @{context} orelse prob_names = []
   256             EVERY [tac1, tac2]
   256             EVERY [tac1, tac2]
   257             THEN interleave_tacs tacs1 tacs2
   257             THEN interleave_tacs tacs1 tacs2
   258       val thms_to_traceprint =
   258       val thms_to_traceprint =
   259         map (fn thm => fn st =>
   259         map (fn thm => fn st =>
   260               (*FIXME uses makestring*)
   260               (*FIXME uses makestring*)
   261               print_tac ctxt (PolyML.makestring thm) st)
   261               print_tac ctxt (@{make_string} thm) st)
   262 
   262 
   263     in
   263     in
   264       if verbose then
   264       if verbose then
   265         ListPair.unzip thm_tacs
   265         ListPair.unzip thm_tacs
   266         |> apfst (fn thms => enumerate 1 thms)
   266         |> apfst (fn thms => enumerate 1 thms)
   343 else
   343 else
   344   the_tactics
   344   the_tactics
   345   |> hd
   345   |> hd
   346   |> map #1
   346   |> map #1
   347   |> TPTP_Reconstruct_Library.enumerate 0
   347   |> TPTP_Reconstruct_Library.enumerate 0
   348   |> List.app (PolyML.makestring #> writeln)
   348   |> List.app (@{make_string} #> writeln)
   349   *}
   349   *}
   350 
   350 
   351 ML {*
   351 ML {*
   352 fun leo2_tac_wrap ctxt prob_name step i st =
   352 fun leo2_tac_wrap ctxt prob_name step i st =
   353   rtac (interpret_leo2_inference ctxt prob_name step) i st
   353   rtac (interpret_leo2_inference ctxt prob_name step) i st
   605       if is_some thy' then
   605       if is_some thy' then
   606         SOME (TPTP_Reconstruct.naive_reconstruct_tacs (* metis_based_reconstruction_tac *)
   606         SOME (TPTP_Reconstruct.naive_reconstruct_tacs (* metis_based_reconstruction_tac *)
   607 interpret_leo2_inference (* auto_based_reconstruction_tac *) (* oracle_based_reconstruction_tac *) prob_name (the ctxt'))
   607 interpret_leo2_inference (* auto_based_reconstruction_tac *) (* oracle_based_reconstruction_tac *) prob_name (the ctxt'))
   608       else NONE
   608       else NONE
   609 
   609 
   610 (* val _ = tracing ("tt=" ^ PolyML.makestring the_tactics) *)
   610 (* val _ = tracing ("tt=" ^ @{make_string} the_tactics) *)
   611 
   611 
   612     val skeleton =
   612     val skeleton =
   613       if is_some thy' then
   613       if is_some thy' then
   614         SOME (TPTP_Reconstruct.make_skeleton (the ctxt')
   614         SOME (TPTP_Reconstruct.make_skeleton (the ctxt')
   615               (TPTP_Reconstruct.get_pannot_of_prob (the thy') prob_name))
   615               (TPTP_Reconstruct.get_pannot_of_prob (the thy') prob_name))
   642       val timer = Timer.startRealTimer ()
   642       val timer = Timer.startRealTimer ()
   643     in
   643     in
   644       TimeLimit.timeLimit (Time.fromSeconds (if timeout = 0 then 60 else timeout))
   644       TimeLimit.timeLimit (Time.fromSeconds (if timeout = 0 then 60 else timeout))
   645        (test_partial_reconstruction thy
   645        (test_partial_reconstruction thy
   646         #> light_output ? erase_inference_fmlas
   646         #> light_output ? erase_inference_fmlas
   647         #> PolyML.makestring (* FIXME *)
   647         #> @{make_string} (* FIXME *)
   648         #> (fn s => report (Proof_Context.init_global thy) (PolyML.makestring file ^ " === " ^ s ^
   648         #> (fn s => report (Proof_Context.init_global thy) (@{make_string} file ^ " === " ^ s ^
   649              " t=" ^ (Timer.checkRealTimer timer |> Time.toMilliseconds |> PolyML.makestring))))
   649              " t=" ^ (Timer.checkRealTimer timer |> Time.toMilliseconds |> @{make_string}))))
   650        file
   650        file
   651     end
   651     end
   652 *}
   652 *}
   653 
   653 
   654 ML {*
   654 ML {*
   673        (fn prob_name =>
   673        (fn prob_name =>
   674         (can
   674         (can
   675           (TPTP_Reconstruct.reconstruct ctxt (fn prob_name =>
   675           (TPTP_Reconstruct.reconstruct ctxt (fn prob_name =>
   676             TPTP_Reconstruct.naive_reconstruct_tac ctxt interpret_leo2_inference prob_name (* oracle_based_reconstruction_tac *))) prob_name )
   676             TPTP_Reconstruct.naive_reconstruct_tac ctxt interpret_leo2_inference prob_name (* oracle_based_reconstruction_tac *))) prob_name )
   677        |> (fn s => report ctxt (Path.print file ^ " === " ^ Bool.toString s ^
   677        |> (fn s => report ctxt (Path.print file ^ " === " ^ Bool.toString s ^
   678              " t=" ^ (Timer.checkRealTimer timer |> Time.toMilliseconds |> PolyML.makestring))))
   678              " t=" ^ (Timer.checkRealTimer timer |> Time.toMilliseconds |> @{make_string}))))
   679        prob_name
   679        prob_name
   680     end
   680     end
   681 *}
   681 *}
   682 
   682 
   683 ML {*
   683 ML {*