Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 004618a

Browse files
b-mehtamergify[bot]
authored andcommitted
feat(data/nat): two lemmas about choose (#1717)
* Two lemmas about choose * swap choose_symm order
1 parent 58fc830 commit 004618a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/data/nat/basic.lean

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,16 @@ end
11211121
theorem fact_mul_fact_dvd_fact {n k : ℕ} (hk : k ≤ n) : fact k * fact (n - k) ∣ fact n :=
11221122
by rw [←choose_mul_fact_mul_fact hk, mul_assoc]; exact dvd_mul_left _ _
11231123

1124+
@[simp] lemma choose_symm {n k : ℕ} (hk : k ≤ n) : choose n (n-k) = choose n k :=
1125+
by rw [choose_eq_fact_div_fact hk, choose_eq_fact_div_fact (sub_le _ _), nat.sub_sub_self hk, mul_comm]
1126+
1127+
lemma choose_succ_right_eq {n k : ℕ} : choose n (k + 1) * (k + 1) = choose n k * (n - k) :=
1128+
begin
1129+
have e : (n+1) * choose n k = choose n k * (k+1) + choose n (k+1) * (k+1),
1130+
rw [← right_distrib, ← choose_succ_succ, succ_mul_choose_eq],
1131+
rw [← nat.sub_eq_of_eq_add e, mul_comm, ← nat.mul_sub_left_distrib, nat.add_sub_add_right]
1132+
end
1133+
11241134
section find_greatest
11251135

11261136
/-- `find_greatest P b` is the largest `i ≤ bound` such that `P i` holds, or `0` if no such `i`

0 commit comments

Comments
 (0)