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.S
with type key = term
Hashtbl
with terms as keys.
module LiteralTable:Hashtbl.S
with type key = literal
Hashtbl
with literals as keys.
module ClauseTable:Hashtbl.S
with type key = clause
Hashtbl
with clauses as keys.
module ClauseApproxTable:Hashtbl.S
with type key = clause
Hashtbl
with clauses as keys.
module LiteralTypeTable:Hashtbl.S
with 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 : literal
val false_literal : literal
val null_term : term
val null_literal : literal
val assert_literal : literal
Context_unifier
).val init_literal : literal
val plus_v : literal
val minus_v : literal
val v_par : var
v_term
.val v_term : term
Context_unifier.extend_partial_context_unifier
.val request_var : var -> term
Term.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
.Var
s built on this variable are identical.
val request_const : symbol -> term
val request_func : ?insert_db:bool -> symbol * term array -> term
Term.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 -> literal
Term.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 -> term
val insert_literal : literal -> literal
Term.insert_term
.val request_negated_literal : ?insert_db:bool -> literal -> literal
val request_skolemized_literal : literal -> literal
val request_skolemized_clause : clause -> clause
val request_universal_term : term -> term
val request_universal_literal : literal -> literal
val request_universal_clause : clause -> clause
val replace_term_in_term : term -> term -> term -> term
replace_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 -> term
Term.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) -> term
replace_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 list
val get_term_sort : term -> Symbol.sort
val get_literal_sort : literal -> Symbol.sort
val is_connection_literal : literal -> bool
val is_fd_relation : literal -> bool
val is_fd_size_marker : literal -> bool
val is_fd_element : term -> bool
val is_input_term : term -> bool
val is_input_literal : literal -> bool
val is_fd_term : term -> bool
Symbol.sort
in FD_Relation, FD_Element, FD_Symbolval is_fd_literal : literal -> bool
Term.is_fd_term
val is_skolem_free_term : term -> bool
val is_skolem_free_literal : literal -> bool
val hash_of_term : term -> int
val hash_of_literal : literal -> int
Term.hash_of_term
.val hash_of_clause : clause -> int
Term.hash_of_clause
.val top_symbol_term : term -> symbol
Not_found
if term is of type Var
.val top_symbol_literal : literal -> symbol
Term.top_symbol_term
.val is_term_var : term -> bool
Var
?val is_literal_var : literal -> bool
Term.is_term_var
.val vars_of_term : term -> var list
val vars_of_literal : literal -> var list
Term.vars_of_term
.val vars_of_clause : clause -> var list
Term.vars_of_literal
.val term_contains_var : term -> var -> bool
val literal_contains_var : literal -> var -> bool
val term_contains_term : term -> term -> bool
term_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 -> bool
val is_literal_ground : literal -> bool
Term.is_literal_var
.val is_schema_term : term -> bool
val create_schema_term : symbol -> term
val create_schema_term_from_term : term -> term
val is_definit : clause -> bool
val is_Horn : clause -> bool
val are_Horn : clause list -> bool
val is_BS : clause -> bool
val are_BS : clause list -> bool
val contains_empty_clause : clause list -> bool
val contains_equality : clause list -> bool
val is_tautology : clause -> bool
tests for:
val term_equal : term -> term -> bool
val literal_equal : literal -> literal -> bool
val clause_equal : clause -> clause -> bool
val clause_approx_equal : clause -> clause -> bool
val compare_terms : term -> term -> int
val compare_literals : literal -> literal -> int
Term.compare_terms
.val sort_clause : clause -> clause
Term.compare_literals
.val are_terms_variants : term -> term -> bool
val are_literals_variants : literal -> literal -> bool
val are_literals_skolem_variants : literal -> literal -> bool
val remove_variants : literal list -> literal list
val remove_duplicates : literal list -> literal list
val tptp_get_domain_element : int -> term
val tptp_replace_var : var -> term
val 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 -> string
val literal_to_string : ?pretty:bool -> literal -> string
val clause_to_string : ?pretty:bool -> clause -> string
val tptp_clause_to_tptp_string : string -> clause -> string
tptp_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"