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.