Documentation

CatCryptCore.Crypto.SDistrLift

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 #

Main results #

Lift SDistr to SPComp by ignoring the heap.

Equations
Instances For

    The state-independent lift preserves pure.

    theorem CatCrypt.Crypto.SDistrLift.sdistrToSPComp_bind {α β : Type} (d : Prob.SDistr α) (f : αProb.SDistr β) :
    sdistrToSPComp (d.bind f) = (sdistrToSPComp d).bind fun (a : α) => sdistrToSPComp (f a)

    The state-independent lift preserves bind.

    The state-independent lift produces IsPure computations.

    theorem CatCrypt.Crypto.SDistrLift.bind_sdistrToSPComp_eq {β : Type} (d : Prob.SDistr β) (D : βCore.SPComp Bool) (h₀ : Core.Heap) :
    (sdistrToSPComp d).bind D h₀ = d.bind fun (b : β) => D b h₀

    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.