package dolmen
Module Dolmen_std.BuiltinSource
This module defines the builtins that are defined by Dolmen.
Builtins are particularly used in typed expressions see Dolmen.Std.Expr, in order to give more information about constants which have builtin semantics.
Users are encouraged to match builtins rather than specific symbols when inspecting typed expressions, as this basically allows to match on the semantics of an identifier rather than matching on the syntaxic value of an identifier. For instance, equality can take an arbitrary number of arguments, and thus in order to have well-typed terms, each arity of equality gives rise to a different symbol (because the symbol's type depends on the arity desired), but all these symbols have the Equal builtin.
In the following we will use pseudo-code to describe the arity and actual type associated to builtins. These will follow ocaml's notation for types with an additional syntax using dots for arbitrary arity. Some examples:
ttypeis a type constantttype -> ttypeis a type constructor (e.g.list)intis a constant of typeintfloat -> intis a unary function'a. 'a -> 'ais a polymorphic unary function'a. 'a -> ... -> Prop.Tdescribes a family of functions that take a type and then an arbitrary number of arguments of that type, and return a proposition (this is for instance the type of equality).
Additionally, due to some languages having overloaded operators, and in order to not have too verbose names, some of these builtins may have overloaded signtures, such as comparisons on numbers which can operate on integers, rationals, or reals. Note that arbitrary arity operators (well family of operators) can be also be seen as overloaded operators. Overloaded types (particularly for numbers) are written:
{a=(Int|Rational|Real)} a -> a -> Prop.T, where the notable difference with polymorphic functions is that functions of this type does not take a type argument.
Type definition
Base Builtins
type t += | Coercion(*
*)Coercion: 'a 'b. 'a -> 'b: Coercion/cast operator, i.e. allows to cast values of some type to another type. This is a polymorphic operator that takes two type argumentsaandb, a value of typea, and returns a value of typeb. The interpretation/semantics of this cast can remain up to the user. This operator is currently mainly used to cast numeric types when this transormation is exact (i.e. an integer casted into a rational, which is always possible and exact, or the cast of a rational into an integer, as long as the cast is guarded by a clause verifying the rational is an integer).
type t += | Multi_trigger(*
*)Multi_trigger: 'a1 ... 'an. 'a1 -> ... -> 'an -> Prop.T: Create a multi trigger: it takes an arbitrarily long list of terms of arbitrary types.| Maps_to(*Maps_to: 'term_var -> 'term -> Prop.T: Used in semantic triggers for floating point arithmetic. Seealt-ergo/src/preludes/fpa-theory-2017-01-04-16h00.ae.
*)warning:It is an Alt-Ergo semantic trigger that should only be allowed inside theories.| Semantic_trigger(*
*)Semantic_trigger: Prop.T -> Prop.T: Denote that its argument is a semantic trigger (used only by Alt-ergo currently).
Boolean Builtins
Algebraic datatype Builtins
HOL encoding Builtins
Arithmetic Builtins
Arrays Builtins
Bitvectors Builtins
Floats Builtins
String and Regexp Builtins
type t += | Str of 'a Str.t(*String builtins
*)| Regexp of 'a Str.RegLan.t(*String Regular language builtins, aka regexps.
*)