src/HOL/TPTP/TPTP_Proof_Reconstruction_Test.thy
author wenzelm
Tue, 22 Oct 2019 20:55:13 +0200
changeset 70923 98d9b78b7f47
parent 69366 b6dacf6eabe3
permissions -rw-r--r--
clarified axiom_table: uniform space (e.g. like consts), e.g. relevant for export of HOL-ex.Join_Theory;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
59720
f893472fff31 proper headers;
wenzelm
parents: 58412
diff changeset
     1
(*  Title:      HOL/TPTP/TPTP_Proof_Reconstruction_Test.thy
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
     2
    Author:     Nik Sultana, Cambridge University Computer Laboratory
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
     3
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
     4
Various tests for the proof reconstruction module.
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
     5
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
     6
NOTE
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
     7
  - looks for THF proofs in the path indicated by $THF_PROOFS
55597
25d7b485df81 added a function that carries out all the reconstruction steps, for improved usability;
sultana
parents: 55596
diff changeset
     8
  - these proofs are generated using LEO-II with the following
25d7b485df81 added a function that carries out all the reconstruction steps, for improved usability;
sultana
parents: 55596
diff changeset
     9
    configuration choices: -po 1 -nux -nuc --expand_extuni
25d7b485df81 added a function that carries out all the reconstruction steps, for improved usability;
sultana
parents: 55596
diff changeset
    10
    You can simply filter LEO-II's output using the filter_proof
25d7b485df81 added a function that carries out all the reconstruction steps, for improved usability;
sultana
parents: 55596
diff changeset
    11
    script which is distributed with LEO-II.
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    12
*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    13
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    14
theory TPTP_Proof_Reconstruction_Test
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    15
imports TPTP_Test TPTP_Proof_Reconstruction
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    16
begin
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    17
55597
25d7b485df81 added a function that carries out all the reconstruction steps, for improved usability;
sultana
parents: 55596
diff changeset
    18
section "Main function"
25d7b485df81 added a function that carries out all the reconstruction steps, for improved usability;
sultana
parents: 55596
diff changeset
    19
text "This function wraps all the reconstruction-related functions. Simply
25d7b485df81 added a function that carries out all the reconstruction steps, for improved usability;
sultana
parents: 55596
diff changeset
    20
 point it at a THF proof produced by LEO-II (using the configuration described
25d7b485df81 added a function that carries out all the reconstruction steps, for improved usability;
sultana
parents: 55596
diff changeset
    21
 above), and it will try to reconstruct it into an Isabelle/HOL theorem.
25d7b485df81 added a function that carries out all the reconstruction steps, for improved usability;
sultana
parents: 55596
diff changeset
    22
 It also returns the theory (into which the axioms and definitions used in the
25d7b485df81 added a function that carries out all the reconstruction steps, for improved usability;
sultana
parents: 55596
diff changeset
    23
 proof have been imported), but note that you can get the theory value from
25d7b485df81 added a function that carries out all the reconstruction steps, for improved usability;
sultana
parents: 55596
diff changeset
    24
 the theorem value."
25d7b485df81 added a function that carries out all the reconstruction steps, for improved usability;
sultana
parents: 55596
diff changeset
    25
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
    26
ML \<open>
55597
25d7b485df81 added a function that carries out all the reconstruction steps, for improved usability;
sultana
parents: 55596
diff changeset
    27
  reconstruct_leo2 (Path.explode "$THF_PROOFS/NUM667^1.p.out") @{theory}
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
    28
\<close>
55597
25d7b485df81 added a function that carries out all the reconstruction steps, for improved usability;
sultana
parents: 55596
diff changeset
    29
25d7b485df81 added a function that carries out all the reconstruction steps, for improved usability;
sultana
parents: 55596
diff changeset
    30
section "Prep for testing the component functions"
25d7b485df81 added a function that carries out all the reconstruction steps, for improved usability;
sultana
parents: 55596
diff changeset
    31
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    32
declare [[
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    33
  tptp_trace_reconstruction = false,
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    34
  tptp_test_all = false,
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    35
  (* tptp_test_all = true, *)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    36
  tptp_test_timeout = 30,
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    37
  (* tptp_max_term_size = 200 *)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    38
  tptp_max_term_size = 0
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    39
]]
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    40
60926
0ccb5fb83c24 more standard options;
wenzelm
parents: 60925
diff changeset
    41
declare [[ML_exception_trace, ML_print_depth = 200]]
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    42
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    43
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    44
section "Importing proofs"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    45
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
    46
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    47
val probs =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    48
  (* "$THF_PROOFS/SYN991^1.p.out" *) (*lacks conjecture*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    49
  (* "$THF_PROOFS/SYO040^2.p.out" *)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    50
  (* "$THF_PROOFS/NUM640^1.p.out" *)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    51
  (* "$THF_PROOFS/SEU553^2.p.out" *)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    52
  (* "$THF_PROOFS/NUM665^1.p.out" *)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    53
  (* "$THF_PROOFS/SEV161^5.p.out" *)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    54
  (* "$THF_PROOFS/SET014^4.p.out" *)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    55
  "$THF_PROOFS/NUM667^1.p.out"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    56
  |> Path.explode
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    57
  |> single
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    58
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    59
val prob_names =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    60
  probs
69366
b6dacf6eabe3 clarified signature;
wenzelm
parents: 67399
diff changeset
    61
  |> map (Path.file_name #> TPTP_Problem_Name.Nonstandard)
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
    62
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    63
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
    64
setup \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    65
  if test_all @{context} then I
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    66
  else
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    67
    fold
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    68
     (fn path =>
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    69
       TPTP_Reconstruct.import_thm true [Path.dir path, Path.explode "$THF_PROOFS"] path leo2_on_load)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    70
     probs
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
    71
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    72
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    73
text "Display nicely."
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
    74
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    75
fun display_nicely ctxt (fms : TPTP_Reconstruct.formula_meaning list) =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    76
  List.app (fn ((n, data) : TPTP_Reconstruct.formula_meaning) =>
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    77
    Pretty.writeln
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    78
      (Pretty.block
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    79
        [Pretty.str (n ^ " "),
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    80
         Syntax.pretty_term ctxt (#fmla data),
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    81
         Pretty.str (
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    82
          if is_none (#source_inf_opt data) then ""
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    83
          else ("\n\tannotation: " ^
60925
90659d0215bd prefer official @{make_string};
wenzelm
parents: 60649
diff changeset
    84
           @{make_string} (the (#source_inf_opt data : TPTP_Proof.source_info option))))])
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    85
    ) (rev fms);
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    86
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    87
(*FIXME hack for testing*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    88
fun test_fmla thy =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    89
  TPTP_Reconstruct.get_fmlas_of_prob thy (hd prob_names);
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    90
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    91
fun test_pannot thy =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    92
  TPTP_Reconstruct.get_pannot_of_prob thy (hd prob_names);
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    93
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    94
if test_all @{context} orelse prob_names = [] then ()
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    95
else
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    96
  display_nicely @{context}
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    97
  (#meta (test_pannot @{theory}))
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    98
(* To look at the original proof (i.e., before the proof transformations applied
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
    99
   when the proof is loaded) replace previous line with:
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   100
   (test_fmla @{theory}
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   101
    |> map TPTP_Reconstruct.structure_fmla_meaning)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   102
*)
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   103
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   104
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   105
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   106
fun step_range_tester f_x f_exn ctxt prob_name from until =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   107
  let
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   108
    val max =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   109
      case until of
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   110
          SOME x => x
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   111
        | NONE =>
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   112
            if is_some Int.maxInt then the Int.maxInt else 999999
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   113
    fun test_step x =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   114
      if x > max then ()
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   115
      else
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   116
        (f_x x;
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   117
         (interpret_leo2_inference ctxt prob_name (Int.toString x); ())
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   118
         handle e => f_exn e; (*FIXME naive. should let Interrupt through*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   119
         (*assumes that inferences are numbered consecutively*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   120
         test_step (x + 1))
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   121
  in
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   122
    test_step from
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   123
  end
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   124
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   125
val step_range_tester_tracing =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   126
  step_range_tester
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   127
   (fn x => tracing ("@step " ^ Int.toString x))
60925
90659d0215bd prefer official @{make_string};
wenzelm
parents: 60649
diff changeset
   128
   (fn e => tracing ("!!" ^ @{make_string} e))
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   129
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   130
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   131
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   132
(*try to reconstruct each inference step*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   133
if test_all @{context} orelse prob_names = []
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   134
orelse true (*NOTE currently disabled*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   135
then ()
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   136
else
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   137
  let
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   138
    (*FIXME not guaranteed to be the right nodes*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   139
    val heur_start = 3
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   140
    val heur_end =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   141
      hd (#meta (test_pannot @{theory}))
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   142
      |> #1
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   143
      |> Int.fromString
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   144
  in
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   145
    step_range_tester_tracing @{context} (hd prob_names) heur_start heur_end
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   146
  end
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   147
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   148
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   149
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   150
section "Building metadata and tactics"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   151
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   152
subsection "Building the skeleton"
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   153
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   154
if test_all @{context} orelse prob_names = [] then []
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   155
else TPTP_Reconstruct.make_skeleton @{context} (test_pannot @{theory});
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   156
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   157
length it
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   158
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   159
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   160
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   161
subsection "The 'one shot' tactic approach"
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   162
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   163
val the_tactic =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   164
  if test_all @{context} then []
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   165
  else
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   166
    map (fn prob_name =>
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   167
      (TPTP_Reconstruct.naive_reconstruct_tac @{context} interpret_leo2_inference (* auto_based_reconstruction_tac *) (* oracle_based_reconstruction_tac *) prob_name))
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   168
     prob_names;
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   169
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   170
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   171
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   172
subsection "The 'piecemeal' approach"
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   173
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   174
val the_tactics =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   175
  if test_all @{context} then []
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   176
  else
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   177
    map (fn prob_name =>
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   178
      TPTP_Reconstruct.naive_reconstruct_tacs interpret_leo2_inference (* auto_based_reconstruction_tac *) (* oracle_based_reconstruction_tac *) prob_name @{context})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   179
     prob_names;
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   180
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   181
56281
03c3d1a7c3b8 proper configuration option "ML_print_depth";
wenzelm
parents: 56265
diff changeset
   182
declare [[ML_print_depth = 2000]]
03c3d1a7c3b8 proper configuration option "ML_print_depth";
wenzelm
parents: 56265
diff changeset
   183
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   184
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   185
the_tactics
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   186
|> map (filter (fn (_, _, x) => is_none x)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   187
        #> map (fn (x, SOME y, _) => (x, cterm_of @{theory} y)))
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   188
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   189
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   190
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   191
section "Using metadata and tactics"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   192
text "There are various ways of testing the two ways (whole tactics or lists of tactics) of representing 'reconstructors'."
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   193
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   194
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   195
subsection "The 'one shot' tactic approach"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   196
text "First we test whole tactics."
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   197
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   198
(*produce thm*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   199
if test_all @{context} then []
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   200
else
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   201
  map (
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   202
    (* try *) (TPTP_Reconstruct.reconstruct @{context}
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   203
     (fn prob_name =>
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   204
       TPTP_Reconstruct.naive_reconstruct_tac @{context} interpret_leo2_inference prob_name
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   205
     (* oracle_based_reconstruction_tac *))))
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   206
   prob_names
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   207
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   208
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   209
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   210
subsection "The 'piecemeal' approach"
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   211
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   212
fun attac n = List.nth (List.nth (the_tactics, 0), n) |> #3 |> the |> snd
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   213
fun attac_to n 0 = attac n
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   214
  | attac_to n m = attac n THEN attac_to (n + 1) (m - 1)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   215
fun shotac n = List.nth (List.nth (the_tactics, 0), n) |> #3 |> the |> fst
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   216
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   217
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   218
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   219
(*Given a list of reconstructed inferences (as in "the_tactics" above,
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   220
  count the number of failures and successes, and list the failed inference
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   221
  reconstructions.*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   222
fun evaluate_the_tactics [] acc = acc
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   223
  | evaluate_the_tactics ((node_no, (inf_name, inf_fmla, NONE)) :: xs) ((fai, suc), inf_list) =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   224
      let
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   225
        val score = (fai + 1, suc)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   226
        val index_info = get_index (fn (x, _) => if x = node_no then SOME true else NONE) inf_list
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   227
        val inf_list' =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   228
          case index_info of
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   229
              NONE => (node_no, (inf_name, inf_fmla, 1)) :: inf_list
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   230
            | SOME (idx, _) =>
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   231
                nth_map idx (fn (node_no, (inf_name, inf_fmla, count)) => (node_no, (inf_name, inf_fmla, count + 1))) inf_list
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   232
      in
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   233
        evaluate_the_tactics xs (score, inf_list')
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   234
      end
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   235
  | evaluate_the_tactics ((_, (_, _, SOME _)) :: xs) ((fai, suc), inf_list) =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   236
      evaluate_the_tactics xs ((fai, suc + 1), inf_list)
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   237
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   238
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   239
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   240
text "Now we build a tactic by combining lists of tactics"
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   241
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   242
(*given a list of tactics to be applied in sequence (i.e., they
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   243
  follow a skeleton), we build a single tactic, interleaving
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   244
  some tracing info to help with debugging.*)
57772
7d9134b032b2 updated application of print_tac to take context parameter;
sultana
parents: 56467
diff changeset
   245
fun step_by_step_tacs ctxt verbose (thm_tacs : (thm * tactic) list) : tactic =
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   246
    let
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   247
      fun interleave_tacs [] [] = all_tac
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   248
        | interleave_tacs (tac1 :: tacs1) (tac2 :: tacs2) =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   249
            EVERY [tac1, tac2]
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   250
            THEN interleave_tacs tacs1 tacs2
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   251
      val thms_to_traceprint =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   252
        map (fn thm => fn st =>
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   253
              (*FIXME uses makestring*)
60925
90659d0215bd prefer official @{make_string};
wenzelm
parents: 60649
diff changeset
   254
              print_tac ctxt (@{make_string} thm) st)
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   255
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   256
    in
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   257
      if verbose then
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   258
        ListPair.unzip thm_tacs
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   259
        |> apfst (fn thms => enumerate 1 thms)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   260
        |> apfst thms_to_traceprint
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   261
        |> uncurry interleave_tacs
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   262
      else EVERY (map #2 thm_tacs)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   263
    end
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   264
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   265
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   266
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   267
(*apply step_by_step_tacs to all problems under test*)
57772
7d9134b032b2 updated application of print_tac to take context parameter;
sultana
parents: 56467
diff changeset
   268
fun narrated_tactics ctxt =
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   269
 map (map (#3 #> the)
57772
7d9134b032b2 updated application of print_tac to take context parameter;
sultana
parents: 56467
diff changeset
   270
      #> step_by_step_tacs ctxt false)
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   271
   the_tactics;
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   272
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   273
(*produce thm*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   274
(*use narrated_tactics to reconstruct all problems under test*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   275
if test_all @{context} then []
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   276
else
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   277
  map (fn (prob_name, tac) =>
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   278
         TPTP_Reconstruct.reconstruct @{context}
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   279
           (fn _ => tac) prob_name)
57772
7d9134b032b2 updated application of print_tac to take context parameter;
sultana
parents: 56467
diff changeset
   280
    (ListPair.zip (prob_names, narrated_tactics @{context}))
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   281
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   282
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   283
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   284
subsection "Manually using 'piecemeal' approach"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   285
text "Another testing possibility involves manually creating a lemma
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   286
and running through the list of tactics generating to prove that lemma. The following code shows the goal of each problem under test, and then for each problem returns the list of tactics which can be invoked individually as shown below."
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   287
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   288
fun show_goal ctxt prob_name =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   289
  let
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   290
    val thy = Proof_Context.theory_of ctxt
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   291
    val pannot = TPTP_Reconstruct.get_pannot_of_prob thy prob_name
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   292
  in
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   293
    #meta pannot
58412
f65f11f4854c more standard Isabelle/ML operations;
wenzelm
parents: 58411
diff changeset
   294
    |> filter (fn (_, info) =>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   295
        #role info = TPTP_Syntax.Role_Conjecture)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   296
    |> hd
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   297
    |> snd |> #fmla
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   298
    |> cterm_of thy
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   299
  end;
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   300
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   301
if test_all @{context} then []
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   302
else
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   303
  map (show_goal @{context}) prob_names;
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   304
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   305
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   306
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   307
(*project out the list of tactics from "the_tactics"*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   308
val just_the_tacs  =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   309
 map (map (#3 #> the #> #2))
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   310
   the_tactics;
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   311
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   312
map length just_the_tacs
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   313
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   314
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   315
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   316
(*like just_the_tacs, but extract the thms, to inspect their thys*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   317
val just_the_thms  =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   318
 map (map (#3 #> the #> #1))
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   319
   the_tactics;
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   320
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   321
map length just_the_thms;
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   322
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   323
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   324
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   325
(*Show the skeleton-level inference which is done by each element of just_the_tacs. This is useful when debugging using the technique shown next*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   326
if test_all @{context} orelse prob_names = [] then ()
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   327
else
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   328
  the_tactics
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   329
  |> hd
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   330
  |> map #1
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   331
  |> TPTP_Reconstruct_Library.enumerate 0
60925
90659d0215bd prefer official @{make_string};
wenzelm
parents: 60649
diff changeset
   332
  |> List.app (@{make_string} #> writeln)
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   333
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   334
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   335
ML \<open>
60649
e007aa6a8aa2 more explicit use of context and elimination of Thm.theory_of_thm, although unclear (and untested?) situations remain;
wenzelm
parents: 59720
diff changeset
   336
fun leo2_tac_wrap ctxt prob_name step i st =
e007aa6a8aa2 more explicit use of context and elimination of Thm.theory_of_thm, although unclear (and untested?) situations remain;
wenzelm
parents: 59720
diff changeset
   337
  rtac (interpret_leo2_inference ctxt prob_name step) i st
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   338
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   339
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   340
(*FIXME move these examples elsewhere*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   341
(*
61076
bdc1e2f0a86a eliminated \<Colon>;
wenzelm
parents: 60926
diff changeset
   342
lemma "\<forall>(Xj::TPTP_Interpret.ind) Xk::TPTP_Interpret.ind.
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   343
        bnd_cCKB6_BLACK Xj Xk \<longrightarrow>
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   344
        bnd_cCKB6_BLACK (bnd_s (bnd_s (bnd_s Xj))) (bnd_s Xk)"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   345
apply (tactic {*nth (nth just_the_tacs 0) 0*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   346
apply (tactic {*nth (nth just_the_tacs 0) 1*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   347
apply (tactic {*nth (nth just_the_tacs 0) 2*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   348
apply (tactic {*nth (nth just_the_tacs 0) 3*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   349
apply (tactic {*nth (nth just_the_tacs 0) 4*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   350
apply (tactic {*nth (nth just_the_tacs 0) 5*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   351
ML_prf "nth (hd the_tactics) 6"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   352
apply (tactic {*nth (nth just_the_tacs 0) 6*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   353
apply (tactic {*nth (nth just_the_tacs 0) 7*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   354
apply (tactic {*nth (nth just_the_tacs 0) 8*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   355
apply (tactic {*nth (nth just_the_tacs 0) 9*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   356
apply (tactic {*nth (nth just_the_tacs 0) 10*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   357
apply (tactic {*nth (nth just_the_tacs 0) 11*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   358
apply (tactic {*nth (nth just_the_tacs 0) 12*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   359
apply (tactic {*nth (nth just_the_tacs 0) 13*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   360
apply (tactic {*nth (nth just_the_tacs 0) 14*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   361
apply (tactic {*nth (nth just_the_tacs 0) 15*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   362
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   363
apply (tactic {*nth (nth just_the_tacs 0) 16*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   364
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   365
(*
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   366
apply (tactic {*
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   367
rtac (interpret_leo2_inference @{context} (hd prob_names) "8") 1
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   368
*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   369
apply (tactic {*
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   370
rtac (interpret_leo2_inference @{context} (hd prob_names) "7") 1
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   371
*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   372
apply (tactic {*
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   373
rtac (interpret_leo2_inference @{context} (hd prob_names) "6") 1
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   374
*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   375
(*
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   376
apply (tactic {*
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   377
rtac (interpret_leo2_inference @{context} (hd prob_names) "4") 1
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   378
*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   379
*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   380
*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   381
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   382
apply (tactic {*nth (nth just_the_tacs 0) 17*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   383
apply (tactic {*nth (nth just_the_tacs 0) 18*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   384
apply (tactic {*nth (nth just_the_tacs 0) 19*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   385
apply (tactic {*nth (nth just_the_tacs 0) 20*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   386
apply (tactic {*nth (nth just_the_tacs 0) 21*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   387
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   388
ML_prf "nth (hd the_tactics) 21"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   389
ML_prf "nth (hd the_tactics) 22"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   390
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   391
apply (tactic {*nth (nth just_the_tacs 0) 22*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   392
apply (tactic {*nth (nth just_the_tacs 0) 23*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   393
apply (tactic {*nth (nth just_the_tacs 0) 24*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   394
apply (tactic {*nth (nth just_the_tacs 0) 25*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   395
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   396
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   397
ML_prf "nth (hd the_tactics) 19"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   398
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   399
apply (tactic {*
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   400
interpret_leo2_inference_wrap (hd prob_names) "8" 1
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   401
*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   402
apply (tactic {*
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   403
interpret_leo2_inference_wrap (hd prob_names) "7" 1
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   404
*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   405
apply (tactic {*
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   406
interpret_leo2_inference_wrap (hd prob_names) "6" 1
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   407
*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   408
apply (tactic {*
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   409
interpret_leo2_inference_wrap (hd prob_names) "4" 1
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   410
*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   411
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   412
ML_prf "nth (hd the_tactics) 20"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   413
ML_prf "nth (hd the_tactics) 21"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   414
ML_prf "nth (hd the_tactics) 22"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   415
*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   416
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   417
(*
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   418
lemma "bnd_powersetE1 \<longrightarrow>
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   419
     bnd_sepInPowerset \<longrightarrow>
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   420
     (\<forall>A Xphi. bnd_subset (bnd_dsetconstr A Xphi) A)"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   421
apply (tactic {*nth (nth just_the_tacs 0) 0*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   422
apply (tactic {*nth (nth just_the_tacs 0) 1*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   423
apply (tactic {*nth (nth just_the_tacs 0) 2*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   424
apply (tactic {*nth (nth just_the_tacs 0) 3*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   425
apply (tactic {*nth (nth just_the_tacs 0) 4*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   426
apply (tactic {*nth (nth just_the_tacs 0) 5*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   427
ML_prf "nth (hd the_tactics) 6"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   428
apply (tactic {*nth (nth just_the_tacs 0) 6*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   429
apply (tactic {*nth (nth just_the_tacs 0) 7*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   430
apply (tactic {*nth (nth just_the_tacs 0) 8*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   431
apply (tactic {*nth (nth just_the_tacs 0) 9*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   432
apply (tactic {*nth (nth just_the_tacs 0) 10*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   433
apply (tactic {*nth (nth just_the_tacs 0) 11*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   434
apply (tactic {*nth (nth just_the_tacs 0) 12*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   435
apply (tactic {*nth (nth just_the_tacs 0) 13*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   436
apply (tactic {*nth (nth just_the_tacs 0) 14*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   437
apply (tactic {*nth (nth just_the_tacs 0) 15*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   438
apply (tactic {*nth (nth just_the_tacs 0) 16*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   439
apply (tactic {*nth (nth just_the_tacs 0) 17*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   440
apply (tactic {*nth (nth just_the_tacs 0) 18*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   441
apply (tactic {*nth (nth just_the_tacs 0) 19*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   442
apply (tactic {*nth (nth just_the_tacs 0) 20*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   443
apply (tactic {*nth (nth just_the_tacs 0) 21*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   444
apply (tactic {*nth (nth just_the_tacs 0) 22*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   445
apply (tactic {*nth (nth just_the_tacs 0) 23*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   446
apply (tactic {*nth (nth just_the_tacs 0) 24*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   447
apply (tactic {*nth (nth just_the_tacs 0) 25*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   448
(* apply (tactic {*nth (nth just_the_tacs 0) 26*}) *)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   449
ML_prf "nth (hd the_tactics) 26"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   450
apply (subgoal_tac "(\<not> (\<forall>A Xphi. bnd_subset (bnd_dsetconstr A Xphi) A)) =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   451
       True \<Longrightarrow>
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   452
       (\<not> bnd_subset (bnd_dsetconstr bnd_sK1 bnd_sK2) bnd_sK1) =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   453
       True")
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   454
prefer 2
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   455
apply (thin_tac "(bnd_powersetE1 \<longrightarrow>
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   456
      bnd_sepInPowerset \<longrightarrow>
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   457
      (\<forall>A Xphi. bnd_subset (bnd_dsetconstr A Xphi) A)) =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   458
     False")
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   459
apply (tactic {*extcnf_combined_simulator_tac (hd prob_names) 1*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   460
apply (tactic {*extcnf_combined_simulator_tac (hd prob_names) 1*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   461
apply (tactic {*extcnf_combined_simulator_tac (hd prob_names) 1*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   462
apply (tactic {*extcnf_combined_simulator_tac (hd prob_names) 1*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   463
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   464
apply simp
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   465
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   466
(* apply (tactic {*nth (nth just_the_tacs 0) 26*}) *)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   467
apply (tactic {*nth (nth just_the_tacs 0) 27*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   468
apply (tactic {*nth (nth just_the_tacs 0) 28*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   469
apply (tactic {*nth (nth just_the_tacs 0) 29*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   470
apply (tactic {*nth (nth just_the_tacs 0) 30*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   471
apply (tactic {*nth (nth just_the_tacs 0) 31*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   472
apply (tactic {*nth (nth just_the_tacs 0) 32*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   473
apply (tactic {*nth (nth just_the_tacs 0) 33*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   474
apply (tactic {*nth (nth just_the_tacs 0) 34*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   475
apply (tactic {*nth (nth just_the_tacs 0) 35*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   476
apply (tactic {*nth (nth just_the_tacs 0) 36*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   477
apply (tactic {*nth (nth just_the_tacs 0) 37*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   478
apply (tactic {*nth (nth just_the_tacs 0) 38*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   479
apply (tactic {*nth (nth just_the_tacs 0) 39*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   480
apply (tactic {*nth (nth just_the_tacs 0) 40*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   481
apply (tactic {*nth (nth just_the_tacs 0) 41*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   482
apply (tactic {*nth (nth just_the_tacs 0) 42*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   483
apply (tactic {*nth (nth just_the_tacs 0) 43*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   484
apply (tactic {*nth (nth just_the_tacs 0) 44*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   485
apply (tactic {*nth (nth just_the_tacs 0) 45*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   486
apply (tactic {*nth (nth just_the_tacs 0) 46*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   487
apply (tactic {*nth (nth just_the_tacs 0) 47*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   488
apply (tactic {*nth (nth just_the_tacs 0) 48*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   489
apply (tactic {*nth (nth just_the_tacs 0) 49*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   490
apply (tactic {*nth (nth just_the_tacs 0) 50*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   491
apply (tactic {*nth (nth just_the_tacs 0) 51*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   492
done
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   493
*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   494
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   495
(*
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   496
We can use just_the_tacs as follows:
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   497
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   498
(this is from SEV012^5.p.out)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   499
lemma "((\<forall>(Xx :: bool) (Xy :: bool). True \<longrightarrow> True) \<and>
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   500
      (\<forall>(Xx :: bool) (Xy :: bool) (Xz :: bool). True \<and> True \<longrightarrow> True)) \<and>
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   501
     (\<lambda>(Xx :: bool) (Xy :: bool). True) = (\<lambda>Xx Xy. True)"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   502
apply (tactic {*nth (nth just_the_tacs 0) 0*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   503
apply (tactic {*nth (nth just_the_tacs 0) 1*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   504
apply (tactic {*nth (nth just_the_tacs 0) 2*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   505
apply (tactic {*nth (nth just_the_tacs 0) 3*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   506
apply (tactic {*nth (nth just_the_tacs 0) 4*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   507
apply (tactic {*nth (nth just_the_tacs 0) 5*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   508
ML_prf "nth (hd the_tactics) 6"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   509
apply (tactic {*nth (nth just_the_tacs 0) 6*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   510
apply (tactic {*nth (nth just_the_tacs 0) 7*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   511
apply (tactic {*nth (nth just_the_tacs 0) 8*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   512
apply (tactic {*nth (nth just_the_tacs 0) 9*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   513
apply (tactic {*nth (nth just_the_tacs 0) 10*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   514
apply (tactic {*nth (nth just_the_tacs 0) 11*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   515
apply (tactic {*nth (nth just_the_tacs 0) 12*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   516
apply (tactic {*nth (nth just_the_tacs 0) 13*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   517
apply (tactic {*nth (nth just_the_tacs 0) 14*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   518
apply (tactic {*nth (nth just_the_tacs 0) 15*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   519
apply (tactic {*nth (nth just_the_tacs 0) 16*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   520
apply (tactic {*nth (nth just_the_tacs 0) 17*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   521
apply (tactic {*nth (nth just_the_tacs 0) 18*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   522
apply (tactic {*nth (nth just_the_tacs 0) 19*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   523
apply (tactic {*nth (nth just_the_tacs 0) 20*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   524
apply (tactic {*nth (nth just_the_tacs 0) 21*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   525
apply (tactic {*nth (nth just_the_tacs 0) 22*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   526
done
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   527
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   528
(*
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   529
We could also use previous definitions directly,
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   530
e.g. the following should prove the goal at a go:
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   531
- apply (tactic {*narrated_tactics |> hd |> hd*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   532
- apply (tactic {*
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   533
    TPTP_Reconstruct.naive_reconstruct_tac
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   534
     interpret_leo2_inference
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   535
     (hd prob_names)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   536
     @{context}*})
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   537
(Note that the previous two methods don't work in this
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   538
 "lemma" testing mode, not sure why. The previous methods
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   539
 (producing the thm values directly) should work though.)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   540
*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   541
*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   542
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   543
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   544
section "Testing against benchmark"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   545
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   546
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   547
(*if reconstruction_info value is NONE then a big error must have occurred*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   548
type reconstruction_info =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   549
  ((int(*no of failures*) * int(*no of successes*)) *
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   550
  (TPTP_Reconstruct.rolling_stock * term option(*inference formula*) * int (*number of times the inference occurs in the skeleton*)) list) option
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   551
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   552
datatype proof_contents =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   553
    No_info
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   554
  | Empty
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   555
  | Nonempty of reconstruction_info
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   556
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   557
(*To make output less cluttered in whole-run tests*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   558
fun erase_inference_fmlas (Nonempty (SOME (outline, inf_info))) =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   559
      Nonempty (SOME (outline, map (fn (inf_name, _, count) => (inf_name, NONE, count)) inf_info))
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   560
  | erase_inference_fmlas x = x
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   561
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   562
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   563
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   564
(*Report on how many inferences in a proof are reconstructed, and give some
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   565
  info about the inferences for which reconstruction failed.*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   566
fun test_partial_reconstruction thy prob_file =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   567
  let
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   568
    val prob_name =
65999
ee4cf96a9406 tuned signature;
wenzelm
parents: 63167
diff changeset
   569
      prob_file
69366
b6dacf6eabe3 clarified signature;
wenzelm
parents: 67399
diff changeset
   570
      |> Path.file_name
65999
ee4cf96a9406 tuned signature;
wenzelm
parents: 63167
diff changeset
   571
      |> TPTP_Problem_Name.Nonstandard
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   572
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   573
    val thy' =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   574
      try
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   575
       (TPTP_Reconstruct.import_thm
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   576
        true
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   577
        [Path.dir prob_file, Path.explode "$TPTP"]
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   578
        prob_file leo2_on_load)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   579
       thy
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   580
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   581
    val ctxt' =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   582
      if is_some thy' then SOME (Proof_Context.init_global (the thy')) else NONE
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   583
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   584
    (*to test if proof is empty*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   585
    val fms =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   586
      if is_some thy'
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   587
      then SOME (TPTP_Reconstruct.get_fmlas_of_prob (the thy') prob_name)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   588
      else NONE
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   589
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   590
    val the_tactics =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   591
      if is_some thy' then
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   592
        SOME (TPTP_Reconstruct.naive_reconstruct_tacs (* metis_based_reconstruction_tac *)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   593
interpret_leo2_inference (* auto_based_reconstruction_tac *) (* oracle_based_reconstruction_tac *) prob_name (the ctxt'))
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   594
      else NONE
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   595
60925
90659d0215bd prefer official @{make_string};
wenzelm
parents: 60649
diff changeset
   596
(* val _ = tracing ("tt=" ^ @{make_string} the_tactics) *)
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   597
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   598
    val skeleton =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   599
      if is_some thy' then
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   600
        SOME (TPTP_Reconstruct.make_skeleton (the ctxt')
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   601
              (TPTP_Reconstruct.get_pannot_of_prob (the thy') prob_name))
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   602
      else NONE
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   603
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   604
    val skeleton_and_tactics =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   605
      if is_some thy' then
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   606
        SOME (ListPair.zip (the skeleton, the the_tactics))
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   607
      else NONE
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   608
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   609
    val result =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   610
      if is_some thy' then
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   611
        SOME (evaluate_the_tactics (the skeleton_and_tactics)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   612
              ((0, 0), []))
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   613
      else NONE
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   614
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   615
    (*strip node names*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   616
    val result' =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   617
      if is_some result then SOME (apsnd (map #2) (the result)) else NONE
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   618
  in
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   619
    if is_some fms andalso List.null (the fms) then Empty
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   620
    else Nonempty result'
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   621
  end
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   622
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   623
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   624
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   625
  (*default timeout is 1 min*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   626
  fun reconstruct timeout light_output file thy =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   627
    let
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   628
      val timer = Timer.startRealTimer ()
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   629
    in
62519
a564458f94db tuned signature -- clarified modules;
wenzelm
parents: 62390
diff changeset
   630
      Timeout.apply (Time.fromSeconds (if timeout = 0 then 60 else timeout))
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   631
       (test_partial_reconstruction thy
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   632
        #> light_output ? erase_inference_fmlas
60925
90659d0215bd prefer official @{make_string};
wenzelm
parents: 60649
diff changeset
   633
        #> @{make_string} (* FIXME *)
90659d0215bd prefer official @{make_string};
wenzelm
parents: 60649
diff changeset
   634
        #> (fn s => report (Proof_Context.init_global thy) (@{make_string} file ^ " === " ^ s ^
90659d0215bd prefer official @{make_string};
wenzelm
parents: 60649
diff changeset
   635
             " t=" ^ (Timer.checkRealTimer timer |> Time.toMilliseconds |> @{make_string}))))
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   636
       file
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   637
    end
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   638
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   639
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   640
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   641
  (*this version of "reconstruct" builds theorems, instead of lists of reconstructed inferences*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   642
  (*default timeout is 1 min*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   643
  fun reconstruct timeout file thy =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   644
    let
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   645
      val timer = Timer.startRealTimer ()
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   646
      val thy' =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   647
        TPTP_Reconstruct.import_thm true
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   648
         [Path.dir file, Path.explode "$TPTP"]
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   649
         file leo2_on_load thy
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   650
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   651
      val ctxt = Proof_Context.init_global thy' (*FIXME pass ctxt instead of thy*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   652
      val prob_name =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   653
        file
69366
b6dacf6eabe3 clarified signature;
wenzelm
parents: 67399
diff changeset
   654
        |> Path.file_name
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   655
        |> TPTP_Problem_Name.Nonstandard
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   656
    in
62519
a564458f94db tuned signature -- clarified modules;
wenzelm
parents: 62390
diff changeset
   657
      Timeout.apply (Time.fromSeconds (if timeout = 0 then 60 else timeout))
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   658
       (fn prob_name =>
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   659
        (can
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   660
          (TPTP_Reconstruct.reconstruct ctxt (fn prob_name =>
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   661
            TPTP_Reconstruct.naive_reconstruct_tac ctxt interpret_leo2_inference prob_name (* oracle_based_reconstruction_tac *))) prob_name )
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   662
       |> (fn s => report ctxt (Path.print file ^ " === " ^ Bool.toString s ^
60925
90659d0215bd prefer official @{make_string};
wenzelm
parents: 60649
diff changeset
   663
             " t=" ^ (Timer.checkRealTimer timer |> Time.toMilliseconds |> @{make_string}))))
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   664
       prob_name
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   665
    end
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   666
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   667
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   668
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   669
  fun reconstruction_test timeout ctxt =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   670
    test_fn ctxt
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   671
     (fn file => reconstruct timeout file (Proof_Context.theory_of ctxt))
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   672
     "reconstructor"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   673
     ()
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   674
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   675
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   676
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   677
datatype examination_results =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   678
    Whole_proof of string(*filename*) * proof_contents
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   679
  | Specific_rule of string(*filename*) * string(*inference rule*) * term option list
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   680
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   681
(*Look out for failures reconstructing a particular inference rule*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   682
fun filter_failures inference_name (Whole_proof (filename, results)) =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   683
  let
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   684
    val filtered_results =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   685
      case results of
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   686
          Nonempty (SOME results') =>
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   687
            #2 results'
58411
wenzelm
parents: 57772
diff changeset
   688
            |> maps (fn (stock as TPTP_Reconstruct.Annotated_step (_, inf_name), inf_fmla, _) =>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   689
                 if inf_name = inference_name then [inf_fmla] else [])
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   690
        | _ => []
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   691
  in Specific_rule (filename, inference_name, filtered_results) end
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   692
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   693
(*Returns detailed info about a proof-reconstruction attempt.
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   694
  If rule_name is specified then the related failed inferences
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   695
  are returned, otherwise all failed inferences are returned.*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   696
fun examine_failed_inferences ctxt filename rule_name =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   697
  let
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   698
    val thy = Proof_Context.theory_of ctxt
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   699
    val prob_file = Path.explode filename
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   700
    val results =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   701
      if test_all ctxt then No_info
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   702
      else test_partial_reconstruction thy prob_file
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   703
  in
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   704
    Whole_proof (filename, results)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   705
    |> is_some rule_name ? (fn x =>
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   706
                             filter_failures (the rule_name) x)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   707
  end
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   708
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   709
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   710
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   711
exception NONSENSE
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   712
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   713
fun annotation_or_id (TPTP_Reconstruct.Step n) = n
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   714
  | annotation_or_id (TPTP_Reconstruct.Annotated_step (n, anno)) = anno
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   715
  | annotation_or_id TPTP_Reconstruct.Assumed = "assumption"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   716
  | annotation_or_id TPTP_Reconstruct.Unconjoin = "conjI"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   717
  | annotation_or_id TPTP_Reconstruct.Caboose = "(end)"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   718
  | annotation_or_id (TPTP_Reconstruct.Synth_step s) = s
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   719
  | annotation_or_id (TPTP_Reconstruct.Split (split_node, soln_node, _)) = "split_at " ^ split_node ^ " " ^ soln_node;
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   720
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   721
fun count_failures (Whole_proof (_, No_info)) = raise NONSENSE
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   722
  | count_failures (Whole_proof (_, Empty)) = raise NONSENSE
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   723
  | count_failures (Whole_proof (_, Nonempty NONE)) = raise NONSENSE
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   724
  | count_failures (Whole_proof (_, Nonempty (SOME (((n, _), _))))) = n
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   725
  | count_failures (Specific_rule (_, _, t)) = length t
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   726
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   727
fun pre_classify_failures [] alist = alist
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   728
  | pre_classify_failures ((stock, _, _) :: xs) alist =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   729
      let
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   730
        val inf = annotation_or_id stock
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 65999
diff changeset
   731
        val count = AList.lookup (=) alist inf
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   732
      in
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   733
        if is_none count
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   734
        then pre_classify_failures xs ((inf, 1) :: alist)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   735
        else
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   736
          pre_classify_failures xs
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 65999
diff changeset
   737
           (AList.update (=) (inf, the count + 1) alist)
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   738
      end
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   739
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   740
fun classify_failures (Whole_proof (_, Nonempty (SOME (((_, _), inferences))))) = pre_classify_failures inferences []
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   741
  | classify_failures (Specific_rule (_, rule, t)) = [(rule, length t)]
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   742
  | classify_failures _ = raise NONSENSE
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   743
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   744
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   745
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   746
val regressions = map (fn s => "$THF_PROOFS/" ^ s)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   747
  ["SEV405^5.p.out",
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   748
   (*"SYO377^5.p.out", Always seems to raise Interrupt on my laptop -- probably because node 475 has lots of premises*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   749
   "PUZ031^5.p.out",
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   750
   "ALG001^5.p.out",
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   751
   "SYO238^5.p.out",
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   752
   (*"SEV158^5.p.out", This is big*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   753
   "SYO285^5.p.out",
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   754
   "../SYO285^5.p.out_reduced",
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   755
   (* "SYO225^5.p.out", This is big*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   756
   "SYO291^5.p.out",
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   757
   "SET669^3.p.out",
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   758
   "SEV233^5.p.out",
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   759
   (*"SEU511^1.p.out", This is big*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   760
   "SEV161^5.p.out",
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   761
   "SEV012^5.p.out",
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   762
   "SYO035^1.p.out",
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   763
   "SYO291^5.p.out",
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   764
   "SET741^4.p.out", (*involves both definitions and contorted splitting. has nice graph.*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   765
   "SEU548^2.p.out",
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   766
   "SEU513^2.p.out",
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   767
   "SYO006^1.p.out",
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   768
   "SYO371^5.p.out" (*has contorted splitting, like SYO006^1.p.out, but doesn't involve definitions*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   769
  ]
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   770
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   771
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   772
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   773
val experiment = examine_failed_inferences @{context}
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   774
  (List.last regressions) NONE;
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   775
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   776
(*
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   777
val experiment_focus =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   778
  filter_failures "extcnf_combined" experiment;
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   779
*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   780
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   781
(*
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   782
count_failures experiment_focus
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   783
classify_failures experiment
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   784
*)
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   785
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   786
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   787
text "Run reconstruction on all problems in a benchmark (provided via a script)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   788
and report on partial success."
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   789
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   790
declare [[
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   791
  tptp_test_all = true,
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   792
  tptp_test_timeout = 10
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   793
]]
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   794
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   795
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   796
  (*problem source*)
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   797
  val tptp_probs_dir =
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   798
    Path.explode "$THF_PROOFS"
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   799
    |> Path.expand;
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   800
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   801
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   802
ML \<open>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   803
  if test_all @{context} then
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   804
    (report @{context} "Reconstructing proofs";
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   805
    S timed_test (reconstruction_test (get_timeout @{context})) @{context} (TPTP_Syntax.get_file_list tptp_probs_dir))
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   806
  else ()
63167
0909deb8059b isabelle update_cartouches -c -t;
wenzelm
parents: 62519
diff changeset
   807
\<close>
55596
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   808
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   809
(*
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   810
Debugging strategy:
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   811
  1) get list of all proofs
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   812
  2) order by size
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   813
  3) try to construct each in turn, given some timeout
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   814
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   815
Use this to find the smallest failure, then debug that.
928b9f677165 reconstruction framework for LEO-II's TPTP proofs;
sultana
parents:
diff changeset
   816
*)
62390
842917225d56 more canonical names
nipkow
parents: 61076
diff changeset
   817
end