Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

QPBT definitions: Games / DistributionAux

Definition
QPBT_QPBT_Games_DistributionAux

by Dengnifer · Oct 27, 2026 · Mathlib 0df444a (Lean v4.33.1)

qpbt

This bundle defines finite-distribution operations used by sandwich constructions and typed question laws. It includes dependent bind, convex mixtures, normalized restrictions, and the probability and push-forward facts needed by those operations.

Principal definitions:

  • MIPStarRE.QPBT.Distribution.bind: defines dependent bind for finite distributions.
  • MIPStarRE.QPBT.uniformDistribution_weight_apply: gives reciprocal uniform weights on finite types.
  • Product formation combines two finite distributions.
  • Mixture formation combines distributions with a coefficient.
  • Restriction normalizes a positive-mass event.
  • Probability and support extensionality establish the corresponding laws.

Formalization Credit. This Lean declaration is part of the Quantum Pauli basis test formalization by Ruixuan Deng. The source code was generated by AI agents; Ruixuan Deng is the responsible maintainer.

Mathematical Source. The mathematical source is Ji, Natarajan, Vidick, Wright, and Yuen, MIP*=RE, arXiv:2001.04383v3.

Definition code
-- Generated from QPBT/Games/DistributionAux.lean by skeleton subtraction.
import Definitions.Def_LIDT_MIPStarRE_LDT_Basic_AxisParallelLine
import Definitions.Def_LIDT_MIPStarRE_LDT_Basic_DiagonalLine
import Definitions.Def_LIDT_MIPStarRE_LDT_Basic_Distribution
import Definitions.Def_LIDT_MIPStarRE_LDT_Basic_LinePolynomials
import Definitions.Def_LIDT_MIPStarRE_LDT_Basic_LowDegreePolynomial
import Definitions.Def_LIDT_MIPStarRE_LDT_Basic_OpFamily
import Definitions.Def_LIDT_MIPStarRE_LDT_Basic_ParametersBase
import Definitions.Def_LIDT_MIPStarRE_LDT_Basic_ParametersFiniteAnswers
import Definitions.Def_LIDT_MIPStarRE_LDT_Basic_QuantumState
import Definitions.Def_LIDT_MIPStarRE_LDT_CommutativityPoints_Defs
import Definitions.Def_LIDT_MIPStarRE_LDT_ExpansionHypercubeGraph_Defs_Core
import Definitions.Def_LIDT_MIPStarRE_LDT_GlobalVariance_Defs_Core
import Definitions.Def_LIDT_MIPStarRE_LDT_MakingMeasurementsProjective_Defs
import Definitions.Def_LIDT_MIPStarRE_LDT_Pasting_Defs_Families
import Definitions.Def_LIDT_MIPStarRE_LDT_Pasting_Defs_Interpolation
import Definitions.Def_LIDT_MIPStarRE_LDT_Tactic_AvgCongr
import Definitions.Def_LIDT_MIPStarRE_LDT_Test_StrategyCore
import Definitions.Def_QPBT_QPBT_Upstream

namespace LIDT.MIPStarRE.LDT
end LIDT.MIPStarRE.LDT
namespace MIPStarRE.QPBT
end MIPStarRE.QPBT

/-! # Operations on finite distributions

Finite distributions support products, convex mixtures, dependent binds,
normalized restrictions, and push-forwards.  Uniform laws are preserved by
bijections and balanced maps, their product projections are uniform, and
dependent uniform sampling agrees with push-forward from a product.
-/

@[expose] public section

open scoped BigOperators

namespace MIPStarRE.QPBT

open LIDT.MIPStarRE.LDT

