Module Opt


module Opt: sig .. end
Data structures used for optimization.


type bound =
| Free
| Bound
type binding_pattern = bound array 
val binding_pattern_covers : binding_pattern -> binding_pattern -> bool
True iff the first binding pattern is stronger or equal to the second, in each position, where Ground is stronger than Bound and Bound is stronger than Free.

Both arguments are assumed to have the same length.


type mode =
| InputGround (*A parameter that must be ground at input time.*)
| OutputGround (*A parameter that will be bound to a ground term at output time.*)
| OutputFree (*A parameter that may be nonground at output time.*)
type mode_specifier = mode array 
type discrimination_value = float 
Used as hint for optimizations. A float between 0.0 and 1.0. It estimates for an argument position:

NumberOfDifferentArgumentValues/PredicateSize

(### Maybe use a different formula, that is better suited for combination of values - ask a statistican.)

So, an argument corresonding to a key attribute has a discrimination value of 1.0. An argument which has the same value for the whole relation has a discrimination value of 0.0.

type discrimination_values = discrimination_value array 
Array of discrimination values corresponding to the arguments of a predicate.
val compute_discrimination_hint : binding_pattern -> discrimination_values -> discrimination_value
val make_default_discrimination_hints : int -> discrimination_values
type applicability_value = float 
Between 0.0 and 1.0.

type proof =
| BuiltinProof
| UnknownProof
Specifies the dependency of builtin predicates.

type predicate_kind =
| Edb (*Consists only of facts (i.e. unit clauses).*)
| Idb (*Consists of facts and/or rules (i.e. may have non-unit clauses).*)
| BuiltIn (*Built-in predicate.*)
Specifiers for different kinds of predicates.

type indexargs =
| WholeTerm
| Argument of int (*Argument position starting at 0 from left.*)
| Arguments of int array (*Argument positions starting at 0 from left.*)
Specifiers for arguments to be indexed.

type indextype =
| HashDt
| AlistDt
| NoIndex
Specifiers for index types.

type declaration =
| DiscriminationHintsDecl of discrimination_values
| IndexDecl of indextype * indexargs
| ModeDecl of mode_specifier