id stringlengths 42 51 | env stringclasses 1
value | msc stringclasses 1
value | family stringclasses 4
values | difficulty int64 1 3 | seed int64 0 83 | kind stringclasses 1
value | instruction stringlengths 762 1.09k | start_file stringlengths 168 473 | path stringlengths 73 82 |
|---|---|---|---|---|---|---|---|---|---|
combinatorial-identities-binomial_sums-d1-t0000 | combinatorial-identities | 05 | binomial_sums | 1 | 0 | prove | # Prove an identity for binomial coefficients
Prove the following.
For every natural number \(n\), \[\sum_{i=0}^{n} \binom{n}{i}\, 2^{i} = 3^{n}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mathlib, with `sorry` in place of the proof. Replace every `sorry` with a proof... | import Mathlib
/-- A weighted sum of binomial coefficients. -/
theorem binomial_sum (n : ℕ) :
∑ i ∈ Finset.range (n + 1), n.choose i * 2 ^ i = 3 ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-binomial_sums-d1-t0000 |
combinatorial-identities-counting-d1-t0001 | combinatorial-identities | 05 | counting | 1 | 1 | prove | # Prove a counting statement
Prove the following.
Let \(s\) be a finite set of integers with more than 3 elements. Prove that \(s\) contains two different integers \(x \ne y\) that leave the same remainder on division by 3.
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mat... | import Mathlib
/-- Pigeonhole principle for remainders. -/
theorem pigeonhole_mod (s : Finset ℤ) (h : 3 < s.card) :
∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ x % 3 = y % 3 := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-counting-d1-t0001 |
combinatorial-identities-fibonacci-d1-t0002 | combinatorial-identities | 05 | fibonacci | 1 | 2 | prove | # Prove an identity for Fibonacci numbers
Prove the following.
For every natural number \(n\), with \(F\) the Fibonacci sequence (\(F_0 = 0\), \(F_1 = 1\), \(F_{k+2} = F_k + F_{k+1}\)), \[\sum_{i=0}^{n-1} F_{i+13} + F_{14} = F_{n+14}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Le... | import Mathlib
/-- A telescoping sum of Fibonacci numbers. -/
theorem fib_shifted_sum (n : ℕ) :
∑ i ∈ Finset.range n, Nat.fib (i + 13) + Nat.fib 14 = Nat.fib (n + 14) := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-fibonacci-d1-t0002 |
combinatorial-identities-linear_recurrence-d1-t0003 | combinatorial-identities | 05 | linear_recurrence | 1 | 3 | prove | # Find the closed form of a recurrence
Prove the following.
Define a sequence of integers by \(u_0 = 6\), \(u_1 = 26\) and \(u_{n+2} = 9\,u_{n+1} - 20\,u_{n}\). Prove that for every natural number \(n\), \[u_n = 4 \cdot 4^{n} + 2 \cdot 5^{n}.\]
## What to do
`Solution.lean` in the working directory states the theor... | import Mathlib
def u : ℕ → ℤ
| 0 => 6
| 1 => 26
| (n + 2) => 9 * u (n + 1) - 20 * u n
/-- A closed form for the sequence defined by the recurrence. -/
theorem seq_closed_form (n : ℕ) :
u n = 4 * 4 ^ n + 2 * 5 ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-linear_recurrence-d1-t0003 |
combinatorial-identities-binomial_sums-d2-t0004 | combinatorial-identities | 05 | binomial_sums | 2 | 4 | prove | # Prove an identity for binomial coefficients
Prove the following.
For every natural number \(n\), \[\sum_{i=0}^{n} \binom{i+7}{7} = \binom{n+8}{8}.\] (This is the hockey stick identity.)
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mathlib, with `sorry` in place of the p... | import Mathlib
/-- A hockey stick identity for binomial coefficients. -/
theorem hockey_stick (n : ℕ) :
∑ i ∈ Finset.range (n + 1), (i + 7).choose 7 = (n + 8).choose 8 := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-binomial_sums-d2-t0004 |
combinatorial-identities-counting-d2-t0005 | combinatorial-identities | 05 | counting | 2 | 5 | prove | # Prove a counting statement
Prove the following.
Let \(n\) be a natural number. Prove that the set \(\{0, 1, \dots, n-1\}\) has at most as many elements as the set of integers \(y\) with \(0 \le y < 4 n\) and \(y \equiv 1 \pmod{4}\). (Construct an injection.)
## What to do
`Solution.lean` in the working directory ... | import Mathlib
/-- An injection into a residue class gives a cardinality bound. -/
theorem card_le_residue_class (n : ℕ) :
(Finset.range n).card ≤ ((Finset.range (4 * n)).filter (fun y => y % 4 = 1)).card := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-counting-d2-t0005 |
combinatorial-identities-fibonacci-d2-t0006 | combinatorial-identities | 05 | fibonacci | 2 | 6 | prove | # Prove an identity for Fibonacci numbers
Prove the following.
For every natural number \(n\), with \(F\) the Fibonacci sequence, \[\sum_{i=0}^{n-1} F_{2i+2} + F_{1} = F_{2n+1}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mathlib, with `sorry` in place of the proof. Re... | import Mathlib
/-- A sum of every second Fibonacci number. -/
theorem fib_odd_sum (n : ℕ) :
∑ i ∈ Finset.range n, Nat.fib (2 * i + 2) + Nat.fib 1 = Nat.fib (2 * n + 1) := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-fibonacci-d2-t0006 |
combinatorial-identities-linear_recurrence-d2-t0007 | combinatorial-identities | 05 | linear_recurrence | 2 | 7 | prove | # Find the closed form of a recurrence
Prove the following.
Define a sequence of integers by \(u_0 = 4\), \(u_1 = -2\) and \(u_{n+2} = -1\,u_{n+1} - -6\,u_{n}\). Prove that for every natural number \(n\), \[u_n = 2 \cdot 2^{n} + 2 \cdot (-3)^{n}.\]
## What to do
`Solution.lean` in the working directory states the t... | import Mathlib
def u : ℕ → ℤ
| 0 => 4
| 1 => (-2)
| (n + 2) => (-1) * u (n + 1) - (-6) * u n
/-- A closed form for the sequence defined by the recurrence. -/
theorem seq_closed_form (n : ℕ) :
u n = 2 * 2 ^ n + 2 * (-3) ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-linear_recurrence-d2-t0007 |
combinatorial-identities-binomial_sums-d3-t0008 | combinatorial-identities | 05 | binomial_sums | 3 | 8 | prove | # Prove an identity for binomial coefficients
Prove the following.
First prove \[\sum_{i=0}^{n} i \binom{n}{i} = n \cdot 2^{n-1},\] where \(n - 1\) is truncated subtraction on the natural numbers. Then use it, and the value of \(\sum_{i=0}^{n} \binom{n}{i}\), to prove \[\sum_{i=0}^{n} (4i + 5) \binom{n}{i} = 4 \cdot ... | import Mathlib
/-- The sum of i times n choose i. -/
theorem sum_i_choose (n : ℕ) :
∑ i ∈ Finset.range (n + 1), i * n.choose i = n * 2 ^ (n - 1) := by
sorry
/-- A weighted binomial sum. -/
theorem weighted_sum (n : ℕ) :
∑ i ∈ Finset.range (n + 1), (4 * i + 5) * n.choose i = 4 * (n * 2 ^ (n - 1)) + 5 * 2 ^ n... | tasks/combinatorial-identities/combinatorial-identities-binomial_sums-d3-t0008 |
combinatorial-identities-counting-d3-t0009 | combinatorial-identities | 05 | counting | 3 | 9 | prove | # Prove a counting statement
Prove the following.
Let \(s\) be a set of natural numbers that are all less than \(6 \cdot 5 = 30\), and suppose \(s\) has more than 5 elements. Prove that \(s\) contains two elements \(x < y\) with \(y - x < 6\).
## What to do
`Solution.lean` in the working directory states the theore... | import Mathlib
/-- Pigeonhole principle for blocks of consecutive numbers. -/
theorem close_pair (s : Finset ℕ) (hs : s ⊆ Finset.range (6 * 5)) (h : 5 < s.card) :
∃ x ∈ s, ∃ y ∈ s, x < y ∧ y < x + 6 := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-counting-d3-t0009 |
combinatorial-identities-fibonacci-d3-t0010 | combinatorial-identities | 05 | fibonacci | 3 | 10 | prove | # Prove an identity for Fibonacci numbers
Prove the following.
First prove Cassini's identity: for every natural number \(n\), \[F_{n+1}^2 - F_n F_{n+2} = (-1)^n,\] computed in the integers, where \(F\) is the Fibonacci sequence. Then conclude that \(F_{m+1}^2 - F_m F_{m+2}\) is either \(1\) or \(-1\) when \(m = 6n +... | import Mathlib
/-- Cassini's identity for Fibonacci numbers. -/
theorem cassini (n : ℕ) :
(Nat.fib (n + 1) : ℤ) ^ 2 - Nat.fib n * Nat.fib (n + 2) = (-1) ^ n := by
sorry
/-- Cassini's determinant is plus or minus one at the index given. -/
theorem cassini_pm_one (n : ℕ) :
(Nat.fib (6 * n + 3 + 1) : ℤ) ^ 2 - ... | tasks/combinatorial-identities/combinatorial-identities-fibonacci-d3-t0010 |
combinatorial-identities-linear_recurrence-d3-t0011 | combinatorial-identities | 05 | linear_recurrence | 3 | 11 | prove | # Find the closed form of a recurrence
Prove the following.
Define a sequence of integers by \(u_0 = 3\), \(u_1 = 12\) and \(u_{n+2} = 4\,u_{n+1} - 4\,u_{n}\). Prove that for every natural number \(n\), \[u_n = (3 + 3 n) \cdot 2^{n}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Lea... | import Mathlib
def u : ℕ → ℤ
| 0 => 3
| 1 => 12
| (n + 2) => 4 * u (n + 1) - 4 * u n
/-- A closed form for the sequence defined by the recurrence. -/
theorem seq_closed_form (n : ℕ) :
u n = (3 + 3 * (n : ℤ)) * 2 ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-linear_recurrence-d3-t0011 |
combinatorial-identities-binomial_sums-d1-t0012 | combinatorial-identities | 05 | binomial_sums | 1 | 12 | prove | # Prove an identity for binomial coefficients
Prove the following.
For every natural number \(n\), \[\sum_{i=0}^{n} \binom{n}{i}\, 6^{i} = 7^{n}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mathlib, with `sorry` in place of the proof. Replace every `sorry` with a proof... | import Mathlib
/-- A weighted sum of binomial coefficients. -/
theorem binomial_sum (n : ℕ) :
∑ i ∈ Finset.range (n + 1), n.choose i * 6 ^ i = 7 ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-binomial_sums-d1-t0012 |
combinatorial-identities-counting-d1-t0013 | combinatorial-identities | 05 | counting | 1 | 13 | prove | # Prove a counting statement
Prove the following.
Let \(s\) be a finite set of integers with more than 5 elements. Prove that \(s\) contains two different integers \(x \ne y\) that leave the same remainder on division by 5.
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mat... | import Mathlib
/-- Pigeonhole principle for remainders. -/
theorem pigeonhole_mod (s : Finset ℤ) (h : 5 < s.card) :
∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ x % 5 = y % 5 := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-counting-d1-t0013 |
combinatorial-identities-fibonacci-d1-t0014 | combinatorial-identities | 05 | fibonacci | 1 | 14 | prove | # Prove an identity for Fibonacci numbers
Prove the following.
For every natural number \(n\), with \(F\) the Fibonacci sequence (\(F_0 = 0\), \(F_1 = 1\), \(F_{k+2} = F_k + F_{k+1}\)), \[\sum_{i=0}^{n-1} F_{i+6} + F_{7} = F_{n+7}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Lean ... | import Mathlib
/-- A telescoping sum of Fibonacci numbers. -/
theorem fib_shifted_sum (n : ℕ) :
∑ i ∈ Finset.range n, Nat.fib (i + 6) + Nat.fib 7 = Nat.fib (n + 7) := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-fibonacci-d1-t0014 |
combinatorial-identities-linear_recurrence-d1-t0015 | combinatorial-identities | 05 | linear_recurrence | 1 | 15 | prove | # Find the closed form of a recurrence
Prove the following.
Define a sequence of integers by \(u_0 = 4\), \(u_1 = 18\) and \(u_{n+2} = 8\,u_{n+1} - 15\,u_{n}\). Prove that for every natural number \(n\), \[u_n = 1 \cdot 3^{n} + 3 \cdot 5^{n}.\]
## What to do
`Solution.lean` in the working directory states the theor... | import Mathlib
def u : ℕ → ℤ
| 0 => 4
| 1 => 18
| (n + 2) => 8 * u (n + 1) - 15 * u n
/-- A closed form for the sequence defined by the recurrence. -/
theorem seq_closed_form (n : ℕ) :
u n = 1 * 3 ^ n + 3 * 5 ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-linear_recurrence-d1-t0015 |
combinatorial-identities-binomial_sums-d2-t0016 | combinatorial-identities | 05 | binomial_sums | 2 | 16 | prove | # Prove an identity for binomial coefficients
Prove the following.
For every natural number \(n\), \[\sum_{i=0}^{n} \binom{i+6}{6} = \binom{n+7}{7}.\] (This is the hockey stick identity.)
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mathlib, with `sorry` in place of the p... | import Mathlib
/-- A hockey stick identity for binomial coefficients. -/
theorem hockey_stick (n : ℕ) :
∑ i ∈ Finset.range (n + 1), (i + 6).choose 6 = (n + 7).choose 7 := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-binomial_sums-d2-t0016 |
combinatorial-identities-counting-d2-t0017 | combinatorial-identities | 05 | counting | 2 | 17 | prove | # Prove a counting statement
Prove the following.
Let \(n\) be a natural number. Prove that the set \(\{0, 1, \dots, n-1\}\) has at most as many elements as the set of integers \(y\) with \(0 \le y < 3 n\) and \(y \equiv 1 \pmod{3}\). (Construct an injection.)
## What to do
`Solution.lean` in the working directory ... | import Mathlib
/-- An injection into a residue class gives a cardinality bound. -/
theorem card_le_residue_class (n : ℕ) :
(Finset.range n).card ≤ ((Finset.range (3 * n)).filter (fun y => y % 3 = 1)).card := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-counting-d2-t0017 |
combinatorial-identities-fibonacci-d2-t0018 | combinatorial-identities | 05 | fibonacci | 2 | 18 | prove | # Prove an identity for Fibonacci numbers
Prove the following.
For every natural number \(n\), with \(F\) the Fibonacci sequence, \[\sum_{i=0}^{n-1} F_{2i+6} + F_{5} = F_{2n+5}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mathlib, with `sorry` in place of the proof. Re... | import Mathlib
/-- A sum of every second Fibonacci number. -/
theorem fib_odd_sum (n : ℕ) :
∑ i ∈ Finset.range n, Nat.fib (2 * i + 6) + Nat.fib 5 = Nat.fib (2 * n + 5) := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-fibonacci-d2-t0018 |
combinatorial-identities-linear_recurrence-d2-t0019 | combinatorial-identities | 05 | linear_recurrence | 2 | 19 | prove | # Find the closed form of a recurrence
Prove the following.
Define a sequence of integers by \(u_0 = 5\), \(u_1 = 22\) and \(u_{n+2} = 9\,u_{n+1} - 20\,u_{n}\). Prove that for every natural number \(n\), \[u_n = 3 \cdot 4^{n} + 2 \cdot 5^{n}.\]
## What to do
`Solution.lean` in the working directory states the theor... | import Mathlib
def u : ℕ → ℤ
| 0 => 5
| 1 => 22
| (n + 2) => 9 * u (n + 1) - 20 * u n
/-- A closed form for the sequence defined by the recurrence. -/
theorem seq_closed_form (n : ℕ) :
u n = 3 * 4 ^ n + 2 * 5 ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-linear_recurrence-d2-t0019 |
combinatorial-identities-binomial_sums-d3-t0020 | combinatorial-identities | 05 | binomial_sums | 3 | 20 | prove | # Prove an identity for binomial coefficients
Prove the following.
First prove \[\sum_{i=0}^{n} i \binom{n}{i} = n \cdot 2^{n-1},\] where \(n - 1\) is truncated subtraction on the natural numbers. Then use it, and the value of \(\sum_{i=0}^{n} \binom{n}{i}\), to prove \[\sum_{i=0}^{n} (5i + 3) \binom{n}{i} = 5 \cdot ... | import Mathlib
/-- The sum of i times n choose i. -/
theorem sum_i_choose (n : ℕ) :
∑ i ∈ Finset.range (n + 1), i * n.choose i = n * 2 ^ (n - 1) := by
sorry
/-- A weighted binomial sum. -/
theorem weighted_sum (n : ℕ) :
∑ i ∈ Finset.range (n + 1), (5 * i + 3) * n.choose i = 5 * (n * 2 ^ (n - 1)) + 3 * 2 ^ n... | tasks/combinatorial-identities/combinatorial-identities-binomial_sums-d3-t0020 |
combinatorial-identities-counting-d3-t0021 | combinatorial-identities | 05 | counting | 3 | 21 | prove | # Prove a counting statement
Prove the following.
Let \(s\) be a set of natural numbers that are all less than \(2 \cdot 3 = 6\), and suppose \(s\) has more than 3 elements. Prove that \(s\) contains two elements \(x < y\) with \(y - x < 2\).
## What to do
`Solution.lean` in the working directory states the theorem... | import Mathlib
/-- Pigeonhole principle for blocks of consecutive numbers. -/
theorem close_pair (s : Finset ℕ) (hs : s ⊆ Finset.range (2 * 3)) (h : 3 < s.card) :
∃ x ∈ s, ∃ y ∈ s, x < y ∧ y < x + 2 := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-counting-d3-t0021 |
combinatorial-identities-fibonacci-d3-t0022 | combinatorial-identities | 05 | fibonacci | 3 | 22 | prove | # Prove an identity for Fibonacci numbers
Prove the following.
First prove Cassini's identity: for every natural number \(n\), \[F_{n+1}^2 - F_n F_{n+2} = (-1)^n,\] computed in the integers, where \(F\) is the Fibonacci sequence. Then conclude that \(F_{m+1}^2 - F_m F_{m+2}\) is either \(1\) or \(-1\) when \(m = 3n +... | import Mathlib
/-- Cassini's identity for Fibonacci numbers. -/
theorem cassini (n : ℕ) :
(Nat.fib (n + 1) : ℤ) ^ 2 - Nat.fib n * Nat.fib (n + 2) = (-1) ^ n := by
sorry
/-- Cassini's determinant is plus or minus one at the index given. -/
theorem cassini_pm_one (n : ℕ) :
(Nat.fib (3 * n + 3 + 1) : ℤ) ^ 2 - ... | tasks/combinatorial-identities/combinatorial-identities-fibonacci-d3-t0022 |
combinatorial-identities-linear_recurrence-d3-t0023 | combinatorial-identities | 05 | linear_recurrence | 3 | 23 | prove | # Find the closed form of a recurrence
Prove the following.
Define a sequence of integers by \(u_0 = -1\), \(u_1 = 0\) and \(u_{n+2} = -6\,u_{n+1} - 9\,u_{n}\). Prove that for every natural number \(n\), \[u_n = (-1 + 1 n) \cdot (-3)^{n}.\]
## What to do
`Solution.lean` in the working directory states the theorem i... | import Mathlib
def u : ℕ → ℤ
| 0 => (-1)
| 1 => 0
| (n + 2) => (-6) * u (n + 1) - 9 * u n
/-- A closed form for the sequence defined by the recurrence. -/
theorem seq_closed_form (n : ℕ) :
u n = ((-1) + 1 * (n : ℤ)) * (-3) ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-linear_recurrence-d3-t0023 |
combinatorial-identities-binomial_sums-d1-t0024 | combinatorial-identities | 05 | binomial_sums | 1 | 24 | prove | # Prove an identity for binomial coefficients
Prove the following.
For every natural number \(n\), \[\sum_{i=0}^{n} \binom{n}{i}\, 9^{i} = 10^{n}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mathlib, with `sorry` in place of the proof. Replace every `sorry` with a proo... | import Mathlib
/-- A weighted sum of binomial coefficients. -/
theorem binomial_sum (n : ℕ) :
∑ i ∈ Finset.range (n + 1), n.choose i * 9 ^ i = 10 ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-binomial_sums-d1-t0024 |
combinatorial-identities-counting-d1-t0025 | combinatorial-identities | 05 | counting | 1 | 25 | prove | # Prove a counting statement
Prove the following.
Let \(s\) be a finite set of integers with more than 5 elements. Prove that \(s\) contains two different integers \(x \ne y\) that leave the same remainder on division by 5.
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mat... | import Mathlib
/-- Pigeonhole principle for remainders. -/
theorem pigeonhole_mod (s : Finset ℤ) (h : 5 < s.card) :
∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ x % 5 = y % 5 := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-counting-d1-t0025 |
combinatorial-identities-fibonacci-d1-t0026 | combinatorial-identities | 05 | fibonacci | 1 | 26 | prove | # Prove an identity for Fibonacci numbers
Prove the following.
For every natural number \(n\), with \(F\) the Fibonacci sequence (\(F_0 = 0\), \(F_1 = 1\), \(F_{k+2} = F_k + F_{k+1}\)), \[\sum_{i=0}^{n-1} F_{i+8} + F_{9} = F_{n+9}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Lean ... | import Mathlib
/-- A telescoping sum of Fibonacci numbers. -/
theorem fib_shifted_sum (n : ℕ) :
∑ i ∈ Finset.range n, Nat.fib (i + 8) + Nat.fib 9 = Nat.fib (n + 9) := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-fibonacci-d1-t0026 |
combinatorial-identities-linear_recurrence-d1-t0027 | combinatorial-identities | 05 | linear_recurrence | 1 | 27 | prove | # Find the closed form of a recurrence
Prove the following.
Define a sequence of integers by \(u_0 = 5\), \(u_1 = 22\) and \(u_{n+2} = 7\,u_{n+1} - 10\,u_{n}\). Prove that for every natural number \(n\), \[u_n = 4 \cdot 5^{n} + 1 \cdot 2^{n}.\]
## What to do
`Solution.lean` in the working directory states the theor... | import Mathlib
def u : ℕ → ℤ
| 0 => 5
| 1 => 22
| (n + 2) => 7 * u (n + 1) - 10 * u n
/-- A closed form for the sequence defined by the recurrence. -/
theorem seq_closed_form (n : ℕ) :
u n = 4 * 5 ^ n + 1 * 2 ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-linear_recurrence-d1-t0027 |
combinatorial-identities-binomial_sums-d2-t0028 | combinatorial-identities | 05 | binomial_sums | 2 | 28 | prove | # Prove an identity for binomial coefficients
Prove the following.
For every natural number \(n\), \[2 \cdot \sum_{i=0}^{n} \binom{i+7}{7} = 2 \cdot \binom{n+8}{8}.\] (This is the hockey stick identity.)
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mathlib, with `sorry` i... | import Mathlib
/-- A hockey stick identity for binomial coefficients. -/
theorem hockey_stick (n : ℕ) :
∑ i ∈ Finset.range (n + 1), 2 * (i + 7).choose 7 = 2 * (n + 8).choose 8 := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-binomial_sums-d2-t0028 |
combinatorial-identities-counting-d2-t0029 | combinatorial-identities | 05 | counting | 2 | 29 | prove | # Prove a counting statement
Prove the following.
Let \(n\) be a natural number. Prove that the set \(\{0, 1, \dots, n-1\}\) has at most as many elements as the set of integers \(y\) with \(0 \le y < 3 n\) and \(y \equiv 2 \pmod{3}\). (Construct an injection.)
## What to do
`Solution.lean` in the working directory ... | import Mathlib
/-- An injection into a residue class gives a cardinality bound. -/
theorem card_le_residue_class (n : ℕ) :
(Finset.range n).card ≤ ((Finset.range (3 * n)).filter (fun y => y % 3 = 2)).card := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-counting-d2-t0029 |
combinatorial-identities-fibonacci-d2-t0030 | combinatorial-identities | 05 | fibonacci | 2 | 30 | prove | # Prove an identity for Fibonacci numbers
Prove the following.
For every natural number \(n\), with \(F\) the Fibonacci sequence, \[\sum_{i=0}^{n-1} F_{2i+1} + F_{0} = F_{2n+0}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mathlib, with `sorry` in place of the proof. Re... | import Mathlib
/-- A sum of every second Fibonacci number. -/
theorem fib_odd_sum (n : ℕ) :
∑ i ∈ Finset.range n, Nat.fib (2 * i + 1) + Nat.fib 0 = Nat.fib (2 * n + 0) := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-fibonacci-d2-t0030 |
combinatorial-identities-linear_recurrence-d2-t0031 | combinatorial-identities | 05 | linear_recurrence | 2 | 31 | prove | # Find the closed form of a recurrence
Prove the following.
Define a sequence of integers by \(u_0 = -4\), \(u_1 = -16\) and \(u_{n+2} = 8\,u_{n+1} - 15\,u_{n}\). Prove that for every natural number \(n\), \[u_n = -2 \cdot 5^{n} + -2 \cdot 3^{n}.\]
## What to do
`Solution.lean` in the working directory states the t... | import Mathlib
def u : ℕ → ℤ
| 0 => (-4)
| 1 => (-16)
| (n + 2) => 8 * u (n + 1) - 15 * u n
/-- A closed form for the sequence defined by the recurrence. -/
theorem seq_closed_form (n : ℕ) :
u n = (-2) * 5 ^ n + (-2) * 3 ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-linear_recurrence-d2-t0031 |
combinatorial-identities-binomial_sums-d3-t0032 | combinatorial-identities | 05 | binomial_sums | 3 | 32 | prove | # Prove an identity for binomial coefficients
Prove the following.
First prove \[\sum_{i=0}^{n} i \binom{n}{i} = n \cdot 2^{n-1},\] where \(n - 1\) is truncated subtraction on the natural numbers. Then use it, and the value of \(\sum_{i=0}^{n} \binom{n}{i}\), to prove \[\sum_{i=0}^{n} (5i + 7) \binom{n}{i} = 5 \cdot ... | import Mathlib
/-- The sum of i times n choose i. -/
theorem sum_i_choose (n : ℕ) :
∑ i ∈ Finset.range (n + 1), i * n.choose i = n * 2 ^ (n - 1) := by
sorry
/-- A weighted binomial sum. -/
theorem weighted_sum (n : ℕ) :
∑ i ∈ Finset.range (n + 1), (5 * i + 7) * n.choose i = 5 * (n * 2 ^ (n - 1)) + 7 * 2 ^ n... | tasks/combinatorial-identities/combinatorial-identities-binomial_sums-d3-t0032 |
combinatorial-identities-counting-d3-t0033 | combinatorial-identities | 05 | counting | 3 | 33 | prove | # Prove a counting statement
Prove the following.
Let \(s\) be a set of natural numbers that are all less than \(7 \cdot 7 = 49\), and suppose \(s\) has more than 7 elements. Prove that \(s\) contains two elements \(x < y\) with \(y - x < 7\).
## What to do
`Solution.lean` in the working directory states the theore... | import Mathlib
/-- Pigeonhole principle for blocks of consecutive numbers. -/
theorem close_pair (s : Finset ℕ) (hs : s ⊆ Finset.range (7 * 7)) (h : 7 < s.card) :
∃ x ∈ s, ∃ y ∈ s, x < y ∧ y < x + 7 := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-counting-d3-t0033 |
combinatorial-identities-fibonacci-d3-t0034 | combinatorial-identities | 05 | fibonacci | 3 | 34 | prove | # Prove an identity for Fibonacci numbers
Prove the following.
First prove Cassini's identity: for every natural number \(n\), \[F_{n+1}^2 - F_n F_{n+2} = (-1)^n,\] computed in the integers, where \(F\) is the Fibonacci sequence. Then conclude that \(F_{m+1}^2 - F_m F_{m+2}\) is either \(1\) or \(-1\) when \(m = 5n +... | import Mathlib
/-- Cassini's identity for Fibonacci numbers. -/
theorem cassini (n : ℕ) :
(Nat.fib (n + 1) : ℤ) ^ 2 - Nat.fib n * Nat.fib (n + 2) = (-1) ^ n := by
sorry
/-- Cassini's determinant is plus or minus one at the index given. -/
theorem cassini_pm_one (n : ℕ) :
(Nat.fib (5 * n + 7 + 1) : ℤ) ^ 2 - ... | tasks/combinatorial-identities/combinatorial-identities-fibonacci-d3-t0034 |
combinatorial-identities-linear_recurrence-d3-t0035 | combinatorial-identities | 05 | linear_recurrence | 3 | 35 | prove | # Find the closed form of a recurrence
Prove the following.
Define a sequence of integers by \(u_0 = -3\), \(u_1 = 18\) and \(u_{n+2} = -6\,u_{n+1} - 9\,u_{n}\). Prove that for every natural number \(n\), \[u_n = (-3 + -3 n) \cdot (-3)^{n}.\]
## What to do
`Solution.lean` in the working directory states the theorem... | import Mathlib
def u : ℕ → ℤ
| 0 => (-3)
| 1 => 18
| (n + 2) => (-6) * u (n + 1) - 9 * u n
/-- A closed form for the sequence defined by the recurrence. -/
theorem seq_closed_form (n : ℕ) :
u n = ((-3) + (-3) * (n : ℤ)) * (-3) ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-linear_recurrence-d3-t0035 |
combinatorial-identities-binomial_sums-d1-t0036 | combinatorial-identities | 05 | binomial_sums | 1 | 36 | prove | # Prove an identity for binomial coefficients
Prove the following.
For every natural number \(n\), \[\sum_{i=0}^{n} \binom{n}{i}\, 2^{i} = 3^{n}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mathlib, with `sorry` in place of the proof. Replace every `sorry` with a proof... | import Mathlib
/-- A weighted sum of binomial coefficients. -/
theorem binomial_sum (n : ℕ) :
∑ i ∈ Finset.range (n + 1), n.choose i * 2 ^ i = 3 ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-binomial_sums-d1-t0036 |
combinatorial-identities-counting-d1-t0037 | combinatorial-identities | 05 | counting | 1 | 37 | prove | # Prove a counting statement
Prove the following.
Let \(s\) be a finite set of integers with more than 3 elements. Prove that \(s\) contains two different integers \(x \ne y\) that leave the same remainder on division by 3.
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mat... | import Mathlib
/-- Pigeonhole principle for remainders. -/
theorem pigeonhole_mod (s : Finset ℤ) (h : 3 < s.card) :
∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ x % 3 = y % 3 := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-counting-d1-t0037 |
combinatorial-identities-fibonacci-d1-t0038 | combinatorial-identities | 05 | fibonacci | 1 | 38 | prove | # Prove an identity for Fibonacci numbers
Prove the following.
For every natural number \(n\), with \(F\) the Fibonacci sequence (\(F_0 = 0\), \(F_1 = 1\), \(F_{k+2} = F_k + F_{k+1}\)), \[\sum_{i=0}^{n-1} F_{i+9} + F_{10} = F_{n+10}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Lea... | import Mathlib
/-- A telescoping sum of Fibonacci numbers. -/
theorem fib_shifted_sum (n : ℕ) :
∑ i ∈ Finset.range n, Nat.fib (i + 9) + Nat.fib 10 = Nat.fib (n + 10) := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-fibonacci-d1-t0038 |
combinatorial-identities-linear_recurrence-d1-t0039 | combinatorial-identities | 05 | linear_recurrence | 1 | 39 | prove | # Find the closed form of a recurrence
Prove the following.
Define a sequence of integers by \(u_0 = 2\), \(u_1 = 13\) and \(u_{n+2} = 7\,u_{n+1} - 10\,u_{n}\). Prove that for every natural number \(n\), \[u_n = 3 \cdot 5^{n} + -1 \cdot 2^{n}.\]
## What to do
`Solution.lean` in the working directory states the theo... | import Mathlib
def u : ℕ → ℤ
| 0 => 2
| 1 => 13
| (n + 2) => 7 * u (n + 1) - 10 * u n
/-- A closed form for the sequence defined by the recurrence. -/
theorem seq_closed_form (n : ℕ) :
u n = 3 * 5 ^ n + (-1) * 2 ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-linear_recurrence-d1-t0039 |
combinatorial-identities-binomial_sums-d2-t0040 | combinatorial-identities | 05 | binomial_sums | 2 | 40 | prove | # Prove an identity for binomial coefficients
Prove the following.
For every natural number \(n\), \[3 \cdot \sum_{i=0}^{n} \binom{i+7}{7} = 3 \cdot \binom{n+8}{8}.\] (This is the hockey stick identity.)
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mathlib, with `sorry` i... | import Mathlib
/-- A hockey stick identity for binomial coefficients. -/
theorem hockey_stick (n : ℕ) :
∑ i ∈ Finset.range (n + 1), 3 * (i + 7).choose 7 = 3 * (n + 8).choose 8 := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-binomial_sums-d2-t0040 |
combinatorial-identities-counting-d2-t0041 | combinatorial-identities | 05 | counting | 2 | 41 | prove | # Prove a counting statement
Prove the following.
Let \(n\) be a natural number. Prove that the set \(\{0, 1, \dots, n-1\}\) has at most as many elements as the set of integers \(y\) with \(0 \le y < 4 n\) and \(y \equiv 3 \pmod{4}\). (Construct an injection.)
## What to do
`Solution.lean` in the working directory ... | import Mathlib
/-- An injection into a residue class gives a cardinality bound. -/
theorem card_le_residue_class (n : ℕ) :
(Finset.range n).card ≤ ((Finset.range (4 * n)).filter (fun y => y % 4 = 3)).card := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-counting-d2-t0041 |
combinatorial-identities-fibonacci-d2-t0042 | combinatorial-identities | 05 | fibonacci | 2 | 42 | prove | # Prove an identity for Fibonacci numbers
Prove the following.
For every natural number \(n\), with \(F\) the Fibonacci sequence, \[\sum_{i=0}^{n} 7\,F_i^2 = 7\,F_n F_{n+1}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mathlib, with `sorry` in place of the proof. Replac... | import Mathlib
/-- A sum of squares of Fibonacci numbers. -/
theorem fib_square_sum (n : ℕ) :
∑ i ∈ Finset.range (n + 1), 7 * Nat.fib i ^ 2 = 7 * (Nat.fib n * Nat.fib (n + 1)) := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-fibonacci-d2-t0042 |
combinatorial-identities-linear_recurrence-d2-t0043 | combinatorial-identities | 05 | linear_recurrence | 2 | 43 | prove | # Find the closed form of a recurrence
Prove the following.
Define a sequence of integers by \(u_0 = 4\), \(u_1 = -2\) and \(u_{n+2} = 2\,u_{n+1} - -8\,u_{n}\). Prove that for every natural number \(n\), \[u_n = 1 \cdot 4^{n} + 3 \cdot (-2)^{n}.\]
## What to do
`Solution.lean` in the working directory states the th... | import Mathlib
def u : ℕ → ℤ
| 0 => 4
| 1 => (-2)
| (n + 2) => 2 * u (n + 1) - (-8) * u n
/-- A closed form for the sequence defined by the recurrence. -/
theorem seq_closed_form (n : ℕ) :
u n = 1 * 4 ^ n + 3 * (-2) ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-linear_recurrence-d2-t0043 |
combinatorial-identities-binomial_sums-d3-t0044 | combinatorial-identities | 05 | binomial_sums | 3 | 44 | prove | # Prove an identity for binomial coefficients
Prove the following.
First prove \[\sum_{i=0}^{n} i \binom{n}{i} = n \cdot 2^{n-1},\] where \(n - 1\) is truncated subtraction on the natural numbers. Then use it, and the value of \(\sum_{i=0}^{n} \binom{n}{i}\), to prove \[\sum_{i=0}^{n} (2i + 7) \binom{n}{i} = 2 \cdot ... | import Mathlib
/-- The sum of i times n choose i. -/
theorem sum_i_choose (n : ℕ) :
∑ i ∈ Finset.range (n + 1), i * n.choose i = n * 2 ^ (n - 1) := by
sorry
/-- A weighted binomial sum. -/
theorem weighted_sum (n : ℕ) :
∑ i ∈ Finset.range (n + 1), (2 * i + 7) * n.choose i = 2 * (n * 2 ^ (n - 1)) + 7 * 2 ^ n... | tasks/combinatorial-identities/combinatorial-identities-binomial_sums-d3-t0044 |
combinatorial-identities-counting-d3-t0045 | combinatorial-identities | 05 | counting | 3 | 45 | prove | # Prove a counting statement
Prove the following.
Let \(s\) be a set of natural numbers that are all less than \(2 \cdot 5 = 10\), and suppose \(s\) has more than 5 elements. Prove that \(s\) contains two elements \(x < y\) with \(y - x < 2\).
## What to do
`Solution.lean` in the working directory states the theore... | import Mathlib
/-- Pigeonhole principle for blocks of consecutive numbers. -/
theorem close_pair (s : Finset ℕ) (hs : s ⊆ Finset.range (2 * 5)) (h : 5 < s.card) :
∃ x ∈ s, ∃ y ∈ s, x < y ∧ y < x + 2 := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-counting-d3-t0045 |
combinatorial-identities-fibonacci-d3-t0046 | combinatorial-identities | 05 | fibonacci | 3 | 46 | prove | # Prove an identity for Fibonacci numbers
Prove the following.
First prove Cassini's identity: for every natural number \(n\), \[F_{n+1}^2 - F_n F_{n+2} = (-1)^n,\] computed in the integers, where \(F\) is the Fibonacci sequence. Then conclude that \(F_{m+1}^2 - F_m F_{m+2}\) is either \(1\) or \(-1\) when \(m = 7n +... | import Mathlib
/-- Cassini's identity for Fibonacci numbers. -/
theorem cassini (n : ℕ) :
(Nat.fib (n + 1) : ℤ) ^ 2 - Nat.fib n * Nat.fib (n + 2) = (-1) ^ n := by
sorry
/-- Cassini's determinant is plus or minus one at the index given. -/
theorem cassini_pm_one (n : ℕ) :
(Nat.fib (7 * n + 6 + 1) : ℤ) ^ 2 - ... | tasks/combinatorial-identities/combinatorial-identities-fibonacci-d3-t0046 |
combinatorial-identities-linear_recurrence-d3-t0047 | combinatorial-identities | 05 | linear_recurrence | 3 | 47 | prove | # Find the closed form of a recurrence
Prove the following.
Define a sequence of integers by \(u_0 = -3\), \(u_1 = 0\) and \(u_{n+2} = -4\,u_{n+1} - 4\,u_{n}\). Prove that for every natural number \(n\), \[u_n = (-3 + 3 n) \cdot (-2)^{n}.\]
## What to do
`Solution.lean` in the working directory states the theorem i... | import Mathlib
def u : ℕ → ℤ
| 0 => (-3)
| 1 => 0
| (n + 2) => (-4) * u (n + 1) - 4 * u n
/-- A closed form for the sequence defined by the recurrence. -/
theorem seq_closed_form (n : ℕ) :
u n = ((-3) + 3 * (n : ℤ)) * (-2) ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-linear_recurrence-d3-t0047 |
combinatorial-identities-binomial_sums-d1-t0048 | combinatorial-identities | 05 | binomial_sums | 1 | 48 | prove | # Prove an identity for binomial coefficients
Prove the following.
For every natural number \(n\), \[\sum_{i=0}^{n} \binom{n}{i}\, 4^{i} = 5^{n}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mathlib, with `sorry` in place of the proof. Replace every `sorry` with a proof... | import Mathlib
/-- A weighted sum of binomial coefficients. -/
theorem binomial_sum (n : ℕ) :
∑ i ∈ Finset.range (n + 1), n.choose i * 4 ^ i = 5 ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-binomial_sums-d1-t0048 |
combinatorial-identities-counting-d1-t0049 | combinatorial-identities | 05 | counting | 1 | 49 | prove | # Prove a counting statement
Prove the following.
Let \(s\) be a finite set of integers with more than 5 elements. Prove that \(s\) contains two different integers \(x \ne y\) that leave the same remainder on division by 5.
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mat... | import Mathlib
/-- Pigeonhole principle for remainders. -/
theorem pigeonhole_mod (s : Finset ℤ) (h : 5 < s.card) :
∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ x % 5 = y % 5 := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-counting-d1-t0049 |
combinatorial-identities-fibonacci-d1-t0050 | combinatorial-identities | 05 | fibonacci | 1 | 50 | prove | # Prove an identity for Fibonacci numbers
Prove the following.
For every natural number \(n\), with \(F\) the Fibonacci sequence (\(F_0 = 0\), \(F_1 = 1\), \(F_{k+2} = F_k + F_{k+1}\)), \[\sum_{i=0}^{n-1} F_{i+0} + F_{1} = F_{n+1}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Lean ... | import Mathlib
/-- A telescoping sum of Fibonacci numbers. -/
theorem fib_shifted_sum (n : ℕ) :
∑ i ∈ Finset.range n, Nat.fib (i + 0) + Nat.fib 1 = Nat.fib (n + 1) := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-fibonacci-d1-t0050 |
combinatorial-identities-linear_recurrence-d1-t0051 | combinatorial-identities | 05 | linear_recurrence | 1 | 51 | prove | # Find the closed form of a recurrence
Prove the following.
Define a sequence of integers by \(u_0 = -4\), \(u_1 = -18\) and \(u_{n+2} = 8\,u_{n+1} - 15\,u_{n}\). Prove that for every natural number \(n\), \[u_n = -1 \cdot 3^{n} + -3 \cdot 5^{n}.\]
## What to do
`Solution.lean` in the working directory states the t... | import Mathlib
def u : ℕ → ℤ
| 0 => (-4)
| 1 => (-18)
| (n + 2) => 8 * u (n + 1) - 15 * u n
/-- A closed form for the sequence defined by the recurrence. -/
theorem seq_closed_form (n : ℕ) :
u n = (-1) * 3 ^ n + (-3) * 5 ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-linear_recurrence-d1-t0051 |
combinatorial-identities-binomial_sums-d2-t0052 | combinatorial-identities | 05 | binomial_sums | 2 | 52 | prove | # Prove an identity for binomial coefficients
Prove the following.
For every natural number \(n\), \[3 \cdot \sum_{i=0}^{n} \binom{i+3}{3} = 3 \cdot \binom{n+4}{4}.\] (This is the hockey stick identity.)
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mathlib, with `sorry` i... | import Mathlib
/-- A hockey stick identity for binomial coefficients. -/
theorem hockey_stick (n : ℕ) :
∑ i ∈ Finset.range (n + 1), 3 * (i + 3).choose 3 = 3 * (n + 4).choose 4 := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-binomial_sums-d2-t0052 |
combinatorial-identities-counting-d2-t0053 | combinatorial-identities | 05 | counting | 2 | 53 | prove | # Prove a counting statement
Prove the following.
Let \(n\) be a natural number. Prove that the set \(\{0, 1, \dots, n-1\}\) has at most as many elements as the set of integers \(y\) with \(0 \le y < 3 n\) and \(y \equiv 2 \pmod{3}\). (Construct an injection.)
## What to do
`Solution.lean` in the working directory ... | import Mathlib
/-- An injection into a residue class gives a cardinality bound. -/
theorem card_le_residue_class (n : ℕ) :
(Finset.range n).card ≤ ((Finset.range (3 * n)).filter (fun y => y % 3 = 2)).card := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-counting-d2-t0053 |
combinatorial-identities-fibonacci-d2-t0054 | combinatorial-identities | 05 | fibonacci | 2 | 54 | prove | # Prove an identity for Fibonacci numbers
Prove the following.
For every natural number \(n\), with \(F\) the Fibonacci sequence, \[\sum_{i=0}^{n} 2\,F_i^2 = 2\,F_n F_{n+1}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mathlib, with `sorry` in place of the proof. Replac... | import Mathlib
/-- A sum of squares of Fibonacci numbers. -/
theorem fib_square_sum (n : ℕ) :
∑ i ∈ Finset.range (n + 1), 2 * Nat.fib i ^ 2 = 2 * (Nat.fib n * Nat.fib (n + 1)) := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-fibonacci-d2-t0054 |
combinatorial-identities-linear_recurrence-d2-t0055 | combinatorial-identities | 05 | linear_recurrence | 2 | 55 | prove | # Find the closed form of a recurrence
Prove the following.
Define a sequence of integers by \(u_0 = 6\), \(u_1 = 6\) and \(u_{n+2} = 0\,u_{n+1} - -9\,u_{n}\). Prove that for every natural number \(n\), \[u_n = 4 \cdot 3^{n} + 2 \cdot (-3)^{n}.\]
## What to do
`Solution.lean` in the working directory states the the... | import Mathlib
def u : ℕ → ℤ
| 0 => 6
| 1 => 6
| (n + 2) => 0 * u (n + 1) - (-9) * u n
/-- A closed form for the sequence defined by the recurrence. -/
theorem seq_closed_form (n : ℕ) :
u n = 4 * 3 ^ n + 2 * (-3) ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-linear_recurrence-d2-t0055 |
combinatorial-identities-binomial_sums-d3-t0056 | combinatorial-identities | 05 | binomial_sums | 3 | 56 | prove | # Prove an identity for binomial coefficients
Prove the following.
First prove \[\sum_{i=0}^{n} i \binom{n}{i} = n \cdot 2^{n-1},\] where \(n - 1\) is truncated subtraction on the natural numbers. Then use it, and the value of \(\sum_{i=0}^{n} \binom{n}{i}\), to prove \[\sum_{i=0}^{n} (1i + 7) \binom{n}{i} = 1 \cdot ... | import Mathlib
/-- The sum of i times n choose i. -/
theorem sum_i_choose (n : ℕ) :
∑ i ∈ Finset.range (n + 1), i * n.choose i = n * 2 ^ (n - 1) := by
sorry
/-- A weighted binomial sum. -/
theorem weighted_sum (n : ℕ) :
∑ i ∈ Finset.range (n + 1), (1 * i + 7) * n.choose i = 1 * (n * 2 ^ (n - 1)) + 7 * 2 ^ n... | tasks/combinatorial-identities/combinatorial-identities-binomial_sums-d3-t0056 |
combinatorial-identities-counting-d3-t0057 | combinatorial-identities | 05 | counting | 3 | 57 | prove | # Prove a counting statement
Prove the following.
Let \(s\) be a set of natural numbers that are all less than \(7 \cdot 5 = 35\), and suppose \(s\) has more than 5 elements. Prove that \(s\) contains two elements \(x < y\) with \(y - x < 7\).
## What to do
`Solution.lean` in the working directory states the theore... | import Mathlib
/-- Pigeonhole principle for blocks of consecutive numbers. -/
theorem close_pair (s : Finset ℕ) (hs : s ⊆ Finset.range (7 * 5)) (h : 5 < s.card) :
∃ x ∈ s, ∃ y ∈ s, x < y ∧ y < x + 7 := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-counting-d3-t0057 |
combinatorial-identities-fibonacci-d3-t0058 | combinatorial-identities | 05 | fibonacci | 3 | 58 | prove | # Prove an identity for Fibonacci numbers
Prove the following.
First prove Cassini's identity: for every natural number \(n\), \[F_{n+1}^2 - F_n F_{n+2} = (-1)^n,\] computed in the integers, where \(F\) is the Fibonacci sequence. Then conclude that \(F_{m+1}^2 - F_m F_{m+2}\) is either \(1\) or \(-1\) when \(m = 2n +... | import Mathlib
/-- Cassini's identity for Fibonacci numbers. -/
theorem cassini (n : ℕ) :
(Nat.fib (n + 1) : ℤ) ^ 2 - Nat.fib n * Nat.fib (n + 2) = (-1) ^ n := by
sorry
/-- Cassini's determinant is plus or minus one at the index given. -/
theorem cassini_pm_one (n : ℕ) :
(Nat.fib (2 * n + 1 + 1) : ℤ) ^ 2 - ... | tasks/combinatorial-identities/combinatorial-identities-fibonacci-d3-t0058 |
combinatorial-identities-linear_recurrence-d3-t0059 | combinatorial-identities | 05 | linear_recurrence | 3 | 59 | prove | # Find the closed form of a recurrence
Prove the following.
Define a sequence of integers by \(u_0 = 1\), \(u_1 = 6\) and \(u_{n+2} = 4\,u_{n+1} - 4\,u_{n}\). Prove that for every natural number \(n\), \[u_n = (1 + 2 n) \cdot 2^{n}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Lean... | import Mathlib
def u : ℕ → ℤ
| 0 => 1
| 1 => 6
| (n + 2) => 4 * u (n + 1) - 4 * u n
/-- A closed form for the sequence defined by the recurrence. -/
theorem seq_closed_form (n : ℕ) :
u n = (1 + 2 * (n : ℤ)) * 2 ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-linear_recurrence-d3-t0059 |
combinatorial-identities-binomial_sums-d1-t0060 | combinatorial-identities | 05 | binomial_sums | 1 | 60 | prove | # Prove an identity for binomial coefficients
Prove the following.
For every natural number \(n\), \[\sum_{i=0}^{n} \binom{n}{i}\, 7^{i} = 8^{n}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mathlib, with `sorry` in place of the proof. Replace every `sorry` with a proof... | import Mathlib
/-- A weighted sum of binomial coefficients. -/
theorem binomial_sum (n : ℕ) :
∑ i ∈ Finset.range (n + 1), n.choose i * 7 ^ i = 8 ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-binomial_sums-d1-t0060 |
combinatorial-identities-counting-d1-t0061 | combinatorial-identities | 05 | counting | 1 | 61 | prove | # Prove a counting statement
Prove the following.
Let \(s\) be a finite set of integers with more than 4 elements. Prove that \(s\) contains two different integers \(x \ne y\) that leave the same remainder on division by 4.
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mat... | import Mathlib
/-- Pigeonhole principle for remainders. -/
theorem pigeonhole_mod (s : Finset ℤ) (h : 4 < s.card) :
∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ x % 4 = y % 4 := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-counting-d1-t0061 |
combinatorial-identities-fibonacci-d1-t0062 | combinatorial-identities | 05 | fibonacci | 1 | 62 | prove | # Prove an identity for Fibonacci numbers
Prove the following.
For every natural number \(n\), with \(F\) the Fibonacci sequence (\(F_0 = 0\), \(F_1 = 1\), \(F_{k+2} = F_k + F_{k+1}\)), \[\sum_{i=0}^{n-1} F_{i+11} + F_{12} = F_{n+12}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Le... | import Mathlib
/-- A telescoping sum of Fibonacci numbers. -/
theorem fib_shifted_sum (n : ℕ) :
∑ i ∈ Finset.range n, Nat.fib (i + 11) + Nat.fib 12 = Nat.fib (n + 12) := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-fibonacci-d1-t0062 |
combinatorial-identities-linear_recurrence-d1-t0063 | combinatorial-identities | 05 | linear_recurrence | 1 | 63 | prove | # Find the closed form of a recurrence
Prove the following.
Define a sequence of integers by \(u_0 = -2\), \(u_1 = -4\) and \(u_{n+2} = 8\,u_{n+1} - 15\,u_{n}\). Prove that for every natural number \(n\), \[u_n = 1 \cdot 5^{n} + -3 \cdot 3^{n}.\]
## What to do
`Solution.lean` in the working directory states the the... | import Mathlib
def u : ℕ → ℤ
| 0 => (-2)
| 1 => (-4)
| (n + 2) => 8 * u (n + 1) - 15 * u n
/-- A closed form for the sequence defined by the recurrence. -/
theorem seq_closed_form (n : ℕ) :
u n = 1 * 5 ^ n + (-3) * 3 ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-linear_recurrence-d1-t0063 |
combinatorial-identities-binomial_sums-d2-t0064 | combinatorial-identities | 05 | binomial_sums | 2 | 64 | prove | # Prove an identity for binomial coefficients
Prove the following.
For every natural number \(n\), \[5 \cdot \sum_{i=0}^{n} \binom{i+3}{3} = 5 \cdot \binom{n+4}{4}.\] (This is the hockey stick identity.)
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mathlib, with `sorry` i... | import Mathlib
/-- A hockey stick identity for binomial coefficients. -/
theorem hockey_stick (n : ℕ) :
∑ i ∈ Finset.range (n + 1), 5 * (i + 3).choose 3 = 5 * (n + 4).choose 4 := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-binomial_sums-d2-t0064 |
combinatorial-identities-counting-d2-t0065 | combinatorial-identities | 05 | counting | 2 | 65 | prove | # Prove a counting statement
Prove the following.
Let \(n\) be a natural number. Prove that the set \(\{0, 1, \dots, n-1\}\) has at most as many elements as the set of integers \(y\) with \(0 \le y < 6 n\) and \(y \equiv 0 \pmod{6}\). (Construct an injection.)
## What to do
`Solution.lean` in the working directory ... | import Mathlib
/-- An injection into a residue class gives a cardinality bound. -/
theorem card_le_residue_class (n : ℕ) :
(Finset.range n).card ≤ ((Finset.range (6 * n)).filter (fun y => y % 6 = 0)).card := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-counting-d2-t0065 |
combinatorial-identities-fibonacci-d2-t0066 | combinatorial-identities | 05 | fibonacci | 2 | 66 | prove | # Prove an identity for Fibonacci numbers
Prove the following.
For every natural number \(n\), with \(F\) the Fibonacci sequence, \[\sum_{i=0}^{n} 1\,F_i^2 = 1\,F_n F_{n+1}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mathlib, with `sorry` in place of the proof. Replac... | import Mathlib
/-- A sum of squares of Fibonacci numbers. -/
theorem fib_square_sum (n : ℕ) :
∑ i ∈ Finset.range (n + 1), 1 * Nat.fib i ^ 2 = 1 * (Nat.fib n * Nat.fib (n + 1)) := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-fibonacci-d2-t0066 |
combinatorial-identities-linear_recurrence-d2-t0067 | combinatorial-identities | 05 | linear_recurrence | 2 | 67 | prove | # Find the closed form of a recurrence
Prove the following.
Define a sequence of integers by \(u_0 = 1\), \(u_1 = -2\) and \(u_{n+2} = 5\,u_{n+1} - 4\,u_{n}\). Prove that for every natural number \(n\), \[u_n = -1 \cdot 4^{n} + 2 \cdot 1^{n}.\]
## What to do
`Solution.lean` in the working directory states the theor... | import Mathlib
def u : ℕ → ℤ
| 0 => 1
| 1 => (-2)
| (n + 2) => 5 * u (n + 1) - 4 * u n
/-- A closed form for the sequence defined by the recurrence. -/
theorem seq_closed_form (n : ℕ) :
u n = (-1) * 4 ^ n + 2 * 1 ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-linear_recurrence-d2-t0067 |
combinatorial-identities-binomial_sums-d3-t0068 | combinatorial-identities | 05 | binomial_sums | 3 | 68 | prove | # Prove an identity for binomial coefficients
Prove the following.
First prove \[\sum_{i=0}^{n} i \binom{n}{i} = n \cdot 2^{n-1},\] where \(n - 1\) is truncated subtraction on the natural numbers. Then use it, and the value of \(\sum_{i=0}^{n} \binom{n}{i}\), to prove \[\sum_{i=0}^{n} (1i + 1) \binom{n}{i} = 1 \cdot ... | import Mathlib
/-- The sum of i times n choose i. -/
theorem sum_i_choose (n : ℕ) :
∑ i ∈ Finset.range (n + 1), i * n.choose i = n * 2 ^ (n - 1) := by
sorry
/-- A weighted binomial sum. -/
theorem weighted_sum (n : ℕ) :
∑ i ∈ Finset.range (n + 1), (1 * i + 1) * n.choose i = 1 * (n * 2 ^ (n - 1)) + 1 * 2 ^ n... | tasks/combinatorial-identities/combinatorial-identities-binomial_sums-d3-t0068 |
combinatorial-identities-counting-d3-t0069 | combinatorial-identities | 05 | counting | 3 | 69 | prove | # Prove a counting statement
Prove the following.
Let \(s\) be a set of natural numbers that are all less than \(6 \cdot 2 = 12\), and suppose \(s\) has more than 2 elements. Prove that \(s\) contains two elements \(x < y\) with \(y - x < 6\).
## What to do
`Solution.lean` in the working directory states the theore... | import Mathlib
/-- Pigeonhole principle for blocks of consecutive numbers. -/
theorem close_pair (s : Finset ℕ) (hs : s ⊆ Finset.range (6 * 2)) (h : 2 < s.card) :
∃ x ∈ s, ∃ y ∈ s, x < y ∧ y < x + 6 := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-counting-d3-t0069 |
combinatorial-identities-fibonacci-d3-t0070 | combinatorial-identities | 05 | fibonacci | 3 | 70 | prove | # Prove an identity for Fibonacci numbers
Prove the following.
First prove Cassini's identity: for every natural number \(n\), \[F_{n+1}^2 - F_n F_{n+2} = (-1)^n,\] computed in the integers, where \(F\) is the Fibonacci sequence. Then conclude that \(F_{m+1}^2 - F_m F_{m+2}\) is either \(1\) or \(-1\) when \(m = 5n +... | import Mathlib
/-- Cassini's identity for Fibonacci numbers. -/
theorem cassini (n : ℕ) :
(Nat.fib (n + 1) : ℤ) ^ 2 - Nat.fib n * Nat.fib (n + 2) = (-1) ^ n := by
sorry
/-- Cassini's determinant is plus or minus one at the index given. -/
theorem cassini_pm_one (n : ℕ) :
(Nat.fib (5 * n + 5 + 1) : ℤ) ^ 2 - ... | tasks/combinatorial-identities/combinatorial-identities-fibonacci-d3-t0070 |
combinatorial-identities-linear_recurrence-d3-t0071 | combinatorial-identities | 05 | linear_recurrence | 3 | 71 | prove | # Find the closed form of a recurrence
Prove the following.
Define a sequence of integers by \(u_0 = 1\), \(u_1 = 16\) and \(u_{n+2} = 8\,u_{n+1} - 16\,u_{n}\). Prove that for every natural number \(n\), \[u_n = (1 + 3 n) \cdot 4^{n}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Le... | import Mathlib
def u : ℕ → ℤ
| 0 => 1
| 1 => 16
| (n + 2) => 8 * u (n + 1) - 16 * u n
/-- A closed form for the sequence defined by the recurrence. -/
theorem seq_closed_form (n : ℕ) :
u n = (1 + 3 * (n : ℤ)) * 4 ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-linear_recurrence-d3-t0071 |
combinatorial-identities-binomial_sums-d1-t0072 | combinatorial-identities | 05 | binomial_sums | 1 | 72 | prove | # Prove an identity for binomial coefficients
Prove the following.
For every natural number \(n\), \[\sum_{i=0}^{n} \binom{n}{i}\, 2^{i} = 3^{n}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mathlib, with `sorry` in place of the proof. Replace every `sorry` with a proof... | import Mathlib
/-- A weighted sum of binomial coefficients. -/
theorem binomial_sum (n : ℕ) :
∑ i ∈ Finset.range (n + 1), n.choose i * 2 ^ i = 3 ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-binomial_sums-d1-t0072 |
combinatorial-identities-counting-d1-t0073 | combinatorial-identities | 05 | counting | 1 | 73 | prove | # Prove a counting statement
Prove the following.
Let \(s\) be a finite set of integers with more than 5 elements. Prove that \(s\) contains two different integers \(x \ne y\) that leave the same remainder on division by 5.
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mat... | import Mathlib
/-- Pigeonhole principle for remainders. -/
theorem pigeonhole_mod (s : Finset ℤ) (h : 5 < s.card) :
∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ x % 5 = y % 5 := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-counting-d1-t0073 |
combinatorial-identities-fibonacci-d1-t0074 | combinatorial-identities | 05 | fibonacci | 1 | 74 | prove | # Prove an identity for Fibonacci numbers
Prove the following.
For every natural number \(n\), with \(F\) the Fibonacci sequence (\(F_0 = 0\), \(F_1 = 1\), \(F_{k+2} = F_k + F_{k+1}\)), \[\sum_{i=0}^{n-1} F_{i+13} + F_{14} = F_{n+14}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Le... | import Mathlib
/-- A telescoping sum of Fibonacci numbers. -/
theorem fib_shifted_sum (n : ℕ) :
∑ i ∈ Finset.range n, Nat.fib (i + 13) + Nat.fib 14 = Nat.fib (n + 14) := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-fibonacci-d1-t0074 |
combinatorial-identities-linear_recurrence-d1-t0075 | combinatorial-identities | 05 | linear_recurrence | 1 | 75 | prove | # Find the closed form of a recurrence
Prove the following.
Define a sequence of integers by \(u_0 = 5\), \(u_1 = 17\) and \(u_{n+2} = 6\,u_{n+1} - 5\,u_{n}\). Prove that for every natural number \(n\), \[u_n = 3 \cdot 5^{n} + 2 \cdot 1^{n}.\]
## What to do
`Solution.lean` in the working directory states the theore... | import Mathlib
def u : ℕ → ℤ
| 0 => 5
| 1 => 17
| (n + 2) => 6 * u (n + 1) - 5 * u n
/-- A closed form for the sequence defined by the recurrence. -/
theorem seq_closed_form (n : ℕ) :
u n = 3 * 5 ^ n + 2 * 1 ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-linear_recurrence-d1-t0075 |
combinatorial-identities-binomial_sums-d2-t0076 | combinatorial-identities | 05 | binomial_sums | 2 | 76 | prove | # Prove an identity for binomial coefficients
Prove the following.
For every natural number \(n\), \[\sum_{i=0}^{n} \binom{i+5}{5} = \binom{n+6}{6}.\] (This is the hockey stick identity.)
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mathlib, with `sorry` in place of the p... | import Mathlib
/-- A hockey stick identity for binomial coefficients. -/
theorem hockey_stick (n : ℕ) :
∑ i ∈ Finset.range (n + 1), (i + 5).choose 5 = (n + 6).choose 6 := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-binomial_sums-d2-t0076 |
combinatorial-identities-counting-d2-t0077 | combinatorial-identities | 05 | counting | 2 | 77 | prove | # Prove a counting statement
Prove the following.
Let \(n\) be a natural number. Prove that the set \(\{0, 1, \dots, n-1\}\) has at most as many elements as the set of integers \(y\) with \(0 \le y < 5 n\) and \(y \equiv 0 \pmod{5}\). (Construct an injection.)
## What to do
`Solution.lean` in the working directory ... | import Mathlib
/-- An injection into a residue class gives a cardinality bound. -/
theorem card_le_residue_class (n : ℕ) :
(Finset.range n).card ≤ ((Finset.range (5 * n)).filter (fun y => y % 5 = 0)).card := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-counting-d2-t0077 |
combinatorial-identities-fibonacci-d2-t0078 | combinatorial-identities | 05 | fibonacci | 2 | 78 | prove | # Prove an identity for Fibonacci numbers
Prove the following.
For every natural number \(n\), with \(F\) the Fibonacci sequence, \[\sum_{i=0}^{n} 1\,F_i^2 = 1\,F_n F_{n+1}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Lean 4 with Mathlib, with `sorry` in place of the proof. Replac... | import Mathlib
/-- A sum of squares of Fibonacci numbers. -/
theorem fib_square_sum (n : ℕ) :
∑ i ∈ Finset.range (n + 1), 1 * Nat.fib i ^ 2 = 1 * (Nat.fib n * Nat.fib (n + 1)) := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-fibonacci-d2-t0078 |
combinatorial-identities-linear_recurrence-d2-t0079 | combinatorial-identities | 05 | linear_recurrence | 2 | 79 | prove | # Find the closed form of a recurrence
Prove the following.
Define a sequence of integers by \(u_0 = 6\), \(u_1 = 0\) and \(u_{n+2} = 0\,u_{n+1} - -9\,u_{n}\). Prove that for every natural number \(n\), \[u_n = 3 \cdot (-3)^{n} + 3 \cdot 3^{n}.\]
## What to do
`Solution.lean` in the working directory states the the... | import Mathlib
def u : ℕ → ℤ
| 0 => 6
| 1 => 0
| (n + 2) => 0 * u (n + 1) - (-9) * u n
/-- A closed form for the sequence defined by the recurrence. -/
theorem seq_closed_form (n : ℕ) :
u n = 3 * (-3) ^ n + 3 * 3 ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-linear_recurrence-d2-t0079 |
combinatorial-identities-binomial_sums-d3-t0080 | combinatorial-identities | 05 | binomial_sums | 3 | 80 | prove | # Prove an identity for binomial coefficients
Prove the following.
First prove \[\sum_{i=0}^{n} i \binom{n}{i} = n \cdot 2^{n-1},\] where \(n - 1\) is truncated subtraction on the natural numbers. Then use it, and the value of \(\sum_{i=0}^{n} \binom{n}{i}\), to prove \[\sum_{i=0}^{n} (1i + 6) \binom{n}{i} = 1 \cdot ... | import Mathlib
/-- The sum of i times n choose i. -/
theorem sum_i_choose (n : ℕ) :
∑ i ∈ Finset.range (n + 1), i * n.choose i = n * 2 ^ (n - 1) := by
sorry
/-- A weighted binomial sum. -/
theorem weighted_sum (n : ℕ) :
∑ i ∈ Finset.range (n + 1), (1 * i + 6) * n.choose i = 1 * (n * 2 ^ (n - 1)) + 6 * 2 ^ n... | tasks/combinatorial-identities/combinatorial-identities-binomial_sums-d3-t0080 |
combinatorial-identities-counting-d3-t0081 | combinatorial-identities | 05 | counting | 3 | 81 | prove | # Prove a counting statement
Prove the following.
Let \(s\) be a set of natural numbers that are all less than \(5 \cdot 7 = 35\), and suppose \(s\) has more than 7 elements. Prove that \(s\) contains two elements \(x < y\) with \(y - x < 5\).
## What to do
`Solution.lean` in the working directory states the theore... | import Mathlib
/-- Pigeonhole principle for blocks of consecutive numbers. -/
theorem close_pair (s : Finset ℕ) (hs : s ⊆ Finset.range (5 * 7)) (h : 7 < s.card) :
∃ x ∈ s, ∃ y ∈ s, x < y ∧ y < x + 5 := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-counting-d3-t0081 |
combinatorial-identities-fibonacci-d3-t0082 | combinatorial-identities | 05 | fibonacci | 3 | 82 | prove | # Prove an identity for Fibonacci numbers
Prove the following.
First prove Cassini's identity: for every natural number \(n\), \[F_{n+1}^2 - F_n F_{n+2} = (-1)^n,\] computed in the integers, where \(F\) is the Fibonacci sequence. Then conclude that \(F_{m+1}^2 - F_m F_{m+2}\) is either \(1\) or \(-1\) when \(m = n + ... | import Mathlib
/-- Cassini's identity for Fibonacci numbers. -/
theorem cassini (n : ℕ) :
(Nat.fib (n + 1) : ℤ) ^ 2 - Nat.fib n * Nat.fib (n + 2) = (-1) ^ n := by
sorry
/-- Cassini's determinant is plus or minus one at the index given. -/
theorem cassini_pm_one (n : ℕ) :
(Nat.fib (n + 3 + 1) : ℤ) ^ 2 - Nat.... | tasks/combinatorial-identities/combinatorial-identities-fibonacci-d3-t0082 |
combinatorial-identities-linear_recurrence-d3-t0083 | combinatorial-identities | 05 | linear_recurrence | 3 | 83 | prove | # Find the closed form of a recurrence
Prove the following.
Define a sequence of integers by \(u_0 = 1\), \(u_1 = 8\) and \(u_{n+2} = 4\,u_{n+1} - 4\,u_{n}\). Prove that for every natural number \(n\), \[u_n = (1 + 3 n) \cdot 2^{n}.\]
## What to do
`Solution.lean` in the working directory states the theorem in Lean... | import Mathlib
def u : ℕ → ℤ
| 0 => 1
| 1 => 8
| (n + 2) => 4 * u (n + 1) - 4 * u n
/-- A closed form for the sequence defined by the recurrence. -/
theorem seq_closed_form (n : ℕ) :
u n = (1 + 3 * (n : ℤ)) * 2 ^ n := by
sorry
| tasks/combinatorial-identities/combinatorial-identities-linear_recurrence-d3-t0083 |
Lean Arena: mathematics environments with a kernel-checked reward
972 tasks in 9 environments in which a model proves a theorem, or writes a definition, in Lean 4 with Mathlib. By Renaissance Labs. The map of all 63 areas of mathematics, with how much of each Mathlib already formalizes, is at math.renaissancelabs.eu; source code at RenaissanceLabs-EU/lean-arena.
The agent gets a folder with Solution.lean (a theorem ending in sorry, or a definition to write) and an instruction, and edits the file. A hidden verifier returns a reward of 1 if the Lean kernel accepts the result, and 0 otherwise. There is no model grader and no partial credit for text that merely looks like a proof.
Environments
Each environment is a subset (load_dataset("RenaissanceLabsEU/math", "<name>") loads its task index).
| Subset | Area | Kind | What the agent does | Task families |
|---|---|---|---|---|
combinatorial-identities |
MSC 05 | prove | Prove binomial sums, Fibonacci identities, closed forms of linear recurrences, and counting arguments with injections and pigeonholes. | binomial_sums, counting, fibonacci, linear_recurrence |
definitions |
MSC 11 | define | Turn a number-theoretic definition written in words into a computable Lean function that agrees with it on hidden inputs. | count, divisors, extremum, pairs, sequence, sum |
finite-sums |
MSC 40 | prove | Prove a closed form for a finite sum: polynomial, geometric or telescoping, by induction on the number of terms. | geometric, polynomial, telescoping |
group-theory |
MSC 20 | prove | Prove facts about abstract groups: commutativity from exponent laws, inverses, subgroup membership and Lagrange, homomorphism kernels. | hom, inverse, involution, subgroup |
inequalities |
MSC 26 | prove | Prove real inequalities: AM-GM, Cauchy-Schwarz, absolute values and monotone functions, with hints, case splits and lemma reuse. | abs_ineq, amgm, cauchy, monotone |
linear-algebra |
MSC 15 | prove | Prove facts about 2x2 matrices, matrix powers, linear independence of explicit vectors, and kernels, ranges and projections of linear maps. | det_trace, independence, linear_map, matrix_pow |
logic-and-sets |
MSC 03 | prove | Prove set identities and image statements, Finset cardinality facts and equivalence relations. | finset_card, relations, set_identities |
modular-arithmetic |
MSC 11 | prove | Prove facts about residues, divisibility, congruences and coprimality for natural numbers and integers, by case analysis on residues. | congruence_chain, divisibility, gcd_coprime, power_residues |
real-analysis |
MSC 26 | prove | Prove limits of explicit sequences, epsilon-delta continuity, bounds on recursive sequences and uniform bounds, from the definitions. | continuity, limit_sequence, sequence_bounds, uniform_bounds |
Every subset has a train split (84 tasks) and an eval split (24 tasks). Each has three difficulty levels.
How a task is checked
tests/grade.py compiles the submission, re-checks it with leanchecker, then runs Verify.lean, which loads the hidden reference and the submission into separate environments and compares kernel terms. It requires that the task's own definitions are unchanged, that each target has exactly the reference statement, and that the proof depends only on propext, Classical.choice and Quot.sound. sorry, native_decide, new axioms, a changed definition and a weakened statement are all rejected; tools/verifier_cheats.py tests these.
Layout
tasks/<env>/<task_id>/ one Harbor task directory per task
instruction.md what the agent is asked to do
task.toml metadata and limits (2 CPUs, 6 GB, no internet)
environment/ Dockerfile and workdir/Solution.lean, copied to /app
solution/ the reference solution, never shown to the agent
tests/ test.sh, grade.py, Verify.lean, spec.json: the hidden verifier
data/<env>/{train,eval}.jsonl the task index shown in the viewer, with the instruction and the start file
envs/<env>/ the seeded generator (gen.py) and env.toml; the contract is in AUTHORING.md
arena/ lean/ docker/ tools/ tests/ the task model, grader, Lean project, image, and checks
reference/ Mathlib coverage per area and the one-tactic baseline numbers
Lean 4.29.1 with Mathlib at commit 5e932f97dd25535344f80f9dd8da3aab83df0fe6. The image in docker/Dockerfile builds Lean, the Mathlib cache and the grader (about 15 GB).
What we measured, and what we did not
- Every reference solution compiles and passes the grader in a batched Lean run (
tools/selftest.py). - The Docker path was run end to end on one held-out task per environment (9 tasks, no network): the reference solution got reward 1.0 and the untouched start file 0.0. A grade takes about 2.5 minutes in a container, mostly importing Mathlib several times.
- One-tactic floor. A single automation tactic (
first | grind | aesop | simp | omega | norm_num | nlinarith | decide) closes 15 of 192 sampled proving tasks (difficulty 1 / 2 / 3 per environment below). That is a floor for how much of the set needs no real proof, not a model score.
| Environment | Closed by one tactic (d1 / d2 / d3, of 8 each) |
|---|---|
combinatorial-identities |
0 of 8 / 0 of 8 / 0 of 8 |
finite-sums |
0 of 8 / 0 of 8 / 0 of 8 |
group-theory |
2 of 8 / 1 of 8 / 0 of 8 |
inequalities |
2 of 8 / 0 of 8 / 2 of 8 |
linear-algebra |
3 of 8 / 0 of 8 / 0 of 8 |
logic-and-sets |
2 of 8 / 2 of 8 / 1 of 8 |
modular-arithmetic |
0 of 8 / 0 of 8 / 0 of 8 |
real-analysis |
0 of 8 / 0 of 8 / 0 of 8 |
Limits
- No model baseline yet. We have not published how any language model scores on these tasks.
- The eval split is in distribution. Train and eval come from the same generators with different seeds. A model that learns the templates will do well on both. It measures practice on these families, not general theorem proving.
- Some easy tasks fall to one tactic (see the table), and
definitionstasks are checked for type and unchanged given definitions, with the solver's own value allowed. - The tasks are synthetic and templated. The area pages of the website (descriptions, landmark theorems, open problems, figure captions) were written with AI help and have not been reviewed by a research mathematician.
- Mathlib coverage per area is a count of
theoremandlemmadeclarations mapped by hand from Mathlib directories to MSC areas. It is a size proxy, not a measure of how much of an area is formalized.
Licenses
Code MIT, data and content CC BY 4.0 (see LICENSE). Mathlib and Lean are Apache 2.0 and are not redistributed here.
- Downloads last month
- 157
