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