Documentation

ToCslib.MeasureTheory.Measure.Coupling

Couplings of measures #

This file defines couplings directly at Mathlib's Measure boundary. A coupling is a joint measure whose first and second marginals are the requested measures. No discreteness or countability assumption is built into the definition.

The elementary constructors are the diagonal (IsCoupling.refl), the graph of a measurable map (IsCoupling.graph), Dirac pairs, the swap and pushforwards. Two finite measures with the same total mass have a coupling, the normalized product (IsCoupling.smul_prod), and only measures with the same total mass do (IsCoupling.apply_univ_eq).

The remaining laws read a coupling concentrated on the graph of a measurable map, z.2 = f z.1 almost everywhere. Its second marginal is the pushforward of its first (IsCoupling.eq_map_of_ae_eq), and the joint measure is the graph coupling (IsCoupling.joint_eq_map_of_ae_eq). A coupling concentrated on the diagonal therefore has equal marginals (IsCoupling.eq_of_ae_eq), with no measurability assumption on the diagonal. Couplings compose with such functional couplings (IsCoupling.trans_of_ae_eq); composing couplings of arbitrary relations would need a gluing construction, which this file does not provide.

These are the measure-theoretic foundation of the relational program logic ExpectationWP.RelWP, whose postconditions hold almost everywhere under the joint measure.

class MeasureTheory.Measure.IsCoupling {α : Type u} {β : Type v} [MeasurableSpace α] [MeasurableSpace β] (c : Measure (α × β)) (μ : Measure α) (ν : Measure β) :

c is a coupling of μ and ν when its two marginals are exactly μ and ν.

  • fst_eq : c.fst = μ

    The first marginal of the joint measure.

  • snd_eq : c.snd = ν

    The second marginal of the joint measure.

