A stratified heap with two universes, enabling storing "small" heap predicates in the larger heap #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR enriches the memory model of Pulse to use PulseCore.TwoLevelHeap
The underlying memory now contains the following:
A pair of a small heap and a large heap is called a TwoLevelHeap, or H2.heap.
The core Pulse.Lib.Core.vprop is now an affine H2.heap -> prop, where
vprop : Type u#3
(We also have an invariant store in PulseCore.Memory, storing
slprop
as invariants, this is mostly unchanged, except for a universe level increase, and some other cleanup, notably, directly using PulseCore.MonotonicStateMonad in a universe-polymorphic way, rather than using FStar.MSTTotal, which fixes the state to be in universe 1.)We also have two functions
down : vprop -> small_slprop
andup: small_slprop -> vprop
, wheresmall_slprop : Type u#2
And a predicate
is_small (p:vprop) = up (down p) == p
That is,
vprop
validatingis_small
can be coerced to small_slprops without loss of information, and then coerced back.Most familiar predicates are small, e.g,
emp
,pure
,pts_to
,ghost_pts_to
etc.The connectives ** and exists* form small vprops if their arguments are also small.
But, we now also have
Pulse.Lib.BigReference.pts_to (#a:Type u#2) (x:ref a) (#p:perm) (v:a) : vprop
that allows storing terms in universe 2 in the heap, including, notablysmall_slprop
.An example PulseExample.UseBigRef shows how it works, storing list of closures packed with small vprops denoting their pre and postconditions.
Note, we also have Pulse.Lib.BigGhostReference, for a ghost variant of a reference to store a universe 2 term.
I plan to add one more level to the heap, this one to turn any slprop into a resourceful invariant---so, expect one more universe bump.