src/HOL/Tools/Sledgehammer/sledgehammer_reconstruct.ML
changeset 54715 a13aa1cac0e8
parent 54712 cbebe2cf77f1
child 54716 55ed20a29a8c
equal deleted inserted replaced
54714:ae01c51eadff 54715:a13aa1cac0e8
    64    clsarity). *)
    64    clsarity). *)
    65 fun is_only_type_information t = t aconv @{term True}
    65 fun is_only_type_information t = t aconv @{term True}
    66 
    66 
    67 fun is_same_inference (role, t) (_, role', t', _, _) =
    67 fun is_same_inference (role, t) (_, role', t', _, _) =
    68   (t |> role = Conjecture ? s_not) aconv (t' |> role' = Conjecture ? s_not)
    68   (t |> role = Conjecture ? s_not) aconv (t' |> role' = Conjecture ? s_not)
       
    69 
       
    70 fun is_False t = t aconv @{term False} orelse t aconv @{prop False}
       
    71 
       
    72 fun truncate_at_false [] = []
       
    73   | truncate_at_false ((line as (_, role, t, _, _)) :: lines) =
       
    74     line :: (if role <> Conjecture andalso is_False t then [] else truncate_at_false lines)
    69 
    75 
    70 (* Discard facts; consolidate adjacent lines that prove the same formula, since
    76 (* Discard facts; consolidate adjacent lines that prove the same formula, since
    71    they differ only in type information.*)
    77    they differ only in type information.*)
    72 fun add_line (name as (_, ss), role, t, rule, []) lines =
    78 fun add_line (name as (_, ss), role, t, rule, []) lines =
    73     (* No dependencies: lemma (for Z3), fact, conjecture, or (for Vampire)
    79     (* No dependencies: lemma (for Z3), fact, conjecture, or (for Vampire)
   224 
   230 
   225     fun isar_proof_of () =
   231     fun isar_proof_of () =
   226       let
   232       let
   227         val atp_proof =
   233         val atp_proof =
   228           atp_proof
   234           atp_proof
       
   235           |> truncate_at_false
   229           |> rpair [] |-> fold_rev add_line
   236           |> rpair [] |-> fold_rev add_line
   230           |> rpair [] |-> fold_rev add_nontrivial_line
   237           |> rpair [] |-> fold_rev add_nontrivial_line
   231           |> rpair (0, [])
   238           |> rpair (0, [])
   232           |-> fold_rev add_desired_line
   239           |-> fold_rev add_desired_line
   233           |> snd
   240           |> snd