Learning.Environment.comap
From the authors
The environment that reads the summary F n of the past rounds and reads f a when the
algorithm plays a in the current round.
This is the primitive transport operation on environments, dual to Algorithm.comap:
Environment.comapAction is the special case in which F n is the round-wise map of the actions.
Only the action can change type, since the observations and the feedbacks are outputs of the
environment; F n can nonetheless forget or summarize the past rounds, as an environment that
reads only the last round does.
-
๐ : Type u_1m๐ : MeasurableSpace ๐A measurable space is a space equipped with a ฯ-algebra. -
๐ : Type u_4m๐ : MeasurableSpace ๐ -
๐' : Type u_5m๐' : MeasurableSpace ๐' -
๐จ : Type u_7m๐จ : MeasurableSpace ๐จ
-
env : Environment ๐ ๐ ๐จA stochastic environment. -
F : (n : โ) โ Hist ๐ ๐' ๐จ n โ Hist ๐ ๐ ๐จ nHistory ofncomplete rounds;n = 0is the empty history. -
f : ๐' โ ๐
-
hF : โ (n : โ), Measurable (F n)A functionfbetween measurable spaces is measurable if the preimage of every measurable set is measurable. -
hf : Measurable f
Environment ๐ ๐' ๐จ{ obs := fun n => (env.obs n).comap (F n) โฏ,
feedback := fun n => (env.feedback n).comap (fun p => ((F n p.1.1, p.1.2), f p.2)) โฏ, isMarkovKernel_obs := โฏ,
isMarkovKernel_feedback := โฏ }MeasurableSpace : Type u_6 โ Type u_6A measurable space is a space equipped with a ฯ-algebra.
Learning.Environment : (๐ : Type u_5) โ
(๐ : Type u_6) โ
(๐จ : Type u_7) โ [MeasurableSpace ๐] โ [MeasurableSpace ๐] โ [MeasurableSpace ๐จ] โ Type (max (max u_5 u_6) u_7)A stochastic environment. At each round, an observation is drawn prior to the algorithm taking an action. Then the environment provides feedback based on the observation and the action.Go to its page
Learning.Hist : Type u_5 โ Type u_6 โ Type u_7 โ โ โ Type (max (max u_7 u_6) u_5)History of `n` complete rounds; `n = 0` is the empty history.Go to its page
Nat : TypeThe natural numbers, starting at zero. This type is special-cased by both the kernel and the compiler, and overridden with an efficient implementation. Both use a fast arbitrary-precision arithmetic library (usually [GMP](https://gmplib.org/)); at runtime, `Nat` values that are sufficiently small are unboxed.
Measurable : {ฮฑ : Type u_1} โ {ฮฒ : Type u_2} โ [MeasurableSpace ฮฑ] โ [MeasurableSpace ฮฒ] โ (ฮฑ โ ฮฒ) โ PropA function `f` between measurable spaces is measurable if the preimage of every measurable set is measurable.
ProbabilityTheory.Kernel.comap : {ฮฑ : Type u_1} โ
{ฮฒ : Type u_2} โ
{mฮฑ : MeasurableSpace ฮฑ} โ
{mฮฒ : MeasurableSpace ฮฒ} โ
{ฮณ : Type u_4} โ
{mฮณ : MeasurableSpace ฮณ} โ
ProbabilityTheory.Kernel ฮฑ ฮฒ โ (g : ฮณ โ ฮฑ) โ Measurable g โ ProbabilityTheory.Kernel ฮณ ฮฒPullback of a kernel, such that for each set s `comap ฮบ g hg c s = ฮบ (g c) s`. We include measurability in the assumptions instead of using junk values to make sure that typeclass inference can infer that the `comap` of a Markov kernel is again a Markov kernel.
Prod.mk : {ฮฑ : Type u} โ {ฮฒ : Type v} โ ฮฑ โ ฮฒ โ ฮฑ ร ฮฒConstructs a pair. This is usually written `(x, y)` instead of `Prod.mk x y`. Conventions for notations in identifiers: * The recommended spelling of `(a, b)` in identifiers is `mk`.
Code
def Environment.comap (env : Environment ๐ ๐ ๐จ)
(F : (n : โ) โ Hist ๐ ๐' ๐จ n โ Hist ๐ ๐ ๐จ n) (hF : โ n, Measurable (F n))
(f : ๐' โ ๐) (hf : Measurable f) : Environment ๐ ๐' ๐จ where
obs n := (env.obs n).comap (F n) (hF n)
feedback n := (env.feedback n).comap (fun p โฆ ((F n p.1.1, p.1.2), f p.2)) (by fun_prop)Meaning last changed in v4.34.0-rc2-76-g565f652 (2026-09-10).
Self-contained, with its dependencies inlined and proofs replaced by sorry: download the raw file ยท open it in the Lean web editor.
Dependency graph
Audit surface: 3 project declarations, 13 external constants
โ Proved: no sorry anywhere in its closure
This is the tool's own reading of one build's recorded axioms, and it is not robust against an author who wants it to pass. Checking meant to be relied on should go through Comparator, which replays the proof through the kernel from an export against an explicit list of permitted axioms.