/-- The product of two finite distributions, a formalization-only auxiliary
used by the sandwich construction; blueprint `lem:ld-sandwich`,
paper `06_nonlocal_games_and_mipstar.tex:465-501`. -/
noncomputable def Distribution.prod {α β : Type*} [DecidableEq α] [DecidableEq β]
    (μ : _root_.LIDT.MIPStarRE.LDT.Distribution α) (ν : _root_.LIDT.MIPStarRE.LDT.Distribution β) : _root_.LIDT.MIPStarRE.LDT.Distribution (α × β) where
  support := μ.support.product ν.support
  weight p := μ.weight p.1 * ν.weight p.2
  nonnegative p := mul_nonneg (μ.nonnegative p.1) (ν.nonnegative p.2)
  outsideSupport p hp := by
    by_cases hμ : p.1 ∈ μ.support
    · have hν : p.2 ∉ ν.support := by
        intro h
        exact hp (Finset.mem_product.mpr ⟨hμ, h⟩)
      simp [ν.outsideSupport p.2 hν]
    · simp [μ.outsideSupport p.1 hμ]



/-- The convex mixture with a coefficient in `[0,1]`, as used for
the equal mixture in blueprint
`def:line-point-dist`, paper
`08_classical_and_quantum_low_degree_tests.tex:274-287`. -/
noncomputable def Distribution.mix {α : Type*} [DecidableEq α]
    (t : ℝ) (ht0 : 0 ≤ t) (ht1 : t ≤ 1)
    (μ ν : _root_.LIDT.MIPStarRE.LDT.Distribution α) : _root_.LIDT.MIPStarRE.LDT.Distribution α where
  support := μ.support ∪ ν.support
  weight a := t * μ.weight a + (1 - t) * ν.weight a
  nonnegative a := by
    exact add_nonneg
      (mul_nonneg ht0 (μ.nonnegative a))
      (mul_nonneg (sub_nonneg.mpr ht1) (ν.nonnegative a))
  outsideSupport a ha := by
    have hμ : a ∉ μ.support := fun h => ha (Finset.mem_union_left _ h)
    have hν : a ∉ ν.support := fun h => ha (Finset.mem_union_right _ h)
    simp [μ.outsideSupport a hμ, ν.outsideSupport a hν]

/-- A convex mixture of probability distributions is a probability distribution;
blueprint `def:line-point-dist`, paper
`08_classical_and_quantum_low_degree_tests.tex:274-287`. -/
theorem Distribution.mix_isProbability {α : Type*} [DecidableEq α]
    (t : ℝ) (μ ν : _root_.LIDT.MIPStarRE.LDT.Distribution α) (hμ : μ.IsProbability)
    (hν : ν.IsProbability) (ht0 : 0 ≤ t) (ht1 : t ≤ 1) :
    (_root_.MIPStarRE.QPBT.Distribution.mix t ht0 ht1 μ ν).IsProbability := by
  have hμ_union :
      ∑ a ∈ μ.support ∪ ν.support, μ.weight a = 1 := by
    apply hμ.weight_sum_eq_one_of_subset
    intro a ha
    exact Finset.mem_union_left ν.support ha
  have hν_union :
      ∑ a ∈ μ.support ∪ ν.support, ν.weight a = 1 := by
    apply hν.weight_sum_eq_one_of_subset
    intro a ha
    exact Finset.mem_union_right μ.support ha
  simp only [_root_.LIDT.MIPStarRE.LDT.Distribution.IsProbability, _root_.LIDT.MIPStarRE.LDT.Distribution.totalWeight,
    _root_.MIPStarRE.QPBT.Distribution.mix]
  rw [Finset.sum_add_distrib, ← Finset.mul_sum, ← Finset.mul_sum,
    hμ_union, hν_union]
  ring

/-- The dependent bind of finite distributions used for typed question
distributions, blueprint `def:typed-cl-distributions`, paper
`07_types.tex:84-94`. -/
noncomputable def Distribution.bind {α β : Type*} [DecidableEq β]
    (μ : _root_.LIDT.MIPStarRE.LDT.Distribution α) (ν : α → _root_.LIDT.MIPStarRE.LDT.Distribution β) : _root_.LIDT.MIPStarRE.LDT.Distribution β where
  support := μ.support.biUnion (fun a => (ν a).support)
  weight b := ∑ a ∈ μ.support, μ.weight a * (ν a).weight b
  nonnegative b := Finset.sum_nonneg fun a _ => mul_nonneg (μ.nonnegative a) ((ν a).nonnegative b)
  outsideSupport b hb := by
    apply Finset.sum_eq_zero
    intro a ha
    have hnot : b ∉ (ν a).support := by
      intro h
      exact hb (Finset.mem_biUnion.mpr ⟨a, ha, h⟩)
    simp [ν a |>.outsideSupport b hnot]



