src/HOL/TPTP/TPTP_Parser/tptp_reconstruct.ML
changeset 60649 e007aa6a8aa2
parent 59936 b8ffc3dc9e24
child 60754 02924903a6fd
equal deleted inserted replaced
60648:6c4550cd1b17 60649:e007aa6a8aa2
  1027     fun skel_to_naive_tactic_dbg prover_tac ctxt prob_name skel (memo : (string * (thm * tactic) option) list) =
  1027     fun skel_to_naive_tactic_dbg prover_tac ctxt prob_name skel (memo : (string * (thm * tactic) option) list) =
  1028       let
  1028       let
  1029         val thy = Proof_Context.theory_of ctxt
  1029         val thy = Proof_Context.theory_of ctxt
  1030         val pannot = get_pannot_of_prob thy prob_name
  1030         val pannot = get_pannot_of_prob thy prob_name
  1031 
  1031 
       
  1032 (* FIXME !???!
  1032         fun rtac_wrap thm_f i = fn st =>
  1033         fun rtac_wrap thm_f i = fn st =>
  1033           let
  1034           let
  1034             val thy = Thm.theory_of_thm st
  1035             val thy = Thm.theory_of_thm st
  1035           in
  1036           in
  1036             rtac (thm_f thy) i st
  1037             rtac (thm_f thy) i st
  1037           end
  1038           end
       
  1039 *)
  1038 
  1040 
  1039         (*Some nodes don't have an inference name, such as the conjecture,
  1041         (*Some nodes don't have an inference name, such as the conjecture,
  1040           definitions and axioms. Such nodes shouldn't appear in the
  1042           definitions and axioms. Such nodes shouldn't appear in the
  1041           skeleton.*)
  1043           skeleton.*)
  1042         fun inference_name_of_node node =
  1044         fun inference_name_of_node node =
  1061           (* TimeLimit.timeLimit (Time.fromSeconds 5) *)
  1063           (* TimeLimit.timeLimit (Time.fromSeconds 5) *)
  1062           (fn ctxt' =>
  1064           (fn ctxt' =>
  1063              let
  1065              let
  1064                fun thm ctxt'' = prover_tac ctxt'' prob_name (hd skel |> stock_to_string)
  1066                fun thm ctxt'' = prover_tac ctxt'' prob_name (hd skel |> stock_to_string)
  1065                val reconstructed_inference = thm ctxt'
  1067                val reconstructed_inference = thm ctxt'
  1066                val rec_inf_tac = fn st =>
  1068                fun rec_inf_tac st = HEADGOAL (rtac (thm ctxt')) st
  1067                  let
       
  1068                    val ctxt =
       
  1069                      Thm.theory_of_thm st
       
  1070                      |> Proof_Context.init_global
       
  1071                  in
       
  1072                    HEADGOAL (rtac (thm ctxt)) st
       
  1073                  end
       
  1074              in (reconstructed_inference,
  1069              in (reconstructed_inference,
  1075                  rec_inf_tac)
  1070                  rec_inf_tac)
  1076              end)
  1071              end)
  1077         fun ignore_interpretation_exn f x = SOME (f x)
  1072         fun ignore_interpretation_exn f x = SOME (f x)
  1078           handle
  1073           handle
  1155                                      (NONE, ctxt)
  1150                                      (NONE, ctxt)
  1156                                     )
  1151                                     )
  1157                                 else
  1152                                 else
  1158                                   let
  1153                                   let
  1159                                     val maybe_thm = ignore_interpretation_exn try_make_step ctxt
  1154                                     val maybe_thm = ignore_interpretation_exn try_make_step ctxt
       
  1155 (* FIXME !???!
  1160                                     val ctxt' =
  1156                                     val ctxt' =
  1161                                       if is_some maybe_thm then
  1157                                       if is_some maybe_thm then
  1162                                         the maybe_thm
  1158                                         the maybe_thm
  1163                                         |> #1
  1159                                         |> #1
  1164                                         |> Thm.theory_of_thm |> Proof_Context.init_global
  1160                                         |> Thm.theory_of_thm |> Proof_Context.init_global
  1165                                       else ctxt
  1161                                       else ctxt
       
  1162 *)
  1166                                   in
  1163                                   in
  1167                                     (maybe_thm, ctxt')
  1164                                     (maybe_thm, ctxt)
  1168                                   end
  1165                                   end
  1169                           in (thm, (node, thm) :: memo, ctxt') end
  1166                           in (thm, (node, thm) :: memo, ctxt') end
  1170                       | SOME maybe_thm => (maybe_thm, memo, ctxt)
  1167                       | SOME maybe_thm => (maybe_thm, memo, ctxt)
  1171                 in
  1168                 in
  1172                   (Annotated_step (node, inference_name),
  1169                   (Annotated_step (node, inference_name),
  1181                       | SOME binding => Global_Theory.get_thm thy (Binding.name_of binding)
  1178                       | SOME binding => Global_Theory.get_thm thy (Binding.name_of binding)
  1182                 in
  1179                 in
  1183                   (hd skel,
  1180                   (hd skel,
  1184                    Thm.prop_of (def_thm thy)
  1181                    Thm.prop_of (def_thm thy)
  1185                    |> SOME,
  1182                    |> SOME,
  1186                    SOME (def_thm thy,
  1183                    SOME (def_thm thy, HEADGOAL (rtac (def_thm thy)))) :: rest memo ctxt
  1187                          HEADGOAL (rtac_wrap def_thm))) :: rest memo ctxt
       
  1188                 end
  1184                 end
  1189             | Axiom n =>
  1185             | Axiom n =>
  1190                 let
  1186                 let
  1191                   val ax_thm =
  1187                   val ax_thm =
  1192                     case AList.lookup (op =) (#axs pannot) n of
  1188                     case AList.lookup (op =) (#axs pannot) n of