Location Couplings for Relational Reasoning #
This file defines location-specific couplings - relations between specific locations across the left and right heaps. These are used as semi-invariants that hold for specific locations.
Main definitions #
syncs- Two locations are synchronized (have equal values)rem_lhs/rem_rhs- Remembered values on left/right sidesingle_lhs/single_rhs- Predicate about single locationcouple_cross- Relation across left and right locations
Usage #
Location couplings are composed with invariants using ⋊ to build
more precise relational specifications. The ssprove_sync and
ssprove_restore tactics manipulate these couplings.
References #
- Larsen and Schürmann, Nominal State-Separating Proofs
- SSProve: theories/Crypt/package/pkg_heap_comp.v
Synchronization #
Two locations are synchronized: they have equal values
Instances For
Same location synchronized on both sides
Equations
- CatCrypt.Invariant.syncsAt l h₀ h₁ = (h₀.get l = h₁.get l)
Instances For
Remembered Values #
Remembered value on the left: the left heap has value v at location l
Equations
- CatCrypt.Invariant.rem_lhs l v h₀ x✝ = (h₀.get l = v)
Instances For
Remembered value on the right: the right heap has value v at location l
Equations
- CatCrypt.Invariant.rem_rhs l v x✝ h₁ = (h₁.get l = v)
Instances For
Remembered value in a specific invariant (left or right)
Instances For
Equations
Instances For
Get the other side
Equations
Instances For
Single-Location Predicates #
Predicate about a single location on the left
Equations
- CatCrypt.Invariant.single_lhs l P h₀ x✝ = P (h₀.get l)
Instances For
Predicate about a single location on the right
Equations
- CatCrypt.Invariant.single_rhs l P x✝ h₁ = P (h₁.get l)
Instances For
Location Couplings #
Relation between two locations on the left heap
Equations
- CatCrypt.Invariant.couple_lhs l₀ l₁ R h₀ x✝ = R (h₀.get l₀) (h₀.get l₁)
Instances For
Relation between two locations on the right heap
Equations
- CatCrypt.Invariant.couple_rhs l₀ l₁ R x✝ h₁ = R (h₁.get l₀) (h₁.get l₁)
Instances For
Relation between a location on left and a location on right
Equations
- CatCrypt.Invariant.couple_cross l₀ l₁ hty R h₀ h₁ = R (h₀.get l₀) (h₁.get l₁)
Instances For
Equality coupling across sides (same as syncs)
Equations
- CatCrypt.Invariant.eqCross l₀ l₁ hty = CatCrypt.Invariant.couple_cross l₀ l₁ hty fun (v₀ : l₀.ty) (v₁ : l₁.ty) => v₀ = cast ⋯ v₁
Instances For
Triple Couplings #
Relation between three locations on the left
Equations
- CatCrypt.Invariant.triple_lhs l₀ l₁ l₂ R h₀ x✝ = R (h₀.get l₀) (h₀.get l₁) (h₀.get l₂)
Instances For
Relation between three locations on the right
Equations
- CatCrypt.Invariant.triple_rhs l₀ l₁ l₂ R x✝ h₁ = R (h₁.get l₀) (h₁.get l₁) (h₁.get l₂)
Instances For
Set Predicates (for writes) #
Setting a value on the left, used in put rules
Equations
- CatCrypt.Invariant.set_lhs l v P h₀ h₁ = P (h₀.set l v) h₁
Instances For
Setting a value on the right, used in put rules
Equations
- CatCrypt.Invariant.set_rhs l v P h₀ h₁ = P h₀ (h₁.set l v)
Instances For
Lemmas #
If locations are synced and we remember on one side, we can remember the same on the other
Proof helpers #
Mark that a location coupling is proven by the precondition
- holds (h₀ h₁ : Core.Heap) : pre h₀ h₁ → coupling h₀ h₁
Instances
If coupling is part of the precondition conjunction, it's proven
Helper to extract proven coupling