Skip to content

Commit 0b88a97

Browse files
committed
feat(RingTheory.Binomial): Add BinomialRing instance for NNRat modules. (#13585)
This PR adds an instance of BinomialRing for NNRat modules. Co-authored-by: Herman Chau <kcaze@users.noreply.github.com>
1 parent 9bfe41c commit 0b88a97

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Mathlib/RingTheory/Binomial.lean

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ end Polynomial
203203

204204
end Pochhammer
205205

206-
section Nat_Int
206+
section Basic_Instances
207207

208208
open Polynomial
209209

@@ -236,7 +236,16 @@ instance Int.instBinomialRing : BinomialRing ℤ where
236236
← Nat.descFactorial_eq_factorial_mul_choose, ← descPochhammer_smeval_eq_descFactorial,
237237
← Int.neg_ofNat_succ, ascPochhammer_smeval_neg_eq_descPochhammer]
238238

239-
end Nat_Int
239+
noncomputable instance {R : Type*} [AddCommMonoid R] [Module ℚ≥0 R] [Pow R ℕ] : BinomialRing R where
240+
nsmul_right_injective n hn r s hrs := by
241+
rw [← one_smul ℚ≥0 r, ← one_smul ℚ≥0 s, show 1 = (n : ℚ≥0)⁻¹ • (n : ℚ≥0) by simp_all]
242+
simp_all only [smul_assoc, ← nsmul_eq_smul_cast]
243+
multichoose r n := (n.factorial : ℚ≥0)⁻¹ • Polynomial.smeval (ascPochhammer ℕ n) r
244+
factorial_nsmul_multichoose r n := by
245+
simp only [← smul_assoc]
246+
field_simp
247+
248+
end Basic_Instances
240249

241250
section Choose
242251

0 commit comments

Comments
 (0)