Skip to content

Commit

Permalink
feat: add Pi.ofNat_apply (#5928)
Browse files Browse the repository at this point in the history
  • Loading branch information
urkud committed Jul 15, 2023
1 parent d5cc6ec commit d31d954
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Mathlib/Data/Nat/Cast/Basic.lean
Expand Up @@ -328,6 +328,9 @@ theorem coe_nat (n : ℕ) : (n : ∀ a, π a) = fun _ ↦ ↑n :=
rfl
#align pi.coe_nat Pi.coe_nat

@[simp]
theorem ofNat_apply (n : ℕ) [n.AtLeastTwo] (a : α) : (OfNat.ofNat n : ∀ a, π a) a = n := rfl

end Pi

theorem Sum.elim_natCast_natCast {α β γ : Type _} [NatCast γ] (n : ℕ) :
Expand Down
7 changes: 2 additions & 5 deletions Mathlib/Probability/Variance.lean
Expand Up @@ -214,11 +214,8 @@ theorem variance_def' [@IsProbabilityMeasure Ω _ ℙ] {X : Ω → ℝ} (hX : Me
· apply hX.integrable_sq.add
convert @integrable_const Ω ℝ (_) ℙ _ _ (𝔼[X] ^ 2)
· exact ((hX.integrable one_le_two).const_mul 2).mul_const' _
simp [integral_mul_right]
have : ∀ (a : Ω), @OfNat.ofNat (Ω → ℝ) 2 instOfNat a = (2 : ℝ) := fun a => rfl
conv_lhs => enter [2, 1, 2, a]; rw [this]
simp only [integral_mul_left (2 : ℝ)]
ring_nf
simp [integral_mul_right, integral_mul_left]
ring
#align probability_theory.variance_def' ProbabilityTheory.variance_def'

theorem variance_le_expectation_sq [@IsProbabilityMeasure Ω _ ℙ] {X : Ω → ℝ}
Expand Down

0 comments on commit d31d954

Please sign in to comment.