Unary Probabilistic Hoare Logic - Judgment #
This file defines the unary probabilistic Hoare logic judgment for CatCrypt.
It is analogous to EasyCrypt's pHL but for our SPComp monad.
Main definitions #
UPre- Unary precondition (predicate on initial heap)UPost α- Unary postcondition (predicate on result and final heap)pHoare P c Q- The pHL judgment: for all heaps satisfyingP, every outcome in the support ofc hsatisfiesQ
References #
- EasyCrypt pHL (unary probabilistic Hoare logic)
- CatCrypt Relational.Judgment (the relational counterpart)
Unary assertion types #
Unary precondition: predicate on initial heap
Equations
Instances For
Unary postcondition: predicate on result and final heap
Equations
- CatCrypt.Unary.UPost α = (α → CatCrypt.Core.Heap → Prop)
Instances For
Standard preconditions #
True precondition: always holds
Equations
Instances For
False precondition: never holds
Equations
Instances For
The pHL Judgment #
The probabilistic Hoare logic judgment (pHL).
pHoare P c Q means: for all initial heaps h satisfying P h,
every outcome (a, h') in the support of c h satisfies Q a h'.
An outcome (a, h') is in the support when (c h) (some (a, h')) ≠ 0,
i.e., it has nonzero probability.
Equations
- CatCrypt.Unary.pHoare P c Q = ∀ (h : CatCrypt.Core.Heap), P h → ∀ (a : α) (h' : CatCrypt.Core.Heap), (c h) (some (a, h')) ≠ 0 → Q a h'
Instances For
Basic properties #
pHoare is monotone in the postcondition
pHoare is antimonotone in the precondition
Consequence rule: strengthen precondition, weaken postcondition
True precondition implies any precondition suffices
False precondition makes any judgment trivially true