package colibri2
include module type of struct include Dolmen_std.Expr.Term end
type t = Dolmen_std.Expr.term
The type of terms and term variables.
type ty = Dolmen_std.Expr.Ty.t
type ty_var = Dolmen_std.Expr.Ty.Var.t
type ty_const = Dolmen_std.Expr.Ty.Const.t
The representation of term types, type variables, and type constants.
type subst =
(Dolmen_std.Expr.term_var, Dolmen_std.Expr.term) Dolmen_std.Expr.Subst.t
The type of substitutions over terms.
type 'a tag = 'a Dolmen_std.Tag.t
The type of tags used to annotate arbitrary terms.
val hash : t -> int
Hash function.
val print : Stdlib.Format.formatter -> t -> unit
Printing function.
val get_tag : t -> 'a Dolmen_std.Tag.t -> 'a option
Get the value bound to a tag.
val get_tag_list : t -> 'a list Dolmen_std.Tag.t -> 'a list
Get the list of values bound to a list tag, returning the empty list if no value is bound.
val get_tag_last : t -> 'a list Dolmen_std.Tag.t -> 'a option
Get the last value bound to a list tag.
val set_tag : t -> 'a Dolmen_std.Tag.t -> 'a -> unit
Set the value bound to the tag.
val add_tag : t -> 'a list Dolmen_std.Tag.t -> 'a -> unit
Bind an additional value to a list tag.
val add_tag_opt : t -> 'a list Dolmen_std.Tag.t -> 'a option -> unit
Optionally bind an additional value to a list tag.
val add_tag_list : t -> 'a list Dolmen_std.Tag.t -> 'a list -> unit
Bind a list of additional values to a list tag.
val unset_tag : t -> _ Dolmen_std.Tag.t -> unit
Remove the binding to the given tag.
module Cstr = Dolmen_std.Expr.Term.Cstr
A module for Algebraic datatype constructors.
module Field = Dolmen_std.Expr.Term.Field
A module for Record fields.
val define_record :
ty_const ->
ty_var list ->
(Dolmen_std.Path.t * ty) list ->
Field.t list
Define a new record type.
val define_adt :
ty_const ->
ty_var list ->
(Dolmen_std.Path.t * (ty * Dolmen_std.Path.t option) list) list ->
(Cstr.t * (ty * Dolmen_std.Expr.Term.Const.t option) list) list
define_aft t vars cstrs
defines the type constant t
, parametrised over the type variables ty_vars
as defining an algebraic datatypes with constructors cstrs
. cstrs
is a list where each elements of the form (name, l)
defines a new constructor for the algebraic datatype, with the given name. The list l
defines the arguments to said constructor, each element of the list giving the type ty
of the argument expected by the constructor (which may contain any of the type variables in vars
), as well as an optional destructor name. If the construcotr name is Some s
, then the ADT definition also defines a function that acts as destructor for that particular field. This polymorphic function is expected to takes as arguments as many types as there are variables in vars
, an element of the algebraic datatype being defined, and returns a value for the given field. For instance, consider the following definition for polymorphic lists: define_adt list [ty_var_a] [
"nil", [];
"const", [
(Ty.of_var ty_var_a , Some "hd");
(ty_list_a , Some "tl");
];
]
This definition defines the usual type of polymorphic linked lists, as well as two destructors "hd" and "tl". "hd" would have type forall alpha. alpha list -> a
, and be the partial function returning the head of the list.
Exception raised in case of typing error during term construction. Wrong_type (t, ty)
should be raised by term constructor functions when some term t
is expected to have type ty
, but does not have that type.
Raised when some constructor was expected to belong to some type but does not belong to the given type.
Exception raised in case of typing error during term construction. This should be raised when the returned field was expected to be a field for the returned record type constant, but it was of another record type.
exception Field_repeated of Field.t
Field repeated in a record expression.
exception Field_missing of Field.t
Field missing in a record expression.
exception Field_expected of Dolmen_std.Expr.term_cst
A field was expected but the returned term constant is not a record field.
exception Pattern_expected of t
Raised when trying to create a pattern matching, but a non-pattern term was provided where a pattern was expected.
Raise when creating a pattern matching but an empty list of branches was provided
exception Partial_pattern_match of t list
Raised when a partial pattern matching was created. A list of terms not covered by the patterns is provided.
exception Constructor_expected of Cstr.t
Raised when trying to access the tester of an ADT constructor, but the constant provided was not a constructor.
exception Over_application of t list
Raised when an application was provided too many term arguments. The extraneous arguments are returned by the exception.
Raised when a polymorphic application does not have an adequate number of arguments.
val of_var : Dolmen_std.Expr.Term.Var.t -> t
Create a term from a variable
val of_cst : Dolmen_std.Expr.Term.Const.t -> t
Create a term from a constant.
val apply_cst : Dolmen_std.Expr.term_cst -> ty list -> t list -> t
Polymorphic application of a constructor.
val pattern_match :
?redundant:(Dolmen_std.Expr.pattern -> unit) ->
t ->
(Dolmen_std.Expr.pattern * t) list ->
t
Create a pattern match.
val void : t
The only inhabitant of type unit.
val _true : t
val _false : t
Some usual formulas.
val int : string -> t
val rat : string -> t
val real : string -> t
Real literals
val lam : (ty_var list * Dolmen_std.Expr.Term.Var.t list) -> t -> t
Create a local function. The first pair of arguments are the variables that are free in the resulting quantified formula, and the second pair are the variables bound.
val all : (ty_var list * Dolmen_std.Expr.Term.Var.t list) -> t -> t
Universally quantify the given formula over the type and terms variables. The first pair of arguments are the variables that are free in the resulting quantified formula, and the second pair are the variables bound.
val ex : (ty_var list * Dolmen_std.Expr.Term.Var.t list) -> t -> t
Existencially quantify the given formula over the type and terms variables. The first pair of arguments are the variables that are free in the resulting quantified formula, and the second pair are the variables bound.
val bind : Dolmen_std.Expr.Term.Var.t -> t -> t
Tag the given variable with the term, to mark it has been let-bound. Views might use that information to transparently replace a let-bound variable with its defining term.
val letin : (Dolmen_std.Expr.Term.Var.t * t) list -> t -> t
Sequential let-binding. Variables can be bound to either terms or formulas.
val letand : (Dolmen_std.Expr.Term.Var.t * t) list -> t -> t
Parrallel let-binding. Variables can be bound to either terms or formulas.
val fv : t -> ty_var list * Dolmen_std.Expr.Term.Var.t list
Returns the list of free variables in the formula.
val subst : ?fix:bool -> Dolmen_std.Expr.Ty.subst -> subst -> t -> t
Substitution over terms.
val maps_to : Dolmen_std.Expr.Term.Var.t -> t -> t
Variable mapping to term.
module Array = Dolmen_std.Expr.Term.Array
module Bitv = Dolmen_std.Expr.Term.Bitv
module Float = Dolmen_std.Expr.Term.Float
module Int = Dolmen_std.Expr.Term.Int
Integer operations.
module Rat = Dolmen_std.Expr.Term.Rat
Rational operations
module Real = Dolmen_std.Expr.Term.Real
Real operations
module String = Dolmen_std.Expr.Term.String
String operations
val pp : Stdlib.Format.formatter -> t -> unit
module Const : sig ... end
module Var : sig ... end
val free_vars : (Ty.Var.S.t * Var.S.t) -> t -> Ty.Var.S.t * Var.S.t