Documentation

VCVio.Interaction.Basic.Strategy

Strategies (Spec.Strategy) #

A Strategy m spec Output plays through spec, choosing moves and interleaving effects in m, producing a transcript-dependent result Output tr. Definitions are by structural recursion on the spec (Hancock–Setzer), avoiding positivity issues for generic m.

run executes a strategy; mapOutput is functorial in the output family. Dependent sequential composition Strategy.comp requires Spec.append from VCVio.Interaction.Basic.Append.

def Interaction.Spec.Strategy (m : Type u → Type u) (spec : Spec) :
(spec.TranscriptType u)Type u

One-player strategy with monadic effects: at each node, choose a move x and continue in m.

Instances For
    @[reducible, inline]
    abbrev Interaction.Spec.Strategy' (m : Type u → Type u) (spec : Spec) (α : Type u) :

    Non-dependent output type α at every transcript.

    Instances For
      def Interaction.Spec.Strategy.run {m : Type u → Type u} [Monad m] (spec : Spec) {Output : spec.TranscriptType u} :
      Strategy m spec Outputm ((tr : spec.Transcript) × Output tr)

      Run the strategy, returning the full transcript and the dependent output.

      Instances For
        def Interaction.Spec.Strategy.mapOutput {m : Type u → Type u} [Functor m] {spec : Spec} {A B : spec.TranscriptType u} :
        ((tr : spec.Transcript) → A trB tr)Strategy m spec AStrategy m spec B

        Map the dependent output family along a natural transformation over transcripts.

        Instances For
          @[simp]
          theorem Interaction.Spec.Strategy.mapOutput_id {m : Type u → Type u} [Functor m] [LawfulFunctor m] {spec : Spec} {A : spec.TranscriptType u} (σ : Strategy m spec A) :
          mapOutput (fun (x : spec.Transcript) (x_1 : A x) => x_1) σ = σ

          Pointwise identity on outputs is the identity on strategies (needs a lawful functor).

          theorem Interaction.Spec.Strategy.mapOutput_comp {m : Type u → Type u} [Functor m] [LawfulFunctor m] {spec : Spec} {A B C : spec.TranscriptType u} (g : (tr : spec.Transcript) → B trC tr) (f : (tr : spec.Transcript) → A trB tr) (σ : Strategy m spec A) :
          mapOutput (fun (tr : spec.Transcript) (x : A tr) => g tr (f tr x)) σ = mapOutput g (mapOutput f σ)

          mapOutput respects composition of output maps (needs a lawful functor).