Learning.Algorithm.comap
From the authors
The algorithm with observations in ๐' and feedbacks in ๐จ' obtained from
alg : Algorithm ๐ ๐ ๐จ by transforming the pair (past rounds, current observation) by F n at
each round n before applying the policy of alg.
This is the primitive transport operation on algorithms: Algorithm.comapObs and
Algorithm.comapFeedback are the special cases in which F n is a round-wise map of the
observation and of the feedback.
-
๐ : Type u_1m๐ : MeasurableSpace ๐A measurable space is a space equipped with a ฯ-algebra. -
๐' : Type u_2m๐' : MeasurableSpace ๐' -
๐ : Type u_4m๐ : MeasurableSpace ๐ -
๐จ : Type u_7m๐จ : MeasurableSpace ๐จ -
๐จ' : Type u_8m๐จ' : MeasurableSpace ๐จ'
-
alg : Algorithm ๐ ๐ ๐จA stochastic, sequential algorithm. -
F : (n : โ) โ Hist ๐' ๐ ๐จ' n ร ๐' โ Hist ๐ ๐ ๐จ n ร ๐
-
hF : โ (n : โ), Measurable (F n)A functionfbetween measurable spaces is measurable if the preimage of every measurable set is measurable.
Algorithm ๐' ๐ ๐จ'{ policy := fun n => (alg.policy n).comap (F n) โฏ, isMarkovKernel_policy := โฏ }MeasurableSpace : Type u_6 โ Type u_6A measurable space is a space equipped with a ฯ-algebra.
Learning.Algorithm : (๐ : Type u_5) โ
(๐ : Type u_6) โ
(๐จ : Type u_7) โ [MeasurableSpace ๐] โ [MeasurableSpace ๐] โ [MeasurableSpace ๐จ] โ Type (max (max u_5 u_6) u_7)A stochastic, sequential algorithm. At each round, it sees an observation in `๐`, then takes an action in `๐`, and finally receives feedback in `๐จ`. The action is a random function of the past rounds and the current observation.Go to its page
Prod : Type u โ Type v โ Type (max u v)The product type, usually written `ฮฑ ร ฮฒ`. Product types are also called pair or tuple types. Elements of this type are pairs in which the first element is an `ฮฑ` and the second element is a `ฮฒ`. Products nest to the right, so `(x, y, z) : ฮฑ ร ฮฒ ร ฮณ` is equivalent to `(x, (y, z)) : ฮฑ ร (ฮฒ ร ฮณ)`. Conventions for notations in identifiers: * The recommended spelling of `ร` in identifiers is `Prod`.
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.
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
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.
Code
def Algorithm.comap (alg : Algorithm ๐ ๐ ๐จ)
(F : (n : โ) โ Hist ๐' ๐ ๐จ' n ร ๐' โ Hist ๐ ๐ ๐จ n ร ๐) (hF : โ n, Measurable (F n)) :
Algorithm ๐' ๐ ๐จ' where
policy n := (alg.policy n).comap (F n) (hF n)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, 10 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.