flowchart TD 1[x>=0] --> 2[z+u*y = x*y & u >=0] --> 4[z = x*y]
Annotations and correctness
Sequential composition
Array as a partial function
x := (x; E:F)
array is a function where is a ‘small’ range of integers and is the type of array element
alter function (x; E:F)
is defined by
(x; E:F)(G) = F if E = G
(x; E:F)(G) = x(G) if e != G
For example:
Given array x
:
{x(0) = a ^ x(1) = b}
x(1) := c
{x(0) = a ^ x(1) = c}
S is the sum(0..k) → loop invariant
s, k := a(0), 1`
{s = (\sum )}