Open DavePearce opened 7 years ago
This will require a relatively simple inference rule (I think). Imagine this example:
assert "assertion failed":
forall(&int x, &int y):
if:
*y == 0
*' == *[x:=0]
then:
*'y == 0
In this case, we'll end up with a conjunction of these atoms:
*y == 0
*' == *[x:=0]
*'y != 0
By congruence closure, we end up with this:
*y == 0
*' == *[x:=0]
*[x:=0](y) != 0
(what syntax for *[x:=0](y)
?)
Then, we have to perform a case analysis on *[x:=0](y)
. Specifically, either x == y
and *[x:=0](y)
reduces to 0
. Or, x != y
and *[x:=0](y)
reduces to *y
.
To implement this feature requires the following changes:
WyalFileParser
to parse *'
notation. Presumably, *''
, *'''
are all permitted.WyalFile.Dereference
operator to support a version number (i.e. 0
, 1
, 2
, etc). WyalFile.Dereference
operator to support assignment sequence of the form *[e1:=e2, e3:=e4, ...]
. OR we could introduce a HeapUpdate
operator. But this would then require the notion of a heap
type and change WyalFile.Dereference
becomes more like ArrayAccess
(i.e. has a source expression of type heap
).
(this follows WyC#743 and WyC#750)
We need to allow for "heap versioning". The proposed syntax is to employ a tick notation. Consider this simply Whiley file:
This could generate the following WyAL file:
Here,
*'
represents a completely "new version" of the heap that is related to*
only via the heap update operator (i.e.*' == *[x:=0]
).