/-- Restrict a distribution to a decidable positive-mass event and normalize it,
as in blueprint
`def:ith-restricted-line`, paper
`14_analysis_of_the_pauli_basis_test.tex:1038-1048`. -/
noncomputable def Distribution.restrict {α : Type*} [DecidableEq α]
    (μ : _root_.LIDT.MIPStarRE.LDT.Distribution α) (p : α → Prop) [DecidablePred p]
    (hpos : 0 < ∑ a ∈ μ.support.filter p, μ.weight a) : _root_.LIDT.MIPStarRE.LDT.Distribution α where
  support := μ.support.filter p
  weight a := if p a then μ.weight a / ∑ b ∈ μ.support.filter p, μ.weight b else 0
  nonnegative a := by
    split
    · exact div_nonneg (μ.nonnegative a) (le_of_lt hpos)
    · exact le_rfl
  outsideSupport a ha := by
    by_cases hp : p a
    · have hμ : a ∉ μ.support := fun h => ha (Finset.mem_filter.mpr ⟨h, hp⟩)
      simp [hp, μ.outsideSupport a hμ]
    · simp [hp]



/-! ### Push-forwards of finite and uniform distributions

The results of this section are not named in the paper.  They record the
elementary behaviour of push-forwards of finite distributions, and of uniform
distributions on finite types, that the line-point samplers of the low-degree
game and the identification of question distributions with typed conditionally
linear distributions rely on.
-/

/-- Formalization-only lemma: two finite distributions coincide as soon as
their supports and weight functions coincide.  This is the support statement
`lem:distribution-ext-support` in blueprint chapter 13. -/
theorem Distribution.ext_of_support_of_weight {α : Type*} {μ ν : _root_.LIDT.MIPStarRE.LDT.Distribution α}
    (hsupport : μ.support = ν.support) (hweight : μ.weight = ν.weight) :
    μ = ν := by
  cases μ with
  | mk s w hn ho =>
    cases ν with
    | mk s' w' hn' ho' =>
      have hs : s = s' := hsupport
      have hw : w = w' := hweight
      subst hs
      subst hw
      rfl

/-- Formalization-only lemma: successive push-forwards of a finite distribution
compose.  This is `lem:distribution-map-comp` in blueprint chapter 13. -/
theorem Distribution.map_map {α β γ : Type*}
    [DecidableEq β] [DecidableEq γ]
    (μ : _root_.LIDT.MIPStarRE.LDT.Distribution α) (e : α → β) (f : β → γ) :
    (μ.map e).map f = μ.map fun a => f (e a) := by
  refine _root_.MIPStarRE.QPBT.Distribution.ext_of_support_of_weight ?_ ?_
  · change (μ.support.image e).image f = μ.support.image fun a => f (e a)
    rw [Finset.image_image]
    rfl
  · funext c
    have hmaps : ∀ a ∈ μ.support.filter fun a => f (e a) = c,
        e a ∈ (μ.support.image e).filter fun b => f b = c := by
      intro a ha
      obtain ⟨ha1, ha2⟩ := Finset.mem_filter.mp ha
      exact Finset.mem_filter.mpr ⟨Finset.mem_image_of_mem _ ha1, ha2⟩
    have hkey := Finset.sum_fiberwise_of_maps_to hmaps μ.weight
    change (∑ b ∈ (μ.support.image e).filter fun b => f b = c,
        ∑ a ∈ μ.support.filter fun a => e a = b, μ.weight a) =
      ∑ a ∈ μ.support.filter fun a => f (e a) = c, μ.weight a
    rw [← hkey]
    refine Finset.sum_congr rfl fun b hb => ?_
    obtain ⟨-, hb2⟩ := Finset.mem_filter.mp hb
    congr 1
    ext a
    simp only [Finset.mem_filter]
    constructor
    · rintro ⟨ha1, rfl⟩
      exact ⟨⟨ha1, hb2⟩, rfl⟩
    · rintro ⟨⟨ha1, -⟩, hae⟩
      exact ⟨ha1, hae⟩

