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