src/HOL/Tools/ATP/atp_proof_reconstruct.ML
changeset 47920 a5c2386518e2
parent 47918 81ae96996223
child 47921 fc26d5538868
equal deleted inserted replaced
47919:1be466c58a26 47920:a5c2386518e2
   297 val have_prefix = "f"
   297 val have_prefix = "f"
   298 
   298 
   299 fun raw_label_for_name (num, ss) =
   299 fun raw_label_for_name (num, ss) =
   300   case resolve_conjecture ss of
   300   case resolve_conjecture ss of
   301     [j] => (conjecture_prefix, j)
   301     [j] => (conjecture_prefix, j)
   302   | _ => case Int.fromString num of
   302   | _ => (raw_prefix ^ ascii_of num, 0)
   303            SOME j => (raw_prefix, j)
       
   304          | NONE => (raw_prefix ^ num, 0)
       
   305 
   303 
   306 (**** INTERPRETATION OF TSTP SYNTAX TREES ****)
   304 (**** INTERPRETATION OF TSTP SYNTAX TREES ****)
   307 
   305 
   308 exception HO_TERM of (string, string) ho_term list
   306 exception HO_TERM of (string, string) ho_term list
   309 exception FORMULA of (string, string, (string, string) ho_term) formula list
   307 exception FORMULA of (string, string, (string, string) ho_term) formula list
   795         step :: aux subst depth nextp proof
   793         step :: aux subst depth nextp proof
   796   in aux [] 0 (1, 1) end
   794   in aux [] 0 (1, 1) end
   797 
   795 
   798 fun string_for_proof ctxt0 type_enc lam_trans i n =
   796 fun string_for_proof ctxt0 type_enc lam_trans i n =
   799   let
   797   let
   800     val ctxt =
   798     val ctxt = ctxt0
   801       ctxt0 |> Config.put show_free_types false
   799 (* FIXME: Implement proper handling of type constraints:
   802             |> Config.put show_types true
   800       |> Config.put show_free_types false
   803             |> Config.put show_sorts true
   801       |> Config.put show_types false
       
   802       |> Config.put show_sorts false
       
   803 *)
   804     fun fix_print_mode f x =
   804     fun fix_print_mode f x =
   805       Print_Mode.setmp (filter (curry (op =) Symbol.xsymbolsN)
   805       Print_Mode.setmp (filter (curry (op =) Symbol.xsymbolsN)
   806                                (print_mode_value ())) f x
   806                                (print_mode_value ())) f x
   807     fun do_indent ind = replicate_string (ind * indent_size) " "
   807     fun do_indent ind = replicate_string (ind * indent_size) " "
   808     fun do_free (s, T) =
   808     fun do_free (s, T) =
   901                             |> member (op = o apsnd fst) tainted s ? s_not))
   901                             |> member (op = o apsnd fst) tainted s ? s_not))
   902                   atp_proof
   902                   atp_proof
   903         fun prop_of_clause c =
   903         fun prop_of_clause c =
   904           fold (curry s_disj) (map_filter (Symtab.lookup props o fst) c)
   904           fold (curry s_disj) (map_filter (Symtab.lookup props o fst) c)
   905                @{term False}
   905                @{term False}
   906         fun label_of_clause c = (space_implode "___" (map fst c), 0)
   906         fun label_of_clause [name] = raw_label_for_name name
       
   907           | label_of_clause c = (space_implode "___" (map fst c), 0)
   907         fun maybe_show outer c =
   908         fun maybe_show outer c =
   908           (outer andalso length c = 1 andalso subset (op =) (c, conjs))
   909           (outer andalso length c = 1 andalso subset (op =) (c, conjs))
   909           ? cons Show
   910           ? cons Show
   910         fun do_have outer qs (gamma, c) =
   911         fun do_have outer qs (gamma, c) =
   911           Prove (maybe_show outer c qs, label_of_clause c, prop_of_clause c,
   912           Prove (maybe_show outer c qs, label_of_clause c, prop_of_clause c,