Documentation

CslibFrontier.Computability.Interactive.StrategyEffect

Changing the effects of interactive strategies #

Translate every effect of a strategy while retaining its message-dependent continuations. Initial computations that produce strategies remain outside this operation and must be translated separately, in their original order. Stateful interpretations should target StateT; run the combined interaction once, rather than resetting the state at each translated effect.

Main definitions #

Main results #

def Cslib.Interactive.ProverStrategy.hoist {m n : Type → Type} {α : Type} [Functor n] (φ : {γ : Type} → m γ → n γ) (s : Spec) :
ProverStrategy m s α → ProverStrategy n s α

Translate effects in a prover strategy, retaining each captured continuation.

def Cslib.Interactive.VerifierStrategy.hoist {m n : Type → Type} {α : Type} [Functor n] (φ : {γ : Type} → m γ → n γ) (s : Spec) :

Translate effects in a verifier strategy, including its terminal view computation.

theorem Cslib.Interactive.runAgainst_hoist {m n : Type → Type} {α β : Type} [Monad m] [Monad n] [LawfulMonad m] [LawfulMonad n] (φ : {γ : Type} → m γ → n γ) (hφ : IsMonadHom m n fun {α : Type} => φ) (s : Spec) (p : ProverStrategy m s α) (v : VerifierStrategy m s β) :
runAgainst s (ProverStrategy.hoist (fun {γ : Type} => φ) s p) (VerifierStrategy.hoist (fun {γ : Type} => φ) s v) = φ (runAgainst s p v)

Translating both strategies by a monad morphism translates their entire interaction, including the transcript and both terminal outputs.

def Cslib.Interactive.liftVerifier {ιP ιV : Type} {oP : OracleSpec ιP} {oV : OracleSpec ιV} {α : Type} :
ProbOracleComp oV α → ProbOracleComp (oP.sum oV) α

Lift a verifier computation into the joint oracles without granting it prover queries.

theorem Cslib.Interactive.isMonadHom_liftProver {ιP ιV : Type} {oP : OracleSpec ιP} {oV : OracleSpec ιV} :

The existing prover-role embedding preserves monadic effects.

The verifier-role embedding preserves monadic effects.

theorem Cslib.Interactive.interpret_liftVerifier {m : Type → Type} {α ιP ιV : Type} {oP : OracleSpec ιP} {oV : OracleSpec ιV} [Monad m] [LawfulMonad m] (random : (k : ℕ) → m (Fin (k + 1))) (prover : (q : ιP) → m (oP q)) (verifier : (q : ιV) → m (oV q)) (program : ProbOracleComp oV α) :

A lifted verifier computation uses only the sampling and verifier components of a joint handler: the prover component is never consulted.