Nuscrlib.Expr
Expressions, used in RefinementTypes
pragma
An expression, used in RefinementType extension
type t = | Var of VariableName.t (** A variable *) | Int of int (** An integer constant *) | Bool of bool (** An boolean constant *) | String of string (** A string literal *) | Binop of binop * t * t (** A binary operator *) | Unop of unop * t (** An unary operator *)
val sexp_of_t : t -> Sexplib0.Sexp.t
val show : t -> Base.string
val free_var : t -> Base.Set.M(Nuscrlib__.Names.VariableName).t
Get free variables in an expression
val substitute : from:Names.VariableName.t -> replace:t -> t -> t
Perform substitutions on an expression
module Sexp : sig ... end
An modified S-expression library that distinguishes literal strings and * atoms
type payload_type =
| PTInt | (* A type for integers *) |
| PTBool | (* A type for booleans *) |
| PTString | (* A type for strings *) |
| PTUnit | (* A type for units *) |
| PTAbstract of Names.PayloadTypeName.t | (* A type for other un-modelled payloads, e.g. custom types *) |
| PTRefined of Names.VariableName.t * payload_type * t | (* A refined types, |
Types for expressions. Integers, booleans and strings are are modelled, and can be thus refined with RefinementTypes extension
val equal_payload_type :
payload_type ->
payload_type ->
Ppx_deriving_runtime.bool
val compare_payload_type :
payload_type ->
payload_type ->
Ppx_deriving_runtime.int
val sexp_of_payload_type : payload_type -> Sexplib0.Sexp.t
val show_payload_type : payload_type -> Base.string
val payload_typename_of_payload_type : payload_type -> Names.PayloadTypeName.t
Extract PayloadTypeName
from a payload_type
val smt_sort_of_type : payload_type -> Base.string
Get the SMT sort of a payload_type
val default_value : payload_type -> t
Get the default value of a payload type, which may not exist.
val parse_typename : Names.PayloadTypeName.t -> payload_type
Convert a PayloadTypeName to a payload_type
val new_typing_env : typing_env
val is_well_formed_type : typing_env -> payload_type -> Base.bool
Check whether a payload type is well-formed under the typing context
val ensure_satisfiable : typing_env -> Base.unit
Validate whether the typing context is satisfiable, i.e. it does not contain in consistencies
val env_append :
typing_env ->
Names.VariableName.t ->
payload_type ->
typing_env
Append an new entry into typing context
val check_type : typing_env -> t -> payload_type -> Base.bool
Check whether an expression can be assigned a provided type under a typing context
val add_assert_s_expr : Sexp.t -> smt_script -> smt_script
Add an assertion into a SMT script
val encode_env : typing_env -> smt_script
Encode a typing context into a SMT script
val check_sat : smt_script -> [ `Sat | `Unsat | `Unknown ]
Invoke SMT solver on an SMT script