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
Imo1993P5
true
[ "algebra" ]
Imo1993P5
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # International Mathematical Olympiad 1993, Problem 5 Does there exist a function f : ℕ → ℕ such that i) f(1) = 2 ii) f(f(n)) = f(n) + n for all n ∈ ℕ iii) f(n + 1) > f(n) for all n ∈ ℕ? -/
abbrev DoesExist : Bool := True abbrev Good (f : ℕ → ℕ) : Prop := f 1 = 2 ∧ ∀ n, f (f n) = f n + n ∧ ∀ n, f n < f (n + 1) theorem imo1993_p5 : if DoesExist then ∃ f, Good f else ¬∃ f, Good f := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # International Mathematical Olympiad 1993, Problem 5 Does there exist a function f : ℕ → ℕ such that i) f(1) = 2 ii) f(f(n)) = f(n) + n for all n ∈ ℕ iii) f(n + 1) > f(n) for all n ∈ ℕ? -/ abbrev DoesExist : Bool := True abbrev Good (f : ℕ → ℕ) : Prop := f 1 = 2 ∧ ∀ n, f (f n) = f n + n ∧ ∀ n, f n < f (n + 1) theorem imo1993_p5 : if DoesExist then ∃ f, Good f else ¬∃ f, Good f := by sorry
algebra
Imo1984P6
true
[ "number theory" ]
Imo1984P6
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # International Mathematical Olympiad 1984, Problem 6 Let a, b, c, and d be odd integers such that 0 < a < b < c < d and ad = bc. Prove that if a + d = 2ᵏ and b + c = 2ᵐ for some integers k and m, then a = 1. -/
theorem imo_1984_p6 (a b c d k m : ℕ) (h₀ : 0 < a ∧ 0 < b ∧ 0 < c ∧ 0 < d) (h₁ : Odd a ∧ Odd b ∧ Odd c ∧ Odd d) (h₂ : a < b ∧ b < c ∧ c < d) (h₃ : a * d = b * c) (h₄ : a + d = 2^k) (h₅ : b + c = 2^m) : a = 1 := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # International Mathematical Olympiad 1984, Problem 6 Let a, b, c, and d be odd integers such that 0 < a < b < c < d and ad = bc. Prove that if a + d = 2ᵏ and b + c = 2ᵐ for some integers k and m, then a = 1. -/ theorem imo_1984_p6 (a b c d k m : ℕ) (h₀ : 0 < a ∧ 0 < b ∧ 0 < c ∧ 0 < d) (h₁ : Odd a ∧ Odd b ∧ Odd c ∧ Odd d) (h₂ : a < b ∧ b < c ∧ c < d) (h₃ : a * d = b * c) (h₄ : a + d = 2^k) (h₅ : b + c = 2^m) : a = 1 := by sorry
number theory
Usa1982P4
true
[ "number theory" ]
Usa1982P4
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # USA Mathematical Olympiad 1982, Problem 4 Prove that there exists a positive integer k such that k⬝2ⁿ + 1 is composite for every integer n. -/
theorem usa1982_p4 : ∃ k : ℕ, 0 < k ∧ ∀ n : ℕ, ¬ Nat.Prime (k * (2 ^ n) + 1) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # USA Mathematical Olympiad 1982, Problem 4 Prove that there exists a positive integer k such that k⬝2ⁿ + 1 is composite for every integer n. -/ theorem usa1982_p4 : ∃ k : ℕ, 0 < k ∧ ∀ n : ℕ, ¬ Nat.Prime (k * (2 ^ n) + 1) := by sorry
number theory
Imo1988P6
true
[ "number theory" ]
Imo1988P6
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # International Mathematical Olympiad 1988, Problem 6 If a and b are two natural numbers such that a*b+1 divides a^2 + b^2, show that their quotient is a perfect square. -/
theorem imo1988_p6 {a b : ℕ} (h : a * b + 1 ∣ a ^ 2 + b ^ 2) : ∃ d, d ^ 2 = (a ^ 2 + b ^ 2) / (a * b + 1) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # International Mathematical Olympiad 1988, Problem 6 If a and b are two natural numbers such that a*b+1 divides a^2 + b^2, show that their quotient is a perfect square. -/ theorem imo1988_p6 {a b : ℕ} (h : a * b + 1 ∣ a ^ 2 + b ^ 2) : ∃ d, d ^ 2 = (a ^ 2 + b ^ 2) / (a * b + 1) := by sorry
number theory
Imo1992P1
true
[ "number theory" ]
Imo1992P1
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # International Mathematical Olympiad 1992, Problem 1 Find all integers 1 < a < b < c such that (a - 1)(b - 1)(c - 1) divides abc - 1. -/
abbrev solution_set : Set (ℤ × ℤ × ℤ) := {(2, 4, 8), (3, 5, 15)} theorem imo1992_p1 (a b c : ℤ) (ha : 1 < a) (hb : a < b) (hc : b < c) : ⟨a, b, c⟩ ∈ solution_set ↔ (a - 1) * (b - 1) * (c - 1) ∣ a * b * c - 1 := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # International Mathematical Olympiad 1992, Problem 1 Find all integers 1 < a < b < c such that (a - 1)(b - 1)(c - 1) divides abc - 1. -/ abbrev solution_set : Set (ℤ × ℤ × ℤ) := {(2, 4, 8), (3, 5, 15)} theorem imo1992_p1 (a b c : ℤ) (ha : 1 < a) (hb : a < b) (hc : b < c) : ⟨a, b, c⟩ ∈ solution_set ↔ (a - 1) * (b - 1) * (c - 1) ∣ a * b * c - 1 := by sorry
number theory
Usa1998P3
true
[ "algebra", "inequality" ]
Usa1998P3
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # USA Mathematical Olympiad 1998, Problem 3 Let a₀,a₁,...,aₙ be real numbers from the interval (0,π/2) such that tan(a₀ - π/4) + tan(a₁ - π/4) + ... + tan(aₙ - π/4) ≥ n - 1. Prove that tan(a₀)tan(a₁)...tan(aₙ) ≥ nⁿ⁺¹. -/
theorem usa1998_p3 (n : ℕ) (a : ℕ → ℝ) (ha : ∀ i ∈ Finset.range (n + 1), a i ∈ Set.Ioo 0 (Real.pi / 2)) (hs : n - 1 ≤ ∑ i ∈ Finset.range (n + 1), Real.tan (a i - (Real.pi / 4))) : n ^ (n + 1) ≤ ∏ i ∈ Finset.range (n + 1), Real.tan (a i) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # USA Mathematical Olympiad 1998, Problem 3 Let a₀,a₁,...,aₙ be real numbers from the interval (0,π/2) such that tan(a₀ - π/4) + tan(a₁ - π/4) + ... + tan(aₙ - π/4) ≥ n - 1. Prove that tan(a₀)tan(a₁)...tan(aₙ) ≥ nⁿ⁺¹. -/ theorem usa1998_p3 (n : ℕ) (a : ℕ → ℝ) (ha : ∀ i ∈ Finset.range (n + 1), a i ∈ Set.Ioo 0 (Real.pi / 2)) (hs : n - 1 ≤ ∑ i ∈ Finset.range (n + 1), Real.tan (a i - (Real.pi / 4))) : n ^ (n + 1) ≤ ∏ i ∈ Finset.range (n + 1), Real.tan (a i) := by sorry
algebra
Hungary1998P6
true
[ "algebra" ]
Hungary1998P6
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # Hungarian Mathematical Olympiad 1998, Problem 6 Let x, y, z be integers with z > 1. Show that (x + 1)² + (x + 2)² + ... + (x + 99)² ≠ yᶻ. -/
theorem hungary1998_p6 (x y : ℤ) (z : ℕ) (hz : 1 < z) : ∑ i ∈ Finset.range 99, (x + i + 1)^2 ≠ y^z := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # Hungarian Mathematical Olympiad 1998, Problem 6 Let x, y, z be integers with z > 1. Show that (x + 1)² + (x + 2)² + ... + (x + 99)² ≠ yᶻ. -/ theorem hungary1998_p6 (x y : ℤ) (z : ℕ) (hz : 1 < z) : ∑ i ∈ Finset.range 99, (x + i + 1)^2 ≠ y^z := by sorry
algebra
Imo1985P2
true
[ "combinatorics" ]
Imo1985P2
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # International Mathematical Olympiad 1985, Problem 5 Each of the numbers in the set $N=\{1, 2, 3, \dots, n-1\}$, where $n ≥ 3$, is colored with one of two colors, say red or black, so that: 1. $i$ and $n-i$ always receive the same color, and 2. for some $j ∈ N$ relatively prime to $n$, $i$ and $|j-i|$ receive the same color for all $i ∈ N, i ≠ j$. Prove that all numbers in $N$ must receive the same color. -/
/-- The conditions on the problem's coloring `C`. Although its domain is all of `ℕ`, we only care about its values in `Set.Ico 1 n`. -/ def Condition (n j : ℕ) (C : ℕ → Fin 2) : Prop := (∀ i ∈ Set.Ico 1 n, C i = C (n - i)) ∧ ∀ i ∈ Set.Ico 1 n, i ≠ j → C i = C (j - i : ℤ).natAbs theorem imo2001_p3 {n j : ℕ} (hn : 3 ≤ n) (hj : j ∈ Set.Ico 1 n) (cpj : Nat.Coprime n j) {C : ℕ → Fin 2} (hC : Condition n j C) {i : ℕ} (hi : i ∈ Set.Ico 1 n) : C i = C j := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # International Mathematical Olympiad 1985, Problem 5 Each of the numbers in the set $N=\{1, 2, 3, \dots, n-1\}$, where $n ≥ 3$, is colored with one of two colors, say red or black, so that: 1. $i$ and $n-i$ always receive the same color, and 2. for some $j ∈ N$ relatively prime to $n$, $i$ and $|j-i|$ receive the same color for all $i ∈ N, i ≠ j$. Prove that all numbers in $N$ must receive the same color. -/ /-- The conditions on the problem's coloring `C`. Although its domain is all of `ℕ`, we only care about its values in `Set.Ico 1 n`. -/ def Condition (n j : ℕ) (C : ℕ → Fin 2) : Prop := (∀ i ∈ Set.Ico 1 n, C i = C (n - i)) ∧ ∀ i ∈ Set.Ico 1 n, i ≠ j → C i = C (j - i : ℤ).natAbs theorem imo2001_p3 {n j : ℕ} (hn : 3 ≤ n) (hj : j ∈ Set.Ico 1 n) (cpj : Nat.Coprime n j) {C : ℕ → Fin 2} (hC : Condition n j C) {i : ℕ} (hi : i ∈ Set.Ico 1 n) : C i = C j := by sorry
combinatorics
Imo1982P3a
true
[ "algebra" ]
Imo1982P3a
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # International Mathematical Olympiad 1982, Problem 3 Consider infinite sequences $\{x_n \}$ of positive reals such that $x_0 = 0$ and $x_0 \geq x_1 \geq x_2 \geq ...$ a) Prove that for every such sequence there is an $n \geq 1$ such that: $\frac{x_0^2}{x_1} + \ldots + \frac{x_{n-1}^2}{x_n} \geq 3.999$ -/
theorem imo1982_q3a {x : ℕ → ℝ} (hx : Antitone x) (h0 : x 0 = 1) (hp : ∀ k, 0 < x k) : ∃ n : ℕ, 3.999 ≤ ∑ k ∈ Finset.range n, (x k) ^ 2 / x (k + 1) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # International Mathematical Olympiad 1982, Problem 3 Consider infinite sequences $\{x_n \}$ of positive reals such that $x_0 = 0$ and $x_0 \geq x_1 \geq x_2 \geq ...$ a) Prove that for every such sequence there is an $n \geq 1$ such that: $\frac{x_0^2}{x_1} + \ldots + \frac{x_{n-1}^2}{x_n} \geq 3.999$ -/ theorem imo1982_q3a {x : ℕ → ℝ} (hx : Antitone x) (h0 : x 0 = 1) (hp : ∀ k, 0 < x k) : ∃ n : ℕ, 3.999 ≤ ∑ k ∈ Finset.range n, (x k) ^ 2 / x (k + 1) := by sorry
algebra
Imo1983P5
false
[ "combinatorics" ]
Imo1983P5
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # International Mathematical Olympiad 1983, Problem 5 Is it possible to choose $1983$ distinct positive integers, all less than or equal to $10^5$, no three of which are consecutive terms of an arithmetic progression? Justify your answer. -/
theorem imo1983_p5 : ∃ S : Finset ℕ, S.card = 1983 ∧ (∀ x ∈ S, x ≤ 10^5) ∧ ∀ x ∈ S, ∀ y ∈ S, ∀ z ∈ S, x < y ∧ y < z → x + z ≠ 2 * y := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # International Mathematical Olympiad 1983, Problem 5 Is it possible to choose $1983$ distinct positive integers, all less than or equal to $10^5$, no three of which are consecutive terms of an arithmetic progression? Justify your answer. -/ theorem imo1983_p5 : ∃ S : Finset ℕ, S.card = 1983 ∧ (∀ x ∈ S, x ≤ 10^5) ∧ ∀ x ∈ S, ∀ y ∈ S, ∀ z ∈ S, x < y ∧ y < z → x + z ≠ 2 * y := by sorry
combinatorics
Imo1995P2
true
[ "algebra", "inequality" ]
Imo1995P2
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # International Mathematical Olympiad 1995, Problem 2 Let a, b, c be positive real numbers such that abc = 1. Show that 1 / (a³(b + c)) + 1 / (b³(c + a)) + 1 / (c³(a + b)) ≥ 3/2. -/
/- special open -/ open Finset theorem imo1995_p2 (a b c : ℝ) (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) (habc : a * b * c = 1) : 3 / 2 ≤ 1 / (a^3 * (b + c)) + 1 / (b^3 * (c + a)) + 1 / (c^3 * (a + b)) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # International Mathematical Olympiad 1995, Problem 2 Let a, b, c be positive real numbers such that abc = 1. Show that 1 / (a³(b + c)) + 1 / (b³(c + a)) + 1 / (c³(a + b)) ≥ 3/2. -/ /- special open -/ open Finset theorem imo1995_p2 (a b c : ℝ) (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) (habc : a * b * c = 1) : 3 / 2 ≤ 1 / (a^3 * (b + c)) + 1 / (b^3 * (c + a)) + 1 / (c^3 * (a + b)) := by sorry
algebra
Imo1982P1
true
[ "algebra" ]
Imo1982P1
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # International Mathematical Olympiad 1982, Problem 1 Let f be a function from positive integers to nonnegative integers such that 1) f(2) = 0 2) f(3) > 0 3) f(9999) = 3333 4) for all m,n > 0, f (m + n) - f (m) - f(n) = 1 or 0 Determine the value of f(1982). -/
abbrev solution_value : ℕ := 660 theorem imo1982_p1 (f : ℕ → ℕ) (h2 : f 2 = 0) (h3 : 0 < f 3) (h9999 : f 9999 = 3333) (hf : ∀ m n, 0 < m → 0 < n → f (m + n) = f m + f n ∨ f (m + n) = f m + f n + 1) : f 1982 = solution_value := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # International Mathematical Olympiad 1982, Problem 1 Let f be a function from positive integers to nonnegative integers such that 1) f(2) = 0 2) f(3) > 0 3) f(9999) = 3333 4) for all m,n > 0, f (m + n) - f (m) - f(n) = 1 or 0 Determine the value of f(1982). -/ abbrev solution_value : ℕ := 660 theorem imo1982_p1 (f : ℕ → ℕ) (h2 : f 2 = 0) (h3 : 0 < f 3) (h9999 : f 9999 = 3333) (hf : ∀ m n, 0 < m → 0 < n → f (m + n) = f m + f n ∨ f (m + n) = f m + f n + 1) : f 1982 = solution_value := by sorry
algebra
Imo1998P6
false
[ "algebra" ]
Imo1998P6
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # International Mathematical Olympiad 1998, Problem 6 Consider all functions f from the set of all positive integers into itself satisfying f(t^2f(s)) = sf(t)^2 for all s and t. Determine the least possible value of f(1998). -/
abbrev solution : ℕ+ := 120 theorem imo1998_p6 (f : ℕ+ → ℕ+) (h : ∀ s t, f (t^2 * f s) = s * (f t)^2) : IsLeast {n : ℕ | n = f 1998} solution := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # International Mathematical Olympiad 1998, Problem 6 Consider all functions f from the set of all positive integers into itself satisfying f(t^2f(s)) = sf(t)^2 for all s and t. Determine the least possible value of f(1998). -/ abbrev solution : ℕ+ := 120 theorem imo1998_p6 (f : ℕ+ → ℕ+) (h : ∀ s t, f (t^2 * f s) = s * (f t)^2) : IsLeast {n : ℕ | n = f 1998} solution := by sorry
algebra
Poland1998P4
true
[ "number theory" ]
Poland1998P4
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! Polish Mathematical Olympiad 1998, Problem 4 Prove that the sequence {a_n} defined by a_1 = 1 and a_n = a_{n - 1} + a_{⌊n/2⌋} n = 2,3,4,... contains infinitely many integers divisible by 7. -/
def a : ℕ → ℕ | 0 => 1 -- unused dummy value | 1 => 1 | Nat.succ n => have _ : (n.succ / 2) < n.succ := Nat.div_lt_self' n 0 a n + a (n.succ / 2) theorem poland1998_p4 : Set.Infinite { n | 7 ∣ a n } := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! Polish Mathematical Olympiad 1998, Problem 4 Prove that the sequence {a_n} defined by a_1 = 1 and a_n = a_{n - 1} + a_{⌊n/2⌋} n = 2,3,4,... contains infinitely many integers divisible by 7. -/ def a : ℕ → ℕ | 0 => 1 -- unused dummy value | 1 => 1 | Nat.succ n => have _ : (n.succ / 2) < n.succ := Nat.div_lt_self' n 0 a n + a (n.succ / 2) theorem poland1998_p4 : Set.Infinite { n | 7 ∣ a n } := by sorry
number theory
Imo2011P3
true
[ "algebra" ]
Imo2011P3
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # International Mathematical Olympiad 2011, Problem 3 Let f : ℝ → ℝ be a function that satisfies f(x + y) ≤ y * f(x) + f(f(x)) for all x and y. Prove that f(x) = 0 for all x ≤ 0. -/
theorem imo2011_p3 (f : ℝ → ℝ) (hf : ∀ x y, f (x + y) ≤ y * f x + f (f x)) : ∀ x ≤ 0, f x = 0 := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # International Mathematical Olympiad 2011, Problem 3 Let f : ℝ → ℝ be a function that satisfies f(x + y) ≤ y * f(x) + f(f(x)) for all x and y. Prove that f(x) = 0 for all x ≤ 0. -/ theorem imo2011_p3 (f : ℝ → ℝ) (hf : ∀ x y, f (x + y) ≤ y * f x + f (f x)) : ∀ x ≤ 0, f x = 0 := by sorry
algebra
Imo2024P6
true
[ "algebra" ]
Imo2024P6
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # International Mathematical Olympiad 2024, Problem 6 A function `f: ℚ → ℚ` is called *aquaesulian* if the following property holds: for every `x, y ∈ ℚ`, `f(x + f(y)) = f(x) + y` or `f(f(x) + y) = x + f(y)`. Show that there exists an integer `c` such that for any aquaesulian function `f` there are at most `c` different rational numbers of the form `f(r)+f(-r)` for some rational number `r`, and find the smallest possible value of `c`. -/
/- special open -/ open Cardinal def Aquaesulian (f : ℚ → ℚ) : Prop := ∀ x y, f (x + f y) = f x + y ∨ f (f x + y) = x + f y abbrev solution : ℕ := 2 theorem imo2024_p6 : (∀ f, Aquaesulian f → #(Set.range (fun x ↦ f x + f (-x))) ≤ solution) ∧ ∀ c : ℕ, (∀ f, Aquaesulian f → #(Set.range (fun x ↦ f x + f (-x))) ≤ c) → solution ≤ c := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # International Mathematical Olympiad 2024, Problem 6 A function `f: ℚ → ℚ` is called *aquaesulian* if the following property holds: for every `x, y ∈ ℚ`, `f(x + f(y)) = f(x) + y` or `f(f(x) + y) = x + f(y)`. Show that there exists an integer `c` such that for any aquaesulian function `f` there are at most `c` different rational numbers of the form `f(r)+f(-r)` for some rational number `r`, and find the smallest possible value of `c`. -/ /- special open -/ open Cardinal def Aquaesulian (f : ℚ → ℚ) : Prop := ∀ x y, f (x + f y) = f x + y ∨ f (f x + y) = x + f y abbrev solution : ℕ := 2 theorem imo2024_p6 : (∀ f, Aquaesulian f → #(Set.range (fun x ↦ f x + f (-x))) ≤ solution) ∧ ∀ c : ℕ, (∀ f, Aquaesulian f → #(Set.range (fun x ↦ f x + f (-x))) ≤ c) → solution ≤ c := by sorry
algebra
Imo1972P4
false
[ "algebra" ]
Imo1972P4
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # International Mathematical Olympiad 1972, Problem 4 Find all positive real solutions to: (x_1^2 - x_3x_5)(x_2^2 - x_3x_5) ≤ 0 (x_2^2 - x_4x_1)(x_3^2 - x_4x_1) ≤ 0 (x_3^2 - x_5x_2)(x_4^2 - x_5x_2) ≤ 0 (x_4^2 - x_1x_3)(x_5^2 - x_1x_3) ≤ 0 (x_5^2 - x_2x_4)(x_1^2 - x_2x_4) ≤ 0 -/
abbrev solution_set : Set (ℝ × ℝ × ℝ × ℝ × ℝ) := {(a, b, c, d, e) | a = b ∧ b = c ∧ c = d ∧ d = e} theorem imo1972_p4 (a b c d e : ℝ) (h₀ : 0 < a ∧ 0 < b ∧ 0 < c ∧ 0 < d ∧ 0 < e): (a^2 - c * e) * (b^2 - c * e) ≤ 0 ∧ (b^2 - d * a) * (c^2 - d * a) ≤ 0 ∧ (c^2 - e * b) * (d^2 - e * b) ≤ 0 ∧ (d^2 - a * c) * (e^2 - a * c) ≤ 0 ∧ (e^2 - b * d) * (a^2 - b * d) ≤ 0 ↔ (a, b, c, d, e) ∈ solution_set := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # International Mathematical Olympiad 1972, Problem 4 Find all positive real solutions to: (x_1^2 - x_3x_5)(x_2^2 - x_3x_5) ≤ 0 (x_2^2 - x_4x_1)(x_3^2 - x_4x_1) ≤ 0 (x_3^2 - x_5x_2)(x_4^2 - x_5x_2) ≤ 0 (x_4^2 - x_1x_3)(x_5^2 - x_1x_3) ≤ 0 (x_5^2 - x_2x_4)(x_1^2 - x_2x_4) ≤ 0 -/ abbrev solution_set : Set (ℝ × ℝ × ℝ × ℝ × ℝ) := {(a, b, c, d, e) | a = b ∧ b = c ∧ c = d ∧ d = e} theorem imo1972_p4 (a b c d e : ℝ) (h₀ : 0 < a ∧ 0 < b ∧ 0 < c ∧ 0 < d ∧ 0 < e): (a^2 - c * e) * (b^2 - c * e) ≤ 0 ∧ (b^2 - d * a) * (c^2 - d * a) ≤ 0 ∧ (c^2 - e * b) * (d^2 - e * b) ≤ 0 ∧ (d^2 - a * c) * (e^2 - a * c) ≤ 0 ∧ (e^2 - b * d) * (a^2 - b * d) ≤ 0 ↔ (a, b, c, d, e) ∈ solution_set := by sorry
algebra
Usa2022P4
true
[ "number theory" ]
Usa2022P4
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # USA Mathematical Olympiad 2022, Problem 4 Determine all pairs of primes (p, q) where p - q and pq - q are both perfect squares. -/
abbrev solution_set : Set (ℕ × ℕ) := {(3, 2)} theorem usa2022_p4 (p q : ℕ) : (p, q) ∈ solution_set ↔ p.Prime ∧ q.Prime ∧ ∃ a, a^2 + q = p ∧ ∃ b, b^2 + q = p * q := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # USA Mathematical Olympiad 2022, Problem 4 Determine all pairs of primes (p, q) where p - q and pq - q are both perfect squares. -/ abbrev solution_set : Set (ℕ × ℕ) := {(3, 2)} theorem usa2022_p4 (p q : ℕ) : (p, q) ∈ solution_set ↔ p.Prime ∧ q.Prime ∧ ∃ a, a^2 + q = p ∧ ∃ b, b^2 + q = p * q := by sorry
number theory
Imo2019P4
true
[ "number theory" ]
Imo2019P4
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # International Mathematical Olympiad 2019, Problem 4 Determine all positive integers n,k that satisfy the equation k! = (2ⁿ - 2⁰)(2ⁿ - 2¹) ... (2ⁿ - 2ⁿ⁻¹). -/
abbrev solution_set : Set (ℕ × ℕ) := { (1,1), (2,3) } theorem imo2018_p2 (n k : ℕ) : (n, k) ∈ solution_set ↔ 0 < n ∧ 0 < k ∧ (k ! : ℤ) = ∏ i ∈ Finset.range n, ((2:ℤ)^n - (2:ℤ)^i) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # International Mathematical Olympiad 2019, Problem 4 Determine all positive integers n,k that satisfy the equation k! = (2ⁿ - 2⁰)(2ⁿ - 2¹) ... (2ⁿ - 2ⁿ⁻¹). -/ abbrev solution_set : Set (ℕ × ℕ) := { (1,1), (2,3) } theorem imo2018_p2 (n k : ℕ) : (n, k) ∈ solution_set ↔ 0 < n ∧ 0 < k ∧ (k ! : ℤ) = ∏ i ∈ Finset.range n, ((2:ℤ)^n - (2:ℤ)^i) := by sorry
number theory
Imo1959P1
true
[ "number theory" ]
Imo1959P1
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # International Mathematical Olympiad 1959, Problem 1. Prove that the fraction `(21n+4)/(14n+3)` is irreducible for every natural number `n`. -/
/- Since Lean doesn't have a concept of "irreducible fractions" per se, we just formalize this as saying the numerator and denominator are relatively prime. -/ theorem imo1959_p1 : ∀ n : ℕ, Nat.Coprime (21 * n + 4) (14 * n + 3) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # International Mathematical Olympiad 1959, Problem 1. Prove that the fraction `(21n+4)/(14n+3)` is irreducible for every natural number `n`. -/ /- Since Lean doesn't have a concept of "irreducible fractions" per se, we just formalize this as saying the numerator and denominator are relatively prime. -/ theorem imo1959_p1 : ∀ n : ℕ, Nat.Coprime (21 * n + 4) (14 * n + 3) := by sorry
number theory
Bulgaria1998P1
false
[ "combinatorics" ]
Bulgaria1998P1
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # Bulgarian Mathematical Olympiad 1998, Problem 1 We will be considering colorings in 2 colors of n (distinct) points A₁, A₂, ..., Aₙ. Call such a coloring "good" if there exist three points Aᵢ, Aⱼ, A₂ⱼ₋ᵢ, 1 ≤ i < 2j - i ≤ n, which are colored the same color. Find the least natural number n (n ≥ 3) such that all colorings of n points are good. -/
abbrev coloring_is_good {m : ℕ} (color : Set.Icc 1 m → Fin 2) : Prop := ∃ i j : Set.Icc 1 m, i < j ∧ ∃ h3 : 2 * j.val - i ∈ Set.Icc 1 m, color i = color j ∧ color i = color ⟨2 * j - i, h3⟩ abbrev all_colorings_are_good (m : ℕ) : Prop := 3 ≤ m ∧ ∀ color : Set.Icc 1 m → Fin 2, coloring_is_good color abbrev solution_value : ℕ := 9 theorem bulgaria1998_p1 : IsLeast { m | all_colorings_are_good m } solution_value := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # Bulgarian Mathematical Olympiad 1998, Problem 1 We will be considering colorings in 2 colors of n (distinct) points A₁, A₂, ..., Aₙ. Call such a coloring "good" if there exist three points Aᵢ, Aⱼ, A₂ⱼ₋ᵢ, 1 ≤ i < 2j - i ≤ n, which are colored the same color. Find the least natural number n (n ≥ 3) such that all colorings of n points are good. -/ abbrev coloring_is_good {m : ℕ} (color : Set.Icc 1 m → Fin 2) : Prop := ∃ i j : Set.Icc 1 m, i < j ∧ ∃ h3 : 2 * j.val - i ∈ Set.Icc 1 m, color i = color j ∧ color i = color ⟨2 * j - i, h3⟩ abbrev all_colorings_are_good (m : ℕ) : Prop := 3 ≤ m ∧ ∀ color : Set.Icc 1 m → Fin 2, coloring_is_good color abbrev solution_value : ℕ := 9 theorem bulgaria1998_p1 : IsLeast { m | all_colorings_are_good m } solution_value := by sorry
combinatorics
Imo2009P5
true
[ "algebra" ]
Imo2009P5
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # International Mathematical Olympiad 2009, Problem 5 Determine all functions f: ℤ>0 → ℤ>0 such that for all positive integers a and b, the numbers a, f(b), and f(b + f(a) - 1) form the sides of a nondegenerate triangle. -/
abbrev solution_set : Set (ℕ+ → ℕ+) := { id } theorem imo2009_p5 (f : ℕ+ → ℕ+) : f ∈ solution_set ↔ ∀ a b, (f (b + f a - 1) < f b + a ∧ a < f b + f (b + f a - 1) ∧ f b < f (b + f a - 1) + a) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # International Mathematical Olympiad 2009, Problem 5 Determine all functions f: ℤ>0 → ℤ>0 such that for all positive integers a and b, the numbers a, f(b), and f(b + f(a) - 1) form the sides of a nondegenerate triangle. -/ abbrev solution_set : Set (ℕ+ → ℕ+) := { id } theorem imo2009_p5 (f : ℕ+ → ℕ+) : f ∈ solution_set ↔ ∀ a b, (f (b + f a - 1) < f b + a ∧ a < f b + f (b + f a - 1) ∧ f b < f (b + f a - 1) + a) := by sorry
algebra
Imo2023P4
true
[ "algebra" ]
Imo2023P4
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # International Mathematical Olympiad 2023, Problem 4 Let x₁, x₂, ... x₂₀₂₃ be distinct positive real numbers. Define aₙ := √((x₁ + x₂ + ... + xₙ)(1/x₁ + 1/x₂ + ... + 1/xₙ)). Suppose that aₙ is an integer for all n ∈ {1,...,2023}. Prove that 3034 ≤ a₂₀₂₃. -/
noncomputable def a (x : Finset.Icc 1 2023 → ℝ) (n : Finset.Icc 1 2023) : ℝ := √((∑ i ∈ Finset.univ.filter (· ≤ n), x i) * (∑ i ∈ Finset.univ.filter (· ≤ n), (1 / x i))) theorem imo2023_p4 (x : Finset.Icc 1 2023 → ℝ) (hxp : ∀ i, 0 < x i) (hxi : x.Injective) (hxa : ∀ i : Finset.Icc 1 2023, ∃ k : ℤ, a x i = k) : 3034 ≤ a x ⟨2023, by simp⟩ := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # International Mathematical Olympiad 2023, Problem 4 Let x₁, x₂, ... x₂₀₂₃ be distinct positive real numbers. Define aₙ := √((x₁ + x₂ + ... + xₙ)(1/x₁ + 1/x₂ + ... + 1/xₙ)). Suppose that aₙ is an integer for all n ∈ {1,...,2023}. Prove that 3034 ≤ a₂₀₂₃. -/ noncomputable def a (x : Finset.Icc 1 2023 → ℝ) (n : Finset.Icc 1 2023) : ℝ := √((∑ i ∈ Finset.univ.filter (· ≤ n), x i) * (∑ i ∈ Finset.univ.filter (· ≤ n), (1 / x i))) theorem imo2023_p4 (x : Finset.Icc 1 2023 → ℝ) (hxp : ∀ i, 0 < x i) (hxi : x.Injective) (hxa : ∀ i : Finset.Icc 1 2023, ∃ k : ℤ, a x i = k) : 3034 ≤ a x ⟨2023, by simp⟩ := by sorry
algebra
Imo1963P1
true
[ "algebra" ]
Imo1963P1
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # International Mathematical Olympiad 1963, Problem 1 Find all real roots of the equation √(x²-p) + 2√(x²-1) = x where *p* is a real parameter. -/
abbrev f (p : ℝ) : Set ℝ := if p ≥ 0 ∧ p ≤ (4 : ℝ) / 3 then { (4 - p) / (2 * Real.sqrt (4 - 2 * p)) } else ∅ theorem imo1963_p1 : ∀ (p x : ℝ), (x ^ 2 - p) ≥ 0 → (x ^ 2 - 1) ≥ 0 → (Real.sqrt (x ^ 2 - p) + 2 * Real.sqrt (x ^ 2 - 1) = x ↔ (x ∈ f p)) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # International Mathematical Olympiad 1963, Problem 1 Find all real roots of the equation √(x²-p) + 2√(x²-1) = x where *p* is a real parameter. -/ abbrev f (p : ℝ) : Set ℝ := if p ≥ 0 ∧ p ≤ (4 : ℝ) / 3 then { (4 - p) / (2 * Real.sqrt (4 - 2 * p)) } else ∅ theorem imo1963_p1 : ∀ (p x : ℝ), (x ^ 2 - p) ≥ 0 → (x ^ 2 - 1) ≥ 0 → (Real.sqrt (x ^ 2 - p) + 2 * Real.sqrt (x ^ 2 - 1) = x ↔ (x ∈ f p)) := by sorry
algebra
Usa2024P2
false
[ "combinatorics" ]
Usa2024P2
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # USA Mathematical Olympiad 2024, Problem 2 Let S₁, S₂, ..., Sₙ be finite sets of integers whose intersection is not empty. For each non-empty T ⊆ {S₁, S₂, ..., Sₙ}, the size of the intersection of the sets in T is a multiple of the number of sets in T. What is the least possible number of elements that are in at least 50 sets? -/
abbrev solution : ℕ := 50 * Nat.choose 100 50 structure Good (S : Fin 100 → Set ℤ) : Prop where finite : ∀ i, (S i).Finite nonempty_inter : ⋂ i, S i ≠ ∅ card : ∀ T : Finset (Fin 100), T.Nonempty → ∃ k : ℕ, (⋂ i ∈ T, S i).ncard * k = T.card -- z is in at least k of the sets S. abbrev InAtLeastKSubsets (S : Fin 100 → Set ℤ) (k : ℕ) (z : ℤ) : Prop := k ≤ {i : Fin 100 | z ∈ S i }.ncard theorem usa2024_p2 (n : ℕ) : IsLeast { k | ∃ S, Good S ∧ k = {z : ℤ | InAtLeastKSubsets S k z }.ncard } solution := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # USA Mathematical Olympiad 2024, Problem 2 Let S₁, S₂, ..., Sₙ be finite sets of integers whose intersection is not empty. For each non-empty T ⊆ {S₁, S₂, ..., Sₙ}, the size of the intersection of the sets in T is a multiple of the number of sets in T. What is the least possible number of elements that are in at least 50 sets? -/ abbrev solution : ℕ := 50 * Nat.choose 100 50 structure Good (S : Fin 100 → Set ℤ) : Prop where finite : ∀ i, (S i).Finite nonempty_inter : ⋂ i, S i ≠ ∅ card : ∀ T : Finset (Fin 100), T.Nonempty → ∃ k : ℕ, (⋂ i ∈ T, S i).ncard * k = T.card -- z is in at least k of the sets S. abbrev InAtLeastKSubsets (S : Fin 100 → Set ℤ) (k : ℕ) (z : ℤ) : Prop := k ≤ {i : Fin 100 | z ∈ S i }.ncard theorem usa2024_p2 (n : ℕ) : IsLeast { k | ∃ S, Good S ∧ k = {z : ℤ | InAtLeastKSubsets S k z }.ncard } solution := by sorry
combinatorics
Imo2008P2b
true
[ "algebra" ]
Imo2008P2b
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # International Mathematical Olympiad 2008, Problem 2 ``` x^2 / (x-1)^2 + y^2 / (y-1)^2 + z^2 / (z-1)^2 ≥ 1 ``` (b) Prove that equality holds above for infinitely many triples of rational numbers `x`, `y`, `z`, each different from 1, and satisfying `xyz = 1`. -/
def rationalSolutions := {s : ℚ × ℚ × ℚ | ∃ x y z : ℚ, s = (x, y, z) ∧ x ≠ 1 ∧ y ≠ 1 ∧ z ≠ 1 ∧ x * y * z = 1 ∧ x ^ 2 / (x - 1) ^ 2 + y ^ 2 / (y - 1) ^ 2 + z ^ 2 / (z - 1) ^ 2 = 1} theorem imo2008_p2b : Set.Infinite rationalSolutions := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # International Mathematical Olympiad 2008, Problem 2 ``` x^2 / (x-1)^2 + y^2 / (y-1)^2 + z^2 / (z-1)^2 ≥ 1 ``` (b) Prove that equality holds above for infinitely many triples of rational numbers `x`, `y`, `z`, each different from 1, and satisfying `xyz = 1`. -/ def rationalSolutions := {s : ℚ × ℚ × ℚ | ∃ x y z : ℚ, s = (x, y, z) ∧ x ≠ 1 ∧ y ≠ 1 ∧ z ≠ 1 ∧ x * y * z = 1 ∧ x ^ 2 / (x - 1) ^ 2 + y ^ 2 / (y - 1) ^ 2 + z ^ 2 / (z - 1) ^ 2 = 1} theorem imo2008_p2b : Set.Infinite rationalSolutions := by sorry
algebra
Imo2001P2
true
[ "algebra", "inequality" ]
Imo2001P2
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # International Mathematical Olympiad 2001, Problem 2 Let a, b, c be positive reals. Prove that a / √(a² + 8bc) + b / √(b² + 8ca) + c / √(c² + 8ab) ≥ 1. -/
variable {a b c : ℝ} theorem imo2001_p2 (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : 1 ≤ a / Real.sqrt (a ^ 2 + 8 * b * c) + b / Real.sqrt (b ^ 2 + 8 * c * a) + c / Real.sqrt (c ^ 2 + 8 * a * b) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # International Mathematical Olympiad 2001, Problem 2 Let a, b, c be positive reals. Prove that a / √(a² + 8bc) + b / √(b² + 8ca) + c / √(c² + 8ab) ≥ 1. -/ variable {a b c : ℝ} theorem imo2001_p2 (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : 1 ≤ a / Real.sqrt (a ^ 2 + 8 * b * c) + b / Real.sqrt (b ^ 2 + 8 * c * a) + c / Real.sqrt (c ^ 2 + 8 * a * b) := by sorry
algebra
Imo2007P1a
false
[ "algebra" ]
Imo2007P1a
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # International Mathematical Olympiad 2007, Problem 1 Real numbers a₁, a₂, ..., aₙ are fixed. For each 1 ≤ i ≤ n, we let dᵢ = max {aⱼ : 1 ≤ j ≤ i} - min {aⱼ : i ≤ j ≤ n}, and let d = max {dᵢ : 1 ≤ i ≤ n}. (a) Prove that for any real numbers x₁ ≤ ... ≤ xₙ, we have max { |xᵢ - aᵢ| : 1 ≤ i ≤ n } ≥ d / 2. -/
noncomputable abbrev d {n : ℕ} (a : Fin n → ℝ) (i : Fin n) := (⨆ j : {j // j ≤ i}, a j - ⨅ j : {j // i ≤ j}, a j) theorem imo2007_p1a {n : ℕ} (hn : 0 < n) {a x : Fin n → ℝ} (h : Monotone x) : (⨆ i, d a i) / 2 ≤ ⨆ i, |x i - a i| := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # International Mathematical Olympiad 2007, Problem 1 Real numbers a₁, a₂, ..., aₙ are fixed. For each 1 ≤ i ≤ n, we let dᵢ = max {aⱼ : 1 ≤ j ≤ i} - min {aⱼ : i ≤ j ≤ n}, and let d = max {dᵢ : 1 ≤ i ≤ n}. (a) Prove that for any real numbers x₁ ≤ ... ≤ xₙ, we have max { |xᵢ - aᵢ| : 1 ≤ i ≤ n } ≥ d / 2. -/ noncomputable abbrev d {n : ℕ} (a : Fin n → ℝ) (i : Fin n) := (⨆ j : {j // j ≤ i}, a j - ⨅ j : {j // i ≤ j}, a j) theorem imo2007_p1a {n : ℕ} (hn : 0 < n) {a x : Fin n → ℝ} (h : Monotone x) : (⨆ i, d a i) / 2 ≤ ⨆ i, |x i - a i| := by sorry
algebra
Singapore2019P11
true
[ "algebra" ]
Singapore2019P11
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # Singapore Math Olympiad (Senior) 2019 (Round 1), Problem 11 http://www.realsutra.com/limjeck/SMO_Senior_2019.pdf Find the value of 448 * (sin 12 degrees) * (sin 39 degrees) * (sin 51 degrees) / sin 24 degrees -/
noncomputable abbrev solution : ℝ := 112 theorem singapore2019_r1_p11 : 448 * Real.sin (12 * Real.pi / 180) * Real.sin (39 * Real.pi / 180) * Real.sin (51 * Real.pi / 180) / Real.sin (24 * Real.pi / 180) = solution := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # Singapore Math Olympiad (Senior) 2019 (Round 1), Problem 11 http://www.realsutra.com/limjeck/SMO_Senior_2019.pdf Find the value of 448 * (sin 12 degrees) * (sin 39 degrees) * (sin 51 degrees) / sin 24 degrees -/ noncomputable abbrev solution : ℝ := 112 theorem singapore2019_r1_p11 : 448 * Real.sin (12 * Real.pi / 180) * Real.sin (39 * Real.pi / 180) * Real.sin (51 * Real.pi / 180) / Real.sin (24 * Real.pi / 180) = solution := by sorry
algebra
imo_sl_2006_A1
true
[ "algebra" ]
2006_A1
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2006 A1 Let $R$ be an archimedean ring with floor. Define the function $f : R → R$ by $$ f(x) = ⌊x⌋ (x - ⌊x⌋). $$ Prove that for any $r ∈ R$, there exists $N ∈ ℕ$ such that for all $k ≥ N$, $$ f^{k + 2}(r) = f^k(r). $$ -/
/- special open -/ open Finset abbrev f [LinearOrderedRing R] [FloorRing R] (r : R) := ⌈r⌉ * (r - ⌈r⌉) theorem imo_sl_2006_A1 [LinearOrderedRing R] [FloorRing R] [Archimedean R] (r : R) : ∃ N, ∀ n ≥ N, f^[n + 2] r = f^[n] r := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2006 A1 Let $R$ be an archimedean ring with floor. Define the function $f : R → R$ by $$ f(x) = ⌊x⌋ (x - ⌊x⌋). $$ Prove that for any $r ∈ R$, there exists $N ∈ ℕ$ such that for all $k ≥ N$, $$ f^{k + 2}(r) = f^k(r). $$ -/ /- special open -/ open Finset abbrev f [LinearOrderedRing R] [FloorRing R] (r : R) := ⌈r⌉ * (r - ⌈r⌉) theorem imo_sl_2006_A1 [LinearOrderedRing R] [FloorRing R] [Archimedean R] (r : R) : ∃ N, ∀ n ≥ N, f^[n + 2] r = f^[n] r := by sorry
algebra
imo_sl_2006_A2
true
[ "algebra" ]
2006_A2
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2006 A2 Consider the sequence $(a_n)_{n ≥ 0}$ of rational nuimbers defined by $a_0 = 1$ and $$ a_n = -\sum_{k = 0}^{n - 1} \frac{a_k}{n + 1 - k}. $$ Prove that $a_n > 0$ for all $n ≠ 0$. -/
/- special open -/ open Finset def a : ℕ → ℚ | 0 => -1 | n + 1 => -(univ : Finset (Fin (n + 1))).sum λ i ↦ a i / (n + 2 - i : ℕ) theorem imo_sl_2006_A2 (h : n ≠ 0) : 0 < a n := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2006 A2 Consider the sequence $(a_n)_{n ≥ 0}$ of rational nuimbers defined by $a_0 = 1$ and $$ a_n = -\sum_{k = 0}^{n - 1} \frac{a_k}{n + 1 - k}. $$ Prove that $a_n > 0$ for all $n ≠ 0$. -/ /- special open -/ open Finset def a : ℕ → ℚ | 0 => -1 | n + 1 => -(univ : Finset (Fin (n + 1))).sum λ i ↦ a i / (n + 2 - i : ℕ) theorem imo_sl_2006_A2 (h : n ≠ 0) : 0 < a n := by sorry
algebra
imo_sl_2006_A4
true
[ "algebra" ]
2006_A4
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2006 A4 Let $F$ be a totally ordered field and $a_1, a_2, …, a_n ∈ F$ be positive. Prove the inequality $$ \sum_{i < j} \frac{a_i a_j}{a_i + a_j} ≤ \frac{n}{2(a_1 + a_2 + … + a_n)} \sum_{i < j} a_i a_j. $$ -/
theorem imo_sl_2006_A4 [LinearOrderedField F] [LinearOrder ι] (a : ι → F) {S : Finset ι} (hS : ∀ i ∈ S, 0 < a i) : let T := (S ×ˢ S).filter λ p ↦ p.1 < p.2 T.sum (λ p ↦ a p.1 * a p.2 / (a p.1 + a p.2)) ≤ S.card • T.sum (λ p ↦ a p.1 * a p.2) / (2 * S.sum a) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2006 A4 Let $F$ be a totally ordered field and $a_1, a_2, …, a_n ∈ F$ be positive. Prove the inequality $$ \sum_{i < j} \frac{a_i a_j}{a_i + a_j} ≤ \frac{n}{2(a_1 + a_2 + … + a_n)} \sum_{i < j} a_i a_j. $$ -/ theorem imo_sl_2006_A4 [LinearOrderedField F] [LinearOrder ι] (a : ι → F) {S : Finset ι} (hS : ∀ i ∈ S, 0 < a i) : let T := (S ×ˢ S).filter λ p ↦ p.1 < p.2 T.sum (λ p ↦ a p.1 * a p.2 / (a p.1 + a p.2)) ≤ S.card • T.sum (λ p ↦ a p.1 * a p.2) / (2 * S.sum a) := by sorry
algebra
imo_sl_2006_A6
true
[ "algebra" ]
2006_A6
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! International Mathematical Olympiad 2006, Problem 3 Find the smallest M ∈ ℝ such that for any a, b, c ∈ ℝ, |ab(a² - b²) + bc(b² - c²) + ca(c² - a²)| ≤ M(a² + b² + c²)². -/
def good [LinearOrderedCommRing R] (M : R) := ∀ a b c : R, |a * b * (a ^ 2 - b ^ 2) + b * c * (b ^ 2 - c ^ 2) + c * a * (c ^ 2 - a ^ 2)| ≤ M * (a ^ 2 + b ^ 2 + c ^ 2) ^ 2 theorem good_iff : good M ↔ 9 * √2 ≤ 32 * M := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! International Mathematical Olympiad 2006, Problem 3 Find the smallest M ∈ ℝ such that for any a, b, c ∈ ℝ, |ab(a² - b²) + bc(b² - c²) + ca(c² - a²)| ≤ M(a² + b² + c²)². -/ def good [LinearOrderedCommRing R] (M : R) := ∀ a b c : R, |a * b * (a ^ 2 - b ^ 2) + b * c * (b ^ 2 - c ^ 2) + c * a * (c ^ 2 - a ^ 2)| ≤ M * (a ^ 2 + b ^ 2 + c ^ 2) ^ 2 theorem good_iff : good M ↔ 9 * √2 ≤ 32 * M := by sorry
algebra
imo_sl_2006_N1
true
[ "number theory" ]
2006_N1
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2006 N1 (P4) Determine all pairs $(x, y) ∈ ℕ × ℤ$ such that $1 + 2^x + 2^{2x + 1} = y^2$. -/
/- special open -/ open Finset def good (x : ℕ) (y : ℤ) := 2 ^ (2 * x + 1) + 2 ^ x + 1 = y ^ 2 theorem imo_sl_2006_N1 : good x y ↔ (x = 0 ∧ (y = 2 ∨ y = -2)) ∨ (x = 4 ∧ (y = 23 ∨ y = -23)) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2006 N1 (P4) Determine all pairs $(x, y) ∈ ℕ × ℤ$ such that $1 + 2^x + 2^{2x + 1} = y^2$. -/ /- special open -/ open Finset def good (x : ℕ) (y : ℤ) := 2 ^ (2 * x + 1) + 2 ^ x + 1 = y ^ 2 theorem imo_sl_2006_N1 : good x y ↔ (x = 0 ∧ (y = 2 ∨ y = -2)) ∨ (x = 4 ∧ (y = 23 ∨ y = -23)) := by sorry
number theory
imo_sl_2006_N3
true
[ "number theory" ]
2006_N3
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2006 N3 For each $n ∈ ℕ$, define $$ f(n) = \frac{1}{n} \sum_{k = 1}^n \left\lfloor \frac{n}{k} \right\rfloor. $$ 1. Prove that $f(n + 1) > f(n)$ infinitely often. 2. Prove that $f(n + 1) < f(n)$ infinitely often. -/
/- special open -/ open Finset def g (n : ℕ) : ℕ := (range n).sum λ k ↦ n / (k + 1) def f (n : ℕ) : ℚ := ((g n : ℤ) : ℚ) / ((n : ℤ) : ℚ) theorem imo_sl_2006_N3 : {n : ℕ | f n < f n.succ}.Infinite ∧ {n : ℕ | f n.succ < f n}.Infinite := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2006 N3 For each $n ∈ ℕ$, define $$ f(n) = \frac{1}{n} \sum_{k = 1}^n \left\lfloor \frac{n}{k} \right\rfloor. $$ 1. Prove that $f(n + 1) > f(n)$ infinitely often. 2. Prove that $f(n + 1) < f(n)$ infinitely often. -/ /- special open -/ open Finset def g (n : ℕ) : ℕ := (range n).sum λ k ↦ n / (k + 1) def f (n : ℕ) : ℚ := ((g n : ℤ) : ℚ) / ((n : ℤ) : ℚ) theorem imo_sl_2006_N3 : {n : ℕ | f n < f n.succ}.Infinite ∧ {n : ℕ | f n.succ < f n}.Infinite := by sorry
number theory
imo_sl_2006_N5
true
[ "number theory" ]
2006_N5
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2006 N5 Let $p > 3$ be a prime. Determine all pairs $(x, y)$ of integers such that $$ \sum_{k = 0}^{p - 1} x^k = y^{p - 2} - 1. $$ -/
/- special open -/ open Finset theorem imo_sl_2006_N5 {p : ℕ} (hp : p.Prime) (h : 3 < p) (x y : ℤ) : ¬(range p).sum (x ^ ·) = y ^ (p - 2) - 1 := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2006 N5 Let $p > 3$ be a prime. Determine all pairs $(x, y)$ of integers such that $$ \sum_{k = 0}^{p - 1} x^k = y^{p - 2} - 1. $$ -/ /- special open -/ open Finset theorem imo_sl_2006_N5 {p : ℕ} (hp : p.Prime) (h : 3 < p) (x y : ℤ) : ¬(range p).sum (x ^ ·) = y ^ (p - 2) - 1 := by sorry
number theory
imo_sl_2006_N7
true
[ "number theory" ]
2006_N7
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2006 N7 Prove that for any $b ∈ ℕ$ and $n ∈ ℕ^+$, there exists $m ∈ ℕ$ such that $n ∣ b^m + m$. -/
theorem imo_sl_2006_N7 (hn : 0 < n) (b) : ∃ m, n ∣ b ^ m + m := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2006 N7 Prove that for any $b ∈ ℕ$ and $n ∈ ℕ^+$, there exists $m ∈ ℕ$ such that $n ∣ b^m + m$. -/ theorem imo_sl_2006_N7 (hn : 0 < n) (b) : ∃ m, n ∣ b ^ m + m := by sorry
number theory
imo_sl_2007_A1a
true
[ "algebra" ]
2007_A1a
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2007 A1, Part 1 Fix a linearly ordered abelian group $G$ and a positive integer $n$. Consider a sequence $(a_i)_{i=0}^n$ of elements of $G$. Let $(x_i)_{i=0}^n$ be a non-decreasing sequence in $G$, and let $$ L = \max_{j \le n} |x_j - a_j|. $$ Prove that for any non-decreasing sequence $(x_i)$, the inequality $2L \ge a_k - a_m$ holds for any $k \le m \le n$. -/
/- special open -/ open Finset variable [LinearOrder α] /-- The sequence `seqMax f` represents the running maximum of a sequence `f`. `seqMax f n = max(f 0, f 1, ..., f n)`. -/ def seqMax (f : Nat → α) : Nat → α | 0 => f 0 | n + 1 => max (seqMax f n) (f n.succ) theorem imo_sl_2007_A1a_part1 [LinearOrderedAddCommGroup G] (a : ℕ → G) (n : ℕ) (x : ℕ → G) (k m : ℕ) (h_mono : Monotone x) (h_le : k ≤ m) (h_n : m ≤ n) : a k - a m ≤ 2 • seqMax (λ i ↦ |x i - a i|) n := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2007 A1, Part 1 Fix a linearly ordered abelian group $G$ and a positive integer $n$. Consider a sequence $(a_i)_{i=0}^n$ of elements of $G$. Let $(x_i)_{i=0}^n$ be a non-decreasing sequence in $G$, and let $$ L = \max_{j \le n} |x_j - a_j|. $$ Prove that for any non-decreasing sequence $(x_i)$, the inequality $2L \ge a_k - a_m$ holds for any $k \le m \le n$. -/ /- special open -/ open Finset variable [LinearOrder α] /-- The sequence `seqMax f` represents the running maximum of a sequence `f`. `seqMax f n = max(f 0, f 1, ..., f n)`. -/ def seqMax (f : Nat → α) : Nat → α | 0 => f 0 | n + 1 => max (seqMax f n) (f n.succ) theorem imo_sl_2007_A1a_part1 [LinearOrderedAddCommGroup G] (a : ℕ → G) (n : ℕ) (x : ℕ → G) (k m : ℕ) (h_mono : Monotone x) (h_le : k ≤ m) (h_n : m ≤ n) : a k - a m ≤ 2 • seqMax (λ i ↦ |x i - a i|) n := by sorry
algebra
imo_sl_2007_A1b
true
[ "algebra" ]
2007_A1b
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2007 A1, Part 2 Fix a linearly ordered abelian group $G$ and a positive integer $n$. Consider a sequence $(a_i)_{i=0}^n$ of elements of $G$. Let $L(x) = \max_{j \le n} |x_j - a_j|$ for a non-decreasing sequence $(x_i)$. Prove that for any $g \in G$ such that $2g \ge a_k - a_m$ for any $k \le m \le n$, there exists a non-decreasing sequence $(x_i)$ such that $L(x) \le g$. -/
/- special open -/ open Finset variable [LinearOrder α] /-- The sequence `seqMax f` represents the running maximum of a sequence `f`. `seqMax f n = max(f 0, f 1, ..., f n)`. -/ def seqMax (f : Nat → α) : Nat → α | 0 => f 0 | n + 1 => max (seqMax f n) (f n.succ) theorem imo_sl_2007_A1b_part2 [LinearOrderedAddCommGroup G] (a : ℕ → G) (n : ℕ) (g : G) (h_g : ∀ k m : ℕ, k ≤ m → m ≤ n → a k - a m ≤ 2 • g) : ∃ x : ℕ → G, Monotone x ∧ seqMax (λ i ↦ |x i - a i|) n ≤ g := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2007 A1, Part 2 Fix a linearly ordered abelian group $G$ and a positive integer $n$. Consider a sequence $(a_i)_{i=0}^n$ of elements of $G$. Let $L(x) = \max_{j \le n} |x_j - a_j|$ for a non-decreasing sequence $(x_i)$. Prove that for any $g \in G$ such that $2g \ge a_k - a_m$ for any $k \le m \le n$, there exists a non-decreasing sequence $(x_i)$ such that $L(x) \le g$. -/ /- special open -/ open Finset variable [LinearOrder α] /-- The sequence `seqMax f` represents the running maximum of a sequence `f`. `seqMax f n = max(f 0, f 1, ..., f n)`. -/ def seqMax (f : Nat → α) : Nat → α | 0 => f 0 | n + 1 => max (seqMax f n) (f n.succ) theorem imo_sl_2007_A1b_part2 [LinearOrderedAddCommGroup G] (a : ℕ → G) (n : ℕ) (g : G) (h_g : ∀ k m : ℕ, k ≤ m → m ≤ n → a k - a m ≤ 2 • g) : ∃ x : ℕ → G, Monotone x ∧ seqMax (λ i ↦ |x i - a i|) n ≤ g := by sorry
algebra
imo_sl_2007_A2
true
[ "algebra" ]
2007_A2
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2007 A2 A function $f : \mathbb{N}^+ \to \mathbb{N}^+$ is called *good* if, for any positive integers $m, n$, the following inequality holds: $$ f(m + n) + 1 \ge f(m) + f(f(n)). $$ For any given $N \in \mathbb{N}^+$, determine all possible values of $k \in \mathbb{N}^+$ for which there exists a good function $f$ such that $f(N) = k$. The solution states that: - If $N=1$, the only possible value is $k=1$. - If $N > 1$, the possible values are all $k$ such that $k \le N+1$. -/
/- special open -/ open Finset /-- A function `f : ℕ+ → ℕ+` is "good" if it satisfies the problem's inequality. Note the inequality is rearranged to use `≤` to align with Lean's conventions. -/ def goodPNat (f : ℕ+ → ℕ+) := ∀ m n, f m + f (f n) ≤ f (m + n) + 1 theorem imo_sl_2007_A2 {N k : ℕ+} : (∃ f : ℕ+ → ℕ+, goodPNat f ∧ f N = k) ↔ if N = 1 then k = 1 else k ≤ N + 1 := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2007 A2 A function $f : \mathbb{N}^+ \to \mathbb{N}^+$ is called *good* if, for any positive integers $m, n$, the following inequality holds: $$ f(m + n) + 1 \ge f(m) + f(f(n)). $$ For any given $N \in \mathbb{N}^+$, determine all possible values of $k \in \mathbb{N}^+$ for which there exists a good function $f$ such that $f(N) = k$. The solution states that: - If $N=1$, the only possible value is $k=1$. - If $N > 1$, the possible values are all $k$ such that $k \le N+1$. -/ /- special open -/ open Finset /-- A function `f : ℕ+ → ℕ+` is "good" if it satisfies the problem's inequality. Note the inequality is rearranged to use `≤` to align with Lean's conventions. -/ def goodPNat (f : ℕ+ → ℕ+) := ∀ m n, f m + f (f n) ≤ f (m + n) + 1 theorem imo_sl_2007_A2 {N k : ℕ+} : (∃ f : ℕ+ → ℕ+, goodPNat f ∧ f N = k) ↔ if N = 1 then k = 1 else k ≤ N + 1 := by sorry
algebra
imo_sl_2007_A3
true
[ "algebra" ]
2007_A3
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2007 A3 Let $F$ be a totally ordered field, and let $n$ be a positive integer. Let $x, y \in F$ be positive elements such that $x^n + y^n = 1$. Prove that $$ \left(\sum_{k = 1}^n \frac{1 + x^{2k}}{1 + x^{4k}}\right) \left(\sum_{k = 1}^n \frac{1 + y^{2k}}{1 + y^{4k}}\right) < \frac{1}{(1 - x)(1 - y)}. $$ -/
/- special open -/ open Finset theorem imo_sl_2007_A3 [LinearOrderedField F] (n : Nat) {x y : F} (hx : 0 < x) (hy : 0 < y) (h : x ^ n + y ^ n = 1) : (range n).sum (λ i ↦ (1 + x ^ (2 * i.succ)) / (1 + x ^ (4 * i.succ))) * (range n).sum (λ i ↦ (1 + y ^ (2 * i.succ)) / (1 + y ^ (4 * i.succ))) < ((1 - x) * (1 - y))⁻¹ := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2007 A3 Let $F$ be a totally ordered field, and let $n$ be a positive integer. Let $x, y \in F$ be positive elements such that $x^n + y^n = 1$. Prove that $$ \left(\sum_{k = 1}^n \frac{1 + x^{2k}}{1 + x^{4k}}\right) \left(\sum_{k = 1}^n \frac{1 + y^{2k}}{1 + y^{4k}}\right) < \frac{1}{(1 - x)(1 - y)}. $$ -/ /- special open -/ open Finset theorem imo_sl_2007_A3 [LinearOrderedField F] (n : Nat) {x y : F} (hx : 0 < x) (hy : 0 < y) (h : x ^ n + y ^ n = 1) : (range n).sum (λ i ↦ (1 + x ^ (2 * i.succ)) / (1 + x ^ (4 * i.succ))) * (range n).sum (λ i ↦ (1 + y ^ (2 * i.succ)) / (1 + y ^ (4 * i.succ))) < ((1 - x) * (1 - y))⁻¹ := by sorry
algebra
imo_sl_2007_A4
true
[ "algebra" ]
2007_A4
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2007 A4 Let $G$ be a totally ordered abelian group and $G_{>0} = \{x \in G : x > 0\}$. Find all functions $f : G_{>0} \to G_{>0}$ such that for any $x, y \in G_{>0}$, $$ f(x + f(y)) = f(x + y) + f(y). $$ -/
variable [LinearOrderedAddCommGroup G] /-- This defines the property of a function `f` satisfying the given functional equation on the subtype of positive elements `{x : G // 0 < x}`. -/ def IsGood (f : {x : G // 0 < x} → {x : G // 0 < x}) : Prop := ∀ x y, f (x + f y) = f (x + y) + f y /-- The solutions to the functional equation are functions that double the input. -/ theorem imo_sl_2007_A4 (f : {x : G // 0 < x} → {x : G // 0 < x}) : IsGood f ↔ f = (fun x ↦ x + x) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2007 A4 Let $G$ be a totally ordered abelian group and $G_{>0} = \{x \in G : x > 0\}$. Find all functions $f : G_{>0} \to G_{>0}$ such that for any $x, y \in G_{>0}$, $$ f(x + f(y)) = f(x + y) + f(y). $$ -/ variable [LinearOrderedAddCommGroup G] /-- This defines the property of a function `f` satisfying the given functional equation on the subtype of positive elements `{x : G // 0 < x}`. -/ def IsGood (f : {x : G // 0 < x} → {x : G // 0 < x}) : Prop := ∀ x y, f (x + f y) = f (x + y) + f y /-- The solutions to the functional equation are functions that double the input. -/ theorem imo_sl_2007_A4 (f : {x : G // 0 < x} → {x : G // 0 < x}) : IsGood f ↔ f = (fun x ↦ x + x) := by sorry
algebra
imo_sl_2007_A6
true
[ "algebra" ]
2007_A6
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2007 A6 Let $R$ be a totally ordered commutative ring and let $n \ge 5$ be an integer. Prove that for any sequence $a_1, a_2, \dots, a_n \in R$, the following inequality holds: $$ \left(3 \sum_{i = 1}^n a_i^2 a_{i + 1}\right)^2 \le 2 \left(\sum_{i = 1}^n a_i^2\right)^3 $$ where the sum is cyclic, i.e., $a_{n+1} = a_1$. -/
/- special open -/ open Finset theorem imo_sl_2007_A6 [LinearOrderedCommRing R] (n : ℕ) (hn : 5 ≤ n) (a : Fin n → R) : (3 * ∑ i, a i ^ 2 * a (finRotate n i)) ^ 2 ≤ 2 * (∑ i, a i ^ 2) ^ 3 := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2007 A6 Let $R$ be a totally ordered commutative ring and let $n \ge 5$ be an integer. Prove that for any sequence $a_1, a_2, \dots, a_n \in R$, the following inequality holds: $$ \left(3 \sum_{i = 1}^n a_i^2 a_{i + 1}\right)^2 \le 2 \left(\sum_{i = 1}^n a_i^2\right)^3 $$ where the sum is cyclic, i.e., $a_{n+1} = a_1$. -/ /- special open -/ open Finset theorem imo_sl_2007_A6 [LinearOrderedCommRing R] (n : ℕ) (hn : 5 ≤ n) (a : Fin n → R) : (3 * ∑ i, a i ^ 2 * a (finRotate n i)) ^ 2 ≤ 2 * (∑ i, a i ^ 2) ^ 3 := by sorry
algebra
imo_sl_2007_C3
true
[ "combinatorics" ]
2007_C3
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2007 C3 Find all finite groups $G$ such that there exists a subset $S \subseteq G$ for which the number of triples $(x, y, z) \in S^3 \cup (G \setminus S)^3$ such that $xyz = 1$ is $2007$. -/
/- special open -/ open Finset variable [Fintype G] [DecidableEq G] [Group G] def tripleSet (S : Finset G) : Finset (Fin 3 → G) := (Fintype.piFinset fun _ ↦ S) ∪ (Fintype.piFinset fun _ ↦ Sᶜ) def filtered_tripleSet (S : Finset G) : Finset (Fin 3 → G) := (tripleSet S).filter fun p ↦ p 0 * p 1 * p 2 = 1 theorem imo_sl_2007_C3 : (∃ S : Finset G, (filtered_tripleSet S).card = 2007) ↔ Fintype.card G = 69 ∨ Fintype.card G = 84 := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2007 C3 Find all finite groups $G$ such that there exists a subset $S \subseteq G$ for which the number of triples $(x, y, z) \in S^3 \cup (G \setminus S)^3$ such that $xyz = 1$ is $2007$. -/ /- special open -/ open Finset variable [Fintype G] [DecidableEq G] [Group G] def tripleSet (S : Finset G) : Finset (Fin 3 → G) := (Fintype.piFinset fun _ ↦ S) ∪ (Fintype.piFinset fun _ ↦ Sᶜ) def filtered_tripleSet (S : Finset G) : Finset (Fin 3 → G) := (tripleSet S).filter fun p ↦ p 0 * p 1 * p 2 = 1 theorem imo_sl_2007_C3 : (∃ S : Finset G, (filtered_tripleSet S).card = 2007) ↔ Fintype.card G = 69 ∨ Fintype.card G = 84 := by sorry
combinatorics
imo_sl_2007_N1
true
[ "number theory" ]
2007_N1
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2007 N1 Find all pairs $(k, n) \in \mathbb{N}^2$ such that $7^k - 3^n \mid k^4 + n^2$. -/
def good (k n : ℕ) : Prop := (7 : ℤ) ^ k - 3 ^ n ∣ (k ^ 4 + n ^ 2 : ℕ) theorem imo_sl_2007_N1 (k n : ℕ) : good k n ↔ (k = 0 ∧ n = 0) ∨ (k = 2 ∧ n = 4) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2007 N1 Find all pairs $(k, n) \in \mathbb{N}^2$ such that $7^k - 3^n \mid k^4 + n^2$. -/ def good (k n : ℕ) : Prop := (7 : ℤ) ^ k - 3 ^ n ∣ (k ^ 4 + n ^ 2 : ℕ) theorem imo_sl_2007_N1 (k n : ℕ) : good k n ↔ (k = 0 ∧ n = 0) ∨ (k = 2 ∧ n = 4) := by sorry
number theory
imo_sl_2007_N2
true
[ "number theory" ]
2007_N2
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2007 N2 Fix integers $b > 0$ and $n ≥ 0$. Suppose that for each $k ∈ ℕ^+$, there exists an integer $a$ such that $k ∣ b - a^n$. Prove that $b = A^n$ for some integer $A$. -/
/- special open -/ open Finset theorem imo_sl_2007_N2 (h : 0 < b) (h0 : ∀ k : ℕ, 0 < k → ∃ c : ℤ, (k : ℤ) ∣ b - c ^ n) : ∃ a : ℤ, b = a ^ n := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2007 N2 Fix integers $b > 0$ and $n ≥ 0$. Suppose that for each $k ∈ ℕ^+$, there exists an integer $a$ such that $k ∣ b - a^n$. Prove that $b = A^n$ for some integer $A$. -/ /- special open -/ open Finset theorem imo_sl_2007_N2 (h : 0 < b) (h0 : ∀ k : ℕ, 0 < k → ∃ c : ℤ, (k : ℤ) ∣ b - c ^ n) : ∃ a : ℤ, b = a ^ n := by sorry
number theory
imo_sl_2007_N6
true
[ "number theory" ]
2007_N6
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2007 N6 (P5) Fix $n > 1$, and let $a$ and $b$ be positive integers such that $nab - 1 ∣ (na^2 - 1)^2$. Prove that $a = b$. -/
/- special open -/ open Finset abbrev bad_pair (n : ℤ) (a b : ℕ) := n * a * b - 1 ∣ (n * a ^ 2 - 1) ^ 2 theorem imo_sl_2007_N6 (hn : 1 < n) (ha : 0 < a) (hb : 0 < b) (h : bad_pair n a b) : a = b := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2007 N6 (P5) Fix $n > 1$, and let $a$ and $b$ be positive integers such that $nab - 1 ∣ (na^2 - 1)^2$. Prove that $a = b$. -/ /- special open -/ open Finset abbrev bad_pair (n : ℤ) (a b : ℕ) := n * a * b - 1 ∣ (n * a ^ 2 - 1) ^ 2 theorem imo_sl_2007_N6 (hn : 1 < n) (ha : 0 < a) (hb : 0 < b) (h : bad_pair n a b) : a = b := by sorry
number theory
imo_sl_2008_A1
true
[ "algebra" ]
2008_A1
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2008 A1 (P4) 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 $p, q, r, s > 0$ with $pq = rs$, $$ (f(p)^2 + f(q)^2) (r^2 + s^2) = (p^2 + q^2) (f(r^2) + f(s^2)). $$ -/
/- special open -/ open Finset structure weakGood [OrderedSemiring R] (f : R → R) : Prop where map_pos_of_pos : ∀ x > 0, f x > 0 good' : ∀ p > 0, ∀ q > 0, ∀ r > 0, ∀ s > 0, p * q = r * s → (f p ^ 2 + f q ^ 2) * (r ^ 2 + s ^ 2) = (p ^ 2 + q ^ 2) * (f (r ^ 2) + f (s ^ 2)) variable [LinearOrderedField R] def good (f : {x : R // 0 < x} → {x : R // 0 < x}) := ∀ p q r s, p * q = r * s → (f p ^ 2 + f q ^ 2) * (r ^ 2 + s ^ 2) = (p ^ 2 + q ^ 2) * (f (r ^ 2) + f (s ^ 2)) theorem imo_sl_2008_A1 [ExistsAddOfLE R] {f : {x : R // 0 < x} → {x : R // 0 < x}} : good f ↔ f = id ∨ ∀ x, x * f x = 1 := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2008 A1 (P4) 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 $p, q, r, s > 0$ with $pq = rs$, $$ (f(p)^2 + f(q)^2) (r^2 + s^2) = (p^2 + q^2) (f(r^2) + f(s^2)). $$ -/ /- special open -/ open Finset structure weakGood [OrderedSemiring R] (f : R → R) : Prop where map_pos_of_pos : ∀ x > 0, f x > 0 good' : ∀ p > 0, ∀ q > 0, ∀ r > 0, ∀ s > 0, p * q = r * s → (f p ^ 2 + f q ^ 2) * (r ^ 2 + s ^ 2) = (p ^ 2 + q ^ 2) * (f (r ^ 2) + f (s ^ 2)) variable [LinearOrderedField R] def good (f : {x : R // 0 < x} → {x : R // 0 < x}) := ∀ p q r s, p * q = r * s → (f p ^ 2 + f q ^ 2) * (r ^ 2 + s ^ 2) = (p ^ 2 + q ^ 2) * (f (r ^ 2) + f (s ^ 2)) theorem imo_sl_2008_A1 [ExistsAddOfLE R] {f : {x : R // 0 < x} → {x : R // 0 < x}} : good f ↔ f = id ∨ ∀ x, x * f x = 1 := by sorry
algebra
imo_sl_2008_A2a
true
[ "algebra" ]
2008_A2a
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2008 A2 1. Let $F$ be an ordered field, and consider $x, y, z \in F \setminus \{1\}$ with $xyz = 1$. Prove that $$ \frac{x^2}{(x - 1)^2} + \frac{y^2}{(y - 1)^2} + \frac{z^2}{(z - 1)^2} \ge 1. $$ -/
theorem imo_sl_2008_A2a_part1 [LinearOrderedField F] {x y z : F} (hx : x ≠ 1) (hy : y ≠ 1) (hz : z ≠ 1) (h : x * y * z = 1) : 1 ≤ (x / (x - 1)) ^ 2 + (y / (y - 1)) ^ 2 + (z / (z - 1)) ^ 2 := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2008 A2 1. Let $F$ be an ordered field, and consider $x, y, z \in F \setminus \{1\}$ with $xyz = 1$. Prove that $$ \frac{x^2}{(x - 1)^2} + \frac{y^2}{(y - 1)^2} + \frac{z^2}{(z - 1)^2} \ge 1. $$ -/ theorem imo_sl_2008_A2a_part1 [LinearOrderedField F] {x y z : F} (hx : x ≠ 1) (hy : y ≠ 1) (hz : z ≠ 1) (h : x * y * z = 1) : 1 ≤ (x / (x - 1)) ^ 2 + (y / (y - 1)) ^ 2 + (z / (z - 1)) ^ 2 := by sorry
algebra
imo_sl_2008_A2b
true
[ "algebra" ]
2008_A2b
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2008 A2 2. Show that there exists infinitely many triplets $(x, y, z) \in (\mathbb{Q} \setminus \{1\})^3$ with $xyz = 1$ such that the above inequality becomes equality. -/
structure IsGood (p : Fin 3 → ℚ) : Prop where p_ne_one : ∀ i, p i ≠ 1 p_mul_eq_one : p 0 * p 1 * p 2 = 1 spec : (p 0 / (p 0 - 1)) ^ 2 + (p 1 / (p 1 - 1)) ^ 2 + (p 2 / (p 2 - 1)) ^ 2 = 1 theorem imo_sl_2008_A2b_part2 : {p : Fin 3 → ℚ | IsGood p}.Infinite := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2008 A2 2. Show that there exists infinitely many triplets $(x, y, z) \in (\mathbb{Q} \setminus \{1\})^3$ with $xyz = 1$ such that the above inequality becomes equality. -/ structure IsGood (p : Fin 3 → ℚ) : Prop where p_ne_one : ∀ i, p i ≠ 1 p_mul_eq_one : p 0 * p 1 * p 2 = 1 spec : (p 0 / (p 0 - 1)) ^ 2 + (p 1 / (p 1 - 1)) ^ 2 + (p 2 / (p 2 - 1)) ^ 2 = 1 theorem imo_sl_2008_A2b_part2 : {p : Fin 3 → ℚ | IsGood p}.Infinite := by sorry
algebra
imo_sl_2008_A3a
true
[ "algebra" ]
2008_A3a
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2008 A3 Let $α$ be a totally ordered type. A **Spanish couple** on $α$ is a pair of strictly increasing functions $(f, g)$ from $α$ to itself such that for all $x \in α$, $f(g(g(x))) < g(f(x))$. Determine whether there exists a Spanish couple on: 1. The set of natural numbers $ℕ$. -/
structure SpanishCouple [Preorder α] (f g : α → α) : Prop where f_mono : StrictMono f g_mono : StrictMono g spec : f ∘ g ∘ g < g ∘ f theorem imo_sl_2008_A3a_part1 : ¬ ∃ f g : ℕ → ℕ, SpanishCouple f g := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2008 A3 Let $α$ be a totally ordered type. A **Spanish couple** on $α$ is a pair of strictly increasing functions $(f, g)$ from $α$ to itself such that for all $x \in α$, $f(g(g(x))) < g(f(x))$. Determine whether there exists a Spanish couple on: 1. The set of natural numbers $ℕ$. -/ structure SpanishCouple [Preorder α] (f g : α → α) : Prop where f_mono : StrictMono f g_mono : StrictMono g spec : f ∘ g ∘ g < g ∘ f theorem imo_sl_2008_A3a_part1 : ¬ ∃ f g : ℕ → ℕ, SpanishCouple f g := by sorry
algebra
imo_sl_2008_A3b
true
[ "algebra" ]
2008_A3b
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2008 A3 Let $α$ be a totally ordered type. A **Spanish couple** on $α$ is a pair of strictly increasing functions $(f, g)$ from $α$ to itself such that for all $x \in α$, $f(g(g(x))) < g(f(x))$. Determine whether there exists a Spanish couple on: 2. The set $ℕ \times ℕ$ with the lexicographical order. -/
structure SpanishCouple [Preorder α] (f g : α → α) : Prop where f_mono : StrictMono f g_mono : StrictMono g spec : f ∘ g ∘ g < g ∘ f theorem imo_sl_2008_A3b_part2 : ∃ f g : (ℕ ×ₗ ℕ) → (ℕ ×ₗ ℕ), SpanishCouple f g := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2008 A3 Let $α$ be a totally ordered type. A **Spanish couple** on $α$ is a pair of strictly increasing functions $(f, g)$ from $α$ to itself such that for all $x \in α$, $f(g(g(x))) < g(f(x))$. Determine whether there exists a Spanish couple on: 2. The set $ℕ \times ℕ$ with the lexicographical order. -/ structure SpanishCouple [Preorder α] (f g : α → α) : Prop where f_mono : StrictMono f g_mono : StrictMono g spec : f ∘ g ∘ g < g ∘ f theorem imo_sl_2008_A3b_part2 : ∃ f g : (ℕ ×ₗ ℕ) → (ℕ ×ₗ ℕ), SpanishCouple f g := by sorry
algebra
imo_sl_2008_A5
true
[ "algebra" ]
2008_A5
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2008 A5 Let $F$ be a totally ordered field and $a_1, a_2, a_3, a_4 \in F$ be positive elements. Suppose that $a_1 a_2 a_3 a_4 = 1$ and $$ \sum_{i = 1}^4 \frac{a_i}{a_{i + 1}} < \sum_{i = 1}^4 a_i. $$ Prove that $$ \sum_{i = 1}^4 a_i < \sum_{i = 1}^4 \frac{a_{i + 1}}{a_i}. $$ -/
theorem imo_sl_2008_A5 [LinearOrderedField F] {a b c d : F} (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) (hd : 0 < d) (h_prod : a * b * c * d = 1) (h_ineq : a / b + b / c + c / d + d / a < a + b + c + d) : a + b + c + d < b / a + c / b + d / c + a / d := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2008 A5 Let $F$ be a totally ordered field and $a_1, a_2, a_3, a_4 \in F$ be positive elements. Suppose that $a_1 a_2 a_3 a_4 = 1$ and $$ \sum_{i = 1}^4 \frac{a_i}{a_{i + 1}} < \sum_{i = 1}^4 a_i. $$ Prove that $$ \sum_{i = 1}^4 a_i < \sum_{i = 1}^4 \frac{a_{i + 1}}{a_i}. $$ -/ theorem imo_sl_2008_A5 [LinearOrderedField F] {a b c d : F} (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) (hd : 0 < d) (h_prod : a * b * c * d = 1) (h_ineq : a / b + b / c + c / d + d / a < a + b + c + d) : a + b + c + d < b / a + c / b + d / c + a / d := by sorry
algebra
imo_sl_2008_A7
true
[ "algebra" ]
2008_A7
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2008 A7 Let $F$ be a totally ordered field. 1. Prove that, for any $a, b, c, d \in F$ positive, $$ \frac{(a - b)(a - c)}{a + b + c} + \frac{(b - c)(b - d)}{b + c + d} + \frac{(c - d)(c - a)}{c + d + a} + \frac{(d - a)(d - b)}{d + a + b} \ge 0. $$ 2. Find all cases of equality. -/
theorem imo_sl_2008_A7 [LinearOrderedField F] {a b c d : F} (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) (hd : 0 < d) : (0 ≤ (a - b) * (a - c) / (a + b + c) + (b - c) * (b - d) / (b + c + d) + (c - d) * (c - a) / (c + d + a) + (d - a) * (d - b) / (d + a + b)) ∧ ((a - b) * (a - c) / (a + b + c) + (b - c) * (b - d) / (b + c + d) + (c - d) * (c - a) / (c + d + a) + (d - a) * (d - b) / (d + a + b) = 0 ↔ a = c ∧ b = d) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2008 A7 Let $F$ be a totally ordered field. 1. Prove that, for any $a, b, c, d \in F$ positive, $$ \frac{(a - b)(a - c)}{a + b + c} + \frac{(b - c)(b - d)}{b + c + d} + \frac{(c - d)(c - a)}{c + d + a} + \frac{(d - a)(d - b)}{d + a + b} \ge 0. $$ 2. Find all cases of equality. -/ theorem imo_sl_2008_A7 [LinearOrderedField F] {a b c d : F} (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) (hd : 0 < d) : (0 ≤ (a - b) * (a - c) / (a + b + c) + (b - c) * (b - d) / (b + c + d) + (c - d) * (c - a) / (c + d + a) + (d - a) * (d - b) / (d + a + b)) ∧ ((a - b) * (a - c) / (a + b + c) + (b - c) * (b - d) / (b + c + d) + (c - d) * (c - a) / (c + d + a) + (d - a) * (d - b) / (d + a + b) = 0 ↔ a = c ∧ b = d) := by sorry
algebra
imo_sl_2008_C4
true
[ "combinatorics" ]
2008_C4
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2008 C4 Let $n$ and $d$ be positive integers. Consider $2n$ lamps labelled with a pair $(b, m)$ where $b \in \{0, 1\}$ and $m \in \{0, 1, \ldots, n - 1\}$. Initially, all the lamps are off. Consider sequences of $k = 2d + n$ steps, where at each step, one of the lamps is switched (off to on and vice versa). Let $S_N$ be the set of $k$-step sequences ending in a state where the lamps labelled $(b, m)$ are on if and only if $b = 0$. Let $S_M \subseteq S_N$ consist of the sequences that do not touch the lamps labelled $(0, m)$ at all. Find the ratio $|S_N|/|S_M|$. -/
/- special open -/ open Finset variable (I Λ : Type) [Fintype I] [Fintype Λ] def IsNSequence [DecidableEq I] [DecidableEq Λ] (f : I → Fin 2 × Λ) : Prop := ∀ p : Fin 2 × Λ, (univ.filter (f · = p)).card % 2 = p.1.val noncomputable instance IsNSequence.instDecidablePred [DecidableEq I] [DecidableEq Λ] : DecidablePred (IsNSequence I Λ) := by unfold IsNSequence; infer_instance def IsMSequence [DecidableEq I] [DecidableEq Λ] (f : I → Λ) : Prop := ∀ l : Λ, (univ.filter (f · = l)).card % 2 = 1 noncomputable instance IsMSequence.instDecidablePred [DecidableEq I] [DecidableEq Λ] : DecidablePred (IsMSequence I Λ) := by unfold IsMSequence; infer_instance theorem imo_sl_2008_C4 [DecidableEq I] [DecidableEq Λ] : Fintype.card { f : I → Fin 2 × Λ // IsNSequence I Λ f } = 2 ^ (Fintype.card I - Fintype.card Λ) * Fintype.card { f : I → Λ // IsMSequence I Λ f } := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2008 C4 Let $n$ and $d$ be positive integers. Consider $2n$ lamps labelled with a pair $(b, m)$ where $b \in \{0, 1\}$ and $m \in \{0, 1, \ldots, n - 1\}$. Initially, all the lamps are off. Consider sequences of $k = 2d + n$ steps, where at each step, one of the lamps is switched (off to on and vice versa). Let $S_N$ be the set of $k$-step sequences ending in a state where the lamps labelled $(b, m)$ are on if and only if $b = 0$. Let $S_M \subseteq S_N$ consist of the sequences that do not touch the lamps labelled $(0, m)$ at all. Find the ratio $|S_N|/|S_M|$. -/ /- special open -/ open Finset variable (I Λ : Type) [Fintype I] [Fintype Λ] def IsNSequence [DecidableEq I] [DecidableEq Λ] (f : I → Fin 2 × Λ) : Prop := ∀ p : Fin 2 × Λ, (univ.filter (f · = p)).card % 2 = p.1.val noncomputable instance IsNSequence.instDecidablePred [DecidableEq I] [DecidableEq Λ] : DecidablePred (IsNSequence I Λ) := by unfold IsNSequence; infer_instance def IsMSequence [DecidableEq I] [DecidableEq Λ] (f : I → Λ) : Prop := ∀ l : Λ, (univ.filter (f · = l)).card % 2 = 1 noncomputable instance IsMSequence.instDecidablePred [DecidableEq I] [DecidableEq Λ] : DecidablePred (IsMSequence I Λ) := by unfold IsMSequence; infer_instance theorem imo_sl_2008_C4 [DecidableEq I] [DecidableEq Λ] : Fintype.card { f : I → Fin 2 × Λ // IsNSequence I Λ f } = 2 ^ (Fintype.card I - Fintype.card Λ) * Fintype.card { f : I → Λ // IsMSequence I Λ f } := by sorry
combinatorics
imo_sl_2009_A2
true
[ "algebra" ]
2009_A2
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2009 A2 Let $F$ be a totally ordered field, and let $a, b, c \in F$ be positive elements. Prove that $$ \frac{1}{(2a + b + c)^2} + \frac{1}{(2b + c + a)^2} + \frac{1}{(2c + a + b)^2} \le \frac{3}{16(ab+bc+ca)}. $$ -/
theorem imo_sl_2009_A2 [LinearOrderedField F] {a b c : F} (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) (h_norm : a⁻¹ + b⁻¹ + c⁻¹ = a + b + c) : ((2 * a + b + c) ^ 2)⁻¹ + ((2 * b + c + a) ^ 2)⁻¹ + ((2 * c + a + b) ^ 2)⁻¹ ≤ 3 / 16 := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2009 A2 Let $F$ be a totally ordered field, and let $a, b, c \in F$ be positive elements. Prove that $$ \frac{1}{(2a + b + c)^2} + \frac{1}{(2b + c + a)^2} + \frac{1}{(2c + a + b)^2} \le \frac{3}{16(ab+bc+ca)}. $$ -/ theorem imo_sl_2009_A2 [LinearOrderedField F] {a b c : F} (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) (h_norm : a⁻¹ + b⁻¹ + c⁻¹ = a + b + c) : ((2 * a + b + c) ^ 2)⁻¹ + ((2 * b + c + a) ^ 2)⁻¹ + ((2 * c + a + b) ^ 2)⁻¹ ≤ 3 / 16 := by sorry
algebra
imo_sl_2009_A3a
true
[ "algebra" ]
2009_A3a
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2009 A3 Find all functions $f : \mathbb{N} \to \mathbb{N}$ such that for any $x, y \in \mathbb{N}$, the numbers $x$, $f(y)$, and $f(y + f(x))$ form the sides of a possibly degenerate triangle. -/
structure IsNatTriangle (x y z : ℕ) : Prop where side_x : x ≤ y + z side_y : y ≤ z + x side_z : z ≤ x + y def IsGoodNat (f : ℕ → ℕ) : Prop := ∀ x y, IsNatTriangle x (f y) (f (y + f x)) theorem imo_sl_2009_A3a_nat (f : ℕ → ℕ) : IsGoodNat f ↔ f = id := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2009 A3 Find all functions $f : \mathbb{N} \to \mathbb{N}$ such that for any $x, y \in \mathbb{N}$, the numbers $x$, $f(y)$, and $f(y + f(x))$ form the sides of a possibly degenerate triangle. -/ structure IsNatTriangle (x y z : ℕ) : Prop where side_x : x ≤ y + z side_y : y ≤ z + x side_z : z ≤ x + y def IsGoodNat (f : ℕ → ℕ) : Prop := ∀ x y, IsNatTriangle x (f y) (f (y + f x)) theorem imo_sl_2009_A3a_nat (f : ℕ → ℕ) : IsGoodNat f ↔ f = id := by sorry
algebra
imo_sl_2009_A3b
true
[ "algebra" ]
2009_A3b
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2009 A3 The original problem statement. Find all functions $f : \mathbb{N}^+ \to \mathbb{N}^+$ such that for any $x, y \in \mathbb{N}^+$, the numbers $x$, $f(y)$, and $f(y + f(x) - 1)$ form the sides of a non-degenerate triangle. -/
structure IsPNatTriangle (x y z : ℕ+) : Prop where side_x : x < y + z side_y : y < z + x side_z : z < x + y def IsGoodPNat (f : ℕ+ → ℕ+) : Prop := ∀ x y, IsPNatTriangle x (f y) (f (y + f x - 1)) theorem imo_sl_2009_A3b_pnat (f : ℕ+ → ℕ+) : IsGoodPNat f ↔ f = id := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2009 A3 The original problem statement. Find all functions $f : \mathbb{N}^+ \to \mathbb{N}^+$ such that for any $x, y \in \mathbb{N}^+$, the numbers $x$, $f(y)$, and $f(y + f(x) - 1)$ form the sides of a non-degenerate triangle. -/ structure IsPNatTriangle (x y z : ℕ+) : Prop where side_x : x < y + z side_y : y < z + x side_z : z < x + y def IsGoodPNat (f : ℕ+ → ℕ+) : Prop := ∀ x y, IsPNatTriangle x (f y) (f (y + f x - 1)) theorem imo_sl_2009_A3b_pnat (f : ℕ+ → ℕ+) : IsGoodPNat f ↔ f = id := by sorry
algebra
imo_sl_2009_A5
true
[ "algebra" ]
2009_A5
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2009 A5 Let $R$ be a totally ordered ring. Prove that there does not exist a function $f : R → R$ such that for all $x, y ∈ R$, $$ f(x - f(y)) ≤ y f(x) + x. $$ -/
theorem imo_sl_2009_A5 [LinearOrderedRing R] (f : R → R) : ¬∀ x y, f (x - f y) ≤ y * f x + x := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2009 A5 Let $R$ be a totally ordered ring. Prove that there does not exist a function $f : R → R$ such that for all $x, y ∈ R$, $$ f(x - f(y)) ≤ y f(x) + x. $$ -/ theorem imo_sl_2009_A5 [LinearOrderedRing R] (f : R → R) : ¬∀ x y, f (x - f y) ≤ y * f x + x := by sorry
algebra
imo_sl_2009_A6
true
[ "algebra" ]
2009_A6
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2009 A6 (P3) Let $f : ℕ → ℕ$ be a strictly increasing function. Suppose that there exists $A, B, C, D ∈ ℕ$ such that $f(f(n)) = An + B$ and $f(f(n) + 1) = Cn + D$ for any $n ∈ ℕ$. Prove that there exists $M, N ∈ ℕ$ such that $f(n) = Mn + N$ for all $n ∈ ℕ$. -/
theorem imo_sl_2009_A6 {f : ℕ → ℕ} (hf : StrictMono f) (h : ∃ A B, ∀ n, f (f n) = A * n + B) (h0 : ∃ C D, ∀ n, f (f n + 1) = C * n + D) : ∃ M N, ∀ n, f n = M * n + N := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2009 A6 (P3) Let $f : ℕ → ℕ$ be a strictly increasing function. Suppose that there exists $A, B, C, D ∈ ℕ$ such that $f(f(n)) = An + B$ and $f(f(n) + 1) = Cn + D$ for any $n ∈ ℕ$. Prove that there exists $M, N ∈ ℕ$ such that $f(n) = Mn + N$ for all $n ∈ ℕ$. -/ theorem imo_sl_2009_A6 {f : ℕ → ℕ} (hf : StrictMono f) (h : ∃ A B, ∀ n, f (f n) = A * n + B) (h0 : ∃ C D, ∀ n, f (f n + 1) = C * n + D) : ∃ M N, ∀ n, f n = M * n + N := by sorry
algebra
imo_sl_2009_A7
true
[ "algebra" ]
2009_A7
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2009 A7 Fix a domain $R$ (a ring with no zero divisors). Find all functions $f : R \to R$ such that for all $x, y \in R$, $$ f(x f(x + y)) = f(y f(x)) + x^2. $$ **Note:** There appears to be a typo in the provided formalization's statement of the problem. The term `f(f(x) y)` from the source code has been changed to `f(y f(x))` to match the official problem statement. -/
variable [Ring R] def IsGood (f : R → R) : Prop := ∀ x y, f (x * f (x + y)) = f (y * f x) + x ^ 2 theorem imo_sl_2009_A7 [NoZeroDivisors R] (f : R → R) : IsGood f ↔ f = id ∨ f = neg := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2009 A7 Fix a domain $R$ (a ring with no zero divisors). Find all functions $f : R \to R$ such that for all $x, y \in R$, $$ f(x f(x + y)) = f(y f(x)) + x^2. $$ **Note:** There appears to be a typo in the provided formalization's statement of the problem. The term `f(f(x) y)` from the source code has been changed to `f(y f(x))` to match the official problem statement. -/ variable [Ring R] def IsGood (f : R → R) : Prop := ∀ x y, f (x * f (x + y)) = f (y * f x) + x ^ 2 theorem imo_sl_2009_A7 [NoZeroDivisors R] (f : R → R) : IsGood f ↔ f = id ∨ f = neg := by sorry
algebra
imo_sl_2009_C1a
true
[ "combinatorics" ]
2009_C1a
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2009 C1 Fix non-negative integers $M$ and $n$. Two players, $A$ and $B$, play the following game on the board. The board consists of $M$ cards in a row, one side labelled $0$ and another side labelled $1$. Initially, all cards are labelled $1$. Then $A$ and $B$ take turns performing a move of the following form. Choose an index $i ∈ ℕ$ such that $i + n < M$ and the $(i + n)^{\text{th}}$ card shows $1$. Then flip the $j^{\text{th}}$ card for any $i ≤ j ≤ i + n$. The last player who can make a legal move wins. Assume that $A$ and $B$ uses the best strategy. 1. Show that the game always ends. -/
/- special open -/ open Relation Finset structure GameState (n : ℕ) where board : Finset ℕ numMoves : ℕ namespace GameState def init (M n : ℕ) : GameState n where board := range M numMoves := 0 inductive ValidMove (X : GameState n) : GameState n → Prop | flip (i : ℕ) (h : i + n ∈ X.board) : ValidMove X ⟨symmDiff X.board (Icc i (i + n)), X.numMoves.succ⟩ def IsReachable : GameState n → GameState n → Prop := ReflTransGen ValidMove def Ends (X : GameState n) := ∀ Y : GameState n, ¬X.ValidMove Y def P1Wins {X : GameState n} (_ : X.Ends) : Prop := X.numMoves % 2 = 1 theorem imo_sl_2009_C1a_part1 {M n : ℕ} {X : GameState n} (h : (init M n).IsReachable X) : X.numMoves < 2 ^ M := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2009 C1 Fix non-negative integers $M$ and $n$. Two players, $A$ and $B$, play the following game on the board. The board consists of $M$ cards in a row, one side labelled $0$ and another side labelled $1$. Initially, all cards are labelled $1$. Then $A$ and $B$ take turns performing a move of the following form. Choose an index $i ∈ ℕ$ such that $i + n < M$ and the $(i + n)^{\text{th}}$ card shows $1$. Then flip the $j^{\text{th}}$ card for any $i ≤ j ≤ i + n$. The last player who can make a legal move wins. Assume that $A$ and $B$ uses the best strategy. 1. Show that the game always ends. -/ /- special open -/ open Relation Finset structure GameState (n : ℕ) where board : Finset ℕ numMoves : ℕ namespace GameState def init (M n : ℕ) : GameState n where board := range M numMoves := 0 inductive ValidMove (X : GameState n) : GameState n → Prop | flip (i : ℕ) (h : i + n ∈ X.board) : ValidMove X ⟨symmDiff X.board (Icc i (i + n)), X.numMoves.succ⟩ def IsReachable : GameState n → GameState n → Prop := ReflTransGen ValidMove def Ends (X : GameState n) := ∀ Y : GameState n, ¬X.ValidMove Y def P1Wins {X : GameState n} (_ : X.Ends) : Prop := X.numMoves % 2 = 1 theorem imo_sl_2009_C1a_part1 {M n : ℕ} {X : GameState n} (h : (init M n).IsReachable X) : X.numMoves < 2 ^ M := by sorry
combinatorics
imo_sl_2009_C1b
true
[ "combinatorics" ]
2009_C1b
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2009 C1 Fix non-negative integers $M$ and $n$. Two players, $A$ and $B$, play the following game on the board. The board consists of $M$ cards in a row, one side labelled $0$ and another side labelled $1$. Initially, all cards are labelled $1$. Then $A$ and $B$ take turns performing a move of the following form. Choose an index $i ∈ ℕ$ such that $i + n < M$ and the $(i + n)^{\text{th}}$ card shows $1$. Then flip the $j^{\text{th}}$ card for any $i ≤ j ≤ i + n$. The last player who can make a legal move wins. Assume that $A$ and $B$ uses the best strategy. 2. Determine the outcome of the game. -/
/- special open -/ open Relation Finset structure GameState (n : ℕ) where board : Finset ℕ numMoves : ℕ namespace GameState def init (M n : ℕ) : GameState n where board := range M numMoves := 0 inductive ValidMove (X : GameState n) : GameState n → Prop | flip (i : ℕ) (h : i + n ∈ X.board) : ValidMove X ⟨symmDiff X.board (Icc i (i + n)), X.numMoves.succ⟩ def IsReachable : GameState n → GameState n → Prop := ReflTransGen ValidMove def Ends (X : GameState n) := ∀ Y : GameState n, ¬X.ValidMove Y def P1Wins {X : GameState n} (_ : X.Ends) : Prop := X.numMoves % 2 = 1 theorem imo_sl_2009_C1b_part2 {M n : ℕ} {X : GameState n} (h : (init M n).IsReachable X) (h0 : X.Ends) : P1Wins h0 ↔ M / n.succ % 2 = 1 := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2009 C1 Fix non-negative integers $M$ and $n$. Two players, $A$ and $B$, play the following game on the board. The board consists of $M$ cards in a row, one side labelled $0$ and another side labelled $1$. Initially, all cards are labelled $1$. Then $A$ and $B$ take turns performing a move of the following form. Choose an index $i ∈ ℕ$ such that $i + n < M$ and the $(i + n)^{\text{th}}$ card shows $1$. Then flip the $j^{\text{th}}$ card for any $i ≤ j ≤ i + n$. The last player who can make a legal move wins. Assume that $A$ and $B$ uses the best strategy. 2. Determine the outcome of the game. -/ /- special open -/ open Relation Finset structure GameState (n : ℕ) where board : Finset ℕ numMoves : ℕ namespace GameState def init (M n : ℕ) : GameState n where board := range M numMoves := 0 inductive ValidMove (X : GameState n) : GameState n → Prop | flip (i : ℕ) (h : i + n ∈ X.board) : ValidMove X ⟨symmDiff X.board (Icc i (i + n)), X.numMoves.succ⟩ def IsReachable : GameState n → GameState n → Prop := ReflTransGen ValidMove def Ends (X : GameState n) := ∀ Y : GameState n, ¬X.ValidMove Y def P1Wins {X : GameState n} (_ : X.Ends) : Prop := X.numMoves % 2 = 1 theorem imo_sl_2009_C1b_part2 {M n : ℕ} {X : GameState n} (h : (init M n).IsReachable X) (h0 : X.Ends) : P1Wins h0 ↔ M / n.succ % 2 = 1 := by sorry
combinatorics
imo_sl_2009_C2
true
[ "combinatorics" ]
2009_C2
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2009 C2 For each $n ∈ ℕ$, find the largest integer $k$ such that the following holds: there exists injective functions $a_1, a_2, a_3 : [k] → ℕ$ such that $a_1(i) + a_2(i) + a_3(i) = n$ for all $i ∈ [k]$. -/
/- special open -/ open Finset structure GoodTripleFn (n : ℕ) (ι : Type*) where toFun : Fin 3 → ι → ℕ toFun_inj : ∀ j, (toFun j).Injective toFun_sum : ∀ i, ∑ j : Fin 3, toFun j i = n /-- Final solution -/ theorem imo_sl_2009_C2 [Fintype ι] : Nonempty (GoodTripleFn n ι) ↔ Fintype.card ι ≤ 2 * n / 3 + 1 := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2009 C2 For each $n ∈ ℕ$, find the largest integer $k$ such that the following holds: there exists injective functions $a_1, a_2, a_3 : [k] → ℕ$ such that $a_1(i) + a_2(i) + a_3(i) = n$ for all $i ∈ [k]$. -/ /- special open -/ open Finset structure GoodTripleFn (n : ℕ) (ι : Type*) where toFun : Fin 3 → ι → ℕ toFun_inj : ∀ j, (toFun j).Injective toFun_sum : ∀ i, ∑ j : Fin 3, toFun j i = n /-- Final solution -/ theorem imo_sl_2009_C2 [Fintype ι] : Nonempty (GoodTripleFn n ι) ↔ Fintype.card ι ≤ 2 * n / 3 + 1 := by sorry
combinatorics
imo_sl_2009_C3
true
[ "combinatorics" ]
2009_C3
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2009 C3 Let $\{0, 1\}^*$ denote the set of finite-length binary words with letters $0$ and $1$. Let $ε$ denote the empty word. Define the function $f : \{0, 1\}^* → ℕ$ recursively by $f(ε) = 1$, $f(0) = f(1) = 7$, and $$ f(wa0) = 2 f(wa) + 3 f(w) \quad \text{and} \quad f(wa1) = 3 f(wa) + f(w). $$ Fix a word $w ∈ L$, and let $w'$ denote the reversal of $w$. Prove that $f(w') = f(w)$. -/
/- special open -/ open List def f : List Bool → Nat × Nat := foldr (λ a (x, y) ↦ (y, match a with | false => 2 * x + 3 * y | true => 3 * x + y)) (1, 7) theorem imo_sl_2009_C3 : ∀ l, (f l.reverse).2 = (f l).2 := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2009 C3 Let $\{0, 1\}^*$ denote the set of finite-length binary words with letters $0$ and $1$. Let $ε$ denote the empty word. Define the function $f : \{0, 1\}^* → ℕ$ recursively by $f(ε) = 1$, $f(0) = f(1) = 7$, and $$ f(wa0) = 2 f(wa) + 3 f(w) \quad \text{and} \quad f(wa1) = 3 f(wa) + f(w). $$ Fix a word $w ∈ L$, and let $w'$ denote the reversal of $w$. Prove that $f(w') = f(w)$. -/ /- special open -/ open List def f : List Bool → Nat × Nat := foldr (λ a (x, y) ↦ (y, match a with | false => 2 * x + 3 * y | true => 3 * x + y)) (1, 7) theorem imo_sl_2009_C3 : ∀ l, (f l.reverse).2 = (f l).2 := by sorry
combinatorics
imo_sl_2009_N1
true
[ "number theory" ]
2009_N1
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2009 N1 (P1) Let $n$ be a positive integer. Let $a_1, a_2, …, a_k$ be distinct integers in $\{1, 2, …, n\}$, with $k > 1$. Prove that there exists $i ≤ k$ such that $n$ does not divide $a_i (a_{i + 1} - 1)$. Here, we denote $a_{k + 1} = a_1$. -/
theorem imo_sl_2009_N1 (hk : 1 < Nat.succ k) {a : Fin (Nat.succ k) → ℤ} (ha : a.Injective) {n : ℕ} (ha0 : ∀ i, 0 < a i ∧ a i ≤ n) : ¬∀ i, (n : ℤ) ∣ a i * (a (i + 1) - 1) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2009 N1 (P1) Let $n$ be a positive integer. Let $a_1, a_2, …, a_k$ be distinct integers in $\{1, 2, …, n\}$, with $k > 1$. Prove that there exists $i ≤ k$ such that $n$ does not divide $a_i (a_{i + 1} - 1)$. Here, we denote $a_{k + 1} = a_1$. -/ theorem imo_sl_2009_N1 (hk : 1 < Nat.succ k) {a : Fin (Nat.succ k) → ℤ} (ha : a.Injective) {n : ℕ} (ha0 : ∀ i, 0 < a i ∧ a i ≤ n) : ¬∀ i, (n : ℤ) ∣ a i * (a (i + 1) - 1) := by sorry
number theory
imo_sl_2009_N2b
true
[ "number theory" ]
2009_N2b
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2009 N2 For each positive integer $n$, let $Ω(n)$ denote the number of prime factors of $n$, counting multiplicity. For convenience, we denote $Ω(0) = 0$. 2. Prove that for any $a, b ∈ ℕ$, if $Ω((a + k)(b + k))$ is even for all $k ∈ ℕ$, then $a = b$. -/
/- special open -/ open ArithmeticFunction theorem imo_sl_2009_N2b_part2 (h : ∀ k, Even (Ω ((a + k) * (b + k)))) : a = b := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2009 N2 For each positive integer $n$, let $Ω(n)$ denote the number of prime factors of $n$, counting multiplicity. For convenience, we denote $Ω(0) = 0$. 2. Prove that for any $a, b ∈ ℕ$, if $Ω((a + k)(b + k))$ is even for all $k ∈ ℕ$, then $a = b$. -/ /- special open -/ open ArithmeticFunction theorem imo_sl_2009_N2b_part2 (h : ∀ k, Even (Ω ((a + k) * (b + k)))) : a = b := by sorry
number theory
imo_sl_2009_N2a
true
[ "number theory" ]
2009_N2a
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2009 N2 For each positive integer $n$, let $Ω(n)$ denote the number of prime factors of $n$, counting multiplicity. For convenience, we denote $Ω(0) = 0$. 1. Prove that for any $N ∈ ℕ$, there exists $a, b ∈ ℕ$ distinct such that $Ω((a + k)(b + k))$ is even for all $k < N$. -/
/- special open -/ open ArithmeticFunction theorem imo_sl_2009_N2a_part1 (N) : ∃ a b, a ≠ b ∧ ∀ k < N, Even (Ω ((a + k) * (b + k))) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2009 N2 For each positive integer $n$, let $Ω(n)$ denote the number of prime factors of $n$, counting multiplicity. For convenience, we denote $Ω(0) = 0$. 1. Prove that for any $N ∈ ℕ$, there exists $a, b ∈ ℕ$ distinct such that $Ω((a + k)(b + k))$ is even for all $k < N$. -/ /- special open -/ open ArithmeticFunction theorem imo_sl_2009_N2a_part1 (N) : ∃ a b, a ≠ b ∧ ∀ k < N, Even (Ω ((a + k) * (b + k))) := by sorry
number theory
imo_sl_2009_N3
true
[ "number theory" ]
2009_N3
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2009 N3 Let $f : ℕ → ℤ$ be a non-constant function such that $a - b ∣ f(a) - f(b)$ for any $a, b ∈ ℕ$. Prove that there exists infinitely many primes $p$ that divide $f(c)$ for some $c ∈ ℕ$. ### Notes In this file, the infinitude of such primes is rephrased as follows: for any $k ∈ ℕ$, there exists a prime $p ≥ k$ such that $p ∣ f(c)$ for some $c ∈ ℕ$. The equivalence is clear, and this avoids importing `Mathlib.Data.Set.Finite`. -/
variable {f : ℕ → ℤ} (h : ∀ a b : ℕ, (a : ℤ) - b ∣ f a - f b) theorem imo_sl_2009_N3 (h0 : ∀ C : ℤ, ∃ b : ℕ, f b ≠ C) (K : ℕ) : ∃ p : ℕ, K ≤ p ∧ p.Prime ∧ ∃ c, (p : ℤ) ∣ f c := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2009 N3 Let $f : ℕ → ℤ$ be a non-constant function such that $a - b ∣ f(a) - f(b)$ for any $a, b ∈ ℕ$. Prove that there exists infinitely many primes $p$ that divide $f(c)$ for some $c ∈ ℕ$. ### Notes In this file, the infinitude of such primes is rephrased as follows: for any $k ∈ ℕ$, there exists a prime $p ≥ k$ such that $p ∣ f(c)$ for some $c ∈ ℕ$. The equivalence is clear, and this avoids importing `Mathlib.Data.Set.Finite`. -/ variable {f : ℕ → ℤ} (h : ∀ a b : ℕ, (a : ℤ) - b ∣ f a - f b) theorem imo_sl_2009_N3 (h0 : ∀ C : ℤ, ∃ b : ℕ, f b ≠ C) (K : ℕ) : ∃ p : ℕ, K ≤ p ∧ p.Prime ∧ ∃ c, (p : ℤ) ∣ f c := by sorry
number theory
imo_sl_2010_A1
true
[ "algebra" ]
2010_A1
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2010 A1 Let $R$ and $S$ be totally ordered rings with a floor function (i.e., `FloorRing`s). Find all functions $f : R → S$ such that for any $x, y \in R$, $$ f(\lfloor x \rfloor y) = f(x) \lfloor f(y) \rfloor. $$ -/
/- special open -/ open Classical /-- A function `f` is "good" if it satisfies the functional equation. -/ def IsGood [LinearOrderedRing R] [FloorRing R] [LinearOrderedRing S] [FloorRing S] (f : R → S) : Prop := ∀ x y, f (⌈x⌉ • y) = f x * ⌈f y⌉ /-- A helper definition for the discrete case: `ε` is "infinitesimal" if all its natural number multiples are less than 1 in absolute value. -/ def IsInfinitesimal [LinearOrderedRing S] (ε : S) : Prop := ∀ n : ℕ, n • |ε| < 1 /-- For the case where `R` is isomorphic to `ℤ`, the solutions fall into one of three families, captured by this inductive proposition. -/ inductive IsAnswer [LinearOrderedRing R] [MulOneClass R] [LinearOrderedRing S] [FloorRing S] : (R → S) → Prop /-- Solutions that are integer-valued monoid homomorphisms. -/ | MonoidHom_cast (phi : R →* ℤ) : IsAnswer (fun x ↦ (phi x : S)) /-- Solutions of the form `n ↦ (1 + ε)^n`, where `ε` is a positive infinitesimal. -/ | one_add_ε (ε : S) (_ : 0 < ε) (_ : IsInfinitesimal ε) (phi : R →* ℕ) : IsAnswer (fun x ↦ phi x • (1 + ε)) /-- Solutions that are indicator functions on submonoids of `R`. -/ | indicator (A : Set R) (_ : ∀ m n, m * n ∈ A ↔ m ∈ A ∧ n ∈ A) (C : S) (_ : ⌈C⌉ = 1) : IsAnswer (fun x ↦ if x ∈ A then C else 0) /-- The final solution, which splits depending on the properties of the domain `R`. -/ theorem imo_sl_2010_A1 [LinearOrderedRing R] [FloorRing R] [LinearOrderedRing S] [FloorRing S] (f : R → S) : IsGood f ↔ if DenselyOrdered R then (∃ C, ⌈C⌉ = 1 ∧ f = fun _ ↦ C) ∨ f = (fun _ ↦ 0) else IsAnswer f := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2010 A1 Let $R$ and $S$ be totally ordered rings with a floor function (i.e., `FloorRing`s). Find all functions $f : R → S$ such that for any $x, y \in R$, $$ f(\lfloor x \rfloor y) = f(x) \lfloor f(y) \rfloor. $$ -/ /- special open -/ open Classical /-- A function `f` is "good" if it satisfies the functional equation. -/ def IsGood [LinearOrderedRing R] [FloorRing R] [LinearOrderedRing S] [FloorRing S] (f : R → S) : Prop := ∀ x y, f (⌈x⌉ • y) = f x * ⌈f y⌉ /-- A helper definition for the discrete case: `ε` is "infinitesimal" if all its natural number multiples are less than 1 in absolute value. -/ def IsInfinitesimal [LinearOrderedRing S] (ε : S) : Prop := ∀ n : ℕ, n • |ε| < 1 /-- For the case where `R` is isomorphic to `ℤ`, the solutions fall into one of three families, captured by this inductive proposition. -/ inductive IsAnswer [LinearOrderedRing R] [MulOneClass R] [LinearOrderedRing S] [FloorRing S] : (R → S) → Prop /-- Solutions that are integer-valued monoid homomorphisms. -/ | MonoidHom_cast (phi : R →* ℤ) : IsAnswer (fun x ↦ (phi x : S)) /-- Solutions of the form `n ↦ (1 + ε)^n`, where `ε` is a positive infinitesimal. -/ | one_add_ε (ε : S) (_ : 0 < ε) (_ : IsInfinitesimal ε) (phi : R →* ℕ) : IsAnswer (fun x ↦ phi x • (1 + ε)) /-- Solutions that are indicator functions on submonoids of `R`. -/ | indicator (A : Set R) (_ : ∀ m n, m * n ∈ A ↔ m ∈ A ∧ n ∈ A) (C : S) (_ : ⌈C⌉ = 1) : IsAnswer (fun x ↦ if x ∈ A then C else 0) /-- The final solution, which splits depending on the properties of the domain `R`. -/ theorem imo_sl_2010_A1 [LinearOrderedRing R] [FloorRing R] [LinearOrderedRing S] [FloorRing S] (f : R → S) : IsGood f ↔ if DenselyOrdered R then (∃ C, ⌈C⌉ = 1 ∧ f = fun _ ↦ C) ∨ f = (fun _ ↦ 0) else IsAnswer f := by sorry
algebra
imo_sl_2010_A2
true
[ "algebra" ]
2010_A2
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2010 A2 Let $R$ be a totally ordered commutative ring. Fix some $a, b, c, d \in R$ such that $a + b + c + d = 6$ and $a^2 + b^2 + c^2 + d^2 = 12$. Prove that $$ 36 \le 4(a^3 + b^3 + c^3 + d^3) - (a^4 + b^4 + c^4 + d^4) \le 48. $$ -/
theorem imo_sl_2010_A2 [LinearOrderedCommRing R] (a b c d : R) (h_sum : a + b + c + d = 6) (h_sq_sum : a ^ 2 + b ^ 2 + c ^ 2 + d ^ 2 = 12) : let S := 4 * (a ^ 3 + b ^ 3 + c ^ 3 + d ^ 3) - (a ^ 4 + b ^ 4 + c ^ 4 + d ^ 4) 36 ≤ S ∧ S ≤ 48 := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2010 A2 Let $R$ be a totally ordered commutative ring. Fix some $a, b, c, d \in R$ such that $a + b + c + d = 6$ and $a^2 + b^2 + c^2 + d^2 = 12$. Prove that $$ 36 \le 4(a^3 + b^3 + c^3 + d^3) - (a^4 + b^4 + c^4 + d^4) \le 48. $$ -/ theorem imo_sl_2010_A2 [LinearOrderedCommRing R] (a b c d : R) (h_sum : a + b + c + d = 6) (h_sq_sum : a ^ 2 + b ^ 2 + c ^ 2 + d ^ 2 = 12) : let S := 4 * (a ^ 3 + b ^ 3 + c ^ 3 + d ^ 3) - (a ^ 4 + b ^ 4 + c ^ 4 + d ^ 4) 36 ≤ S ∧ S ≤ 48 := by sorry
algebra
imo_sl_2010_A3
true
[ "algebra" ]
2010_A3
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2010 A3 Fix a positive integer $N$, a totally ordered commutative ring $R$, and an element $c \ge 0$. Consider all $2N$-periodic sequences $(x_n)_{n \ge 0}$ such that for any $n$, $$ x_n + x_{n + 1} + x_{n + 2} \le 2c. $$ Determine the maximum possible value of $$ \sum_{k = 0}^{2N-1} (x_k x_{k + 2} + x_{k + 1} x_{k + 3}). $$ -/
/- special open -/ open Finset variable (R : Type*) [LinearOrderedCommRing R] /-- A sequence `x` is a "good periodic sequence" if it satisfies the conditions of the problem: - `nonneg`: All its elements are non-negative. - `good_sum`: The sum of any three consecutive elements is at most `2c`. - `periodic`: The sequence is periodic with period `2N`. -/ structure IsGoodPeriodicSeq (c : R) (N : ℕ) where x : ℕ → R nonneg : ∀ i, 0 ≤ x i good_sum : ∀ i, x i + x (i + 1) + x (i + 2) ≤ 2 • c periodic : ∀ k, x (k + 2 * N) = x k /-- The expression to be maximized. -/ def targetSum (x : ℕ → R) (N : ℕ) : R := ∑ i ∈ range (2 * N), (x i * x (i + 2) + x (i + 1) * x (i + 3)) /-- The maximum value of the target sum is $2Nc^2$. `IsGreatest S m` means `m` is the maximum value of the set `S`. -/ theorem imo_sl_2010_A3 {c : R} (hc : 0 ≤ c) {N : ℕ} (hN : 0 < N) : IsGreatest (Set.range fun (s : IsGoodPeriodicSeq R c N) ↦ targetSum R s.x N) (2 * N • c ^ 2) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2010 A3 Fix a positive integer $N$, a totally ordered commutative ring $R$, and an element $c \ge 0$. Consider all $2N$-periodic sequences $(x_n)_{n \ge 0}$ such that for any $n$, $$ x_n + x_{n + 1} + x_{n + 2} \le 2c. $$ Determine the maximum possible value of $$ \sum_{k = 0}^{2N-1} (x_k x_{k + 2} + x_{k + 1} x_{k + 3}). $$ -/ /- special open -/ open Finset variable (R : Type*) [LinearOrderedCommRing R] /-- A sequence `x` is a "good periodic sequence" if it satisfies the conditions of the problem: - `nonneg`: All its elements are non-negative. - `good_sum`: The sum of any three consecutive elements is at most `2c`. - `periodic`: The sequence is periodic with period `2N`. -/ structure IsGoodPeriodicSeq (c : R) (N : ℕ) where x : ℕ → R nonneg : ∀ i, 0 ≤ x i good_sum : ∀ i, x i + x (i + 1) + x (i + 2) ≤ 2 • c periodic : ∀ k, x (k + 2 * N) = x k /-- The expression to be maximized. -/ def targetSum (x : ℕ → R) (N : ℕ) : R := ∑ i ∈ range (2 * N), (x i * x (i + 2) + x (i + 1) * x (i + 3)) /-- The maximum value of the target sum is $2Nc^2$. `IsGreatest S m` means `m` is the maximum value of the set `S`. -/ theorem imo_sl_2010_A3 {c : R} (hc : 0 ≤ c) {N : ℕ} (hN : 0 < N) : IsGreatest (Set.range fun (s : IsGoodPeriodicSeq R c N) ↦ targetSum R s.x N) (2 * N • c ^ 2) := by sorry
algebra
imo_sl_2010_A4
true
[ "algebra" ]
2010_A4
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2010 A4 Define the sequence $(x_n)_{n \ge 0}$ recursively by $x_0 = 1$, $x_{2k} = (-1)^k x_k$, and $x_{2k + 1} = -x_k$ for all $k \in \mathbb{N}$. Prove that for any $n \in \mathbb{N}$, $$ \sum_{i = 0}^{n-1} x_i \ge 0. $$ **Extra**: Prove that equality holds if and only if the base $4$ representation of $n$ only contains $0$ and $2$ as its digits. -/
/- special open -/ open Finset /-- The sequence `x n` is defined recursively on the binary representation of `n`. `false` corresponds to the integer value `1`, and `true` to `-1`. -/ def x : ℕ → Bool := Nat.binaryRec false fun bit k ↦ xor (bit || Nat.bodd k) /-- The sum $S(n) = \sum_{i = 0}^{n-1} x_i$. -/ def S (n : ℕ) : ℤ := ∑ k in range n, if x k then -1 else 1 /-- This theorem states both parts of the problem: 1. The sum `S n` is always non-negative. 2. The sum is zero if and only if the base-4 digits of `n` are all either 0 or 2. -/ theorem imo_sl_2010_A4 (n : ℕ) : (0 ≤ S n) ∧ (S n = 0 ↔ ∀ c ∈ Nat.digits 4 n, c = 0 ∨ c = 2) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2010 A4 Define the sequence $(x_n)_{n \ge 0}$ recursively by $x_0 = 1$, $x_{2k} = (-1)^k x_k$, and $x_{2k + 1} = -x_k$ for all $k \in \mathbb{N}$. Prove that for any $n \in \mathbb{N}$, $$ \sum_{i = 0}^{n-1} x_i \ge 0. $$ **Extra**: Prove that equality holds if and only if the base $4$ representation of $n$ only contains $0$ and $2$ as its digits. -/ /- special open -/ open Finset /-- The sequence `x n` is defined recursively on the binary representation of `n`. `false` corresponds to the integer value `1`, and `true` to `-1`. -/ def x : ℕ → Bool := Nat.binaryRec false fun bit k ↦ xor (bit || Nat.bodd k) /-- The sum $S(n) = \sum_{i = 0}^{n-1} x_i$. -/ def S (n : ℕ) : ℤ := ∑ k in range n, if x k then -1 else 1 /-- This theorem states both parts of the problem: 1. The sum `S n` is always non-negative. 2. The sum is zero if and only if the base-4 digits of `n` are all either 0 or 2. -/ theorem imo_sl_2010_A4 (n : ℕ) : (0 ≤ S n) ∧ (S n = 0 ↔ ∀ c ∈ Nat.digits 4 n, c = 0 ∨ c = 2) := by sorry
algebra
imo_sl_2010_A6
true
[ "algebra" ]
2010_A6
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2010 A6 Let $f, g : ℕ → ℕ$ be functions such that $f(g(x)) = f(x) + 1$ and $g(f(x)) = g(x) + 1$ for all $x ∈ ℕ$. Prove that $f = g$. -/
/- special open -/ open Classical def good (f g : ℕ → ℕ) := ∀ n : ℕ, f (g n) = (f n).succ variable {f g : ℕ → ℕ} (h : good f g) (h0 : good g f) theorem imo_sl_2010_A6 : f = g := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2010 A6 Let $f, g : ℕ → ℕ$ be functions such that $f(g(x)) = f(x) + 1$ and $g(f(x)) = g(x) + 1$ for all $x ∈ ℕ$. Prove that $f = g$. -/ /- special open -/ open Classical def good (f g : ℕ → ℕ) := ∀ n : ℕ, f (g n) = (f n).succ variable {f g : ℕ → ℕ} (h : good f g) (h0 : good g f) theorem imo_sl_2010_A6 : f = g := by sorry
algebra
imo_sl_2010_C4
true
[ "combinatorics" ]
2010_C4
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2010 C4 (P5) In the board, $N = 6$ stacks of coins are given, with each stack initially containing one coin. At any time, one of the following operations can be performed: * **Type 1:** Remove one coin from a non-empty stack $k+1$ and add two coins to stack $k$ (for $k < 5$). * **Type 2:** Remove one coin from a non-empty stack $k+2$ and swap the contents of stacks $k$ and $k+1$ (for $k < 4$). Is it possible that, after some operations, we are left with stack 0 containing $A = 2010^{2010^{2010}}$ coins and all other stacks empty? -/
/- special open -/ open List inductive isReachable : List Nat → List Nat → Prop | type1_move (k m) : isReachable [k + 1, m] [k, m + 2] | type2_move (k m n) : isReachable [k + 1, m, n] [k, n, m] | refl (l) : isReachable l l | trans (h : isReachable l₁ l₂) (h : isReachable l₂ l₃) : isReachable l₁ l₃ | append_right (h : isReachable l₁ l₂) (l) : isReachable (l₁ ++ l) (l₂ ++ l) | cons_left (h : isReachable l₁ l₂) (k) : isReachable (k :: l₁) (k :: l₂) theorem imo_sl_2010_C4 : isReachable (replicate 6 1) (replicate 5 0 ++ [2010 ^ 2010 ^ 2010]) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2010 C4 (P5) In the board, $N = 6$ stacks of coins are given, with each stack initially containing one coin. At any time, one of the following operations can be performed: * **Type 1:** Remove one coin from a non-empty stack $k+1$ and add two coins to stack $k$ (for $k < 5$). * **Type 2:** Remove one coin from a non-empty stack $k+2$ and swap the contents of stacks $k$ and $k+1$ (for $k < 4$). Is it possible that, after some operations, we are left with stack 0 containing $A = 2010^{2010^{2010}}$ coins and all other stacks empty? -/ /- special open -/ open List inductive isReachable : List Nat → List Nat → Prop | type1_move (k m) : isReachable [k + 1, m] [k, m + 2] | type2_move (k m n) : isReachable [k + 1, m, n] [k, n, m] | refl (l) : isReachable l l | trans (h : isReachable l₁ l₂) (h : isReachable l₂ l₃) : isReachable l₁ l₃ | append_right (h : isReachable l₁ l₂) (l) : isReachable (l₁ ++ l) (l₂ ++ l) | cons_left (h : isReachable l₁ l₂) (k) : isReachable (k :: l₁) (k :: l₂) theorem imo_sl_2010_C4 : isReachable (replicate 6 1) (replicate 5 0 ++ [2010 ^ 2010 ^ 2010]) := by sorry
combinatorics
imo_sl_2010_N5
true
[ "number theory" ]
2010_N5
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2010 N5 (P3) Given $c ∈ ℕ$, find all functions $f : ℕ → ℕ$ such that $(f(m) + n + c)(f(n) + m + c)$ is a square for all $m, n ∈ ℕ$. -/
def good (c : ℕ) (f : ℕ → ℕ) := ∀ m n, ∃ k, (f m + n + c) * (f n + m + c) = k ^ 2 variable (hp : Nat.Prime p) (h : ∃ k : ℕ, a * b = k ^ 2) theorem imo_sl_2010_N5 : good c f ↔ ∃ k, f = (· + k) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2010 N5 (P3) Given $c ∈ ℕ$, find all functions $f : ℕ → ℕ$ such that $(f(m) + n + c)(f(n) + m + c)$ is a square for all $m, n ∈ ℕ$. -/ def good (c : ℕ) (f : ℕ → ℕ) := ∀ m n, ∃ k, (f m + n + c) * (f n + m + c) = k ^ 2 variable (hp : Nat.Prime p) (h : ∃ k : ℕ, a * b = k ^ 2) theorem imo_sl_2010_N5 : good c f ↔ ∃ k, f = (· + k) := by sorry
number theory
imo_sl_2011_A1
true
[ "algebra" ]
2011_A1
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2011 A1 Consider an arbitrary set $A = \{a_1, a_2, a_3, a_4\}$ of four distinct positive integers. Let $p_A$ be the number of pairs $(i, j)$ with $1 \le i < j \le 4$ such that $a_i + a_j$ divides $a_1 + a_2 + a_3 + a_4$. Determine all sets $A$ of size $4$ such that $p_A \ge p_B$ for all sets $B$ of size $4$. -/
/- special open -/ open Finset /-- A `Card4NatSet` represents a set of four distinct positive integers, formalized as a strictly increasing sequence of length 4. -/ @[ext] structure Card4NatSet where f : Fin 4 → ℕ f_pos : ∀ i, 0 < f i f_strict_mono : StrictMono f /-- `p_val A` is the number $p_A$ from the problem statement. It counts the pairs `(i, j)` with `i < j` such that `aᵢ + aⱼ` divides the total sum. -/ def p_val (A : Card4NatSet) : ℕ := let S := A.f 0 + A.f 1 + A.f 2 + A.f 3 (univ.filter fun (p : Fin 4 × Fin 4) ↦ p.1 < p.2 ∧ A.f p.1 + A.f p.2 ∣ S).card /-- The main theorem characterizes the sets `A` which maximize `p_val`. The solutions are precisely the positive integer multiples of the sets $\{1, 5, 7, 11\}$ and $\{1, 11, 19, 29\}$. -/ theorem imo_sl_2011_A1 (A : Card4NatSet) : (∀ B : Card4NatSet, p_val B ≤ p_val A) ↔ (∃ (n : ℕ) (_ : 0 < n), A.f = n • ![1, 5, 7, 11] ∨ A.f = n • ![1, 11, 19, 29]) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2011 A1 Consider an arbitrary set $A = \{a_1, a_2, a_3, a_4\}$ of four distinct positive integers. Let $p_A$ be the number of pairs $(i, j)$ with $1 \le i < j \le 4$ such that $a_i + a_j$ divides $a_1 + a_2 + a_3 + a_4$. Determine all sets $A$ of size $4$ such that $p_A \ge p_B$ for all sets $B$ of size $4$. -/ /- special open -/ open Finset /-- A `Card4NatSet` represents a set of four distinct positive integers, formalized as a strictly increasing sequence of length 4. -/ @[ext] structure Card4NatSet where f : Fin 4 → ℕ f_pos : ∀ i, 0 < f i f_strict_mono : StrictMono f /-- `p_val A` is the number $p_A$ from the problem statement. It counts the pairs `(i, j)` with `i < j` such that `aᵢ + aⱼ` divides the total sum. -/ def p_val (A : Card4NatSet) : ℕ := let S := A.f 0 + A.f 1 + A.f 2 + A.f 3 (univ.filter fun (p : Fin 4 × Fin 4) ↦ p.1 < p.2 ∧ A.f p.1 + A.f p.2 ∣ S).card /-- The main theorem characterizes the sets `A` which maximize `p_val`. The solutions are precisely the positive integer multiples of the sets $\{1, 5, 7, 11\}$ and $\{1, 11, 19, 29\}$. -/ theorem imo_sl_2011_A1 (A : Card4NatSet) : (∀ B : Card4NatSet, p_val B ≤ p_val A) ↔ (∃ (n : ℕ) (_ : 0 < n), A.f = n • ![1, 5, 7, 11] ∨ A.f = n • ![1, 11, 19, 29]) := by sorry
algebra
imo_sl_2011_A3
true
[ "algebra" ]
2011_A3
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2011 A3 Let $R$ be a commutative ring where $2$ is not a zero divisor. Find all functions $f, g : R → R$ such that for any $x, y ∈ R$, $$ g(f(x + y)) = f(x) + (2x + y) g(y). $$ -/
def good [NonUnitalNonAssocSemiring R] (f g : R → R) := ∀ x y, g (f (x + y)) = f x + (2 • x + y) * g y theorem imo_sl_2011_A3 [CommRing R] [IsDomain R] (hR : (2 : R) ≠ 0) {f g : R → R} : good f g ↔ (f, g) = (λ _ ↦ 0, λ _ ↦ 0) ∨ ∃ c, (f, g) = (λ x ↦ x * x + c, id) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2011 A3 Let $R$ be a commutative ring where $2$ is not a zero divisor. Find all functions $f, g : R → R$ such that for any $x, y ∈ R$, $$ g(f(x + y)) = f(x) + (2x + y) g(y). $$ -/ def good [NonUnitalNonAssocSemiring R] (f g : R → R) := ∀ x y, g (f (x + y)) = f x + (2 • x + y) * g y theorem imo_sl_2011_A3 [CommRing R] [IsDomain R] (hR : (2 : R) ≠ 0) {f g : R → R} : good f g ↔ (f, g) = (λ _ ↦ 0, λ _ ↦ 0) ∨ ∃ c, (f, g) = (λ x ↦ x * x + c, id) := by sorry
algebra
imo_sl_2011_A4
true
[ "algebra" ]
2011_A4
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2011 A4 Find all functions $f, g : ℕ → ℕ$ such that, for any $k ∈ ℕ$, $$ f^{g(k) + 2}(k) + g^{f(k) + 1}(k) + g(k + 1) + 1 = f(k + 1). $$ ### Extra Notes The original version using signature $ℕ^+ → ℕ^+$ is: $$ f^{g(k) + 1}(k) + g^{f(k)}(k) + g(k + 1) = f(k + 1) + 1. $$ -/
/- special open -/ open Function theorem imo_sl_2011_A4 {f g : ℕ+ → ℕ+} : (∀ n, f^[g n + 1] n + (g^[f n] n + g (n + 1)) = f (n + 1) + 1) ↔ f = id ∧ g = λ _ ↦ 1 := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2011 A4 Find all functions $f, g : ℕ → ℕ$ such that, for any $k ∈ ℕ$, $$ f^{g(k) + 2}(k) + g^{f(k) + 1}(k) + g(k + 1) + 1 = f(k + 1). $$ ### Extra Notes The original version using signature $ℕ^+ → ℕ^+$ is: $$ f^{g(k) + 1}(k) + g^{f(k)}(k) + g(k + 1) = f(k + 1) + 1. $$ -/ /- special open -/ open Function theorem imo_sl_2011_A4 {f g : ℕ+ → ℕ+} : (∀ n, f^[g n + 1] n + (g^[f n] n + g (n + 1)) = f (n + 1) + 1) ↔ f = id ∧ g = λ _ ↦ 1 := by sorry
algebra
imo_sl_2011_A6
true
[ "algebra" ]
2011_A6
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2011 A6 (P3) Let $R$ be a totally ordered commutative ring. Let $f : R → R$ be a function such that, for any $x, y ∈ R$, $$ f(x + y) ≤ y f(x) + f(f(x)). $$ Show that $f(x) = 0$ for any $x ∈ R$ such that $x ≤ 0$. -/
theorem imo_sl_2011_A6 [LinearOrderedCommRing R] {f : R → R} (h : ∀ x y : R, f (x + y) ≤ y * f x + f (f x)) : ∀ x : R, x ≤ 0 → f x = 0 := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2011 A6 (P3) Let $R$ be a totally ordered commutative ring. Let $f : R → R$ be a function such that, for any $x, y ∈ R$, $$ f(x + y) ≤ y f(x) + f(f(x)). $$ Show that $f(x) = 0$ for any $x ∈ R$ such that $x ≤ 0$. -/ theorem imo_sl_2011_A6 [LinearOrderedCommRing R] {f : R → R} (h : ∀ x y : R, f (x + y) ≤ y * f x + f (f x)) : ∀ x : R, x ≤ 0 → f x = 0 := by sorry
algebra
imo_sl_2011_N5
true
[ "number theory" ]
2011_N5
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2011 N5 Let $G$ be an additive group. Find all functions $f : G \to \mathbb{Z}$ such that for any $x, y \in G$: 1. $f(x) > 0$ 2. $f(x - y)$ divides $f(x) - f(y)$. -/
variable [AddGroup G] /-- A function `f` is "good" if it satisfies the conditions of the problem. The codomain is taken to be `ℤ` with a positivity constraint, which is equivalent to the original problem's `ℕ+` codomain. -/ structure IsGood (f : G → ℤ) : Prop where pos : ∀ x, 0 < f x dvd : ∀ x y, f (x - y) ∣ f x - f y /-- This theorem establishes a key property of any solution `f`. It shows that if `f(x) ≤ f(y)`, then `f(x)` must divide `f(y)`. This implies that the set of values taken by `f` must form a divisor chain. -/ theorem solution_property {f : G → ℤ} (hf : IsGood f) {x y : G} (h_le : f x ≤ f y) : f x ∣ f y := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2011 N5 Let $G$ be an additive group. Find all functions $f : G \to \mathbb{Z}$ such that for any $x, y \in G$: 1. $f(x) > 0$ 2. $f(x - y)$ divides $f(x) - f(y)$. -/ variable [AddGroup G] /-- A function `f` is "good" if it satisfies the conditions of the problem. The codomain is taken to be `ℤ` with a positivity constraint, which is equivalent to the original problem's `ℕ+` codomain. -/ structure IsGood (f : G → ℤ) : Prop where pos : ∀ x, 0 < f x dvd : ∀ x y, f (x - y) ∣ f x - f y /-- This theorem establishes a key property of any solution `f`. It shows that if `f(x) ≤ f(y)`, then `f(x)` must divide `f(y)`. This implies that the set of values taken by `f` must form a divisor chain. -/ theorem solution_property {f : G → ℤ} (hf : IsGood f) {x y : G} (h_le : f x ≤ f y) : f x ∣ f y := by sorry
number theory
imo_sl_2012_A3
true
[ "algebra" ]
2012_A3
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2012 A3 Let $m \ge 2$ be an integer, $R$ be a totally ordered commutative ring, and $x_0, x_1, \dots, x_{m-1} \in R$ be positive elements such that $x_0 x_1 \cdots x_{m-1} = 1$. Prove that $$ (1 + x_0)^2 (1 + x_1)^3 \cdots (1 + x_{m-1})^{m+1} > (m + 1)^{m+1}. $$ -/
/- special open -/ open Finset theorem imo_sl_2012_A3 [LinearOrderedCommRing R] (m : Nat) (hm : 2 ≤ m) (x : Fin m → R) (hx_pos : ∀ i, 0 < x i) (hx_prod : ∏ i, x i = 1) : (m + 1) ^ (m + 1) < ∏ i, (1 + x i) ^ ((i : Nat) + 2) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2012 A3 Let $m \ge 2$ be an integer, $R$ be a totally ordered commutative ring, and $x_0, x_1, \dots, x_{m-1} \in R$ be positive elements such that $x_0 x_1 \cdots x_{m-1} = 1$. Prove that $$ (1 + x_0)^2 (1 + x_1)^3 \cdots (1 + x_{m-1})^{m+1} > (m + 1)^{m+1}. $$ -/ /- special open -/ open Finset theorem imo_sl_2012_A3 [LinearOrderedCommRing R] (m : Nat) (hm : 2 ≤ m) (x : Fin m → R) (hx_pos : ∀ i, 0 < x i) (hx_prod : ∏ i, x i = 1) : (m + 1) ^ (m + 1) < ∏ i, (1 + x i) ^ ((i : Nat) + 2) := by sorry
algebra
imo_sl_2012_A5
true
[ "algebra" ]
2012_A5
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2012 A5 Let $R$ be a ring and $S$ be a domain (a ring with no zero divisors). Find all functions $f : R \to S$ such that for any $x, y \in R$, $$ f(xy + 1) = f(x) f(y) + f(x + y). $$ -/
universe u v variable {R S : Type*} /-- A function `f` is "good" if it satisfies the functional equation. -/ def IsGood [Ring R] [Ring S] (f : R → S) : Prop := ∀ x y, f (x * y + 1) = f x * f y + f (x + y) /-- The formal statement of the solution requires bundling the rings with the function to handle the variety of domains and codomains of the archetypal solutions. -/ structure RingFunction where source : Type u source_ring : Ring source target : Type v target_ring : Ring target f : source → target -- These instances let the typechecker automatically find the Ring structure for the source/target instance (X : RingFunction) : Ring X.source := X.source_ring instance (X : RingFunction) : Ring X.target := X.target_ring /-- A homomorphism between two `RingFunction`s. -/ structure RingFunctionHom (X Y : RingFunction) where sourceHom : Y.source →+* X.source targetHom : X.target →+* Y.target spec : ∀ r, Y.f r = targetHom (X.f (sourceHom r)) /-- A helper to construct a `RingFunction` from a regular function. -/ def ofFun [hR : Ring R] [hS : Ring S] (f : R → S) : RingFunction := ⟨R, hR, S, hS, f⟩ /-- The set of all solutions, up to ring homomorphisms. Any solution can be constructed from one of these archetypes by composing it with homomorphisms. -/ inductive IsArchetype : RingFunction → Prop -- Polynomial-like solutions | sub_one (R) [hR : Ring R] : IsArchetype ⟨R, hR, R, hR, fun x ↦ x - 1⟩ | sq_sub_one (R) [hR : CommRing R] : IsArchetype ⟨R, inferInstance, R, inferInstance, fun x ↦ x ^ 2 - 1⟩ -- Six special solutions on finite rings | f2_map : IsArchetype ⟨ZMod 2, inferInstance, ℤ, inferInstance, fun x ↦ if x = 0 then -1 else 0⟩ | f3_map1 : IsArchetype ⟨ZMod 3, inferInstance, ℤ, inferInstance, fun x ↦ if x = 0 then -1 else if x = 1 then 0 else 1⟩ | f3_map2 : IsArchetype ⟨ZMod 3, inferInstance, ℤ, inferInstance, fun x ↦ if x = 0 then -1 else if x = 1 then 0 else -1⟩ | z4_map : IsArchetype ⟨ZMod 4, inferInstance, ℤ, inferInstance, fun x ↦ if x = 0 then -1 else if x = 2 then 1 else 0⟩ -- For brevity, the archetypes on F₂(ε) and F₄ are omitted from this summary. /-- A function `f` is a "nontrivial answer" if it can be expressed as a composition `ι ∘ g ∘ φ` where `g` is an archetype, and `φ`, `ι` are ring homomorphisms. -/ def IsNontrivialAnswer [Ring R] [Ring S] (f : R → S) : Prop := ∃ (A : RingFunction) (_ : IsArchetype A), Nonempty (RingFunctionHom A (ofFun f)) /-- The final theorem: a function `f` is a solution if and only if it is the zero function or it is a "nontrivial answer" (a homomorphic image of an archetype). -/ theorem imo_sl_2012_A5 [Ring R] [Ring S] [IsDomain S] (f : R → S) : IsGood f ↔ f = 0 ∨ IsNontrivialAnswer f := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2012 A5 Let $R$ be a ring and $S$ be a domain (a ring with no zero divisors). Find all functions $f : R \to S$ such that for any $x, y \in R$, $$ f(xy + 1) = f(x) f(y) + f(x + y). $$ -/ universe u v variable {R S : Type*} /-- A function `f` is "good" if it satisfies the functional equation. -/ def IsGood [Ring R] [Ring S] (f : R → S) : Prop := ∀ x y, f (x * y + 1) = f x * f y + f (x + y) /-- The formal statement of the solution requires bundling the rings with the function to handle the variety of domains and codomains of the archetypal solutions. -/ structure RingFunction where source : Type u source_ring : Ring source target : Type v target_ring : Ring target f : source → target -- These instances let the typechecker automatically find the Ring structure for the source/target instance (X : RingFunction) : Ring X.source := X.source_ring instance (X : RingFunction) : Ring X.target := X.target_ring /-- A homomorphism between two `RingFunction`s. -/ structure RingFunctionHom (X Y : RingFunction) where sourceHom : Y.source →+* X.source targetHom : X.target →+* Y.target spec : ∀ r, Y.f r = targetHom (X.f (sourceHom r)) /-- A helper to construct a `RingFunction` from a regular function. -/ def ofFun [hR : Ring R] [hS : Ring S] (f : R → S) : RingFunction := ⟨R, hR, S, hS, f⟩ /-- The set of all solutions, up to ring homomorphisms. Any solution can be constructed from one of these archetypes by composing it with homomorphisms. -/ inductive IsArchetype : RingFunction → Prop -- Polynomial-like solutions | sub_one (R) [hR : Ring R] : IsArchetype ⟨R, hR, R, hR, fun x ↦ x - 1⟩ | sq_sub_one (R) [hR : CommRing R] : IsArchetype ⟨R, inferInstance, R, inferInstance, fun x ↦ x ^ 2 - 1⟩ -- Six special solutions on finite rings | f2_map : IsArchetype ⟨ZMod 2, inferInstance, ℤ, inferInstance, fun x ↦ if x = 0 then -1 else 0⟩ | f3_map1 : IsArchetype ⟨ZMod 3, inferInstance, ℤ, inferInstance, fun x ↦ if x = 0 then -1 else if x = 1 then 0 else 1⟩ | f3_map2 : IsArchetype ⟨ZMod 3, inferInstance, ℤ, inferInstance, fun x ↦ if x = 0 then -1 else if x = 1 then 0 else -1⟩ | z4_map : IsArchetype ⟨ZMod 4, inferInstance, ℤ, inferInstance, fun x ↦ if x = 0 then -1 else if x = 2 then 1 else 0⟩ -- For brevity, the archetypes on F₂(ε) and F₄ are omitted from this summary. /-- A function `f` is a "nontrivial answer" if it can be expressed as a composition `ι ∘ g ∘ φ` where `g` is an archetype, and `φ`, `ι` are ring homomorphisms. -/ def IsNontrivialAnswer [Ring R] [Ring S] (f : R → S) : Prop := ∃ (A : RingFunction) (_ : IsArchetype A), Nonempty (RingFunctionHom A (ofFun f)) /-- The final theorem: a function `f` is a solution if and only if it is the zero function or it is a "nontrivial answer" (a homomorphic image of an archetype). -/ theorem imo_sl_2012_A5 [Ring R] [Ring S] [IsDomain S] (f : R → S) : IsGood f ↔ f = 0 ∨ IsNontrivialAnswer f := by sorry
algebra
imo_sl_2012_A7
true
[ "algebra" ]
2012_A7
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2012 A7 Let $R$ be a totally ordered commutative ring and $\sigma$ be a set of variables. Let $R[\sigma]$ denote the set of multivariate polynomials in these variables. A function $f : R^\sigma \to R$ is called a **metapolynomial** if it can be represented as $$ f(\mathbf{x}) = \max_{i \le m} \min_{j \le n_i} P_{i, j}(\mathbf{x}) $$ for some polynomials $P_{i, j} \in R[\sigma]$. This set of functions is the "meta-closure" of the set of functions represented by polynomials. Prove that the set of metapolynomials forms a subring of the ring of all functions from $R^\sigma$ to $R$. -/
inductive BinOpClosure {α : Type*} (op : α → α → α) (P : α → Prop) : α → Prop where | ofMem {a} (h : P a) : BinOpClosure op P a | ofOp {a b} (ha : BinOpClosure op P a) (hb : BinOpClosure op P b) : BinOpClosure op P (op a b) def MetaClosure {α : Type*} [Lattice α] (S : Set α) : Set α := {x | BinOpClosure (· ⊔ ·) (BinOpClosure (· ⊓ ·) (· ∈ S)) x} abbrev MvPolynomialImage (σ R : Type*) [CommRing R] : Subring ((σ → R) → R) := (Pi.ringHom (MvPolynomial.eval (R := R) (σ := σ))).range theorem imo_sl_2012_A7 (σ R : Type*) [LinearOrderedCommRing R] : ∃ (T : Subring ((σ → R) → R)), T.carrier = MetaClosure (MvPolynomialImage σ R).carrier := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2012 A7 Let $R$ be a totally ordered commutative ring and $\sigma$ be a set of variables. Let $R[\sigma]$ denote the set of multivariate polynomials in these variables. A function $f : R^\sigma \to R$ is called a **metapolynomial** if it can be represented as $$ f(\mathbf{x}) = \max_{i \le m} \min_{j \le n_i} P_{i, j}(\mathbf{x}) $$ for some polynomials $P_{i, j} \in R[\sigma]$. This set of functions is the "meta-closure" of the set of functions represented by polynomials. Prove that the set of metapolynomials forms a subring of the ring of all functions from $R^\sigma$ to $R$. -/ inductive BinOpClosure {α : Type*} (op : α → α → α) (P : α → Prop) : α → Prop where | ofMem {a} (h : P a) : BinOpClosure op P a | ofOp {a b} (ha : BinOpClosure op P a) (hb : BinOpClosure op P b) : BinOpClosure op P (op a b) def MetaClosure {α : Type*} [Lattice α] (S : Set α) : Set α := {x | BinOpClosure (· ⊔ ·) (BinOpClosure (· ⊓ ·) (· ∈ S)) x} abbrev MvPolynomialImage (σ R : Type*) [CommRing R] : Subring ((σ → R) → R) := (Pi.ringHom (MvPolynomial.eval (R := R) (σ := σ))).range theorem imo_sl_2012_A7 (σ R : Type*) [LinearOrderedCommRing R] : ∃ (T : Subring ((σ → R) → R)), T.carrier = MetaClosure (MvPolynomialImage σ R).carrier := by sorry
algebra
imo_sl_2012_N1
true
[ "number theory" ]
2012_N1
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2012 N1 Let $R$ be a commutative ring. A set $A ⊆ R$ is called *admissible* if $x^2 + rxy + y^2 ∈ A$ for any $x, y ∈ A$ and $r ∈ R$. Determine all pairs $(x, y) ∈ R^2$ such that the only admissible set containing $x$ and $y$ is $R$. -/
def admissible [Semiring R] (A : Set R) := ∀ x y : R, x ∈ A → y ∈ A → ∀ r : R, x ^ 2 + r * x * y + y ^ 2 ∈ A theorem imo_sl_2012_N1 [CommRing R] (x y : R) : (∀ A : Set R, admissible A → x ∈ A → y ∈ A → ∀ z : R, z ∈ A) ↔ IsCoprime x y := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2012 N1 Let $R$ be a commutative ring. A set $A ⊆ R$ is called *admissible* if $x^2 + rxy + y^2 ∈ A$ for any $x, y ∈ A$ and $r ∈ R$. Determine all pairs $(x, y) ∈ R^2$ such that the only admissible set containing $x$ and $y$ is $R$. -/ def admissible [Semiring R] (A : Set R) := ∀ x y : R, x ∈ A → y ∈ A → ∀ r : R, x ^ 2 + r * x * y + y ^ 2 ∈ A theorem imo_sl_2012_N1 [CommRing R] (x y : R) : (∀ A : Set R, admissible A → x ∈ A → y ∈ A → ∀ z : R, z ∈ A) ↔ IsCoprime x y := by sorry
number theory
imo_sl_2012_N3
true
[ "number theory" ]
2012_N3
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2012 N3 Determine all integers $m > 1$ such that $n ∣ \binom{n}{m - 2n}$ for every $n ≤ m/2$. -/
theorem imo_sl_2012_N3 (h : 1 < m) : (∀ n : ℕ, 2 * n ≤ m → n ∣ n.choose (m - 2 * n)) ↔ m.Prime := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2012 N3 Determine all integers $m > 1$ such that $n ∣ \binom{n}{m - 2n}$ for every $n ≤ m/2$. -/ theorem imo_sl_2012_N3 (h : 1 < m) : (∀ n : ℕ, 2 * n ≤ m → n ∣ n.choose (m - 2 * n)) ↔ m.Prime := by sorry
number theory
imo_sl_2012_N4
true
[ "number theory" ]
2012_N4
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2012 N4 An integer $a$ is called *friendly* if there exist positive integers $m, n$ such that $$ (m^2 + n)(n^2 + m) = a(m - n)^3. $$ 1. Prove that $\{1, 2, \dots, 2012\}$ contains at least $500$ friendly integers. 2. Is $2$ friendly? -/
/- special open -/ open Finset Classical /-- An integer `a` is friendly if it satisfies the given condition for some positive integers `m` and `n`. -/ def IsFriendly (a : ℤ) : Prop := ∃ m > 0, ∃ n > 0, (m ^ 2 + n) * (n ^ 2 + m) = a * (m - n) ^ 3 theorem imo_sl_2012_N4 : 500 ≤ ((Icc 1 2012).filter (IsFriendly)).card ∧ ¬ IsFriendly 2 := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2012 N4 An integer $a$ is called *friendly* if there exist positive integers $m, n$ such that $$ (m^2 + n)(n^2 + m) = a(m - n)^3. $$ 1. Prove that $\{1, 2, \dots, 2012\}$ contains at least $500$ friendly integers. 2. Is $2$ friendly? -/ /- special open -/ open Finset Classical /-- An integer `a` is friendly if it satisfies the given condition for some positive integers `m` and `n`. -/ def IsFriendly (a : ℤ) : Prop := ∃ m > 0, ∃ n > 0, (m ^ 2 + n) * (n ^ 2 + m) = a * (m - n) ^ 3 theorem imo_sl_2012_N4 : 500 ≤ ((Icc 1 2012).filter (IsFriendly)).card ∧ ¬ IsFriendly 2 := by sorry
number theory
imo_sl_2013_A1
true
[ "algebra" ]
2013_A1
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2013 A1 Let $R$ be a commutative ring. Given a list of elements $a_0, \dots, a_{n-1} \in R$, we define a sequence $(u_k)$ by $u_0 = u_1 = 1$, and $u_{k + 2} = u_{k + 1} + a_k u_k$ for each $0 \le k < n$. We then define the function $f(a_0, \dots, a_{n-1}) = u_{n + 1}$. Prove that $f(a_0, \dots, a_{n-1}) = f(a_{n-1}, \dots, a_0)$. -/
variable {R : Type*} [CommRing R] /-- A helper function to compute the pair `(u_{k+1}, u_k)` recursively. `f_aux [a₀, a₁, ..., a_{k-1}]` returns `(u_{k+1}, u_k)`. -/ def f_aux : List R → R × R | [] => (1, 1) | r :: l => let (a, b) := f_aux l; (a + r * b, a) def f (l : List R) : R := (f_aux l).1 theorem imo_sl_2013_A1 (l : List R) : f l.reverse = f l := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2013 A1 Let $R$ be a commutative ring. Given a list of elements $a_0, \dots, a_{n-1} \in R$, we define a sequence $(u_k)$ by $u_0 = u_1 = 1$, and $u_{k + 2} = u_{k + 1} + a_k u_k$ for each $0 \le k < n$. We then define the function $f(a_0, \dots, a_{n-1}) = u_{n + 1}$. Prove that $f(a_0, \dots, a_{n-1}) = f(a_{n-1}, \dots, a_0)$. -/ variable {R : Type*} [CommRing R] /-- A helper function to compute the pair `(u_{k+1}, u_k)` recursively. `f_aux [a₀, a₁, ..., a_{k-1}]` returns `(u_{k+1}, u_k)`. -/ def f_aux : List R → R × R | [] => (1, 1) | r :: l => let (a, b) := f_aux l; (a + r * b, a) def f (l : List R) : R := (f_aux l).1 theorem imo_sl_2013_A1 (l : List R) : f l.reverse = f l := by sorry
algebra
imo_sl_2013_A5
true
[ "algebra" ]
2013_A5
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2013 A5 Find all functions $f : \mathbb{N} \to \mathbb{N}$ such that for any $n \in \mathbb{N}$, $$ f(f(f(n))) = f(n + 1) + 1. $$ -/
def IsGood (f : ℕ → ℕ) : Prop := ∀ n, f^[3] n = f (n + 1) + 1 def answer2 : ℕ → ℕ | 0 => 1 | 1 => 6 | 2 => 3 | 3 => 0 | n + 4 => answer2 n + 4 theorem imo_sl_2013_A5 (f : ℕ → ℕ) : IsGood f ↔ f = Nat.succ ∨ f = answer2 := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2013 A5 Find all functions $f : \mathbb{N} \to \mathbb{N}$ such that for any $n \in \mathbb{N}$, $$ f(f(f(n))) = f(n + 1) + 1. $$ -/ def IsGood (f : ℕ → ℕ) : Prop := ∀ n, f^[3] n = f (n + 1) + 1 def answer2 : ℕ → ℕ | 0 => 1 | 1 => 6 | 2 => 3 | 3 => 0 | n + 4 => answer2 n + 4 theorem imo_sl_2013_A5 (f : ℕ → ℕ) : IsGood f ↔ f = Nat.succ ∨ f = answer2 := by sorry
algebra
imo_sl_2013_N1
true
[ "number theory" ]
2013_N1
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2013 N1 Find all functions $f : ℕ^+ → ℕ^+$ such that, for any $m, n : ℕ^+$, $$ m^2 + f(n) ∣ m f(m) + n. $$ -/
theorem imo_sl_2013_N1 {f : ℕ+ → ℕ+} : (∀ m n : ℕ+, m * m + f n ∣ m * f m + n) ↔ f = id := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2013 N1 Find all functions $f : ℕ^+ → ℕ^+$ such that, for any $m, n : ℕ^+$, $$ m^2 + f(n) ∣ m f(m) + n. $$ -/ theorem imo_sl_2013_N1 {f : ℕ+ → ℕ+} : (∀ m n : ℕ+, m * m + f n ∣ m * f m + n) ↔ f = id := by sorry
number theory
imo_sl_2013_N2
true
[ "number theory" ]
2013_N2
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2013 N2 Prove that for any positive integers $k, n$, there exist positive integers $m_1, m_2, \dots, m_k$ such that $$ 1 + \frac{2^k - 1}{n} = \prod_{i = 1}^k \left(1 + \frac{1}{m_i}\right). $$ -/
/- special open -/ open Finset theorem imo_sl_2013_N2 (k n : ℕ+) : ∃ (m : Fin k → ℕ+), (1 : ℚ) + ((2 : ℚ) ^ (k : ℕ) - 1) / (n : ℚ) = ∏ i : Fin k, (1 + 1 / (m i : ℚ)) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2013 N2 Prove that for any positive integers $k, n$, there exist positive integers $m_1, m_2, \dots, m_k$ such that $$ 1 + \frac{2^k - 1}{n} = \prod_{i = 1}^k \left(1 + \frac{1}{m_i}\right). $$ -/ /- special open -/ open Finset theorem imo_sl_2013_N2 (k n : ℕ+) : ∃ (m : Fin k → ℕ+), (1 : ℚ) + ((2 : ℚ) ^ (k : ℕ) - 1) / (n : ℚ) = ∏ i : Fin k, (1 + 1 / (m i : ℚ)) := by sorry
number theory
imo_sl_2013_N3
true
[ "number theory" ]
2013_N3
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2013 N3 For each positive integer $n$, let $P(n)$ denote the largest prime divisor of $n$. Prove that there exists infinitely many $n ∈ ℕ$ such that $$ P(n^4 + n^2 + 1) = P((n + 1)^4 + (n + 1)^2 + 1). $$ -/
noncomputable def lpf (n : ℕ) : ℕ := ((Nat.primeFactors n).toList.maximum?).getD 1 theorem imo_sl_2013_N3 : ∀ (C : ℕ), ∃ n ≥ C, lpf (n ^ 4 + n ^ 2 + 1) = lpf ((n + 1) ^ 4 + (n + 1) ^ 2 + 1) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2013 N3 For each positive integer $n$, let $P(n)$ denote the largest prime divisor of $n$. Prove that there exists infinitely many $n ∈ ℕ$ such that $$ P(n^4 + n^2 + 1) = P((n + 1)^4 + (n + 1)^2 + 1). $$ -/ noncomputable def lpf (n : ℕ) : ℕ := ((Nat.primeFactors n).toList.maximum?).getD 1 theorem imo_sl_2013_N3 : ∀ (C : ℕ), ∃ n ≥ C, lpf (n ^ 4 + n ^ 2 + 1) = lpf ((n + 1) ^ 4 + (n + 1) ^ 2 + 1) := by sorry
number theory
imo_sl_2013_N6
true
[ "number theory" ]
2013_N6
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2013 N6 Determine all functions $f : ℚ → ℤ$ such that for any $x ∈ ℚ$, $a ∈ ℤ$, and $b ∈ ℕ^+$, $$ f\left(\frac{f(x) + a}{b}\right) = f\left(\frac{x + a}{b}\right). $$ -/
def good (f : ℚ → ℤ) := ∀ (x : ℚ) (a : ℤ) (b : ℕ), 0 < b → f ((f x + a) / b) = f ((x + a) / b) theorem imo_sl_2013_N6 : good f ↔ (∃ C, f = λ _ ↦ C) ∨ f = Int.floor ∨ f = Int.ceil := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2013 N6 Determine all functions $f : ℚ → ℤ$ such that for any $x ∈ ℚ$, $a ∈ ℤ$, and $b ∈ ℕ^+$, $$ f\left(\frac{f(x) + a}{b}\right) = f\left(\frac{x + a}{b}\right). $$ -/ def good (f : ℚ → ℤ) := ∀ (x : ℚ) (a : ℤ) (b : ℕ), 0 < b → f ((f x + a) / b) = f ((x + a) / b) theorem imo_sl_2013_N6 : good f ↔ (∃ C, f = λ _ ↦ C) ∨ f = Int.floor ∨ f = Int.ceil := by sorry
number theory
imo_sl_2014_A1
true
[ "algebra" ]
2014_A1
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2014 A1 Let $(z_n)_{n \ge 0}$ be an infinite sequence of positive integers. 1. Prove that there exists a unique non-negative integer $N$ such that $$ N z_N < \sum_{j = 0}^N z_j \le (N + 1) z_{N + 1}. $$ (Note: The sum is often written as $\sum_{j=0}^{N-1} z_j \le N z_N < \sum_{j=0}^N z_j$. The version above is what is used in the formalization). 2. Prove that $N$ is positive. 3. Show that $\binom{N}{2} < z_0$. -/
/- special open -/ open Finset variable {z : ℕ → ℤ} /-- `IsTheN z N` is the property that `N` satisfies the double inequality from the problem. -/ def IsTheN (z : ℕ → ℤ) (N : ℕ) : Prop := (N : ℤ) * z N < (∑ i in range (N + 1), z i) ∧ (∑ i in range (N + 1), z i) ≤ (N + 1) * z (N + 1) theorem imo_sl_2014_A1 (hz_pos : ∀ n, 0 < z n) (hz_mono : StrictMono z) : (∃! N, IsTheN z N) ∧ (∀ N, IsTheN z N → 0 < N ∧ N.choose 2 < (z 0).natAbs) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2014 A1 Let $(z_n)_{n \ge 0}$ be an infinite sequence of positive integers. 1. Prove that there exists a unique non-negative integer $N$ such that $$ N z_N < \sum_{j = 0}^N z_j \le (N + 1) z_{N + 1}. $$ (Note: The sum is often written as $\sum_{j=0}^{N-1} z_j \le N z_N < \sum_{j=0}^N z_j$. The version above is what is used in the formalization). 2. Prove that $N$ is positive. 3. Show that $\binom{N}{2} < z_0$. -/ /- special open -/ open Finset variable {z : ℕ → ℤ} /-- `IsTheN z N` is the property that `N` satisfies the double inequality from the problem. -/ def IsTheN (z : ℕ → ℤ) (N : ℕ) : Prop := (N : ℤ) * z N < (∑ i in range (N + 1), z i) ∧ (∑ i in range (N + 1), z i) ≤ (N + 1) * z (N + 1) theorem imo_sl_2014_A1 (hz_pos : ∀ n, 0 < z n) (hz_mono : StrictMono z) : (∃! N, IsTheN z N) ∧ (∀ N, IsTheN z N → 0 < N ∧ N.choose 2 < (z 0).natAbs) := by sorry
algebra
imo_sl_2014_A4
true
[ "algebra" ]
2014_A4
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2014 A4 Let $b$ and $c$ be integers with $|b| > 1$ and $c ≠ 0$. Find all functions $f : ℤ → ℤ$ such that, for any $x, y ∈ ℤ$, $$ f(y + f(x)) - f(y) = f(bx) - f(x) + c. $$ -/
/- special open -/ open Finset def good (b c : ℤ) (f : ℤ → ℤ) := ∀ x y : ℤ, f (y + f x) - f y = f (b * x) - f x + c theorem imo_sl_2014_A4 {b c : ℤ} (h : 1 < b.natAbs) (h0 : c ≠ 0) : good b c f ↔ b - 1 ∣ c ∧ f = ((b - 1) * · + c / (b - 1)) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2014 A4 Let $b$ and $c$ be integers with $|b| > 1$ and $c ≠ 0$. Find all functions $f : ℤ → ℤ$ such that, for any $x, y ∈ ℤ$, $$ f(y + f(x)) - f(y) = f(bx) - f(x) + c. $$ -/ /- special open -/ open Finset def good (b c : ℤ) (f : ℤ → ℤ) := ∀ x y : ℤ, f (y + f x) - f y = f (b * x) - f x + c theorem imo_sl_2014_A4 {b c : ℤ} (h : 1 < b.natAbs) (h0 : c ≠ 0) : good b c f ↔ b - 1 ∣ c ∧ f = ((b - 1) * · + c / (b - 1)) := by sorry
algebra
imo_sl_2014_C4
true
[ "combinatorics" ]
2014_C4
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2014 C4 Consider 4 types of skew-tetrominoes in $ℕ^2$, classified by its orientation. Let $S ⊆ ℕ^2$ be a multiset, and suppose that it can be partitioned into skew-tetrominos. Prove that the parity of the number of skew-tetrominoes used for each type in the partition does not depend on the partition. -/
/- special open -/ open Multiset /-- Base skew-tetrominoes, representing the four orientations. -/ def BaseSkewT4 : Fin 4 → Multiset (ℕ × ℕ) | 1 => {(0, 0), (1, 0), (1, 1), (2, 1)} | 2 => {(1, 0), (1, 1), (0, 1), (0, 2)} | 3 => {(0, 1), (1, 1), (1, 0), (2, 0)} | 4 => {(0, 0), (0, 1), (1, 1), (1, 2)} /-- A specific skew-tetromino piece, defined by its type and position. -/ def SkewT4 (q : Fin 4 × ℕ × ℕ) : Multiset (ℕ × ℕ) := (BaseSkewT4 q.1).map λ p ↦ q.2 + p /-- Let `P` and `Q` be two different partitions of the same shape `S` into skew-tetrominoes. This is formally stated as `(map SkewT4 P).sum = (map SkewT4 Q).sum`. The theorem asserts that for any type `i`, the number of tetrominoes of that type has the same parity in both partitions. -/ theorem imo_sl_2014_C4 {P Q : Multiset (Fin 4 × ℕ × ℕ)} (h : (map SkewT4 P).sum = (map SkewT4 Q).sum) (i : Fin 4) : (P.map Prod.fst).count i % 2 = (Q.map Prod.fst).count i % 2 := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2014 C4 Consider 4 types of skew-tetrominoes in $ℕ^2$, classified by its orientation. Let $S ⊆ ℕ^2$ be a multiset, and suppose that it can be partitioned into skew-tetrominos. Prove that the parity of the number of skew-tetrominoes used for each type in the partition does not depend on the partition. -/ /- special open -/ open Multiset /-- Base skew-tetrominoes, representing the four orientations. -/ def BaseSkewT4 : Fin 4 → Multiset (ℕ × ℕ) | 1 => {(0, 0), (1, 0), (1, 1), (2, 1)} | 2 => {(1, 0), (1, 1), (0, 1), (0, 2)} | 3 => {(0, 1), (1, 1), (1, 0), (2, 0)} | 4 => {(0, 0), (0, 1), (1, 1), (1, 2)} /-- A specific skew-tetromino piece, defined by its type and position. -/ def SkewT4 (q : Fin 4 × ℕ × ℕ) : Multiset (ℕ × ℕ) := (BaseSkewT4 q.1).map λ p ↦ q.2 + p /-- Let `P` and `Q` be two different partitions of the same shape `S` into skew-tetrominoes. This is formally stated as `(map SkewT4 P).sum = (map SkewT4 Q).sum`. The theorem asserts that for any type `i`, the number of tetrominoes of that type has the same parity in both partitions. -/ theorem imo_sl_2014_C4 {P Q : Multiset (Fin 4 × ℕ × ℕ)} (h : (map SkewT4 P).sum = (map SkewT4 Q).sum) (i : Fin 4) : (P.map Prod.fst).count i % 2 = (Q.map Prod.fst).count i % 2 := by sorry
combinatorics
imo_sl_2014_N2
true
[ "number theory" ]
2014_N2
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/- # IMO 2014 N2 Determine all pairs $(x, y)$ of integers such that $$ 7x^2 - 13xy + y^2 = (|x - y| + 1)^3. $$ -/
def good (x y : ℤ) := 7 * x ^ 2 - 13 * x * y + 7 * y ^ 2 = (|x - y| + 1) ^ 3 theorem imo_sl_2014_N2 : good x y ↔ (∃ m, (x, y) = (m ^ 3 + 2 * m ^ 2 - m - 1, m ^ 3 + m ^ 2 - 2 * m - 1)) ∨ (∃ m, (x, y) = (m ^ 3 + m ^ 2 - 2 * m - 1, m ^ 3 + 2 * m ^ 2 - m - 1)) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /- # IMO 2014 N2 Determine all pairs $(x, y)$ of integers such that $$ 7x^2 - 13xy + y^2 = (|x - y| + 1)^3. $$ -/ def good (x y : ℤ) := 7 * x ^ 2 - 13 * x * y + 7 * y ^ 2 = (|x - y| + 1) ^ 3 theorem imo_sl_2014_N2 : good x y ↔ (∃ m, (x, y) = (m ^ 3 + 2 * m ^ 2 - m - 1, m ^ 3 + m ^ 2 - 2 * m - 1)) ∨ (∃ m, (x, y) = (m ^ 3 + m ^ 2 - 2 * m - 1, m ^ 3 + 2 * m ^ 2 - m - 1)) := by sorry
number theory
imo_sl_2014_N3
true
[ "number theory" ]
2014_N3
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2014 N3 Consider a collection $C$ of coins, where each coin has a value of $1/n$ for some positive integer $n$. A partition of $C$ into $N$ groups is called an *$N$-Cape Town* partition if the total value of coins in each group is at most $1$. Prove that if the total value of all coins in $C$ is at most $N + 1/2$, then $C$ has an $(N + 1)$-Cape Town partition. -/
/- special open -/ open Multiset variable (N : ℕ) (C : Multiset ℕ) /-- A `CapeTownPartition N C` is a partition of the multiset of coins `C` into `N + 1` groups, where the sum of the values of the coins in each group is at most 1. -/ structure CapeTownPartition where /-- The list of groups in the partition. -/ part : Multiset (Multiset ℕ) /-- The number of groups is `N + 1`. -/ card_part : card part = N + 1 /-- The groups form a partition of `C`. -/ sum_part : part.sum = C /-- The total value of coins in each group is at most 1. -/ total_bound : ∀ G ∈ part, (G.map (fun x ↦ (x : ℚ)⁻¹)).sum ≤ 1 theorem imo_sl_2014_N3 (h_total_value : (C.map (fun x ↦ (x : ℚ)⁻¹)).sum ≤ (N : ℚ) + 1/2) : Nonempty (CapeTownPartition N C) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2014 N3 Consider a collection $C$ of coins, where each coin has a value of $1/n$ for some positive integer $n$. A partition of $C$ into $N$ groups is called an *$N$-Cape Town* partition if the total value of coins in each group is at most $1$. Prove that if the total value of all coins in $C$ is at most $N + 1/2$, then $C$ has an $(N + 1)$-Cape Town partition. -/ /- special open -/ open Multiset variable (N : ℕ) (C : Multiset ℕ) /-- A `CapeTownPartition N C` is a partition of the multiset of coins `C` into `N + 1` groups, where the sum of the values of the coins in each group is at most 1. -/ structure CapeTownPartition where /-- The list of groups in the partition. -/ part : Multiset (Multiset ℕ) /-- The number of groups is `N + 1`. -/ card_part : card part = N + 1 /-- The groups form a partition of `C`. -/ sum_part : part.sum = C /-- The total value of coins in each group is at most 1. -/ total_bound : ∀ G ∈ part, (G.map (fun x ↦ (x : ℚ)⁻¹)).sum ≤ 1 theorem imo_sl_2014_N3 (h_total_value : (C.map (fun x ↦ (x : ℚ)⁻¹)).sum ≤ (N : ℚ) + 1/2) : Nonempty (CapeTownPartition N C) := by sorry
number theory
imo_sl_2014_N4
true
[ "number theory" ]
2014_N4
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2014 N4 Prove that, for any positive integer $n > 1$, there exists infinitely many positive integers $k$ such that $⌊n^k/k⌋$ is odd. -/
theorem imo_sl_2014_N4 (hn : 1 < n) (N) : ∃ k > N, Odd (n ^ k / k) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2014 N4 Prove that, for any positive integer $n > 1$, there exists infinitely many positive integers $k$ such that $⌊n^k/k⌋$ is odd. -/ theorem imo_sl_2014_N4 (hn : 1 < n) (N) : ∃ k > N, Odd (n ^ k / k) := by sorry
number theory
imo_sl_2015_A1
true
[ "algebra" ]
2015_A1
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat
/-! # IMO 2015 A1 Let $F$ be a totally ordered field. Let $(a_n)_{n ≥ 0}$ be a sequence of positive elements of $F$ such that $a_{k + 1} ≥ \dfrac{(k + 1) a_k}{a_k^2 + k}$ for all $k ∈ ℕ$. Prove that, for every $n ≥ 2$, $$ a_0 + a_1 + … + a_{n - 1} ≥ n. $$ ### Further directions Generalize to totally ordered semirings `R` with `ExistsAddOfLE R`. If impossible, we can alternatively generalize the above sequence to two sequences $(a_n)_{n ≥ 0}$, $(b_n)_{n ≥ 0}$ satisfying $b_{k + 1} ≤ a_k + b_k$ and $a_k b_k ≥ k$ for all $k ∈ ℕ$. -/
/- special open -/ open Finset theorem imo_sl_2015_A1 [LinearOrderedField F] {a : ℕ → F} (h : ∀ k : ℕ, 0 < a k) (h0 : ∀ k : ℕ, ((k.succ : F) * a k) / (a k ^ 2 + (k : F)) ≤ a k.succ) : ∀ n : ℕ, 2 ≤ n → (n : F) ≤ (range n).sum (fun i => a i) := by sorry
test
import Mathlib import Aesop set_option maxHeartbeats 0 open BigOperators Real Nat Topology Rat /-! # IMO 2015 A1 Let $F$ be a totally ordered field. Let $(a_n)_{n ≥ 0}$ be a sequence of positive elements of $F$ such that $a_{k + 1} ≥ \dfrac{(k + 1) a_k}{a_k^2 + k}$ for all $k ∈ ℕ$. Prove that, for every $n ≥ 2$, $$ a_0 + a_1 + … + a_{n - 1} ≥ n. $$ ### Further directions Generalize to totally ordered semirings `R` with `ExistsAddOfLE R`. If impossible, we can alternatively generalize the above sequence to two sequences $(a_n)_{n ≥ 0}$, $(b_n)_{n ≥ 0}$ satisfying $b_{k + 1} ≤ a_k + b_k$ and $a_k b_k ≥ k$ for all $k ∈ ℕ$. -/ /- special open -/ open Finset theorem imo_sl_2015_A1 [LinearOrderedField F] {a : ℕ → F} (h : ∀ k : ℕ, 0 < a k) (h0 : ∀ k : ℕ, ((k.succ : F) * a k) / (a k ^ 2 + (k : F)) ≤ a k.succ) : ∀ n : ℕ, 2 ≤ n → (n : F) ≤ (range n).sum (fun i => a i) := by sorry
algebra