src/HOL/Tools/ATP/atp_proof_reconstruct.ML
changeset 47974 08d2dcc2dab9
parent 47973 9af7e5caf16f
child 48085 ff5e900d7b1a
equal deleted inserted replaced
47973:9af7e5caf16f 47974:08d2dcc2dab9
   186   String.isPrefix helper_prefix andf String.isSuffix typed_helper_suffix
   186   String.isPrefix helper_prefix andf String.isSuffix typed_helper_suffix
   187 fun is_typed_helper_used_in_atp_proof atp_proof =
   187 fun is_typed_helper_used_in_atp_proof atp_proof =
   188   is_axiom_used_in_proof is_typed_helper_name atp_proof
   188   is_axiom_used_in_proof is_typed_helper_name atp_proof
   189 
   189 
   190 val leo2_ext = "extcnf_equal_neg"
   190 val leo2_ext = "extcnf_equal_neg"
       
   191 val leo2_unfold_def = "unfold_def"
       
   192 
   191 val isa_ext = Thm.get_name_hint @{thm ext}
   193 val isa_ext = Thm.get_name_hint @{thm ext}
   192 val isa_short_ext = Long_Name.base_name isa_ext
   194 val isa_short_ext = Long_Name.base_name isa_ext
   193 
   195 
   194 fun ext_name ctxt =
   196 fun ext_name ctxt =
   195   if Thm.eq_thm_prop (@{thm ext},
   197   if Thm.eq_thm_prop (@{thm ext},
   196          singleton (Attrib.eval_thms ctxt) (Facts.named isa_short_ext, [])) then
   198          singleton (Attrib.eval_thms ctxt) (Facts.named isa_short_ext, [])) then
   197     isa_short_ext
   199     isa_short_ext
   198   else
   200   else
   199     isa_ext
   201     isa_ext
   200 
   202 
       
   203 fun add_all_defs fact_names accum =
       
   204   Vector.foldl (fn (facts, factss) =>
       
   205                    filter (fn (_, (_, status)) => status = Def) facts @ factss)
       
   206                accum fact_names
       
   207 
   201 fun add_fact ctxt fact_names (Inference_Step ((_, ss), _, rule, deps)) =
   208 fun add_fact ctxt fact_names (Inference_Step ((_, ss), _, rule, deps)) =
   202     (if rule = leo2_ext then
   209     (if rule = leo2_ext then
   203        insert (op =) (ext_name ctxt, (Global, General))
   210        insert (op =) (ext_name ctxt, (Global, General))
       
   211      else if rule = leo2_unfold_def then
       
   212        (* LEO 1.3.3 does not record definitions properly, leading to missing
       
   213          dependencies in the TSTP proof. Remove the next line once this is
       
   214          fixed. *)
       
   215        add_all_defs fact_names
   204      else if rule = satallax_unsat_coreN then
   216      else if rule = satallax_unsat_coreN then
   205        (fn [] =>
   217        (fn [] =>
   206            (* Satallax doesn't include definitions in its unsatisfiable cores,
   218            (* Satallax doesn't include definitions in its unsatisfiable cores,
   207               so we assume the worst and include them all here. *)
   219               so we assume the worst and include them all here. *)
   208            Vector.foldl (fn (facts, factss) =>
   220            [(ext_name ctxt, (Global, General))] |> add_all_defs fact_names
   209                             filter (fn (_, (_, status)) => status = Def) facts
       
   210                             @ factss)
       
   211                         [(ext_name ctxt, (Global, General))] fact_names
       
   212          | facts => facts)
   221          | facts => facts)
   213      else
   222      else
   214        I)
   223        I)
   215     #> (if null deps then union (op =) (resolve_fact fact_names ss)
   224     #> (if null deps then union (op =) (resolve_fact fact_names ss)
   216         else I)
   225         else I)