name
stringlengths 9
20
| solved
bool 2
classes | tags
listlengths 0
2
| problem_id
stringlengths 7
20
| header
stringclasses 1
value | informal_prefix
stringlengths 89
1.15k
| formal_statement
stringlengths 58
2.76k
| split
stringclasses 1
value | lean4_code
stringlengths 268
3.5k
| category
stringclasses 4
values |
---|---|---|---|---|---|---|---|---|---|
imo_sl_2015_A2
| true |
[
"algebra"
] |
2015_A2
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2015 A2
Find all functions $f : β€ β β€$ such that, for any $x, y β β€$,
$$ f(x - f(y)) = f(f(x)) - f(y) - 1. $$
-/
|
/- special open -/ open Finset
theorem imo_sl_2015_A2 {f : Int β Int} :
(β x y, f (x - f y) = f (f x) - f y - 1) β (f = Ξ» _ β¦ -1) β¨ f = (Β· + 1) := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2015 A2
Find all functions $f : β€ β β€$ such that, for any $x, y β β€$,
$$ f(x - f(y)) = f(f(x)) - f(y) - 1. $$
-/
/- special open -/ open Finset
theorem imo_sl_2015_A2 {f : Int β Int} :
(β x y, f (x - f y) = f (f x) - f y - 1) β (f = Ξ» _ β¦ -1) β¨ f = (Β· + 1) := by sorry
|
algebra
|
imo_sl_2015_N1
| true |
[
"number theory"
] |
2015_N1
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2015 N1
Define the function $f : β€ β β€$ by $f(n) = n βn/2β$.
Find all integers $M$ such that $f^k(M)$ is even for some $k β β$.
### Notes
The original formulation is slightly different.
Instead of $f : β€ β β€$, we define $f : β β β$ by $f(q) = q βqβ$.
Then the problem asks for which $M β β^+$ does there exists
$k β β$ such that $f^k(M + 1/2)$ is an integer.
-/
|
/- special open -/ open Finset
abbrev f (n : β€) := n * (n / 2)
theorem imo_sl_2015_N1 : (β k : β, 2 β£ f^[k] M) β M β 3 := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2015 N1
Define the function $f : β€ β β€$ by $f(n) = n βn/2β$.
Find all integers $M$ such that $f^k(M)$ is even for some $k β β$.
### Notes
The original formulation is slightly different.
Instead of $f : β€ β β€$, we define $f : β β β$ by $f(q) = q βqβ$.
Then the problem asks for which $M β β^+$ does there exists
$k β β$ such that $f^k(M + 1/2)$ is an integer.
-/
/- special open -/ open Finset
abbrev f (n : β€) := n * (n / 2)
theorem imo_sl_2015_N1 : (β k : β, 2 β£ f^[k] M) β M β 3 := by sorry
|
number theory
|
imo_sl_2015_N2
| true |
[
"number theory"
] |
2015_N2
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2015 N2
Let $a, b β β$ such that $a! + b! β£ a! b!$.
Prove that $3a β₯ 2b + 2$, and find all the equality cases.
-/
|
/- special open -/ open Finset
def good (c d : β) := c + d β£ c * d
theorem imo_sl_2015_N2 (h : good a.factorial b.factorial) :
2 * b + 2 β€ 3 * a β§ (2 * b + 2 = 3 * a β a = 2 β§ b = 2 β¨ a = 4 β§ b = 5) := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2015 N2
Let $a, b β β$ such that $a! + b! β£ a! b!$.
Prove that $3a β₯ 2b + 2$, and find all the equality cases.
-/
/- special open -/ open Finset
def good (c d : β) := c + d β£ c * d
theorem imo_sl_2015_N2 (h : good a.factorial b.factorial) :
2 * b + 2 β€ 3 * a β§ (2 * b + 2 = 3 * a β a = 2 β§ b = 2 β¨ a = 4 β§ b = 5) := by sorry
|
number theory
|
imo_sl_2015_N3
| true |
[
"number theory"
] |
2015_N3
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2015 N3
Let $m$ and $n > 1$ be positive integers such that $k β£ m$ whenever $n β€ k < 2n$.
Prove that $L - 1$ is not a power of $2$, where
$$ L = \prod_{k = n}^{2n - 1} \left(\frac{m}{k} + 1\right). $$
-/
|
/- special open -/ open Finset
theorem imo_sl_2015_N3 (hm : 0 < m) (hn : 1 < n) (h : β k β Ico n (2 * n), k β£ m) :
β N, β k β Ico n (2 * n), (m / k + 1) β 2 ^ N + 1 := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2015 N3
Let $m$ and $n > 1$ be positive integers such that $k β£ m$ whenever $n β€ k < 2n$.
Prove that $L - 1$ is not a power of $2$, where
$$ L = \prod_{k = n}^{2n - 1} \left(\frac{m}{k} + 1\right). $$
-/
/- special open -/ open Finset
theorem imo_sl_2015_N3 (hm : 0 < m) (hn : 1 < n) (h : β k β Ico n (2 * n), k β£ m) :
β N, β k β Ico n (2 * n), (m / k + 1) β 2 ^ N + 1 := by sorry
|
number theory
|
imo_sl_2016_A1
| true |
[
"algebra"
] |
2016_A1
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2016 A1
Let $R$ be a totally ordered commutative ring.
Let $a_1, a_2, \dots, a_n, c \in R$ be non-negative elements such that $a_i a_j \ge c$
whenever $i \ne j$.
Let $r \in R$ be an element such that $n r \ge a_1 + a_2 + \dots + a_n$.
Prove that
$$ \prod_{i = 1}^n (a_i^2 + c) \le (r^2 + c)^n. $$
-/
|
/- special open -/ open Finset
theorem imo_sl_2016_A1 [LinearOrderedCommRing R] (n : β) (a : Fin n β R) (c r : R)
(ha : β i, 0 β€ a i)
(hc : 0 β€ c)
(h_prod_ge : β i j, i β j β c β€ a i * a j)
(hr_ge_avg : β i, a i β€ n β’ r) :
β i, (a i ^ 2 + c) β€ (r ^ 2 + c) ^ n := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2016 A1
Let $R$ be a totally ordered commutative ring.
Let $a_1, a_2, \dots, a_n, c \in R$ be non-negative elements such that $a_i a_j \ge c$
whenever $i \ne j$.
Let $r \in R$ be an element such that $n r \ge a_1 + a_2 + \dots + a_n$.
Prove that
$$ \prod_{i = 1}^n (a_i^2 + c) \le (r^2 + c)^n. $$
-/
/- special open -/ open Finset
theorem imo_sl_2016_A1 [LinearOrderedCommRing R] (n : β) (a : Fin n β R) (c r : R)
(ha : β i, 0 β€ a i)
(hc : 0 β€ c)
(h_prod_ge : β i j, i β j β c β€ a i * a j)
(hr_ge_avg : β i, a i β€ n β’ r) :
β i, (a i ^ 2 + c) β€ (r ^ 2 + c) ^ n := by sorry
|
algebra
|
imo_sl_2016_A4
| true |
[
"algebra"
] |
2016_A4
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2016 A4
Let $M$ be an integral multiplicative monoid with a cancellative, distributive addition.
Find all functions $f : M β M$ such that, for all $x, y β M$,
$$ x f(x^2) f(f(y)) + f(y f(x)) = f(xy) \left(f(f(y^2)) + f(f(x^2))\right). $$
-/
|
def good [Mul M] [Add M] (f : M β M) :=
β x y, x * f (x * x) * f (f y) + f (y * f x) = f (x * y) * (f (f (y * y)) + f (f (x * x)))
class CancelCommDistribMonoid (M) extends CancelCommMonoid M, Distrib M
variable [CancelCommDistribMonoid M]
theorem imo_sl_2016_A4 [IsCancelAdd M] {f : M β M} : good f β β x, x * f x = 1 := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2016 A4
Let $M$ be an integral multiplicative monoid with a cancellative, distributive addition.
Find all functions $f : M β M$ such that, for all $x, y β M$,
$$ x f(x^2) f(f(y)) + f(y f(x)) = f(xy) \left(f(f(y^2)) + f(f(x^2))\right). $$
-/
def good [Mul M] [Add M] (f : M β M) :=
β x y, x * f (x * x) * f (f y) + f (y * f x) = f (x * y) * (f (f (y * y)) + f (f (x * x)))
class CancelCommDistribMonoid (M) extends CancelCommMonoid M, Distrib M
variable [CancelCommDistribMonoid M]
theorem imo_sl_2016_A4 [IsCancelAdd M] {f : M β M} : good f β β x, x * f x = 1 := by sorry
|
algebra
|
imo_sl_2016_A5a
| true |
[
"algebra"
] |
2016_A5a
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2016 A5
1. Prove that, for every $n β β$, there exists some $a, b β β$
such that $0 < b β€ \sqrt{n} + 1$ and $b^2 n β€ a^2 β€ b^2 (n + 1)$.
-/
|
theorem imo_sl_2016_A5a_part1 (n) :
β a b, 0 < b β§ b β€ n.sqrt + 1 β§ b ^ 2 * n β€ a ^ 2 β§ a ^ 2 β€ b ^ 2 * (n + 1) := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2016 A5
1. Prove that, for every $n β β$, there exists some $a, b β β$
such that $0 < b β€ \sqrt{n} + 1$ and $b^2 n β€ a^2 β€ b^2 (n + 1)$.
-/
theorem imo_sl_2016_A5a_part1 (n) :
β a b, 0 < b β§ b β€ n.sqrt + 1 β§ b ^ 2 * n β€ a ^ 2 β§ a ^ 2 β€ b ^ 2 * (n + 1) := by sorry
|
algebra
|
imo_sl_2016_A5b
| true |
[
"algebra"
] |
2016_A5b
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2016 A5
2. Prove that, for infinitely many $n β β$, there does not exist $a, b β β$
such that $0 < b β€ \sqrt{n}$ and $b^2 n β€ a^2 β€ b^2 (n + 1)$.
-/
|
theorem imo_sl_2016_A5b_part2 (N) :
β n > N, Β¬β a b, 0 < b β§ b β€ n.sqrt β§ b ^ 2 * n β€ a ^ 2 β§ a ^ 2 β€ b ^ 2 * (n + 1) := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2016 A5
2. Prove that, for infinitely many $n β β$, there does not exist $a, b β β$
such that $0 < b β€ \sqrt{n}$ and $b^2 n β€ a^2 β€ b^2 (n + 1)$.
-/
theorem imo_sl_2016_A5b_part2 (N) :
β n > N, Β¬β a b, 0 < b β§ b β€ n.sqrt β§ b ^ 2 * n β€ a ^ 2 β§ a ^ 2 β€ b ^ 2 * (n + 1) := by sorry
|
algebra
|
imo_sl_2016_A7
| true |
[
"algebra"
] |
2016_A7
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2016 A7
Let $R$ be a ring and $S$ be a totally ordered commutative ring.
Find all functions $f : R \to S$ such that for any $x, y \in R$,
$$ f(x + y)^2 = 2 f(x) f(y) + \max\{f(x^2) + f(y^2), f(x^2 + y^2)\}. $$
-/
|
variable {R : Type*} [Ring R] {S : Type*} [LinearOrderedCommRing S]
/-- A function `f` is a solution if it satisfies the functional equation. -/
def IsSolution (f : R β S) : Prop :=
β x y : R, f (x + y) ^ 2 = 2 * f x * f y + max (f (x ^ 2) + f (y ^ 2)) (f (x ^ 2 + y ^ 2))
theorem imo_sl_2016_A7 (f : R β S) :
IsSolution f β
(f = (fun _ β¦ (0 : S)) β¨ β (phi : RingHom R S), f = phi) β¨
(f = (fun _ β¦ (-1 : S)) β¨ β (phi : RingHom R S), f = (fun x β¦ phi x - 1)) := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2016 A7
Let $R$ be a ring and $S$ be a totally ordered commutative ring.
Find all functions $f : R \to S$ such that for any $x, y \in R$,
$$ f(x + y)^2 = 2 f(x) f(y) + \max\{f(x^2) + f(y^2), f(x^2 + y^2)\}. $$
-/
variable {R : Type*} [Ring R] {S : Type*} [LinearOrderedCommRing S]
/-- A function `f` is a solution if it satisfies the functional equation. -/
def IsSolution (f : R β S) : Prop :=
β x y : R, f (x + y) ^ 2 = 2 * f x * f y + max (f (x ^ 2) + f (y ^ 2)) (f (x ^ 2 + y ^ 2))
theorem imo_sl_2016_A7 (f : R β S) :
IsSolution f β
(f = (fun _ β¦ (0 : S)) β¨ β (phi : RingHom R S), f = phi) β¨
(f = (fun _ β¦ (-1 : S)) β¨ β (phi : RingHom R S), f = (fun x β¦ phi x - 1)) := by sorry
|
algebra
|
imo_sl_2016_N4
| true |
[
"number theory"
] |
2016_N4
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2016 N4
Consider some $k, β, m, n β β^+$ with $n > 1$ such that
$$ n^k + mn^β + 1 β£ n^{k + β} - 1. $$
Prove that one of the following holds:
* $m = 1$ and $β = 2k$; or
* $k = (t + 1)β$ and $m(n^β - 1) = n^{t β} - 1$ for some $t > 0$.
-/
|
theorem imo_sl_2016_N4 (hk : 0 < k) (hl : 0 < l) (hm : 0 < m) (hn : 1 < n)
(h : n ^ k + m * n ^ l + 1 β£ n ^ (k + l) - 1) :
(m = 1 β§ l = 2 * k) β¨ (β t > 0, k = (t + 1) * l β§ m * (n ^ l - 1) = n ^ (l * t) - 1) := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2016 N4
Consider some $k, β, m, n β β^+$ with $n > 1$ such that
$$ n^k + mn^β + 1 β£ n^{k + β} - 1. $$
Prove that one of the following holds:
* $m = 1$ and $β = 2k$; or
* $k = (t + 1)β$ and $m(n^β - 1) = n^{t β} - 1$ for some $t > 0$.
-/
theorem imo_sl_2016_N4 (hk : 0 < k) (hl : 0 < l) (hm : 0 < m) (hn : 1 < n)
(h : n ^ k + m * n ^ l + 1 β£ n ^ (k + l) - 1) :
(m = 1 β§ l = 2 * k) β¨ (β t > 0, k = (t + 1) * l β§ m * (n ^ l - 1) = n ^ (l * t) - 1) := by sorry
|
number theory
|
imo_sl_2016_N5
| true |
[
"number theory"
] |
2016_N5
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2016 N5
Fix some $k, a β β€$ with $k β₯ 0$ and $a > 0$.
A pair $(x, y) β β€^2$ is called *nice* if $(k + 1) y^2 - k x^2 = a$.
Prove that the following two statements are equivalent:
* There exists a nice pair $(x, y)$ with $x β₯ 0$ and $x^2 > a$;
* There exists a nice pair $(x, y)$ with $x β₯ 0$ and $x^2 β€ a$.
-/
|
def nice (k a x y : β€) := (k + 1) * y ^ 2 - k * x ^ 2 = a
theorem imo_sl_2016_N5 :
(β x y, 0 β€ x β§ a < x ^ 2 β§ nice k a x y)
β (β x y, 0 β€ x β§ x ^ 2 β€ a β§ nice k a x y) := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2016 N5
Fix some $k, a β β€$ with $k β₯ 0$ and $a > 0$.
A pair $(x, y) β β€^2$ is called *nice* if $(k + 1) y^2 - k x^2 = a$.
Prove that the following two statements are equivalent:
* There exists a nice pair $(x, y)$ with $x β₯ 0$ and $x^2 > a$;
* There exists a nice pair $(x, y)$ with $x β₯ 0$ and $x^2 β€ a$.
-/
def nice (k a x y : β€) := (k + 1) * y ^ 2 - k * x ^ 2 = a
theorem imo_sl_2016_N5 :
(β x y, 0 β€ x β§ a < x ^ 2 β§ nice k a x y)
β (β x y, 0 β€ x β§ x ^ 2 β€ a β§ nice k a x y) := by sorry
|
number theory
|
imo_sl_2017_A1
| true |
[
"algebra"
] |
2017_A1
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2017 A1
Let $a_1, a_2, \dots, a_n$ and $k$ be positive integers such that the sum of the reciprocals
of the $a_i$ is equal to $k$, i.e., $\sum_{i=1}^n \frac{1}{a_i} = k$.
Suppose that at least one of the $a_i$ is greater than $1$.
Prove that for any totally ordered commutative semiring $R$ and any positive element $x \in R$,
$$ \left(\prod_{i=1}^n a_i\right) (x + 1)^k < \prod_{i=1}^n (x + a_i). $$
-/
|
/- special open -/ open Finset
theorem imo_sl_2017_A1 [LinearOrderedField R] (n : β) (a : Fin n β β) (k : β) (x : R)
(ha_pos : β i, 0 < a i)
(ha_gt_one : β i, 1 < a i)
(hk_sum : (β i, (a i : β)β»ΒΉ) = k)
(hx : 0 < x) :
((β i, a i) : R) * (x + 1) ^ k < β i, (x + (a i : R)) := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2017 A1
Let $a_1, a_2, \dots, a_n$ and $k$ be positive integers such that the sum of the reciprocals
of the $a_i$ is equal to $k$, i.e., $\sum_{i=1}^n \frac{1}{a_i} = k$.
Suppose that at least one of the $a_i$ is greater than $1$.
Prove that for any totally ordered commutative semiring $R$ and any positive element $x \in R$,
$$ \left(\prod_{i=1}^n a_i\right) (x + 1)^k < \prod_{i=1}^n (x + a_i). $$
-/
/- special open -/ open Finset
theorem imo_sl_2017_A1 [LinearOrderedField R] (n : β) (a : Fin n β β) (k : β) (x : R)
(ha_pos : β i, 0 < a i)
(ha_gt_one : β i, 1 < a i)
(hk_sum : (β i, (a i : β)β»ΒΉ) = k)
(hx : 0 < x) :
((β i, a i) : R) * (x + 1) ^ k < β i, (x + (a i : R)) := by sorry
|
algebra
|
imo_sl_2017_A3
| true |
[
"algebra"
] |
2017_A3
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2017 A3
Let $S$ be a finite set, and fix some $f : S β S$.
Suppose that, for any $g : S β S$, $$f β g β f = g β f β g \implies g = f. $$
Prove that $f^2(S) = f(S)$.
-/
|
theorem imo_sl_2017_A3 (h : β g : S β S, f β g β f = g β f β g β g = f) :
Set.range f^[2] = Set.range f := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2017 A3
Let $S$ be a finite set, and fix some $f : S β S$.
Suppose that, for any $g : S β S$, $$f β g β f = g β f β g \implies g = f. $$
Prove that $f^2(S) = f(S)$.
-/
theorem imo_sl_2017_A3 (h : β g : S β S, f β g β f = g β f β g β g = f) :
Set.range f^[2] = Set.range f := by sorry
|
algebra
|
imo_sl_2017_A4
| true |
[
"algebra"
] |
2017_A4
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2017 A4
Let $G$ be a totally ordered abelian group and let $D$ be a natural number.
A sequence $(a_n)_{n \ge 0}$ of elements of $G$ satisfies the following properties:
* for any $i, j \in \mathbb{N}$ with $i + j \ge D$, we have $a_{i + j + 1} \le -a_i - a_j$,
* for any $n \ge D$, there exists $i, j \in \mathbb{N}$ such that
$i + j = n$ and $a_{n + 1} = -a_i - a_j$.
Prove that $(a_n)_{n \ge 0}$ is bounded. Explicitly, prove that for all $n$,
$|a_n| \le 2 \max\{B, C - B\}$, where
$B = \max_{k \le D} a_k$ and $C = \max_{k \le D} (-a_k)$.
-/
|
variable {G : Type*} [LinearOrderedAddCommGroup G]
def seqMax (a : β β G) (n : β) : G :=
if h : n = 0 then
a 0
else
max (seqMax a (n-1)) (a n)
def IsGood1 (D : β) (a : β β G) : Prop :=
β i j : β, D β€ i + j β a (i + j + 1) β€ -(a i) - (a j)
def IsGood2 (D : β) (a : β β G) : Prop :=
β n β₯ D, β i j : β, i + j = n β§ a (n + 1) = -(a i) - (a j)
theorem imo_sl_2017_A4 (D : β) (a : β β G) (h1 : IsGood1 D a) (h2 : IsGood2 D a) (n : β) :
|a n| β€ max ((2 : β) β’ seqMax a D) ((2 : β) β’ (seqMax (fun i => -a i) D - seqMax a D)) := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2017 A4
Let $G$ be a totally ordered abelian group and let $D$ be a natural number.
A sequence $(a_n)_{n \ge 0}$ of elements of $G$ satisfies the following properties:
* for any $i, j \in \mathbb{N}$ with $i + j \ge D$, we have $a_{i + j + 1} \le -a_i - a_j$,
* for any $n \ge D$, there exists $i, j \in \mathbb{N}$ such that
$i + j = n$ and $a_{n + 1} = -a_i - a_j$.
Prove that $(a_n)_{n \ge 0}$ is bounded. Explicitly, prove that for all $n$,
$|a_n| \le 2 \max\{B, C - B\}$, where
$B = \max_{k \le D} a_k$ and $C = \max_{k \le D} (-a_k)$.
-/
variable {G : Type*} [LinearOrderedAddCommGroup G]
def seqMax (a : β β G) (n : β) : G :=
if h : n = 0 then
a 0
else
max (seqMax a (n-1)) (a n)
def IsGood1 (D : β) (a : β β G) : Prop :=
β i j : β, D β€ i + j β a (i + j + 1) β€ -(a i) - (a j)
def IsGood2 (D : β) (a : β β G) : Prop :=
β n β₯ D, β i j : β, i + j = n β§ a (n + 1) = -(a i) - (a j)
theorem imo_sl_2017_A4 (D : β) (a : β β G) (h1 : IsGood1 D a) (h2 : IsGood2 D a) (n : β) :
|a n| β€ max ((2 : β) β’ seqMax a D) ((2 : β) β’ (seqMax (fun i => -a i) D - seqMax a D)) := by sorry
|
algebra
|
imo_sl_2017_A6
| true |
[
"algebra"
] |
2017_A6
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2017 A6
Let $R$ be a ring, $G$ be an abelian (additive) group, and $\iota : G \to R$ be a group
homomorphism. Find all functions $f : R \to G$ such that for any $x, y \in R$,
$$ f(\iota(f(x)) \iota(f(y))) + f(x + y) = f(xy). $$
-/
|
variable {R G : Type*}
def IsGoodFun [Ring R] [AddCommGroup G] (ΞΉ : G β+ R) (f : R β G) : Prop :=
β x y : R, f (ΞΉ (f x) * ΞΉ (f y)) + f (x + y) = f (x * y)
@[ext] structure CentralInvolutive (R : Type*) [Ring R] where
val : R
val_mul_self_eq_one : val * val = 1
val_mul_comm (x : R) : x * val = val * x
theorem imo_sl_2017_A6 [Ring R] [AddCommGroup G]
(hG2 : β x y : G, 2 β’ x = 2 β’ y β x = y)
(hG3 : β x y : G, 3 β’ x = 3 β’ y β x = y)
(ΞΉ : G β+ R) (f : R β G) :
IsGoodFun ΞΉ f β
β (rc : RingCon R) (a : CentralInvolutive (rc.Quotient))
(phi : {Ο : rc.Quotient β+ G // β x, rc.toQuotient (ΞΉ (Ο x)) = x}),
f = fun x β¦ phi.1 (a.val * (rc.toQuotient (1 - x))) := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2017 A6
Let $R$ be a ring, $G$ be an abelian (additive) group, and $\iota : G \to R$ be a group
homomorphism. Find all functions $f : R \to G$ such that for any $x, y \in R$,
$$ f(\iota(f(x)) \iota(f(y))) + f(x + y) = f(xy). $$
-/
variable {R G : Type*}
def IsGoodFun [Ring R] [AddCommGroup G] (ΞΉ : G β+ R) (f : R β G) : Prop :=
β x y : R, f (ΞΉ (f x) * ΞΉ (f y)) + f (x + y) = f (x * y)
@[ext] structure CentralInvolutive (R : Type*) [Ring R] where
val : R
val_mul_self_eq_one : val * val = 1
val_mul_comm (x : R) : x * val = val * x
theorem imo_sl_2017_A6 [Ring R] [AddCommGroup G]
(hG2 : β x y : G, 2 β’ x = 2 β’ y β x = y)
(hG3 : β x y : G, 3 β’ x = 3 β’ y β x = y)
(ΞΉ : G β+ R) (f : R β G) :
IsGoodFun ΞΉ f β
β (rc : RingCon R) (a : CentralInvolutive (rc.Quotient))
(phi : {Ο : rc.Quotient β+ G // β x, rc.toQuotient (ΞΉ (Ο x)) = x}),
f = fun x β¦ phi.1 (a.val * (rc.toQuotient (1 - x))) := by sorry
|
algebra
|
imo_sl_2017_A7
| true |
[
"algebra"
] |
2017_A7
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2017 A7
Let $(b_n)_{n \ge 0}$ be a sequence of positive integers.
Let $(a_n)_{n \ge 0}$ be a sequence of integers defined by $a_0 = 0$, $a_1 = 1$, and
for $n \ge 0$:
- $a_{n + 2} = a_{n + 1} b_{n + 1} + a_n$ if $b_n = 1$;
- $a_{n + 2} = a_{n + 1} b_{n + 1} - a_n$ if $b_n > 1$.
Prove that $\max\{a_n, a_{n + 1}\} \ge n$ for any $n \ge 0$.
-/
|
def a (b : β β β€) : β β β€
| 0 => 0
| 1 => 1
| n + 2 => a b (n + 1) * b (n + 1) + a b n * if b n = 1 then 1 else -1
theorem imo_sl_2017_A7 (b : β β β€) (b_pos : β n, 0 < b n) (n : β) :
(n : β€) β€ a b n β¨ (n : β€) β€ a b (n + 1) := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2017 A7
Let $(b_n)_{n \ge 0}$ be a sequence of positive integers.
Let $(a_n)_{n \ge 0}$ be a sequence of integers defined by $a_0 = 0$, $a_1 = 1$, and
for $n \ge 0$:
- $a_{n + 2} = a_{n + 1} b_{n + 1} + a_n$ if $b_n = 1$;
- $a_{n + 2} = a_{n + 1} b_{n + 1} - a_n$ if $b_n > 1$.
Prove that $\max\{a_n, a_{n + 1}\} \ge n$ for any $n \ge 0$.
-/
def a (b : β β β€) : β β β€
| 0 => 0
| 1 => 1
| n + 2 => a b (n + 1) * b (n + 1) + a b n * if b n = 1 then 1 else -1
theorem imo_sl_2017_A7 (b : β β β€) (b_pos : β n, 0 < b n) (n : β) :
(n : β€) β€ a b n β¨ (n : β€) β€ a b (n + 1) := by sorry
|
algebra
|
imo_sl_2017_A8
| true |
[
"algebra"
] |
2017_A8
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2017 A8
Let $G$ be a totally ordered abelian group. We are interested in functions $f : G \to G$
that satisfy the following property: for any $x, y \in G$,
$$ \text{if } f(x) + y < f(y) + x, \text{ then } f(x) + y \le 0 \le f(y) + x. $$
The problem is to show that if $G$ is densely ordered, then every function $f$ with the
above property also satisfies:
$$ f(y) + x \le f(x) + y \quad \text{for all } x, y \in G \text{ with } x \le y. $$
-/
|
def IsGood {G : Type*} [AddCommGroup G] [LinearOrder G] (f : G β G) : Prop :=
β x y : G, f x + y < f y + x β f x + y β€ 0 β§ 0 β€ f y + x
theorem imo_sl_2017_A8 {G : Type*} [AddCommGroup G] [LinearOrder G] :
(β (f : G β G), IsGood f β (β x y, x β€ y β f y + x β€ f x + y)) β DenselyOrdered G := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2017 A8
Let $G$ be a totally ordered abelian group. We are interested in functions $f : G \to G$
that satisfy the following property: for any $x, y \in G$,
$$ \text{if } f(x) + y < f(y) + x, \text{ then } f(x) + y \le 0 \le f(y) + x. $$
The problem is to show that if $G$ is densely ordered, then every function $f$ with the
above property also satisfies:
$$ f(y) + x \le f(x) + y \quad \text{for all } x, y \in G \text{ with } x \le y. $$
-/
def IsGood {G : Type*} [AddCommGroup G] [LinearOrder G] (f : G β G) : Prop :=
β x y : G, f x + y < f y + x β f x + y β€ 0 β§ 0 β€ f y + x
theorem imo_sl_2017_A8 {G : Type*} [AddCommGroup G] [LinearOrder G] :
(β (f : G β G), IsGood f β (β x y, x β€ y β f y + x β€ f x + y)) β DenselyOrdered G := by sorry
|
algebra
|
imo_sl_2017_C1
| true |
[
"combinatorics"
] |
2017_C1
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2017 C1
A rectangle in $β^2$ is a subset of form $\{a, a + 1, β¦, a + w - 1\}
Γ \{b, b + 1, β¦, b + h - 1\}$ for some $a, b, w, h β β$.
Given such rectangle, the quantity $w$ and $h$ are called the
*width* and *height* of the rectangle, respectively.
A rectangle $R$ in $β^2$ with odd width and height is
partitioned into small rectangles.
Prove that there exists a small rectangle $R'$ with the following property:
the distances from the sides of $R'$ to the respective sides
of $R$ all have the same parity.
-/
|
/- special open -/ open Finset
def latticeRect (q : (β Γ β) Γ β Γ β) : Finset (β Γ β) :=
Ico q.1.1 (q.1.1 + q.2.1) ΓΛ’ Ico q.1.2 (q.1.2 + q.2.2)
theorem imo_sl_2017_C1 {I : Finset ΞΉ}
(h : (I : Set ΞΉ).PairwiseDisjoint (latticeRect β Q))
(h0 : m.bodd = true β§ n.bodd = true)
(h1 : latticeRect β¨β¨0, 0β©, β¨m, nβ©β© = I.disjiUnion (latticeRect β Q) h) :
β i β I, ((Q i).2.1.bodd = true β§ (Q i).2.2.bodd = true)
β§ ((Q i).1.1 + (Q i).1.2).bodd = false := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2017 C1
A rectangle in $β^2$ is a subset of form $\{a, a + 1, β¦, a + w - 1\}
Γ \{b, b + 1, β¦, b + h - 1\}$ for some $a, b, w, h β β$.
Given such rectangle, the quantity $w$ and $h$ are called the
*width* and *height* of the rectangle, respectively.
A rectangle $R$ in $β^2$ with odd width and height is
partitioned into small rectangles.
Prove that there exists a small rectangle $R'$ with the following property:
the distances from the sides of $R'$ to the respective sides
of $R$ all have the same parity.
-/
/- special open -/ open Finset
def latticeRect (q : (β Γ β) Γ β Γ β) : Finset (β Γ β) :=
Ico q.1.1 (q.1.1 + q.2.1) ΓΛ’ Ico q.1.2 (q.1.2 + q.2.2)
theorem imo_sl_2017_C1 {I : Finset ΞΉ}
(h : (I : Set ΞΉ).PairwiseDisjoint (latticeRect β Q))
(h0 : m.bodd = true β§ n.bodd = true)
(h1 : latticeRect β¨β¨0, 0β©, β¨m, nβ©β© = I.disjiUnion (latticeRect β Q) h) :
β i β I, ((Q i).2.1.bodd = true β§ (Q i).2.2.bodd = true)
β§ ((Q i).1.1 + (Q i).1.2).bodd = false := by sorry
|
combinatorics
|
imo_sl_2017_N1
| true |
[
"number theory"
] |
2017_N1
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2017 N1 (P1)
For each $n β β$, define $f(n)$ by $\sqrt{n}$ if $n$ is a square and $n + 3$ otherwise.
Find all $N β β$ such that $\{n : f^n(N) = a\}$ is infinite for some $a β β$.
-/
|
/- special open -/ open Finset
def f (p k : β) : β := if k.sqrt ^ 2 = k then k.sqrt else k + p
def good (p N : β) := β a, β m, β n β₯ m, (f p)^[n] N = a
theorem imo_sl_2017_N1 : good 3 N β N = 1 β¨ 3 β£ N := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2017 N1 (P1)
For each $n β β$, define $f(n)$ by $\sqrt{n}$ if $n$ is a square and $n + 3$ otherwise.
Find all $N β β$ such that $\{n : f^n(N) = a\}$ is infinite for some $a β β$.
-/
/- special open -/ open Finset
def f (p k : β) : β := if k.sqrt ^ 2 = k then k.sqrt else k + p
def good (p N : β) := β a, β m, β n β₯ m, (f p)^[n] N = a
theorem imo_sl_2017_N1 : good 3 N β N = 1 β¨ 3 β£ N := by sorry
|
number theory
|
imo_sl_2017_N3
| true |
[
"number theory"
] |
2017_N3
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2017 N3
Let $n > 1$ be an integer.
A *special $n$-tuple* is an $n$-tuple $\mathbf{a} = (a_0, a_1, β¦, a_{n - 1})$ of integers
such that there exists an indexing function $f : [n] β [n]$ such that for all $i$,
$$ n β£ a_i + a_{i + 1} + β¦ + a_{i + f(i)}. $$
Determine all $n > 1$ such that any special $n$-tuple $\mathbf{a}$ satisfies
$$ n β£ a_0 + a_1 + β¦ + a_{n-1}. $$
-/
|
/- special open -/ open Finset Function
structure SpecialTuple (n : β) where
toFun : Fin n.pred.succ β β€
jump_shift : Fin n.pred.succ β Fin n.pred.succ
jump_shift_spec : β i, (n : β€) β£ β j β Ico i.1 (i.1 + ((jump_shift i).1 + 1)), toFun j
def sum (X : SpecialTuple n) : β€ := β i, X.toFun i
theorem imo_sl_2017_N3 (hn : 1 < n) : (β X : SpecialTuple n, (n : β€) β£ sum X) β n.Prime := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2017 N3
Let $n > 1$ be an integer.
A *special $n$-tuple* is an $n$-tuple $\mathbf{a} = (a_0, a_1, β¦, a_{n - 1})$ of integers
such that there exists an indexing function $f : [n] β [n]$ such that for all $i$,
$$ n β£ a_i + a_{i + 1} + β¦ + a_{i + f(i)}. $$
Determine all $n > 1$ such that any special $n$-tuple $\mathbf{a}$ satisfies
$$ n β£ a_0 + a_1 + β¦ + a_{n-1}. $$
-/
/- special open -/ open Finset Function
structure SpecialTuple (n : β) where
toFun : Fin n.pred.succ β β€
jump_shift : Fin n.pred.succ β Fin n.pred.succ
jump_shift_spec : β i, (n : β€) β£ β j β Ico i.1 (i.1 + ((jump_shift i).1 + 1)), toFun j
def sum (X : SpecialTuple n) : β€ := β i, X.toFun i
theorem imo_sl_2017_N3 (hn : 1 < n) : (β X : SpecialTuple n, (n : β€) β£ sum X) β n.Prime := by sorry
|
number theory
|
imo_sl_2017_N6
| true |
[
"number theory"
] |
2017_N6
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2017 N6
A multiset $S$ of positive rational numbers is called *nice* if
both $\sum_{q β S} q$ and $\sum_{q β S} 1/q$ are integers.
Find all $n β β$ such that there exists infinitely many nice multisets $S$ of size $n$.
-/
|
/- special open -/ open Multiset
structure nice (S : Multiset β) : Prop where
pos : β q : β, q β S β 0 < q
sum_eq_int : β k : β€, S.sum = k
sum_inv_eq_int : β k : β€, (S.map (Β·β»ΒΉ)).sum = k
def good (n : β) := {S : Multiset β | card S = n β§ nice S}.Infinite
theorem imo_sl_2017_N6 : good n β 3 β€ n := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2017 N6
A multiset $S$ of positive rational numbers is called *nice* if
both $\sum_{q β S} q$ and $\sum_{q β S} 1/q$ are integers.
Find all $n β β$ such that there exists infinitely many nice multisets $S$ of size $n$.
-/
/- special open -/ open Multiset
structure nice (S : Multiset β) : Prop where
pos : β q : β, q β S β 0 < q
sum_eq_int : β k : β€, S.sum = k
sum_inv_eq_int : β k : β€, (S.map (Β·β»ΒΉ)).sum = k
def good (n : β) := {S : Multiset β | card S = n β§ nice S}.Infinite
theorem imo_sl_2017_N6 : good n β 3 β€ n := by sorry
|
number theory
|
imo_sl_2018_A2
| true |
[
"algebra"
] |
2018_A2
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2018 A2 (P2)
Let $R$ be a totally ordered commutative ring.
Find all periodic sequences $(a_k)_{k β₯ 0}$ such that for any $k β₯ 0$,
$$ a_{k + 2} = a_k a_{k + 1} + 1. $$
Original problem: Find all possible periods of such sequence.
-/
|
/- special open -/ open Finset
def good [NonAssocSemiring R] (a : β β R) := β k, a (k + 2) = a k * a (k + 1) + 1
variable (R) [NonAssocRing R] (d : Fin 3)
def stdGoodSeq : β β R := Ξ» n β¦ ![2, -1, -1] (n + d)
variable [LinearOrderedCommRing R] {a : β β R} (ha : good a) (hn : a.Periodic (n + 1))
theorem imo_sl_2018_A2 [LinearOrderedCommRing R] {n : β} :
(β a : β β R, good a β§ a.Periodic (n + 1)) β 3 β£ n + 1 := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2018 A2 (P2)
Let $R$ be a totally ordered commutative ring.
Find all periodic sequences $(a_k)_{k β₯ 0}$ such that for any $k β₯ 0$,
$$ a_{k + 2} = a_k a_{k + 1} + 1. $$
Original problem: Find all possible periods of such sequence.
-/
/- special open -/ open Finset
def good [NonAssocSemiring R] (a : β β R) := β k, a (k + 2) = a k * a (k + 1) + 1
variable (R) [NonAssocRing R] (d : Fin 3)
def stdGoodSeq : β β R := Ξ» n β¦ ![2, -1, -1] (n + d)
variable [LinearOrderedCommRing R] {a : β β R} (ha : good a) (hn : a.Periodic (n + 1))
theorem imo_sl_2018_A2 [LinearOrderedCommRing R] {n : β} :
(β a : β β R, good a β§ a.Periodic (n + 1)) β 3 β£ n + 1 := by sorry
|
algebra
|
imo_sl_2018_C1
| true |
[
"combinatorics"
] |
2018_C1
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2018 C1
Let $n β₯ 4$ be an integer and $S β β^+$.
We say that $S$ is *good* if for each $m β β$ with $2 β€ m β€ n - 2$, there exists
$T β S$ of size $m$ such that the sum of all elements in $T$ and $S \ T$ are equal.
Prove that for any $n β₯ 4$, there exists a good set of size $n$.
-/
|
/- special open -/ open Finset
def good (S : Finset β) :=
β m β₯ 2, m + 2 β€ S.card β β T β S, T.card = m β§ T.sum id = (S \ T).sum id
theorem imo_sl_2018_C1 (n : β) : β S : Finset β, S.card = n β§ (β x β S, 0 < x) β§ good S := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2018 C1
Let $n β₯ 4$ be an integer and $S β β^+$.
We say that $S$ is *good* if for each $m β β$ with $2 β€ m β€ n - 2$, there exists
$T β S$ of size $m$ such that the sum of all elements in $T$ and $S \ T$ are equal.
Prove that for any $n β₯ 4$, there exists a good set of size $n$.
-/
/- special open -/ open Finset
def good (S : Finset β) :=
β m β₯ 2, m + 2 β€ S.card β β T β S, T.card = m β§ T.sum id = (S \ T).sum id
theorem imo_sl_2018_C1 (n : β) : β S : Finset β, S.card = n β§ (β x β S, 0 < x) β§ good S := by sorry
|
combinatorics
|
imo_sl_2018_N2
| true |
[
"number theory"
] |
2018_N2
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2018 N2
Let $n$ and $k$ be positive integers.
Consider an $k Γ k$ table, where each cell contains an integer $1 \pmod{n}$.
Suppose that the sum of all numbers in an arbitrary row or column is $k \pmod{n^2}$.
For each $i β€ n$, let $R_i$ and $C_i$ be the product of
numbers in the $i$th row and $i$th column, respectively.
Prove that
$$ \sum_{i = 1}^n R_i β‘ \sum_{i = 1}^n C_i \pmod{n^4}. $$
-/
|
/- special open -/ open Finset
theorem imo_sl_2018_N2 {n : β€} {f : ΞΉ β ΞΉ β β€} (h : β i β S, β j β S, f i j β‘ 1 [ZMOD n])
(h0 : β i β S, β j β S, f i j β‘ S.card [ZMOD n ^ 2])
(h1 : β j β S, β i β S, f i j β‘ S.card [ZMOD n ^ 2]) :
(S.sum Ξ» i β¦ β j β S, f i j) β‘ (S.sum Ξ» j β¦ β i β S, f i j) [ZMOD n ^ 4] := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2018 N2
Let $n$ and $k$ be positive integers.
Consider an $k Γ k$ table, where each cell contains an integer $1 \pmod{n}$.
Suppose that the sum of all numbers in an arbitrary row or column is $k \pmod{n^2}$.
For each $i β€ n$, let $R_i$ and $C_i$ be the product of
numbers in the $i$th row and $i$th column, respectively.
Prove that
$$ \sum_{i = 1}^n R_i β‘ \sum_{i = 1}^n C_i \pmod{n^4}. $$
-/
/- special open -/ open Finset
theorem imo_sl_2018_N2 {n : β€} {f : ΞΉ β ΞΉ β β€} (h : β i β S, β j β S, f i j β‘ 1 [ZMOD n])
(h0 : β i β S, β j β S, f i j β‘ S.card [ZMOD n ^ 2])
(h1 : β j β S, β i β S, f i j β‘ S.card [ZMOD n ^ 2]) :
(S.sum Ξ» i β¦ β j β S, f i j) β‘ (S.sum Ξ» j β¦ β i β S, f i j) [ZMOD n ^ 4] := by sorry
|
number theory
|
imo_sl_2018_N4
| true |
[
"number theory"
] |
2018_N4
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2018 N4 (P5)
Let $(a_n)_{n β₯ 1}$ be a sequence of positive integers such that for $n$ large enough,
$$ \frac{a_1}{a_2} + \frac{a_2}{a_3} + β¦ + \frac{a_{n - 1}}{a_n} + \frac{a_n}{a_1} β β€. $$
Prove that $(a_n)_{n β₯ 1}$ is eventually constant.
-/
|
/- special open -/ open Finset
theorem imo_sl_2018_N4 {a : β β β} (ha : β n, 0 < a n)
(ha0 : β K, β n β₯ K, β z : β€, (z : β) =
(β i β Finset.range n, (a i : β) / a (i + 1)) + a n / a 0) :
β C N, β n, a (n + N) = C := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2018 N4 (P5)
Let $(a_n)_{n β₯ 1}$ be a sequence of positive integers such that for $n$ large enough,
$$ \frac{a_1}{a_2} + \frac{a_2}{a_3} + β¦ + \frac{a_{n - 1}}{a_n} + \frac{a_n}{a_1} β β€. $$
Prove that $(a_n)_{n β₯ 1}$ is eventually constant.
-/
/- special open -/ open Finset
theorem imo_sl_2018_N4 {a : β β β} (ha : β n, 0 < a n)
(ha0 : β K, β n β₯ K, β z : β€, (z : β) =
(β i β Finset.range n, (a i : β) / a (i + 1)) + a n / a 0) :
β C N, β n, a (n + N) = C := by sorry
|
number theory
|
imo_sl_2018_N5
| true |
[
"number theory"
] |
2018_N5
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2018 N5
Determine whether there exists $x, y, z, t β β^+$ such that
$xy - zt = x + y = z + t$ and both $xy$ and $zt$ are perfect squares.
-/
|
/- special open -/ open Finset
def good (v : Fin 4 β β€) := v 0 * v 1 - v 2 * v 3 = v 0 + v 1 β§ v 0 + v 1 = v 2 + v 3
variable (hv : good v)
theorem imo_sl_2018_N5 (hv0 : β i, v i β 0) :
Β¬((β x, v 0 * v 1 = x ^ 2) β§ β y, v 2 * v 3 = y ^ 2) := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2018 N5
Determine whether there exists $x, y, z, t β β^+$ such that
$xy - zt = x + y = z + t$ and both $xy$ and $zt$ are perfect squares.
-/
/- special open -/ open Finset
def good (v : Fin 4 β β€) := v 0 * v 1 - v 2 * v 3 = v 0 + v 1 β§ v 0 + v 1 = v 2 + v 3
variable (hv : good v)
theorem imo_sl_2018_N5 (hv0 : β i, v i β 0) :
Β¬((β x, v 0 * v 1 = x ^ 2) β§ β y, v 2 * v 3 = y ^ 2) := by sorry
|
number theory
|
imo_sl_2018_N6
| true |
[
"number theory"
] |
2018_N6
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2018 N6
Let $f : \mathbb{N}^+ \to \mathbb{N}^+$ be a function such that $f(m + n)$ divides $f(m) + f(n)$
for all $m, n \in \mathbb{N}^+$.
Prove that there exists $n_0 \in \mathbb{N}^+$ such that $f(n_0)$ divides $f(n)$ for all
$n \in \mathbb{N}^+$.
-/
|
def IsGood (f : β+ β β+) : Prop :=
β m n, f (m + n) β£ f m + f n
theorem imo_sl_2018_N6 (f : β+ β β+) (hf : IsGood f) :
β nβ, β n, f nβ β£ f n := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2018 N6
Let $f : \mathbb{N}^+ \to \mathbb{N}^+$ be a function such that $f(m + n)$ divides $f(m) + f(n)$
for all $m, n \in \mathbb{N}^+$.
Prove that there exists $n_0 \in \mathbb{N}^+$ such that $f(n_0)$ divides $f(n)$ for all
$n \in \mathbb{N}^+$.
-/
def IsGood (f : β+ β β+) : Prop :=
β m n, f (m + n) β£ f m + f n
theorem imo_sl_2018_N6 (f : β+ β β+) (hf : IsGood f) :
β nβ, β n, f nβ β£ f n := by sorry
|
number theory
|
imo_sl_2019_A1
| true |
[
"algebra"
] |
2019_A1
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2019 A1 (P1)
Fix an integer $N β 0$.
Find all functions $f : β€ β β€$ such that, for any $a, b β β€$,
$$ f(Na) + N f(b) = f(f(a + b)). $$
-/
|
theorem imo_sl_2019_A1 (h : N β 0) {f : Int β Int} :
(β a b : Int, f (N * a) + N * f b = f (f (a + b)))
β (f = Ξ» _ β¦ 0) β¨ β c : Int, f = (N * Β· + c) := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2019 A1 (P1)
Fix an integer $N β 0$.
Find all functions $f : β€ β β€$ such that, for any $a, b β β€$,
$$ f(Na) + N f(b) = f(f(a + b)). $$
-/
theorem imo_sl_2019_A1 (h : N β 0) {f : Int β Int} :
(β a b : Int, f (N * a) + N * f b = f (f (a + b)))
β (f = Ξ» _ β¦ 0) β¨ β c : Int, f = (N * Β· + c) := by sorry
|
algebra
|
imo_sl_2019_A2
| true |
[
"algebra"
] |
2019_A2
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2019 A2
Let $R$ be a totally ordered ring and $x_1, x_2, β¦, x_n β R$ be elements with
$$ x_1 + x_2 + β¦ + x_n = 0. $$
Let $a, b β R$ such that $b β€ x_i β€ a$ for all $i β€ n$.
Show that $$ nab + \sum_{i = 1}^n x_i^2 β€ 0. $$
-/
|
/- special open -/ open Multiset
theorem imo_sl_2019_A2 [LinearOrderedCommRing R]
{a b : R} {M : Multiset R} (hM : M.sum = 0) (ha : β x β M, x β€ a) (hb : β x β M, b β€ x) :
card M β’ (a * b) + (M.map Ξ» x β¦ x ^ 2).sum β€ 0 := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2019 A2
Let $R$ be a totally ordered ring and $x_1, x_2, β¦, x_n β R$ be elements with
$$ x_1 + x_2 + β¦ + x_n = 0. $$
Let $a, b β R$ such that $b β€ x_i β€ a$ for all $i β€ n$.
Show that $$ nab + \sum_{i = 1}^n x_i^2 β€ 0. $$
-/
/- special open -/ open Multiset
theorem imo_sl_2019_A2 [LinearOrderedCommRing R]
{a b : R} {M : Multiset R} (hM : M.sum = 0) (ha : β x β M, x β€ a) (hb : β x β M, b β€ x) :
card M β’ (a * b) + (M.map Ξ» x β¦ x ^ 2).sum β€ 0 := by sorry
|
algebra
|
imo_sl_2019_C2
| true |
[
"combinatorics"
] |
2019_C2
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2019 C2
Let $G$ be a totally ordered abelian group, and fix a non-negative element $g \in G$.
For a multiset $S$ of elements of $G$, let $\Sigma_S$ denote the sum of the elements of $S$,
counting multiplicity.
Let $S$ be a multiset of elements of $G$ such that $\Sigma_S \le 2|S|g$. Suppose that
each element of $S$ is greater than or equal to $g$.
Prove that for any $r \in G$ with $-2g \le r \le \Sigma_S$, there exists a sub-multiset
$S'$ of $S$ such that $r \le \Sigma_{S'} \le r + 2g$.
-/
|
/- special open -/ open Multiset
theorem imo_sl_2019_C2 [LinearOrderedAddCommGroup G] (g : G) (hg : 0 β€ g) (S : Multiset G)
(hS_elems : β x β S, g β€ x)
(hS_sum : S.sum β€ (2 * card S) β’ g)
(r : G) (hr_lower : -(2 β’ g) β€ r) (hr_upper : r β€ S.sum) :
β T β€ S, r β€ T.sum β§ T.sum β€ r + 2 β’ g := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2019 C2
Let $G$ be a totally ordered abelian group, and fix a non-negative element $g \in G$.
For a multiset $S$ of elements of $G$, let $\Sigma_S$ denote the sum of the elements of $S$,
counting multiplicity.
Let $S$ be a multiset of elements of $G$ such that $\Sigma_S \le 2|S|g$. Suppose that
each element of $S$ is greater than or equal to $g$.
Prove that for any $r \in G$ with $-2g \le r \le \Sigma_S$, there exists a sub-multiset
$S'$ of $S$ such that $r \le \Sigma_{S'} \le r + 2g$.
-/
/- special open -/ open Multiset
theorem imo_sl_2019_C2 [LinearOrderedAddCommGroup G] (g : G) (hg : 0 β€ g) (S : Multiset G)
(hS_elems : β x β S, g β€ x)
(hS_sum : S.sum β€ (2 * card S) β’ g)
(r : G) (hr_lower : -(2 β’ g) β€ r) (hr_upper : r β€ S.sum) :
β T β€ S, r β€ T.sum β§ T.sum β€ r + 2 β’ g := by sorry
|
combinatorics
|
imo_sl_2019_N3
| true |
[
"number theory"
] |
2019_N3
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2019 N3
A set $S β β€$ is called *rootiful* if for any $a_0, a_1, β¦ a_n β S$, not all zero,
and $x β β€$ such that $a_0 + a_1 x + β¦ + a_n x^n = 0$, we have $x β S$.
Fix an integer $N$ with $|N| > 1$.
Find all rootiful sets containing $N^{a + 1} - N^{b + 1}$ for all $a, b β β$.
-/
|
/- special open -/ open List
def rootiful (S : Set β€) :=
β (x : β€) (P : List β€) (_ : β a : β€, a β P β a β S) (_ : β a : β€, a β P β§ a β 0),
P.foldr (Β· + x * Β·) 0 = 0 β x β S
theorem imo_sl_2019_N3 {N : β€} (h : 1 < |N|) {S : Set β€} :
(rootiful S β§ β a b : β, N ^ (a + 1) - N ^ (b + 1) β S) β S = Set.univ := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2019 N3
A set $S β β€$ is called *rootiful* if for any $a_0, a_1, β¦ a_n β S$, not all zero,
and $x β β€$ such that $a_0 + a_1 x + β¦ + a_n x^n = 0$, we have $x β S$.
Fix an integer $N$ with $|N| > 1$.
Find all rootiful sets containing $N^{a + 1} - N^{b + 1}$ for all $a, b β β$.
-/
/- special open -/ open List
def rootiful (S : Set β€) :=
β (x : β€) (P : List β€) (_ : β a : β€, a β P β a β S) (_ : β a : β€, a β P β§ a β 0),
P.foldr (Β· + x * Β·) 0 = 0 β x β S
theorem imo_sl_2019_N3 {N : β€} (h : 1 < |N|) {S : Set β€} :
(rootiful S β§ β a b : β, N ^ (a + 1) - N ^ (b + 1) β S) β S = Set.univ := by sorry
|
number theory
|
imo_sl_2019_N4
| true |
[
"number theory"
] |
2019_N4
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2019 N4
Fix some $C β β$.
Find all functions $f : β β β$ such that $a + f(b) β£ a^2 + b f(a)$
for any $a, b β β$ satisfying $a + b > C$.
-/
|
/- special open -/ open List
def goodPNat (C : β+) (f : β+ β β+) :=
β a b : β+, C < a + b β a + f b β£ a ^ 2 + b * f a
theorem imo_sl_2019_N4 : goodPNat C f β β k : β+, f = (k * Β·) := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2019 N4
Fix some $C β β$.
Find all functions $f : β β β$ such that $a + f(b) β£ a^2 + b f(a)$
for any $a, b β β$ satisfying $a + b > C$.
-/
/- special open -/ open List
def goodPNat (C : β+) (f : β+ β β+) :=
β a b : β+, C < a + b β a + f b β£ a ^ 2 + b * f a
theorem imo_sl_2019_N4 : goodPNat C f β β k : β+, f = (k * Β·) := by sorry
|
number theory
|
imo_sl_2020_A3
| true |
[
"algebra"
] |
2020_A3
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2020 A3
Let $a, b, c, d$ be positive real numbers such that $(a + c)(b + d) = ac + bd$.
Find the smallest possible value of
$$ \frac{a}{b} + \frac{b}{c} + \frac{c}{d} + \frac{d}{a}. $$
-/
|
variable {F : Type*} [LinearOrderedField F]
def IsGood (a b c d : F) : Prop :=
(a + c) * (b + d) = a * c + b * d
def targetVal (a b c d : F) : F :=
a / b + b / c + c / d + d / a
theorem imo_sl_2020_A3 :
(β a b c d : F, 0 < a β 0 < b β 0 < c β 0 < d β IsGood a b c d β (8 : F) β€ targetVal a b c d) β§
(β a b c d : F, 0 < a β§ 0 < b β§ 0 < c β§ 0 < d β§ IsGood a b c d β§ targetVal a b c d = (8 : F)) :=
by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2020 A3
Let $a, b, c, d$ be positive real numbers such that $(a + c)(b + d) = ac + bd$.
Find the smallest possible value of
$$ \frac{a}{b} + \frac{b}{c} + \frac{c}{d} + \frac{d}{a}. $$
-/
variable {F : Type*} [LinearOrderedField F]
def IsGood (a b c d : F) : Prop :=
(a + c) * (b + d) = a * c + b * d
def targetVal (a b c d : F) : F :=
a / b + b / c + c / d + d / a
theorem imo_sl_2020_A3 :
(β a b c d : F, 0 < a β 0 < b β 0 < c β 0 < d β IsGood a b c d β (8 : F) β€ targetVal a b c d) β§
(β a b c d : F, 0 < a β§ 0 < b β§ 0 < c β§ 0 < d β§ IsGood a b c d β§ targetVal a b c d = (8 : F)) :=
by sorry
|
algebra
|
imo_sl_2020_A4
| true |
[
"algebra"
] |
2020_A4
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2020 A4
Let $a, b, c, d$ be real numbers with $a \ge b \ge c \ge d > 0$ and $a + b + c + d = 1$.
Prove that
$$ (a + 2b + 3c + 4d) a^a b^b c^c d^d < 1. $$
-/
|
/- special open -/ open NNReal
theorem imo_sl_2020_A4 (a b c d : NNReal)
(h_ord : a β₯ b β§ b β₯ c β§ c β₯ d β§ d > 0)
(h_sum : a + b + c + d = 1) :
(a + 2 * b + 3 * c + 4 * d) *
(a.toReal ^ a.toReal * b.toReal ^ b.toReal * c.toReal ^ c.toReal * d.toReal ^ d.toReal) < 1 := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2020 A4
Let $a, b, c, d$ be real numbers with $a \ge b \ge c \ge d > 0$ and $a + b + c + d = 1$.
Prove that
$$ (a + 2b + 3c + 4d) a^a b^b c^c d^d < 1. $$
-/
/- special open -/ open NNReal
theorem imo_sl_2020_A4 (a b c d : NNReal)
(h_ord : a β₯ b β§ b β₯ c β§ c β₯ d β§ d > 0)
(h_sum : a + b + c + d = 1) :
(a + 2 * b + 3 * c + 4 * d) *
(a.toReal ^ a.toReal * b.toReal ^ b.toReal * c.toReal ^ c.toReal * d.toReal ^ d.toReal) < 1 := by sorry
|
algebra
|
imo_sl_2020_A6
| true |
[
"algebra"
] |
2020_A6
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2020 A6
Find all functions $f : β€ β β€$ such that, for any $a, b β β€$,
$$ f^{a^2 + b^2}(a + b) = a f(a) + b f(b). $$
-/
|
/- special open -/ open Function
def good (f : β€ β β€) := β a b, f^[a.natAbs ^ 2 + b.natAbs ^ 2] (a + b) = a * f a + b * f b
theorem imo_sl_2020_A6 {f : β€ β β€} : good f β f = (Β· + 1) β¨ f = Ξ» _ β¦ 0 := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2020 A6
Find all functions $f : β€ β β€$ such that, for any $a, b β β€$,
$$ f^{a^2 + b^2}(a + b) = a f(a) + b f(b). $$
-/
/- special open -/ open Function
def good (f : β€ β β€) := β a b, f^[a.natAbs ^ 2 + b.natAbs ^ 2] (a + b) = a * f a + b * f b
theorem imo_sl_2020_A6 {f : β€ β β€} : good f β f = (Β· + 1) β¨ f = Ξ» _ β¦ 0 := by sorry
|
algebra
|
imo_sl_2020_N1
| true |
[
"number theory"
] |
2020_N1
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2020 N1
Prove that, for any positive integer $k$, there exists a prime $p$ and
distinct elements $x_1, x_2, β¦, x_{k + 3} \in π½_p^Γ$ such that for all $i β€ k$,
$$ x_i x_{i + 1} x_{i + 2} x_{i + 3} = i. $$
-/
|
/- special open -/ open Function
abbrev ratSeq : β β β
| 0 => 2
| 1 => 2β»ΒΉ
| 2 => -4
| 3 => -4β»ΒΉ
| n + 4 => (1 + (n.succ : β)β»ΒΉ) * ratSeq n
theorem imo_sl_2020_N1 (k : β) :
β (p : β) (_ : p.Prime) (a : Fin (k + 4) β ZMod p), a.Injective β§ (β i, a i β 0) β§
(β i β€ k, a i * a (i + 1) * a (i + 2) * a (i + 3) = i.succ) := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2020 N1
Prove that, for any positive integer $k$, there exists a prime $p$ and
distinct elements $x_1, x_2, β¦, x_{k + 3} \in π½_p^Γ$ such that for all $i β€ k$,
$$ x_i x_{i + 1} x_{i + 2} x_{i + 3} = i. $$
-/
/- special open -/ open Function
abbrev ratSeq : β β β
| 0 => 2
| 1 => 2β»ΒΉ
| 2 => -4
| 3 => -4β»ΒΉ
| n + 4 => (1 + (n.succ : β)β»ΒΉ) * ratSeq n
theorem imo_sl_2020_N1 (k : β) :
β (p : β) (_ : p.Prime) (a : Fin (k + 4) β ZMod p), a.Injective β§ (β i, a i β 0) β§
(β i β€ k, a i * a (i + 1) * a (i + 2) * a (i + 3) = i.succ) := by sorry
|
number theory
|
imo_sl_2021_A1
| true |
[
"algebra"
] |
2021_A1
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2021 A1
Let $n$ be an integer and $A$ be a subset of $\{0, 1, β¦, 5^n\}$ of size $4n + 2$.
Prove that there exists $a, b, c β A$ such that $a < b < c$ and $c + 2a > 3b$.
-/
|
/- special open -/ open List
theorem imo_sl_2021_A1 (hn : n β 0) {A : Finset β}
(hA : A.card = 4 * n + 2) (hA0 : β a β A, a β€ 5 ^ n) :
β a β A, β b β A, β c β A, a < b β§ b < c β§ 3 * b < c + 2 * a := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2021 A1
Let $n$ be an integer and $A$ be a subset of $\{0, 1, β¦, 5^n\}$ of size $4n + 2$.
Prove that there exists $a, b, c β A$ such that $a < b < c$ and $c + 2a > 3b$.
-/
/- special open -/ open List
theorem imo_sl_2021_A1 (hn : n β 0) {A : Finset β}
(hA : A.card = 4 * n + 2) (hA0 : β a β A, a β€ 5 ^ n) :
β a β A, β b β A, β c β A, a < b β§ b < c β§ 3 * b < c + 2 * a := by sorry
|
algebra
|
imo_sl_2021_A2
| true |
[
"algebra"
] |
2021_A2
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2021 A2
For any positive integer $n$, prove that
$$ 4 \sum_{i = 1}^n \sum_{j = 1}^n \left\lfloor \frac{ij}{n + 1} \right\rfloor
β₯ n^2 (n - 1). $$
Determine the equality cases.
-/
|
/- special open -/ open Finset
abbrev targetSum (n : β) := 4 * β i β range n, β j β range n, (i + 1) * (j + 1) / (n + 1)
theorem imo_sl_2021_A2 (hn : n β 0) : targetSum n = n ^ 2 * (n - 1) β (n + 1).Prime := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2021 A2
For any positive integer $n$, prove that
$$ 4 \sum_{i = 1}^n \sum_{j = 1}^n \left\lfloor \frac{ij}{n + 1} \right\rfloor
β₯ n^2 (n - 1). $$
Determine the equality cases.
-/
/- special open -/ open Finset
abbrev targetSum (n : β) := 4 * β i β range n, β j β range n, (i + 1) * (j + 1) / (n + 1)
theorem imo_sl_2021_A2 (hn : n β 0) : targetSum n = n ^ 2 * (n - 1) β (n + 1).Prime := by sorry
|
algebra
|
imo_sl_2021_A3
| true |
[
"algebra"
] |
2021_A3
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2021 A3
Find the smallest possible value of
$$ \sum_{j = 1}^n \left\lfloor \frac{a_j}{j} \right\rfloor $$
across all permutations $(a_1, a_2, \ldots, a_n)$ of $(1, 2, \ldots, n)$.
-/
|
/- special open -/ open List
def targetSum : List β β β
| [] => 0
| a :: l => a / (a :: l).length + targetSum l
theorem imo_sl_2021_A3 :
IsLeast (targetSum '' {l : List β | l ~ (List.range' 1 n).reverse}) n.size := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2021 A3
Find the smallest possible value of
$$ \sum_{j = 1}^n \left\lfloor \frac{a_j}{j} \right\rfloor $$
across all permutations $(a_1, a_2, \ldots, a_n)$ of $(1, 2, \ldots, n)$.
-/
/- special open -/ open List
def targetSum : List β β β
| [] => 0
| a :: l => a / (a :: l).length + targetSum l
theorem imo_sl_2021_A3 :
IsLeast (targetSum '' {l : List β | l ~ (List.range' 1 n).reverse}) n.size := by sorry
|
algebra
|
imo_sl_2021_A5
| true |
[
"algebra"
] |
2021_A5
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
### IMO 2021 A5
Let $F$ be a totally ordered field.
Let $a_1, a_2, β¦, a_n β F$ be non-negative elements.
Let $r β F$ be any positive element such that $r β₯ a_1 + a_2 + β¦ + a_n$.
Prove that
$$ \sum_{k = 1}^n \frac{a_k}{r - a_k} (a_1 + a_2 + β¦ + a_{k - 1})^2 < \frac{r^2}{3}. $$
-/
|
def targetSumPair [Field F] (r : F) (l : List F) : F Γ F :=
l.foldr (Ξ» a p β¦ (a / (r - a) * p.2 ^ 2 + p.1, a + p.2)) (0, 0)
theorem imo_sl_2021_A5 [LinearOrderedField F]
{r : F} (hr : 0 < r) (l : List F)
(hl : β x β l, 0 β€ x) (h : l.foldr (Β· + Β·) 0 β€ r) :
(targetSumPair r l).1 < r ^ 2 / 3 := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
### IMO 2021 A5
Let $F$ be a totally ordered field.
Let $a_1, a_2, β¦, a_n β F$ be non-negative elements.
Let $r β F$ be any positive element such that $r β₯ a_1 + a_2 + β¦ + a_n$.
Prove that
$$ \sum_{k = 1}^n \frac{a_k}{r - a_k} (a_1 + a_2 + β¦ + a_{k - 1})^2 < \frac{r^2}{3}. $$
-/
def targetSumPair [Field F] (r : F) (l : List F) : F Γ F :=
l.foldr (Ξ» a p β¦ (a / (r - a) * p.2 ^ 2 + p.1, a + p.2)) (0, 0)
theorem imo_sl_2021_A5 [LinearOrderedField F]
{r : F} (hr : 0 < r) (l : List F)
(hl : β x β l, 0 β€ x) (h : l.foldr (Β· + Β·) 0 β€ r) :
(targetSumPair r l).1 < r ^ 2 / 3 := by sorry
|
algebra
|
imo_sl_2021_A6
| true |
[
"algebra"
] |
2021_A6
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2021 A6 (P6)
Let $m β β$ and $a_0, a_1, β¦, a_{k - 1}$ be integers.
Suppose that there exists subsets $B_0, B_1, β¦, B_{m - 1}$ of $[k]$
such that for each $i β [m]$, $$ \sum_{j β B_i} a_j = m^{i + 1}. $$
Prove that $k β₯ m/2$.
-/
|
/- special open -/ open Finset
variable [Fintype ΞΊ] [DecidableEq ΞΊ] {a : ΞΊ β β€}
theorem imo_sl_2021_A6 {a : ΞΊ β β€} {B : Fin m β Finset ΞΊ}
[β i j, Decidable (j β B i)] (h : β i : Fin m, (B i).sum a = m ^ (i.1 + 1)) :
m β€ 2 * Fintype.card ΞΊ := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2021 A6 (P6)
Let $m β β$ and $a_0, a_1, β¦, a_{k - 1}$ be integers.
Suppose that there exists subsets $B_0, B_1, β¦, B_{m - 1}$ of $[k]$
such that for each $i β [m]$, $$ \sum_{j β B_i} a_j = m^{i + 1}. $$
Prove that $k β₯ m/2$.
-/
/- special open -/ open Finset
variable [Fintype ΞΊ] [DecidableEq ΞΊ] {a : ΞΊ β β€}
theorem imo_sl_2021_A6 {a : ΞΊ β β€} {B : Fin m β Finset ΞΊ}
[β i j, Decidable (j β B i)] (h : β i : Fin m, (B i).sum a = m ^ (i.1 + 1)) :
m β€ 2 * Fintype.card ΞΊ := by sorry
|
algebra
|
imo_sl_2021_A7
| true |
[
"algebra"
] |
2021_A7
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2021 A7
Let $R$ be a totally ordered commutative ring.
Let $(x_n)_{n β₯ 0}$ be a sequence of elements of $R$ such that, for each $n β β$,
$$ x_{n + 1} x_{n + 2} β₯ x_n^2 + 1. $$
Show that for any $N β β$,
$$ 27 (x_0 + x_1 + β¦ + x_{N + 1})^2 > 8 N^3. $$
-/
|
/- special open -/ open Finset
variable [LinearOrderedField R] [ExistsAddOfLE R]
theorem imo_sl_2021_A7 {x : β β R} (hx : β n, 0 β€ x n)
(hx0 : β n, x n ^ 2 + 1 β€ x (n + 1) * x (n + 2)) (N) :
8 * N ^ 3 < 27 * (range (N + 2)).sum x ^ 2 := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2021 A7
Let $R$ be a totally ordered commutative ring.
Let $(x_n)_{n β₯ 0}$ be a sequence of elements of $R$ such that, for each $n β β$,
$$ x_{n + 1} x_{n + 2} β₯ x_n^2 + 1. $$
Show that for any $N β β$,
$$ 27 (x_0 + x_1 + β¦ + x_{N + 1})^2 > 8 N^3. $$
-/
/- special open -/ open Finset
variable [LinearOrderedField R] [ExistsAddOfLE R]
theorem imo_sl_2021_A7 {x : β β R} (hx : β n, 0 β€ x n)
(hx0 : β n, x n ^ 2 + 1 β€ x (n + 1) * x (n + 2)) (N) :
8 * N ^ 3 < 27 * (range (N + 2)).sum x ^ 2 := by sorry
|
algebra
|
imo_sl_2021_C1
| true |
[
"combinatorics"
] |
2021_C1
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2021 C1
Consider a complete graph with an infinite vertex set $V$.
Each edge $xy$ is coloured such that for each vertex $v$, there exists only
finitely many colours assigned to an edge incident with $v$.
Prove that if some of the edges has distinct colours, then there exists
$x, y, z β V$, pairwise distinct, such that $c_{xy} = c_{xz} β c_{yz}$.
-/
|
structure FiniteIncidenceColouring (V Ξ± : Type*) where
colour : V β V β Ξ±
colour_symm (x y : V) : colour x y = colour y x
incidence_finite (v : V) : Finite (Set.range (colour v))
variable [Infinite V] (C : FiniteIncidenceColouring V Ξ±)
theorem imo_sl_2021_C1 (h : β c : Ξ±, β x y : V, x β y β§ C.colour x y β c) :
β x y z, y β z β§ C.colour x y = C.colour x z β§ C.colour y z β C.colour x z := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2021 C1
Consider a complete graph with an infinite vertex set $V$.
Each edge $xy$ is coloured such that for each vertex $v$, there exists only
finitely many colours assigned to an edge incident with $v$.
Prove that if some of the edges has distinct colours, then there exists
$x, y, z β V$, pairwise distinct, such that $c_{xy} = c_{xz} β c_{yz}$.
-/
structure FiniteIncidenceColouring (V Ξ± : Type*) where
colour : V β V β Ξ±
colour_symm (x y : V) : colour x y = colour y x
incidence_finite (v : V) : Finite (Set.range (colour v))
variable [Infinite V] (C : FiniteIncidenceColouring V Ξ±)
theorem imo_sl_2021_C1 (h : β c : Ξ±, β x y : V, x β y β§ C.colour x y β c) :
β x y z, y β z β§ C.colour x y = C.colour x z β§ C.colour y z β C.colour x z := by sorry
|
combinatorics
|
imo_sl_2021_C2
| true |
[
"combinatorics"
] |
2021_C2
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2021 C2
Fix some positive integer $n$, and denote $[n] = \{0, 1, β¦, n - 1\}$.
Find all positive integers $m β β$ such that there exists a
function $f : β€/mβ€ β [n]$ with the following property:
for any $k β β€/mβ€$ and $i β [n]$, there exists $j β€ n$ such that $f(k + j) = i$.
-/
|
/- special open -/ open Finset
def good (f : Fin (m + 1) β Fin n) := β k i, β j β€ n, f (k + j) = i
theorem imo_sl_2021_C2 {n m : β} :
(β f : Fin m.succ β Fin n.succ, good f) β m.succ % n.succ β€ m.succ / n.succ := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2021 C2
Fix some positive integer $n$, and denote $[n] = \{0, 1, β¦, n - 1\}$.
Find all positive integers $m β β$ such that there exists a
function $f : β€/mβ€ β [n]$ with the following property:
for any $k β β€/mβ€$ and $i β [n]$, there exists $j β€ n$ such that $f(k + j) = i$.
-/
/- special open -/ open Finset
def good (f : Fin (m + 1) β Fin n) := β k i, β j β€ n, f (k + j) = i
theorem imo_sl_2021_C2 {n m : β} :
(β f : Fin m.succ β Fin n.succ, good f) β m.succ % n.succ β€ m.succ / n.succ := by sorry
|
combinatorics
|
imo_sl_2021_N1
| true |
[
"number theory"
] |
2021_N1
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2021 N1
Find all triplets $(a, b, n)$ of positive integers such that
* $a^2 + b + 3$ is cubefree; and
* $ab + 3b + 8 = n(a^2 + b + 3)$.
-/
|
@[mk_iff] structure good (a b n : β+) : Prop where
cubefree : β p, (a ^ 2 + b + 3).factorMultiset.count p β€ 2
eqn : a * b + 3 * b + 8 = n * (a ^ 2 + b + 3)
theorem imo_sl_2021_N1 :
good a b n β n = 2 β§ β k : β+,
(β p, (k + 2).factorMultiset.count p β€ 1) β§ a = k + 1 β§ b = 2 * k := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2021 N1
Find all triplets $(a, b, n)$ of positive integers such that
* $a^2 + b + 3$ is cubefree; and
* $ab + 3b + 8 = n(a^2 + b + 3)$.
-/
@[mk_iff] structure good (a b n : β+) : Prop where
cubefree : β p, (a ^ 2 + b + 3).factorMultiset.count p β€ 2
eqn : a * b + 3 * b + 8 = n * (a ^ 2 + b + 3)
theorem imo_sl_2021_N1 :
good a b n β n = 2 β§ β k : β+,
(β p, (k + 2).factorMultiset.count p β€ 1) β§ a = k + 1 β§ b = 2 * k := by sorry
|
number theory
|
imo_sl_2021_N2
| true |
[
"number theory"
] |
2021_N2
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2021 N2 (P1)
Let $n β₯ 99$ be an integer.
The non-negative integers are coloured using two colours.
Prove that there exists $a, b β β$ of the same colour such that
$n β€ a < b β€ 2n$ and $a + b$ is a square.
-/
|
def good (n : β) :=
β x : β β Bool, β a b, n β€ a β§ a < b β§ b β€ 2 * n β§ x a = x b β§ β k, a + b = k ^ 2
theorem imo_sl_2021_N2 (h : 99 β€ n) : good n := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2021 N2 (P1)
Let $n β₯ 99$ be an integer.
The non-negative integers are coloured using two colours.
Prove that there exists $a, b β β$ of the same colour such that
$n β€ a < b β€ 2n$ and $a + b$ is a square.
-/
def good (n : β) :=
β x : β β Bool, β a b, n β€ a β§ a < b β§ b β€ 2 * n β§ x a = x b β§ β k, a + b = k ^ 2
theorem imo_sl_2021_N2 (h : 99 β€ n) : good n := by sorry
|
number theory
|
imo_sl_2022_A1
| true |
[
"algebra"
] |
2022_A1
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2022 A1
Let $R$ be a totally ordered ring.
Let $(a_n)_{n β₯ 0}$ be a sequence of non-negative elements of $R$ such that for any $n β β$,
$$ a_{n + 1}^2 + a_n a_{n + 2} β€ a_n + a_{n + 2}. $$
Show that $a_N β€ 1$ for all $N β₯ 2$.
-/
|
variable [LinearOrderedRing R]
theorem imo_sl_2022_A1 {a : β β R} (h : β i, 0 β€ a i)
(h0 : β i, a (i + 1) ^ 2 + a i * a (i + 2) β€ a i + a (i + 2))
(N : β) (h1 : 2 β€ N) : a N β€ 1 := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2022 A1
Let $R$ be a totally ordered ring.
Let $(a_n)_{n β₯ 0}$ be a sequence of non-negative elements of $R$ such that for any $n β β$,
$$ a_{n + 1}^2 + a_n a_{n + 2} β€ a_n + a_{n + 2}. $$
Show that $a_N β€ 1$ for all $N β₯ 2$.
-/
variable [LinearOrderedRing R]
theorem imo_sl_2022_A1 {a : β β R} (h : β i, 0 β€ a i)
(h0 : β i, a (i + 1) ^ 2 + a i * a (i + 2) β€ a i + a (i + 2))
(N : β) (h1 : 2 β€ N) : a N β€ 1 := by sorry
|
algebra
|
imo_sl_2022_A3
| true |
[
"algebra"
] |
2022_A3
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2022 A3 (P2)
Let $R$ be a totally ordered commutative ring, and let $R_{>0} = \{x β R : x > 0\}$.
Find all functions $f : R_{>0} β R_{>0}$ such that for any $x β R_{>0}$,
there exists a unique $y β R_{>0}$ such that $x f(y) + y f(x) β€ 2$.
-/
|
variable [LinearOrderedField R]
def good (f : {x : R // 0 < x} β {x : R // 0 < x}) :=
β x, β! y, x * f y + y * f x β€ β¨2, two_posβ©
theorem imo_sl_2022_A3 [ExistsAddOfLE R] {f : {x : R // 0 < x} β {x : R // 0 < x}} :
good f β β x, x * f x = 1 := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2022 A3 (P2)
Let $R$ be a totally ordered commutative ring, and let $R_{>0} = \{x β R : x > 0\}$.
Find all functions $f : R_{>0} β R_{>0}$ such that for any $x β R_{>0}$,
there exists a unique $y β R_{>0}$ such that $x f(y) + y f(x) β€ 2$.
-/
variable [LinearOrderedField R]
def good (f : {x : R // 0 < x} β {x : R // 0 < x}) :=
β x, β! y, x * f y + y * f x β€ β¨2, two_posβ©
theorem imo_sl_2022_A3 [ExistsAddOfLE R] {f : {x : R // 0 < x} β {x : R // 0 < x}} :
good f β β x, x * f x = 1 := by sorry
|
algebra
|
imo_sl_2022_A6
| true |
[
"algebra"
] |
2022_A6
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2022 A6
Let $G$ be a commutative group.
A function $f : G β G$ is called *infectious* if
$$ f(x + f(y)) = f(x) + f(y) \quad β x, y β G. $$
Find all pairs $(m, n)$ of integers such that for any infectious functions
$f : G β G$, there exists $z β G$ such that $m f(z) = nz$.
-/
|
structure InfectiousFun (G) [Add G] where
toFun : G β G
infectious_def' : β x y, toFun (x + toFun y) = toFun x + toFun y
instance [Add G] : FunLike (InfectiousFun G) G G where
coe f := f.toFun
coe_injective' f g h := by rwa [InfectiousFun.mk.injEq]
def good (G) [AddGroup G] (m n : β€) := β f : InfectiousFun G, β z, m β’ f z = n β’ z
theorem imo_sl_2022_A6 [AddCommGroup G] :
good G m n β β g : G, (m - n).gcd (addOrderOf g) β£ m.natAbs := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2022 A6
Let $G$ be a commutative group.
A function $f : G β G$ is called *infectious* if
$$ f(x + f(y)) = f(x) + f(y) \quad β x, y β G. $$
Find all pairs $(m, n)$ of integers such that for any infectious functions
$f : G β G$, there exists $z β G$ such that $m f(z) = nz$.
-/
structure InfectiousFun (G) [Add G] where
toFun : G β G
infectious_def' : β x y, toFun (x + toFun y) = toFun x + toFun y
instance [Add G] : FunLike (InfectiousFun G) G G where
coe f := f.toFun
coe_injective' f g h := by rwa [InfectiousFun.mk.injEq]
def good (G) [AddGroup G] (m n : β€) := β f : InfectiousFun G, β z, m β’ f z = n β’ z
theorem imo_sl_2022_A6 [AddCommGroup G] :
good G m n β β g : G, (m - n).gcd (addOrderOf g) β£ m.natAbs := by sorry
|
algebra
|
imo_sl_2022_C7
| true |
[
"combinatorics"
] |
2022_C7
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2022 C7
Let $m$ be a positive integer and consider an arbitrary subset $S \subseteq \mathbb{Z}^m$.
We say that $S$ is *add-sup closed* if for any $v, w \in S$, their pointwise sum $v+w$ and
their pointwise maximum (or sup) $v \lor w$ are also in $S$.
A set $G \subseteq \mathbb{Z}^m$ is called an *add-sup generator* if the only add-sup
closed set containing $G$ is $\mathbb{Z}^m$ itself.
Find the smallest possible size of an add-sup generator, in terms of $m$.
-/
|
/- special open -/ open Finset Classical
class IsAddSupClosed {m : β} (S : Set (Fin m β β€)) : Prop where
add_mem : β {v w}, v β S β w β S β v + w β S
sup_mem : β {v w}, v β S β w β S β v β w β S
def IsAddSupGenerator {m : β} (G : Finset (Fin m β β€)) : Prop :=
β S : Set (Fin m β β€), βG β S β IsAddSupClosed S β S = Set.univ
def IsGoodSize (m n : β) : Prop :=
β G : Finset (Fin m β β€), G.card β€ n β§ IsAddSupGenerator G
theorem imo_sl_2022_C7 (m n : β) :
IsGoodSize m n β n β₯ (if m = 0 then 1 else if m β€ 2 then 2 else 3) := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2022 C7
Let $m$ be a positive integer and consider an arbitrary subset $S \subseteq \mathbb{Z}^m$.
We say that $S$ is *add-sup closed* if for any $v, w \in S$, their pointwise sum $v+w$ and
their pointwise maximum (or sup) $v \lor w$ are also in $S$.
A set $G \subseteq \mathbb{Z}^m$ is called an *add-sup generator* if the only add-sup
closed set containing $G$ is $\mathbb{Z}^m$ itself.
Find the smallest possible size of an add-sup generator, in terms of $m$.
-/
/- special open -/ open Finset Classical
class IsAddSupClosed {m : β} (S : Set (Fin m β β€)) : Prop where
add_mem : β {v w}, v β S β w β S β v + w β S
sup_mem : β {v w}, v β S β w β S β v β w β S
def IsAddSupGenerator {m : β} (G : Finset (Fin m β β€)) : Prop :=
β S : Set (Fin m β β€), βG β S β IsAddSupClosed S β S = Set.univ
def IsGoodSize (m n : β) : Prop :=
β G : Finset (Fin m β β€), G.card β€ n β§ IsAddSupGenerator G
theorem imo_sl_2022_C7 (m n : β) :
IsGoodSize m n β n β₯ (if m = 0 then 1 else if m β€ 2 then 2 else 3) := by sorry
|
combinatorics
|
imo_sl_2022_N8
| true |
[
"number theory"
] |
2022_N8
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2022 N8
Given $n β β$ such that $2^n + 65 β£ 5^n - 3^n$, prove that $n = 0$.
-/
|
theorem imo_sl_2022_N8 (h : 5 ^ n β‘ 3 ^ n [MOD 2 ^ n + 65]) : n = 0 := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2022 N8
Given $n β β$ such that $2^n + 65 β£ 5^n - 3^n$, prove that $n = 0$.
-/
theorem imo_sl_2022_N8 (h : 5 ^ n β‘ 3 ^ n [MOD 2 ^ n + 65]) : n = 0 := by sorry
|
number theory
|
imo_sl_2023_A2
| true |
[
"algebra"
] |
2023_A2
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2023 A2
Let $G$ be a $2$-divisible abelian group and $R$ be a totally ordered ring.
Let $f : G β R$ be a function such that
* $f(x + y) f(x - y) β₯ f(x)^2 - f(y)^2$ for all $x, y β G$,
* $f(x_0 + y_0) f(x_0 - y_0) > f(x_0)^2 - f(y_0)^2$ for some $x_0, y_0 β G$.
Prove that either $f β₯ 0$ or $f β€ 0$.
-/
|
theorem imo_sl_2023_A2 [AddCommGroup G] (hG : β x : G, β y, 2 β’ y = x) [LinearOrderedRing R]
{f : G β R} (hf : β x y, f x ^ 2 - f y ^ 2 β€ f (x + y) * f (x - y))
(hf0 : β x0 y0, f x0 ^ 2 - f y0 ^ 2 < f (x0 + y0) * f (x0 - y0)) :
(β x, 0 β€ f x) β¨ (β x, f x β€ 0) := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2023 A2
Let $G$ be a $2$-divisible abelian group and $R$ be a totally ordered ring.
Let $f : G β R$ be a function such that
* $f(x + y) f(x - y) β₯ f(x)^2 - f(y)^2$ for all $x, y β G$,
* $f(x_0 + y_0) f(x_0 - y_0) > f(x_0)^2 - f(y_0)^2$ for some $x_0, y_0 β G$.
Prove that either $f β₯ 0$ or $f β€ 0$.
-/
theorem imo_sl_2023_A2 [AddCommGroup G] (hG : β x : G, β y, 2 β’ y = x) [LinearOrderedRing R]
{f : G β R} (hf : β x y, f x ^ 2 - f y ^ 2 β€ f (x + y) * f (x - y))
(hf0 : β x0 y0, f x0 ^ 2 - f y0 ^ 2 < f (x0 + y0) * f (x0 - y0)) :
(β x, 0 β€ f x) β¨ (β x, f x β€ 0) := by sorry
|
algebra
|
imo_sl_2023_A3
| true |
[
"algebra"
] |
2023_A3
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2023 A3
Let $F$ be a totally ordered field and $N$ be a positive integer.
Let $x_0, x_1, \dots, x_{N-1} \in F$ be distinct positive elements.
Suppose that for each $n \in \{0, \dots, N\}$, there exists an integer $a_n \in \mathbb{N}$ such that
$$ \left(\sum_{i=0}^{n-1} x_i\right) \left(\sum_{i=0}^{n-1} \frac{1}{x_i}\right) = a_n^2. $$
Prove that $a_N \ge \lfloor 3N/2 \rfloor$.
-/
|
/- special open -/ open Finset
structure GoodSeq (N : β) (F : Type*) [LinearOrderedField F] where
x : β β F
a : β β β
x_pos : β i < N, 0 < x i
x_inj : β i < N, β j < N, x i = x j β i = j
spec : β i β€ N, (a i : F) ^ 2 = (β j β range i, x j) * (β j β range i, (x j)β»ΒΉ)
theorem imo_sl_2023_A3 {N : β} {F : Type*} [LinearOrderedField F]
(hN : 0 < N) (X : GoodSeq N F) :
3 * N / 2 β€ X.a N := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2023 A3
Let $F$ be a totally ordered field and $N$ be a positive integer.
Let $x_0, x_1, \dots, x_{N-1} \in F$ be distinct positive elements.
Suppose that for each $n \in \{0, \dots, N\}$, there exists an integer $a_n \in \mathbb{N}$ such that
$$ \left(\sum_{i=0}^{n-1} x_i\right) \left(\sum_{i=0}^{n-1} \frac{1}{x_i}\right) = a_n^2. $$
Prove that $a_N \ge \lfloor 3N/2 \rfloor$.
-/
/- special open -/ open Finset
structure GoodSeq (N : β) (F : Type*) [LinearOrderedField F] where
x : β β F
a : β β β
x_pos : β i < N, 0 < x i
x_inj : β i < N, β j < N, x i = x j β i = j
spec : β i β€ N, (a i : F) ^ 2 = (β j β range i, x j) * (β j β range i, (x j)β»ΒΉ)
theorem imo_sl_2023_A3 {N : β} {F : Type*} [LinearOrderedField F]
(hN : 0 < N) (X : GoodSeq N F) :
3 * N / 2 β€ X.a N := by sorry
|
algebra
|
imo_sl_2023_A5
| true |
[
"algebra"
] |
2023_A5
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2023 A5
Let $N > 0$ be an integer and $(a_0, a_1, \dots, a_N)$ be a permutation of $(0, 1, \dots, N)$.
Suppose that the sequence of absolute differences $(|a_0 - a_1|, \dots, |a_{N - 1} - a_N|)$
is a permutation of $(1, 2, \dots, N)$.
Prove that $\max\{a_0, a_N\} \ge \lfloor (N + 1)/4 \rfloor + 1$.
-/
|
/- special open -/ open Fin
/--
A `NicePerm N` is a structure containing the permutations that satisfy the problem's conditions.
- `toPerm`: The permutation `a` of `{0, ..., N}`.
- `distPerm`: The permutation of `{1, ..., N}` given by the absolute differences.
- `distPerm_spec`: The proof that the differences `|aα΅’ - aα΅’ββ|` match the `distPerm`.
-/
structure NicePerm (N : β) where
toPerm : Equiv (Fin (N + 1)) (Fin (N + 1))
distPerm : Equiv (Fin N) (Fin N)
distPerm_spec : β i : Fin N,
Nat.dist (toPerm i.castSucc).val (toPerm i.succ).val = (distPerm i).val + 1
theorem imo_sl_2023_A5 (N : β) (p : NicePerm N) :
(if N = 0 then 0 else (N + 1) / 4 + 1) β€ max (p.toPerm (last N)).val (p.toPerm 0).val := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2023 A5
Let $N > 0$ be an integer and $(a_0, a_1, \dots, a_N)$ be a permutation of $(0, 1, \dots, N)$.
Suppose that the sequence of absolute differences $(|a_0 - a_1|, \dots, |a_{N - 1} - a_N|)$
is a permutation of $(1, 2, \dots, N)$.
Prove that $\max\{a_0, a_N\} \ge \lfloor (N + 1)/4 \rfloor + 1$.
-/
/- special open -/ open Fin
/--
A `NicePerm N` is a structure containing the permutations that satisfy the problem's conditions.
- `toPerm`: The permutation `a` of `{0, ..., N}`.
- `distPerm`: The permutation of `{1, ..., N}` given by the absolute differences.
- `distPerm_spec`: The proof that the differences `|aα΅’ - aα΅’ββ|` match the `distPerm`.
-/
structure NicePerm (N : β) where
toPerm : Equiv (Fin (N + 1)) (Fin (N + 1))
distPerm : Equiv (Fin N) (Fin N)
distPerm_spec : β i : Fin N,
Nat.dist (toPerm i.castSucc).val (toPerm i.succ).val = (distPerm i).val + 1
theorem imo_sl_2023_A5 (N : β) (p : NicePerm N) :
(if N = 0 then 0 else (N + 1) / 4 + 1) β€ max (p.toPerm (last N)).val (p.toPerm 0).val := by sorry
|
algebra
|
imo_sl_2023_N2
| true |
[
"number theory"
] |
2023_N2
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2023 N2
Find all pairs $(a, p) β β^2$ with $a > 0$ and $p$ prime
such that $p^a + a^4$ is a perfect square.
-/
|
def good (a p : β) := β b, p ^ a + a ^ 4 = b ^ 2
theorem imo_sl_2023_N2 {a p : β} (ha : 0 < a) (hp : p.Prime) :
good a p β p = 3 β§ (a = 1 β¨ a = 2 β¨ a = 6 β¨ a = 9) := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2023 N2
Find all pairs $(a, p) β β^2$ with $a > 0$ and $p$ prime
such that $p^a + a^4$ is a perfect square.
-/
def good (a p : β) := β b, p ^ a + a ^ 4 = b ^ 2
theorem imo_sl_2023_N2 {a p : β} (ha : 0 < a) (hp : p.Prime) :
good a p β p = 3 β§ (a = 1 β¨ a = 2 β¨ a = 6 β¨ a = 9) := by sorry
|
number theory
|
imo_sl_2023_N3
| true |
[
"number theory"
] |
2023_N3
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2023 N3
For any positive integer $n$ and $k β₯ 2$, define $Ξ½_k(n)$
as the largest exponent $r$ such that $k^r β£ n$.
Prove the following:
1. there are infinitely many $n$ such that $Ξ½_{10}(n!) > Ξ½_9(n!)$; and
2. there are infinitely many $n$ such that $Ξ½_{10}(n!) < Ξ½_9(n!)$.
-/
|
theorem imo_sl_2023_N3 (N : β) :
(β n > N, padicValNat 9 n.factorial < padicValNat 10 n.factorial) β§
(β n > N, padicValNat 10 n.factorial < padicValNat 9 n.factorial) := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2023 N3
For any positive integer $n$ and $k β₯ 2$, define $Ξ½_k(n)$
as the largest exponent $r$ such that $k^r β£ n$.
Prove the following:
1. there are infinitely many $n$ such that $Ξ½_{10}(n!) > Ξ½_9(n!)$; and
2. there are infinitely many $n$ such that $Ξ½_{10}(n!) < Ξ½_9(n!)$.
-/
theorem imo_sl_2023_N3 (N : β) :
(β n > N, padicValNat 9 n.factorial < padicValNat 10 n.factorial) β§
(β n > N, padicValNat 10 n.factorial < padicValNat 9 n.factorial) := by sorry
|
number theory
|
imo_sl_2023_N4
| true |
[
"number theory"
] |
2023_N4
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2023 N4
Let $a_0, a_1, β¦, a_{n - 1}, b_0, b_1, β¦, b_{n - 1} β β^+$ and
$D$ be a positive integer such that for each $i β€ n$,
$$ b_0 b_1 β¦ b_i a_{i + 1} β¦ a_{n - 1} = b_0 b_1 β¦ b_{i - 1} a_i β¦ a_{n - 1} + D. $$
Determine the smallest possible value of $D$.
-/
|
/- special open -/ open Finset
structure goodSeq (n : β) where
a : β β β
a_pos : β i, 0 < a i
b : β β β
b_pos : β i, 0 < b i
D : β
D_pos : 0 < D
spec : β i < n, (range (i + 1)).prod b * (Ico (i + 1) n).prod a
= (range i).prod b * (Ico i n).prod a + D
theorem imo_sl_2023_N4 (n : β) : IsLeast (Set.range (goodSeq.D (n := n))) n.factorial := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2023 N4
Let $a_0, a_1, β¦, a_{n - 1}, b_0, b_1, β¦, b_{n - 1} β β^+$ and
$D$ be a positive integer such that for each $i β€ n$,
$$ b_0 b_1 β¦ b_i a_{i + 1} β¦ a_{n - 1} = b_0 b_1 β¦ b_{i - 1} a_i β¦ a_{n - 1} + D. $$
Determine the smallest possible value of $D$.
-/
/- special open -/ open Finset
structure goodSeq (n : β) where
a : β β β
a_pos : β i, 0 < a i
b : β β β
b_pos : β i, 0 < b i
D : β
D_pos : 0 < D
spec : β i < n, (range (i + 1)).prod b * (Ico (i + 1) n).prod a
= (range i).prod b * (Ico i n).prod a + D
theorem imo_sl_2023_N4 (n : β) : IsLeast (Set.range (goodSeq.D (n := n))) n.factorial := by sorry
|
number theory
|
imo_sl_2023_N5
| true |
[
"number theory"
] |
2023_N5
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2023 N5
Let $(a_n)_{n \ge 0}$ be a strictly increasing sequence of positive integers such that:
* For all $k \ge 1$, $a_k$ divides $2(a_0 + a_1 + \dots + a_{k - 1})$.
* For each prime $p$, there exists some $k$ such that $p$ divides $a_k$.
Prove that for any positive integer $n$, there exists some $k$ such that $n$ divides $a_k$.
-/
|
/- special open -/ open Finset
structure GoodSeq where
a : β β β
a_strictMono : StrictMono a
a_pos : β k, 0 < a k
a_spec : β k, a k β£ 2 * β i β range k, a i
exists_dvd_a_of_prime : β p : β, p.Prime β β k, p β£ a k
theorem imo_sl_2023_N5 (X : GoodSeq) (N : β) (hN : 0 < N) :
β k, N β£ X.a k := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2023 N5
Let $(a_n)_{n \ge 0}$ be a strictly increasing sequence of positive integers such that:
* For all $k \ge 1$, $a_k$ divides $2(a_0 + a_1 + \dots + a_{k - 1})$.
* For each prime $p$, there exists some $k$ such that $p$ divides $a_k$.
Prove that for any positive integer $n$, there exists some $k$ such that $n$ divides $a_k$.
-/
/- special open -/ open Finset
structure GoodSeq where
a : β β β
a_strictMono : StrictMono a
a_pos : β k, 0 < a k
a_spec : β k, a k β£ 2 * β i β range k, a i
exists_dvd_a_of_prime : β p : β, p.Prime β β k, p β£ a k
theorem imo_sl_2023_N5 (X : GoodSeq) (N : β) (hN : 0 < N) :
β k, N β£ X.a k := by sorry
|
number theory
|
imo_sl_2023_N6
| true |
[
"number theory"
] |
2023_N6
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2023 N6
A sequence $(a_n)_{n β₯ 0}$ is called *kawaii* if $a_0 = 0$, $a_1 = 1$, and for any $n β β$,
$$ a_{n + 2} + 2 a_n = 3 a_{n + 1} \text{ or } a_{n + 2} + 3 a_n = 4 a_{n + 1}. $$
A non-negative integer $m$ is said to be *kawaii* if it belongs to some kawaii sequence.
Let $m β β$ such that both $m$ and $m + 1$ are kawaii.
Prove that $3 β£ m$ and $m/3$ belongs to a kawaii sequence.
-/
|
@[ext] structure KawaiiSequence (S : Set β) where
a : β β β
a_zero : a 0 = 0
a_one : a 1 = 1
a_step : β n, β c : S, a (n + 2) + c * a n = (c + 1) * a (n + 1)
theorem imo_sl_2023_N6 (hn : β (X : KawaiiSequence {2, 3}) (k : β), n = X.a k)
(hn0 : β (X : KawaiiSequence {2, 3}) (k : β), n + 1 = X.a k) :
β m, (β (X : KawaiiSequence {2, 3}) (k : β), m = X.a k) β§ n = 3 * m := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2023 N6
A sequence $(a_n)_{n β₯ 0}$ is called *kawaii* if $a_0 = 0$, $a_1 = 1$, and for any $n β β$,
$$ a_{n + 2} + 2 a_n = 3 a_{n + 1} \text{ or } a_{n + 2} + 3 a_n = 4 a_{n + 1}. $$
A non-negative integer $m$ is said to be *kawaii* if it belongs to some kawaii sequence.
Let $m β β$ such that both $m$ and $m + 1$ are kawaii.
Prove that $3 β£ m$ and $m/3$ belongs to a kawaii sequence.
-/
@[ext] structure KawaiiSequence (S : Set β) where
a : β β β
a_zero : a 0 = 0
a_one : a 1 = 1
a_step : β n, β c : S, a (n + 2) + c * a n = (c + 1) * a (n + 1)
theorem imo_sl_2023_N6 (hn : β (X : KawaiiSequence {2, 3}) (k : β), n = X.a k)
(hn0 : β (X : KawaiiSequence {2, 3}) (k : β), n + 1 = X.a k) :
β m, (β (X : KawaiiSequence {2, 3}) (k : β), m = X.a k) β§ n = 3 * m := by sorry
|
number theory
|
imo_sl_2023_N7
| true |
[
"number theory"
] |
2023_N7
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
|
/-!
# IMO 2023 N7
Find all possible values of $a + b + c + d$ across all $a, b, c, d β β^+$ satisfying
$$ \frac{ab}{a + b} + \frac{cd}{c + d} = \frac{(a + b)(c + d)}{a + b + c + d}. $$
-/
|
class nice (a b c d : β) : Prop where
a_pos : 0 < a
b_pos : 0 < b
c_pos : 0 < c
d_pos : 0 < d
spec : ((a * b : β) : β) / (a + b : β) + (c * d : β) / (c + d : β)
= (a + b : β) * (c + d : β) / (a + b + c + d : β)
theorem imo_sl_2023_N7 (hn : 0 < n) :
(β a b c d, nice a b c d β§ a + b + c + d = n) β Β¬Squarefree n := by sorry
|
test
|
import Mathlib
import Aesop
set_option maxHeartbeats 0
open BigOperators Real Nat Topology Rat
/-!
# IMO 2023 N7
Find all possible values of $a + b + c + d$ across all $a, b, c, d β β^+$ satisfying
$$ \frac{ab}{a + b} + \frac{cd}{c + d} = \frac{(a + b)(c + d)}{a + b + c + d}. $$
-/
class nice (a b c d : β) : Prop where
a_pos : 0 < a
b_pos : 0 < b
c_pos : 0 < c
d_pos : 0 < d
spec : ((a * b : β) : β) / (a + b : β) + (c * d : β) / (c + d : β)
= (a + b : β) * (c + d : β) / (a + b + c + d : β)
theorem imo_sl_2023_N7 (hn : 0 < n) :
(β a b c d, nice a b c d β§ a + b + c + d = n) β Β¬Squarefree n := by sorry
|
number theory
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.