/-- Formalization-only lemma: every point of a nonempty finite type carries the
reciprocal of the type's cardinality as its uniform weight.  This is
`lem:uniform-distribution-weight` in blueprint chapter 13. -/
theorem uniformDistribution_weight_apply (α : Type*)
    [Fintype α] [DecidableEq α] [Nonempty α] (a : α) :
    (_root_.LIDT.MIPStarRE.LDT.uniformDistribution α).weight a = 1 / (Fintype.card α : _root_.LIDT.MIPStarRE.LDT.Error) := by
  simp [_root_.LIDT.MIPStarRE.LDT.uniformDistribution]

/-- Formalization-only lemma: a push-forward of a uniform law assigns to a point
the cardinality of its fibre divided by the cardinality of the source.  This is
`lem:uniform-map-fibre-weight` in blueprint chapter 13. -/
theorem uniformDistribution_map_weight {α γ : Type*}
    [Fintype α] [DecidableEq α] [Nonempty α] [DecidableEq γ]
    (e : α → γ) (c : γ) :
    ((_root_.LIDT.MIPStarRE.LDT.uniformDistribution α).map e).weight c =
      (((Finset.univ : Finset α).filter fun x => e x = c).card : _root_.LIDT.MIPStarRE.LDT.Error) *
        (1 / (Fintype.card α : _root_.LIDT.MIPStarRE.LDT.Error)) := by
  change (∑ x ∈ (Finset.univ : Finset α).filter (fun x => e x = c),
      (_root_.LIDT.MIPStarRE.LDT.uniformDistribution α).weight x) = _
  rw [Finset.sum_congr rfl fun x _ => _root_.MIPStarRE.QPBT.uniformDistribution_weight_apply α x,
    Finset.sum_const, nsmul_eq_mul]

/-- Formalization-only lemma: a map whose fibers all have the same cardinality
pushes the uniform distribution forward to the uniform distribution.  This is
`lem:uniform-map-equal-fibers` in blueprint chapter 13. -/
theorem uniformDistribution_map_of_card_fiber {α β : Type*}
    [Fintype α] [DecidableEq α] [Nonempty α]
    [Fintype β] [DecidableEq β] [Nonempty β]
    (e : α → β) (c : ℕ)
    (hc : ∀ b : β, ((Finset.univ : Finset α).filter fun a => e a = b).card = c) :
    (_root_.LIDT.MIPStarRE.LDT.uniformDistribution α).map e = _root_.LIDT.MIPStarRE.LDT.uniformDistribution β := by
  have hcpos : 0 < c := by
    obtain ⟨a₀⟩ := (inferInstance : Nonempty α)
    have hmem : a₀ ∈ (Finset.univ : Finset α).filter fun a => e a = e a₀ :=
      Finset.mem_filter.mpr ⟨Finset.mem_univ _, rfl⟩
    have hpos := Finset.card_pos.mpr ⟨a₀, hmem⟩
    rwa [hc] at hpos
  have hcard : Fintype.card α = Fintype.card β * c := by
    have h := Finset.card_eq_sum_card_fiberwise
      (f := e) (s := (Finset.univ : Finset α)) (t := (Finset.univ : Finset β))
      (fun a _ => Finset.mem_univ _)
    rw [Finset.card_univ] at h
    rw [h, Finset.sum_congr rfl fun b _ => hc b]
    simp [Finset.card_univ, mul_comm]
  refine _root_.MIPStarRE.QPBT.Distribution.ext_of_support_of_weight ?_ ?_
  · change (Finset.univ : Finset α).image e = (Finset.univ : Finset β)
    ext b
    simp only [Finset.mem_image, Finset.mem_univ, iff_true, true_and]
    have hne : ((Finset.univ : Finset α).filter fun a => e a = b).Nonempty := by
      rw [← Finset.card_pos, hc]
      exact hcpos
    obtain ⟨a, ha⟩ := hne
    exact ⟨a, (Finset.mem_filter.mp ha).2⟩
  · funext b
    have hbeta : (Fintype.card β : _root_.LIDT.MIPStarRE.LDT.Error) ≠ 0 := by
      exact_mod_cast Fintype.card_ne_zero (α := β)
    have hc' : (c : _root_.LIDT.MIPStarRE.LDT.Error) ≠ 0 := by exact_mod_cast hcpos.ne'
    change (∑ a ∈ (Finset.univ : Finset α).filter fun a => e a = b,
        (_root_.LIDT.MIPStarRE.LDT.uniformDistribution α).weight a) = (_root_.LIDT.MIPStarRE.LDT.uniformDistribution β).weight b
    rw [Finset.sum_congr rfl fun a _ => _root_.MIPStarRE.QPBT.uniformDistribution_weight_apply α a,
      _root_.MIPStarRE.QPBT.uniformDistribution_weight_apply, Finset.sum_const, hc, nsmul_eq_mul, hcard]
    push_cast
    field_simp

