Module Biabduction.Prop
type pi= Predicates.atom listtype sigma= Predicates.hpred listtype 'a t= private{sigma : sigma;spatial part
sub : Predicates.subst;substitution
pi : pi;pure part
sigma_fp : sigma;abduced spatial part
pi_fp : pi;abduced pure part
}the kind 'a should range over
normalandexposed
type struct_init_mode=|No_init|Fld_inittype to describe different strategies for initializing fields of a structure.
No_initdoes not initialize any fields of the struct.Fld_initinitializes the fields of the struct with fresh variables (C) or default values (Java).
Basic Functions for propositions
val has_footprint : 'a t -> boolsigma_fp is nonempty or pi_fp is nonempty
val d_sub : Predicates.subst -> unitDump a substitution.
val pp_pi : IStdlib.Pp.env -> Stdlib.Format.formatter -> pi -> unitPretty print a pi.
val d_pi : pi -> unitDump a pi.
val d_sigma : sigma -> unitDump a sigma.
val sigma_get_stack_nonstack : bool -> sigma -> sigma * sigmaSplit sigma into stack and nonstack parts. The boolean indicates whether the stack should only include local variales.
val prop_update_obj_sub : IStdlib.Pp.env -> 'a t -> IStdlib.Pp.envUpdate the object substitution given the stack variables in the prop
val pp_prop : IStdlib.Pp.env -> Stdlib.Format.formatter -> 'a t -> unitPretty print a proposition.
val prop_pred_env : 'a t -> Predicates.Env.tCreate a predicate environment for a prop
val d_prop : 'a t -> unitDump a proposition.
val d_proplist_with_typ : 'a t list -> unitval max_stamp : ?f:(IR.Ident.t -> bool) -> normal t -> intval pi_free_vars : pi -> IR.Ident.t IStdlib.IStd.Sequence.tval sigma_free_vars : sigma -> IR.Ident.t IStdlib.IStd.Sequence.tval free_vars : normal t -> IR.Ident.t IStdlib.IStd.Sequence.tval gen_free_vars : normal t -> (unit, IR.Ident.t) IStdlib.IStd.Sequence.Generator.tval sorted_gen_free_vars : sorted t -> (unit, IR.Ident.t) IStdlib.IStd.Sequence.Generator.tval non_pure_free_vars : normal t -> IR.Ident.t IStdlib.IStd.Sequence.tval dfs_sort : IR.Tenv.t -> normal t -> sorted tval pi_sub : Predicates.subst -> Predicates.atom list -> Predicates.atom listApply substitution for pi
val sigma_sub : Predicates.subst -> Predicates.hpred list -> Predicates.hpred listApply subsitution for sigma
val prop_sub : Predicates.subst -> 'a t -> exposed tApply subsitution to prop. Result is not normalized.
val prop_expmap : (IR.Exp.t -> IR.Exp.t) -> 'a t -> exposed tApply the substitution to all the expressions in the prop.
val sigma_replace_exp : IR.Tenv.t -> (IR.Exp.t * IR.Exp.t) list -> Predicates.hpred list -> Predicates.hpred listRelaces all expressions in the
hpred listusing the first argument. Assume that the first parameter defines a partial function. No expressions inside hpara are replaced.
Normalization
val mk_inequality : IR.Tenv.t -> IR.Exp.t -> Predicates.atomTurn an inequality expression into an atom
val atom_is_inequality : Predicates.atom -> boolReturn
trueif the atom is an inequality
val atom_exp_le_const : Predicates.atom -> (IR.Exp.t * IR.IntLit.t) optionIf the atom is
e<=nreturne,n
val atom_const_lt_exp : Predicates.atom -> (IR.IntLit.t * IR.Exp.t) optionIf the atom is
n<ereturnn,e
val exp_normalize_prop : ?destructive:bool -> IR.Tenv.t -> 'a t -> IR.Exp.t -> IR.Exp.tNormalize
expusing the pure part ofprop. Later, we should change this such that the normalization exposes offsets ofexpas much as possible.If
destructiveis true then normalize more aggressively, which may lose some useful structure or types.
val exp_normalize_noabs : IR.Tenv.t -> Predicates.subst -> IR.Exp.t -> IR.Exp.tNormalize the expression without abstracting complex subexpressions
val exp_collapse_consecutive_indices_prop : IR.Typ.t -> IR.Exp.t -> IR.Exp.tCollapse consecutive indices that should be added. For instance, this function reduces
x[1][1]tox[2]. Thetypargument is used to ensure the soundness of this collapsing.
val lexp_normalize_prop : IR.Tenv.t -> 'a t -> IR.Exp.t -> IR.Exp.tNormalize
expused for the address of a heap cell. This normalization does not combine two offsets insideexp.
val atom_normalize_prop : IR.Tenv.t -> 'a t -> Predicates.atom -> Predicates.atomval sigma_normalize_prop : IR.Tenv.t -> 'a t -> Predicates.hpred list -> Predicates.hpred listval normalize : IR.Tenv.t -> exposed t -> normal tnormalize a prop
Compaction
val prop_compact : Predicates.sharing_env -> normal t -> normal tReturn a compact representation of the prop
Queries about propositions
val prop_is_emp : 'a t -> boolCheck if the sigma part of the proposition is emp
Functions for changing and generating propositions
val mk_neq : IR.Tenv.t -> IR.Exp.t -> IR.Exp.t -> Predicates.atomConstruct a disequality.
val mk_eq : IR.Tenv.t -> IR.Exp.t -> IR.Exp.t -> Predicates.atomConstruct an equality.
val mk_pred : IR.Tenv.t -> IR.PredSymb.t -> IR.Exp.t list -> Predicates.atomConstruct a positive pred.
val mk_npred : IR.Tenv.t -> IR.PredSymb.t -> IR.Exp.t list -> Predicates.atomConstruct a negative pred.
val create_strexp_of_type : IR.Tenv.t -> struct_init_mode -> IR.Typ.t -> IR.Exp.t option -> Predicates.inst -> Predicates.strexpcreate a strexp of the given type, populating the structures if
expand_structsis true
val mk_ptsto : IR.Tenv.t -> IR.Exp.t -> Predicates.strexp -> IR.Exp.t -> Predicates.hpredConstruct a pointsto.
val mk_ptsto_exp : IR.Tenv.t -> struct_init_mode -> (IR.Exp.t * IR.Exp.t * IR.Exp.t option) -> Predicates.inst -> Predicates.hpredConstruct a points-to predicate for an expression using either the provided expression
nameas base for fresh identifiers.
val mk_ptsto_lvar : IR.Tenv.t -> struct_init_mode -> Predicates.inst -> (IR.Pvar.t * IR.Exp.t * IR.Exp.t option) -> Predicates.hpredConstruct a points-to predicate for a single program variable. If
expand_structsis true, initialize the fields of structs with fresh variables.
val mk_lseg : IR.Tenv.t -> Predicates.lseg_kind -> Predicates.hpara -> IR.Exp.t -> IR.Exp.t -> IR.Exp.t list -> Predicates.hpredConstruct a lseg predicate
val mk_dllseg : IR.Tenv.t -> Predicates.lseg_kind -> Predicates.hpara_dll -> IR.Exp.t -> IR.Exp.t -> IR.Exp.t -> IR.Exp.t -> IR.Exp.t list -> Predicates.hpredConstruct a dllseg predicate
val prop_reset_inst : (Predicates.inst -> Predicates.inst) -> 'a t -> exposed tReset every inst in the prop using the given map
val prop_hpred_star : 'a t -> Predicates.hpred -> exposed tConjoin a heap predicate by separating conjunction.
val prop_sigma_star : 'a t -> Predicates.hpred list -> exposed tConjoin a list of heap predicates by separating conjunction
val prop_atom_and : IR.Tenv.t -> ?footprint:bool -> normal t -> Predicates.atom -> normal tConjoin a pure atomic predicate by normal conjunction.
val conjoin_eq : IR.Tenv.t -> ?footprint:bool -> IR.Exp.t -> IR.Exp.t -> normal t -> normal tConjoin
exp1=exp2with a symbolic heapprop.
val conjoin_neq : IR.Tenv.t -> ?footprint:bool -> IR.Exp.t -> IR.Exp.t -> normal t -> normal tConjoin
exp1!=exp2with a symbolic heapprop.
val get_pure : 'a t -> Predicates.atom listReturn the pure part of
prop.
Functions for existentially quantifying and unquantifying variables
val exist_quantify : IR.Tenv.t -> ?ids_queue:unit IR.Ident.HashQueue.t -> IR.Ident.t list -> normal t -> normal tExistentially quantify the
idsinprop.
val prop_normal_vars_to_primed_vars : IR.Tenv.t -> normal t -> normal tconvert the footprint vars to primed vars.
Prop iterators
val prop_iter_create : normal t -> unit prop_iter optionCreate an iterator, return None if sigma part is empty.
val prop_iter_to_prop : IR.Tenv.t -> 'a prop_iter -> normal tReturn the prop associated to the iterator.
val prop_iter_add_atom : bool -> 'a prop_iter -> Predicates.atom -> 'a prop_iterAdd an atom to the pi part of prop iter. The first parameter records whether it is done during footprint or during re - execution.
val prop_iter_remove_curr_then_to_prop : IR.Tenv.t -> 'a prop_iter -> normal tRemove the current element from the iterator, and return the prop associated to the resulting iterator.
val prop_iter_current : IR.Tenv.t -> 'a prop_iter -> Predicates.hpred * 'aReturn the current hpred and state.
val prop_iter_update_current : 'a prop_iter -> Predicates.hpred -> 'a prop_iterUpdate the current element of the iterator.
val prop_iter_prev_then_insert : 'a prop_iter -> Predicates.hpred -> 'a prop_iterInsert before the current element of the iterator.
val prop_iter_max_stamp : ?f:(IR.Ident.t -> bool) -> 'a prop_iter -> intFind the maximum stamp of a free variable of a certain kind.
val prop_iter_get_footprint_sigma : 'a prop_iter -> Predicates.hpred listExtract the sigma part of the footprint
val prop_iter_replace_footprint_sigma : 'a prop_iter -> Predicates.hpred list -> 'a prop_iterReplace the sigma part of the footprint
val prop_iter_find : unit prop_iter -> (Predicates.hpred -> 'a option) -> 'a prop_iter optionScan sigma to find an
hpredsatisfying the filter function.
val prop_iter_update_current_by_list : 'a prop_iter -> Predicates.hpred list -> unit prop_iterUpdate the current element of the iterator by a nonempty list of elements.
val prop_iter_make_id_primed : IR.Tenv.t -> IR.Ident.t -> 'a prop_iter -> 'a prop_iterRename
identiniterby a fresh primed identifier
Internal modules
module Metrics : sig ... endmodule CategorizePreconditions : sig ... end