src/HOL/Tools/ATP/atp_proof_reconstruct.ML
changeset 63692 1bc4bc2c9fd1
parent 59582 0fbed69ff081
child 67091 1393c2340eec
equal deleted inserted replaced
63691:94a89b95b871 63692:1bc4bc2c9fd1
   269           val tm = do_term NONE term
   269           val tm = do_term NONE term
   270         in quantify_over_var true lambda' var_name typ tm end
   270         in quantify_over_var true lambda' var_name typ tm end
   271       | ATerm ((s, tys), us) =>
   271       | ATerm ((s, tys), us) =>
   272         if s = ""
   272         if s = ""
   273         then error "Isar proof reconstruction failed because the ATP proof \
   273         then error "Isar proof reconstruction failed because the ATP proof \
   274                      \contains unparsable material."
   274                      \contains unparsable material"
   275         else if s = tptp_equal then
   275         else if s = tptp_equal then
   276           list_comb (Const (@{const_name HOL.eq}, Type_Infer.anyT @{sort type}),
   276           list_comb (Const (@{const_name HOL.eq}, Type_Infer.anyT @{sort type}),
   277             map (do_term NONE) us)
   277             map (do_term NONE) us)
   278         else if not (null us) then
   278         else if not (null us) then
   279           let
   279           let
   347     fun do_term extra_ts opt_T u =
   347     fun do_term extra_ts opt_T u =
   348       (case u of
   348       (case u of
   349         ATerm ((s, tys), us) =>
   349         ATerm ((s, tys), us) =>
   350         if s = "" then
   350         if s = "" then
   351           error "Isar proof reconstruction failed because the ATP proof contains unparsable \
   351           error "Isar proof reconstruction failed because the ATP proof contains unparsable \
   352             \material."
   352             \material"
   353         else if String.isPrefix native_type_prefix s then
   353         else if String.isPrefix native_type_prefix s then
   354           @{const True} (* ignore TPTP type information (needed?) *)
   354           @{const True} (* ignore TPTP type information (needed?) *)
   355         else if s = tptp_equal then
   355         else if s = tptp_equal then
   356           list_comb (Const (@{const_name HOL.eq}, Type_Infer.anyT @{sort type}),
   356           list_comb (Const (@{const_name HOL.eq}, Type_Infer.anyT @{sort type}),
   357             map (do_term [] NONE) us)
   357             map (do_term [] NONE) us)
   426             in list_comb (t, ts) end))
   426             in list_comb (t, ts) end))
   427   in do_term [] end
   427   in do_term [] end
   428 
   428 
   429 fun term_of_atp ctxt (ATP_Problem.THF _) type_enc =
   429 fun term_of_atp ctxt (ATP_Problem.THF _) type_enc =
   430     if ATP_Problem_Generate.is_type_enc_higher_order type_enc then K (term_of_atp_ho ctxt)
   430     if ATP_Problem_Generate.is_type_enc_higher_order type_enc then K (term_of_atp_ho ctxt)
   431     else error "Unsupported Isar reconstruction."
   431     else error "Unsupported Isar reconstruction"
   432   | term_of_atp ctxt _ type_enc =
   432   | term_of_atp ctxt _ type_enc =
   433     if not (ATP_Problem_Generate.is_type_enc_higher_order type_enc) then term_of_atp_fo ctxt
   433     if not (ATP_Problem_Generate.is_type_enc_higher_order type_enc) then term_of_atp_fo ctxt
   434     else error "Unsupported Isar reconstruction."
   434     else error "Unsupported Isar reconstruction"
   435 
   435 
   436 fun term_of_atom ctxt format type_enc textual sym_tab pos (u as ATerm ((s, _), _)) =
   436 fun term_of_atom ctxt format type_enc textual sym_tab pos (u as ATerm ((s, _), _)) =
   437   if String.isPrefix class_prefix s then
   437   if String.isPrefix class_prefix s then
   438     add_type_constraint pos (type_constraint_of_term ctxt u)
   438     add_type_constraint pos (type_constraint_of_term ctxt u)
   439     #> pair @{const True}
   439     #> pair @{const True}