Synchronized pRHL Rules #
This file contains synchronized pRHL rules, where the same operation is performed on both sides of the relational judgment simultaneously.
Main definitions #
r_get_vs_get- Synchronized get on both sidesr_put_vs_put- Synchronized put on both sidesr_sample_vs_sample- Synchronized sampling on both sides
References #
- SSProve: theories/Crypt/package/pkg_rhl.v
- EasyCrypt pRHL
Synchronized Get Rules #
Synchronized get on both sides at the same location. Precondition must imply the locations have the same value. Postcondition gets both values equal and preserves the invariant.
Synchronized get at same location, where the invariant implies equality. This version gives a more explicit postcondition that captures the read value.
Synchronized get at different locations with same type.
Each side reads from its respective location.
Note: This rule is complex due to type casts; prefer using
r_get_vs_get when both locations have the same type.
Synchronized Put Rules #
Synchronized put on both sides at the same location with the same value. Preserves invariants that are preserved under the synchronized update.
Synchronized put with different values on each side. Useful when transforming an invariant that relates values at the location.
Synchronized put at different locations. Each side writes to its respective location.
Synchronized Sampling Rules #
Synchronized sampling from the same distribution on both sides. Uses the diagonal coupling where both sides get the same value.
Synchronized sampling with a bijection coupling. The values on each side are related by the bijection f.
Synchronized sampling with an arbitrary coupling relation. This is the most general form, requiring a proof that the coupling exists.
Combined Synchronized Operations #
Get then put on the same location, synchronized on both sides. Updates the location with a function of its current value.
Sample then put on both sides. Samples a value and writes it to the same location.
Swap Rules #
Swap lemma: if same code is run on swapped heaps with swapped pre/post, then we can use it on the original judgment.
Frame Rules #
Frame rule: if the invariant only depends on certain locations, and the code only modifies those locations, the invariant is preserved.