State-independent lift SDistr → SPComp #
The canonical stateless embedding of a distribution SDistr α into the stateful
probabilistic computation monad SPComp α, obtained by threading the heap
through unchanged. This is pure CatCrypt program-logic content — it mentions no
external probability library — so it lives in the minimal core basis, where both
SDistr and SPComp are defined.
The UCMonadMorphism packaging (sdistrLift) and the VCVio interoperability
built on top of this lift live downstream (CatCrypt.Crypto.UCMonad.SDistrLift
and the catcrypt-vcvio package), which is why those consumers can depend on a
VCVio-free core module rather than dragging the VCVio library into their closure.
Main definitions #
sdistrToSPComp— the state-independent lift.
Main results #
sdistrToSPComp_pure/sdistrToSPComp_bind— monad-morphism laws.sdistrToSPComp_isPure— the lift produces heap-independent computations.bind_sdistrToSPComp_eq— running a bind of the lift at a heap.marginalize_heap— marginalising the heap out of anSDistr (Bool × Heap).
Lift SDistr to SPComp by ignoring the heap.
Equations
- CatCrypt.Crypto.SDistrLift.sdistrToSPComp d h = d.bind fun (a : α) => CatCrypt.Prob.SDistr.pure (a, h)
Instances For
The state-independent lift preserves pure.
The state-independent lift preserves bind.
The state-independent lift produces IsPure computations.
Running a bind of the state-independent lift against a distinguisher at a
fixed heap collapses to the underlying SDistr bind.
Marginalising the heap out of an SDistr (Bool × Heap): summing the
probability of (true, ·) over all heaps equals the probability of true
under the first-projection push-forward.