Functor Runtime_mem.Create


module Create: 
functor (F : Formula.S) ->
functor (A : Mint.S with module F = F) ->
functor (R : Mfloat.S with module F = F) -> sig .. end
Parameters:
F : Formula.S
A : Mint.S with module F = F
R : Mfloat.S with module F = F

type decl = F.decl 

The memory is composed of 2 parts: one that deals with the values, and the other one that handle allocation information. More over, there is a table in the Pre memory to handle logic variables that are used for the initial value of the parameters.
type m_mbits 
val t_mbits : Formula.tau
type mem_bits = m_mbits F.term 
type m_alloc 
val t_alloc : Formula.tau
type mem_alloc = m_alloc F.term 
type m_mem 
val t_mem : Formula.tau

type mem = {
   vbits : F.var;
   valloc : F.var;
}
type m_format 
type format = m_format F.term 
----- Formats :
val mk_iformat : Ctypes.c_int -> string
val mk_fformat : Ctypes.c_float -> string
val int_format : '_a F.term
val real_format : '_a F.term
val i_format : Ctypes.c_int -> 'a F.term
val f_format : Ctypes.c_float -> 'a F.term
val format_of_addr : 'a -> 'b F.term
val tcomp_of_comp : Cil_types.compinfo -> Cil_types.typ
val cil_field_info : Cil_types.fieldinfo -> int * int
val cil_field_offset : Cil_types.fieldinfo -> int
val cil_field_size : Cil_types.fieldinfo -> int
val name_of_var : F.Xindex.t -> F.name
val name_of_field : F.Findex.t -> F.integer

Size and offset are sometimes known constants. We can choose to represent them are simple int and compute values as far as possible, or to keep them as named terms. The first solution gives smaller - yet easier provable - goals, but if if fails, the user has few information the understand the problem. We will try to have both solutions in order to be able to test them.
val compute_int_mode : Runtime_mem.compute_int_mode
type 'a tint = F.integer 
integer terms with a phantom type to mark what kind of object it is.
module Aint: sig .. end
type m_addr 
Phantom types to tag the terms
type m_offset 
type m_size 
type m_zone 
type t_addr = m_addr tint 
Specialized type of F.integer terms
type t_offset = m_offset tint 
type t_size = m_size tint 
type t_zone = m_zone F.term 
module Tint: sig .. end

about size and offset


val sizeof_c_object : Ctypes.c_object -> Tint.x_size

Extracted specification from runtime.why

see definitions and axioms in runtime.why
type m_bits 
type t_bits = m_bits F.term 
type m_dzone 
type dzone = m_dzone F.term 
module RtLib: sig .. end
val z_from_bits : t_bits -> format -> F.integer
val real_from_bits : t_bits -> format -> F.real
module Model: sig .. end
val startof : 'a -> 'b -> 'a
val cast_loc_to_loc : 'a -> 'b -> 'c -> 'c

about zone



Mwp requires a type dzone defined as m_zone F.term that represent why formula of the model why zone type (which name is given by tau_of_zone below).

Because we need to provide function such as dzone_union, this dzone is defined as a set of the rt_zone defined in WHY.

val tau_of_dzone : Formula.tau
val xzone_assigned : Tint.x_addr F.assigned -> Tint.x_zone
val dzone_assigned : 'a -> Tint.x_addr F.assigned -> dzone
val dzone_empty : unit -> dzone
val dzone_subset : dzone -> dzone -> F.pred
val dzone_union : dzone ->
dzone -> dzone
val effect_supported : bool
val int_format_for_hyp : Ctypes.c_object -> 'a F.term option
val add_int_format_hyp : 'a F.term -> Ctypes.c_object -> F.pred -> F.pred
module VarDecl: F.DRegister(sig
include F.Varinfo
val declare : F.Xindex.t -> 'a -> ('b, 'c, F.pred) Formula.item
Global variable has a fixed zone in any allocation memory. forall ma, rt_vsize (ma, v) = sz /\ rt_vaddr (ma, v) = rt_gaddr v
val section : Formula.section
val prefix : string
val basename : Cil_types.varinfo -> string
val clear : unit -> unit
val pp_descr : Format.formatter -> 'a -> unit
end)
module Fields: F.DRegister(sig
include F.Fieldinfo
val declare : Cil_types.fieldinfo -> 'a -> ('b, 'c, F.pred) Formula.item
val section : Formula.section
val prefix : string
val basename : Cil_types.fieldinfo -> string
val clear : unit -> unit
val pp_descr : Format.formatter -> 'a -> unit
end)
module V: Datalib.Cvalues(Model)
module L: Datalib.Create(V)
module Data: sig .. end
module DF: Data_mem.Create(Data)
val load : mem ->
Ctypes.c_object ->
Tint.x_addr -> Data.value
val store : mem ->
Tint.x_addr ->
Ctypes.c_object ->
Data.value -> mem_bits
include Data

about bits

bits type is used to represent the values that are stored in the memory. We have functions that encode/decode bits to/from ACSL logic values depending on the intermediate C type t.
val format_of_compinfo : Cil_types.compinfo -> 'a Data.F.term
val format_of_array : Ctypes.arrayinfo -> 'a Data.F.term
val rt_format_of_ctype : Ctypes.c_object -> 'a Data.F.term
val value_of_bits : Ctypes.c_object -> t_bits -> Data.value
Compute the logic value from bits interpreted with type t.
val bits_of_value : 'a -> value -> t_bits

Frame Environment


val mem : unit -> mem

Validity


val valid : mem -> Tint.x_addr F.assigned -> F.pred
val separated : 'a ->
Tint.x_addr F.assigned ->
Tint.x_addr F.assigned -> F.pred
val tbits_of_var : F.var -> t_bits
val subst_havoc : mem ->
Tint.x_addr F.assigned -> F.havoc list
val assigns_goal : mem ->
Tint.x_addr F.assigned list ->
mem -> F.pred
val assigns_supported : bool

Special locations


val base_address : mem ->
Tint.x_addr -> Tint.x_addr
val block_length : mem ->
Tint.x_addr -> t_size

User-defined Predicates



type closure =
| Mem
| Alloc
val pp_closure : Format.formatter -> closure -> unit
val userdef_mem_signature : mem -> (F.var * closure) list
val userdef_mem_apply : mem -> closure -> F.abstract
type formal = unit 
val pp_formal : 'a -> 'b -> unit
val userdef_is_ref_param : Cil_types.logic_var -> bool
val userdef_ref_signature : mem ->
(F.var * Cil_types.logic_var * formal) list
val userdef_ref_apply : mem -> formal -> loc -> value
val userdef_ref_has_cvar : Cil_types.logic_var -> bool

Mwp.S requirements


val update : at:mem ->
here:mem ->
L.F.pred -> L.F.pred
val quantify : mem ->
L.F.pred -> L.F.pred
val subst_lval : mem ->
Ctypes.c_object ->
Tint.x_addr ->
Data.value ->
L.F.pred -> L.F.pred
val local_scope : mem ->
F.Xindex.t list ->
Mcfg.scope -> L.F.pred -> L.F.pred
val global_scope : 'a -> 'b -> 'b