Evaluation Semantics for ReaderT #
This file provides monad homomorphisms for evaluating ReaderT ρ m computations
by fixing the environment parameter.
Unlike StateT, ReaderT evaluation at a fixed environment is a valid monad homomorphism
because the environment is read-only and doesn't change during computation.
Main definitions #
ReaderT.evalAt ρ0: Monad homomorphismReaderT ρ m →ᵐ mby evaluation atρ0ReaderT.toSPMF ρ0: LiftMonadLiftT m SPMFthroughReaderTat fixedρ0ReaderT.toPMF ρ0: LiftMonadLiftT m PMFthroughReaderTat fixedρ0
Design notes #
We do NOT provide global MonadLiftT (ReaderT ρ m) SPMF instances because there's no
canonical choice of environment. Instead, users explicitly provide the environment
when constructing the evaluation homomorphism.
For cryptographic games with random oracles, the typical pattern is:
Lift m → SPMF to a homomorphism ReaderT ρ m →ᵐ SPMF by fixing ρ0.
This allows evaluating reader computations to sub-probability distributions
when the base monad m has such an evaluation.
Instances For
Evaluating pure x at any environment gives the same result as pure x in the base monad.
Evaluating a bind distributes through the monad homomorphism.