/-- Formalization-only lemma: relabelling along a bijection preserves
uniformity.  This is `lem:uniform-map-equivalence` in blueprint chapter 13. -/
theorem uniformDistribution_map_equiv {α β : Type*}
    [Fintype α] [DecidableEq α] [Nonempty α]
    [Fintype β] [DecidableEq β] [Nonempty β] (E : α ≃ β) :
    (_root_.LIDT.MIPStarRE.LDT.uniformDistribution α).map E = _root_.LIDT.MIPStarRE.LDT.uniformDistribution β := by
  refine _root_.MIPStarRE.QPBT.uniformDistribution_map_of_card_fiber _ 1 fun b => ?_
  have hfilter :
      ((Finset.univ : Finset α).filter fun a => E a = b) = {E.symm b} := by
    ext a
    simp [Equiv.apply_eq_iff_eq_symm_apply]
  rw [hfilter]
  simp

/-- Formalization-only lemma: the first marginal of the uniform distribution on
a product is uniform.  This is `lem:uniform-product-first-marginal` in blueprint
chapter 13. -/
theorem uniformDistribution_map_fst {α β : Type*}
    [Fintype α] [DecidableEq α] [Nonempty α]
    [Fintype β] [DecidableEq β] [Nonempty β] :
    (_root_.LIDT.MIPStarRE.LDT.uniformDistribution (α × β)).map Prod.fst = _root_.LIDT.MIPStarRE.LDT.uniformDistribution α := by
  refine _root_.MIPStarRE.QPBT.uniformDistribution_map_of_card_fiber _ (Fintype.card β) fun a => ?_
  have hfilter : ((Finset.univ : Finset (α × β)).filter fun p => p.1 = a)
      = ({a} : Finset α) ×ˢ (Finset.univ : Finset β) := by
    ext p
    simp only [Finset.mem_filter, Finset.mem_univ, true_and, Finset.mem_product,
      Finset.mem_singleton, and_true]
  rw [hfilter, Finset.card_product]
  simp



