Simulation through WriterT Handlers #
Combinators and output-preservation lemmas for writer-instrumented query implementations.
The combinators here mirror the StateT/ReaderT versions in
SimSemantics/StateT/Basic.lean and SimSemantics/ReaderT/Basic.lean.
Given implementations for oracles in spec₁ and spec₂ in terms of writer monads for
two different log monoids ω₁ and ω₂, implement the combined set spec₁ + spec₂ in terms
of the product monoid ω₁ × ω₂. Each side leaves the other component at the identity.
Instances For
Indexed version of QueryImpl.parallelWriterT. Each query for index t writes into the
t-th component of the pi-product (t : τ) → ω t, leaving every other component at the
identity. Note that m cannot vary with t.
Instances For
Reassociate a nested writer transformer into one product log.
The outer log is the first component of the product; the inner/base log is the second. This
is the writer-transformer analogue of flattenStateT. Requires [Monoid ω₂] to lift the
inner writer's run; the resulting WriterT (ω₁ × ω₂) m carries both logs as a product.
Instances For
Taking the first component of the WriterT output recovers the original computation, when the query implementation preserves the underlying oracle behavior (hso).