remove needless steps from refutation graph -- these confuse the proof redirection algorithm (and are needless)
authorblanchet
Wed, 20 Feb 2013 17:05:24 +0100
changeset 51208 44f0bfe67b01
parent 51207 914436eb988b
child 51209 80a0af55f6c1
remove needless steps from refutation graph -- these confuse the proof redirection algorithm (and are needless)
src/HOL/Tools/ATP/atp_proof_redirect.ML
src/HOL/Tools/Sledgehammer/sledgehammer_reconstruct.ML
--- a/src/HOL/Tools/ATP/atp_proof_redirect.ML	Wed Feb 20 16:21:04 2013 +0100
+++ b/src/HOL/Tools/ATP/atp_proof_redirect.ML	Wed Feb 20 17:05:24 2013 +0100
@@ -32,7 +32,7 @@
 
   type direct_proof = direct_inference list
 
-  val make_refute_graph : (atom list * atom) list -> refute_graph
+  val make_refute_graph : atom -> (atom list * atom) list -> refute_graph
   val axioms_of_refute_graph : refute_graph -> atom list -> atom list
   val tainted_atoms_of_refute_graph : refute_graph -> atom list -> atom list
   val sequents_of_refute_graph : refute_graph -> ref_sequent list
@@ -72,14 +72,16 @@
 fun direct_sequent_eq ((gamma, c), (delta, d)) =
   clause_eq (gamma, delta) andalso clause_eq (c, d)
 
-fun make_refute_graph infers =
+fun make_refute_graph bot infers =
   let
     fun add_edge to from =
       Atom_Graph.default_node (from, ())
       #> Atom_Graph.default_node (to, ())
       #> Atom_Graph.add_edge_acyclic (from, to)
     fun add_infer (froms, to) = fold (add_edge to) froms
-  in Atom_Graph.empty |> fold add_infer infers end
+    val graph = fold add_infer infers Atom_Graph.empty
+    val reachable = Atom_Graph.all_preds graph [bot]
+  in graph |> Atom_Graph.restrict (member (is_equal o Atom.ord) reachable) end
 
 fun axioms_of_refute_graph refute_graph conjs =
   subtract atom_eq conjs (Atom_Graph.minimals refute_graph)
--- a/src/HOL/Tools/Sledgehammer/sledgehammer_reconstruct.ML	Wed Feb 20 16:21:04 2013 +0100
+++ b/src/HOL/Tools/Sledgehammer/sledgehammer_reconstruct.ML	Wed Feb 20 17:05:24 2013 +0100
@@ -678,12 +678,12 @@
                  | _ => NONE)
               | _ => NONE)
         fun dep_of_step (name, _, _, _, from) = SOME (from, name)
+        val bot = atp_proof |> List.last |> dep_of_step |> the |> snd
         val refute_graph =
-          atp_proof |> map_filter dep_of_step |> make_refute_graph
+          atp_proof |> map_filter dep_of_step |> make_refute_graph bot
         val axioms = axioms_of_refute_graph refute_graph conjs
         val tainted = tainted_atoms_of_refute_graph refute_graph conjs
         val is_clause_tainted = exists (member (op =) tainted)
-        val bot = atp_proof |> List.last |> dep_of_step |> the |> snd
         val steps =
           Symtab.empty
           |> fold (fn (name as (s, _), role, t, rule, _) =>