Instances
    structure MeasureTheory.Measure.Coupling {α : Type u} {β : Type v} [MeasurableSpace α] [MeasurableSpace β] (μ : Measure α) (ν : Measure β) :
    Type (max u v)

    A joint measure together with its two marginal equations.

    Instances For
      theorem MeasureTheory.Measure.Coupling.ext {α : Type u} {β : Type v} {inst✝ : MeasurableSpace α} {inst✝¹ : MeasurableSpace β} {μ : Measure α} {ν : Measure β} {x y : μ.Coupling ν} (joint : x.joint = y.joint) :
      x = y
      theorem MeasureTheory.Measure.Coupling.ext_iff {α : Type u} {β : Type v} {inst✝ : MeasurableSpace α} {inst✝¹ : MeasurableSpace β} {μ : Measure α} {ν : Measure β} {x y : μ.Coupling ν} :
      x = y ↔ x.joint = y.joint
      theorem MeasureTheory.Measure.IsCoupling.joint_apply_univ_eq_left {α : Type u} {β : Type v} [MeasurableSpace α] [MeasurableSpace β] {c : Measure (α × β)} {μ : Measure α} {ν : Measure β} (h : c.IsCoupling μ ν) :

      A coupling has the same total mass as its first marginal.

      theorem MeasureTheory.Measure.IsCoupling.joint_apply_univ_eq_right {α : Type u} {β : Type v} [MeasurableSpace α] [MeasurableSpace β] {c : Measure (α × β)} {μ : Measure α} {ν : Measure β} (h : c.IsCoupling μ ν) :

      A coupling has the same total mass as its second marginal.

      theorem MeasureTheory.Measure.IsCoupling.apply_univ_eq {α : Type u} {β : Type v} [MeasurableSpace α] [MeasurableSpace β] {c : Measure (α × β)} {μ : Measure α} {ν : Measure β} (h : c.IsCoupling μ ν) :

      Measures admitting a coupling necessarily have equal total mass.

      theorem MeasureTheory.Measure.IsCoupling.ae_mem_prod {α : Type u} {β : Type v} [MeasurableSpace α] [MeasurableSpace β] {c : Measure (α × β)} {μ : Measure α} {ν : Measure β} (h : c.IsCoupling μ ν) {s : Set α} {t : Set β} (hs : MeasurableSet s) (ht : MeasurableSet t) (hμ : ∀ᵐ (a : α) ∂μ, a ∈ s) (hν : ∀ᵐ (b : β) ∂ν, b ∈ t) :
      ∀ᵐ (z : α × β) ∂c, z ∈ s ×ˢ t

      Concentration of the marginals gives concentration of the joint pair.

      Dirac marginals force the joint output pair almost everywhere.

      theorem MeasureTheory.Measure.IsCoupling.refl {α : Type u} [MeasurableSpace α] (μ : Measure α) :
      (Measure.map (fun (a : α) => (a, a)) μ).IsCoupling μ μ

      The diagonal pushforward is a self-coupling of any measure.

      theorem MeasureTheory.Measure.IsCoupling.graph {α : Type u} {β : Type v} [MeasurableSpace α] [MeasurableSpace β] (μ : Measure α) {f : α → β} (hf : Measurable f) :
      (Measure.map (fun (a : α) => (a, f a)) μ).IsCoupling μ (Measure.map f μ)

      The graph of a measurable map couples a measure with its pushforward.

      The product of two probability measures is an independent coupling.

      Two finite measures of the same total mass are coupled by their product, normalized by that mass.

      A Dirac measure at a pair couples the corresponding Dirac marginals.

      theorem MeasureTheory.Measure.IsCoupling.swap {α : Type u} {β : Type v} [MeasurableSpace α] [MeasurableSpace β] {c : Measure (α × β)} {μ : Measure α} {ν : Measure β} (h : c.IsCoupling μ ν) :

      Swapping the coordinates of a coupling swaps its marginals.

      theorem MeasureTheory.Measure.IsCoupling.map {α : Type u} {β : Type v} {γ : Type w} {δ : Type x} [MeasurableSpace α] [MeasurableSpace β] [MeasurableSpace γ] [MeasurableSpace δ] {c : Measure (α × β)} {μ : Measure α} {ν : Measure β} (h : c.IsCoupling μ ν) (f : α → γ) (g : β → δ) (hf : Measurable f) (hg : Measurable g) :
      (Measure.map (fun (z : α × β) => (f z.1, g z.2)) c).IsCoupling (Measure.map f μ) (Measure.map g ν)

      Measurable maps of both coordinates transport a coupling to the pushed-forward marginals.

      theorem MeasureTheory.Measure.IsCoupling.map_right {α : Type u} {β : Type v} {δ : Type x} [MeasurableSpace α] [MeasurableSpace β] [MeasurableSpace δ] {c : Measure (α × β)} {μ : Measure α} {ν : Measure β} (h : c.IsCoupling μ ν) {g : β → δ} (hg : Measurable g) :
      (Measure.map (fun (z : α × β) => (z.1, g z.2)) c).IsCoupling μ (Measure.map g ν)

      A measurable map of the second coordinate composes a coupling with the graph coupling of that map.

      Couplings concentrated on a graph #

      theorem MeasureTheory.Measure.IsCoupling.eq_map_of_ae_eq {α : Type u} {β : Type v} [MeasurableSpace α] [MeasurableSpace β] {c : Measure (α × β)} {μ : Measure α} {ν : Measure β} (h : c.IsCoupling μ ν) {f : α → β} (hf : Measurable f) (hc : ∀ᵐ (z : α × β) ∂c, z.2 = f z.1) :
      ν = Measure.map f μ

      The second marginal of a coupling concentrated on the graph of a measurable map is the pushforward of the first marginal.

      theorem MeasureTheory.Measure.IsCoupling.joint_eq_map_of_ae_eq {α : Type u} {β : Type v} [MeasurableSpace α] [MeasurableSpace β] {c : Measure (α × β)} {μ : Measure α} {ν : Measure β} (h : c.IsCoupling μ ν) {f : α → β} (hf : Measurable f) (hc : ∀ᵐ (z : α × β) ∂c, z.2 = f z.1) :
      c = Measure.map (fun (a : α) => (a, f a)) μ

      A coupling concentrated on the graph of a measurable map is the graph coupling of its first marginal.

      theorem MeasureTheory.Measure.IsCoupling.eq_of_ae_eq {α : Type u} [MeasurableSpace α] {c : Measure (α × α)} {μ ν : Measure α} (h : c.IsCoupling μ ν) (hc : ∀ᵐ (z : α × α) ∂c, z.1 = z.2) :
      μ = ν

      A coupling concentrated on the diagonal has equal marginals. The diagonal need not be a measurable set.

      theorem MeasureTheory.Measure.IsCoupling.trans_of_ae_eq {α : Type u} {β : Type v} {δ : Type x} [MeasurableSpace α] [MeasurableSpace β] [MeasurableSpace δ] {c : Measure (α × β)} {μ : Measure α} {ν : Measure β} {ρ : Measure δ} {c' : Measure (β × δ)} (h : c.IsCoupling μ ν) (h' : c'.IsCoupling ν ρ) {g : β → δ} (hg : Measurable g) (hc' : ∀ᵐ (z : β × δ) ∂c', z.2 = g z.1) :
      (Measure.map (fun (z : α × β) => (z.1, g z.2)) c).IsCoupling μ ρ

      A coupling of μ and ν composes with a coupling of ν and ρ concentrated on the graph of a measurable map g: mapping the second coordinate by g couples μ and ρ.

      @[reducible, inline]
      abbrev MeasureTheory.Measure.Coupling.val {α : Type u} {β : Type v} [MeasurableSpace α] [MeasurableSpace β] {μ : Measure α} {ν : Measure β} (c : μ.Coupling ν) :
      Measure (α × β)

      The underlying joint measure.

      Equations
      Instances For
        @[reducible, inline]
        abbrev MeasureTheory.Measure.Coupling.property {α : Type u} {β : Type v} [MeasurableSpace α] [MeasurableSpace β] {μ : Measure α} {ν : Measure β} (c : μ.Coupling ν) :

        The joint law's marginal certificate.

        Equations
        • ⋯ = ⋯
        Instances For
          noncomputable def MeasureTheory.Measure.Coupling.refl {α : Type u} [MeasurableSpace α] (μ : Measure α) :
          μ.Coupling μ

          Canonical diagonal self-coupling.

          Equations
          Instances For
            @[simp]
            theorem MeasureTheory.Measure.Coupling.refl_joint {α : Type u} [MeasurableSpace α] (μ : Measure α) :
            (refl μ).joint = Measure.map (fun (a : α) => (a, a)) μ

            The diagonal coupling's joint law is the diagonal pushforward.

            noncomputable def MeasureTheory.Measure.Coupling.prod {α : Type u} {β : Type v} [MeasurableSpace α] [MeasurableSpace β] (μ : Measure α) (ν : Measure β) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] :
            μ.Coupling ν

            Independent-product coupling of probability measures.

            Equations
            Instances For
              noncomputable def MeasureTheory.Measure.Coupling.dirac {α : Type u} {β : Type v} [MeasurableSpace α] [MeasurableSpace β] (a : α) (b : β) :

              Coupling of two pure outcomes.

              Equations
              Instances For
                @[simp]
                theorem MeasureTheory.Measure.Coupling.dirac_joint {α : Type u} {β : Type v} [MeasurableSpace α] [MeasurableSpace β] (a : α) (b : β) :

                The joint law of two pure outcomes is their paired Dirac measure.

                noncomputable def MeasureTheory.Measure.Coupling.swap {α : Type u} {β : Type v} [MeasurableSpace α] [MeasurableSpace β] {μ : Measure α} {ν : Measure β} (c : μ.Coupling ν) :
                ν.Coupling μ

                Swap the coordinates of a coupling.

                Equations
                Instances For
                  noncomputable def MeasureTheory.Measure.Coupling.map {α : Type u} {β : Type v} {γ : Type w} {δ : Type x} [MeasurableSpace α] [MeasurableSpace β] [MeasurableSpace γ] [MeasurableSpace δ] {μ : Measure α} {ν : Measure β} (c : μ.Coupling ν) (f : α → γ) (g : β → δ) (hf : Measurable f) (hg : Measurable g) :

                  Push a coupling forward through a pair of measurable functions.

                  Equations
                  Instances For