src/HOL/Tools/Sledgehammer/sledgehammer_tptp_format.ML
changeset 37962 d7dbe01f48d7
parent 37961 6a48c85a211a
child 37992 7911e78a7122
equal deleted inserted replaced
37961:6a48c85a211a 37962:d7dbe01f48d7
     9 sig
     9 sig
    10   type class_rel_clause = Metis_Clauses.class_rel_clause
    10   type class_rel_clause = Metis_Clauses.class_rel_clause
    11   type arity_clause = Metis_Clauses.arity_clause
    11   type arity_clause = Metis_Clauses.arity_clause
    12   type fol_clause = Metis_Clauses.fol_clause
    12   type fol_clause = Metis_Clauses.fol_clause
    13 
    13 
       
    14   val axiom_prefix : string
    14   val write_tptp_file :
    15   val write_tptp_file :
    15     theory -> bool -> bool -> bool -> Path.T
    16     theory -> bool -> bool -> bool -> Path.T
    16     -> fol_clause list * fol_clause list * fol_clause list * fol_clause list
    17     -> fol_clause list * fol_clause list * fol_clause list * fol_clause list
    17        * class_rel_clause list * arity_clause list
    18        * class_rel_clause list * arity_clause list
    18     -> string Symtab.table * int
    19     -> string Symtab.table * int
   134                pool_map nice_problem_line lines #>> pair heading) problem
   135                pool_map nice_problem_line lines #>> pair heading) problem
   135 
   136 
   136 
   137 
   137 (** Sledgehammer stuff **)
   138 (** Sledgehammer stuff **)
   138 
   139 
   139 val clause_prefix = "cls_"
   140 val axiom_prefix = "ax_"
       
   141 val conjecture_prefix = "conj_"
   140 val arity_clause_prefix = "clsarity_"
   142 val arity_clause_prefix = "clsarity_"
   141 
   143 
   142 fun hol_ident axiom_name clause_id =
   144 fun hol_ident prefix axiom_name = prefix ^ ascii_of axiom_name
   143   clause_prefix ^ ascii_of axiom_name ^ "_" ^ Int.toString clause_id
       
   144 
   145 
   145 fun wrap_type ty t = ATerm ((type_wrapper_name, type_wrapper_name), [ty, t])
   146 fun wrap_type ty t = ATerm ((type_wrapper_name, type_wrapper_name), [ty, t])
   146 
   147 
   147 fun fo_term_for_combtyp (CombTVar name) = ATerm (name, [])
   148 fun fo_term_for_combtyp (CombTVar name) = ATerm (name, [])
   148   | fo_term_for_combtyp (CombTFree name) = ATerm (name, [])
   149   | fo_term_for_combtyp (CombTFree name) = ATerm (name, [])
   187   map (fo_literal_for_type_literal false)
   188   map (fo_literal_for_type_literal false)
   188       (type_literals_for_types ctypes_sorts)
   189       (type_literals_for_types ctypes_sorts)
   189   |> formula_for_fo_literals
   190   |> formula_for_fo_literals
   190 
   191 
   191 fun problem_line_for_axiom full_types
   192 fun problem_line_for_axiom full_types
   192         (clause as FOLClause {axiom_name, clause_id, kind, ...}) =
   193         (clause as FOLClause {axiom_name, kind, ...}) =
   193   Fof (hol_ident axiom_name clause_id, kind,
   194   Fof (hol_ident axiom_prefix axiom_name, kind,
   194        formula_for_axiom full_types clause)
   195        formula_for_axiom full_types clause)
   195 
   196 
   196 fun problem_line_for_class_rel_clause
   197 fun problem_line_for_class_rel_clause
   197         (ClassRelClause {axiom_name, subclass, superclass, ...}) =
   198         (ClassRelClause {axiom_name, subclass, superclass, ...}) =
   198   let val ty_arg = ATerm (("T", "T"), []) in
   199   let val ty_arg = ATerm (("T", "T"), []) in
   211   Fof (arity_clause_prefix ^ ascii_of axiom_name, Axiom,
   212   Fof (arity_clause_prefix ^ ascii_of axiom_name, Axiom,
   212        map fo_literal_for_arity_literal (conclLit :: premLits)
   213        map fo_literal_for_arity_literal (conclLit :: premLits)
   213        |> formula_for_fo_literals)
   214        |> formula_for_fo_literals)
   214 
   215 
   215 fun problem_line_for_conjecture full_types
   216 fun problem_line_for_conjecture full_types
   216         (clause as FOLClause {axiom_name, clause_id, kind, literals, ...}) =
   217         (clause as FOLClause {axiom_name, kind, literals, ...}) =
   217   Fof (hol_ident axiom_name clause_id, kind,
   218   Fof (hol_ident conjecture_prefix axiom_name, kind,
   218        map (fo_literal_for_literal full_types) literals
   219        map (fo_literal_for_literal full_types) literals
   219        |> formula_for_fo_literals |> mk_anot)
   220        |> formula_for_fo_literals |> mk_anot)
   220 
   221 
   221 fun atp_free_type_literals_for_conjecture (FOLClause {ctypes_sorts, ...}) =
   222 fun atp_free_type_literals_for_conjecture (FOLClause {ctypes_sorts, ...}) =
   222   map (fo_literal_for_type_literal true) (type_literals_for_types ctypes_sorts)
   223   map (fo_literal_for_type_literal true) (type_literals_for_types ctypes_sorts)