src/HOL/Tools/res_clause.ML
changeset 20824 aca7d38283bf
parent 20790 a9595fdc02b1
child 20854 f9cf9e62d11c
equal deleted inserted replaced
20823:5480ec4b542d 20824:aca7d38283bf
     9 (*FIXME: is this signature necessary? Or maybe define and open a Basic_ResClause?*)
     9 (*FIXME: is this signature necessary? Or maybe define and open a Basic_ResClause?*)
    10 signature RES_CLAUSE =
    10 signature RES_CLAUSE =
    11   sig
    11   sig
    12   exception CLAUSE of string * term
    12   exception CLAUSE of string * term
    13   type clause and arityClause and classrelClause
    13   type clause and arityClause and classrelClause
    14   type fol_type
    14   datatype fol_type = AtomV of string
    15   type typ_var
    15                     | AtomF of string
    16   type type_literal
    16                     | Comp of string * fol_type list;
       
    17   datatype fol_term = UVar of string * fol_type
       
    18                     | Fun of string * fol_type list * fol_term list;
       
    19   datatype predicate = Predicate of string * fol_type list * fol_term list;
       
    20   type typ_var and type_literal and literal
       
    21   val literals_of_term: Term.term -> literal list * (typ_var * Term.sort) list
    17   val add_typs_aux : (typ_var * string list) list -> type_literal list * type_literal list
    22   val add_typs_aux : (typ_var * string list) list -> type_literal list * type_literal list
    18   val arity_clause_thy: theory -> arityClause list 
    23   val arity_clause_thy: theory -> arityClause list 
    19   val ascii_of : string -> string
    24   val ascii_of : string -> string
    20   val bracket_pack : string list -> string
    25   val bracket_pack : string list -> string
    21   val classrel_clauses_thy: theory -> classrelClause list 
    26   val classrel_clauses_thy: theory -> classrelClause list 
    26        ((thm * (string * int)) list * classrelClause list * arityClause list) -> string list
    31        ((thm * (string * int)) list * classrelClause list * arityClause list) -> string list
    27   val fixed_var_prefix : string
    32   val fixed_var_prefix : string
    28   val gen_tptp_cls : int * string * string * string -> string
    33   val gen_tptp_cls : int * string * string * string -> string
    29   val gen_tptp_type_cls : int * string * string * string * int -> string
    34   val gen_tptp_type_cls : int * string * string * string * int -> string
    30   val get_axiomName : clause ->  string
    35   val get_axiomName : clause ->  string
       
    36   val get_literals : clause -> literal list
    31   val init : theory -> unit
    37   val init : theory -> unit
    32   val isMeta : string -> bool
    38   val isMeta : string -> bool
    33   val isTaut : clause -> bool
    39   val isTaut : clause -> bool
    34   val keep_types : bool ref
    40   val keep_types : bool ref
    35   val list_ord : ('a * 'b -> order) -> 'a list * 'b list -> order
    41   val list_ord : ('a * 'b -> order) -> 'a list * 'b list -> order
   210 type axiom_name = string;
   216 type axiom_name = string;
   211 type polarity = bool;
   217 type polarity = bool;
   212 
   218 
   213 (**** Isabelle FOL clauses ****)
   219 (**** Isabelle FOL clauses ****)
   214 
   220 
   215 type pred_name = string;
       
   216 
       
   217 datatype typ_var = FOLTVar of indexname | FOLTFree of string;
   221 datatype typ_var = FOLTVar of indexname | FOLTFree of string;
   218 
   222 
   219 (*FIXME: give the constructors more sensible names*)
   223 (*FIXME: give the constructors more sensible names*)
   220 datatype fol_type = AtomV of string
   224 datatype fol_type = AtomV of string
   221 		  | AtomF of string
   225 		  | AtomF of string
   234 (*First string is the type class; the second is a TVar or TFfree*)
   238 (*First string is the type class; the second is a TVar or TFfree*)
   235 datatype type_literal = LTVar of string * string | LTFree of string * string;
   239 datatype type_literal = LTVar of string * string | LTFree of string * string;
   236 
   240 
   237 datatype fol_term = UVar of string * fol_type
   241 datatype fol_term = UVar of string * fol_type
   238                   | Fun of string * fol_type list * fol_term list;
   242                   | Fun of string * fol_type list * fol_term list;
   239 datatype predicate = Predicate of pred_name * fol_type list * fol_term list;
   243 datatype predicate = Predicate of string * fol_type list * fol_term list;
   240 
   244 
   241 datatype literal = Literal of polarity * predicate;
   245 datatype literal = Literal of polarity * predicate;
   242 
   246 
   243 fun mk_typ_var_sort (TFree(a,s)) = (FOLTFree a,s)
   247 fun mk_typ_var_sort (TFree(a,s)) = (FOLTFree a,s)
   244   | mk_typ_var_sort (TVar(v,s)) = (FOLTVar v,s);
   248   | mk_typ_var_sort (TVar(v,s)) = (FOLTVar v,s);
   252 		    kind: kind,
   256 		    kind: kind,
   253 		    literals: literal list,
   257 		    literals: literal list,
   254 		    types_sorts: (typ_var * sort) list};
   258 		    types_sorts: (typ_var * sort) list};
   255 
   259 
   256 fun get_axiomName (Clause cls) = #axiom_name cls;
   260 fun get_axiomName (Clause cls) = #axiom_name cls;
       
   261 
       
   262 fun get_literals (Clause cls) = #literals cls;
   257 
   263 
   258 exception CLAUSE of string * term;
   264 exception CLAUSE of string * term;
   259 
   265 
   260 fun isFalse (Literal (pol, Predicate(pname,_,[]))) =
   266 fun isFalse (Literal (pol, Predicate(pname,_,[]))) =
   261       (pol andalso pname = "c_False") orelse
   267       (pol andalso pname = "c_False") orelse