src/HOL/Tools/ATP/recon_parse.ML
changeset 17315 5bf0e0aacc24
parent 17312 159783c74f75
child 17422 3b237822985d
equal deleted inserted replaced
17314:04e21a27c0ad 17315:5bf0e0aacc24
     1 (*  ID:         $Id$
     1 (*  ID:         $Id$
     2     Author:     Claire Quigley
     2     Author:     Claire Quigley
     3     Copyright   2004  University of Cambridge
     3     Copyright   2004  University of Cambridge
     4 *)
     4 *)
     5 
     5 
     6 (*use "Translate_Proof";*)
       
     7 (* Parsing functions *)
     6 (* Parsing functions *)
     8 
     7 
     9 (* Auxiliary functions *)
     8 (* Auxiliary functions *)
    10 
     9 
    11 structure Recon_Parse =
    10 structure Recon_Parse =
   113            o fst o cut_after "contradiction.\n") s
   112            o fst o cut_after "contradiction.\n") s
   114         else
   113         else
   115           raise (GandalfError "Couldn't find a proof.")
   114           raise (GandalfError "Couldn't find a proof.")
   116 *)
   115 *)
   117 
   116 
       
   117 val start_E = "# Proof object starts here."
       
   118 val end_E   = "# Proof object ends here."
       
   119 val start_V6 = "%================== Proof: ======================"
       
   120 val end_V6   = "%==============  End of proof. =================="
       
   121 
       
   122 
   118 (*Identifies the start/end lines of an ATP's output*)
   123 (*Identifies the start/end lines of an ATP's output*)
   119 fun extract_proof s =
   124 fun extract_proof s =
   120   if cut_exists "Here is a proof with" s then
   125   if cut_exists "Here is a proof with" s then
   121     (kill_lines 0
   126     (kill_lines 0
   122      o snd o cut_after ":"
   127      o snd o cut_after ":"
   123      o snd o cut_after "Here is a proof with"
   128      o snd o cut_after "Here is a proof with"
   124      o fst o cut_after " ||  -> .") s
   129      o fst o cut_after " ||  -> .") s
   125   else if cut_exists "%================== Proof: ======================" s then
   130   else if cut_exists start_V6 s then
   126     (kill_lines 0    (*Vampire 5.0*)
   131     (kill_lines 0    (*Vampire 6.0*)
   127      o snd o cut_after "%================== Proof: ======================"
   132      o snd o cut_after start_V6
   128      o fst o cut_before "==============  End of proof. ==================") s
   133      o fst o cut_before end_V6) s
   129   else if cut_exists "# Proof object ends here." s then
   134   else if cut_exists end_E s then
   130     (kill_lines 0    (*eproof*)
   135     (kill_lines 0    (*eproof*)
   131      o snd o cut_after "# Proof object starts here."
   136      o snd o cut_after start_E
   132      o fst o cut_before "# Proof object ends here.") s
   137      o fst o cut_before end_E) s
   133   else "??extract_proof failed" (*Couldn't find a proof*)
   138   else "??extract_proof failed" (*Couldn't find a proof*)
   134 
   139 
   135 fun several p = many (some p)
   140 fun several p = many (some p)
   136       fun collect (h, t) = h ^ (fold_rev (fn s1 => fn s2 => s1 ^ s2) t "")
   141       fun collect (h, t) = h ^ (fold_rev (fn s1 => fn s2 => s1 ^ s2) t "")
   137   
   142