src/HOL/Tools/Sledgehammer/sledgehammer_atp_reconstruct.ML
changeset 43000 bd424c3dde46
parent 42998 1c80902d0456
child 43004 20e9caff1f86
equal deleted inserted replaced
42999:0db96016bdbf 43000:bd424c3dde46
   388     fun aux opt_T extra_us u =
   388     fun aux opt_T extra_us u =
   389       case u of
   389       case u of
   390         ATerm (a, us) =>
   390         ATerm (a, us) =>
   391         if String.isPrefix simple_type_prefix a then
   391         if String.isPrefix simple_type_prefix a then
   392           @{const True} (* ignore TPTP type information *)
   392           @{const True} (* ignore TPTP type information *)
   393         else case strip_prefix_and_unascii const_prefix a of
   393         else if a = tptp_equal then
   394           SOME "equal" =>
       
   395           let val ts = map (aux NONE []) us in
   394           let val ts = map (aux NONE []) us in
   396             if length ts = 2 andalso hd ts aconv List.last ts then
   395             if length ts = 2 andalso hd ts aconv List.last ts then
   397               (* Vampire is keen on producing these. *)
   396               (* Vampire is keen on producing these. *)
   398               @{const True}
   397               @{const True}
   399             else
   398             else
   400               list_comb (Const (@{const_name HOL.eq}, HOLogic.typeT), ts)
   399               list_comb (Const (@{const_name HOL.eq}, HOLogic.typeT), ts)
   401           end
   400           end
   402         | SOME s =>
   401         else case strip_prefix_and_unascii const_prefix a of
       
   402           SOME s =>
   403           let
   403           let
   404             val ((s', s), mangled_us) = s |> unmangled_const |>> `invert_const
   404             val ((s', s), mangled_us) = s |> unmangled_const |>> `invert_const
   405           in
   405           in
   406             if s' = type_tag_name then
   406             if s' = type_tag_name then
   407               case mangled_us @ us of
   407               case mangled_us @ us of
   692                                                   facts_offset fact_names)
   692                                                   facts_offset fact_names)
   693                         deps ([], [])))
   693                         deps ([], [])))
   694 
   694 
   695 fun repair_name "$true" = "c_True"
   695 fun repair_name "$true" = "c_True"
   696   | repair_name "$false" = "c_False"
   696   | repair_name "$false" = "c_False"
   697   | repair_name "$$e" = "c_equal" (* seen in Vampire proofs *)
   697   | repair_name "$$e" = tptp_equal (* seen in Vampire proofs *)
   698   | repair_name "equal" = "c_equal" (* needed by SPASS? *)
       
   699   | repair_name s =
   698   | repair_name s =
   700     if String.isPrefix "sQ" s andalso String.isSuffix "_eqProxy" s then
   699     if is_tptp_equal s orelse
   701       "c_equal" (* seen in Vampire proofs *)
   700        (* seen in Vampire proofs *)
       
   701        (String.isPrefix "sQ" s andalso String.isSuffix "_eqProxy" s) then
       
   702       tptp_equal
   702     else
   703     else
   703       s
   704       s
   704 
   705 
   705 fun isar_proof_from_atp_proof pool ctxt type_sys tfrees isar_shrink_factor
   706 fun isar_proof_from_atp_proof pool ctxt type_sys tfrees isar_shrink_factor
   706         atp_proof conjecture_shape facts_offset fact_names sym_tab params
   707         atp_proof conjecture_shape facts_offset fact_names sym_tab params