Zulip Chat Archive

Stream: mathlib4

Topic: binomial on integer


Gaolei He (Dec 07 2024 at 13:56):

I'm doing some binomial problems
I want to ask that does lean4 have define

(nk)=0\binom{n}{k}=0

when k < 0?
or in other words: how do we deal with negative numbers in binomial in lean4

Kevin Buzzard (Dec 07 2024 at 14:04):

Nat.choose : ℕ → ℕ → ℕ so your question doesn't even typecheck. In other words, Nat.choose by definition eats two natural numbers.

Edward van de Meent (Dec 07 2024 at 14:05):

there is also Ring.choose

Edward van de Meent (Dec 07 2024 at 14:05):

(which applies to integers too, afaict)

Edward van de Meent (Dec 07 2024 at 14:07):

actually nvm, that also only eats natural numbers

Edward van de Meent (Dec 07 2024 at 14:09):

do check out #Is there code for X? > Choose on integer for a similar question/conversation

Notification Bot (Dec 07 2024 at 14:10):

6 messages were moved here from #mathlib4 > question about Ico by Edward van de Meent.


Last updated: May 02 2025 at 03:31 UTC