Module Fol


module Fol: sig .. end

Constants

Fol Variable definition



Constants



type constant =
| ConstInt of string
| ConstBool of bool
| ConstUnit
| ConstFloat of string
val c_bool : bool -> constant
val c_int_of_str : string -> constant
val c_int : int -> constant
val c_float_of_str : string -> constant
val c_float : float -> constant

Variables


module Var: sig .. end
Fol Variable definition
module Vset: Set.Make(Var)
module Vmap: Map.Make(Var)

Terms



type term =
| Tconst of constant
| Tvar of Var.t
| Tapp of string * term list
| Tgetfield of Cil_types.fieldinfo * term
| Tsetfield of Cil_types.fieldinfo * term * term
| Taccess of term * term
| Tupdate of term * term * term
| Tif of term * term * term
| Tlet of Var.t * term * term

Term comparison


val eq_terms : term -> term -> bool
structural equality

Term visitors


val e_has_var : (string * int option * 'a * 'b) list -> term -> bool
val e_closed : Var.t list -> term -> bool

Term smart constructors


val e_true : term
val e_false : term
val e_int : int -> term
val e_int64 : int64 -> term
val e_float : float -> term
val e_cnst : constant -> term
val e_var : Var.t -> term
val e_if : term -> term -> term -> term
val i_compute : (Big_int.big_int -> Big_int.big_int -> Big_int.big_int) ->
string -> string -> term
val i_apply : (Big_int.big_int -> Big_int.big_int) -> string -> term
val simpl : unit -> Wp_parameters.Simpl.t
val signed_in_bound : Big_int.big_int -> string -> 'a -> 'a -> 'a
val unsigned_in_bound : Big_int.big_int -> string -> 'a -> 'a -> 'a
val as_int_format : string -> string -> term
val as_int : string -> string -> term
val coercion : string -> string -> term -> term
val e_app : string -> term list -> term
val e_let : Var.t -> term -> term -> term
val case_of : term -> string option
val e_update : term -> term -> term -> term
val e_access : term -> term -> term
val e_setfield : Cil_types.fieldinfo -> term -> term -> term
val e_getfield : Cil_datatype.Fieldinfo.t -> term -> term

Term transformation


val change_in_exp : (Var.t -> term option) -> term -> term
Apply do_var in term subexpressions.
val term_replace : (Var.t -> Var.t option) ->
Var.t -> term -> term -> term
val alpha_bound_var : Vmap.key Vmap.t ->
Vmap.key -> Vmap.key option * Vmap.key Vmap.t
val alpha_unbound : 'a Vmap.t -> Vmap.key -> 'a option -> 'a Vmap.t
val apply_alpha : (string * int option * Formula.tau * 'a option) Vmap.t ->
Vmap.key ->
(string * int option * Formula.tau * 'a option) Vmap.t *
(string * int option * Formula.tau * 'a option)
val term_alpha_cv : Var.t Vmap.t -> term -> Var.t Vmap.t * term
val terms_alpha_cv : Var.t Vmap.t -> term list -> Var.t Vmap.t * term list

Predicates



type pred =
| Papp of string * term list
| Ptrue
| Pfalse
| Pimplies of pred * pred
| Pif of term * pred * pred
| Pand of pred * pred
| Por of pred * pred
| Piff of pred * pred
| Pnot of pred
| Pforall of Var.t * pred
| Pexists of Var.t * pred
| Plet of Var.t * term * pred
| Pnamed of string * pred
val eq_preds : pred -> pred -> bool
(partial) structural equality
val p_has_var : (string * int option * 'a * 'b) list -> pred -> bool
val p_closed : Var.t list -> pred -> bool

Predicates smart constructors


val pp_term : (Format.formatter -> term -> unit) Pervasives.ref
val i_compare : (Big_int.big_int -> Big_int.big_int -> bool) -> string -> string -> pred
val p_app : string -> term list -> pred
val val_of : pred -> pred
val cut : pred -> pred -> pred
val is_true : pred -> bool
val is_false : pred -> bool
val p_not : pred -> pred
val p_and : pred -> pred -> pred
val p_or : pred -> pred -> pred
val p_xor : pred -> pred -> pred
val p_implies : pred -> pred -> pred
val p_conj : pred list -> pred
val p_disj : pred list -> pred
val p_if : term -> pred -> pred -> pred
val p_iff : pred -> pred -> pred
val p_eq : term -> term -> pred
val p_neq : term -> term -> pred
val p_forall : Var.t -> pred -> pred
val p_exists : Var.t -> pred -> pred
val p_let : Var.t -> term -> pred -> pred
val p_named : string -> pred -> pred
val change_exp_in_pred : (term -> term) -> pred -> pred
apply do_exp on each sub expression of the predicate. quantif_do_exp is called to change do_exp if needed when we go under a quantification. This version makes possible to have a different flavor of term, ie. it can be used for translation. TODOopt: we could have another optimized version if the types of terms are the same in order to avoid building new terms when there is no modification.
val no_quantif_do_exp : (term -> term) -> Var.t -> term -> term
val pred_alpha_cv : Var.t Vmap.t -> pred -> Var.t Vmap.t * pred
pred_alpha_c data_alpha alpha p -> alpha', p'
val p_alpha_cv : pred -> Var.t list * pred
val change_exp_in_pred : (term -> term) -> pred -> pred
val subst_vars_in_pred : (Var.t -> term option) -> pred -> pred
Similar to change_vars_in_exp but on predicates. Notice that we assume (and check) that var_subst only works on free variables (and that they are different from bounded ones).
val subst_in_pred : string * int option * 'a * 'b -> term -> pred -> pred
Specialized version of subst_vars_in_pred to substitute one variable v by and expression exp in a predicate p.
val let_pred : fresh:bool -> Var.t -> term -> pred -> pred
Build a predicate equivalent to let v = e in p but may use the substitution in some simple cases (like substitute a variable by another variable for instance). fresh is only meaningfull when the let is actually built: it tells if we have to build a new variable for v.
val pred_replace : (Var.t -> Var.t option) ->
Var.t -> term -> pred -> pred
val fresh_vars_in_pred : (string * int option * Formula.tau * 'a) list ->
pred -> (string * int option * Formula.tau * 'b option) list * pred
val p_forall_vars : (string * int option * Formula.tau * 'a) list -> pred -> pred
val p_exists_vars : (string * int option * Formula.tau * 'a) list -> pred -> pred
val term_calls : string -> term -> bool
val pred_calls : string -> pred -> bool
exception Huge
val check_term : int -> term -> int
val check_pred : int -> pred -> int
val huge_term : int -> term -> bool
val huge_pred : int -> pred -> bool
type decl = (Var.t, term, pred) Formula.declaration