Location-Based Frame Rule #
This file provides a location-based frame rule for pRHL, the CatCrypt analogue
of separation logic's frame rule and Bluebell's P * Q (separating conjunction
= independence). The key idea: assertions on disjoint heap regions plus
computations with bounded footprints enable compositional reasoning.
Main definitions #
DependsOn P L— assertion P only examines locations in LPreservesOutside c L— computation c only modifies locations in Lr_frame_local— the frame rule: disjoint footprints preserve the framer_frame_of_preservesNothing— any frame survives computations that write nothingr_frame_agreeOff—agreeOff Lsurvives computations that write only insideL
Design notes #
RPre = Heap → Heap → Prop is deterministic (no probabilistic separation needed).
The right analogue of Bluebell's probabilistic separation is location-based
separation: assertions on disjoint heap regions + computations with bounded
footprints.
The three frame rules #
The three rules cover three shapes of frame footprint, and none of them is an instance of another.
r_frame_localframes an assertion with a finite footprintL_f(DependsOn Frame L_f) across computations writing only inside aL_cdisjoint from it.r_frame_of_preservesNothingframes an arbitrary assertion, at the price of asking both computations to write nothing at all.r_frame_agreeOffframes the specific assertionagreeOff L, whose footprint is co-finite, across computations writing only insideL.DependsOn (agreeOff L) L_ffails for every finiteL_f, sor_frame_localdoes not reach it; the computations write, sor_frame_of_preservesNothingdoes not either.
At L = ∅ the last two rules meet without either containing the other:
agreeOff ∅ is whole-heap equality (agreeOff_empty_iff), one assertion, while
r_frame_of_preservesNothing at the same footprint frames every assertion.
References #
- Bluebell (POPL 2025) —
P * Qseparating conjunction for independence - O'Hearn, Reynolds, Yang — Separation logic
Assertion locality #
DependsOn P L means P only examines locations in L: heap pairs
agreeing on L cannot be distinguished by P.
Equations
- CatCrypt.Relational.DependsOn P L = ∀ (h₁ h₁' h₂ h₂' : CatCrypt.Core.Heap), h₁.agreeOn h₁' L → h₂.agreeOn h₂' L → P h₁ h₂ → P h₁' h₂'
Instances For
DependsOn instances #
Computation footprint #
PreservesOutside c L means c does not modify locations outside L:
for every output in c's support, non-L locations are unchanged.
Equations
- CatCrypt.Relational.PreservesOutside c L = ∀ (h : CatCrypt.Core.Heap) (a : α) (h' : CatCrypt.Core.Heap), (c h) (some (a, h')) ≠ 0 → ∀ id ∉ L, Finmap.lookup id h'.data = Finmap.lookup id h.data
Instances For
PreservesOutside instances #
The frame rule #
Location-based frame rule: if computations only modify locations in L_c,
and the frame assertion only depends on locations in L_f, and these
sets are disjoint, then the frame is preserved.
This is the CatCrypt analogue of separation logic's frame rule.
A computation that modifies nothing leaves its heap alone.
Frame rule for computations that modify no location: the precondition carries through to the postcondition, whatever it is.
r_frame_local asks the frame to depend on a LocSet, which is a Finset, so
it cannot frame an assertion with no finite footprint — eqPre, whole-heap
equality, is one such. Nothing is needed of the assertion here, because the two
computations leave their heaps as they found them, so the assertion holds of the
final pair exactly when it held of the initial pair.
Frame rule for agreement outside a write-set: if both computations write only
inside L and the two initial heaps agree outside L, the two final heaps agree
outside L.
The frame agreeOff L constrains every location outside a finite set, so it has
no finite footprint and DependsOn (agreeOff L) L_f fails for every L_f; the
computations write inside L, so r_frame_of_preservesNothing does not apply.
What replaces the disjointness hypothesis is that the frame's footprint is the
complement of the write-set: each side's final heap agrees with its own initial
heap outside L, and the initial heaps agree with each other there.