/-- Formalization-only lemma: binding the uniform law on a finite subset to a
family of uniformly seeded push-forwards is the push-forward of the uniform law
on the product of an indexing type for that subset with the seed space.  This is
`lem:uniform-bind-on-finset-map` in blueprint chapter 13. -/
theorem bind_uniformOnFinset_map {α β γ σ : Type*} [DecidableEq α]
    [Fintype σ] [DecidableEq σ] [Nonempty σ]
    [Fintype β] [DecidableEq β] [Nonempty β] [DecidableEq γ]
    (s : Finset α) (f : σ → α) (hinj : Function.Injective f)
    (himage : (Finset.univ : Finset σ).image f = s) (g : α → β → γ) :
    _root_.MIPStarRE.QPBT.Distribution.bind (_root_.LIDT.MIPStarRE.LDT.Distribution.uniformOnFinset s)
        (fun a => (_root_.LIDT.MIPStarRE.LDT.uniformDistribution β).map (g a)) =
      (_root_.LIDT.MIPStarRE.LDT.uniformDistribution (σ × β)).map fun q => g (f q.1) q.2 := by
  have hmem : ∀ a, a ∈ s ↔ ∃ x : σ, f x = a := by
    intro a
    rw [← himage]
    simp
  have hcard : s.card = Fintype.card σ := by
    rw [← himage, Finset.card_image_of_injective _ hinj, Finset.card_univ]
  have hsum : ∀ h : α → _root_.LIDT.MIPStarRE.LDT.Error, ∑ a ∈ s, h a = ∑ x : σ, h (f x) := by
    intro h
    rw [← himage, Finset.sum_image fun x _ y _ hxy => hinj hxy]
  refine _root_.MIPStarRE.QPBT.Distribution.ext_of_support_of_weight ?_ ?_
  · change s.biUnion (fun a => (Finset.univ : Finset β).image (g a)) =
      (Finset.univ : Finset (σ × β)).image fun q => g (f q.1) q.2
    ext c
    simp only [Finset.mem_biUnion, Finset.mem_image, Finset.mem_univ, true_and,
      Prod.exists]
    constructor
    · rintro ⟨a, ha, b, rfl⟩
      obtain ⟨xx, rfl⟩ := (hmem a).mp ha
      exact ⟨xx, b, rfl⟩
    · rintro ⟨xx, b, rfl⟩
      exact ⟨f xx, (hmem _).mpr ⟨xx, rfl⟩, b, rfl⟩
  · funext c
    have key : ∀ a ∈ s, (_root_.LIDT.MIPStarRE.LDT.Distribution.uniformOnFinset s).weight a *
        ((_root_.LIDT.MIPStarRE.LDT.uniformDistribution β).map (g a)).weight c =
        (((Finset.univ : Finset β).filter fun b => g a b = c).card : _root_.LIDT.MIPStarRE.LDT.Error) *
          (1 / ((Fintype.card σ : _root_.LIDT.MIPStarRE.LDT.Error) * (Fintype.card β : _root_.LIDT.MIPStarRE.LDT.Error))) := by
      intro a ha
      rw [_root_.LIDT.MIPStarRE.LDT.Distribution.uniformOnFinset_weight, if_pos ha,
        _root_.MIPStarRE.QPBT.uniformDistribution_map_weight, hcard]
      ring
    have hcount :
        ((Finset.univ : Finset (σ × β)).filter fun q => g (f q.1) q.2 = c).card =
          ∑ x : σ, ((Finset.univ : Finset β).filter fun b => g (f x) b = c).card := by
      simp only [Finset.card_filter]
      rw [Fintype.sum_prod_type]
    change (∑ a ∈ s, (_root_.LIDT.MIPStarRE.LDT.Distribution.uniformOnFinset s).weight a *
        ((_root_.LIDT.MIPStarRE.LDT.uniformDistribution β).map (g a)).weight c) =
      ∑ q ∈ (Finset.univ : Finset (σ × β)).filter fun q => g (f q.1) q.2 = c,
        (_root_.LIDT.MIPStarRE.LDT.uniformDistribution (σ × β)).weight q
    rw [Finset.sum_congr rfl key,
      hsum fun a => (((Finset.univ : Finset β).filter fun b => g a b = c).card : _root_.LIDT.MIPStarRE.LDT.Error) *
        (1 / ((Fintype.card σ : _root_.LIDT.MIPStarRE.LDT.Error) * (Fintype.card β : _root_.LIDT.MIPStarRE.LDT.Error))),
      ← Finset.sum_mul,
      Finset.sum_congr rfl fun q _ => _root_.MIPStarRE.QPBT.uniformDistribution_weight_apply (σ × β) q,
      Finset.sum_const, nsmul_eq_mul, hcount, Fintype.card_prod]
    push_cast
    ring



