Kernel lifting utilities #
This file provides helper functions for lifting and unlifting kernel expressions: type extraction,
construction of measurable equivalences, and explicit constructors for kernel operations and
Kernel.lift. The constructors build the applications directly (mkAppN with explicit universe
levels and instances) instead of going through mkAppM, whose unification is the main cost of
the transformations.
Main declarations #
Carrier: a measurable spaceX : Type u, given by the expressionXand the levelu.getTypesFromKernel: extracts carrier types and universe levels from kernel expressions.constructMeasurableEquiv: recursively builds measurable equivalences.getOriginalType: retrieves the original type from a lifted type.mkKernelComp,mkKernelParallelComp, ...,mkKernelLift: explicit constructors.
A measurable space: the carrier type and its universe level.
- type : Lean.Expr
The carrier type.
- lvl : Lean.Level
The universe level of the carrier type.
Instances For
The MeasurableSpace instance of a carrier (cached).
Equations
- c.inst = synthInstanceCached (Lean.mkApp (Lean.mkConst `MeasurableSpace [c.lvl]) c.type)
Instances For
Extract (X, Y, u, v) from an expression of type Kernel X Y.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Extract the source and target carriers of a kernel.
Equations
Instances For
Build the measurable equivalence X' ≃ᵐ X between the lift X' of e to the universe
maxLvl and e itself, recursively on products. Returns the equivalence and X'.
Get the original type from a lifted type.
Explicit constructors #
η ∘ₖ κ with κ : Kernel X Y and η : Kernel Y Z.
Equations
- One or more equations did not get rendered due to their size.
Instances For
κ ∥ₖ η with κ : Kernel X Y and η : Kernel Z T.
Equations
- One or more equations did not get rendered due to their size.
Instances For
κ ×ₖ η with κ : Kernel X Y and η : Kernel X Z.
Equations
- One or more equations did not get rendered due to their size.
Instances For
κ ⊗ₖ η with κ : Kernel X Y and η : Kernel (X × Y) Z.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Kernel.id : Kernel X X.
Equations
- mkKernelId X = do let __do_lift ← X.inst pure (Lean.mkAppN (Lean.mkConst `ProbabilityTheory.Kernel.id [X.lvl]) #[X.type, __do_lift])
Instances For
Kernel.copy X.
Equations
- mkKernelCopy X = do let __do_lift ← X.inst pure (Lean.mkAppN (Lean.mkConst `ProbabilityTheory.Kernel.copy [X.lvl]) #[X.type, __do_lift])
Instances For
Kernel.discard X : Kernel X PUnit.{punitLvl + 1}.
Equations
- mkKernelDiscard X punitLvl = do let __do_lift ← X.inst pure (Lean.mkAppN (Lean.mkConst `ProbabilityTheory.Kernel.discard [X.lvl, punitLvl]) #[X.type, __do_lift])
Instances For
Kernel.swap X Y.
Equations
- One or more equations did not get rendered due to their size.
Instances For
κ.lift (ex := ex) (ey := ey) : Kernel X' Y' with κ : Kernel X Y.
Equations
- One or more equations did not get rendered due to their size.