The types the guarded program declares #
The emitted guarded program declares the types of the init items of the WP walk: a known
type, or the type of a name resolved at emission (emit_tys). A WP walk declares as known
types only declared types of the walked fragment and the Boolean type, records as declared
types only those and the initial ones, and refers to the type of a name, directly or through a
type reference of a fresh name, only for names that are no variable of the initial types or
that the fragment reads or writes (TyInv, TyOut, wpList_tySpec). Hence every type the output
of wpEntry declares is a declared type of the input, the Boolean type, or the type in tys of
a variable the input reads or writes (wpEntry_initTypes).
Key definitions: wTyRefs, itemTys, RefOK, TyInv, TyOut, TySpec.
Key theorems: emit_tys, wpList_tySpec, wpEntry_initTypes.
Types of items #
The type references of the init items of a list of guarded items, at any depth.
Equations
- Imperative.WP.wTyRefs [] = []
- Imperative.WP.wTyRefs (Imperative.WP.WItem.init x_1 ty e :: rest) = ty :: Imperative.WP.wTyRefs rest
- Imperative.WP.wTyRefs (Imperative.WP.WItem.branch t e :: rest) = Imperative.WP.wTyRefs t ++ Imperative.WP.wTyRefs e ++ Imperative.WP.wTyRefs rest
- Imperative.WP.wTyRefs (head :: rest) = Imperative.WP.wTyRefs rest
Instances For
The declared types of the statements of a list of flat items, at any depth.
Equations
- Imperative.WP.itemTys [] = []
- Imperative.WP.itemTys (Imperative.WP.Item.plain s :: rest) = Imperative.Stmt.initTypes s ++ Imperative.WP.itemTys rest
- Imperative.WP.itemTys (Imperative.WP.Item.obls reach cs :: rest) = Imperative.Block.initTypes cs ++ Imperative.WP.itemTys rest
- Imperative.WP.itemTys (Imperative.WP.Item.branch t e :: rest) = Imperative.WP.itemTys t ++ Imperative.WP.itemTys e ++ Imperative.WP.itemTys rest
Instances For
A resolved type reference: a known type, or the type tyOfName gives the name.
Equations
- Imperative.WP.RefTy T Y ty (Imperative.WP.TyRef.known ty') = (ty' = ty)
- Imperative.WP.RefTy T Y ty (Imperative.WP.TyRef.of y) = (Imperative.WP.tyOfName T Y y = Except.ok ty)
Instances For
Every declared type of resolved items resolves a type reference of the items.
The declared types of the emitted guarded program resolve type references of the items of the rope.
The type facts of a walk #
A type reference allowed in the output of a walk: a known type satisfying Θ, or the type
of a name that is in V when it is in K.
Equations
- Imperative.WP.RefOK K V Θ (Imperative.WP.TyRef.known ty') = Θ ty'
- Imperative.WP.RefOK K V Θ (Imperative.WP.TyRef.of y) = (y ∈ K → y ∈ V)
Instances For
The type facts of a walk state st, for the names K (the variables of the initial types)
avoided by fresh names, the names V allowed among them, the allowed types Θ and the
initial declared types T0: the Boolean type is allowed; the names of K are avoided and
are no recorded renaming; a declared type is allowed or the initial one; the target of a
type reference and of a carried merge is in V when it is in K.
- bool : Θ HasBool.boolTy
Instances For
The type facts of a walk result r: its output holds only allowed type references
(RefOK), and every name it assigns is in V when it is in K.
Instances For
The type property of the walk m of a fragment ss: every run from a state with the type
facts, of a fragment whose declared types are allowed, whose variables of K it reads or
writes are in V, and which declares no name of K, ends in a state with the type facts
and has a result with the type facts.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A state with the avoided names of a state st with the type facts, whose renamings are those
of st or names st does not avoid, and whose declared types, type references and carried
merges are those of st or allowed ones, has the type facts.
A value of a hash map after an insertion of a value satisfying Q is a value before it or
satisfies Q.
A run of wName x keeps the type facts and returns x or a name not in K.
A run of wDecl x keeps the type facts.
A run of wRen e keeps the type facts.
A run of liveAdd xs keeps the type facts.
A run of wFreshBool b keeps the type facts.
A run of wFreshLike y for a name y in V when it is in K keeps the type facts.
A run of saveRestore xs for names xs in V when they are in K keeps the type facts;
its saves, copies and restores hold only references to the types of names of xs, and its
copy pairs pair names of xs.
A result without output and assigned names has the type facts.
The walk of a command has the type property.
The walk of an exit has the type property.
The walk of a statement that is not a command, an exit, a block or a deterministic ite
has the type property.
The walk of the empty list has the type property.
The walk of s :: rest has the type property when the walks of s (for every obligation
bit) and of rest have it.
Appending set items to a rope adds no type reference.
The walk of a block has the type property when the walks of its body (at the next depth, under every context) have it.
The walk of a real branch has the type property when the walks of its arms (under top,
no obligation following them) have it.
An optional draw of a Boolean name keeps the type facts.
The walk of a laid-out ite has the type property when the walks of its arms (at the same
depth, under every context, an obligation following them) have it.
Every statement-list walk has the type property.
Every statement walk has the type property.
The types the output of the WP phase declares. For a loop-free list ss well scoped
(Block.WellScoped) from a scope S containing the variables of tys, every type an init
of the output of wpEntry declares is a declared type of ss, the Boolean type, or the type in
tys of a variable that ss reads or writes (Block.freeVars).