/-! ## Elementary rewriting of finite distributions -/

/-- Formalization-only auxiliary: the mass of a decidable event is the average
of its indicator.  Blueprint `lem:restricted-line-mixture-bounds`, paper
`references/qpbt-paper/14_analysis_of_the_pauli_basis_test.tex:1049-1051`. -/
theorem Distribution.sum_filter_weight_eq_avgOver {α : Type*}
    (μ : _root_.LIDT.MIPStarRE.LDT.Distribution α) (p : α → Prop) [DecidablePred p] :
    ∑ a ∈ μ.support.filter p, μ.weight a =
      _root_.LIDT.MIPStarRE.LDT.avgOver μ (fun a => if p a then 1 else 0) := by
  unfold _root_.LIDT.MIPStarRE.LDT.avgOver
  rw [Finset.sum_filter]
  refine Finset.sum_congr rfl fun a _ => ?_
  by_cases h : p a <;> simp [h]





/-! ## Reindexing a dependent mixture -/







/-! ## Associativity of dependent mixtures -/



/-! ## Products with an independent factor -/



/-! ## The equal two-term mixture as a uniform dependent mixture -/



/-! ## Averages of the distribution operations -/



/-- Formalization-only auxiliary: an average against a convex mixture is the
convex combination of the two averages.  Blueprint
`lem:restricted-line-mixture-bounds`, paper
`references/qpbt-paper/14_analysis_of_the_pauli_basis_test.tex:1052-1058`. -/
theorem avgOver_mix {α : Type*} [DecidableEq α] (t : ℝ) (ht0 : 0 ≤ t)
    (ht1 : t ≤ 1) (μ ν : _root_.LIDT.MIPStarRE.LDT.Distribution α) (f : α → ℝ) :
    _root_.LIDT.MIPStarRE.LDT.avgOver (_root_.MIPStarRE.QPBT.Distribution.mix t ht0 ht1 μ ν) f =
      t * _root_.LIDT.MIPStarRE.LDT.avgOver μ f + (1 - t) * _root_.LIDT.MIPStarRE.LDT.avgOver ν f := by
  classical
  unfold _root_.LIDT.MIPStarRE.LDT.avgOver
  have hsplit : (∑ a ∈ μ.support ∪ ν.support,
        (t * μ.weight a + (1 - t) * ν.weight a) * f a) =
      t * (∑ a ∈ μ.support ∪ ν.support, μ.weight a * f a) +
        (1 - t) * (∑ a ∈ μ.support ∪ ν.support, ν.weight a * f a) := by
    rw [Finset.mul_sum, Finset.mul_sum, ← Finset.sum_add_distrib]
    exact Finset.sum_congr rfl fun a _ => by ring
  have hμ : (∑ a ∈ μ.support ∪ ν.support, μ.weight a * f a) =
      ∑ a ∈ μ.support, μ.weight a * f a := by
    refine (Finset.sum_subset Finset.subset_union_left ?_).symm
    intro a _ ha
    rw [μ.outsideSupport a ha, zero_mul]
  have hν : (∑ a ∈ μ.support ∪ ν.support, ν.weight a * f a) =
      ∑ a ∈ ν.support, ν.weight a * f a := by
    refine (Finset.sum_subset Finset.subset_union_right ?_).symm
    intro a _ ha
    rw [ν.outsideSupport a ha, zero_mul]
  change (∑ a ∈ μ.support ∪ ν.support,
    (t * μ.weight a + (1 - t) * ν.weight a) * f a) = _
  rw [hsplit, hμ, hν]



end MIPStarRE.QPBT
Source
https://github.com/Dengnifer/MIPStarRE-QPBT/blob/8f4118aeea7be16912adbaee3df6dce1741a2c26/QPBT/Games/DistributionAux.lean#L22-L776

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me