def choose

bend-collections-laws-math@1.0.0.0 · spec/math/natural.bend:67

import bend-collections-laws-math@1.0.0.0/spec/math/natural.bend as Natural
import Base

67# Mathlib/Data/Nat/Choose/Basic (Pascal's rule, Nat.choose_succ_succ)
68def choose(n: Nat, k: Nat) -> Nat:
69  match n k:
70    case 0n 0n:
71      1n
72    case 0n 1n+j:
73      0n
74    case 1n+m 0n:
75      1n
76    case 1n+ +m 1n+ +j:
77      Nat.add(choose(m, j), choose(m, 1n+j))

Uses (2)

Used by (30)