LeanMachineLearning

Learning.Environment.comap๐Ÿ”—

Definition

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.

Types
  • ๐“ž : 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 ๐“จ
Given
Assuming
  • hF : โˆ€ (n : โ„•), Measurable (F n)A function f between measurable spaces is measurable if the preimage of every measurable set is measurable.
  • hf : Measurable f
Result
Environment ๐“ž ๐“' ๐“จ
Body
{ 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 := โ‹ฏ }
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.