Casting lemmas for non-negative rational numbers involving sums and products #
theorem
NNRat.coe_multiset_sum
(s : Multiset NNRat)
:
↑(Multiset.sum s) = Multiset.sum (Multiset.map Subtype.val s)
theorem
NNRat.coe_multiset_prod
(s : Multiset NNRat)
:
↑(Multiset.prod s) = Multiset.prod (Multiset.map Subtype.val s)
theorem
NNRat.coe_sum
{α : Type u_2}
{s : Finset α}
{f : α → NNRat}
:
↑(Finset.sum s fun (a : α) => f a) = Finset.sum s fun (a : α) => ↑(f a)
theorem
NNRat.toNNRat_sum_of_nonneg
{α : Type u_2}
{s : Finset α}
{f : α → ℚ}
(hf : ∀ a ∈ s, 0 ≤ f a)
:
Rat.toNNRat (Finset.sum s fun (a : α) => f a) = Finset.sum s fun (a : α) => Rat.toNNRat (f a)
theorem
NNRat.coe_prod
{α : Type u_2}
{s : Finset α}
{f : α → NNRat}
:
↑(Finset.prod s fun (a : α) => f a) = Finset.prod s fun (a : α) => ↑(f a)
theorem
NNRat.toNNRat_prod_of_nonneg
{α : Type u_2}
{s : Finset α}
{f : α → ℚ}
(hf : ∀ a ∈ s, 0 ≤ f a)
:
Rat.toNNRat (Finset.prod s fun (a : α) => f a) = Finset.prod s fun (a : α) => Rat.toNNRat (f a)