Module Logic_ptree


module Logic_ptree: sig .. end
logic types.


type logic_type =
| LTvoid (*C void*)
| LTinteger (*mathematical integers.*)
| LTreal (*mathematical real.*)
| LTint of Cil_types.ikind (*C integral type.*)
| LTfloat of Cil_types.fkind (*C floating-point type*)
| LTarray of logic_type (*C array*)
| LTpointer of logic_type (*C pointer*)
| LTenum of string (*C enum*)
| LTstruct of string (*C struct*)
| LTunion of string (*C union*)
| LTnamed of string * logic_type list (*declared logic type.*)
logic types.
type quantifiers = (logic_type * string) list 
quantifier-bound variables

type constant =
| IntConstant of string (*integer constant*)
| FloatConstant of string (*real constant*)
| StringConstant of string (*string constant*)
| WStringConstant of string (*wide string constant*)
logic constants.

type relation =
| Lt
| Gt
| Le
| Ge
| Eq
| Neq
comparison operators.

type binop =
| Badd
| Bsub
| Bmul
| Bdiv
| Bmod
| Bbw_and
| Bbw_or
| Bbw_xor
| Blshift
| Brshift
arithmetic and logic binary operators.

type unop =
| Uminus
| Ustar
| Uamp
| Ubw_not
unary operators.

type lexpr = {
   lexpr_node : lexpr_node; (*kind of expression.*)
   lexpr_loc : Cil_types.location; (*position in the source code.*)
}
logical expression. The distinction between locations, terms and predicate is done during typing.

type lexpr_node =
| PLvar of string (*a variable*)
| PLapp of string * string list * lexpr list (*an application.*)
| PLlambda of (logic_type * string) list * lexpr (*a lambda abstraction.*)
| PLconstant of constant (*a constant.*)
| PLunop of unop * lexpr (*unary operator.*)
| PLbinop of lexpr * binop * lexpr (*binary operator.*)
| PLdot of lexpr * string (*field access ()*)
| PLarrow of lexpr * string (*field access ()*)
| PLarrget of lexpr * lexpr (*array access.*)
| PLold of lexpr (*expression refers to pre-state of a function.*)
| PLat of lexpr * string (*expression refers to a given program point.*)
| PLbase_addr of lexpr (*base address of a pointer.*)
| PLblock_length of lexpr (*length of the block pointed to by an expression.*)
| PLresult (*value returned by a function.*)
| PLnull (*null pointer.*)
| PLcast of logic_type * lexpr (*cast.*)
| PLrange of lexpr option * lexpr option (*interval of integers.*)
| PLsizeof of logic_type (*sizeof a type.*)
| PLsizeofE of lexpr (*sizeof the type of an expression.*)
| PLcoercion of lexpr * logic_type (*coercion of an expression in a given type.*)
| PLcoercionE of lexpr * lexpr (*coercion of the first expression into the type of the second one.*)
| PLupdate of lexpr * string * lexpr (*functional update of the field of a structure.*)
| PLtypeof of lexpr (*type tag for an expression.*)
| PLtype of logic_type (*type tag for a C type.*)
| PLfalse (*false (either as a term or a predicate.*)
| PLtrue (*true (either as a term or a predicate.*)
| PLrel of lexpr * relation * lexpr (*comparison operator.*)
| PLand of lexpr * lexpr (*conjunction.*)
| PLor of lexpr * lexpr (*disjunction.*)
| PLxor of lexpr * lexpr (*logical xor.*)
| PLimplies of lexpr * lexpr (*implication.*)
| PLiff of lexpr * lexpr (*equivalence.*)
| PLnot of lexpr (*negation.*)
| PLif of lexpr * lexpr * lexpr (*conditional operator.*)
| PLforall of quantifiers * lexpr (*universal quantification.*)
| PLexists of quantifiers * lexpr (*existential quantification.*)
| PLvalid of lexpr (*pointer is valid.*)
| PLvalid_index of lexpr * lexpr (*PLvalid_index(p,i) indicates that accessing the ith element of p is valid.*)
| PLvalid_range of lexpr * lexpr * lexpr (*same as PLvalid_index, but for a range of indices.*)
| PLseparated of lexpr list (*separation predicate.*)
| PLfresh of lexpr (*expression points to a newly allocated block.*)
| PLnamed of string * lexpr (*named expression.*)
| PLsubtype of lexpr * lexpr (*first type tag is a subtype of second one.*)
| PLcomprehension of lexpr * quantifiers * lexpr option (*set of expression defined in comprehension ()*)
| PLunion of lexpr list (*union of sets.*)
| PLinter of lexpr list (*intersection of sets.*)
| PLempty (*empty set.*)
kind of expression.

type type_annot = {
   inv_name : string;
   this_type : logic_type;
   this_name : string; (*name of its argument.*)
   inv : lexpr;
}
type invariant.

type decl =
| LDlogic_def of string * string list * string list * logic_type
* (logic_type * string) list * lexpr
(*LDlogic_def(name,labels,type_params, return_type, parameters, definition) represents the definition of a logic function name whose return type is return_type and arguments are parameters. Its label arguments are labels. Polymorphic functions have their type parameters in type_params. definition is the body of the defined function.*)
| LDlogic_reads of string * string list * string list * logic_type
* (logic_type * string) list * lexpr list
(*OBSOLETE ??? LDlogic_reads(name,labels,type_params, return_type, parameters, reads_tsets) represents the declaration of logic function. It has the same arguments as LDlogic_def, except that the definition is abstracted to a set of read accesses in read_tsets.*)
| LDtype of string * string list * (string * logic_type list) list option (*new logic type and its parameters, optionally followed by a list of data constructors.*)
| LDpredicate_reads of string * string list * string list * (logic_type * string) list
* lexpr list
(*LDpredicate_reads(name,labels,type_params, parameters, reads_tsets) represents the declaration of a new predicate. It is similar to LDlogic_reads except that it has no return_type.*)
| LDpredicate_def of string * string list * string list * (logic_type * string) list
* lexpr
(*LDpredicate_def(name,labels,type_params, parameters, def) represents the definition of a new predicate. It is similar to LDlogic_def except that it has no return_type.*)
| LDinductive_def of string * string list * string list * (logic_type * string) list
* (string * string list * string list * lexpr) list
(*LDinductive_def(name,labels,type_params, parameters, indcases) represents an inductive definition of a new predicate.*)
| LDlemma of string * bool * string list * string list * lexpr (*LDlemma(name,is_axiom,labels,type_params,property) represents a lemma or an axiom name. is_axiom is true for an axiom and false for a lemma. labels is the list of label arguments and type_params the list of type parameters. Last, property is the statement of the lemma.*)
| LDaxiomatic of string * decl list (*LDaxiomatic(id,decls) represents a block of axiomatic definitions.*)
| LDinvariant of string * lexpr (*global invariant.*)
| LDtype_annot of type_annot (*type invariant.*)
global declarations.
type spec = (lexpr, lexpr, lexpr) Cil_types.spec 
specification of a C function.
type code_annot = (lexpr, lexpr, lexpr, lexpr)
Cil_types.code_annot
type assigns = lexpr Cil_types.assigns 
assignment performed by a C function.
type variant = lexpr Cil_types.variant 
variant for loop or recursive function.

type annot =
| Adecl of (Cil_types.location * decl) list (*global annotation.*)
| Aspec
| Acode_annot of Cil_types.location * code_annot (*code annotation.*)
| Aloop_annot of Cil_types.location * code_annot list (*loop annotation.*)
| Aattribute_annot of Cil_types.location * string (*attribute annotation.*)
all kind of annotations