Documentation

LeanAPAP.Prereqs.Expect.Basic

Average over a finset #

This file defines Finset.expect, the average (aka expectation) of a function over a finset.

Notation #

def Finset.expect {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] (s : Finset ι) (f : ια) :
α

Average of a function over a finset. If the finset is empty, this is equal to zero.

Equations
Instances For
    • 𝔼 i ∈ s, f i is notation for Finset.expect s f. It is the expectation of f i where i ranges over the finite set s (either a Finset or a Set with a Fintype instance).
    • 𝔼 x, f x is notation for Finset.expect Finset.univ f. It is the expectation of f i where i ranges over the finite domain of f.
    • 𝔼 i ∈ s with p i, f i is notation for Finset.expect (Finset.filter p s) f.
    • 𝔼 (i ∈ s) (j ∈ t), f i j is notation for Finset.expect (s ×ˢ t) (fun ⟨i, j⟩ ↦ f i j).

    These support destructuring, for example 𝔼 ⟨i, j⟩ ∈ s ×ˢ t, f i j.

    Notation: "𝔼" bigOpBinders* ("with" term)? "," term

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      Delaborator for Finset.expect. The pp.piBinderTypes option controls whether to show the domain type when the expect is over Finset.univ.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        theorem Finset.expect_univ {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] {f : ια} [Fintype ι] :
        (Finset.univ.expect fun (x : ι) => f x) = ((Fintype.card ι))⁻¹ Finset.univ.sum fun (x : ι) => f x
        @[simp]
        theorem Finset.expect_empty {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] (f : ια) :
        .expect f = 0
        @[simp]
        theorem Finset.expect_singleton {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] (f : ια) (i : ι) :
        {i}.expect f = f i
        @[simp]
        theorem Finset.expect_const_zero {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] (s : Finset ι) :
        (s.expect fun (_i : ι) => 0) = 0
        theorem Finset.expect_congr {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} {f : ια} {g : ια} {t : Finset ι} (hst : s = t) (h : xt, f x = g x) :
        (s.expect fun (i : ι) => f i) = t.expect fun (i : ι) => g i
        theorem Finset.expectWith_congr {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} {f : ια} {g : ια} (p : ιProp) [DecidablePred p] (h : xs, p xf x = g x) :
        ((Finset.filter (fun (i : ι) => p i) s).expect fun (i : ι) => f i) = (Finset.filter (fun (i : ι) => p i) s).expect fun (i : ι) => g i
        theorem Finset.expect_sum_comm {ι : Type u_1} {κ : Type u_2} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] (s : Finset ι) (t : Finset κ) (f : ικα) :
        (s.expect fun (i : ι) => t.sum fun (j : κ) => f i j) = t.sum fun (j : κ) => s.expect fun (i : ι) => f i j
        theorem Finset.expect_comm {ι : Type u_1} {κ : Type u_2} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] (s : Finset ι) (t : Finset κ) (f : ικα) :
        (s.expect fun (i : ι) => t.expect fun (j : κ) => f i j) = t.expect fun (j : κ) => s.expect fun (i : ι) => f i j
        theorem Finset.expect_eq_zero {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} {f : ια} (h : is, f i = 0) :
        (s.expect fun (i : ι) => f i) = 0
        theorem Finset.exists_ne_zero_of_expect_ne_zero {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} {f : ια} (h : (s.expect fun (i : ι) => f i) 0) :
        is, f i 0
        theorem Finset.expect_add_distrib {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] (s : Finset ι) (f : ια) (g : ια) :
        (s.expect fun (i : ι) => f i + g i) = (s.expect fun (i : ι) => f i) + s.expect fun (i : ι) => g i
        theorem Finset.expect_add_expect_comm {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} (f₁ : ια) (f₂ : ια) (g₁ : ια) (g₂ : ια) :
        ((s.expect fun (i : ι) => f₁ i + f₂ i) + s.expect fun (i : ι) => g₁ i + g₂ i) = (s.expect fun (i : ι) => f₁ i + g₁ i) + s.expect fun (i : ι) => f₂ i + g₂ i
        theorem Finset.expect_eq_single_of_mem {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} {f : ια} (i : ι) (hi : i s) (h : js, j if j = 0) :
        (s.expect fun (i : ι) => f i) = (s.card)⁻¹ f i
        theorem Finset.expect_ite_zero {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] (s : Finset ι) (p : ιProp) [DecidablePred p] (h : is, js, p ip ji = j) (a : α) :
        (s.expect fun (i : ι) => if p i then a else 0) = if is, p i then (s.card)⁻¹ a else 0

        See also Finset.expect_boole.

        @[simp]
        theorem Finset.expect_dite_eq {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} [DecidableEq ι] (i : ι) (f : (j : ι) → i = jα) :
        (s.expect fun (j : ι) => if h : i = j then f j h else 0) = if i s then (s.card)⁻¹ f i else 0
        @[simp]
        theorem Finset.expect_dite_eq' {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} [DecidableEq ι] (i : ι) (f : (j : ι) → j = iα) :
        (s.expect fun (j : ι) => if h : j = i then f j h else 0) = if i s then (s.card)⁻¹ f i else 0
        @[simp]
        theorem Finset.expect_ite_eq {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} [DecidableEq ι] (i : ι) (f : ια) :
        (s.expect fun (j : ι) => if i = j then f j else 0) = if i s then (s.card)⁻¹ f i else 0
        @[simp]
        theorem Finset.expect_ite_eq' {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} [DecidableEq ι] (i : ι) (f : ια) :
        (s.expect fun (j : ι) => if j = i then f j else 0) = if i s then (s.card)⁻¹ f i else 0
        theorem Finset.expect_bij {ι : Type u_1} {κ : Type u_2} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} {f : ια} {t : Finset κ} {g : κα} (i : (a : ι) → a sκ) (hi : ∀ (a : ι) (ha : a s), i a ha t) (h : ∀ (a : ι) (ha : a s), f a = g (i a ha)) (i_inj : ∀ (a₁ : ι) (ha₁ : a₁ s) (a₂ : ι) (ha₂ : a₂ s), i a₁ ha₁ = i a₂ ha₂a₁ = a₂) (i_surj : bt, ∃ (a : ι) (ha : a s), i a ha = b) :
        (s.expect fun (x : ι) => f x) = t.expect fun (x : κ) => g x
        theorem Finset.expect_nbij {ι : Type u_1} {κ : Type u_2} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} {f : ια} {t : Finset κ} {g : κα} (i : ικ) (hi : as, i a t) (h : as, f a = g (i a)) (i_inj : Set.InjOn i s) (i_surj : Set.SurjOn i s t) :
        (s.expect fun (x : ι) => f x) = t.expect fun (x : κ) => g x
        theorem Finset.expect_bij' {ι : Type u_1} {κ : Type u_2} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} {f : ια} {t : Finset κ} {g : κα} (i : (a : ι) → a sκ) (j : (a : κ) → a tι) (hi : ∀ (a : ι) (ha : a s), i a ha t) (hj : ∀ (a : κ) (ha : a t), j a ha s) (left_inv : ∀ (a : ι) (ha : a s), j (i a ha) = a) (right_inv : ∀ (a : κ) (ha : a t), i (j a ha) = a) (h : ∀ (a : ι) (ha : a s), f a = g (i a ha)) :
        (s.expect fun (x : ι) => f x) = t.expect fun (x : κ) => g x
        theorem Finset.expect_nbij' {ι : Type u_1} {κ : Type u_2} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} {f : ια} {t : Finset κ} {g : κα} (i : ικ) (j : κι) (hi : as, i a t) (hj : at, j a s) (left_inv : as, j (i a) = a) (right_inv : at, i (j a) = a) (h : as, f a = g (i a)) :
        (s.expect fun (x : ι) => f x) = t.expect fun (x : κ) => g x
        theorem Finset.expect_equiv {ι : Type u_1} {κ : Type u_2} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} {f : ια} {t : Finset κ} {g : κα} (e : ι κ) (hst : ∀ (i : ι), i s e i t) (hfg : is, f i = g (e i)) :
        (s.expect fun (i : ι) => f i) = t.expect fun (i : κ) => g i

        Finset.expect_equiv is a specialization of Finset.expect_bij that automatically fills in most arguments.

        theorem Finset.expect_product' {ι : Type u_1} {κ : Type u_2} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} {t : Finset κ} (f : ικα) :
        ((s ×ˢ t).expect fun (x : ι × κ) => f x.1 x.2) = s.expect fun (x : ι) => t.expect fun (y : κ) => f x y
        @[simp]
        theorem Finset.expect_image {ι : Type u_1} {κ : Type u_2} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] {f : ια} {t : Finset κ} [DecidableEq ι] {m : κι} (hm : Set.InjOn m t) :
        ((Finset.image m t).expect fun (i : ι) => f i) = t.expect fun (i : κ) => f (m i)
        @[simp]
        theorem Finset.expect_inv_index {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] [DecidableEq ι] [InvolutiveInv ι] (s : Finset ι) (f : ια) :
        (s⁻¹.expect fun (i : ι) => f i) = s.expect fun (i : ι) => f i⁻¹
        @[simp]
        theorem Finset.expect_neg_index {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] [DecidableEq ι] [InvolutiveNeg ι] (s : Finset ι) (f : ια) :
        ((-s).expect fun (i : ι) => f i) = s.expect fun (i : ι) => f (-i)
        theorem map_expect {ι : Type u_1} {α : Type u_3} {β : Type u_4} [AddCommMonoid α] [Module ℚ≥0 α] [AddCommMonoid β] [Module ℚ≥0 β] {F : Type u_5} [FunLike F α β] [LinearMapClass F ℚ≥0 α β] (g : F) (f : ια) (s : Finset ι) :
        g (s.expect fun (x : ι) => f x) = s.expect fun (x : ι) => g (f x)
        @[simp]
        theorem Finset.card_smul_expect {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] (s : Finset ι) (f : ια) :
        (s.card s.expect fun (i : ι) => f i) = s.sum fun (i : ι) => f i
        @[simp]
        theorem Fintype.card_smul_expect {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] [Fintype ι] (f : ια) :
        (Fintype.card ι Finset.univ.expect fun (i : ι) => f i) = Finset.univ.sum fun (i : ι) => f i
        @[simp]
        theorem Finset.expect_const {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} (hs : s.Nonempty) (a : α) :
        (s.expect fun (_i : ι) => a) = a
        theorem Finset.smul_expect {ι : Type u_1} {α : Type u_3} [AddCommMonoid α] [Module ℚ≥0 α] {G : Type u_5} [DistribSMul G α] [SMulCommClass G ℚ≥0 α] (a : G) (s : Finset ι) (f : ια) :
        (a s.expect fun (i : ι) => f i) = s.expect fun (i : ι) => a f i
        theorem Finset.expect_sub_distrib {ι : Type u_1} {α : Type u_3} [AddCommGroup α] [Module ℚ≥0 α] (s : Finset ι) (f : ια) (g : ια) :
        (s.expect fun (i : ι) => f i - g i) = (s.expect fun (i : ι) => f i) - s.expect fun (i : ι) => g i
        @[simp]
        theorem Finset.expect_neg_distrib {ι : Type u_1} {α : Type u_3} [AddCommGroup α] [Module ℚ≥0 α] (s : Finset ι) (f : ια) :
        (s.expect fun (i : ι) => -f i) = -s.expect fun (i : ι) => f i
        def Finset.balance {ι : Type u_1} {α : Type u_3} [AddCommGroup α] [Module ℚ≥0 α] [Fintype ι] (f : ια) :
        ια
        Equations
        Instances For
          theorem Finset.balance_apply {ι : Type u_1} {α : Type u_3} [AddCommGroup α] [Module ℚ≥0 α] [Fintype ι] (f : ια) (x : ι) :
          Finset.balance f x = f x - Finset.univ.expect fun (y : ι) => f y
          @[simp]
          theorem Finset.balance_zero {ι : Type u_1} {α : Type u_3} [AddCommGroup α] [Module ℚ≥0 α] [Fintype ι] :
          @[simp]
          theorem Finset.balance_add {ι : Type u_1} {α : Type u_3} [AddCommGroup α] [Module ℚ≥0 α] [Fintype ι] (f : ια) (g : ια) :
          @[simp]
          theorem Finset.balance_sub {ι : Type u_1} {α : Type u_3} [AddCommGroup α] [Module ℚ≥0 α] [Fintype ι] (f : ια) (g : ια) :
          @[simp]
          theorem Finset.balance_neg {ι : Type u_1} {α : Type u_3} [AddCommGroup α] [Module ℚ≥0 α] [Fintype ι] (f : ια) :
          @[simp]
          theorem Finset.sum_balance {ι : Type u_1} {α : Type u_3} [AddCommGroup α] [Module ℚ≥0 α] [Fintype ι] (f : ια) :
          (Finset.univ.sum fun (x : ι) => Finset.balance f x) = 0
          @[simp]
          theorem Finset.expect_balance {ι : Type u_1} {α : Type u_3} [AddCommGroup α] [Module ℚ≥0 α] [Fintype ι] (f : ια) :
          (Finset.univ.expect fun (x : ι) => Finset.balance f x) = 0
          @[simp]
          theorem Finset.balance_idem {ι : Type u_1} {α : Type u_3} [AddCommGroup α] [Module ℚ≥0 α] [Fintype ι] (f : ια) :
          @[simp]
          theorem Finset.map_balance {ι : Type u_1} {α : Type u_3} {β : Type u_4} [AddCommGroup α] [Module ℚ≥0 α] [Field β] [Module ℚ≥0 β] [Fintype ι] {F : Type u_5} [FunLike F α β] [LinearMapClass F ℚ≥0 α β] (g : F) (f : ια) (a : ι) :
          g (Finset.balance f a) = Finset.balance (g f) a
          @[simp]
          theorem Finset.card_mul_expect {ι : Type u_1} {α : Type u_3} [Semiring α] [Module ℚ≥0 α] (s : Finset ι) (f : ια) :
          (s.card * s.expect fun (i : ι) => f i) = s.sum fun (i : ι) => f i
          @[simp]
          theorem Fintype.card_mul_expect {ι : Type u_1} {α : Type u_3} [Semiring α] [Module ℚ≥0 α] [Fintype ι] (f : ια) :
          ((Fintype.card ι) * Finset.univ.expect fun (i : ι) => f i) = Finset.univ.sum fun (i : ι) => f i
          theorem Finset.expect_mul {ι : Type u_1} {α : Type u_3} [Semiring α] [Module ℚ≥0 α] [IsScalarTower ℚ≥0 α α] (s : Finset ι) (f : ια) (a : α) :
          (s.expect fun (i : ι) => f i) * a = s.expect fun (i : ι) => f i * a
          theorem Finset.mul_expect {ι : Type u_1} {α : Type u_3} [Semiring α] [Module ℚ≥0 α] [SMulCommClass ℚ≥0 α α] (s : Finset ι) (f : ια) (a : α) :
          (a * s.expect fun (i : ι) => f i) = s.expect fun (i : ι) => a * f i
          theorem Finset.expect_mul_expect {ι : Type u_1} {κ : Type u_2} {α : Type u_3} [Semiring α] [Module ℚ≥0 α] [IsScalarTower ℚ≥0 α α] [SMulCommClass ℚ≥0 α α] (s : Finset ι) (t : Finset κ) (f : ια) (g : κα) :
          ((s.expect fun (i : ι) => f i) * t.expect fun (j : κ) => g j) = s.expect fun (i : ι) => t.expect fun (j : κ) => f i * g j
          theorem Finset.expect_pow {ι : Type u_1} {α : Type u_3} [CommSemiring α] [Module ℚ≥0 α] [IsScalarTower ℚ≥0 α α] [SMulCommClass ℚ≥0 α α] (s : Finset ι) (f : ια) (n : ) :
          (s.expect fun (i : ι) => f i) ^ n = (s^^n).expect fun (p : Fin nι) => Finset.univ.prod fun (i : Fin n) => f (p i)
          theorem Finset.expect_indicate_eq {ι : Type u_1} {α : Type u_3} [Semifield α] [CharZero α] [Fintype ι] [Nonempty ι] [DecidableEq ι] (f : ια) (x : ι) :
          (Finset.univ.expect fun (i : ι) => (if x = i then (Fintype.card ι) else 0) * f i) = f x
          theorem Finset.expect_indicate_eq' {ι : Type u_1} {α : Type u_3} [Semifield α] [CharZero α] [Fintype ι] [Nonempty ι] [DecidableEq ι] (f : ια) (x : ι) :
          (Finset.univ.expect fun (i : ι) => (if i = x then (Fintype.card ι) else 0) * f i) = f x
          theorem Finset.expect_eq_sum_div_card {ι : Type u_1} {α : Type u_3} [Semifield α] [CharZero α] (s : Finset ι) (f : ια) :
          (s.expect fun (i : ι) => f i) = (s.sum fun (i : ι) => f i) / s.card
          theorem Fintype.expect_eq_sum_div_card {ι : Type u_1} {α : Type u_3} [Semifield α] [CharZero α] [Fintype ι] (f : ια) :
          (Finset.univ.expect fun (i : ι) => f i) = (Finset.univ.sum fun (i : ι) => f i) / (Fintype.card ι)
          theorem Finset.expect_div {ι : Type u_1} {α : Type u_3} [Semifield α] [CharZero α] (s : Finset ι) (f : ια) (a : α) :
          (s.expect fun (i : ι) => f i) / a = s.expect fun (i : ι) => f i / a

          Order #

          theorem Finset.expect_eq_zero_iff_of_nonneg {ι : Type u_1} {α : Type u_3} [OrderedAddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} {f : ια} (hs : s.Nonempty) (hf : is, 0 f i) :
          (s.expect fun (i : ι) => f i) = 0 is, f i = 0
          theorem Finset.expect_eq_zero_iff_of_nonpos {ι : Type u_1} {α : Type u_3} [OrderedAddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} {f : ια} (hs : s.Nonempty) (hf : is, f i 0) :
          (s.expect fun (i : ι) => f i) = 0 is, f i = 0
          theorem Finset.expect_le_expect {ι : Type u_1} {α : Type u_3} [OrderedAddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} {f : ια} {g : ια} [PosSMulMono ℚ≥0 α] (hfg : is, f i g i) :
          (s.expect fun (i : ι) => f i) s.expect fun (i : ι) => g i
          theorem GCongr.expect_le_expect {ι : Type u_1} {α : Type u_3} [OrderedAddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} {f : ια} {g : ια} [PosSMulMono ℚ≥0 α] (h : is, f i g i) :
          s.expect f s.expect g

          This is a (beta-reduced) version of the standard lemma Finset.expect_le_expect, convenient for the gcongr tactic.

          theorem Finset.expect_le {ι : Type u_1} {α : Type u_3} [OrderedAddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} [PosSMulMono ℚ≥0 α] (hs : s.Nonempty) (f : ια) (a : α) (h : xs, f x a) :
          (s.expect fun (i : ι) => f i) a
          theorem Finset.le_expect {ι : Type u_1} {α : Type u_3} [OrderedAddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} [PosSMulMono ℚ≥0 α] (hs : s.Nonempty) (f : ια) (a : α) (h : xs, a f x) :
          a s.expect fun (i : ι) => f i
          theorem Finset.expect_nonneg {ι : Type u_1} {α : Type u_3} [OrderedAddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} {f : ια} [PosSMulMono ℚ≥0 α] (hf : is, 0 f i) :
          0 s.expect fun (i : ι) => f i
          theorem Finset.le_expect_of_subadditive {ι : Type u_1} {α : Type u_3} {β : Type u_4} [OrderedAddCommMonoid α] [Module ℚ≥0 α] [OrderedAddCommMonoid β] [Module ℚ≥0 β] [PosSMulMono ℚ≥0 β] (m : αβ) (h_zero : m 0 = 0) (h_add : ∀ (a b : α), m (a + b) m a + m b) (h_div : ∀ (a : α) (n : ), m ((n)⁻¹ a) = (n)⁻¹ m a) (s : Finset ι) (f : ια) :
          m (s.expect fun (i : ι) => f i) s.expect fun (i : ι) => m (f i)

          If m is a subadditive function (m (x + y) ≤ m x + m y, f 1 = 1), and f i, i ∈ s, is a finite family of elements, then m (𝔼 i in s, f i) ≤ 𝔼 i in s, m (f i).

          theorem Finset.expect_pos {ι : Type u_1} {α : Type u_3} [OrderedCancelAddCommMonoid α] [Module ℚ≥0 α] {s : Finset ι} {f : ια} [PosSMulStrictMono ℚ≥0 α] (hf : is, 0 < f i) (hs : s.Nonempty) :
          0 < s.expect fun (i : ι) => f i
          theorem Finset.abs_expect_le_expect_abs {ι : Type u_1} {α : Type u_3} [LinearOrderedAddCommGroup α] [Module ℚ≥0 α] [PosSMulMono ℚ≥0 α] (s : Finset ι) (f : ια) :
          |s.expect fun (i : ι) => f i| s.expect fun (i : ι) => |f i|
          @[simp]
          theorem algebraMap.coe_expect {ι : Type u_1} {α : Type u_3} {β : Type u_4} [Semifield α] [CharZero α] [Semifield β] [CharZero β] [Algebra α β] (s : Finset ι) (f : ια) :
          (s.expect fun (i : ι) => f i) = s.expect fun (i : ι) => (f i)
          theorem Fintype.expect_bijective {ι : Type u_1} {κ : Type u_2} {α : Type u_3} [Fintype ι] [Fintype κ] [AddCommMonoid α] [Module ℚ≥0 α] (e : ικ) (he : Function.Bijective e) (f : ια) (g : κα) (h : ∀ (x : ι), f x = g (e x)) :
          (Finset.univ.expect fun (i : ι) => f i) = Finset.univ.expect fun (i : κ) => g i

          Fintype.expect_bijective is a variant of Finset.expect_bij that accepts Function.Bijective.

          See Function.Bijective.expect_comp for a version without h.

          theorem Fintype.expect_equiv {ι : Type u_1} {κ : Type u_2} {α : Type u_3} [Fintype ι] [Fintype κ] [AddCommMonoid α] [Module ℚ≥0 α] (e : ι κ) (f : ια) (g : κα) (h : ∀ (x : ι), f x = g (e x)) :
          (Finset.univ.expect fun (i : ι) => f i) = Finset.univ.expect fun (i : κ) => g i

          Fintype.expect_equiv is a specialization of Finset.expect_bij that automatically fills in most arguments.

          See Equiv.expect_comp for a version without h.

          @[simp]
          theorem Fintype.expect_const {ι : Type u_1} {α : Type u_3} [Fintype ι] [AddCommMonoid α] [Module ℚ≥0 α] [Nonempty ι] (a : α) :
          (Finset.univ.expect fun (_i : ι) => a) = a
          theorem Fintype.expect_ite_zero {ι : Type u_1} {α : Type u_3} [Fintype ι] [AddCommMonoid α] [Module ℚ≥0 α] (p : ιProp) [DecidablePred p] (h : ∀ (i j : ι), p ip ji = j) (a : α) :
          (Finset.univ.expect fun (i : ι) => if p i then a else 0) = if ∃ (i : ι), p i then ((Fintype.card ι))⁻¹ a else 0
          @[simp]
          theorem Fintype.expect_dite_eq {ι : Type u_1} {α : Type u_3} [Fintype ι] [AddCommMonoid α] [Module ℚ≥0 α] [DecidableEq ι] (i : ι) (f : (j : ι) → i = jα) :
          (Finset.univ.expect fun (j : ι) => if h : i = j then f j h else 0) = ((Fintype.card ι))⁻¹ f i
          @[simp]
          theorem Fintype.expect_dite_eq' {ι : Type u_1} {α : Type u_3} [Fintype ι] [AddCommMonoid α] [Module ℚ≥0 α] [DecidableEq ι] (i : ι) (f : (j : ι) → j = iα) :
          (Finset.univ.expect fun (j : ι) => if h : j = i then f j h else 0) = ((Fintype.card ι))⁻¹ f i
          @[simp]
          theorem Fintype.expect_ite_eq {ι : Type u_1} {α : Type u_3} [Fintype ι] [AddCommMonoid α] [Module ℚ≥0 α] [DecidableEq ι] (i : ι) (f : ια) :
          (Finset.univ.expect fun (j : ι) => if i = j then f j else 0) = ((Fintype.card ι))⁻¹ f i
          @[simp]
          theorem Fintype.expect_ite_eq' {ι : Type u_1} {α : Type u_3} [Fintype ι] [AddCommMonoid α] [Module ℚ≥0 α] [DecidableEq ι] (i : ι) (f : ια) :
          (Finset.univ.expect fun (j : ι) => if j = i then f j else 0) = ((Fintype.card ι))⁻¹ f i
          @[simp]
          theorem Fintype.expect_one {ι : Type u_1} {α : Type u_3} [Fintype ι] [Semiring α] [Module ℚ≥0 α] [Nonempty ι] :
          (Finset.univ.expect fun (_i : ι) => 1) = 1
          theorem Fintype.expect_eq_zero_iff_of_nonneg {ι : Type u_1} {α : Type u_3} [Fintype ι] [OrderedAddCommMonoid α] [Module ℚ≥0 α] {f : ια} [Nonempty ι] (hf : 0 f) :
          (Finset.univ.expect fun (i : ι) => f i) = 0 f = 0
          theorem Fintype.expect_eq_zero_iff_of_nonpos {ι : Type u_1} {α : Type u_3} [Fintype ι] [OrderedAddCommMonoid α] [Module ℚ≥0 α] {f : ια} [Nonempty ι] (hf : f 0) :
          (Finset.univ.expect fun (i : ι) => f i) = 0 f = 0
          @[simp]
          theorem RCLike.coe_balance {ι : Type u_1} {α : Type u_3} [RCLike α] [Fintype ι] (f : ι) (a : ι) :
          (Finset.balance f a) = Finset.balance (RCLike.ofReal f) a
          @[simp]
          theorem RCLike.coe_comp_balance {ι : Type u_1} {α : Type u_3} [RCLike α] [Fintype ι] (f : ι) :
          RCLike.ofReal Finset.balance f = Finset.balance (RCLike.ofReal f)