module Term:terms, literals, clausessig..end
All persistent terms are stored in a global database, so that each term exists only once in the system (hash-consing).
Fast access is based on a hash value for every term Term.hash_of_term.
For variables and constants that's their id,
for terms it is (for efficiency) stored in the term data structure.
Benefits: low memory usage by term sharing, fast term comparison by pointer equality.
Drawbacks: term construction implies a term database access, terms store a hash value.
Only temporarily needed terms may not be entered into the database,
if the argument ?insert_db is false in the request functions below.
By default ?insert_db is true.
typevar =Var.var
typesymbol =Symbol.symbol
type func = private {
|
symbol : |
(* | the top symbol, e.g. f | *) |
|
subterms : |
(* | the subterms, e.g. a, b | *) |
|
ground : |
(* | is the term ground? | *) |
|
hash : |
(* | the hash value of this term used in the term database. | *) |
|
in_db : |
(* | is this term in the database? | *) |
type term = private
| |
Var of |
(* | a variable | *) |
| |
Const of |
(* | a constant | *) |
| |
Func of |
(* | a function | *) |
type literal = private {
|
sign : |
(* | the sign/polarity | *) |
|
atom : |
(* | the atom | *) |
|
literal_in_db : |
(* | is this term in the database? | *) |
typeclause =literal list
module TermTable:Hashtbl.Swith type key = term
Hashtbl with terms as keys.
module LiteralTable:Hashtbl.Swith type key = literal
Hashtbl with literals as keys.
module ClauseTable:Hashtbl.Swith type key = clause
Hashtbl with clauses as keys.
module ClauseApproxTable:Hashtbl.Swith type key = clause
Hashtbl with clauses as keys.
module LiteralTypeTable:Hashtbl.Swith type key = literal
Hashtbl with literal types as keys,
that is not the concrete literal but it's sign and predicate symbol.
val true_literal : literalval false_literal : literalval null_term : termval null_literal : literalval assert_literal : literalContext_unifier).val init_literal : literalval plus_v : literalval minus_v : literalval v_par : varv_term.val v_term : termContext_unifier.extend_partial_context_unifier.val request_var : var -> termTerm.term.Var term from a database.
there might be different instances of the same variable Var.var in the system.
Still, as the first request to Term.request_var creates a database entry
for this specific instance of the variable,
and the following requests return this first stored instance,
all Term.term.Vars built on this variable are identical.
val request_const : symbol -> term
val request_func : ?insert_db:bool -> symbol * term array -> termTerm.term.Func term.
if insert_db is true (default: true) the term is inserted into the database,
if it is not already contained.val request_literal : ?insert_db:bool -> bool -> term -> literalTerm.literal.
if insert_db is true (default: true) the term is inserted into the database,
if it is not already contained.val insert_term : term -> termval insert_literal : literal -> literalTerm.insert_term.val request_negated_literal : ?insert_db:bool -> literal -> literalval request_skolemized_literal : literal -> literalval request_skolemized_clause : clause -> clause
val request_universal_term : term -> termval request_universal_literal : literal -> literal
val request_universal_clause : clause -> clause
val replace_term_in_term : term -> term -> term -> termreplace_in_term_term term sub_term replace_term
builds a new term from term by replacing
every occurrence of sub_term in term by replace_term.val replace_term_in_literal : literal -> term -> term -> literal
val replace_terms_in_term : term -> (term * term) list -> termTerm.replace_term_in_term, but for a number of terms simultaneously.val replace_terms_in_literal : literal -> (term * term) list -> literal
val replace_vars_in_term : term -> (var -> term -> term) -> termreplace_vars_in_term term map
like Term.replace_terms_in_term,
but a variable is replaced by a term by the function map.val replace_vars_in_literal : literal -> (var -> term -> term) -> literal
val remove_duplicates : literal list -> literal listval get_term_sort : term -> Symbol.sortval get_literal_sort : literal -> Symbol.sortval is_connection_literal : literal -> boolval is_fd_relation : literal -> boolval is_fd_size_marker : literal -> boolval is_fd_element : term -> boolval is_input_term : term -> boolval is_input_literal : literal -> bool
val is_fd_term : term -> boolSymbol.sort in FD_Relation, FD_Element, FD_Symbolval is_fd_literal : literal -> boolTerm.is_fd_termval is_skolem_free_term : term -> boolval is_skolem_free_literal : literal -> boolval hash_of_term : term -> intval hash_of_literal : literal -> intTerm.hash_of_term.val hash_of_clause : clause -> intTerm.hash_of_clause.val top_symbol_term : term -> symbolNot_found if term is of type Var.val top_symbol_literal : literal -> symbolTerm.top_symbol_term.val is_term_var : term -> boolVar?val is_literal_var : literal -> boolTerm.is_term_var.val vars_of_term : term -> var listval vars_of_literal : literal -> var listTerm.vars_of_term.val vars_of_clause : clause -> var listTerm.vars_of_literal.val term_contains_var : term -> var -> boolval literal_contains_var : literal -> var -> bool
val term_contains_term : term -> term -> boolterm_contains_term term contained is the term contained contained in the term term?val literal_contains_term : literal -> term -> bool
val is_term_ground : term -> boolval is_literal_ground : literal -> boolTerm.is_literal_var.val is_schema_term : term -> boolval create_schema_term : symbol -> termval create_schema_term_from_term : term -> termval is_definit : clause -> boolval is_Horn : clause -> boolval are_Horn : clause list -> boolval is_BS : clause -> boolval are_BS : clause list -> boolval contains_empty_clause : clause list -> boolval contains_equality : clause list -> boolval is_tautology : clause -> booltests for:
val term_equal : term -> term -> boolval literal_equal : literal -> literal -> boolval clause_equal : clause -> clause -> boolval clause_approx_equal : clause -> clause -> boolval compare_terms : term -> term -> intval compare_literals : literal -> literal -> intTerm.compare_terms.val sort_clause : clause -> clauseTerm.compare_literals.val are_terms_variants : term -> term -> boolval are_literals_variants : literal -> literal -> bool
val are_literals_skolem_variants : literal -> literal -> boolval remove_variants : literal list -> literal listval remove_duplicates : literal list -> literal listval tptp_get_domain_element : int -> termval tptp_replace_var : var -> termval to_tptp_term : term -> term
relational function terms of the from r(f, ...)
are replaced by f(...).
for r(x, ...), i.e. if there is no fd relation symbol f,
the function fails with an exception.
val term_to_string : ?pretty:bool -> term -> stringval literal_to_string : ?pretty:bool -> literal -> stringval clause_to_string : ?pretty:bool -> clause -> stringval tptp_clause_to_tptp_string : string -> clause -> stringtptp_clause_to_tptp_string label clause
transforms a clause into a tptp string representation.
label is the label of the clause, e.g. "flattened_0"