theorem_name stringlengths 10 17 | natural_language stringlengths 48 1.25k | answer listlengths 1 3 β | source stringclasses 1
value | tag stringclasses 4
values | formal_statement stringlengths 93 3.05k |
|---|---|---|---|---|---|
hackmath_1 | How many ways can a teacher select a group of 6 students to sit in the front row if the class has 13 students? | [
"1716"
] | https://www.hackmath.net/en/word-math-problems/combinatorics | hackmath | import Mathlib
abbrev hackmath_1_solution : β := sorry
theorem hackmath_1 (sols : Finset (Fin 13 β Fin 2))
(h_sols : β f, f β sols β ((List.ofFn f).count 0 = 6)) :
sols.card = hackmath_1_solution := by sorry |
hackmath_2 | There are 8 athletes participating in a sprint competition. The referee needs to select 3 athletes and assign them specific rankings (first place, second place, and third place). How many different arrangements are possible? | [
"336"
] | https://www.hackmath.net/en/word-math-problems/combinatorics | hackmath | import Mathlib
abbrev hackmath_2_solution : β := sorry
theorem hackmath_2 (sols : Finset (Fin 8 β Fin 4))
(h_sols : β f, f β sols β
((List.ofFn f).count 0 = 1) β§ ((List.ofFn f).count 1 = 1) β§ ((List.ofFn f).count 2 = 1)) :
sols.card = hackmath_2_solution := by sorry |
hackmath_3 | How many four-digit numbers can be formed from the numbers 3 5 8 9 if they are not allowed to be repeated? | [
"24"
] | https://www.hackmath.net/en/word-math-problems/combinatorics | hackmath | import Mathlib
abbrev hackmath_3_solution : β := sorry
theorem hackmath_3 (sol : Finset β)
(h_sol : β s, s β sol β 1000 β€ s β§ s β€ 9999 β§ (Nat.digits 10 s).toFinset = {3, 5, 8, 9}) :
sol.card = hackmath_3_solution := by sorry |
hackmath_4 | How many people must be in a group for at least two of them to be born in the same month? | [
"13"
] | https://www.hackmath.net/en/word-math-problems/combinatorics | hackmath | import Mathlib
abbrev hackmath_4_solution : β := sorry
theorem hackmath_4 : IsLeast {n | β f : Fin n β Fin 12, β a b, f a = f b} hackmath_4_solution := by sorry |
hackmath_5 | There are 10 red marbles, 6 green marbles, and 4 blue marbles in a box. What is the probability of picking the next red marble? | [
"1 / 2"
] | https://www.hackmath.net/en/word-math-problems/combinatorics | hackmath | import Mathlib
open MeasureTheory ProbabilityTheory ENNReal
noncomputable abbrev hackmath_5_solution : ENNReal := sorry
theorem hackmath_5 : uniformOn (Ξ© := (Fin 20)) β€ {i | i.1 < 10} = hackmath_5_solution := by sorry |
hackmath_6 | Two coins are tossed simultaneously. What is the probability of getting (i) At least one head? (ii) At most one tail? (iii) A head and a tail? | [
"3 / 4",
"3 / 4",
"1 / 2"
] | https://www.hackmath.net/en/word-math-problems/combinatorics | hackmath | import Mathlib
noncomputable abbrev hackmath_6_1_solution : ENNReal := sorry
noncomputable abbrev hackmath_6_2_solution : ENNReal := sorry
noncomputable abbrev hackmath_6_3_solution : ENNReal := sorry
theorem hackmath_6 : PMF.binomial (1/2 : _) ENNReal.half_le_self 2 1 +
PMF.binomial (1/2 : _) ENNReal.half_le_s... |
hackmath_7 | The group of 10 girls should be divided into two groups with at least four girls in each group. How many ways can this be done? | [
"462"
] | https://www.hackmath.net/en/word-math-problems/combinatorics | hackmath | import Mathlib
abbrev hackmath_7_solution : β := sorry
theorem hackmath_7 (sols : Finset (Finpartition (@Finset.univ (Fin 10))))
(h_sols : β f, f β sols β (f.parts.card = 2) β§ (β i, i β f.parts β i.card β₯ 4)) :
sols.card = hackmath_7_solution := by sorry |
hackmath_8 | A ferry with a capacity of 10 people takes a group of 13 men and 7 women across a river. Find the number of ways in which the group may be taken across the if all women go on the first group. | [
"286"
] | https://www.hackmath.net/en/word-math-problems/combinatorics | hackmath | import Mathlib
abbrev hackmath_8_solution : β := sorry
theorem hackmath_8 (sols : Finset ((Fin 13 β Fin 2) Γ (Fin 7 β Fin 2)))
(h_sols : β f, f β sols β (β i, f.2 i = 0) β§ β k, ((List.ofFn f.1).count k + (List.ofFn f.2).count k = 10)) :
sols.card = hackmath_8_solution := by sorry |
hackmath_9 | The father has six sons and ten identical, indistinguishable balls. How many ways can he give the balls to his sons if everyone gets at least one? | [
"126"
] | https://www.hackmath.net/en/word-math-problems/combinatorics | hackmath | import Mathlib
abbrev hackmath_9_solution : β := sorry
theorem hackmath_9 (sols : Finset (Fin 6 β β))
(h_sols : β f, f β sols β ((β i, f i > 0) β§ (β i, f i = 10))) :
sols.card = hackmath_9_solution := by sorry |
hackmath_10 | How many different ways can three people divide seven pears and five apples? | [
"756"
] | https://www.hackmath.net/en/word-math-problems/combinatorics | hackmath | import Mathlib
abbrev hackmath_10_solution : β := sorry
theorem hackmath_10 (sols : Finset (Fin 3 β (β Γ β)))
(h_sols : β f, f β sols β (β i, (f i).1 = 7 β§ β i, (f i).2 = 5)) :
sols.card = hackmath_10_solution := by sorry |
brualdi_ch1_16 | Show that the result of replacing every integer a in a magic square of order n with $n^2 + 1 β a$ is a magic square of order n. | null | null | brualdi | import Mathlib
structure IsMagicSquare {n : β} (M : Matrix (Fin n) (Fin n) β) : Prop where
mem : β i j, M i j β Finset.Icc 1 (n * n)
pairwise : β i j i' j', i β i' β¨ j β j' β M i j β M i' j'
same_sum : β s, (β i, β j, M i j = s) β§ (β j, β i, M i j = s) β§ (β i, M i i.rev = s) β§ β i, M i i = s
abbrev replace {n :... |
brualdi_ch1_10 | Verify that there is no magic square of order 2. | null | null | brualdi | import Mathlib
structure IsMagicSquare {n : β} (M : Matrix (Fin n) (Fin n) β) : Prop where
mem : β i j, M i j β Finset.Icc 1 (n * n)
pairwise : β i j i' j', i β i' β¨ j β j' β M i j β M i' j'
same_sum : β s, (β i, β j, M i j = s) β§ (β j, β i, M i j = s) β§ (β i, M i i.rev = s) β§ β i, M i i = s
theorem brualdi_ch1... |
brualdi_ch1_5 | Find the number of different perfect covers of a 3-by-4 chessboard by dominoes. | [
"9"
] | null | brualdi | import Mathlib
structure Domino (n k : β) where
carrier : Finset (Fin n Γ Fin (2 * k))
card : carrier.card = 2
position : β i β carrier, β j β carrier, i β j β
(i.1.val = j.1.val β§ (i.2.val + 1 = j.2.val β¨ j.2.val + 1 = i.2.val)) β¨
(i.2.val = j.2.val β§ (i.1.val + 1 = j.1.val β¨ j.1.val + 1 =... |
brualdi_ch2_6 | How many integers greater than 5400 have both of the following properties? (a) The digits are distinct. (b) The digits 2 and 7 do not occur. | [
"94830"
] | null | brualdi | import Mathlib
abbrev brualdi_ch2_6_solution : β := sorry
theorem brualdi_ch2_6 (s : Finset β)
(hs : β n, n β s β n > 5400 β§ (Nat.digits 10 n).Nodup β§ 2 β (Nat.digits 10 n) β§ 7 β (Nat.digits 10 n)) :
s.card = brualdi_ch2_6_solution := by sorry |
brualdi_ch2_36 | Determine the total number of combinations (of any size) of a multiset of objects of $k$ different types with finite repetition numbers $n_{1}, n_{2}, \ldots, n_{k}$, respectively. | [
"fun n => (β i : Fin k, (n i + 1))"
] | null | brualdi | import Mathlib
abbrev brualdi_ch2_36_solution {k} : (Fin k β β) β β := sorry
theorem brualdi_ch2_36 {k : β} (n : Fin k β β)
(sols : Finset (Fin k β β))
(h_sols : β f, f β sols β (β i, f i β€ n i)) :
sols.card = brualdi_ch2_36_solution n := by sorry |
brualdi_ch2_11 | How many sets of three integers between 1 and 20 are possible if no two consecutive integers are to be in a set? | [
"816"
] | null | brualdi | import Mathlib
open Finset
abbrev brualdi_ch2_11_solution : β := sorry
theorem brualdi_ch2_11 :
((Icc (1 : β) 20).powersetCard 3 |>.filter (fun S => β a β S, a - 1 β S β§ a + 1 β S)).card =
brualdi_ch2_11_solution := by sorry |
brualdi_ch3_18 | Prove that of any five points chosen within a square of side length 2 , there are two whose distance apart is at most $\sqrt{2}$. | null | null | brualdi | import Mathlib
theorem brualdi_ch3_18
(points : Fin 5 β (EuclideanSpace β (Fin 2)))
(h_points : β i, 0 β€ ((points i) 0) β§ ((points i) 0) β€ 2 β§ 0 β€ ((points i) 1) β§ ((points i) 1) β€ 2) :
β i j, i β j β§ dist (points i) (points j) β€ β2 := by sorry |
brualdi_ch3_4 | Show that if $n+1$ integers are chosen from the set ${1,2, \ldots, 2 n}$, then there are always two which differ by 1. | null | null | brualdi | import Mathlib
theorem brualdi_ch3_4 (n : β) (S : Finset β) (elem_range : β s β S, (1 β€ s β§ s β€ 2 * n))
(card : S.card = n + 1) : β s β S, β s' β S, s = s' + 1 := by sorry |
brualdi_ch3_27 | A collection of subsets of ${1,2, \ldots, n}$ has the property that each pair of subsets has at least one element in common. Prove that there are at most $2^{n-1}$ subsets in the collection. | null | null | brualdi | import Mathlib
theorem brualdi_ch3_27 (n : β) (hn : n β₯ 1)
(subsets : Set (Set (Set.Icc 1 n)))
(cond : β S β subsets, β T β subsets, (S β© T).Nonempty) :
β (m : β), m β€ 2 ^ (n - 1) β§ Nonempty (Fin m β subsets) := by sorry |
brualdi_ch4_35 | The complement $\bar{A}$ of an $r$-subset $A$ of $\{1,2, \ldots, n\}$ is the $(n-r)$-subset of $\{1,2, \ldots, n\}$, consisting of all those elements that do not belong to $A$. Let $M=\binom{n}{r}$, the number of $r$-subsets and, at the same time, the number of $(n-r)$ subsets of $\{1,2, \ldots, n\}$. Prove that, if $A... | null | null | brualdi | import Mathlib
open List Lex
theorem brualdi_ch4_35 (r n M : β) (hM : M = ((@Finset.univ (Fin n)).powersetCard r).card)
(A : Fin M β (Finset.powersetCard r (@Finset.univ (Fin M) _))) :
β i j, (List.Lex (fun x1 x2 : Fin M => x1 β€ x2)
(Finset.sort (Β· β€ Β·) (A i)) (Finset.sort (Β· β€ Β·) (A j))) β
(List.Lex ... |
brualdi_ch4_59 | Let $n \geq 2$ be an integer. Prove that the total number of inversions of all $n$ ! permutations of $1,2, \ldots, n$ equals $\frac{1}{2} n!\binom{n}{2}=n!\frac{n(n-1)}{4}$ (Hint: Pair up the permutations so that the number of inversions in each pair is $\frac{n(n-1)}{2}$.) | null | null | brualdi | import Mathlib
def invNum {n : β} (Ο : Equiv.Perm (Fin n)) : β :=
β x β Equiv.Perm.finPairsLT n, if Ο x.fst β€ Ο x.snd then 1 else 0
theorem brualdi_ch4_59 (n : β) (hn : n β₯ 2) : β Ο : Equiv.Perm (Fin n), invNum Ο =
n.factorial * n * (n - 1) / 4 := by sorry |
brualdi_ch4_9 | Show that the largest number of inversions of a permutation of ${1, 2, ... , n}$ equals $\frac{n(n -1)}{2}$. | null | null | brualdi | import Mathlib
def invNum {n : β} (Ο : Equiv.Perm (Fin n)) : β :=
β x β Equiv.Perm.finPairsLT n, if Ο x.fst β€ Ο x.snd then 1 else 0
theorem brualdi_ch4_9 (n : β) :
IsGreatest {k | β Ο : Equiv.Perm (Fin n), k = invNum Ο} (n * (n - 1) / 2) := by sorry |
brualdi_ch5_51 | Let $R$ and $S$ be two partial orders on the same set $X$. Considering $R$ and $S$ as subsets of $X \times X$, we assume that $R \subseteq S$ but $R \neq S$. Show that there exists an ordered pair $(p, q)$, where $(p, q) \in S$ and $(p, q) \notin R$ such that $R^{\prime}=R \cup\{(p, q)\}$ is also a partial order on $X$... | null | null | brualdi | import Mathlib
theorem brualdi_ch5_51 {X : Type} [DecidableEq X] (R S : Rel X X) [IsPartialOrder X R]
[IsPartialOrder X S] (le : R < S) :
β (p q : X), S p q β§ Β¬ R p q β§
IsPartialOrder X (R β fun x y β¦ if x = p β§ y = q then true else false) := by sorry |
brualdi_ch5_9 | Evaluate the sum $\sum_{k=0}^{n}(-1)^{k}\binom{n}{k} 10^{k}$. | [
"fun n => (-9 : β€)^n"
] | null | brualdi | import Mathlib
abbrev brualdi_ch5_9_solution : β β β€ := sorry
theorem brualdi_ch5_9 (n : β) : β k β Finset.range (n + 1), (-1 : β€) ^ k * (n.choose k) * 10 ^ k =
brualdi_ch5_9_solution n := by sorry |
brualdi_ch5_26 | Let $n$ and $k$ be integers with $1 \leq k \leq n$. Prove that $\sum_{k=1}^{n}\binom{n}{k}\binom{n}{k-1}=\frac{1}{2}\binom{2 n+1}{n+1}-\binom{2 n}{n}$. | null | null | brualdi | import Mathlib
theorem brualdi_ch5_26 (n k : β) (h1 : 1 β€ k) (h2 : k β€ n) :
β k β Finset.Icc 1 n, Nat.choose n k * Nat.choose n (k - 1) =
(1 / 2 : β) * Nat.choose (2 * n + 1) (n + 1) - Nat.choose (2 * n) n := by sorry |
brualdi_ch6_11 | Determine the number of permutations of $\{1,2, \ldots, 8\}$ in which no even integer is in its natural position. | [
"24024"
] | null | brualdi | import Mathlib
abbrev brualdi_ch6_11_solution : β := sorry
theorem brualdi_ch6_11
(sols : Finset (Equiv.Perm (Finset.Icc 1 8)))
(h_sols : β Ο, Ο β sols β (β i, Even i.1 β Ο i β i)) :
sols.card = brualdi_ch6_11_solution := by sorry |
brualdi_ch6_21 | Prove that $D_{n}$ is an even number if and only if $n$ is an odd number. | null | null | brualdi | import Mathlib
theorem brualdi_ch6_21 (n : β) : Even (numDerangements n) β Odd n := by sorry |
brualdi_ch6_9 | Determine the number of integral solutions of the equation $x_{1}+x_{2}+x_{3}+x_{4}=20$ that satisfy $1 \leq x_{1} \leq 6,0 \leq x_{2} \leq 7,4 \leq x_{3} \leq 8,2 \leq x_{4} \leq 6$. | [
"96"
] | null | brualdi | import Mathlib
open Finset
abbrev brualdi_ch6_9_solution : β := sorry
theorem brualdi_ch6_9 : {x : Fin 4 β β | β i, x i = 20 β§ x 0 β Icc 1 6 β§ x 1 β Icc 0 7 β§
x 2 β Icc 4 8 β§ x 3 β Icc 2 6}.ncard = brualdi_ch6_9_solution := by sorry |
brualdi_ch7_15 | Determine the generating function for the sequence of cubes \[ 0, 1, 8, \ldots, n^{3}, \ldots \] | [
"PowerSeries.X * (PowerSeries.X ^ 2 + 4 * PowerSeries.X + 1) * PowerSeries.inv (1 - PowerSeries.X) ^ 4"
] | null | brualdi | import Mathlib
abbrev brualdi_ch7_15_solution : PowerSeries β := sorry
theorem brualdi_ch7_15 : PowerSeries.mk (fun (n : β) => (n : β) ^ 3) = brualdi_ch7_15_solution := by
sorry |
brualdi_ch7_7 | Let $m$ and $n$ be positive integers whose greatest common divisor is $d$. Prove that the greatest common divisor of the Fibonacci numbers $f_{m}$ and $f_{n}$ is the Fibonacci number $f_{d}$. | null | null | brualdi | import Mathlib
theorem brualdi_ch7_7 (m n d : β+) (hmd : d = Nat.gcd m n) :
Nat.gcd (Nat.fib m) (Nat.fib n) = Nat.fib d := by sorry |
brualdi_ch7_27 | Determine the number of n-digit numbers with all digits odd, such that 1 and 3 each occur a nonzero, even number of times. | [
"fun n => (5 ^ n - 4 ^ (n + 1) + 6 * 3 ^ n - 4 * 2 ^ n + 1) / 4 "
] | null | brualdi | import Mathlib
abbrev S (n : β) : Finset β :=
{m < 10^n | (Nat.digits 10 m).length = n β§
(β i : Fin (Nat.digits 10 m).length, Odd ((Nat.digits 10 m).get i)) β§
Even ((Nat.digits 10 m).count 1) β§ Even ((Nat.digits 10 m).count 3) β§
((Nat.digits 10 m).count 1) β 0 β§ ((Nat.digits 10 m).count 3) β 0}
abbrev brualdi... |
brualdi_ch8_6 | Let the sequence $h_{0}, h_{1}, \ldots, h_{n}, \ldots$ be defined by $h_{n}=2 n^{2}-n+3,(n \geq 0)$. Find a formula for $\sum_{k=0}^{n} h_{k}$. | [
"fun n => ((n + 1) * (4 * n ^ 2 - n + 18) / 6)"
] | null | brualdi | import Mathlib
abbrev brualdi_ch8_6_solution : β β β := sorry
theorem brualdi_ch8_6 (n : β) (h : β β β) (h' : β i, h i = 2 * i ^ 2 - i + 3) :
β i β Finset.range (n + 1), h i = brualdi_ch8_6_solution n := by sorry |
brualdi_ch8_30 | Prove that the partition function satisfies $p_{n} > p_{n-1}$ when $2 β€ n$. | null | null | brualdi | import Mathlib
theorem brualdi_ch8_30 (n : β) (hn : 2 β€ n) :
Fintype.card (Nat.Partition (n - 1)) < Fintype.card (Nat.Partition n) := by sorry |
brualdi_ch8_9 | Prove that the following formula holds for the $k$ th-order differences of a sequence $h_{0}, h_{1}, \ldots, h_{n}, \ldots$ : \Delta^{k} h_{n}=\sum_{j=0}^{k}(-1)^{k-j}\binom{k}{j} h_{n+j} | null | null | brualdi | import Mathlib
theorem brualdi_ch8_9 (h : β β β€) (k n : β): (fwdDiff 1)^[k] h n = β j β Finset.range (k + 1),
(-1 : β€) ^ (k - j) * Nat.choose k j * h (n + j) := by sorry |
brualdi_ch9_13 | Let $A$ be a matrix with $n$ columns, with integer entries taken from the set $S=\{1,2, \ldots, k\}$. Assume that each integer $i$ in $S$ occurs exactly $n r_{i}$ times in $A$, where $r_{i}$ is an integer. Prove that it is possible to permute the entries in each row of $A$ to obtain a matrix $B$ in which each integer $... | null | null | brualdi | import Mathlib
theorem brualdi_ch9_13 (n m k : β) (r : β β β) (A : Matrix (Fin m) (Fin n) β)
(hn : n > 0) (hm : m > 0)(hk : k β₯ 1)
(hA : β i j, A i j β Finset.Icc 1 k)
(hr : β i β Finset.Icc 1 k, (β x : Fin m, β y : Fin n, if A x y = i then 1 else 0) = n * r i) :
β (rΟ : Fin m β Equiv.Perm (Fin n)),
... |
brualdi_ch9_8 | Let $\mathcal{A}=\left(A_{1}, A_{2}, A_{3}, A_{4}, A_{5}, A_{6}\right)$, where \[ \begin{aligned} & A_{1}=\{1,2\}, A_{2}=\{2,3\}, A_{3}=\{3,4\} \\ & A_{4}=\{4,5\}, A_{5}=\{5,6\}, A_{6}=\{6,1\} \end{aligned} \] Determine the number of different SDRs that $\mathcal{A}$ has. | [
"2"
] | null | brualdi | import Mathlib
variable {Ξ± : Type*}
structure SDR {n : β} (A : Fin n β Finset Ξ±) where
toFun : Fin n β Ξ±
mem_Ai : β i, toFun i β A i
pairwise : β i j, i β j β toFun i β toFun j
instance {n : β} (A : Fin n β Finset Ξ±) : CoeFun (SDR A) (fun _ => Fin n β Ξ±) where
coe s := s.toFun
noncomputable instance {n : β}... |
brualdi_ch9_11 | Let $n>1$, and let $\mathcal{A}=\left(A_{1}, A_{2}, \ldots, A_{n}\right)$ be the family of subsets of $\{1,2, \ldots, n\}$, where \[ A_{i}=\{1,2, \ldots, n\}-\{i\}, \quad(i=1,2, \ldots, n) \] Prove that $\mathcal{A}$ has an SDR and that the number of SDRs is the $n$th derangement number $D_{n}$. | null | null | brualdi | import Mathlib
variable {Ξ± : Type*}
structure SDR {n : β} (A : Fin n β Finset Ξ±) where
toFun : Fin n β Ξ±
mem_Ai : β i, toFun i β A i
pairwise : β i j, i β j β toFun i β toFun j
instance {n : β} (A : Fin n β Finset Ξ±) : CoeFun (SDR A) (fun _ => Fin n β Ξ±) where
coe s := s.toFun
noncomputable instance {n : β}... |
brualdi_ch10_31 | Prove that $B = {0,3,4,9,11}$ is a difference set in $Z_{21}$. | null | null | brualdi | import Mathlib
def isDifferenceSet (n : β) (B : Finset (ZMod n)) : Prop :=
β k, β x : (ZMod n), x β 0 β β i β B, β j β B \ {i}, List.count x [i - j] = k
theorem brualdi_ch10_31 : isDifferenceSet 21 {0, 3, 4, 9, 11} := by sorry |
brualdi_ch10_34 | Let $t$ be a positive integer. Prove that, if there exists a Steiner triple system of index 1 having $v$ varieties, then there exists a Steiner triple system having $v^{t}$ varieties. | null | null | brualdi | import Mathlib
structure SteinerTripleSystemOfIndOne (t k n : β) where
carrier : Fin n
blocks : Finset (Finset (Fin n))
card_blocks : β b β blocks, b.card = k
block_inner : β s : (Finset (Fin n)), s.card = t β β! b β blocks, s β b
structure SteinerTripleSystem (t k n I : β) where
carrier : Fin n
blocks : ... |
brualdi_ch10_60 | Prove that a symmetric, idempotent Latin square has odd order. | null | null | brualdi | import Mathlib
structure LatinSquare (n : β) where
carrier : Matrix (Fin n) (Fin n) (ZMod n)
pairwise_1 : β i j1 j2, j1 β j2 β carrier i j1 β carrier i j2
pairwise_2 : β j i1 i2, i1 β i2 β carrier i1 j β carrier i2 j
def IsIdempotent {n : β} (L : LatinSquare n) : Prop :=
β i, L.carrier i i = i
theorem bruald... |
brualdi_ch11_5 | Use the pigeonhole principle to prove that a graph of order n β₯ 2 always has two vertices of the same degree. | null | null | brualdi | import Mathlib
theorem brualdi_ch11_5 (n : β) (h_n: n β₯ 2) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] :
β v1 v2, v1 β v2 β§ G.degree v1 = G.degree v2 := by sorry |
brualdi_ch11_59 | Prove that the removal of an edge from a tree leaves a forest of two trees. | null | null | brualdi | import Mathlib
open SimpleGraph
theorem brualdi_ch11_59 {V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) (hT : IsTree T) (e : Sym2 V) (he : e β T.edgeSet) :
β (T1 T2 : SimpleGraph V), IsTree T1 β§ IsTree T2 β§
T1.edgeSet βͺ T2.edgeSet = T.edgeSet \ {e} β§
Disjoint (T1.support) (T2.support) := b... |
brualdi_ch11_20 | Prove that a graph of order n with at least `(n-1)(n-2)/2 + 1` edges must be connected. | null | null | brualdi | import Mathlib
theorem brualdi_ch11_20 {V : Type*} [Fintype V] (n : β) (hn : n β₯ 1) (hV : Fintype.card V = n)
(G : SimpleGraph V) (h : (n - 1) * (n - 2) / 2 + 1 β€ (SimpleGraph.edgeSet G).ncard) :
G.Connected := by sorry |
brualdi_ch12_37 | Determine the domination number of the graph $Q_{3}$ of vertices and edges of a three-dimensional cube. | [
"2"
] | null | brualdi | import Mathlib
open SimpleGraph BigOperators Classical
variable (n : β) {V : Type*} (G : SimpleGraph V)
def SimpleGraph.IsDominatingSet (D : Set V) : Prop :=
β v : V, Β¬ (v β D) β β u β D, G.Adj u v
lemma IsDominatingSet.univ : G.IsDominatingSet Set.univ := by simp [IsDominatingSet]
noncomputable def SimpleGraph... |
brualdi_ch12_62 | Let $G$ be a graph. Prove that $G$ is 2-connected if and only if, for each vertex $x$ and each edge $\alpha$, there is a cycle that contains both the vertex $x$ and the edge $\alpha$. | null | null | brualdi | import Mathlib
structure TwoConnected {V : Type*} (G : SimpleGraph V) : Prop where
selfconnected : G.Connected
remains_connected : β x : V, ((β€ : SimpleGraph.Subgraph G).deleteVerts {x}).coe.Connected
theorem brualdi_ch12_62 {V : Type*} (G : SimpleGraph V) : TwoConnected G β β x : V, β e β G.edgeSet,
β G' : S... |
brualdi_ch12_34 | Prove that the complement of a disconnected graph is connected. | null | null | brualdi | import Mathlib
theorem brualdi_ch12_34 {V : Type*} (G : SimpleGraph V) (h : Β¬ G.Connected) :
GαΆ.Connected := by sorry |
brualdi_ch13_6 | Prove that a digraph is strongly connected if and only if there is a closed, directed walk that contains each vertex at least once. | null | null | brualdi | import Mathlib
universe u
inductive Digraph.Walk {V : Type u} (G : Digraph V) : V β V β Type u
| nil {u : V} (h : G.Adj u u) : Digraph.Walk G u u
| cons {u v w : V} (h : G.Adj u v) (p : Digraph.Walk G v w) : Digraph.Walk G u w
deriving DecidableEq
structure Digraph.StronglyConnected {V : Type u} (G : Digraph V... |
brualdi_ch13_10 | Prove that every tournament contains a vertex $u$ such that, for every other vertex $x$, there is a path from $u$ to $x$ of length at most 2. | null | null | brualdi | import Mathlib
universe u
structure IsTournament {V : Type u} (G : Digraph V) : Prop where
irrefl : β (u : V), Β¬ G.Adj u u
adj : β (u v : V), u β v β (G.Adj u v β Β¬ G.Adj v u)
inductive Digraph.Walk {V : Type u} (G : Digraph V) : V β V β Type u
| nil {u : V} (h : G.Adj u u) : Digraph.Walk G u u
| cons {u v w... |
brualdi_ch13_9 | Prove that a tournament is strongly connected if and only if it has a directed Hamilton cycle. | null | null | brualdi | import Mathlib
universe u
structure IsTournament {V : Type u} (G : Digraph V) : Prop where
irrefl : β (u : V), Β¬ G.Adj u u
adj : β (u v : V), u β v β (G.Adj u v β Β¬ G.Adj v u)
inductive Digraph.Walk {V : Type u} (G : Digraph V) : V β V β Type u
| nil {u : V} (h : G.Adj u u) : Digraph.Walk G u u
| cons {u v w... |
brualdi_ch14_45 | Let $n$ be an odd prime number. Prove that each of the permutations, $\rho_{n}, \rho_{n}^{2}, \ldots, \rho_{n}^{n}$ of $\{1,2, \ldots, n\}$ is an $n$-cycle. (Recall that $\rho_{n}$ is the permutation that sends 1 to 2,2 to $3, \ldots, n-1$ to $n$, and $n$ to 1.) | null | null | brualdi | import Mathlib
theorem brualdi_ch14_45 {n : β} (h : Odd n) (hp : Nat.Prime n) :
β i β Finset.Icc 1 n, ((finRotate n) ^ i).IsCycle := by sorry |
brualdi_ch14_26 | How many different necklaces are there that contain four red and three blue beads? | [
"15"
] | null | brualdi | import Mathlib
structure PreNecklaces where
c : Fin 7 β Fin 2
color : β S : Finset (Fin 7), S.card = 4 β§ β i β S, c i = 0
deriving Fintype
def myDihedralGroup (n : β) : Subgroup (Equiv.Perm (Fin n)) :=
Subgroup.closure {finRotate n, Fin.revPerm}
instance Necklaces.setoid : Setoid PreNecklaces where
r n1 n2... |
brualdi_ch14_33 | Prove that a permutation and its inverse have the same type. | null | null | brualdi | import Mathlib
theorem brualdi_ch14_33 {Ξ± : Type*} [Fintype Ξ±] [DecidableEq Ξ±] (Ο : Equiv.Perm Ξ±) :
Ο.cycleType = Οβ»ΒΉ.cycleType := by sorry |
apmo_1991_p2 | Suppose there are 997 points given in a plane. If every two points are joined by a line segment with its midpoint coloured in red, show that there are at least 1991 red points in the plane. | null | null | math_competitions | import Mathlib
noncomputable def red_points {k} (points : Fin k β β Γ β) : Finset (β Γ β) :=
(((Finset.univ (Ξ± := Fin k Γ Fin k)) \ (Finset.univ).image (fun i => (i, i))).image
(fun x => midpoint β (points x.1) (points x.2)))
theorem apmo_1991_p2 (points : Fin 997 β β Γ β) (hpoints : Function.Injective points) ... |
apmo_2023_p1 | Let $n \geq 5$ be an integer. Consider $n$ squares with side lengths $1,2, \ldots, n$, respectively. The squares are arranged in the plane with their sides parallel to the $x$ and $y$ axes. Suppose that no two squares touch, except possibly at their vertices.\nShow that it is possible to arrange these squares in a way ... | null | null | math_competitions | import Mathlib
structure Square where
(pos : β Γ β)
(side_length : β)
noncomputable def Square.vertices (s: Square) : Finset (β Γ β) :=
let x := s.pos.1; let y := s.pos.2; let n : β := s.side_length;
{(x, y), (x + n, y), (x, y + n), (x + n, y + n)}
def Square.occupy (s : Square) : Set (β Γ β) :=
let x := s... |
balticway_2015_p7 | There are 100 members in a ladies' club. Each lady has had tea (in private) with exactly 56 of the other members of the club. The Board, consisting of the 50 most distinguished ladies, have all had tea with one another. Prove that the entire club may be split into two groups in such a way that, within each group, any l... | null | null | math_competitions | import Mathlib
open SimpleGraph Finset
abbrev Ladies := Fin 100
theorem balticway_2015_p7 (had_tea: SimpleGraph (Ladies)) [DecidableRel had_tea.Adj]
(h_had_tea_with_56: β l : Ladies, had_tea.degree l = 56)
(h_board: β board : Finset Ladies, board.card = 50 β§ had_tea.IsClique board) :
β group1 group2: Fin... |
egmo_2022_p5 | For all positive integers $n, k$, let $f(n, 2k)$ be the number of ways an $n \times 2k$ board can be fully covered by $nk$ dominoes of size $2 \times 1$. (For example, $f(2,2)=2$ and $f(3,2)=3$.)\nFind all positive integers $n$ such that for every positive integer $k$, the number $f(n, 2k)$ is odd. | [
"{x | β m > 0, 2 ^ m - 1 = x}"
] | null | math_competitions | import Mathlib
structure Domino (n k : β) where
carrier : Finset (Fin n Γ Fin (2 * k))
card : carrier.card = 2
position : β i β carrier, β j β carrier, i β j β
(i.1.val = j.1.val β§ (i.2.val + 1 = j.2.val β¨ j.2.val + 1 = i.2.val)) β¨
(i.2.val = j.2.val β§ (i.1.val + 1 = j.1.val β¨ j.1.val + 1 =... |
imosl_2011_c6 | Let $n$ be a positive integer and let $W=\ldots x_{-1} x_{0} x_{1} x_{2} \ldots$ be an infinite periodic word consisting of the letters $a$ and $b$. Suppose that the minimal period $N$ of $W$ is greater than $2^{n}$. A finite nonempty word $U$ is said to appear in $W$ if there exist indices $k \leq \ell$ such that $U=x... | null | null | math_competitions | import Mathlib
def appears (W : β€ β Fin 2) (U : Ξ£ n, Fin n β Fin 2) : Prop :=
β k, β i : Fin U.1, U.2 i = W (k + i)
def ubiquitous (W : β€ β Fin 2) (U : Ξ£ n, Fin n β Fin 2) : Prop :=
appears W β¨U.1 + 1, Fin.snoc U.2 0β© β§
appears W β¨U.1 + 1, Fin.snoc U.2 1β© β§
appears W β¨U.1 + 1, Fin.cons 0 U.2β© β§
appears W... |
imosl_2015_c6 | Let $S$ be a nonempty set of positive integers. We say that a positive integer $n$ is clean if it has a unique representation as a sum of an odd number of distinct elements from $S$. Prove that there exist infinitely many positive integers that are not clean. | null | null | math_competitions | import Mathlib
def clean (S : Set β+) (n : β) : Prop :=
β! (S' : Finset β+),
((S' : Set _) β S) β§ (Odd S'.card) β§ (β s β S', (s : β) = n)
theorem imosl_2015_c6 (S : Set β+) (hS : S.Nonempty): β (N : β), β (m : β), N < m β§ Β¬ clean S m := by sorry |
imosl_2019_c2 | You are given a set of $n$ blocks, each weighing at least 1; their total weight is $2 n$. Prove that for every real number $r$ with $0 \leqslant r \leqslant 2 n-2$ you can choose a subset of the blocks whose total weight is at least $r$ but at most $r+2$. | null | null | math_competitions | import Mathlib
theorem imosl_2019_c2 (n : β) (blocks : Fin n β β) (h1 : β i, blocks i β₯ 1)
(h2 : β i, blocks i = 2 * n) :
β r : β, 0 β€ r β§ r β€ 2 * n - 2 β
β (s : Finset (Fin n)), (β i β s, blocks i) β₯ r β§ (β i β s, blocks i) β€ r + 2 := by sorry |
imosl_2021_c5 | Let $n$ and $k$ be two integers with $n > k \geqslant 1$. There are $2n+1$ students standing in a circle. Each student $S$ has $2k$ neighbours - namely, the $k$ students closest to $S$ on the right, and the $k$ students closest to $S$ on the left. Suppose that $n+1$ of the students are girls, and the other $n$ are boys... | null | null | math_competitions | import Mathlib
def leftNeighbors {n : β+} (people : Fin (2*n+1) β ZMod 2) (k : β+) (i : Fin (2*n+1)) : Fin k β ZMod 2 :=
fun j β¦ people <| (finRotate (2*n+1))^[j.1 + 1] i
def rightNeighbors {n : β+} (people : Fin (2*n+1) β ZMod 2) (k : β+) (i : Fin (2*n+1)) : Fin k β ZMod 2 :=
fun j β¦ people <| (finRotate (2*n+1)... |
izho_2014_p3 | There are given 100 distinct positive integers. We call a pair of integers among them good if the ratio of its elements is either 2 or 3. What is the maximum number $g$ of good pairs that these 100 numbers can form? (A same number can be used in several pairs.) | [
"180"
] | null | math_competitions | import Mathlib
structure goodPairs (s : Fin 100 βͺ β+) where
(i j : Fin 100)
(ratio : s i = 2 * s j β¨ s i = 3 * s j)
deriving Fintype
abbrev izho_2014_p3_solution : β := sorry
theorem izho_2014_p3 :
IsGreatest (Set.range fun x => Fintype.card (goodPairs x)) izho_2014_p3_solution := by sorry |
izho_2019_p1 | Prove that there are at least 100! ways to partition the number 100! into summands from the set $\{1!, 2!, 3!, \ldots, 99!\}$. (Partitions differing in the order of summands are considered the same; any summand can be taken multiple times. We remind that $n!=1 \cdot 2 \cdot \ldots \cdot n$.) | null | null | math_competitions | import Mathlib
open Nat
theorem izho_2019_p1 : ((@Finset.univ 100!.Partition).filter
(fun p => β i β p.parts, β k β Finset.Icc 1 99, i = Nat.factorial k)).card β₯ 100! := by sorry |
bxmo_2017_p2 | Let $n \geqslant 2$ be an integer. Alice and Bob play a game concerning a country made of $n$ islands. Exactly two of those $n$ islands have a factory. Initially there is no bridge in the country. Alice and Bob take turns in the following way. In each turn, the player must build a bridge between two different islands $... | [
"fun x => if x % 4 = 3 then 0 else 1"
] | null | math_competitions | import Mathlib
variable (m : β)
local notation3 (prettyPrint := false) "n" => (m + 2)
local notation3 (prettyPrint := false) "F1" => (0 : Fin n)
local notation3 (prettyPrint := false) "F2" => (1 : Fin n)
structure GameState where
islands: SimpleGraph (Fin n)
decidable: DecidableRel islands.Adj
instance (s : Gam... |
usamo_2000_p4 | Find the smallest positive integer $n$ such that if $n$ squares of a $1000 \times 1000$ chessboard are colored, then there will exist three colored squares whose centers form a right triangle with sides parallel to the edges of the board. | [
"1999"
] | null | math_competitions | import Mathlib
def valid_n : Set β := { n : β |
β s : Finset (Fin 1000 Γ Fin 1000),
s.card = n β
β a β s, β b β s, β c β s,
a β b β§ b β c β§ a β c β§
a.1 = b.1 β§ a.2 = c.2}
abbrev usamo_2000_p4_solution : β+ := sorry
theorem usamo_2000_p4 : IsLeast valid_n usamo_2000_p4_solution.1 := by sor... |
imo_2009_p6 | Let $a_1,a_2,\ldots,a_n$ be distinct positive integers and let $M$ be a set of $n-1$ positive integers not containing $s=a_1+a_2+\ldots+a_n$. A grasshopper is to jump along the real axis, starting at the point $0$ and making $n$ jumps to the right with lengths $a_1,a_2,\ldots,a_n$ in some order. Prove that the order ca... | null | null | imo | import Mathlib
open BigOperators Finset
theorem imo_2009_p6 (n : β) (hn : n β₯ 1) (a : Fin n β β) (ha : Function.Injective a) (M : Finset β)
(ha' : β i, a i > 0) (hM : M.card = n - 1) (hM' : β m β M, m > 0) (haM : β n, (a n) β M) :
β (Ο : Equiv.Perm (Fin n)), β k, (β i β€ k, (a β Ο) i) β M := by sorry |
imo_2020_p3 | There are $4n$ pebbles of weights $1, 2, 3, \ldots, 4n$. Each pebble is colored in one of $n$ colors and there are four pebbles of each color. Show that we can arrange the pebbles into two piles so that the following two conditions are both satisfied: 1) The total weights of both piles are the same. 2) Each pile contai... | null | null | imo | import Mathlib
structure Pebble (n : β) where
weight : β
color : Fin n
deriving DecidableEq
theorem imo_2020_p3 (n : β) (PebbleSet : Finset (Pebble n)) (hP : PebbleSet.card = 4 * n)
(h_weight : β p β PebbleSet, p.weight β Finset.Icc 1 (4 * n))
(h_ne_weight : β p β PebbleSet, β q β PebbleSet, p β q β p.wei... |
imo_2022_p6 | Let $n$ be a positive integer. A Nordic square is an $n \times n$ board containing all the integers from $1$ to $n^2$ so that each cell contains exactly one number. Two different cells are considered adjacent if they share an edge. Every cell that is adjacent only to cells containing larger numbers is called a valley. ... | [
"fun n => 2 * n ^ 2 - 2 * n + 1"
] | null | imo | import Mathlib
open Function
set_option autoImplicit false
variable {n : β}
def Adjacent (x y : Fin n Γ Fin n) : Prop := x β y β¨ y β x
abbrev NordicSquare (n : β) := Fin n Γ Fin n β Fin (n ^ 2)
namespace NordicSquare
variable {sq : NordicSquare n}
def IsValley (sq : NordicSquare n) (x : Fin n Γ Fin n) : Prop :=
... |
imo_2024_p3 | Let $a_1, a_2, a_3, \dots$ be an infinite sequence of positive integers, and let $N$ be a positive integer. Suppose that, for each $n > N$, $a_n$ is equal to the number of times $a_{n-1}$ appears in the list $a_1, a_2, \dots, a_{n-1}$. Prove that at least one of the sequence $a_1, a_3, a_5, \dots$ and $a_2, a_4, a_6, \... | null | null | imo | import Mathlib
open scoped Finset
def Condition (a : β β β) (N : β) : Prop :=
(β i, 0 < a i) β§ β n, N < n β a n = #{i β Finset.range n | a i = a (n - 1)}
def EventuallyPeriodic (b : β β β) : Prop := β p M, 0 < p β§ β m, M β€ m β b (m + p) = b m
theorem imo_2024_p3 {a : β β β} {N : β} (h : Condition a N) :
Event... |
imo_2000_p4 | A magician has one hundred cards numbered $1$ to $100$. He puts them into three boxes, a red one, a white one and a blue one, so that each box contains at least one card. A member of the audience selects two of the three boxes, chooses one card from each and announces the sum of the numbers on the chosen cards. Given t... | [
"12"
] | null | imo | import Mathlib
abbrev Cards := Finset.Icc 1 100
abbrev Boxes := Fin 3
abbrev Trick := β β Boxes
def trick_works (f : Cards β Boxes) (t : Trick) : Prop :=
β cβ cβ : Cards,
(f cβ = 0 β f cβ = 1 β t (cβ.1 + cβ.1) = 2) β§
(f cβ = 0 β f cβ = 2 β t (cβ.1 + cβ.1) = 1) β§
(f cβ = 1 β f cβ = 2 β t (cβ.1 + cβ.... |
imo_2001_p3 | Twenty-one girls and twenty-one boys took part in a mathematical competition. It turned out that each contestant solved at most six problems, and for each pair of a girl and a boy, there was at least one problem that was solved by both the girl and the boy. Show that there is a problem that was solved by at least three... | null | null | imo | import Mathlib
def solved_by_at_least_three {n : β} (problem : β) (solved_problems: Fin n β Finset β) : Prop :=
β a b c, a β b β§ b β c β§ a β c β§ problem β solved_problems a β© solved_problems b β© solved_problems c
theorem imo_2001_p3 (solved_problems_girls: Fin 21 β Finset β)
(solved_problems_boys: Fin 21 β Fins... |
imo_2001_p4 | Let $n_1, n_2, \dots , n_m$ be integers where $m>1$ is odd. Let $x = (x_1, \dots , x_m)$ denote a permutation of the integers $1, 2, \cdots , m$. Let $f(x) = x_1n_1 + x_2n_2 + ... + x_mn_m$. Show that for some distinct permutations $a$, $b$ the difference $f(a) - f(b)$ is a multiple of $m!$. | null | null | imo | import Mathlib
open Nat
def f {m : β} (n : Finset.Icc 1 m β β€) (x : Equiv.Perm (Finset.Icc 1 m)) : β€ := β i, x i * n i
theorem imo_2001_p4 (m : β) (h_m_pos: m > 1) (h_m_odd: Odd m) (n : Finset.Icc 1 m β β€):
β a b : Equiv.Perm (Finset.Icc 1 m), a β b β§ β(m !) β£ (f n a - f n b) := by sorry |
imo_2002_p1 | $S$ is the set of all $(h,k)$ with $h,k$ non-negative integers such that $h + k < n$. Each element of $S$ is colored red or blue, so that if $(h,k)$ is red and $h' \le h,k' \le k$, then $(h',k')$ is also red. A type $1$ subset of $S$ has $n$ blue elements with different first member and a type $2$ subset of $S$ has $n$... | null | null | imo | import Mathlib
open Finset
def S (n : β) : Finset (Fin n Γ Fin n) :=
{ (h, k) | h + k < n }
structure Coloring (n : β) where
is_red: S n β Bool
coloring_condition: β hk hk' : S n,
match hk.val, hk'.val with
| (h, k), (h', k') => is_red hk β§ h' β€ h β§ k' β€ k β is_red hk'
def is_type_1 {n : β} (c : Color... |
imo_2003_p1 | $S$ is the set $\{1, 2, 3, \dots ,1000000\}$. Show that for any subset $A$ of $S$ with $101$ elements we can find $100$ distinct elements $x_i$ of $S$, such that the sets $\{a + x_i \mid a \in A\}$ are all pairwise disjoint. | null | null | imo | import Mathlib
def S := Finset.Icc 1 1000000
theorem imo_2003_p1 (A : Finset S) (hA: A.card = 101):
β x : Function.Embedding (Fin 100) S,
β i j, i β j β Disjoint { a.1 + (x i).1 | a β A } { a.1 + (x j).1 | a β A } := by sorry |
imo_2005_p6 | In a mathematical competition, in which 6 problems were posed to the participants, every two of these problems were solved by more than 2/5 of the contestants. Moreover, no contestant solved all the 6 problems. Show that there are at least 2 contestants who solved exactly 5 problems each. | null | null | imo | import Mathlib
theorem imo_2005_p6 {participants : Type} [Fintype participants] [DecidableEq participants]
(solved : Fin 6 β Finset participants)
(h : β i j, i β j β (solved i β© solved j).card > (2 * Fintype.card participants : β) / 5)
(h' : β i : participants, β p : Fin 6, i β solved p) :
β s : Finset... |
imo_2006_p2 | Let $P$ be a regular 2006-gon. A diagonal of $P$ is called good if its endpoints divide the boundary of $P$ into two parts, each composed of an odd number of sides of $P$. The sides of $P$ are also called good. Suppose $P$ has been dissected into triangles by 2003 diagonals, no two of which have a common point in the i... | [
"1003"
] | null | imo | import Mathlib
open scoped Classical Finset
instance {N : β} : CircularOrder (Fin N) := LinearOrder.toCircularOrder _
variable {Ξ± : Type*} [CircularOrder Ξ±] {a b c d : Ξ±}
def SBtwβ (a b c d : Ξ±) : Prop := sbtw a b c β§ sbtw c d a
lemma sbtwβ_swap : SBtwβ a b c d β SBtwβ c d a b := and_comm
variable {N : β}
abbrev... |
imo_2007_p3 | In a mathematical competition some competitors are friends. Friendship is always mutual. Call a group of competitors a clique if each two of them are friends. (In particular, any group of fewer than two competitors is a clique.) The number of members of a clique is called its size. Given that, in this competition, the ... | null | null | imo | import Mathlib
theorem imo_2007_p3 {player : Type} [Fintype player] (math_competiton : SimpleGraph player)
(h : Even math_competiton.cliqueNum) :
β a : SimpleGraph.Subgraph math_competiton, a.coe.cliqueNum = aαΆ.coe.cliqueNum := by sorry |
imo_2008_p5 | Let $n$ and $k$ be positive integers with $k \geq n$ and $k - n$ an even number. Let $2n$ lamps labelled $1$, $2$, ..., $2n$ be given, each of which can be either on or off. Initially all the lamps are off. We consider sequences of steps: at each step one of the lamps is switched (from on to off or from off to on). Let... | [
"fun n k => 2 ^ (k.1 - n.1)"
] | null | imo | import Mathlib
def switch_lamp (n : β+) (switch_label : Fin (2 * n)) (lamps_state : List Bool) : List Bool :=
List.mapIdx (fun j (x : Bool) => if j = switch_label then Β¬x else x) lamps_state
def lamps_final_state (n : β+) (switch_list : List (Fin (2 * n))) : List Bool :=
match switch_list with
| [] => (List.ofF... |
imo_2010_p5 | Each of the six boxes $B_1$, $B_2$, $B_3$, $B_4$, $B_5$, $B_6$ initially contains one coin. The following operations are allowed: Type 1) Choose a non-empty box $B_j$, $1\leq j \leq 5$, remove one coin from $B_j$ and add two coins to $B_{j+1}$; Type 2) Choose a non-empty box $B_k$, $1\leq k \leq 4$, remove one coin fro... | [
"true"
] | null | imo | import Mathlib
structure Boxes where
(B1 B2 B3 B4 B5 B6 : β)
def op11 : Boxes β Boxes
| β¨b1, b2, b3, b4, b5, b6β© => β¨b1 - 1, b2 + 2, b3, b4, b5, b6β©
def op12 : Boxes β Boxes
| β¨b1, b2, b3, b4, b5, b6β© => β¨b1, b2 - 1, b3 + 2, b4, b5, b6β©
def op13 : Boxes β Boxes
| β¨b1, b2, b3, b4, b5, b6β© => β¨b1, b2, b3 - 1,... |
imo_2011_p2 | Let $\mathcal{S}$ be a finite set of at least two points in the plane. Assume that no three points of $\mathcal S$ are collinear. A windmill is a process that starts with a line $\ell$ going through a single point $P \in \mathcal S$. The line rotates clockwise about the pivot $P$ until the first time that the line meet... | null | null | imo | import Mathlib
open EuclideanGeometry Real Filter
namespace List
variable {Ξ± Ξ² : Type*}
@[mk_iff]
inductive Triplewise (p : Ξ± β Ξ± β Ξ± β Prop) : List Ξ± β Prop
| nil : [].Triplewise p
| cons {a : Ξ±} {l : List Ξ±} : l.Pairwise (p a) β l.Triplewise p β (a :: l).Triplewise p
end List
instance : Fact (Module.finrank... |
imo_2011_p4 | Let $n > 0$ be an integer. We are given a balance and $n$ weights of weight $2^0,2^1, \cdots ,2^{n-1}$. We are to place each of the $n$ weights on the balance, one after another, in such a way that the right pan is never heavier than the left pan. At each step we choose one of the weights that has not yet been placed o... | [
"fun n => Nat.doubleFactorial (2 * n - 1)"
] | null | imo | import Mathlib
def weight_of_left_pan {n : β} (Ο : Equiv.Perm (Fin n)) (place_left : Fin n β Bool) (step : β) : β :=
β j with place_left j = true β§ Ο j β€ step, 2 ^ j.1
def weight_of_right_pan {n : β} (Ο : Equiv.Perm (Fin n)) (place_left : Fin n β Bool) (step : β) : β :=
β j with place_left j = false β§ Ο j β€ step,... |
imo_2012_p3 | The liarβs guessing game is a game played between two players A and B. The rules of the game depend on two positive integers $k$ and $n$ which are known to both players. At the start of the game the player A chooses integers $x$ and $N$ with $1 \le x \le N$. Player A keeps $x$ secret, and truthfully tells $N$ to the pl... | null | null | imo | import Mathlib
open scoped Finset
set_option autoImplicit false
structure AliceStrategy where
N : β
x : Fin N
nextAnswer : List (Set (Fin N) Γ Bool) β Set (Fin N) β Bool
structure BobStrategy where
nextQuestion N : List (Set (Fin N) Γ Bool) β Set (Fin N)
guess N : List (Set (Fin N) Γ Bool) ... |
imo_2013_p2 | A configuration of $4027$ points in the plane is called Colombian if it consists of $2013$ red points and $2014$ blue points, and no three of the points of the configuration are collinear. By drawing some lines, the plane is divided into several regions. An arrangement of lines is good for a Colombian configuration if ... | [
"2013"
] | null | imo | import Mathlib
structure Colombian_config : Type where
(R B : Finset (β Γ β))
(hR : R.card = 2013)
(hB : B.card = 2014)
(hC : R β© B = β
)
(h_no_collinear : β p β R βͺ B, β q β R βͺ B, β r β R βͺ B, p β q β p β r β q β r β
Β¬ β t : β, t β 0 β§ t * (q.1 - p.1) = (r.1 - p.1) β§ t * (q.2 - p.2) = (r.2 - p.2))
def ... |
imo_2013_p6 | Let $n \ge 3$ be an integer, and consider a circle with $n + 1$ equally spaced points marked on it. Consider all labellings of these points with the numbers $0, 1, ... , n$ such that each label is used exactly once; two such labellings are considered to be the same if one can be obtained from the other by a rotation of... | null | null | imo | import Mathlib
open Equiv Fintype Finset
def IsBeautiful {n} (e : Perm (Fin (n + 1))) : Prop :=
β β¦a bβ¦, a < b β β β¦cβ¦, b < c β β β¦dβ¦, c < d β a.val + d.val = b.val + c.val β
e a < e b β§ e b < e d β§ e a < e c β§ e c < e d β¨
e d < e b β§ e b < e a β§ e d < e c β§ e c < e a β¨
e b < e a β§ e a < ... |
imo_2014_p2 | Let $n\ge2$ be an integer. Consider an $n\times n$ chessboard consisting of $n^2$ unit squares. A configuration of $n$ rooks on this board is $\textit{peaceful}$ if every row and every column contains exactly one rook. Find the greatest positive integer $k$ such that, for each peaceful configuration of $n$ rooks, there... | [
"fun n => ββnββ - 1"
] | null | imo | import Mathlib
structure peaceful_rooks (n : β) : Type where
carrier : Matrix (Fin n) (Fin n) Bool
is_peaceful_row : β i, List.count true (List.ofFn (fun j => carrier i j)) = 1
is_peaceful_col : β j, List.count true (List.ofFn (fun i => carrier i j)) = 1
deriving Fintype
noncomputable abbrev imo_2014_p2_soluti... |
imo_2014_p6 | A set of lines in the plane is in $\textit{general position}$ if no two are parallel and no three pass through the same point. A set of lines in general position cuts the plane into regions, some of which have finite area; we call these its $\textit{finite regions}$. Prove that for all sufficiently large $n$, in any se... | null | null | imo | import Mathlib
def General_position (L : Finset (β Γ β Γ β)) : Prop :=
(β l β L, l.1 β 0 β¨ l.2.1 β 0) β§
(β l1 β L, β l2 β L, l1 β l2 β l1.1 * l2.2.1 β l1.2.1 * l2.1) β§
(β l1 β L, β l2 β L, β l3 β L, l1 β l2 β l1 β l3 β l2 β l3 β
(Β¬ β (p : β Γ β), l1.1 * p.1 + l1.2.1 * p.2 + l1.2.2 = 0 β§
l2.1 * p.1 + l2... |
imo_2015_p1 | We say that a finite set $\mathcal{S}$ in the plane is balanced if, for any two different points $A$, $B$ in $\mathcal{S}$, there is a point $C$ in $\mathcal{S}$ such that $AC=BC$. We say that $\mathcal{S}$ is centre-free if for any three points $A$, $B$, $C$ in $\mathcal{S}$, there is no point $P$ in $\mathcal{S}$ suc... | [
"{n | n β₯ 3 β§ Odd n}"
] | null | imo | import Mathlib
def balanced (S : Set (EuclideanSpace β (Fin 2))) : Prop :=
β A β S, β B β S, A β B β (β C β S, dist A C = dist B C)
def centre_free (S : Set (EuclideanSpace β (Fin 2))) : Prop :=
β A β S, β B β S, β C β S, A β B β B β C β A β C β
Β¬ (β P β S, dist A P = dist B P β§ dist B P = dist C P)
abbrev i... |
imo_2015_p6 | The sequence $a_1,a_2,\dots$ of integers satisfies the conditions: (i) $1\le a_j\le2015$ for all $j\ge1$, (ii) $k+a_k\neq \ell+a_\ell$ for all $1\le k<\ell$. Prove that there exist two positive integers $b$ and $N$ for which\[\left\vert\sum_{j=m+1}^n(a_j-b)\right\vert\le1007^2\]for all integers $m$ and $n$ such that $n... | null | null | imo | import Mathlib
theorem imo_2015_p6 (a : β+ β β€) (ha1 : β j : β+, 1 β€ a j β§ a j β€ 2015)
(ha2 : β k l, k < l β k + a k β l + a l) :
β b N : β+, β m n, n > m β§ m β₯ N β |(β j β Finset.Icc (m + 1) n, (a j - b))| β€ 1007^2 := by sorry |
imo_2016_p2 | Find all integers $n$ for which each cell of $n \times n$ table can be filled with one of the letters $I,M$ and $O$ in such a way that: in each row and each column, one third of the entries are $I$, one third are $M$ and one third are $O$; and in any diagonal, if the number of entries on the diagonal is a multiple of t... | [
"{n | 9 β£ n}"
] | null | imo | import Mathlib
open Finset
inductive Letters
| I | M | O
deriving BEq, DecidableEq
def diagonal_I_set (n k : β) : Finset (Fin n Γ Fin n) :=
(@Finset.univ (Fin n Γ Fin n) _ |>.filter (fun (i, j) => i.1 + j.1 = k))
def diagonal_I (n k : β) (A : Matrix (Fin n) (Fin n) Letters) : Prop :=
3 β£ #(diagonal_I_set n k)... |
imo_2016_p6 | There are $n\ge 2$ line segments in the plane such that every two segments cross and no three segments meet at a point. Geoff has to choose an endpoint of each segment and place a frog on it facing the other endpoint. Then he will clap his hands $n-1$ times. Every time he claps, each frog will immediately jump forward ... | null | null | imo | import Mathlib
open Function
structure FrogSystem (N : β) where
otherSegment (s : Fin N) : Fin (N - 1) β {s' : Fin N // s β s'}
point : {p : Sym2 (Fin N) // Β¬ p.IsDiag} β EuclideanSpace β (Fin 2)
mem_collinear {s tβ tβ tβ} : tβ < tβ β tβ < tβ β Sbtw β
(point β¨s(s, otherSegment s tβ), by simpa usi... |
imo_2017_p3 | A hunter and an invisible rabbit play a game in the Euclidean plane. The rabbit's starting point, $A_0$, and the hunter's starting point, $B_0$, are the same. After $n-1$ rounds of the game, the rabbit is at point $A_{n-1}$ and the hunter is at point $B_{n-1}$. In the nth round of the game, three things occur in order.... | [
"false"
] | null | imo | import Mathlib
abbrev imo_2017_p3_solution : Bool := sorry
theorem imo_2017_p3 (start : EuclideanSpace β (Fin 2)) : imo_2017_p3_solution =
β (A : β β EuclideanSpace β (Fin 2)),
A 0 = (fun x => if x = 0 then start 1 else start 2) β
β n, dist (A n) (A (n + 1)) = 1 β
(β (P : β β EuclideanSpace β (F... |
imo_2017_p5 | An integer $N \ge 2$ is given. A collection of $N(N + 1)$ soccer players, no two of whom are of the same height, stand in a row. Sir Alex wants to remove $N(N - 1)$ players from this row leaving a new row of $2N$ players in which the following $N$ conditions hold: ($1$) no one stands between the two tallest players, ($... | null | null | imo | import Mathlib
open Equiv Finset
theorem imo_2017_p5 (N : β) (h_N : N β₯ 2) (height : Perm (Fin (N * (N + 1)))) :
β kept : Fin (2 * N) βͺo Fin (N * (N + 1)),
β i j, Even #{l | height (kept l) < height (kept i)} β
#{l | height (kept l) < height (kept i)} + 1 = #{l | height (kept l) < height (ke... |
imo_2018_p3 | An anti-Pascal triangle is an equilateral triangular array of numbers such that, except for the numbers in the bottom row, each number is the absolute value of the difference of the two numbers immediately below it. For example, the following is an anti-Pascal triangle with four rows which contains every integer from $... | [
"false"
] | null | imo | import Mathlib
structure PascalIndex (n : β) where
(i : β) (j : β)
(i_le_n : i β€ n)
(j_le_i : j < i)
def IsAntiPascal (n : β) (values : PascalIndex n β β€) : Prop :=
β index : PascalIndex n,
if h : index.i < n then
values index =
abs (
values { i := index.i + 1, j := index.j, i_le_n... |
imo_2018_p4 | A site is any point $(x, y)$ in the plane such that $x$ and $y$ are both positive integers less than or equal to 20. Initially, each of the 400 sites is unoccupied. Amy and Ben take turns placing stones with Amy going first. On her turn, Amy places a new red stone on an unoccupied site such that the distance between an... | [
"100"
] | null | imo | import Mathlib
abbrev Site := Fin 20 Γ Fin 20
def Site.asPoint (s : Site) : EuclideanSpace β (Fin 2) :=
fun x => if x = 0 then (s.1.val + 1) else (s.2.val + 1)
inductive State
| red
| blue
| unoccupied
abbrev Game := Site β State
def initialGame : Game := fun _ => State.unoccupied
def valid_Amy_move (x : ... |
imo_2019_p3 | A social network has $2019$ users, some pairs of whom are friends. Whenever user $A$ is friends with user $B$, user $B$ is also friends with user $A$. Events of the following kind may happen repeatedly, one at a time: Three users $A$, $B$, and $C$ such that $A$ is friends with both $B$ and $C$, but $B$ and $C$ are not ... | null | null | imo | import Mathlib
noncomputable instance (users : SimpleGraph (Fin 2019)) (a : Fin 2019) : Fintype (users.neighborSet a) :=
Fintype.ofFinite β(users.neighborSet a)
def IsTriple (l : List (Fin 2019)) (G : SimpleGraph (Fin 2019)) : Prop :=
l.length = 3 β§ G.Adj l[0]! l[1]! β§ G.Adj l[0]! l[2]! β§ Β¬ G.Adj l[1]! l[2]! β§ l[... |
imo_2019_p5 | The Bank of Bath issues coins with an $H$ on one side and a $T$ on the other. Harry has $n$ of these coins arranged in a line from left to right. He repeatedly performs the following operation: If there are exactly $k > 0$ coins showing $H$, then he turns over the $k^{th}$ coin from the left; otherwise, all coins show ... | [
"fun n => n * (n + 1) / 4"
] | null | imo | import Mathlib
abbrev Coin := Fin 2
abbrev Coin.H : Coin := 0
abbrev Coin.T : Coin := 1
abbrev CoinConfig (n : β) := Fin n β Coin
def CoinConfig.countH {n : β} (c : CoinConfig n) : β := (List.ofFn c).count .H
def CoinConfig.flip {n : β} (c : CoinConfig n) (k : β) : CoinConfig n :=
fun i => if i.val + 1 = k then... |
imo_2020_p4 | There is an integer $n > 1$. There are $n^2$ stations on a slope of a mountain, all at different altitudes. Each of two cable car companies, $A$ and $B$, operates $k$ cable cars; each cable car provides a transfer from one of the stations to a higher one (with no intermediate stops). The $k$ cable cars of $A$ have $k$ ... | [
"fun n => n ^ 2 - n + 1"
] | null | imo | import Mathlib
def Iscompanies (n k : β) (car_set : Finset (Fin n Γ Fin n)) : Prop :=
car_set.card = k β§
(β (a b : Fin n), (a, b) β car_set β a < b)β§
(β a β car_set, β b β car_set, a β b β a.1 β b.1 β§ a.2 β b.2)
def Islinked {n : β} (a b : Fin n) (car_set : Finset (Fin n Γ Fin n)) : Prop :=
β s : List (Fin n ... |
imo_2021_p5 | Two squirrels, Bushy and Jumpy, have collected 2021 walnuts for the winter. Jumpy numbers the walnuts from 1 through 2021, and digs 2021 little holes in a circular pattern in the ground around their favourite tree. The next morning Jumpy notices that Bushy had placed one walnut into each hole, but had paid no attention... | null | null | imo | import Mathlib
def move (k : Fin 2021) (order : Fin 2021 β Fin 2021) : Fin 2021 β Fin 2021 :=
order.trans (Equiv.swap (order (finRotate _ (order.symm k))) (order ((finRotate _).symm (order.symm k))))
def performMoves (originalOrder : Fin 2021 β Fin 2021) : (Fin 2021) β (Fin 2021 β Fin 2021)
| 0 => originalOrde... |
imo_2022_p1 | The Bank of Oslo issues two types of coin: aluminium (denoted A) and bronze (denoted B). Marianne has $n$ aluminium coins and $n$ bronze coins, arranged in a row in some arbitrary initial order. A chain is any subsequence of consecutive coins of the same type. Given a fixed positive integer $k\le 2n$, Marianne repeated... | [
"fun n => {p | p.1 = n β§ n β€ p.2 β§ p.2 β€ β(3 * n : β) / 2ββ}"
] | null | imo | import Mathlib
abbrev sortedList (n : β) := (List.range (2 * n))|>.map
(fun i β¦ if i < n then 0 else 1)
def checkList (k : β) : List β β β Γ β := fun L β¦ Id.run do
let mut i0 := k - 1
let mut i1 := k - 1
for i in [k : L.length] do
if L[i]! = L[k-1]! then
i1 := i1 + 1
else break
for j in [1 : k... |
imo_2023_p5 | Let $n$ be a positive integer. A Japanese triangle consists of $1 + 2 + \dots + n$ circles arranged in an equilateral triangular shape such that for each $i = 1$, $2$, $\dots$, $n$, the $i^{th}$ row contains exactly $i$ circles, exactly one of which is coloured red. A ninja path in a Japanese triangle is a sequence of ... | [
"fun n => βReal.logb 2 nββ + 1"
] | null | imo | import Mathlib
structure Index (n : β+) where
row : β
col : β
le_row : 1 β€ row
row_le : row β€ n
le_col : 1 β€ col
col_le : col β€ row
def Index.atBottomLeft {n : β+} (p q : Index n) : Prop :=
q.row + 1 = p.row β§ q.col = p.col
def Index.atBottomRight {n : β+} (p q : Index n) : Prop :=
q.row + 1 = ... |
imo_2024_p5 | Turbo the snail plays a game on a board with 2024 rows and 2023 columns. There are hidden monsters in 2022 of the cells. Initially, Turbo does not know where any of the monsters are, but he knows that there is exactly one monster in each row except the first row and the last row, and that each column contains at most o... | [
"3"
] | null | imo | import Mathlib
namespace Imo_2024_p5
abbrev Cell (N : β) : Type := Fin (N + 2) Γ Fin (N + 1)
abbrev InteriorRow (N : β) : Type := (Set.Icc 1 β¨N, by omegaβ© : Set (Fin (N + 2)))
abbrev MonsterData (N : β) : Type := InteriorRow N βͺ Fin (N + 1)
def MonsterData.monsterCells {N} (m : MonsterData N) :
Set (Cell N) :=... |
CombiBench
CombiBench is the first benchmark focused on combinatorial problems, based on the formal language Lean 4. CombiBench is a manually produced benchmark, including 100 combinatorial mathematics problems of varying difficulty and knowledge levels. It aims to provide a benchmark for evaluating the combinatorial mathematics capabilities of automated theorem proving systems to advance the field. For problems that require providing a solution first and then proving its correctness, we have referred to the style of PutnamBench.
We are hosting a leaderboard and will readily receive evaluation results which are accompanied by a preprint or publication. Please reach out privately at liujunqi@amss.ac.cn with any requests for additions to the leaderboard.
Statistics
We collected all combinatorics problems from the official IMO problems since 2000, except for one problem that relies on a figure. And We selected problems through random sampling from 14 chapters in the book, choosing 3 problems from each chapter, ensuring that the 42 problems are evenly distributed across all 14 chapters. We randomly selected 10 simple combinatorics problems at the middle school level from a mathematics problem collection website hackmath. Then, we randomly collected 12 problems from other mathematics competitions.
| Source | Count |
|---|---|
| Hackmath | 10 |
| Brualdi's book | 42 |
| IMO | 36 |
| APMO | 2 |
| Balticway | 1 |
| EGMO | 1 |
| IMO-Shortlist | 4 |
| IZHO | 2 |
| BXMO | 1 |
| USAMO | 1 |
Note : The complete proofs of Problem 3 and Problem 5 from IMO 2024 have already been formalized in mathlib4/Archive/Imo2024Q3 and mathlib4/Archive/Imo2024Q5. Therefore, we directly refer to the statements of these problems, along with the necessary definitions used in the statements. We are very grateful to Joseph Myers, the author of these two problems. We also appreciate his suggestions on the formalization of our problems.
Evaluation
Our evaluation code is released at https://github.com/MoonshotAI/CombiBench
π Contributing
Contributions are welcome! If anyone notices any mistakes, please raise an issue on the repository and we will address it.
π License
This project is licensed under the MIT License. See the LICENSE file for full details.
- Downloads last month
- 90