{"name": "Usa2005P2", "solved": true, "tags": ["number theory"], "problem_id": "Usa2005P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 2005, Problem 2\n\nProve that there do not exist integers x,y,z such that\n\n x\u2076 + x\u00b3 + x\u00b3y + y = 147\u00b9\u2075\u2077\n x\u00b3 + x\u00b3y + y\u00b2 + y + z\u2079 = 157\u00b9\u2074\u2077.\n-/", "formal_statement": "theorem usa2005_p2 :\n \u00ac\u2203 (x y z : \u2124),\n x^6 + x^3 + x^3 * y + y = 147^157 \u2227\n x^3 + x^3 * y + y^2 + y + z^9 = 157^147 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 2005, Problem 2\n\nProve that there do not exist integers x,y,z such that\n\n x\u2076 + x\u00b3 + x\u00b3y + y = 147\u00b9\u2075\u2077\n x\u00b3 + x\u00b3y + y\u00b2 + y + z\u2079 = 157\u00b9\u2074\u2077.\n-/\ntheorem usa2005_p2 :\n \u00ac\u2203 (x y z : \u2124),\n x^6 + x^3 + x^3 * y + y = 147^157 \u2227\n x^3 + x^3 * y + y^2 + y + z^9 = 157^147 := by sorry", "category": "number theory"} {"name": "Imo2006P3", "solved": true, "tags": ["algebra"], "problem_id": "Imo2006P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2006, Problem 3\n\nDetermine the least real number $M$ such that\n$$\n\\left| ab(a^2 - b^2) + bc(b^2 - c^2) + ca(c^2 - a^2) \\right|\n\u2264 M (a^2 + b^2 + c^2)^2\n$$\nfor all real numbers $a$, $b$, $c$.\n-/", "formal_statement": "noncomputable abbrev solution : \u211d := 9 * Real.sqrt 2 / 32\n\ntheorem imo2006_p3 :\n IsLeast\n { M | (\u2200 a b c : \u211d,\n |a * b * (a ^ 2 - b ^ 2) + b * c * (b ^ 2 - c ^ 2) + c * a * (c ^ 2 - a ^ 2)| \u2264\n M * (a ^ 2 + b ^ 2 + c ^ 2) ^ 2) } solution := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2006, Problem 3\n\nDetermine the least real number $M$ such that\n$$\n\\left| ab(a^2 - b^2) + bc(b^2 - c^2) + ca(c^2 - a^2) \\right|\n\u2264 M (a^2 + b^2 + c^2)^2\n$$\nfor all real numbers $a$, $b$, $c$.\n-/\nnoncomputable abbrev solution : \u211d := 9 * Real.sqrt 2 / 32\n\ntheorem imo2006_p3 :\n IsLeast\n { M | (\u2200 a b c : \u211d,\n |a * b * (a ^ 2 - b ^ 2) + b * c * (b ^ 2 - c ^ 2) + c * a * (c ^ 2 - a ^ 2)| \u2264\n M * (a ^ 2 + b ^ 2 + c ^ 2) ^ 2) } solution := by sorry", "category": "algebra"} {"name": "Imo2020P2", "solved": true, "tags": ["algebra", "inequality"], "problem_id": "Imo2020P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2020, Problem 2\n\nThe real numbers `a`, `b`, `c`, `d` are such that `a \u2265 b \u2265 c \u2265 d > 0` and `a + b + c + d = 1`.\nProve that `(a + 2b + 3c + 4d) a^a b^b c^c d^d < 1`.\n-/", "formal_statement": "theorem imo2020_q2 (a b c d : \u211d) (hd0 : 0 < d) (hdc : d \u2264 c) (hcb : c \u2264 b) (hba : b \u2264 a)\n (h1 : a + b + c + d = 1) : (a + 2 * b + 3 * c + 4 * d) * a ^ a * b ^ b * c ^ c * d ^ d < 1 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2020, Problem 2\n\nThe real numbers `a`, `b`, `c`, `d` are such that `a \u2265 b \u2265 c \u2265 d > 0` and `a + b + c + d = 1`.\nProve that `(a + 2b + 3c + 4d) a^a b^b c^c d^d < 1`.\n-/\ntheorem imo2020_q2 (a b c d : \u211d) (hd0 : 0 < d) (hdc : d \u2264 c) (hcb : c \u2264 b) (hba : b \u2264 a)\n (h1 : a + b + c + d = 1) : (a + 2 * b + 3 * c + 4 * d) * a ^ a * b ^ b * c ^ c * d ^ d < 1 := by sorry", "category": "algebra"} {"name": "Usa1979P1", "solved": true, "tags": ["algebra", "inequality"], "problem_id": "Usa1979P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 1979, Problem 1\n\nDetermine all non-negative integral solutions $(n_1,n_2,\\dots , n_{14})$ if any,\napart from permutations, of the Diophantine Equation $n_1^4+n_2^4+\\cdots +n_{14}^4=1599$.\n-/", "formal_statement": "/--\nA type representing assignments to the variables $n_1$, $n_2$, ..., $n_{14}$,\nquotiented by permutations of indices.\n-/\nstructure MultisetNatOfLen14 where\n s : Multiset \u2115\n p : Multiset.card s = 14\n\nabbrev SolutionSet : Set MultisetNatOfLen14 := \u2205\n\ntheorem usa1979_p1 : \u2200 e, e \u2208 SolutionSet \u2194 (e.s.map (fun x \u21a6 x ^ 4)).sum = 1599 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 1979, Problem 1\n\nDetermine all non-negative integral solutions $(n_1,n_2,\\dots , n_{14})$ if any,\napart from permutations, of the Diophantine Equation $n_1^4+n_2^4+\\cdots +n_{14}^4=1599$.\n-/\n/--\nA type representing assignments to the variables $n_1$, $n_2$, ..., $n_{14}$,\nquotiented by permutations of indices.\n-/\nstructure MultisetNatOfLen14 where\n s : Multiset \u2115\n p : Multiset.card s = 14\n\nabbrev SolutionSet : Set MultisetNatOfLen14 := \u2205\n\ntheorem usa1979_p1 : \u2200 e, e \u2208 SolutionSet \u2194 (e.s.map (fun x \u21a6 x ^ 4)).sum = 1599 := by sorry", "category": "algebra"} {"name": "Imo2018P3", "solved": false, "tags": ["combinatorics"], "problem_id": "Imo2018P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2018, Problem 3\n\nAn anti-Pascal triangle is an equilateral triangular array of numbers such that,\nexcept for the numbers in the bottom row, each number is the absolute value\nof the difference of the two numbers immediately below it. For example,\nthe following array is an anti-Pascal triangle with four rows\nwhich contains every integer from 1 to 10:\n\n 4\n 2 6\n 5 7 1\n 8 3 10 9\n\nDoes there exist an anti-Pascal triangle with 2018 rows which contains every\ninteger from 1 to 1 + 2 + ... + 2018?\n-/", "formal_statement": "structure Coords where\n(row : \u2115) (col : \u2115)\n\ndef left_child (c : Coords) : Coords :=\n \u27e8c.row.succ, c.col\u27e9\n\ndef right_child (c : Coords) : Coords :=\n \u27e8c.row.succ, c.col.succ\u27e9\n\n/--\nantipascal triangle with n rows\n-/\nstructure antipascal_triangle (n : \u2115) where\n(f : Coords \u2192 \u2115)\n(antipascal : \u2200 x : Coords, x.row + 1 < n \u2227 x.col \u2264 x.row \u2192\n f x + f (left_child x) = f (right_child x) \u2228\n f x + f (right_child x) = f (left_child x))\n\ndef exists_desired_triangle : Prop :=\n \u2203 t : antipascal_triangle 2018,\n \u2200 n, 1 \u2264 n \u2192 n \u2264 \u2211 i \u2208 Finset.range 2018, (i + 1) \u2192\n \u2203 r, r \u2264 2018 \u2227 \u2203 c, c < r \u2227 t.f \u27e8r,c\u27e9 = n\n\nabbrev does_exist : Bool := false\n\ntheorem imo2018_p3 :\n if does_exist then exists_desired_triangle else \u00ac exists_desired_triangle := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2018, Problem 3\n\nAn anti-Pascal triangle is an equilateral triangular array of numbers such that,\nexcept for the numbers in the bottom row, each number is the absolute value\nof the difference of the two numbers immediately below it. For example,\nthe following array is an anti-Pascal triangle with four rows\nwhich contains every integer from 1 to 10:\n\n 4\n 2 6\n 5 7 1\n 8 3 10 9\n\nDoes there exist an anti-Pascal triangle with 2018 rows which contains every\ninteger from 1 to 1 + 2 + ... + 2018?\n-/\nstructure Coords where\n(row : \u2115) (col : \u2115)\n\ndef left_child (c : Coords) : Coords :=\n \u27e8c.row.succ, c.col\u27e9\n\ndef right_child (c : Coords) : Coords :=\n \u27e8c.row.succ, c.col.succ\u27e9\n\n/--\nantipascal triangle with n rows\n-/\nstructure antipascal_triangle (n : \u2115) where\n(f : Coords \u2192 \u2115)\n(antipascal : \u2200 x : Coords, x.row + 1 < n \u2227 x.col \u2264 x.row \u2192\n f x + f (left_child x) = f (right_child x) \u2228\n f x + f (right_child x) = f (left_child x))\n\ndef exists_desired_triangle : Prop :=\n \u2203 t : antipascal_triangle 2018,\n \u2200 n, 1 \u2264 n \u2192 n \u2264 \u2211 i \u2208 Finset.range 2018, (i + 1) \u2192\n \u2203 r, r \u2264 2018 \u2227 \u2203 c, c < r \u2227 t.f \u27e8r,c\u27e9 = n\n\nabbrev does_exist : Bool := false\n\ntheorem imo2018_p3 :\n if does_exist then exists_desired_triangle else \u00ac exists_desired_triangle := by sorry", "category": "combinatorics"} {"name": "Imo2024P5", "solved": true, "tags": ["combinatorics"], "problem_id": "Imo2024P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2024, Problem 5\n\nTurbo the snail plays a game on a board with $2024$ rows and $2023$ columns. There are hidden\nmonsters in $2022$ of the cells. Initially, Turbo does not know where any of the monsters are,\nbut he knows that there is exactly one monster in each row except the first row and the last\nrow, and that each column contains at most one monster.\n\nTurbo makes a series of attempts to go from the first row to the last row. On each attempt,\nhe chooses to start on any cell in the first row, then repeatedly moves to an adjacent cell\nsharing a common side. (He is allowed to return to a previously visited cell.) If he reaches a\ncell with a monster, his attempt ends and he is transported back to the first row to start a\nnew attempt. The monsters do not move, and Turbo remembers whether or not each cell he has\nvisited contains a monster. If he reaches any cell in the last row, his attempt ends and the\ngame is over.\n\nDetermine the minimum value of $n$ for which Turbo has a strategy that guarantees reaching\nthe last row on the $n$th attempt or earlier, regardless of the locations of the monsters.\n-/", "formal_statement": "/-! ### Definitions for setting up the problem -/\n\n-- There are N monsters, N+1 columns and N+2 rows.\nvariable {N : \u2115}\n\n/-- A cell on the board for the game. -/\nabbrev Cell (N : \u2115) : Type := Fin (N + 2) \u00d7 Fin (N + 1)\n\n/-- A row that is neither the first nor the last (and thus contains a monster). -/\nabbrev InteriorRow (N : \u2115) : Type := (Set.Icc 1 \u27e8N, by omega\u27e9 : Set (Fin (N + 2)))\n\n/-- Data for valid positions of the monsters. -/\nabbrev MonsterData (N : \u2115) : Type := InteriorRow N \u21aa Fin (N + 1)\n\n/-- The cells with monsters as a Set, given an injection from rows to columns. -/\ndef MonsterData.monsterCells (m : MonsterData N) :\n Set (Cell N) :=\n Set.range (fun x : InteriorRow N \u21a6 ((x : Fin (N + 2)), m x))\n\n/-- Whether two cells are adjacent. -/\ndef Adjacent (x y : Cell N) : Prop :=\n Nat.dist x.1 y.1 + Nat.dist x.2 y.2 = 1\n\n/-- A valid path from the first to the last row. -/\nstructure _Path (N : \u2115) where\n /-- The cells on the path. -/\n cells : List (Cell N)\n nonempty : cells \u2260 []\n head_first_row : (cells.head nonempty).1 = 0\n last_last_row : (cells.getLast nonempty).1 = Fin.last (N + 1)\n valid_move_seq : cells.Chain' Adjacent\n\n/-- The first monster on a path, or `none`. -/\nnoncomputable def _Path.firstMonster (p : _Path N) (m : MonsterData N) : Option (Cell N) :=\n letI := Classical.propDecidable\n p.cells.find? (fun x \u21a6 (x \u2208 m.monsterCells : Bool))\n\n/-- A strategy, given the results of initial attempts, returns a path for the next attempt. -/\nabbrev Strategy (N : \u2115) : Type := \u2983k : \u2115\u2984 \u2192 (Fin k \u2192 Option (Cell N)) \u2192 _Path N\n\n/-- Playing a strategy, k attempts. -/\nnoncomputable def Strategy.play (s : Strategy N) (m : MonsterData N) :\n (k : \u2115) \u2192 Fin k \u2192 Option (Cell N)\n| 0 => Fin.elim0\n| k + 1 => Fin.snoc (s.play m k) ((s (s.play m k)).firstMonster m)\n\n/-- The predicate for a strategy winning within the given number of attempts. -/\ndef Strategy.WinsIn (s : Strategy N) (m : MonsterData N) (k : \u2115) : Prop :=\n none \u2208 Set.range (s.play m k)\n\n/-- Whether a strategy forces a win within the given number of attempts. -/\ndef Strategy.ForcesWinIn (s : Strategy N) (k : \u2115) : Prop :=\n \u2200 m, s.WinsIn m k\n\nabbrev answer : \u2115 := 3\n\ntheorem imo2024_p5 : IsLeast {k | \u2203 s : Strategy 2022, s.ForcesWinIn k} answer := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2024, Problem 5\n\nTurbo the snail plays a game on a board with $2024$ rows and $2023$ columns. There are hidden\nmonsters in $2022$ of the cells. Initially, Turbo does not know where any of the monsters are,\nbut he knows that there is exactly one monster in each row except the first row and the last\nrow, and that each column contains at most one monster.\n\nTurbo makes a series of attempts to go from the first row to the last row. On each attempt,\nhe chooses to start on any cell in the first row, then repeatedly moves to an adjacent cell\nsharing a common side. (He is allowed to return to a previously visited cell.) If he reaches a\ncell with a monster, his attempt ends and he is transported back to the first row to start a\nnew attempt. The monsters do not move, and Turbo remembers whether or not each cell he has\nvisited contains a monster. If he reaches any cell in the last row, his attempt ends and the\ngame is over.\n\nDetermine the minimum value of $n$ for which Turbo has a strategy that guarantees reaching\nthe last row on the $n$th attempt or earlier, regardless of the locations of the monsters.\n-/\n/-! ### Definitions for setting up the problem -/\n\n-- There are N monsters, N+1 columns and N+2 rows.\nvariable {N : \u2115}\n\n/-- A cell on the board for the game. -/\nabbrev Cell (N : \u2115) : Type := Fin (N + 2) \u00d7 Fin (N + 1)\n\n/-- A row that is neither the first nor the last (and thus contains a monster). -/\nabbrev InteriorRow (N : \u2115) : Type := (Set.Icc 1 \u27e8N, by omega\u27e9 : Set (Fin (N + 2)))\n\n/-- Data for valid positions of the monsters. -/\nabbrev MonsterData (N : \u2115) : Type := InteriorRow N \u21aa Fin (N + 1)\n\n/-- The cells with monsters as a Set, given an injection from rows to columns. -/\ndef MonsterData.monsterCells (m : MonsterData N) :\n Set (Cell N) :=\n Set.range (fun x : InteriorRow N \u21a6 ((x : Fin (N + 2)), m x))\n\n/-- Whether two cells are adjacent. -/\ndef Adjacent (x y : Cell N) : Prop :=\n Nat.dist x.1 y.1 + Nat.dist x.2 y.2 = 1\n\n/-- A valid path from the first to the last row. -/\nstructure _Path (N : \u2115) where\n /-- The cells on the path. -/\n cells : List (Cell N)\n nonempty : cells \u2260 []\n head_first_row : (cells.head nonempty).1 = 0\n last_last_row : (cells.getLast nonempty).1 = Fin.last (N + 1)\n valid_move_seq : cells.Chain' Adjacent\n\n/-- The first monster on a path, or `none`. -/\nnoncomputable def _Path.firstMonster (p : _Path N) (m : MonsterData N) : Option (Cell N) :=\n letI := Classical.propDecidable\n p.cells.find? (fun x \u21a6 (x \u2208 m.monsterCells : Bool))\n\n/-- A strategy, given the results of initial attempts, returns a path for the next attempt. -/\nabbrev Strategy (N : \u2115) : Type := \u2983k : \u2115\u2984 \u2192 (Fin k \u2192 Option (Cell N)) \u2192 _Path N\n\n/-- Playing a strategy, k attempts. -/\nnoncomputable def Strategy.play (s : Strategy N) (m : MonsterData N) :\n (k : \u2115) \u2192 Fin k \u2192 Option (Cell N)\n| 0 => Fin.elim0\n| k + 1 => Fin.snoc (s.play m k) ((s (s.play m k)).firstMonster m)\n\n/-- The predicate for a strategy winning within the given number of attempts. -/\ndef Strategy.WinsIn (s : Strategy N) (m : MonsterData N) (k : \u2115) : Prop :=\n none \u2208 Set.range (s.play m k)\n\n/-- Whether a strategy forces a win within the given number of attempts. -/\ndef Strategy.ForcesWinIn (s : Strategy N) (k : \u2115) : Prop :=\n \u2200 m, s.WinsIn m k\n\nabbrev answer : \u2115 := 3\n\ntheorem imo2024_p5 : IsLeast {k | \u2203 s : Strategy 2022, s.ForcesWinIn k} answer := by sorry", "category": "combinatorics"} {"name": "Imo1977P4", "solved": false, "tags": ["algebra"], "problem_id": "Imo1977P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1977, Problem 4\n\nDefine f(x) = 1 - a cos x - b sin x - A cos 2x - B sin 2x,\nwhere a, b, A, B are real constants.\nSuppose that f(x) \u2265 0 for all real x.\nProve that a^2 + b^2 \u2264 2 and A^2 + B^2 \u2264 1.\n-/", "formal_statement": "theorem imo1977_p4 (f : \u211d \u2192 \u211d) (a b A B : \u211d)\n (h\u2080 : \u2200 x, f x =\n 1 - a * Real.cos x - b * Real.sin x - A * Real.cos (2 * x) - B * Real.sin (2 * x))\n (h\u2081 : \u2200 x, f x \u2265 0) :\n a ^ 2 + b ^ 2 \u2264 2 \u2227 A ^ 2 + B ^ 2 \u2264 1 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1977, Problem 4\n\nDefine f(x) = 1 - a cos x - b sin x - A cos 2x - B sin 2x,\nwhere a, b, A, B are real constants.\nSuppose that f(x) \u2265 0 for all real x.\nProve that a^2 + b^2 \u2264 2 and A^2 + B^2 \u2264 1.\n-/\ntheorem imo1977_p4 (f : \u211d \u2192 \u211d) (a b A B : \u211d)\n (h\u2080 : \u2200 x, f x =\n 1 - a * Real.cos x - b * Real.sin x - A * Real.cos (2 * x) - B * Real.sin (2 * x))\n (h\u2081 : \u2200 x, f x \u2265 0) :\n a ^ 2 + b ^ 2 \u2264 2 \u2227 A ^ 2 + B ^ 2 \u2264 1 := by sorry", "category": "algebra"} {"name": "Imo2021P6", "solved": false, "tags": ["algebra"], "problem_id": "Imo2021P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2021, Problem 6\n\nLet m \u2265 2 be an integer, A a finite set of integers (not necessarily\npositive) and B\u2081, B\u2082, ... B\u2098 subsets of A. Suppose that for every\nk = 1, 2, ..., m, the sum of the elements of B\u2096 is m^k. Prove that\nA contains at least m/2 elements.\n-/", "formal_statement": "theorem imo2021_p6 (m : \u2115) (hm : 2 \u2264 m) (A : Finset \u2124)\n (B : Fin m \u2192 Finset \u2124) (hB : \u2200 k, B k \u2286 A)\n (hs : \u2200 k, \u2211 b \u2208 B k, b = (m : \u2124) ^ (k.val + 1))\n : m \u2264 2 * A.card := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2021, Problem 6\n\nLet m \u2265 2 be an integer, A a finite set of integers (not necessarily\npositive) and B\u2081, B\u2082, ... B\u2098 subsets of A. Suppose that for every\nk = 1, 2, ..., m, the sum of the elements of B\u2096 is m^k. Prove that\nA contains at least m/2 elements.\n-/\ntheorem imo2021_p6 (m : \u2115) (hm : 2 \u2264 m) (A : Finset \u2124)\n (B : Fin m \u2192 Finset \u2124) (hB : \u2200 k, B k \u2286 A)\n (hs : \u2200 k, \u2211 b \u2208 B k, b = (m : \u2124) ^ (k.val + 1))\n : m \u2264 2 * A.card := by sorry", "category": "algebra"} {"name": "Imo1961P3", "solved": true, "tags": ["algebra"], "problem_id": "Imo1961P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1961, Problem 3\n\nSolve the equation\n\n cos\u207f x - sin\u207f x = 1,\n\nwhere n is a given positive integer.\n-/", "formal_statement": "abbrev solutionSet (n : \u2115+) : Set \u211d :=\n{ x | (\u2203 k : \u2124, k * Real.pi = x) \u2227 Even n.val \u2228 (\u2203 k : \u2124, k * (2 * Real.pi) = x) \u2227 Odd n.val \u2228\n (\u2203 k : \u2124, -(Real.pi / 2) + k * (2 * Real.pi) = x) \u2227 Odd n.val }\n\ntheorem imo1961_p3 {n : \u2115} {x : \u211d} (npos : 0 < n) :\n x \u2208 solutionSet \u27e8n, npos\u27e9 \u2194\n (cos x) ^ n - (sin x) ^ n = 1 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1961, Problem 3\n\nSolve the equation\n\n cos\u207f x - sin\u207f x = 1,\n\nwhere n is a given positive integer.\n-/\nabbrev solutionSet (n : \u2115+) : Set \u211d :=\n{ x | (\u2203 k : \u2124, k * Real.pi = x) \u2227 Even n.val \u2228 (\u2203 k : \u2124, k * (2 * Real.pi) = x) \u2227 Odd n.val \u2228\n (\u2203 k : \u2124, -(Real.pi / 2) + k * (2 * Real.pi) = x) \u2227 Odd n.val }\n\ntheorem imo1961_p3 {n : \u2115} {x : \u211d} (npos : 0 < n) :\n x \u2208 solutionSet \u27e8n, npos\u27e9 \u2194\n (cos x) ^ n - (sin x) ^ n = 1 := by sorry", "category": "algebra"} {"name": "Usa2000P1", "solved": true, "tags": ["algebra"], "problem_id": "Usa2000P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\nUSA Mathematical Olympiad 2000, Problem 1\n\nA function f : \u211d \u2192 \u211d is called \"very convex\" if it satisfies\n\n \u2200 x y : \u211d, (f(x) + f(y))/2 \u2265 f((x + y)/2) + |x - y|.\n\nShow that there exist no very convex functions.\n-/", "formal_statement": "theorem usa2000_p1 :\n \u00ac\u2203 f : \u211d \u2192 \u211d,\n \u2200 x y : \u211d, f ((x + y) / 2) + |x - y| \u2264 (f x + f y) / 2 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\nUSA Mathematical Olympiad 2000, Problem 1\n\nA function f : \u211d \u2192 \u211d is called \"very convex\" if it satisfies\n\n \u2200 x y : \u211d, (f(x) + f(y))/2 \u2265 f((x + y)/2) + |x - y|.\n\nShow that there exist no very convex functions.\n-/\ntheorem usa2000_p1 :\n \u00ac\u2203 f : \u211d \u2192 \u211d,\n \u2200 x y : \u211d, f ((x + y) / 2) + |x - y| \u2264 (f x + f y) / 2 := by sorry", "category": "algebra"} {"name": "Imo2022P3", "solved": false, "tags": ["number theory"], "problem_id": "Imo2022P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2022, Problem 3\n\nLet k be a positive integer and let S be a finite set of odd prime\nintegers. Prove that there is at most one way (up to rotation and reflection)\nto place the elements of S around a circle such that the product of any\ntwo neighbors is of the form x\u00b2 + x + k for some positive integer x.\n\n-/", "formal_statement": "/- special open -/ open Finset\n\n\n\n\n\n\n\n/-- The condition of the problem on a placement of numbers round a circle. -/\ndef Condition (k : \u2115) (S : Finset \u2115) (p : Fin (Finset.card S) \u2192 S) : Prop :=\n \u2200 i, have : NeZero (Finset.card S) := \u27e8i.pos.ne'\u27e9\n \u2203 x : \u2115, 0 < x \u2227 ((p i : \u2115) * (p (i + 1) : \u2115)) = x ^ 2 + x + k\n\ntheorem imo2023_p3\n {k : \u2115} (hk : 0 < k) (S : Finset \u2115) (hS : \u2200 p \u2208 S, Odd p \u2227 Nat.Prime p)\n {p\u2081 p\u2082 : Fin (Finset.card S) \u2192 S} (hp\u2081 : Condition k S p\u2081) (hp\u2082 : Condition k S p\u2082) :\n (\u2203 i, \u2200 j, p\u2082 j = p\u2081 (j + i)) \u2228 \u2203 i, \u2200 j, p\u2082 j = p\u2081 (Fin.rev j + i) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2022, Problem 3\n\nLet k be a positive integer and let S be a finite set of odd prime\nintegers. Prove that there is at most one way (up to rotation and reflection)\nto place the elements of S around a circle such that the product of any\ntwo neighbors is of the form x\u00b2 + x + k for some positive integer x.\n\n-/\n/- special open -/ open Finset\n\n\n\n\n\n\n\n/-- The condition of the problem on a placement of numbers round a circle. -/\ndef Condition (k : \u2115) (S : Finset \u2115) (p : Fin (Finset.card S) \u2192 S) : Prop :=\n \u2200 i, have : NeZero (Finset.card S) := \u27e8i.pos.ne'\u27e9\n \u2203 x : \u2115, 0 < x \u2227 ((p i : \u2115) * (p (i + 1) : \u2115)) = x ^ 2 + x + k\n\ntheorem imo2023_p3\n {k : \u2115} (hk : 0 < k) (S : Finset \u2115) (hS : \u2200 p \u2208 S, Odd p \u2227 Nat.Prime p)\n {p\u2081 p\u2082 : Fin (Finset.card S) \u2192 S} (hp\u2081 : Condition k S p\u2081) (hp\u2082 : Condition k S p\u2082) :\n (\u2203 i, \u2200 j, p\u2082 j = p\u2081 (j + i)) \u2228 \u2203 i, \u2200 j, p\u2082 j = p\u2081 (Fin.rev j + i) := by sorry", "category": "number theory"} {"name": "Imo1978P1", "solved": true, "tags": ["number theory"], "problem_id": "Imo1978P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1978, Problem 1\n\nm and n are positive integers with m < n.\nThe last three decimal digits of 1978\u1d50 are the same as the\nlast three decimal digits of 1978\u207f.\nFind m and n such that m + n has the least possible value.\n-/", "formal_statement": "abbrev solution : \u2115 \u00d7 \u2115 := (3, 103)\n\nabbrev ValidPair : \u2115 \u00d7 \u2115 \u2192 Prop\n| (m, n) => 1 \u2264 m \u2227 m < n \u2227 (1978^m) % 1000 = (1978^n) % 1000\n\ntheorem imo1978_p1 (m n : \u2115)\n (hmn : (m, n) = solution) :\n ValidPair (m, n) \u2227\n (\u2200 m' n' : \u2115, ValidPair (m', n') \u2192 m + n \u2264 m' + n') := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1978, Problem 1\n\nm and n are positive integers with m < n.\nThe last three decimal digits of 1978\u1d50 are the same as the\nlast three decimal digits of 1978\u207f.\nFind m and n such that m + n has the least possible value.\n-/\nabbrev solution : \u2115 \u00d7 \u2115 := (3, 103)\n\nabbrev ValidPair : \u2115 \u00d7 \u2115 \u2192 Prop\n| (m, n) => 1 \u2264 m \u2227 m < n \u2227 (1978^m) % 1000 = (1978^n) % 1000\n\ntheorem imo1978_p1 (m n : \u2115)\n (hmn : (m, n) = solution) :\n ValidPair (m, n) \u2227\n (\u2200 m' n' : \u2115, ValidPair (m', n') \u2192 m + n \u2264 m' + n') := by sorry", "category": "number theory"} {"name": "Imo2004P2", "solved": false, "tags": ["algebra"], "problem_id": "Imo2004P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2004, Problem 2\n\nFind all polynomials P with real coefficients such that\nfor all reals a,b,c such that ab + bc + ca = 0 we have\n\n P(a - b) + P(b - c) + P(c - a) = 2P(a + b + c).\n-/", "formal_statement": "abbrev SolutionSet : Set (Polynomial \u211d) := \n {P | \u2203 (a\u2082 a\u2084 : \u211d), P = Polynomial.monomial 2 a\u2082 + Polynomial.monomial 4 a\u2084}\n\ntheorem imo2004_p2 (P : Polynomial \u211d) :\n P \u2208 SolutionSet \u2194\n \u2200 a b c, a * b + b * c + c * a = 0 \u2192\n P.eval (a - b) + P.eval (b - c) + P.eval (c - a) =\n 2 * P.eval (a + b + c) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2004, Problem 2\n\nFind all polynomials P with real coefficients such that\nfor all reals a,b,c such that ab + bc + ca = 0 we have\n\n P(a - b) + P(b - c) + P(c - a) = 2P(a + b + c).\n-/\nabbrev SolutionSet : Set (Polynomial \u211d) := \n {P | \u2203 (a\u2082 a\u2084 : \u211d), P = Polynomial.monomial 2 a\u2082 + Polynomial.monomial 4 a\u2084}\n\ntheorem imo2004_p2 (P : Polynomial \u211d) :\n P \u2208 SolutionSet \u2194\n \u2200 a b c, a * b + b * c + c * a = 0 \u2192\n P.eval (a - b) + P.eval (b - c) + P.eval (c - a) =\n 2 * P.eval (a + b + c) := by sorry", "category": "algebra"} {"name": "Bulgaria1998P2", "solved": false, "tags": ["geometry"], "problem_id": "Bulgaria1998P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# Bulgarian Mathematical Olympiad 1998, Problem 2\n\nA convex quadrilateral ABCD has AD = CD and \u2220DAB = \u2220ABC < 90\u00b0.\nThe line through D and the midpoint of BC intersects line AB\nin point E. Prove that \u2220BEC = \u2220DAC. (Note: The problem is valid\nwithout the assumption \u2220ABC < 90\u00b0.)\n-/", "formal_statement": "/- special open -/ open EuclideanGeometry\n\n\n\n\n\n\ntheorem bulgaria1998_p2\n (A B C D E M : EuclideanSpace \u211d (Fin 2))\n (H1 : dist D A = dist D C)\n (H2 : \u2220 D A B = \u2220 A B C)\n (H3 : M = midpoint \u211d B C) :\n \u2220 B E C = \u2220 D A C := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# Bulgarian Mathematical Olympiad 1998, Problem 2\n\nA convex quadrilateral ABCD has AD = CD and \u2220DAB = \u2220ABC < 90\u00b0.\nThe line through D and the midpoint of BC intersects line AB\nin point E. Prove that \u2220BEC = \u2220DAC. (Note: The problem is valid\nwithout the assumption \u2220ABC < 90\u00b0.)\n-/\n/- special open -/ open EuclideanGeometry\n\n\n\n\n\n\ntheorem bulgaria1998_p2\n (A B C D E M : EuclideanSpace \u211d (Fin 2))\n (H1 : dist D A = dist D C)\n (H2 : \u2220 D A B = \u2220 A B C)\n (H3 : M = midpoint \u211d B C) :\n \u2220 B E C = \u2220 D A C := by sorry", "category": "geometry"} {"name": "Imo2017P6", "solved": false, "tags": ["number theory"], "problem_id": "Imo2017P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2017, Problem 6\n\nA point (x,y) \u2208 \u2124 \u00d7 \u2124 is called primitive if gcd(x,y) = 1.\nLet S be a finite set of primitive points.\nProve that there exists n > 0 and integers a\u2080,a\u2081,...,a\u2099\nsuch that\n\n a\u2080x\u207f + a\u2081x\u207f\u207b\u00b9y + a\u2082x\u207f\u207b\u00b2y\u00b2 + ... + a\u2099\u208b\u2081xy\u207f\u207b\u00b9 + a\u2099y\u207f = 1\n\nfor each (x,y) \u2208 S.\n\n-/", "formal_statement": "theorem imo2017_p6 (S : Finset (\u2124 \u00d7 \u2124)) (hS : \u2200 s \u2208 S, gcd s.1 s.2 = 1) :\n \u2203 n : \u2115, 0 < n \u2227 \u2203 a : \u2115 \u2192 \u2124,\n \u2200 s \u2208 S, \u2211 i \u2208 Finset.range n, a i * s.1 ^ i * s.2 ^ (n - i) = 1 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2017, Problem 6\n\nA point (x,y) \u2208 \u2124 \u00d7 \u2124 is called primitive if gcd(x,y) = 1.\nLet S be a finite set of primitive points.\nProve that there exists n > 0 and integers a\u2080,a\u2081,...,a\u2099\nsuch that\n\n a\u2080x\u207f + a\u2081x\u207f\u207b\u00b9y + a\u2082x\u207f\u207b\u00b2y\u00b2 + ... + a\u2099\u208b\u2081xy\u207f\u207b\u00b9 + a\u2099y\u207f = 1\n\nfor each (x,y) \u2208 S.\n\n-/\ntheorem imo2017_p6 (S : Finset (\u2124 \u00d7 \u2124)) (hS : \u2200 s \u2208 S, gcd s.1 s.2 = 1) :\n \u2203 n : \u2115, 0 < n \u2227 \u2203 a : \u2115 \u2192 \u2124,\n \u2200 s \u2208 S, \u2211 i \u2208 Finset.range n, a i * s.1 ^ i * s.2 ^ (n - i) = 1 := by sorry", "category": "number theory"} {"name": "Imo2009P6", "solved": false, "tags": ["combinatorics"], "problem_id": "Imo2009P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2009, Problem 6\n\nLet a\u2081, a\u2082, ..., a\u2099 be distinct positive integers and let M\nbe a set of n - 1 positive integers not containing\ns = a\u2081 + a\u2082 + ... + a\u2099. A grasshopper is to jump along the\nreal axis, starting at the point 0 and making n jumps to\nthe right with lengths a\u2081, a\u2082, ..., a\u2099 in some order. Prove\nthat the order can be chosen in such a way that the\ngrasshopper never lands on any point in M.\n-/", "formal_statement": "theorem imo2009_p6 (n : \u2115) (hn : 0 < n)\n (a : Fin n \u2192 \u2124)\n (ainj : a.Injective)\n (apos : \u2200 i, 0 < a i)\n (M : Finset \u2124)\n (Mpos : \u2200 m \u2208 M, 0 < m)\n (Mcard : M.card = n - 1)\n (hM : \u2211 i, a i \u2209 M)\n : \u2203 p : Equiv.Perm (Fin n),\n \u2200 i : Fin n,\n \u2211 j \u2208 Finset.univ.filter (\u00b7 \u2264 i), a (p j) \u2209 M := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2009, Problem 6\n\nLet a\u2081, a\u2082, ..., a\u2099 be distinct positive integers and let M\nbe a set of n - 1 positive integers not containing\ns = a\u2081 + a\u2082 + ... + a\u2099. A grasshopper is to jump along the\nreal axis, starting at the point 0 and making n jumps to\nthe right with lengths a\u2081, a\u2082, ..., a\u2099 in some order. Prove\nthat the order can be chosen in such a way that the\ngrasshopper never lands on any point in M.\n-/\ntheorem imo2009_p6 (n : \u2115) (hn : 0 < n)\n (a : Fin n \u2192 \u2124)\n (ainj : a.Injective)\n (apos : \u2200 i, 0 < a i)\n (M : Finset \u2124)\n (Mpos : \u2200 m \u2208 M, 0 < m)\n (Mcard : M.card = n - 1)\n (hM : \u2211 i, a i \u2209 M)\n : \u2203 p : Equiv.Perm (Fin n),\n \u2200 i : Fin n,\n \u2211 j \u2208 Finset.univ.filter (\u00b7 \u2264 i), a (p j) \u2209 M := by sorry", "category": "combinatorics"} {"name": "Imo2013P1", "solved": true, "tags": ["number theory"], "problem_id": "Imo2013P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2013, Problem 1\n\nProve that for any pair of positive integers k and n, there exist k positive integers\nm\u2081, m\u2082, ..., m\u2096 (not necessarily different) such that\n\n 1 + (2\u1d4f - 1)/ n = (1 + 1/m\u2081) * (1 + 1/m\u2082) * ... * (1 + 1/m\u2096).\n\n-/", "formal_statement": "theorem imo2013_p1 (n : \u2115+) (k : \u2115) :\n \u2203 m : \u2115 \u2192 \u2115+,\n (1 : \u211a) + (2 ^ k - 1) / n = \u220f i \u2208 Finset.range k, (1 + 1 / (m i : \u211a)) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2013, Problem 1\n\nProve that for any pair of positive integers k and n, there exist k positive integers\nm\u2081, m\u2082, ..., m\u2096 (not necessarily different) such that\n\n 1 + (2\u1d4f - 1)/ n = (1 + 1/m\u2081) * (1 + 1/m\u2082) * ... * (1 + 1/m\u2096).\n\n-/\ntheorem imo2013_p1 (n : \u2115+) (k : \u2115) :\n \u2203 m : \u2115 \u2192 \u2115+,\n (1 : \u211a) + (2 ^ k - 1) / n = \u220f i \u2208 Finset.range k, (1 + 1 / (m i : \u211a)) := by sorry", "category": "number theory"} {"name": "Imo1979P5", "solved": false, "tags": ["algebra"], "problem_id": "Imo1979P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1979, Problem 5\n\nFind all real numbers a for which there exist\nnon-negative real numbers x1, x2, x3, x4, x5 satisfying:\n\nx1 + 2x_2 + 3x_3 + 4x_4 + 5x_5 = a,\nx1 + 2^3x_2 + 3^3x_3 + 4^3x_4 + 5^3x_5 = a^2,\nx1 + 2^5x_2 + 3^5x_3 + 4^5x_4 + 5^5x_5 = a^3.\n-/", "formal_statement": "abbrev solution_set : Set \u211d := {0, 1, 4, 9, 16, 25}\n\ntheorem imo1979_p5 (a : \u211d) :\n (\u2203 x1 x2 x3 x4 x5 : \u211d,\n x1 \u2265 0 \u2227 x2 \u2265 0 \u2227 x3 \u2265 0 \u2227 x4 \u2265 0 \u2227 x5 \u2265 0 \u2227\n x1 + 2*x2 + 3*x3 + 4*x4 + 5*x5 = a \u2227\n x1 + 2^3*x2 + 3^3*x3 + 4^3*x4 + 5^3*x5 = a^2 \u2227\n x1 + 2^5*x2 + 3^5*x3 + 4^5*x4 + 5^5*x5 = a^3 ) \u2194 a \u2208 solution_set := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1979, Problem 5\n\nFind all real numbers a for which there exist\nnon-negative real numbers x1, x2, x3, x4, x5 satisfying:\n\nx1 + 2x_2 + 3x_3 + 4x_4 + 5x_5 = a,\nx1 + 2^3x_2 + 3^3x_3 + 4^3x_4 + 5^3x_5 = a^2,\nx1 + 2^5x_2 + 3^5x_3 + 4^5x_4 + 5^5x_5 = a^3.\n-/\nabbrev solution_set : Set \u211d := {0, 1, 4, 9, 16, 25}\n\ntheorem imo1979_p5 (a : \u211d) :\n (\u2203 x1 x2 x3 x4 x5 : \u211d,\n x1 \u2265 0 \u2227 x2 \u2265 0 \u2227 x3 \u2265 0 \u2227 x4 \u2265 0 \u2227 x5 \u2265 0 \u2227\n x1 + 2*x2 + 3*x3 + 4*x4 + 5*x5 = a \u2227\n x1 + 2^3*x2 + 3^3*x3 + 4^3*x4 + 5^3*x5 = a^2 \u2227\n x1 + 2^5*x2 + 3^5*x3 + 4^5*x4 + 5^5*x5 = a^3 ) \u2194 a \u2208 solution_set := by sorry", "category": "algebra"} {"name": "Imo1970P6", "solved": false, "tags": ["combinatorics"], "problem_id": "Imo1970P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1970, Problem 6\n\nIn a plane there are 100 points, no three of which are collinear.\nConsider all possible triangles having these points as vertices.\nProve that no more that 70% of these triangles are acute.\n-/", "formal_statement": "/- special open -/ open EuclideanGeometry\n\n\n\n\n\n\nabbrev Pt := EuclideanSpace \u211d (Fin 2)\n\ndef AcuteTriangle (T : Affine.Triangle \u211d Pt) : Prop :=\n \u2220 (T.points 1) (T.points 2) (T.points 3) < Real.pi / 2 \u2227\n \u2220 (T.points 2) (T.points 3) (T.points 1) < Real.pi / 2 \u2227\n \u2220 (T.points 3) (T.points 1) (T.points 2) < Real.pi / 2\n\ntheorem imo1970_p6\n (P : Fin 100 \u2192 Pt)\n (hP : \u2200 a b c : Fin 100,\n List.Nodup [a, b, c] \u2192 \u00ac Collinear \u211d {P c, P b, P c}) :\n let cardAll := Nat.card { t : Affine.Triangle \u211d Pt |\n \u2203 a b c : Fin 100, ![P a, P b, P c] = t.points }\n let cardAcute :=\n Nat.card { t : Affine.Triangle \u211d Pt | \u2203 a b c : Fin 100, ![P a, P b, P c] = t.points \u2227\n AcuteTriangle t }\n (cardAcute : \u211a) / cardAll \u2264 7 / 10 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1970, Problem 6\n\nIn a plane there are 100 points, no three of which are collinear.\nConsider all possible triangles having these points as vertices.\nProve that no more that 70% of these triangles are acute.\n-/\n/- special open -/ open EuclideanGeometry\n\n\n\n\n\n\nabbrev Pt := EuclideanSpace \u211d (Fin 2)\n\ndef AcuteTriangle (T : Affine.Triangle \u211d Pt) : Prop :=\n \u2220 (T.points 1) (T.points 2) (T.points 3) < Real.pi / 2 \u2227\n \u2220 (T.points 2) (T.points 3) (T.points 1) < Real.pi / 2 \u2227\n \u2220 (T.points 3) (T.points 1) (T.points 2) < Real.pi / 2\n\ntheorem imo1970_p6\n (P : Fin 100 \u2192 Pt)\n (hP : \u2200 a b c : Fin 100,\n List.Nodup [a, b, c] \u2192 \u00ac Collinear \u211d {P c, P b, P c}) :\n let cardAll := Nat.card { t : Affine.Triangle \u211d Pt |\n \u2203 a b c : Fin 100, ![P a, P b, P c] = t.points }\n let cardAcute :=\n Nat.card { t : Affine.Triangle \u211d Pt | \u2203 a b c : Fin 100, ![P a, P b, P c] = t.points \u2227\n AcuteTriangle t }\n (cardAcute : \u211a) / cardAll \u2264 7 / 10 := by sorry", "category": "combinatorics"} {"name": "Imo2008P2a", "problem_id": "Imo2008P2a", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2008, Problem 2\n(a) Prove that\n ```\n x^2 / (x-1)^2 + y^2 / (y-1)^2 + z^2 / (z-1)^2 \u2265 1\n ```\nfor all real numbers `x`,`y`, `z`, each different from 1, and satisfying `xyz = 1`.\n-/", "formal_statement": "theorem imo2008_p2a (x y z : \u211d) (h : x * y * z = 1) (hx : x \u2260 1) (hy : y \u2260 1) (hz : z \u2260 1) :\n x ^ 2 / (x - 1) ^ 2 + y ^ 2 / (y - 1) ^ 2 + z ^ 2 / (z - 1) ^ 2 \u2265 1 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2008, Problem 2\n(a) Prove that\n ```\n x^2 / (x-1)^2 + y^2 / (y-1)^2 + z^2 / (z-1)^2 \u2265 1\n ```\nfor all real numbers `x`,`y`, `z`, each different from 1, and satisfying `xyz = 1`.\n-/\ntheorem imo2008_p2a (x y z : \u211d) (h : x * y * z = 1) (hx : x \u2260 1) (hy : y \u2260 1) (hz : z \u2260 1) :\n x ^ 2 / (x - 1) ^ 2 + y ^ 2 / (y - 1) ^ 2 + z ^ 2 / (z - 1) ^ 2 \u2265 1 := by sorry", "tags": ["algebra"], "solved": true, "category": "algebra"} {"name": "Usa2011P4", "solved": true, "tags": ["number theory"], "problem_id": "Usa2011P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 2011, Problem 4\n\nFor any integer n \u2265 2, define P(n) to be the proposition:\n\n P(n) \u2261 2^(2^n) % (2^n - 1) is a power of 4\n\nEither prove that P(n) is always true, or find a counterexample.\n-/", "formal_statement": "abbrev P (n : \u2115) : Prop := \u2203 k, 4^k = 2^(2^n) % (2^n - 1)\n\ninductive SolutionData where\n| AlwaysTrue : SolutionData\n| Counterexample : \u2115 \u2192 SolutionData\n\nabbrev solution_data : SolutionData := SolutionData.Counterexample 25\n\ntheorem usa2011_p4 :\n match solution_data with\n | .AlwaysTrue => \u2200 n, 2 \u2264 n \u2192 P n\n | .Counterexample m => 2 \u2264 m \u2227 \u00ac P m := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 2011, Problem 4\n\nFor any integer n \u2265 2, define P(n) to be the proposition:\n\n P(n) \u2261 2^(2^n) % (2^n - 1) is a power of 4\n\nEither prove that P(n) is always true, or find a counterexample.\n-/\nabbrev P (n : \u2115) : Prop := \u2203 k, 4^k = 2^(2^n) % (2^n - 1)\n\ninductive SolutionData where\n| AlwaysTrue : SolutionData\n| Counterexample : \u2115 \u2192 SolutionData\n\nabbrev solution_data : SolutionData := SolutionData.Counterexample 25\n\ntheorem usa2011_p4 :\n match solution_data with\n | .AlwaysTrue => \u2200 n, 2 \u2264 n \u2192 P n\n | .Counterexample m => 2 \u2264 m \u2227 \u00ac P m := by sorry", "category": "number theory"} {"name": "Imo2007P1b", "problem_id": "Imo2007P1b", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2007, Problem 1\n\nReal numbers a\u2081, a\u2082, ..., a\u2099 are fixed. For each 1 \u2264 i \u2264 n,\nwe let d\u1d62 = max {a\u2c7c : 1 \u2264 j \u2264 i} - min {a\u2c7c : i \u2264 j \u2264 n},\nand let d = max {d\u1d62 : 1 \u2264 i \u2264 n}.\n\n(b) Show that there exists some choice of x\u2081 \u2264 ... \u2264 x\u2099 which achieves equality.\n-/", "formal_statement": "noncomputable abbrev d {n : \u2115} (a : Fin n \u2192 \u211d) (i : Fin n) :=\n (\u2a06 j : {j // j \u2264 i}, a j - \u2a05 j : {j // i \u2264 j}, a j)\n\ntheorem imo2007_p1b {n : \u2115} (hn : 0 < n) {a : Fin n \u2192 \u211d} :\n \u2203 x : Fin n \u2192 \u211d, Monotone x \u2227\n (\u2a06 i, d a i) / 2 = \u2a06 i, |x i - a i| := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2007, Problem 1\n\nReal numbers a\u2081, a\u2082, ..., a\u2099 are fixed. For each 1 \u2264 i \u2264 n,\nwe let d\u1d62 = max {a\u2c7c : 1 \u2264 j \u2264 i} - min {a\u2c7c : i \u2264 j \u2264 n},\nand let d = max {d\u1d62 : 1 \u2264 i \u2264 n}.\n\n(b) Show that there exists some choice of x\u2081 \u2264 ... \u2264 x\u2099 which achieves equality.\n-/\nnoncomputable abbrev d {n : \u2115} (a : Fin n \u2192 \u211d) (i : Fin n) :=\n (\u2a06 j : {j // j \u2264 i}, a j - \u2a05 j : {j // i \u2264 j}, a j)\n\ntheorem imo2007_p1b {n : \u2115} (hn : 0 < n) {a : Fin n \u2192 \u211d} :\n \u2203 x : Fin n \u2192 \u211d, Monotone x \u2227\n (\u2a06 i, d a i) / 2 = \u2a06 i, |x i - a i| := by sorry", "tags": ["algebra"], "solved": false, "category": "algebra"} {"name": "Imo2001P1", "solved": false, "tags": ["geometry"], "problem_id": "Imo2001P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2001, Problem 1\n\nLet ABC be an acute-angled triangle with O as its circumcenter. Let P\non line BC be the foot of the altitude from A. Assume that\n\u2220BCA \u2265 \u2220ABC + 30\u00b0. Prove that \u2220CAB + \u2220COP < 90\u00b0.\n-/", "formal_statement": "/- special open -/ open EuclideanGeometry\n\n\n\n\n\n\ntheorem imo2001_p1\n (A B C : EuclideanSpace \u211d (Fin 2))\n (hABC : AffineIndependent \u211d ![A, B, C])\n (hAcuteA : \u2220 C A B < Real.pi / 2)\n (hAcuteB : \u2220 A B C < Real.pi / 2)\n (hAcuteC : \u2220 B C A < Real.pi / 2)\n (hAB : \u2220 A B C + Real.pi / 6 \u2264 \u2220 B C A)\n : let ABC : Affine.Triangle _ _ := \u27e8![A, B, C], hABC\u27e9\n let P := EuclideanGeometry.orthogonalProjection line[\u211d, B, C] A\n \u2220 C A B + \u2220 C ABC.circumcenter P < Real.pi / 2 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2001, Problem 1\n\nLet ABC be an acute-angled triangle with O as its circumcenter. Let P\non line BC be the foot of the altitude from A. Assume that\n\u2220BCA \u2265 \u2220ABC + 30\u00b0. Prove that \u2220CAB + \u2220COP < 90\u00b0.\n-/\n/- special open -/ open EuclideanGeometry\n\n\n\n\n\n\ntheorem imo2001_p1\n (A B C : EuclideanSpace \u211d (Fin 2))\n (hABC : AffineIndependent \u211d ![A, B, C])\n (hAcuteA : \u2220 C A B < Real.pi / 2)\n (hAcuteB : \u2220 A B C < Real.pi / 2)\n (hAcuteC : \u2220 B C A < Real.pi / 2)\n (hAB : \u2220 A B C + Real.pi / 6 \u2264 \u2220 B C A)\n : let ABC : Affine.Triangle _ _ := \u27e8![A, B, C], hABC\u27e9\n let P := EuclideanGeometry.orthogonalProjection line[\u211d, B, C] A\n \u2220 C A B + \u2220 C ABC.circumcenter P < Real.pi / 2 := by sorry", "category": "geometry"} {"name": "Usa1998P1", "solved": true, "tags": ["number theory"], "problem_id": "Usa1998P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 1998, Problem 1\n\nSuppose that the set { 1, 2, ..., 1998 } has been partitioned into disjoint\npairs {a\u1d62, b\u1d62}, where 1 \u2264 i \u2264 999, so that for all i, |a\u1d62 - b\u1d62| = 1 or 6.\n\nProve that the sum\n\n |a\u2081 - b\u2081| + |a\u2082 - b\u2082| + ... + |a\u2089\u2089\u2089 - b\u2089\u2089\u2089|\n\n-/", "formal_statement": "/--\n `ab 0 i` is a\u1d62 and `ab 1 i` is `b\u1d62`\n-/\ntheorem usa1998_p1\n (ab : Fin 2 \u2192 Fin 999 \u2192 Finset.Icc 1 1998)\n (hab : (ab.uncurry).Bijective)\n (habd : \u2200 i : Fin 999,\n |(ab 0 i : \u2124) - (ab 1 i : \u2124)| = 1 \u2228\n |(ab 0 i : \u2124) - (ab 1 i : \u2124)| = 6) :\n (\u2211 i : Fin 999, |(ab 0 i : \u2124) - (ab 1 i : \u2124)|) % 10 = 9 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 1998, Problem 1\n\nSuppose that the set { 1, 2, ..., 1998 } has been partitioned into disjoint\npairs {a\u1d62, b\u1d62}, where 1 \u2264 i \u2264 999, so that for all i, |a\u1d62 - b\u1d62| = 1 or 6.\n\nProve that the sum\n\n |a\u2081 - b\u2081| + |a\u2082 - b\u2082| + ... + |a\u2089\u2089\u2089 - b\u2089\u2089\u2089|\n\n-/\n/--\n `ab 0 i` is a\u1d62 and `ab 1 i` is `b\u1d62`\n-/\ntheorem usa1998_p1\n (ab : Fin 2 \u2192 Fin 999 \u2192 Finset.Icc 1 1998)\n (hab : (ab.uncurry).Bijective)\n (habd : \u2200 i : Fin 999,\n |(ab 0 i : \u2124) - (ab 1 i : \u2124)| = 1 \u2228\n |(ab 0 i : \u2124) - (ab 1 i : \u2124)| = 6) :\n (\u2211 i : Fin 999, |(ab 0 i : \u2124) - (ab 1 i : \u2124)|) % 10 = 9 := by sorry", "category": "number theory"} {"name": "Imo1982P3b", "problem_id": "Imo1982P3b", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1982, Problem 3\n\nConsider infinite sequences $\\{x_n \\}$ of positive reals such that $x_0 = 0$ and\n$x_0 \\geq x_1 \\geq x_2 \\geq ...$\n\nb) Find such a sequence such that for all n:\n\n$\\frac{x_0^2}{x_1} + \\ldots + \\frac{x_{n-1}^2}{x_n} < 4$\n-/", "formal_statement": "noncomputable abbrev sol : \u2115 \u2192 \u211d := fun k \u21a6 2\u207b\u00b9 ^ k\n\ntheorem imo1982_q3b : Antitone sol \u2227 sol 0 = 1 \u2227 (\u2200 k, 0 < sol k)\n \u2227 \u2200 n, \u2211 k \u2208 Finset.range n, sol k ^ 2 / sol (k + 1) < 4 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1982, Problem 3\n\nConsider infinite sequences $\\{x_n \\}$ of positive reals such that $x_0 = 0$ and\n$x_0 \\geq x_1 \\geq x_2 \\geq ...$\n\nb) Find such a sequence such that for all n:\n\n$\\frac{x_0^2}{x_1} + \\ldots + \\frac{x_{n-1}^2}{x_n} < 4$\n-/\nnoncomputable abbrev sol : \u2115 \u2192 \u211d := fun k \u21a6 2\u207b\u00b9 ^ k\n\ntheorem imo1982_q3b : Antitone sol \u2227 sol 0 = 1 \u2227 (\u2200 k, 0 < sol k)\n \u2227 \u2200 n, \u2211 k \u2208 Finset.range n, sol k ^ 2 / sol (k + 1) < 4 := by sorry", "tags": ["algebra"], "solved": true, "category": "algebra"} {"name": "Romania1998P12", "solved": true, "tags": ["algebra"], "problem_id": "Romania1998P12", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# Romanian Mathematical Olympiad 1998, Problem 12\n\nFind all functions u : \u211d \u2192 \u211d for which there exists a strictly monotonic\nfunction f : \u211d \u2192 \u211d such that\n\n \u2200 x,y \u2208 \u211d, f(x + y) = f(x)u(y) + f(y)\n-/", "formal_statement": "abbrev solution_set : Set (\u211d \u2192 \u211d) :=\n { u | \u2203 k : \u211d, \u2200 x : \u211d, u x = Real.exp (k * x) }\n\ntheorem romania1998_p12 (u : \u211d \u2192 \u211d) :\n (\u2203 f : \u211d \u2192 \u211d, (StrictMono f \u2228 StrictAnti f)\n \u2227 \u2200 x y : \u211d, f (x + y) = f x * u y + f y) \u2194\n u \u2208 solution_set := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# Romanian Mathematical Olympiad 1998, Problem 12\n\nFind all functions u : \u211d \u2192 \u211d for which there exists a strictly monotonic\nfunction f : \u211d \u2192 \u211d such that\n\n \u2200 x,y \u2208 \u211d, f(x + y) = f(x)u(y) + f(y)\n-/\nabbrev solution_set : Set (\u211d \u2192 \u211d) :=\n { u | \u2203 k : \u211d, \u2200 x : \u211d, u x = Real.exp (k * x) }\n\ntheorem romania1998_p12 (u : \u211d \u2192 \u211d) :\n (\u2203 f : \u211d \u2192 \u211d, (StrictMono f \u2228 StrictAnti f)\n \u2227 \u2200 x y : \u211d, f (x + y) = f x * u y + f y) \u2194\n u \u2208 solution_set := by sorry", "category": "algebra"} {"name": "Imo1987P1", "solved": true, "tags": ["combinatorics"], "problem_id": "Imo1987P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1987, Problem 1\n\nLet $p_{n, k}$ be the number of permutations of a set of cardinality `n \u2265 1`\nthat fix exactly `k` elements. Prove that $\u2211_{k=0}^n k p_{n,k}=n!$.\n-/", "formal_statement": "/-- Given `\u03b1 : Type*` and `k : \u2115`, `fiber \u03b1 k` is the set of permutations of\n `\u03b1` with exactly `k` fixed points. -/\ndef fiber (\u03b1 : Type*) [Fintype \u03b1] [DecidableEq \u03b1] (k : \u2115) : Set (Equiv.Perm \u03b1) :=\n {\u03c3 : Equiv.Perm \u03b1 | Fintype.card (Function.fixedPoints \u03c3) = k}\n\ninstance {k : \u2115} (\u03b1 : Type*) [Fintype \u03b1] [DecidableEq \u03b1] :\n Fintype (fiber \u03b1 k) := by unfold fiber; infer_instance\n\n/-- `p \u03b1 k` is the number of permutations of `\u03b1` with exactly `k` fixed points. -/\ndef p (\u03b1 : Type*) [Fintype \u03b1] [DecidableEq \u03b1] (k : \u2115) : \u2115 := Fintype.card (fiber \u03b1 k)\n\n\ntheorem imo1987_p1 {n : \u2115} (hn : 1 \u2264 n) :\n \u2211 k \u2208 Finset.range (n + 1), k * p (Fin n) k = n ! := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1987, Problem 1\n\nLet $p_{n, k}$ be the number of permutations of a set of cardinality `n \u2265 1`\nthat fix exactly `k` elements. Prove that $\u2211_{k=0}^n k p_{n,k}=n!$.\n-/\n/-- Given `\u03b1 : Type*` and `k : \u2115`, `fiber \u03b1 k` is the set of permutations of\n `\u03b1` with exactly `k` fixed points. -/\ndef fiber (\u03b1 : Type*) [Fintype \u03b1] [DecidableEq \u03b1] (k : \u2115) : Set (Equiv.Perm \u03b1) :=\n {\u03c3 : Equiv.Perm \u03b1 | Fintype.card (Function.fixedPoints \u03c3) = k}\n\ninstance {k : \u2115} (\u03b1 : Type*) [Fintype \u03b1] [DecidableEq \u03b1] :\n Fintype (fiber \u03b1 k) := by unfold fiber; infer_instance\n\n/-- `p \u03b1 k` is the number of permutations of `\u03b1` with exactly `k` fixed points. -/\ndef p (\u03b1 : Type*) [Fintype \u03b1] [DecidableEq \u03b1] (k : \u2115) : \u2115 := Fintype.card (fiber \u03b1 k)\n\n\ntheorem imo1987_p1 {n : \u2115} (hn : 1 \u2264 n) :\n \u2211 k \u2208 Finset.range (n + 1), k * p (Fin n) k = n ! := by sorry", "category": "combinatorics"} {"name": "Imo1994P5", "solved": true, "tags": ["algebra"], "problem_id": "Imo1994P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1994, Problem 5\n\nLet S be the set of all real numbers greater than -1.\nFind all functions f : S\u2192S such that f(x + f(y) + xf(y)) = y + f(x) + yf(x)\nfor all x and y, and f(x)/x is strictly increasing on each of the\nintervals -1 < x < 0 and 0 < x.\n-/", "formal_statement": "def S := { x : \u211d // -1 < x }\n\nabbrev op (f : S \u2192 S) (a b : S) : S :=\n \u27e8a.val + (f b).val + a.val * (f b).val, by nlinarith [a.property, (f b).property]\u27e9\n\naxiom sol_prop {a : \u211d} (ha : -1 < a) : -1 < -a / (1 + a)\n\nabbrev solution_set : Set (S \u2192 S) := { fun x \u21a6 \u27e8-x.val / (1 + x.val), sol_prop x.property\u27e9 }\n\ntheorem imo1994_p5 (f : S \u2192 S) :\n f \u2208 solution_set \u2194\n ((\u2200 x y : S, f (op f x y) = op f y x) \u2227\n (\u2200 x y : S, x.val \u2208 Set.Ioo (-1) 0 \u2192 y.val \u2208 Set.Ioo (-1) 0 \u2192\n x.val < y.val \u2192 (f x).val / x.val < (f y).val / y.val) \u2227\n (\u2200 x y : S, 0 < x.val \u2192 0 < y.val \u2192\n x.val < y.val \u2192 (f x).val / x.val < (f y).val / y.val)) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1994, Problem 5\n\nLet S be the set of all real numbers greater than -1.\nFind all functions f : S\u2192S such that f(x + f(y) + xf(y)) = y + f(x) + yf(x)\nfor all x and y, and f(x)/x is strictly increasing on each of the\nintervals -1 < x < 0 and 0 < x.\n-/\ndef S := { x : \u211d // -1 < x }\n\nabbrev op (f : S \u2192 S) (a b : S) : S :=\n \u27e8a.val + (f b).val + a.val * (f b).val, by nlinarith [a.property, (f b).property]\u27e9\n\naxiom sol_prop {a : \u211d} (ha : -1 < a) : -1 < -a / (1 + a)\n\nabbrev solution_set : Set (S \u2192 S) := { fun x \u21a6 \u27e8-x.val / (1 + x.val), sol_prop x.property\u27e9 }\n\ntheorem imo1994_p5 (f : S \u2192 S) :\n f \u2208 solution_set \u2194\n ((\u2200 x y : S, f (op f x y) = op f y x) \u2227\n (\u2200 x y : S, x.val \u2208 Set.Ioo (-1) 0 \u2192 y.val \u2208 Set.Ioo (-1) 0 \u2192\n x.val < y.val \u2192 (f x).val / x.val < (f y).val / y.val) \u2227\n (\u2200 x y : S, 0 < x.val \u2192 0 < y.val \u2192\n x.val < y.val \u2192 (f x).val / x.val < (f y).val / y.val)) := by sorry", "category": "algebra"} {"name": "Imo1983P6", "solved": true, "tags": ["algebra", "inequality"], "problem_id": "Imo1983P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1983, Problem 6\n\nSuppose that a,b,c are the side lengths of a triangle. Prove that\n\n a\u00b2b(a - b) + b\u00b2c(b - c) + c\u00b2a(c - a) \u2265 0.\n\nDetermine when equality occurs.\n-/", "formal_statement": "abbrev EqualityCondition (a b c : \u211d) : Prop := a = b \u2227 a = c\n\ntheorem imo1983_p6 (T : Affine.Triangle \u211d (EuclideanSpace \u211d (Fin 2))) :\n let a := dist (T.points 1) (T.points 2)\n let b := dist (T.points 0) (T.points 2)\n let c := dist (T.points 0) (T.points 1)\n 0 \u2264 a^2 * b * (a - b) + b^2 * c * (b - c) + c^2 * a * (c - a) \u2227\n (0 = a^2 * b * (a - b) + b^2 * c * (b - c) + c^2 * a * (c - a) \u2194\n EqualityCondition a b c) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1983, Problem 6\n\nSuppose that a,b,c are the side lengths of a triangle. Prove that\n\n a\u00b2b(a - b) + b\u00b2c(b - c) + c\u00b2a(c - a) \u2265 0.\n\nDetermine when equality occurs.\n-/\nabbrev EqualityCondition (a b c : \u211d) : Prop := a = b \u2227 a = c\n\ntheorem imo1983_p6 (T : Affine.Triangle \u211d (EuclideanSpace \u211d (Fin 2))) :\n let a := dist (T.points 1) (T.points 2)\n let b := dist (T.points 0) (T.points 2)\n let c := dist (T.points 0) (T.points 1)\n 0 \u2264 a^2 * b * (a - b) + b^2 * c * (b - c) + c^2 * a * (c - a) \u2227\n (0 = a^2 * b * (a - b) + b^2 * c * (b - c) + c^2 * a * (c - a) \u2194\n EqualityCondition a b c) := by sorry", "category": "algebra"} {"name": "Usa1993P3", "solved": false, "tags": ["algebra"], "problem_id": "Usa1993P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 1993, Problem 3\n\nConsider functions f : [0,1] \u2192 \u211d which satisfy\n\n (i) f(x) \u2265 0 for all x \u2208 [0,1]\n (ii) f(1) = 1\n (iii) f(x) + f(y) \u2264 f (x + y) whenever x, y and x + y are all in [0,1].\n\nDetermine the smallest constant c such that\n\n f(x) \u2264 cx\n\nfor every function satisfying (i) - (iii) and every x \u2208 [0,1].\n-/", "formal_statement": "def valid (f : Set.Icc 0 1 \u2192 \u211d) : Prop :=\n (\u2200 x, 0 \u2264 f x) \u2227\n f 1 = 1 \u2227\n \u2200 x y, (h : x.val + y.val \u2208 Set.Icc 0 1) \u2192 f x + f y \u2264 f \u27e8x.val + y.val, h\u27e9\n\nabbrev min_c : \u211d := 2\n\ntheorem usa1993_p5 :\n IsLeast {c | \u2200 f, valid f \u2227 \u2200 x, f x \u2264 c * x } min_c := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 1993, Problem 3\n\nConsider functions f : [0,1] \u2192 \u211d which satisfy\n\n (i) f(x) \u2265 0 for all x \u2208 [0,1]\n (ii) f(1) = 1\n (iii) f(x) + f(y) \u2264 f (x + y) whenever x, y and x + y are all in [0,1].\n\nDetermine the smallest constant c such that\n\n f(x) \u2264 cx\n\nfor every function satisfying (i) - (iii) and every x \u2208 [0,1].\n-/\ndef valid (f : Set.Icc 0 1 \u2192 \u211d) : Prop :=\n (\u2200 x, 0 \u2264 f x) \u2227\n f 1 = 1 \u2227\n \u2200 x y, (h : x.val + y.val \u2208 Set.Icc 0 1) \u2192 f x + f y \u2264 f \u27e8x.val + y.val, h\u27e9\n\nabbrev min_c : \u211d := 2\n\ntheorem usa1993_p5 :\n IsLeast {c | \u2200 f, valid f \u2227 \u2200 x, f x \u2264 c * x } min_c := by sorry", "category": "algebra"} {"name": "Imo1986P5", "solved": true, "tags": ["algebra"], "problem_id": "Imo1986P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1986, Problem 5\n\nFind all functions `f`, defined on the non-negative real numbers and taking nonnegative real values,\nsuch that:\n\n- $f(xf(y))f(y) = f(x + y)$ for all $x, y \\ge 0$,\n- $f(2) = 0$,\n- $f(x) \\ne 0$ for $0 \\le x < 2$.\n-/", "formal_statement": "/- special open -/ open NNReal\n\n\n\n\n\n\nstructure IsGood (f : \u211d\u22650 \u2192 \u211d\u22650) : Prop where\n map_add_rev x y : f (x * f y) * f y = f (x + y)\n map_two : f 2 = 0\n map_ne_zero : \u2200 x < 2, f x \u2260 0\n\nabbrev SolutionSet : Set (\u211d\u22650 \u2192 \u211d\u22650) := { fun x \u21a6 2 / (2 - x) }\n\ntheorem imo1986_p5 {f : \u211d\u22650 \u2192 \u211d\u22650} : IsGood f \u2194 f \u2208 SolutionSet := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1986, Problem 5\n\nFind all functions `f`, defined on the non-negative real numbers and taking nonnegative real values,\nsuch that:\n\n- $f(xf(y))f(y) = f(x + y)$ for all $x, y \\ge 0$,\n- $f(2) = 0$,\n- $f(x) \\ne 0$ for $0 \\le x < 2$.\n-/\n/- special open -/ open NNReal\n\n\n\n\n\n\nstructure IsGood (f : \u211d\u22650 \u2192 \u211d\u22650) : Prop where\n map_add_rev x y : f (x * f y) * f y = f (x + y)\n map_two : f 2 = 0\n map_ne_zero : \u2200 x < 2, f x \u2260 0\n\nabbrev SolutionSet : Set (\u211d\u22650 \u2192 \u211d\u22650) := { fun x \u21a6 2 / (2 - x) }\n\ntheorem imo1986_p5 {f : \u211d\u22650 \u2192 \u211d\u22650} : IsGood f \u2194 f \u2208 SolutionSet := by sorry", "category": "algebra"} {"name": "Imo1991P6", "solved": false, "tags": ["algebra"], "problem_id": "Imo1991P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1991, Problem 6\n\nAn infinite sequence x\u2080,x\u2081,x\u2082,... of real numbers is said to be *bounded*\nif there is a constant C such that |x\u1d62| \u2264 C for every i \u2265 0.\n\nGiven any real number a > 1, construct a bounded infinite sequence\nx\u2080,x\u2081,x\u2082,... such that\n\n |x\u1d62 - x\u2c7c|\u2b1d|i - j| \u2265 1\n\nfor every pair of distinct nonnegative integers i, j.\n-/", "formal_statement": "abbrev Bounded (x : \u2115 \u2192 \u211d) : Prop := \u2203 C, \u2200 i, |x i| \u2264 C\n\nnoncomputable abbrev solution (a : \u211d) (ha : 1 < a) : \u2115 \u2192 \u211d := \n let t := 1/(2^a)\n let c := 1 - t/(1 - t)\n \u03bb n => if n = 0 then 0 else\n (1/c) * (\u2211 i \u2208 Finset.filter (\u03bb i => (n / 2^i) % 2 = 1) (Finset.range (Nat.log2 n + 1)), t^i)\n \ntheorem imo1991_p6 (a : \u211d) (ha : 1 < a) :\n Bounded (solution a ha) \u2227\n \u2200 i j, i \u2260 j \u2192\n 1 \u2264 |solution a ha i - solution a ha j| * |(i:\u211d) - j| := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1991, Problem 6\n\nAn infinite sequence x\u2080,x\u2081,x\u2082,... of real numbers is said to be *bounded*\nif there is a constant C such that |x\u1d62| \u2264 C for every i \u2265 0.\n\nGiven any real number a > 1, construct a bounded infinite sequence\nx\u2080,x\u2081,x\u2082,... such that\n\n |x\u1d62 - x\u2c7c|\u2b1d|i - j| \u2265 1\n\nfor every pair of distinct nonnegative integers i, j.\n-/\nabbrev Bounded (x : \u2115 \u2192 \u211d) : Prop := \u2203 C, \u2200 i, |x i| \u2264 C\n\nnoncomputable abbrev solution (a : \u211d) (ha : 1 < a) : \u2115 \u2192 \u211d := \n let t := 1/(2^a)\n let c := 1 - t/(1 - t)\n \u03bb n => if n = 0 then 0 else\n (1/c) * (\u2211 i \u2208 Finset.filter (\u03bb i => (n / 2^i) % 2 = 1) (Finset.range (Nat.log2 n + 1)), t^i)\n \ntheorem imo1991_p6 (a : \u211d) (ha : 1 < a) :\n Bounded (solution a ha) \u2227\n \u2200 i j, i \u2260 j \u2192\n 1 \u2264 |solution a ha i - solution a ha j| * |(i:\u211d) - j| := by sorry", "category": "algebra"} {"name": "Imo1998P4", "solved": false, "tags": ["number theory"], "problem_id": "Imo1998P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1998, Problem 4\n\nDetermine all pairs (a, b) of positive integers such that ab^2 + b + 7 divides a^2b + a + b.\n-/", "formal_statement": "abbrev solution_set : Set (\u2115 \u00d7 \u2115) := {(11, 1), (49, 1)} \u222a\n {(x,y) | \u2203 k : \u2115 , (x = 7 * k^2 \u2227 y = 7 * k)}\n\ntheorem imo1998_p4 (a b : \u2115) :\n (0 < a \u2227 0 < b \u2227 a * b^2 + b + 7 \u2223 a^2 * b + a + b) \u2194\n (a, b) \u2208 solution_set := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1998, Problem 4\n\nDetermine all pairs (a, b) of positive integers such that ab^2 + b + 7 divides a^2b + a + b.\n-/\nabbrev solution_set : Set (\u2115 \u00d7 \u2115) := {(11, 1), (49, 1)} \u222a\n {(x,y) | \u2203 k : \u2115 , (x = 7 * k^2 \u2227 y = 7 * k)}\n\ntheorem imo1998_p4 (a b : \u2115) :\n (0 < a \u2227 0 < b \u2227 a * b^2 + b + 7 \u2223 a^2 * b + a + b) \u2194\n (a, b) \u2208 solution_set := by sorry", "category": "number theory"} {"name": "Usa1996P1", "solved": true, "tags": ["algebra"], "problem_id": "Usa1996P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 1996, Problem 1\n\nProve that the average of the numbers n\u2b1dsin(n \u03c0 / 180)\nfor n \u2208 {2,4,6,\u2026,180} is 1/tan(\u03c0/180).\n-/", "formal_statement": "theorem usa1996_p1 :\n (1 / (90:\u211d)) * \u2211 n \u2208 Finset.range 90, (2 * (n+1)) * Real.sin ((2 * (n+1)) * Real.pi / 180)\n = 1 / Real.tan (Real.pi / 180) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 1996, Problem 1\n\nProve that the average of the numbers n\u2b1dsin(n \u03c0 / 180)\nfor n \u2208 {2,4,6,\u2026,180} is 1/tan(\u03c0/180).\n-/\ntheorem usa1996_p1 :\n (1 / (90:\u211d)) * \u2211 n \u2208 Finset.range 90, (2 * (n+1)) * Real.sin ((2 * (n+1)) * Real.pi / 180)\n = 1 / Real.tan (Real.pi / 180) := by sorry", "category": "algebra"} {"name": "Usa1989P5", "solved": true, "tags": ["algebra"], "problem_id": "Usa1989P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 1989, Problem 5\n\nLet u and v be real numbers such that\n\n(u + u\u00b2 + u\u00b3 + \u22ef + u\u2078) + 10u\u2079 = (v + v\u00b2 + v\u00b3 + \u22ef + v\u00b9\u2070) + 10v\u00b9\u00b9 = 8.\n\nDetermine, with proof, which of the two numbers, u or v, is larger.\n-/", "formal_statement": "abbrev u_is_larger : Bool := false\n\ntheorem usa1989_p5\n (u v : \u211d)\n (hu : (\u2211 i \u2208 Finset.range 8, u^(i + 1)) + 10 * u^9 = 8)\n (hv : (\u2211 i \u2208 Finset.range 10, v^(i + 1)) + 10 * v^11 = 8) :\n if u_is_larger then v < u else u < v := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 1989, Problem 5\n\nLet u and v be real numbers such that\n\n(u + u\u00b2 + u\u00b3 + \u22ef + u\u2078) + 10u\u2079 = (v + v\u00b2 + v\u00b3 + \u22ef + v\u00b9\u2070) + 10v\u00b9\u00b9 = 8.\n\nDetermine, with proof, which of the two numbers, u or v, is larger.\n-/\nabbrev u_is_larger : Bool := false\n\ntheorem usa1989_p5\n (u v : \u211d)\n (hu : (\u2211 i \u2208 Finset.range 8, u^(i + 1)) + 10 * u^9 = 8)\n (hv : (\u2211 i \u2208 Finset.range 10, v^(i + 1)) + 10 * v^11 = 8) :\n if u_is_larger then v < u else u < v := by sorry", "category": "algebra"} {"name": "Imo1990P3", "solved": true, "tags": ["number theory"], "problem_id": "Imo1990P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1990, Problem 3\n\nFind all integers n > 1 such that n\u00b2 divides 2\u207f + 1.\n-/", "formal_statement": "abbrev solution_set : Set \u2115 := { 3 }\n\ntheorem imo1990_p3 (n : \u2115) (hn : 1 < n) : n \u2208 solution_set \u2194 n^2 \u2223 2^n + 1 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1990, Problem 3\n\nFind all integers n > 1 such that n\u00b2 divides 2\u207f + 1.\n-/\nabbrev solution_set : Set \u2115 := { 3 }\n\ntheorem imo1990_p3 (n : \u2115) (hn : 1 < n) : n \u2208 solution_set \u2194 n^2 \u2223 2^n + 1 := by sorry", "category": "number theory"} {"name": "Imo1994P4", "solved": false, "tags": ["number theory"], "problem_id": "Imo1994P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1994, Problem 4\n\nDetermine all ordered pairs of positive integers (m, n) such that\n\n (n\u00b3 + 1) / (mn - 1)\n\nis an integer.\n-/", "formal_statement": "abbrev SolutionSet : Set (\u2124 \u00d7 \u2124) := \n {(1, 2), (1, 3), (2, 1), (2, 2), (2, 5), (3, 1), (3, 5), (5, 2), (5, 3)}\n\ntheorem imo1994_p4 (m n : \u2124) :\n (m, n) \u2208 SolutionSet \u2194\n 0 < m \u2227 0 < n \u2227 (m * n - 1) \u2223 (n^3 + 1) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1994, Problem 4\n\nDetermine all ordered pairs of positive integers (m, n) such that\n\n (n\u00b3 + 1) / (mn - 1)\n\nis an integer.\n-/\nabbrev SolutionSet : Set (\u2124 \u00d7 \u2124) := \n {(1, 2), (1, 3), (2, 1), (2, 2), (2, 5), (3, 1), (3, 5), (5, 2), (5, 3)}\n\ntheorem imo1994_p4 (m n : \u2124) :\n (m, n) \u2208 SolutionSet \u2194\n 0 < m \u2227 0 < n \u2227 (m * n - 1) \u2223 (n^3 + 1) := by sorry", "category": "number theory"} {"name": "Imo1992P2", "solved": true, "tags": ["algebra"], "problem_id": "Imo1992P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1992, Problem 2\n\nDetermine all functions f : \u211d \u2192 \u211d such that\nfor all x,y \u2208 \u211d, f(x\u00b2 + f(y)) = y + (f(x))\u00b2.\n-/", "formal_statement": "abbrev solution_set : Set (\u211d \u2192 \u211d) := { fun x \u21a6 x }\n\ntheorem imo1992_p2 (f : \u211d \u2192 \u211d) :\n f \u2208 solution_set \u2194\n \u2200 x y, f (x^2 + f y) = y + f x ^ 2 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1992, Problem 2\n\nDetermine all functions f : \u211d \u2192 \u211d such that\nfor all x,y \u2208 \u211d, f(x\u00b2 + f(y)) = y + (f(x))\u00b2.\n-/\nabbrev solution_set : Set (\u211d \u2192 \u211d) := { fun x \u21a6 x }\n\ntheorem imo1992_p2 (f : \u211d \u2192 \u211d) :\n f \u2208 solution_set \u2194\n \u2200 x y, f (x^2 + f y) = y + f x ^ 2 := by sorry", "category": "algebra"} {"name": "Imo1981P6", "solved": true, "tags": ["algebra"], "problem_id": "Imo1981P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1981, Problem 6\n\nSuppose that f : \u2115 \u00d7 \u2115 \u2192 \u2115 satisfies\n\n 1) f (0, y) = y + 1\n 2) f (x + 1, 0) = f (x, 1),\n 3) f (x + 1, y + 1) = f (x, f (x + 1, y))\n\nfor all x y \u2208 \u2115.\n\nDetermine f (4, 1981).\n-/", "formal_statement": "def no_eval (x : \u2115) : \u2115 := x\n\nabbrev solution_value : \u2115 := no_eval ((2^\u00b7)^[1984] 1 - 3)\n\ntheorem imo1981_p6 (f : \u2115 \u2192 \u2115 \u2192 \u2115)\n (h1 : \u2200 y, f 0 y = y + 1)\n (h2 : \u2200 x, f (x + 1) 0 = f x 1)\n (h3 : \u2200 x y, f (x + 1) (y + 1) = f x (f (x + 1) y)) :\n f 4 1981 = solution_value := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1981, Problem 6\n\nSuppose that f : \u2115 \u00d7 \u2115 \u2192 \u2115 satisfies\n\n 1) f (0, y) = y + 1\n 2) f (x + 1, 0) = f (x, 1),\n 3) f (x + 1, y + 1) = f (x, f (x + 1, y))\n\nfor all x y \u2208 \u2115.\n\nDetermine f (4, 1981).\n-/\ndef no_eval (x : \u2115) : \u2115 := x\n\nabbrev solution_value : \u2115 := no_eval ((2^\u00b7)^[1984] 1 - 3)\n\ntheorem imo1981_p6 (f : \u2115 \u2192 \u2115 \u2192 \u2115)\n (h1 : \u2200 y, f 0 y = y + 1)\n (h2 : \u2200 x, f (x + 1) 0 = f x 1)\n (h3 : \u2200 x y, f (x + 1) (y + 1) = f x (f (x + 1) y)) :\n f 4 1981 = solution_value := by sorry", "category": "algebra"} {"name": "Singapore2019P2", "solved": true, "tags": ["algebra"], "problem_id": "Singapore2019P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# Singapore Math Olympiad (Senior) 2019 (Round 1), Problem 2\n\nhttp://www.realsutra.com/limjeck/SMO_Senior_2019.pdf\n\nSimplify $(sqrt{10} - sqrt{2})^{1/3} * (sqrt{10} + sqrt{2})^{7/3}$.\n-/", "formal_statement": "noncomputable abbrev solution : \u211d := 24 + 8 * \u221a5\n\ntheorem singapore2019_r1_p2 : (\u221a10 - \u221a2)^(1 / 3 : \u211d) * (\u221a10 + \u221a2)^(7 / 3 : \u211d) = solution := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# Singapore Math Olympiad (Senior) 2019 (Round 1), Problem 2\n\nhttp://www.realsutra.com/limjeck/SMO_Senior_2019.pdf\n\nSimplify $(sqrt{10} - sqrt{2})^{1/3} * (sqrt{10} + sqrt{2})^{7/3}$.\n-/\nnoncomputable abbrev solution : \u211d := 24 + 8 * \u221a5\n\ntheorem singapore2019_r1_p2 : (\u221a10 - \u221a2)^(1 / 3 : \u211d) * (\u221a10 + \u221a2)^(7 / 3 : \u211d) = solution := by sorry", "category": "algebra"} {"name": "Imo2012P4", "solved": true, "tags": ["algebra"], "problem_id": "Imo2012P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2012, Problem 4\n\nDetermine all functions f : \u2124 \u2192 \u2124 such that for all integers a,b,c with a + b + c = 0,\nthe following equality holds:\n f(a)\u00b2 + f(b)\u00b2 + f(c)\u00b2 = 2f(a)f(b) + 2f(b)f(c) + 2f(c)f(a).\n-/", "formal_statement": "def odd_const : Set (\u2124 \u2192 \u2124) := fun f =>\n \u2203 c : \u2124, \u2200 x : \u2124,\n (Odd x \u2192 f x = c) \u2227 (Even x \u2192 f x = 0)\n\ndef mod4_cycle : Set (\u2124 \u2192 \u2124) := fun f =>\n \u2203 c : \u2124, \u2200 x : \u2124, f x =\n match x % 4 with\n | 0 => 0\n | 2 => 4 * c\n | _ => c\n\ndef square_set : Set (\u2124 \u2192 \u2124) := fun f =>\n \u2203 c : \u2124, \u2200 x : \u2124, f x = x ^ 2 * c\n\nabbrev solution_set : Set (\u2124 \u2192 \u2124) := odd_const \u222a mod4_cycle \u222a square_set\n\ntheorem imo2012_p4 (f : \u2124 \u2192 \u2124) :\n f \u2208 solution_set \u2194\n \u2200 a b c : \u2124, a + b + c = 0 \u2192\n (f a)^2 + (f b)^2 + (f c)^2 =\n 2 * f a * f b + 2 * f b * f c + 2 * f c * f a := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2012, Problem 4\n\nDetermine all functions f : \u2124 \u2192 \u2124 such that for all integers a,b,c with a + b + c = 0,\nthe following equality holds:\n f(a)\u00b2 + f(b)\u00b2 + f(c)\u00b2 = 2f(a)f(b) + 2f(b)f(c) + 2f(c)f(a).\n-/\ndef odd_const : Set (\u2124 \u2192 \u2124) := fun f =>\n \u2203 c : \u2124, \u2200 x : \u2124,\n (Odd x \u2192 f x = c) \u2227 (Even x \u2192 f x = 0)\n\ndef mod4_cycle : Set (\u2124 \u2192 \u2124) := fun f =>\n \u2203 c : \u2124, \u2200 x : \u2124, f x =\n match x % 4 with\n | 0 => 0\n | 2 => 4 * c\n | _ => c\n\ndef square_set : Set (\u2124 \u2192 \u2124) := fun f =>\n \u2203 c : \u2124, \u2200 x : \u2124, f x = x ^ 2 * c\n\nabbrev solution_set : Set (\u2124 \u2192 \u2124) := odd_const \u222a mod4_cycle \u222a square_set\n\ntheorem imo2012_p4 (f : \u2124 \u2192 \u2124) :\n f \u2208 solution_set \u2194\n \u2200 a b c : \u2124, a + b + c = 0 \u2192\n (f a)^2 + (f b)^2 + (f c)^2 =\n 2 * f a * f b + 2 * f b * f c + 2 * f c * f a := by sorry", "category": "algebra"} {"name": "Imo2008P3", "solved": true, "tags": ["number theory"], "problem_id": "Imo2008P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2008, Problem 3\nProve that there exist infinitely many positive integers `n` such that `n^2 + 1` has a prime\ndivisor which is greater than `2n + \u221a(2n)`.\n-/", "formal_statement": "theorem imo2008_p3 : \u2200 N : \u2115, \u2203 n : \u2115, n \u2265 N \u2227\n \u2203 p : \u2115, Nat.Prime p \u2227 p \u2223 n ^ 2 + 1 \u2227 (p : \u211d) > 2 * (n : \u211d) + Real.sqrt (2 * (n : \u211d)) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2008, Problem 3\nProve that there exist infinitely many positive integers `n` such that `n^2 + 1` has a prime\ndivisor which is greater than `2n + \u221a(2n)`.\n-/\ntheorem imo2008_p3 : \u2200 N : \u2115, \u2203 n : \u2115, n \u2265 N \u2227\n \u2203 p : \u2115, Nat.Prime p \u2227 p \u2223 n ^ 2 + 1 \u2227 (p : \u211d) > 2 * (n : \u211d) + Real.sqrt (2 * (n : \u211d)) := by sorry", "category": "number theory"} {"name": "Usa2002P1", "solved": true, "tags": ["combinatorics"], "problem_id": "Usa2002P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 2002, Problem 1\n\nLet S be a set with 2002 elements, and let N be an integer with\n\n 0 \u2264 N \u2264 2^2002.\n\nProve that it is possible to color every subset of S either blue or\nred so that the following conditions hold:\n\n a) the union of any two red subsets is red;\n b) the union of any two blue subsets is blue;\n c) there are exactly N red subsets.\n-/", "formal_statement": "inductive Color : Type where\n| red : Color\n| blue : Color\nderiving DecidableEq, Fintype\n\ntheorem usa2002_p1\n {\u03b1 : Type} [DecidableEq \u03b1] [Fintype \u03b1] (hs : Fintype.card \u03b1 = 2002)\n (N : \u2115) (hN : N \u2264 2 ^ 2002) :\n \u2203 f : Finset \u03b1 \u2192 Color,\n ((\u2200 s1 s2 : Finset \u03b1, f s1 = f s2 \u2192 f (s1 \u222a s2) = f s1) \u2227\n (Fintype.card\n { a : Finset \u03b1 // f a = Color.red } = N)) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 2002, Problem 1\n\nLet S be a set with 2002 elements, and let N be an integer with\n\n 0 \u2264 N \u2264 2^2002.\n\nProve that it is possible to color every subset of S either blue or\nred so that the following conditions hold:\n\n a) the union of any two red subsets is red;\n b) the union of any two blue subsets is blue;\n c) there are exactly N red subsets.\n-/\ninductive Color : Type where\n| red : Color\n| blue : Color\nderiving DecidableEq, Fintype\n\ntheorem usa2002_p1\n {\u03b1 : Type} [DecidableEq \u03b1] [Fintype \u03b1] (hs : Fintype.card \u03b1 = 2002)\n (N : \u2115) (hN : N \u2264 2 ^ 2002) :\n \u2203 f : Finset \u03b1 \u2192 Color,\n ((\u2200 s1 s2 : Finset \u03b1, f s1 = f s2 \u2192 f (s1 \u222a s2) = f s1) \u2227\n (Fintype.card\n { a : Finset \u03b1 // f a = Color.red } = N)) := by sorry", "category": "combinatorics"} {"name": "Bulgaria1998P3", "solved": true, "tags": ["algebra"], "problem_id": "Bulgaria1998P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# Bulgarian Mathematical Olympiad 1998, Problem 3\n\nLet \u211d\u207a be the set of positive real numbers. Prove that there does not exist a function\nf: \u211d\u207a \u2192 \u211d\u207a such that\n\n (f(x))\u00b2 \u2265 f(x + y) * (f(x) + y)\n\nfor every x,y \u2208 \u211d\u207a.\n\n-/", "formal_statement": "theorem bulgaria1998_p3\n (f : \u211d \u2192 \u211d)\n (hpos : \u2200 x : \u211d, 0 < x \u2192 0 < f x)\n (hf : (\u2200 x y : \u211d, 0 < x \u2192 0 < y \u2192 (f (x + y)) * (f x + y) \u2264 (f x)^2)) :\n False := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# Bulgarian Mathematical Olympiad 1998, Problem 3\n\nLet \u211d\u207a be the set of positive real numbers. Prove that there does not exist a function\nf: \u211d\u207a \u2192 \u211d\u207a such that\n\n (f(x))\u00b2 \u2265 f(x + y) * (f(x) + y)\n\nfor every x,y \u2208 \u211d\u207a.\n\n-/\ntheorem bulgaria1998_p3\n (f : \u211d \u2192 \u211d)\n (hpos : \u2200 x : \u211d, 0 < x \u2192 0 < f x)\n (hf : (\u2200 x y : \u211d, 0 < x \u2192 0 < y \u2192 (f (x + y)) * (f x + y) \u2264 (f x)^2)) :\n False := by sorry", "category": "algebra"} {"name": "Imo2022P2", "solved": true, "tags": ["algebra"], "problem_id": "Imo2022P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2022, Problem 2\n\nLet \u211d+ be the set of positive real numbers.\nDetermine all functions f: \u211d+ \u2192 \u211d+ such that\nfor each x \u2208 \u211d+, there is exactly one y \u2208 \u211d+\nsatisfying\n\n x\u00b7f(y) + y\u00b7f(x) \u2264 2\n-/", "formal_statement": "abbrev PosReal : Type := { x : \u211d // 0 < x }\n\nnotation \"\u211d+\" => PosReal\n\nabbrev solution_set : Set (\u211d+ \u2192 \u211d+) := { fun x \u21a6 1 / x }\n\ntheorem imo2022_p2 (f : \u211d+ \u2192 \u211d+) :\n f \u2208 solution_set \u2194\n \u2200 x, \u2203! y, x * f y + y * f x \u2264 \u27e82, two_pos\u27e9 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2022, Problem 2\n\nLet \u211d+ be the set of positive real numbers.\nDetermine all functions f: \u211d+ \u2192 \u211d+ such that\nfor each x \u2208 \u211d+, there is exactly one y \u2208 \u211d+\nsatisfying\n\n x\u00b7f(y) + y\u00b7f(x) \u2264 2\n-/\nabbrev PosReal : Type := { x : \u211d // 0 < x }\n\nnotation \"\u211d+\" => PosReal\n\nabbrev solution_set : Set (\u211d+ \u2192 \u211d+) := { fun x \u21a6 1 / x }\n\ntheorem imo2022_p2 (f : \u211d+ \u2192 \u211d+) :\n f \u2208 solution_set \u2194\n \u2200 x, \u2203! y, x * f y + y * f x \u2264 \u27e82, two_pos\u27e9 := by sorry", "category": "algebra"} {"name": "Imo1971P3", "solved": false, "tags": ["number theory"], "problem_id": "Imo1971P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1971, Problem 3\n\nProve that we can find an infinite set of positive integers of the form 2^n - 3\n(where n is a positive integer) every pair of which are relatively prime.\n-/", "formal_statement": "theorem imo1971_p3 : Set.Infinite\n {(n, m) : \u2115 \u00d7 \u2115 | Nat.Coprime (2 ^ n - 3) (2 ^ m - 3)} := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1971, Problem 3\n\nProve that we can find an infinite set of positive integers of the form 2^n - 3\n(where n is a positive integer) every pair of which are relatively prime.\n-/\ntheorem imo1971_p3 : Set.Infinite\n {(n, m) : \u2115 \u00d7 \u2115 | Nat.Coprime (2 ^ n - 3) (2 ^ m - 3)} := by sorry", "category": "number theory"} {"name": "Imo2003P1", "solved": false, "tags": ["combinatorics"], "problem_id": "Imo2003P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2003, Problem 1\n\nLet A be a 101-element subset of S = {1,2,...10\u2076}. Prove that\nthere exist numbers t\u2081, t\u2082, ..., t\u2081\u2080\u2080 in S such that the sets\n\n A\u2c7c = {x + t\u2c7c | x \u2208 A}, j = 1,2, ..., 100\n\nare pairwise disjoint.\n-/", "formal_statement": "abbrev S : Finset \u2115 := Finset.Icc 1 (10^6)\n\ntheorem imo2003_p1 (A : Finset \u2115) (hA : A \u2286 S) :\n \u2203 t : Fin 100 \u2192 S,\n \u2200 i j, i \u2260 j \u2192 Disjoint {x + t i | x \u2208 A} {x + t j | x \u2208 A} := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2003, Problem 1\n\nLet A be a 101-element subset of S = {1,2,...10\u2076}. Prove that\nthere exist numbers t\u2081, t\u2082, ..., t\u2081\u2080\u2080 in S such that the sets\n\n A\u2c7c = {x + t\u2c7c | x \u2208 A}, j = 1,2, ..., 100\n\nare pairwise disjoint.\n-/\nabbrev S : Finset \u2115 := Finset.Icc 1 (10^6)\n\ntheorem imo2003_p1 (A : Finset \u2115) (hA : A \u2286 S) :\n \u2203 t : Fin 100 \u2192 S,\n \u2200 i j, i \u2260 j \u2192 Disjoint {x + t i | x \u2208 A} {x + t j | x \u2208 A} := by sorry", "category": "combinatorics"} {"name": "Canada1998P5", "solved": false, "tags": ["algebra"], "problem_id": "Canada1998P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\nCanadian Mathematical Olympiad 1998, Problem 5\n\nLet m be a positive integer. Define the sequence {a\u2099} by a\u2080 = 0,\na\u2081 = m, and a\u2099\u208a\u2081 = m\u00b2a\u2099 - a\u2099\u208b\u2081 for n \u2265 1. Prove that an ordered pair\n(a,b) of nonegative integers, with a \u2264 b, is a solution of the equation\n\n (a\u00b2 + b\u00b2) / (ab + 1) = m\u00b2\n\nif an only if (a,b) = (a\u2099,a\u2099\u208a\u2081) for some n \u2265 0.\n-/", "formal_statement": "def A (m : \u2115) (hm : 0 < m) : \u2115 \u2192 \u2124\n| 0 => 0\n| 1 => (\u2191m)\n| n + 2 => (m : \u2124)^2 * A m hm (n + 1) - A m hm n\n\ntheorem canada1998_p5 (m : \u2115) (hm : 0 < m) (a b : \u2115) (hab : a \u2264 b) :\n a^2 + b^2 = m^2 * (a * b + 1) \u2194\n \u2203 n : \u2115, (a:\u2124) = A m hm n \u2227 (b:\u2124) = A m hm (n + 1) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\nCanadian Mathematical Olympiad 1998, Problem 5\n\nLet m be a positive integer. Define the sequence {a\u2099} by a\u2080 = 0,\na\u2081 = m, and a\u2099\u208a\u2081 = m\u00b2a\u2099 - a\u2099\u208b\u2081 for n \u2265 1. Prove that an ordered pair\n(a,b) of nonegative integers, with a \u2264 b, is a solution of the equation\n\n (a\u00b2 + b\u00b2) / (ab + 1) = m\u00b2\n\nif an only if (a,b) = (a\u2099,a\u2099\u208a\u2081) for some n \u2265 0.\n-/\ndef A (m : \u2115) (hm : 0 < m) : \u2115 \u2192 \u2124\n| 0 => 0\n| 1 => (\u2191m)\n| n + 2 => (m : \u2124)^2 * A m hm (n + 1) - A m hm n\n\ntheorem canada1998_p5 (m : \u2115) (hm : 0 < m) (a b : \u2115) (hab : a \u2264 b) :\n a^2 + b^2 = m^2 * (a * b + 1) \u2194\n \u2203 n : \u2115, (a:\u2124) = A m hm n \u2227 (b:\u2124) = A m hm (n + 1) := by sorry", "category": "algebra"} {"name": "Imo2018P2", "solved": true, "tags": ["algebra"], "problem_id": "Imo2018P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2018, Problem 2\n\nDetermine all integers n \u2265 3 such that there exist real numbers\na\u2081, a\u2082, ..., a\u2099 satisfying\n\n a\u1d62a\u1d62\u208a\u2081 + 1 = a\u1d62\u208a\u2082,\n\nwhere the indices are taken mod n.\n-/", "formal_statement": "abbrev P {n : \u2115} (a : ZMod n \u2192 \u211d) :=\n \u2200 (i : ZMod n), a i * a (i + 1) + 1 = a (i + 2)\n\nabbrev solution_set : Set \u2115 := { n | 3 \u2264 n \u2227 3 \u2223 n }\n\ntheorem imo2018_p2 (n : \u2115) :\n n \u2208 solution_set \u2194 3 \u2264 n \u2227 \u2203 a : ZMod n \u2192 \u211d, P a := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2018, Problem 2\n\nDetermine all integers n \u2265 3 such that there exist real numbers\na\u2081, a\u2082, ..., a\u2099 satisfying\n\n a\u1d62a\u1d62\u208a\u2081 + 1 = a\u1d62\u208a\u2082,\n\nwhere the indices are taken mod n.\n-/\nabbrev P {n : \u2115} (a : ZMod n \u2192 \u211d) :=\n \u2200 (i : ZMod n), a i * a (i + 1) + 1 = a (i + 2)\n\nabbrev solution_set : Set \u2115 := { n | 3 \u2264 n \u2227 3 \u2223 n }\n\ntheorem imo2018_p2 (n : \u2115) :\n n \u2208 solution_set \u2194 3 \u2264 n \u2227 \u2203 a : ZMod n \u2192 \u211d, P a := by sorry", "category": "algebra"} {"name": "Imo2002P5", "solved": true, "tags": ["algebra"], "problem_id": "Imo2002P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2002, Problem 5\n\nDetermine all functions f : \u211d \u2192 \u211d such that\n\n (f(x) + f(z))(f(y) + f(t)) = f(xy - zt) + f(xt + yz)\n\nfor all real numbers x,y,z,t.\n-/", "formal_statement": "abbrev SolutionSet : Set (\u211d \u2192 \u211d) :=\n { fun x \u21a6 0, fun x \u21a6 1/2, fun x \u21a6 x^2 }\n\ntheorem imo2002_p5 (f : \u211d \u2192 \u211d) :\n f \u2208 SolutionSet \u2194\n \u2200 x y z t, (f x + f z) * (f y + f t) =\n f (x * y - z * t) + f (x * t + y * z) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2002, Problem 5\n\nDetermine all functions f : \u211d \u2192 \u211d such that\n\n (f(x) + f(z))(f(y) + f(t)) = f(xy - zt) + f(xt + yz)\n\nfor all real numbers x,y,z,t.\n-/\nabbrev SolutionSet : Set (\u211d \u2192 \u211d) :=\n { fun x \u21a6 0, fun x \u21a6 1/2, fun x \u21a6 x^2 }\n\ntheorem imo2002_p5 (f : \u211d \u2192 \u211d) :\n f \u2208 SolutionSet \u2194\n \u2200 x y z t, (f x + f z) * (f y + f t) =\n f (x * y - z * t) + f (x * t + y * z) := by sorry", "category": "algebra"} {"name": "Usa2001P4", "solved": true, "tags": ["geometry"], "problem_id": "Usa2001P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 2001, Problem 4\n\nLet ABC be a triangle and P be any point such that PA, PB, PC\nare the sides of an obtuse triangle, with PA the longest side.\nProve that \u2220BAC is acute.\n-/", "formal_statement": "/- special open -/ open EuclideanGeometry\n\n\n\n\n\n\ntheorem usa2001_p4\n (A B C P X Y Z : EuclideanSpace \u211d (Fin 2))\n (hABC : AffineIndependent \u211d ![A, B, C])\n (hXYZ : AffineIndependent \u211d ![X, Y, Z])\n (hPA : dist X Y = dist P A)\n (hPB : dist Y Z = dist P B)\n (hPC : dist Z X = dist P C)\n (hObtuse : Real.pi / 2 < \u2220 X Z Y)\n : \u2220 B A C < Real.pi / 2 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 2001, Problem 4\n\nLet ABC be a triangle and P be any point such that PA, PB, PC\nare the sides of an obtuse triangle, with PA the longest side.\nProve that \u2220BAC is acute.\n-/\n/- special open -/ open EuclideanGeometry\n\n\n\n\n\n\ntheorem usa2001_p4\n (A B C P X Y Z : EuclideanSpace \u211d (Fin 2))\n (hABC : AffineIndependent \u211d ![A, B, C])\n (hXYZ : AffineIndependent \u211d ![X, Y, Z])\n (hPA : dist X Y = dist P A)\n (hPB : dist Y Z = dist P B)\n (hPC : dist Z X = dist P C)\n (hObtuse : Real.pi / 2 < \u2220 X Z Y)\n : \u2220 B A C < Real.pi / 2 := by sorry", "category": "geometry"} {"name": "Imo2020P3", "solved": false, "tags": ["combinatorics"], "problem_id": "Imo2020P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2020, Problem 3\n\nThere are 4n pebbles of weights 1,2,3,...,4n. Each pebble is colored\nin one of n colors and there are four pebbles of each color. Show\nthat we can arrange the pebbles into two piles such that the total\nweights of both piles are the same, and each pile contains two\npebbles of each color.\n-/", "formal_statement": "/- special open -/ open Finset\n\n\n\n\n\n\ntheorem imo2020_p3 {n : \u2115} {c : Fin (4 * n) \u2192 Fin n} (h : \u2200 i, Finset.card (filter (\u03bb j => c j = i) univ) = 4) :\n \u2203 S : Finset (Fin (4 * n)), \u2211 i \u2208 S, ((i : \u2115) + 1) = \u2211 i \u2208 S\u1d9c, ((i : \u2115) + 1) \u2227\n \u2200 i, Finset.card (filter (\u03bb j => c j = i) S) = 2 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2020, Problem 3\n\nThere are 4n pebbles of weights 1,2,3,...,4n. Each pebble is colored\nin one of n colors and there are four pebbles of each color. Show\nthat we can arrange the pebbles into two piles such that the total\nweights of both piles are the same, and each pile contains two\npebbles of each color.\n-/\n/- special open -/ open Finset\n\n\n\n\n\n\ntheorem imo2020_p3 {n : \u2115} {c : Fin (4 * n) \u2192 Fin n} (h : \u2200 i, Finset.card (filter (\u03bb j => c j = i) univ) = 4) :\n \u2203 S : Finset (Fin (4 * n)), \u2211 i \u2208 S, ((i : \u2115) + 1) = \u2211 i \u2208 S\u1d9c, ((i : \u2115) + 1) \u2227\n \u2200 i, Finset.card (filter (\u03bb j => c j = i) S) = 2 := by sorry", "category": "combinatorics"} {"name": "Usa2023P2", "solved": true, "tags": ["algebra"], "problem_id": "Usa2023P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 2023, Problem 2\n\nLet \u211d+ be the set of positive real numbers.\nFind all functions f: \u211d+ \u2192 \u211d+ that satisfy the equation\n\n f(x\u2b1dy + f(x)) = x\u2b1df(y) + 2\n\nfor all x,y \u2208 \u211d+.\n-/", "formal_statement": "abbrev PosReal : Type := { x : \u211d // 0 < x }\n\nnotation \"\u211d+\" => PosReal\n\nabbrev solution_set : Set (\u211d+ \u2192 \u211d+) := { fun x \u21a6 x + 1 }\n\ntheorem usa2023_p2 (f : \u211d+ \u2192 \u211d+) :\n f \u2208 solution_set \u2194\n \u2200 x y, f (x * y + (f x)) = x * (f y) + \u27e82, two_pos\u27e9 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 2023, Problem 2\n\nLet \u211d+ be the set of positive real numbers.\nFind all functions f: \u211d+ \u2192 \u211d+ that satisfy the equation\n\n f(x\u2b1dy + f(x)) = x\u2b1df(y) + 2\n\nfor all x,y \u2208 \u211d+.\n-/\nabbrev PosReal : Type := { x : \u211d // 0 < x }\n\nnotation \"\u211d+\" => PosReal\n\nabbrev solution_set : Set (\u211d+ \u2192 \u211d+) := { fun x \u21a6 x + 1 }\n\ntheorem usa2023_p2 (f : \u211d+ \u2192 \u211d+) :\n f \u2208 solution_set \u2194\n \u2200 x y, f (x * y + (f x)) = x * (f y) + \u27e82, two_pos\u27e9 := by sorry", "category": "algebra"} {"name": "Imo2015P6", "solved": true, "tags": ["algebra"], "problem_id": "Imo2015P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2015, Problem 6\nThe sequence $a_1, a_2, \\dots$ of integers satisfies the conditions\n1. $1 \u2264 a_j \u2264 2015$ for all $j \u2265 1$,\n2. $k + a_k \u2260 l + a_l$ for all $1 \u2264 k < l$.\nProve that there exist two positive integers $b$ and $N$ for which\n$$\\left|\\sum_{j=m+1}^n (a_j-b)\\right| \u2264 1007^2$$\nfor all integers $m,n$ such that $N \u2264 m < n$.\n-/", "formal_statement": "/-- The conditions on `a` in the problem. We reindex `a` to start from 0 rather than 1;\n`N` then only has to be nonnegative rather than positive, and the sum in the problem statement\nis over `Ico m n` rather than `Ioc m n`. -/\ndef Condition (a : \u2115 \u2192 \u2124) : Prop :=\n (\u2200 i, a i \u2208 Finset.Icc 1 2015) \u2227 Function.Injective fun i \u21a6 i + a i\n\n\ntheorem imo2015_p6 (ha : Condition a) :\n \u2203 b > 0, \u2203 N, \u2200 m \u2265 N, \u2200 n > m, |\u2211 j \u2208 Finset.Ico m n, (a j - b)| \u2264 1007 ^ 2 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2015, Problem 6\nThe sequence $a_1, a_2, \\dots$ of integers satisfies the conditions\n1. $1 \u2264 a_j \u2264 2015$ for all $j \u2265 1$,\n2. $k + a_k \u2260 l + a_l$ for all $1 \u2264 k < l$.\nProve that there exist two positive integers $b$ and $N$ for which\n$$\\left|\\sum_{j=m+1}^n (a_j-b)\\right| \u2264 1007^2$$\nfor all integers $m,n$ such that $N \u2264 m < n$.\n-/\n/-- The conditions on `a` in the problem. We reindex `a` to start from 0 rather than 1;\n`N` then only has to be nonnegative rather than positive, and the sum in the problem statement\nis over `Ico m n` rather than `Ioc m n`. -/\ndef Condition (a : \u2115 \u2192 \u2124) : Prop :=\n (\u2200 i, a i \u2208 Finset.Icc 1 2015) \u2227 Function.Injective fun i \u21a6 i + a i\n\n\ntheorem imo2015_p6 (ha : Condition a) :\n \u2203 b > 0, \u2203 N, \u2200 m \u2265 N, \u2200 n > m, |\u2211 j \u2208 Finset.Ico m n, (a j - b)| \u2264 1007 ^ 2 := by sorry", "category": "algebra"} {"name": "Imo1985P6", "solved": true, "tags": ["algebra"], "problem_id": "Imo1985P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1985, Problem 6\n\nFor every real number x_1, construct the sequence {x_1,x_2, ...}\nby setting x_{n+1} = x_n * (x_n + 1 / n) for each n >= 1.\n\n\nProve that there exists exactly one value of x_1 for which\n0 < x_n , x_n < x_{n+1}, and x_{n+1} < 1 for every n.\n-/", "formal_statement": "theorem imo_1985_p6\n (f : \u2115 \u2192 \u211d \u2192 \u211d)\n (h\u2080 : \u2200 x, f 1 x = x)\n (h\u2081 : \u2200 n x, 0 < n \u2192 f (n + 1) x = f n x * (f n x + 1 / n)) :\n \u2203! a, \u2200 n, 0 < n \u2192 0 < f n a \u2227 f n a < f (n + 1) a \u2227 f (n + 1) a < 1 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1985, Problem 6\n\nFor every real number x_1, construct the sequence {x_1,x_2, ...}\nby setting x_{n+1} = x_n * (x_n + 1 / n) for each n >= 1.\n\n\nProve that there exists exactly one value of x_1 for which\n0 < x_n , x_n < x_{n+1}, and x_{n+1} < 1 for every n.\n-/\ntheorem imo_1985_p6\n (f : \u2115 \u2192 \u211d \u2192 \u211d)\n (h\u2080 : \u2200 x, f 1 x = x)\n (h\u2081 : \u2200 n x, 0 < n \u2192 f (n + 1) x = f n x * (f n x + 1 / n)) :\n \u2203! a, \u2200 n, 0 < n \u2192 0 < f n a \u2227 f n a < f (n + 1) a \u2227 f (n + 1) a < 1 := by sorry", "category": "algebra"} {"name": "Imo1959P2b", "problem_id": "Imo1959P2b", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1959, Problem 2\n\nFor what real values of x is\n\n \u221a(x+\u221a(2x-1)) + \u221a(x-\u221a(2x-1)) = A,\n\ngiven:\n (a) A = \u221a2\n (b) A = 1\n (c) A = 2,\nwhere only non-negative real numbers are admitted for square roots?\n-/", "formal_statement": "/- special open -/ open Set\n\n\n\n\n\n\ndef IsGood (x A : \u211d) : Prop :=\n sqrt (x + sqrt (2 * x - 1)) + sqrt (x - sqrt (2 * x - 1)) = A \u2227 0 \u2264 2 * x - 1 \u2227\n 0 \u2264 x + sqrt (2 * x - 1) \u2227 0 \u2264 x - sqrt (2 * x - 1)\n\nvariable {x A : \u211d}\n\nabbrev solution_set_one : Set \u211d := \u2205\n\ntheorem imo1959_p2b : IsGood x 1 \u2194 x \u2208 solution_set_one := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1959, Problem 2\n\nFor what real values of x is\n\n \u221a(x+\u221a(2x-1)) + \u221a(x-\u221a(2x-1)) = A,\n\ngiven:\n (a) A = \u221a2\n (b) A = 1\n (c) A = 2,\nwhere only non-negative real numbers are admitted for square roots?\n-/\n/- special open -/ open Set\n\n\n\n\n\n\ndef IsGood (x A : \u211d) : Prop :=\n sqrt (x + sqrt (2 * x - 1)) + sqrt (x - sqrt (2 * x - 1)) = A \u2227 0 \u2264 2 * x - 1 \u2227\n 0 \u2264 x + sqrt (2 * x - 1) \u2227 0 \u2264 x - sqrt (2 * x - 1)\n\nvariable {x A : \u211d}\n\nabbrev solution_set_one : Set \u211d := \u2205\n\ntheorem imo1959_p2b : IsGood x 1 \u2194 x \u2208 solution_set_one := by sorry", "tags": ["algebra"], "solved": true, "category": "algebra"} {"name": "Imo1968P5a", "problem_id": "Imo1968P5a", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1968, Problem 5\n\nLet f be a real-valued function defined for all real numbers x such that,\nfor some positive constant a, the equation\n\n f(x + a) = a/2 + \u221a(f(x) - (f(x))\u00b2)\n\nholds for all x.\n\n(a) Prove that the function f is periodic.\n-/", "formal_statement": "abbrev P (a : \u211d) (f : \u211d \u2192 \u211d) : Prop :=\n 0 < a \u2227\n \u2200 x, (f x)^2 \u2264 f x \u2227 f (x + a) = 1/2 + \u221a(f x - (f x)^2)\n\ntheorem imo1968_p5a (f : \u211d \u2192 \u211d) (a : \u211d) (hf : P a f) :\n \u2203 b, 0 < b \u2227 f.Periodic b := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1968, Problem 5\n\nLet f be a real-valued function defined for all real numbers x such that,\nfor some positive constant a, the equation\n\n f(x + a) = a/2 + \u221a(f(x) - (f(x))\u00b2)\n\nholds for all x.\n\n(a) Prove that the function f is periodic.\n-/\nabbrev P (a : \u211d) (f : \u211d \u2192 \u211d) : Prop :=\n 0 < a \u2227\n \u2200 x, (f x)^2 \u2264 f x \u2227 f (x + a) = 1/2 + \u221a(f x - (f x)^2)\n\ntheorem imo1968_p5a (f : \u211d \u2192 \u211d) (a : \u211d) (hf : P a f) :\n \u2203 b, 0 < b \u2227 f.Periodic b := by sorry", "tags": ["algebra"], "solved": true, "category": "algebra"} {"name": "Imo1984P2", "solved": true, "tags": ["number theory"], "problem_id": "Imo1984P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1984, Problem 2\n\nFind a pair of positive integers a and b such that\n\n (i) ab(a + b) is not divisible by 7.\n (ii) (a + b)\u2077 - a\u2077 - b\u2077 is divisible by 7\u2077.\n-/", "formal_statement": "abbrev a : \u2124 := 18\nabbrev b : \u2124 := 1\n\ntheorem imo1984_p2 :\n (0 < a) \u2227 (0 < b) \u2227\n (\u00ac 7 \u2223 a * b * (a + b)) \u2227\n 7^7 \u2223 (a + b)^7 - a^7 - b^7 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1984, Problem 2\n\nFind a pair of positive integers a and b such that\n\n (i) ab(a + b) is not divisible by 7.\n (ii) (a + b)\u2077 - a\u2077 - b\u2077 is divisible by 7\u2077.\n-/\nabbrev a : \u2124 := 18\nabbrev b : \u2124 := 1\n\ntheorem imo1984_p2 :\n (0 < a) \u2227 (0 < b) \u2227\n (\u00ac 7 \u2223 a * b * (a + b)) \u2227\n 7^7 \u2223 (a + b)^7 - a^7 - b^7 := by sorry", "category": "number theory"} {"name": "Bulgaria1998P8", "solved": true, "tags": ["algebra"], "problem_id": "Bulgaria1998P8", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# Bulgarian Mathematical Olympiad 1998, Problem 8\nThe polynomials P\u2099(x,y) for n = 1, 2, ... are defined by P\u2081(x,y) = 1 and\n P\u2099\u208a\u2081(x,y) = (x + y - 1)(y + 1)P\u2099(x,y+2) + (y - y\u00b2)P\u2099(x,y)\nProve that P\u2099(x,y) = P\u2099(y,x) for all x,y,n.\n-/", "formal_statement": "variable {R : Type} [CommRing R]\n\ndef P : \u2115 \u2192 R \u2192 R \u2192 R\n| 0, _, _ => 1\n| n+1, x, y => (x + y - 1) * (y + 1) * P n x (y + 2) + (y - y^2) * P n x y\n\ntheorem bulgaria1998_p8 (n : \u2115) (x y : R) : P n x y = P n y x := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# Bulgarian Mathematical Olympiad 1998, Problem 8\nThe polynomials P\u2099(x,y) for n = 1, 2, ... are defined by P\u2081(x,y) = 1 and\n P\u2099\u208a\u2081(x,y) = (x + y - 1)(y + 1)P\u2099(x,y+2) + (y - y\u00b2)P\u2099(x,y)\nProve that P\u2099(x,y) = P\u2099(y,x) for all x,y,n.\n-/\nvariable {R : Type} [CommRing R]\n\ndef P : \u2115 \u2192 R \u2192 R \u2192 R\n| 0, _, _ => 1\n| n+1, x, y => (x + y - 1) * (y + 1) * P n x (y + 2) + (y - y^2) * P n x y\n\ntheorem bulgaria1998_p8 (n : \u2115) (x y : R) : P n x y = P n y x := by sorry", "category": "algebra"} {"name": "Imo1998P3", "solved": false, "tags": ["number theory"], "problem_id": "Imo1998P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1998, Problem 3\n\nFor any positive integer $n$,\nlet $d(n)$ denote the number of positive divisors of $n$ (including 1 and $n$ itself).\nDetermine all positive integers $k$ such that $d(n^2)/d(n) = k$ for some $n$.\n-/", "formal_statement": "abbrev solution_set : Set \u2115 := {x | \u2203 k : \u2115 , x = 2 * k + 1}\n\ntheorem imo1998_p3 (k : \u2115) :\n k \u2208 solution_set \u2194\n \u2203 n : \u2115,\n (Finset.card (Nat.divisors (n ^ 2))) = k * Finset.card (Nat.divisors n) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1998, Problem 3\n\nFor any positive integer $n$,\nlet $d(n)$ denote the number of positive divisors of $n$ (including 1 and $n$ itself).\nDetermine all positive integers $k$ such that $d(n^2)/d(n) = k$ for some $n$.\n-/\nabbrev solution_set : Set \u2115 := {x | \u2203 k : \u2115 , x = 2 * k + 1}\n\ntheorem imo1998_p3 (k : \u2115) :\n k \u2208 solution_set \u2194\n \u2203 n : \u2115,\n (Finset.card (Nat.divisors (n ^ 2))) = k * Finset.card (Nat.divisors n) := by sorry", "category": "number theory"} {"name": "Usa1992P1", "solved": true, "tags": ["algebra"], "problem_id": "Usa1992P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 1992, Problem 1\n\nFind, as a function of n, the sum of the digits of\n\n 9 \u00d7 99 \u00d7 9999 \u00d7 ... \u00d7 (10^2\u207f - 1),\n\nwhere each factor has twice as many digits as the last one.\n-/", "formal_statement": "abbrev solution : \u2115 \u2192 \u2115 := fun n \u21a6 9 * 2 ^ n\n\ntheorem usa1992_p1 (n : \u2115) :\n (Nat.digits 10\n (\u220f i \u2208 Finset.range (n + 1), (10^(2^i) - 1))).sum = solution n := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 1992, Problem 1\n\nFind, as a function of n, the sum of the digits of\n\n 9 \u00d7 99 \u00d7 9999 \u00d7 ... \u00d7 (10^2\u207f - 1),\n\nwhere each factor has twice as many digits as the last one.\n-/\nabbrev solution : \u2115 \u2192 \u2115 := fun n \u21a6 9 * 2 ^ n\n\ntheorem usa1992_p1 (n : \u2115) :\n (Nat.digits 10\n (\u220f i \u2208 Finset.range (n + 1), (10^(2^i) - 1))).sum = solution n := by sorry", "category": "algebra"} {"name": "Imo1982P4", "solved": false, "tags": ["number theory"], "problem_id": "Imo1982P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1982, Problem 4\n\nProve that if n is a positive integer such that the equation\n\nx3 - 3xy^2 + y^3 = n\n\nhas a solution in integers x, y, then it has at least three such solutions.\nShow that the equation has no solutions in integers for n = 2891.\n-/", "formal_statement": "theorem imo1982_p4 (n : \u2115)\n (hn : 0 < n)\n (hxy : \u2203 x y : \u2124, x^3 - 3 * x * y^2 + y^3 = n) :\n (n \u2260 2891) \u2227\n \u2203 x1 x2 x3 y1 y2 y3 : \u2124, (x1^3 - 3 * x1 * y1^2 + y1^3 = n \u2227\n x2^3 - 3 * x2 * y2^2 + y2^3 = n \u2227\n x3^3 - 3 * x3 * y3^2 + y3^3 = n \u2227\n (x1 \u2260 x2 \u2228 y1 \u2260 y2) \u2227\n (x1 \u2260 x3 \u2228 y1 \u2260 y3) \u2227\n (x2 \u2260 x3 \u2228 y2 \u2260 y3)) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1982, Problem 4\n\nProve that if n is a positive integer such that the equation\n\nx3 - 3xy^2 + y^3 = n\n\nhas a solution in integers x, y, then it has at least three such solutions.\nShow that the equation has no solutions in integers for n = 2891.\n-/\ntheorem imo1982_p4 (n : \u2115)\n (hn : 0 < n)\n (hxy : \u2203 x y : \u2124, x^3 - 3 * x * y^2 + y^3 = n) :\n (n \u2260 2891) \u2227\n \u2203 x1 x2 x3 y1 y2 y3 : \u2124, (x1^3 - 3 * x1 * y1^2 + y1^3 = n \u2227\n x2^3 - 3 * x2 * y2^2 + y2^3 = n \u2227\n x3^3 - 3 * x3 * y3^2 + y3^3 = n \u2227\n (x1 \u2260 x2 \u2228 y1 \u2260 y2) \u2227\n (x1 \u2260 x3 \u2228 y1 \u2260 y3) \u2227\n (x2 \u2260 x3 \u2228 y2 \u2260 y3)) := by sorry", "category": "number theory"} {"name": "Usa1981P5", "solved": true, "tags": ["algebra"], "problem_id": "Usa1981P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 1981, Problem 5\n\nShow that for any positive real number x and any nonnegative\ninteger n,\n\n \u2211\u2096 (\u230akx\u230b/k) \u2264 \u230anx\u230b\n\nwhere the sum goes from k = 1 to k = n, inclusive.\n-/", "formal_statement": "theorem usa1981_p5 (x : \u211d) (n : \u2115) :\n \u2211 k \u2208 Finset.Icc 1 n, ((\u230ak * x\u230b:\u211d)/k) \u2264 \u230an * x\u230b := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 1981, Problem 5\n\nShow that for any positive real number x and any nonnegative\ninteger n,\n\n \u2211\u2096 (\u230akx\u230b/k) \u2264 \u230anx\u230b\n\nwhere the sum goes from k = 1 to k = n, inclusive.\n-/\ntheorem usa1981_p5 (x : \u211d) (n : \u2115) :\n \u2211 k \u2208 Finset.Icc 1 n, ((\u230ak * x\u230b:\u211d)/k) \u2264 \u230an * x\u230b := by sorry", "category": "algebra"} {"name": "Imo2006P5", "solved": true, "tags": ["number theory"], "problem_id": "Imo2006P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2006, Problem 5\n\nLet $P(x)$ be a polynomial of degree $n>1$ with integer coefficients, and let $k$ be a positive\ninteger. Consider the polynomial $Q(x) = P(P(\\ldots P(P(x))\\ldots))$, where $P$ occurs $k$ times.\nProve that there are at most $n$ integers $t$ such that $Q(t)=t$.\n-/", "formal_statement": "/- special open -/ open Function Polynomial\n\n\n\n\n\n\ntheorem imo2006_p5 {P : Polynomial \u2124} (hP : 1 < P.natDegree) {k : \u2115} (hk : 0 < k) :\n (P.comp^[k] X - X).roots.toFinset.card \u2264 P.natDegree := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2006, Problem 5\n\nLet $P(x)$ be a polynomial of degree $n>1$ with integer coefficients, and let $k$ be a positive\ninteger. Consider the polynomial $Q(x) = P(P(\\ldots P(P(x))\\ldots))$, where $P$ occurs $k$ times.\nProve that there are at most $n$ integers $t$ such that $Q(t)=t$.\n-/\n/- special open -/ open Function Polynomial\n\n\n\n\n\n\ntheorem imo2006_p5 {P : Polynomial \u2124} (hP : 1 < P.natDegree) {k : \u2115} (hk : 0 < k) :\n (P.comp^[k] X - X).roots.toFinset.card \u2264 P.natDegree := by sorry", "category": "number theory"} {"name": "Imo1969P2", "solved": true, "tags": ["algebra"], "problem_id": "Imo1969P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1969, Problem 2\n\nLet a\u2081, a\u2082, ..., a\u2099 be real constants, x be a real variable, and\n\n f(x) = cos(a\u2081 + x) + (1/2)cos(a\u2082 + x) + (1/4)cos(a\u2083 + x) + ...\n + (1/2\u207f\u207b\u00b9)cos(a\u2099 + x).\n\nGiven that f(x\u2081) = f(x\u2082) = 0 for some x\u2081, x\u2082, prove that\nx\u2082 - x\u2081 = m\u03c0 for some integer m.\n-/", "formal_statement": "theorem imo1969_p2\n (x\u2081 x\u2082 : \u211d)\n (n : \u2115)\n (a : \u2115 \u2192 \u211d)\n (f : \u211d \u2192 \u211d)\n (h\u2081 : \u2200 x, f x = \u2211 i \u2208 Finset.range n, (Real.cos (a i + x)) / (2^i))\n (h\u2082 : f x\u2082 = 0)\n (h\u2083 : f x\u2081 = 0)\n (h\u2084: \u2211 i \u2208 Finset.range n, (Real.cos (a i) / (2 ^ i)) \u2260 0) :\n \u2203 m : \u2124, x\u2082 - x\u2081 = m * Real.pi := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1969, Problem 2\n\nLet a\u2081, a\u2082, ..., a\u2099 be real constants, x be a real variable, and\n\n f(x) = cos(a\u2081 + x) + (1/2)cos(a\u2082 + x) + (1/4)cos(a\u2083 + x) + ...\n + (1/2\u207f\u207b\u00b9)cos(a\u2099 + x).\n\nGiven that f(x\u2081) = f(x\u2082) = 0 for some x\u2081, x\u2082, prove that\nx\u2082 - x\u2081 = m\u03c0 for some integer m.\n-/\ntheorem imo1969_p2\n (x\u2081 x\u2082 : \u211d)\n (n : \u2115)\n (a : \u2115 \u2192 \u211d)\n (f : \u211d \u2192 \u211d)\n (h\u2081 : \u2200 x, f x = \u2211 i \u2208 Finset.range n, (Real.cos (a i + x)) / (2^i))\n (h\u2082 : f x\u2082 = 0)\n (h\u2083 : f x\u2081 = 0)\n (h\u2084: \u2211 i \u2208 Finset.range n, (Real.cos (a i) / (2 ^ i)) \u2260 0) :\n \u2203 m : \u2124, x\u2082 - x\u2081 = m * Real.pi := by sorry", "category": "algebra"} {"name": "Imo1960P1", "solved": true, "tags": ["number theory"], "problem_id": "Imo1960P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1960, Problem 1\n\nDetermine all three-digit numbers N having the property that N is divisible by 11, and\nN/11 is equal to the sum of the squares of the digits of N.\n-/", "formal_statement": "def sumOfSquares (L : List \u2115) : \u2115 :=\n (L.map fun x => x * x).sum\n\ndef ProblemPredicate (n : \u2115) : Prop :=\n (Nat.digits 10 n).length = 3 \u2227 11 \u2223 n \u2227 n / 11 = sumOfSquares (Nat.digits 10 n)\n\nabbrev SolutionPredicate (n : \u2115) : Prop :=\n n = 550 \u2228 n = 803\n \ntheorem imo1960_p1 (n : \u2115) : ProblemPredicate n \u2194 SolutionPredicate n := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1960, Problem 1\n\nDetermine all three-digit numbers N having the property that N is divisible by 11, and\nN/11 is equal to the sum of the squares of the digits of N.\n-/\ndef sumOfSquares (L : List \u2115) : \u2115 :=\n (L.map fun x => x * x).sum\n\ndef ProblemPredicate (n : \u2115) : Prop :=\n (Nat.digits 10 n).length = 3 \u2227 11 \u2223 n \u2227 n / 11 = sumOfSquares (Nat.digits 10 n)\n\nabbrev SolutionPredicate (n : \u2115) : Prop :=\n n = 550 \u2228 n = 803\n \ntheorem imo1960_p1 (n : \u2115) : ProblemPredicate n \u2194 SolutionPredicate n := by sorry", "category": "number theory"} {"name": "Usa2023P5", "solved": false, "tags": ["combinatorics"], "problem_id": "Usa2023P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 2023, Problem 5\n\nLet n be an integer greater than 2. We will be arranging the numbers\n1, 2, ... n\u00b2 into an n \u00d7 n grid. Such an arrangement is called *row-valid*\nif the numbers in each row can be permuted to make an arithmetic progression.\nSimilarly, such an arrangement is called *column-valid* if the numbers\nin each column can be permuted to make an arithmetic progression.\n\nDetermine the values of n for which it possible to transform\nany row-valid arrangement into a column-valid arrangement by permuting\nthe numbers in each row.\n\n-/", "formal_statement": "def PermutedArithSeq {n : \u2115} (hn : 0 < n) (a : Fin n \u21aa Fin (n^2)) : Prop :=\n \u2203 p : Fin n \u2192 Fin n, p.Bijective \u2227\n \u2203 k : \u2115, \u2200 m : Fin n, (a (p m)).val = a (p \u27e80, hn\u27e9) + m.val * k\n\ndef row_valid {n : \u2115} (hn : 0 < n) (a : Fin n \u2192 Fin n \u2192 Fin (n^2)) (ha : a.Injective2) : Prop :=\n \u2200 r : Fin n, PermutedArithSeq hn \u27e8(a r \u00b7), Function.Injective2.right ha r\u27e9\n\ndef col_valid {n : \u2115} (hn : 0 < n) (a : Fin n \u2192 Fin n \u2192 Fin (n^2)) (ha : a.Injective2) : Prop :=\n \u2200 c : Fin n, PermutedArithSeq hn \u27e8(a \u00b7 c), Function.Injective2.left ha c\u27e9\n\nlemma injective_of_permuted_rows {\u03b1 \u03b2 \u03b3 : Type}\n {f : \u03b1 \u2192 \u03b2 \u2192 \u03b3} (hf : f.Injective2) {p : \u03b1 \u2192 \u03b2 \u2192 \u03b2} (hp : \u2200 a, (p a).Injective) :\n Function.Injective2 (fun r c \u21a6 f r (p r c)) := by\n intro a1 a2 b1 b2 hab\n obtain \u27e8ha1, hp1\u27e9 := hf hab\n rw [ha1] at *\n rw [hp a2 hp1]\n simp only [and_self]\n\nabbrev solution_set : Set \u2115 := { n | n.Prime }\n\ntheorem usa2023_p5 (n : \u2115) (hn : 2 < n) :\n n \u2208 solution_set \u2194\n (\u2200 a : (Fin n \u2192 Fin n \u2192 Fin (n^2)),\n (ha : a.Injective2) \u2192 row_valid (Nat.zero_lt_of_lt hn) a ha \u2192\n \u2203 p : Fin n \u2192 Fin n \u2192 Fin n, \u2203 hp : (\u2200 r, (p r).Injective),\n col_valid (Nat.zero_lt_of_lt hn) (fun r c \u21a6 a r (p r c))\n (injective_of_permuted_rows ha hp)) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 2023, Problem 5\n\nLet n be an integer greater than 2. We will be arranging the numbers\n1, 2, ... n\u00b2 into an n \u00d7 n grid. Such an arrangement is called *row-valid*\nif the numbers in each row can be permuted to make an arithmetic progression.\nSimilarly, such an arrangement is called *column-valid* if the numbers\nin each column can be permuted to make an arithmetic progression.\n\nDetermine the values of n for which it possible to transform\nany row-valid arrangement into a column-valid arrangement by permuting\nthe numbers in each row.\n\n-/\ndef PermutedArithSeq {n : \u2115} (hn : 0 < n) (a : Fin n \u21aa Fin (n^2)) : Prop :=\n \u2203 p : Fin n \u2192 Fin n, p.Bijective \u2227\n \u2203 k : \u2115, \u2200 m : Fin n, (a (p m)).val = a (p \u27e80, hn\u27e9) + m.val * k\n\ndef row_valid {n : \u2115} (hn : 0 < n) (a : Fin n \u2192 Fin n \u2192 Fin (n^2)) (ha : a.Injective2) : Prop :=\n \u2200 r : Fin n, PermutedArithSeq hn \u27e8(a r \u00b7), Function.Injective2.right ha r\u27e9\n\ndef col_valid {n : \u2115} (hn : 0 < n) (a : Fin n \u2192 Fin n \u2192 Fin (n^2)) (ha : a.Injective2) : Prop :=\n \u2200 c : Fin n, PermutedArithSeq hn \u27e8(a \u00b7 c), Function.Injective2.left ha c\u27e9\n\nlemma injective_of_permuted_rows {\u03b1 \u03b2 \u03b3 : Type}\n {f : \u03b1 \u2192 \u03b2 \u2192 \u03b3} (hf : f.Injective2) {p : \u03b1 \u2192 \u03b2 \u2192 \u03b2} (hp : \u2200 a, (p a).Injective) :\n Function.Injective2 (fun r c \u21a6 f r (p r c)) := by\n intro a1 a2 b1 b2 hab\n obtain \u27e8ha1, hp1\u27e9 := hf hab\n rw [ha1] at *\n rw [hp a2 hp1]\n simp only [and_self]\n\nabbrev solution_set : Set \u2115 := { n | n.Prime }\n\ntheorem usa2023_p5 (n : \u2115) (hn : 2 < n) :\n n \u2208 solution_set \u2194\n (\u2200 a : (Fin n \u2192 Fin n \u2192 Fin (n^2)),\n (ha : a.Injective2) \u2192 row_valid (Nat.zero_lt_of_lt hn) a ha \u2192\n \u2203 p : Fin n \u2192 Fin n \u2192 Fin n, \u2203 hp : (\u2200 r, (p r).Injective),\n col_valid (Nat.zero_lt_of_lt hn) (fun r c \u21a6 a r (p r c))\n (injective_of_permuted_rows ha hp)) := by sorry", "category": "combinatorics"} {"name": "Imo1973P5", "solved": false, "tags": ["algebra"], "problem_id": "Imo1973P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1973, Problem 5\n\n$G$ is a set of non-constant functions of the real variable $x$ of the form\n\\[f(x) = ax + b, a \\text{ and } b \\text{ are real numbers,}\\] and $G$ has the following properties:\n(a) If $f$ and $g$ are in $G$, then $g \\circ f$ is in $G$; here $(g \\circ f)(x) = g[f(x)]$.\n(b) If $f$ is in $G$, then its inverse $f^{-1}$ is in $G$;\n here the inverse of $f(x) = ax + b$ is $f^{-1}(x) = (x - b) / a$.\n(c) For every $f$ in $G$, there exists a real number $x_f$ such that $f(x_f) = x_f$.\nProve that there exists a real number $k$ such that $f(k) = k$ for all $f$ in $G$.\n-/", "formal_statement": "theorem imo1973_p5 {G : Set (\u211d \u2192 \u211d)}\n (hf: \u2200 f \u2208 G, \u2203 a b : \u211d, a \u2260 0 \u2227 \u2200 x : \u211d, f x = a * x + b)\n (hG : \u2200 f \u2208 G, \u2200 g \u2208 G, g \u2218 f \u2208 G)\n (hinv : \u2200 f \u2208 G, (\u2200 x, f x \u2260 0) \u2192 f\u207b\u00b9 \u2208 G)\n (hfix : \u2200 f \u2208 G, \u2203 x, f x = x) :\n \u2203 k : \u211d, \u2200 f \u2208 G, f k = k := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1973, Problem 5\n\n$G$ is a set of non-constant functions of the real variable $x$ of the form\n\\[f(x) = ax + b, a \\text{ and } b \\text{ are real numbers,}\\] and $G$ has the following properties:\n(a) If $f$ and $g$ are in $G$, then $g \\circ f$ is in $G$; here $(g \\circ f)(x) = g[f(x)]$.\n(b) If $f$ is in $G$, then its inverse $f^{-1}$ is in $G$;\n here the inverse of $f(x) = ax + b$ is $f^{-1}(x) = (x - b) / a$.\n(c) For every $f$ in $G$, there exists a real number $x_f$ such that $f(x_f) = x_f$.\nProve that there exists a real number $k$ such that $f(k) = k$ for all $f$ in $G$.\n-/\ntheorem imo1973_p5 {G : Set (\u211d \u2192 \u211d)}\n (hf: \u2200 f \u2208 G, \u2203 a b : \u211d, a \u2260 0 \u2227 \u2200 x : \u211d, f x = a * x + b)\n (hG : \u2200 f \u2208 G, \u2200 g \u2208 G, g \u2218 f \u2208 G)\n (hinv : \u2200 f \u2208 G, (\u2200 x, f x \u2260 0) \u2192 f\u207b\u00b9 \u2208 G)\n (hfix : \u2200 f \u2208 G, \u2203 x, f x = x) :\n \u2203 k : \u211d, \u2200 f \u2208 G, f k = k := by sorry", "category": "algebra"} {"name": "Imo2018P5", "solved": false, "tags": ["number theory"], "problem_id": "Imo2018P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2018, Problem 5\n\nLet a\u2081, a\u2082, ... be an infinite sequence of positive integers.\nSuppose that there is an integer N > 1 such that for each n \u2265 N\nthe number\n\n a\u2081/a\u2082 + a\u2082/a\u2083 ... + a\u2099\u208b\u2081/a\u2099 + a\u2099/a\u2081\n\nis an integer. Prove that there is a positive integer M such that\na\u2098 = a\u2098\u208a\u2081 for all m \u2265 M.\n-/", "formal_statement": "theorem imo2018_p5\n (a : \u2115 \u2192 \u2124)\n (apos : \u2200 n, 0 < a n)\n (N : \u2115)\n (hN : 0 < N)\n (h : \u2200 n, N \u2264 n \u2192\n \u2203 z : \u2124,\n z = \u2211 i \u2208 Finset.range n, (a i : \u211a) / a ((i + 1) % n))\n : \u2203 M, \u2200 m, M \u2264 m \u2192 a m = a (m + 1) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2018, Problem 5\n\nLet a\u2081, a\u2082, ... be an infinite sequence of positive integers.\nSuppose that there is an integer N > 1 such that for each n \u2265 N\nthe number\n\n a\u2081/a\u2082 + a\u2082/a\u2083 ... + a\u2099\u208b\u2081/a\u2099 + a\u2099/a\u2081\n\nis an integer. Prove that there is a positive integer M such that\na\u2098 = a\u2098\u208a\u2081 for all m \u2265 M.\n-/\ntheorem imo2018_p5\n (a : \u2115 \u2192 \u2124)\n (apos : \u2200 n, 0 < a n)\n (N : \u2115)\n (hN : 0 < N)\n (h : \u2200 n, N \u2264 n \u2192\n \u2203 z : \u2124,\n z = \u2211 i \u2208 Finset.range n, (a i : \u211a) / a ((i + 1) % n))\n : \u2203 M, \u2200 m, M \u2264 m \u2192 a m = a (m + 1) := by sorry", "category": "number theory"} {"name": "Usa2001P3", "solved": true, "tags": ["algebra"], "problem_id": "Usa2001P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 2001, Problem 3\n\nLet a,b,c \u2265 0 be real numbers satsifying\n\n a\u00b2 + b\u00b2 + c\u00b2 + abc = 4.\n\nShow that\n\n 0 \u2264 ab + bc + ca - abc \u2264 2.\n-/", "formal_statement": "theorem usa2001_p3 (a b c : \u211d) (ha : 0 \u2264 a) (hb : 0 \u2264 b) (hc : 0 \u2264 c)\n (h : a^2 + b^2 + c^2 + a * b * c = 4) :\n 0 \u2264 a * b + b * c + c * a - a * b * c \u2227\n a * b + b * c + c * a - a * b * c \u2264 2 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 2001, Problem 3\n\nLet a,b,c \u2265 0 be real numbers satsifying\n\n a\u00b2 + b\u00b2 + c\u00b2 + abc = 4.\n\nShow that\n\n 0 \u2264 ab + bc + ca - abc \u2264 2.\n-/\ntheorem usa2001_p3 (a b c : \u211d) (ha : 0 \u2264 a) (hb : 0 \u2264 b) (hc : 0 \u2264 c)\n (h : a^2 + b^2 + c^2 + a * b * c = 4) :\n 0 \u2264 a * b + b * c + c * a - a * b * c \u2227\n a * b + b * c + c * a - a * b * c \u2264 2 := by sorry", "category": "algebra"} {"name": "Imo2024P3", "solved": true, "tags": ["combinatorics"], "problem_id": "Imo2024P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2024, Problem 3\n\nLet a\u2081, a\u2082, a\u2083, ... be an infinite sequence of positive integers,\nand let N be a positive integer. Suppose that, for each n > N,\na\u2099 is equal to the number of times a\u2099\u208b\u2081 appears in the list\na\u2081, a\u2082, ..., a\u2099\u208b\u2081.\n\nProve that at least one of the sequences a\u2081, a\u2083, a\u2085, ... and\na\u2082, a\u2084, a\u2086, ... is eventually periodic.\n-/", "formal_statement": "/- special open -/ open Finset\n\n\n\n\n\n\ndef Condition (a : \u2115 \u2192 \u2115) (N : \u2115) : Prop :=\n (\u2200 i, 0 < a i) \u2227 \u2200 n, N < n \u2192 a n = Finset.card (filter (\u03bb i => a i = a (n - 1)) (Finset.range n))\n\ndef EventuallyPeriodic (b : \u2115 \u2192 \u2115) : Prop :=\n \u2203 p M, 0 < p \u2227 \u2200 m, M \u2264 m \u2192 b (m + p) = b m\n\ntheorem imo2024_p3 {a : \u2115 \u2192 \u2115} {N : \u2115} (h : Condition a N) :\n EventuallyPeriodic (fun i \u21a6 a (2 * i)) \u2228 EventuallyPeriodic (fun i \u21a6 a (2 * i + 1)) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2024, Problem 3\n\nLet a\u2081, a\u2082, a\u2083, ... be an infinite sequence of positive integers,\nand let N be a positive integer. Suppose that, for each n > N,\na\u2099 is equal to the number of times a\u2099\u208b\u2081 appears in the list\na\u2081, a\u2082, ..., a\u2099\u208b\u2081.\n\nProve that at least one of the sequences a\u2081, a\u2083, a\u2085, ... and\na\u2082, a\u2084, a\u2086, ... is eventually periodic.\n-/\n/- special open -/ open Finset\n\n\n\n\n\n\ndef Condition (a : \u2115 \u2192 \u2115) (N : \u2115) : Prop :=\n (\u2200 i, 0 < a i) \u2227 \u2200 n, N < n \u2192 a n = Finset.card (filter (\u03bb i => a i = a (n - 1)) (Finset.range n))\n\ndef EventuallyPeriodic (b : \u2115 \u2192 \u2115) : Prop :=\n \u2203 p M, 0 < p \u2227 \u2200 m, M \u2264 m \u2192 b (m + p) = b m\n\ntheorem imo2024_p3 {a : \u2115 \u2192 \u2115} {N : \u2115} (h : Condition a N) :\n EventuallyPeriodic (fun i \u21a6 a (2 * i)) \u2228 EventuallyPeriodic (fun i \u21a6 a (2 * i + 1)) := by sorry", "category": "combinatorics"} {"name": "Imo1972P1", "solved": true, "tags": ["combinatorics"], "problem_id": "Imo1972P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1972, Problem 1\n\nProve that from a set of ten distinct two-digit numbers (in\ndecimal), it is possible to select two disjoint subsets whose\nmembers have the same sum.\n-/", "formal_statement": "theorem imo1972_p1 (S : Finset \u2115)\n (Scard : S.card = 10)\n (Sdigits : \u2200 n \u2208 S, (Nat.digits 10 n).length = 2) :\n \u2203 S1 S2 : Finset \u2115, S1 \u2286 S \u2227 S2 \u2286 S \u2227\n Disjoint S1 S2 \u2227 \u2211 n \u2208 S1, n = \u2211 n \u2208 S2, n := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1972, Problem 1\n\nProve that from a set of ten distinct two-digit numbers (in\ndecimal), it is possible to select two disjoint subsets whose\nmembers have the same sum.\n-/\ntheorem imo1972_p1 (S : Finset \u2115)\n (Scard : S.card = 10)\n (Sdigits : \u2200 n \u2208 S, (Nat.digits 10 n).length = 2) :\n \u2203 S1 S2 : Finset \u2115, S1 \u2286 S \u2227 S2 \u2286 S \u2227\n Disjoint S1 S2 \u2227 \u2211 n \u2208 S1, n = \u2211 n \u2208 S2, n := by sorry", "category": "combinatorics"} {"name": "Usa2022P1", "solved": false, "tags": ["combinatorics"], "problem_id": "Usa2022P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 2022, Problem 1\n\nLet a and b be positive integers. The cells of an (a+b+1) \u00d7 (a+b+1) grid\nare colored amber and bronze such that there are at least a\u00b2 + ab - b\namber cells and at least b\u00b2 + ab - a bronze cells. Prove that it is\npossible to choose a amber cells and b bronze cells such that no two\nof the a + b chosen cells lie in the same row or column.\n-/", "formal_statement": "theorem usa2022_p1\n (a b : \u2115)\n (ha : 0 < a)\n (hb : 0 < b)\n (color : Fin (a + b + 1) \u00d7 Fin (a + b + 1) \u2192 Fin 2)\n (c0 : a^2 + a * b - b \u2264 Fintype.card {s // color s = 0})\n (c1 : b^2 + a * b - a \u2264 Fintype.card {s // color s = 1}) :\n \u2203 A B : Finset (Fin (a + b + 1) \u00d7 Fin (a + b + 1)),\n A.card = a \u2227 B.card = b \u2227\n (\u2200 x \u2208 A, color x = 0) \u2227\n (\u2200 y \u2208 B, color y = 1) \u2227\n \u2200 x \u2208 A \u222a B, \u2200 y \u2208 A \u222a B, x \u2260 y \u2192 x.fst \u2260 y.fst \u2227 x.snd \u2260 y.snd := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 2022, Problem 1\n\nLet a and b be positive integers. The cells of an (a+b+1) \u00d7 (a+b+1) grid\nare colored amber and bronze such that there are at least a\u00b2 + ab - b\namber cells and at least b\u00b2 + ab - a bronze cells. Prove that it is\npossible to choose a amber cells and b bronze cells such that no two\nof the a + b chosen cells lie in the same row or column.\n-/\ntheorem usa2022_p1\n (a b : \u2115)\n (ha : 0 < a)\n (hb : 0 < b)\n (color : Fin (a + b + 1) \u00d7 Fin (a + b + 1) \u2192 Fin 2)\n (c0 : a^2 + a * b - b \u2264 Fintype.card {s // color s = 0})\n (c1 : b^2 + a * b - a \u2264 Fintype.card {s // color s = 1}) :\n \u2203 A B : Finset (Fin (a + b + 1) \u00d7 Fin (a + b + 1)),\n A.card = a \u2227 B.card = b \u2227\n (\u2200 x \u2208 A, color x = 0) \u2227\n (\u2200 y \u2208 B, color y = 1) \u2227\n \u2200 x \u2208 A \u222a B, \u2200 y \u2208 A \u222a B, x \u2260 y \u2192 x.fst \u2260 y.fst \u2227 x.snd \u2260 y.snd := by sorry", "category": "combinatorics"} {"name": "Imo2003P6", "solved": true, "tags": ["number theory"], "problem_id": "Imo2003P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2003, Problem 6\n\nLet p be a prime number. Prove that there exists a prime number q\nsuch that for every integer n, the number n\u1d56 - p is not divisible\nby q.\n-/", "formal_statement": "theorem imo2003_p6 (p : \u2115) (hp : p.Prime) :\n \u2203 q : \u2115, q.Prime \u2227 \u2200 n, \u00ac((q : \u2124) \u2223 (n : \u2124)^p - (p : \u2124)) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2003, Problem 6\n\nLet p be a prime number. Prove that there exists a prime number q\nsuch that for every integer n, the number n\u1d56 - p is not divisible\nby q.\n-/\ntheorem imo2003_p6 (p : \u2115) (hp : p.Prime) :\n \u2203 q : \u2115, q.Prime \u2227 \u2200 n, \u00ac((q : \u2124) \u2223 (n : \u2124)^p - (p : \u2124)) := by sorry", "category": "number theory"} {"name": "Imo2019P1", "solved": true, "tags": ["algebra"], "problem_id": "Imo2019P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2019, Problem 1\nLet \u2124 be the set of integers. Determine all functions f : \u2124 \u2192 \u2124 such that,\nfor all integers a and b,\ufffc\n\n f(2 * a) + 2 * f(b) = f(f(a + b)).\n-/", "formal_statement": "abbrev solution_set : Set (\u2124 \u2192 \u2124) :=\n { f | (\u2200 z, f z = 0) \u2228 \u2203 c, \u2200 z, f z = 2 * z + c }\n\ntheorem imo2019_p1 (f : \u2124 \u2192 \u2124) :\n (\u2200 a b, f (2 * a) + 2 * (f b) = f (f (a + b))) \u2194 f \u2208 solution_set := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2019, Problem 1\nLet \u2124 be the set of integers. Determine all functions f : \u2124 \u2192 \u2124 such that,\nfor all integers a and b,\ufffc\n\n f(2 * a) + 2 * f(b) = f(f(a + b)).\n-/\nabbrev solution_set : Set (\u2124 \u2192 \u2124) :=\n { f | (\u2200 z, f z = 0) \u2228 \u2203 c, \u2200 z, f z = 2 * z + c }\n\ntheorem imo2019_p1 (f : \u2124 \u2192 \u2124) :\n (\u2200 a b, f (2 * a) + 2 * (f b) = f (f (a + b))) \u2194 f \u2208 solution_set := by sorry", "category": "algebra"} {"name": "Imo1976P6", "solved": false, "tags": ["algebra"], "problem_id": "Imo1976P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1976, Problem 6\n\nThe sequence u_0, u_1, u_2, ... is defined by:\nu_0 = 2, u1 = 5/2, u_{n+1} = un(u_{n-1}^2 - 2) - u_1 for n = 1, 2, ... .\nProve that \\[un\\] = 2^(2^n - (-1)^n)/3, where \\[x\\] denotes the greatest integer\nless than or equal to x.\n-/", "formal_statement": "theorem imo1976_p6 (u : \u2115 \u2192 \u211d)\n (h\u2080 : u 0 = 2)\n (h\u2081 : u 1 = 5 / 2)\n (h\u2082 : \u2200 n, u (n + 2) = u (n + 1) * ((u n)^2 - 2) - u 1) :\n \u2200 n, \u230au n\u230b = (2:\u211d) ^((2^n - (-1 : \u211d)^n) / 3):= by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1976, Problem 6\n\nThe sequence u_0, u_1, u_2, ... is defined by:\nu_0 = 2, u1 = 5/2, u_{n+1} = un(u_{n-1}^2 - 2) - u_1 for n = 1, 2, ... .\nProve that \\[un\\] = 2^(2^n - (-1)^n)/3, where \\[x\\] denotes the greatest integer\nless than or equal to x.\n-/\ntheorem imo1976_p6 (u : \u2115 \u2192 \u211d)\n (h\u2080 : u 0 = 2)\n (h\u2081 : u 1 = 5 / 2)\n (h\u2082 : \u2200 n, u (n + 2) = u (n + 1) * ((u n)^2 - 2) - u 1) :\n \u2200 n, \u230au n\u230b = (2:\u211d) ^((2^n - (-1 : \u211d)^n) / 3):= by sorry", "category": "algebra"} {"name": "Imo1965P2", "solved": true, "tags": ["algebra"], "problem_id": "Imo1965P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1965, Problem 2\n\nSuppose that\n a\u2081\u2081x\u2081 + a\u2081\u2082x\u2082 + a\u2081\u2083x\u2083 = 0\n a\u2082\u2081x\u2081 + a\u2082\u2082x\u2082 + a\u2082\u2083x\u2083 = 0\n a\u2083\u2081x\u2081 + a\u2083\u2082x\u2082 + a\u2083\u2083x\u2083 = 0\n\nwhere\n (A) a\u2081\u2081, a\u2082\u2082, a\u2083\u2083 are positive\n (B) the remaining a\u1d62\u2c7c are negative\n (C) in each row i, the sum of the coefficients a\u1d62\u2c7c is positive.\n\nProve that x\u2081 = x\u2082 = x\u2083 = 0.\n-/", "formal_statement": "theorem imo1965_p2 (x : Fin 3 \u2192 \u211d) (a : Fin 3 \u2192 Fin 3 \u2192 \u211d)\n (heqs : \u2200 i, \u2211 j : Fin 3, (a i j * x j) = 0)\n (hab : \u2200 i j, if i = j then 0 < a i j else a i j < 0)\n (hc : \u2200 i, 0 < \u2211 j : Fin 3, a i j)\n : \u2200 i, x i = 0 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1965, Problem 2\n\nSuppose that\n a\u2081\u2081x\u2081 + a\u2081\u2082x\u2082 + a\u2081\u2083x\u2083 = 0\n a\u2082\u2081x\u2081 + a\u2082\u2082x\u2082 + a\u2082\u2083x\u2083 = 0\n a\u2083\u2081x\u2081 + a\u2083\u2082x\u2082 + a\u2083\u2083x\u2083 = 0\n\nwhere\n (A) a\u2081\u2081, a\u2082\u2082, a\u2083\u2083 are positive\n (B) the remaining a\u1d62\u2c7c are negative\n (C) in each row i, the sum of the coefficients a\u1d62\u2c7c is positive.\n\nProve that x\u2081 = x\u2082 = x\u2083 = 0.\n-/\ntheorem imo1965_p2 (x : Fin 3 \u2192 \u211d) (a : Fin 3 \u2192 Fin 3 \u2192 \u211d)\n (heqs : \u2200 i, \u2211 j : Fin 3, (a i j * x j) = 0)\n (hab : \u2200 i j, if i = j then 0 < a i j else a i j < 0)\n (hc : \u2200 i, 0 < \u2211 j : Fin 3, a i j)\n : \u2200 i, x i = 0 := by sorry", "category": "algebra"} {"name": "Imo2022P5", "solved": true, "tags": ["number theory"], "problem_id": "Imo2022P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2022, Problem 5\n\nDetermine all possible triples of positive integers a,b,p that satisfy\n\n a\u1d56 = b! + p\n\nwhere p is prime.\n\n-/", "formal_statement": "abbrev solution_set : Set (\u2115 \u00d7 \u2115 \u00d7 \u2115) := { \u27e82,2,2\u27e9, \u27e83,4,3\u27e9 }\n\ntheorem imo2022_p5 (a b p : \u2115) (ha : 0 < a) (hb : 0 < b) (hp : p.Prime) :\n \u27e8a,b,p\u27e9 \u2208 solution_set \u2194 a^p = Nat.factorial b + p := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2022, Problem 5\n\nDetermine all possible triples of positive integers a,b,p that satisfy\n\n a\u1d56 = b! + p\n\nwhere p is prime.\n\n-/\nabbrev solution_set : Set (\u2115 \u00d7 \u2115 \u00d7 \u2115) := { \u27e82,2,2\u27e9, \u27e83,4,3\u27e9 }\n\ntheorem imo2022_p5 (a b p : \u2115) (ha : 0 < a) (hb : 0 < b) (hp : p.Prime) :\n \u27e8a,b,p\u27e9 \u2208 solution_set \u2194 a^p = Nat.factorial b + p := by sorry", "category": "number theory"} {"name": "Imo1963P4", "solved": false, "tags": ["algebra"], "problem_id": "Imo1963P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1963, Problem 4\n\nFind all solutions x\u2081,x\u2082,x\u2083,x\u2084,x\u2085 of the system\n\n x\u2085 + x\u2082 = yx\u2081\n x\u2081 + x\u2083 = yx\u2082\n x\u2082 + x\u2084 = yx\u2083\n x\u2083 + x\u2085 = yx\u2084\n x\u2084 + x\u2081 = yx\u2085\n\nwhere y is a parameter.\n-/", "formal_statement": "abbrev SolutionSet (y : \u211d) : Set (\u211d \u00d7 \u211d \u00d7 \u211d \u00d7 \u211d \u00d7 \u211d) :=\n if y = 2 then\n -- When y = 2, all variables are equal: x\u1d62 = s for any s\n {p | \u2203 s : \u211d, p = (s, s, s, s, s)}\n else if y * y + y - 1 = 0 then\n -- When y\u00b2 + y - 1 = 0, we can have two free parameters\n {p | \u2203 (s t : \u211d), \n p = (s, t, -s + y*t, -y*s - y*t, y*s - t)}\n else\n -- Otherwise, either all x\u1d62 = 0 or the system has no solution\n {(0, 0, 0, 0, 0)}\n\ntheorem imo1963_p4 (x\u2081 x\u2082 x\u2083 x\u2084 x\u2085 y : \u211d) :\n (x\u2081, x\u2082, x\u2083, x\u2084, x\u2085) \u2208 SolutionSet y \u2194\n (x\u2085 + x\u2082 = y * x\u2081 \u2227\n x\u2081 + x\u2083 = y * x\u2082 \u2227\n x\u2082 + x\u2084 = y * x\u2083 \u2227\n x\u2083 + x\u2085 = y * x\u2084 \u2227\n x\u2084 + x\u2081 = y * x\u2085) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1963, Problem 4\n\nFind all solutions x\u2081,x\u2082,x\u2083,x\u2084,x\u2085 of the system\n\n x\u2085 + x\u2082 = yx\u2081\n x\u2081 + x\u2083 = yx\u2082\n x\u2082 + x\u2084 = yx\u2083\n x\u2083 + x\u2085 = yx\u2084\n x\u2084 + x\u2081 = yx\u2085\n\nwhere y is a parameter.\n-/\nabbrev SolutionSet (y : \u211d) : Set (\u211d \u00d7 \u211d \u00d7 \u211d \u00d7 \u211d \u00d7 \u211d) :=\n if y = 2 then\n -- When y = 2, all variables are equal: x\u1d62 = s for any s\n {p | \u2203 s : \u211d, p = (s, s, s, s, s)}\n else if y * y + y - 1 = 0 then\n -- When y\u00b2 + y - 1 = 0, we can have two free parameters\n {p | \u2203 (s t : \u211d), \n p = (s, t, -s + y*t, -y*s - y*t, y*s - t)}\n else\n -- Otherwise, either all x\u1d62 = 0 or the system has no solution\n {(0, 0, 0, 0, 0)}\n\ntheorem imo1963_p4 (x\u2081 x\u2082 x\u2083 x\u2084 x\u2085 y : \u211d) :\n (x\u2081, x\u2082, x\u2083, x\u2084, x\u2085) \u2208 SolutionSet y \u2194\n (x\u2085 + x\u2082 = y * x\u2081 \u2227\n x\u2081 + x\u2083 = y * x\u2082 \u2227\n x\u2082 + x\u2084 = y * x\u2083 \u2227\n x\u2083 + x\u2085 = y * x\u2084 \u2227\n x\u2084 + x\u2081 = y * x\u2085) := by sorry", "category": "algebra"} {"name": "Imo2023P1", "solved": true, "tags": ["number theory"], "problem_id": "Imo2023P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2023, Problem 1\n\nDetermine all composite integers n>1 that satisfy the following property:\nif d\u2081,d\u2082,...,d\u2096 are all the positive divisors of n with\n1 = d\u2081 < d\u2082 < ... < d\u2096 = n, then d\u1d62 divides d\u1d62\u208a\u2081 + d\u1d62\u208a\u2082 for every\n1 \u2264 i \u2264 k - 2.\n-/", "formal_statement": "abbrev ConsecutiveFactors (n a b : \u2115) :=\n a \u2223 n \u2227 b \u2223 n \u2227 a < b \u2227 \u00ac\u2203 c, (c \u2223 n \u2227 a < c \u2227 c < b)\n\nabbrev Dividable (n : \u2115) :=\n \u2200 {a b c : \u2115},\n ConsecutiveFactors n a b \u2227 ConsecutiveFactors n b c\n \u2192 a \u2223 b + c\n\nabbrev solution_set : Set \u2115 := { n | \u00acn.Prime \u2227 IsPrimePow n }\n\ntheorem imo2023_p1 : solution_set = { n | 1 < n \u2227 \u00acn.Prime \u2227 Dividable n } := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2023, Problem 1\n\nDetermine all composite integers n>1 that satisfy the following property:\nif d\u2081,d\u2082,...,d\u2096 are all the positive divisors of n with\n1 = d\u2081 < d\u2082 < ... < d\u2096 = n, then d\u1d62 divides d\u1d62\u208a\u2081 + d\u1d62\u208a\u2082 for every\n1 \u2264 i \u2264 k - 2.\n-/\nabbrev ConsecutiveFactors (n a b : \u2115) :=\n a \u2223 n \u2227 b \u2223 n \u2227 a < b \u2227 \u00ac\u2203 c, (c \u2223 n \u2227 a < c \u2227 c < b)\n\nabbrev Dividable (n : \u2115) :=\n \u2200 {a b c : \u2115},\n ConsecutiveFactors n a b \u2227 ConsecutiveFactors n b c\n \u2192 a \u2223 b + c\n\nabbrev solution_set : Set \u2115 := { n | \u00acn.Prime \u2227 IsPrimePow n }\n\ntheorem imo2023_p1 : solution_set = { n | 1 < n \u2227 \u00acn.Prime \u2227 Dividable n } := by sorry", "category": "number theory"} {"name": "Imo2016P4", "solved": false, "tags": ["number theory"], "problem_id": "Imo2016P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2016, Problem 4\n\nA set of positive integers is called *fragrant* if it contains\nat least two elements and each of its elements has a prime\nfactor in common with at least one of the other elements.\nLet P(n) = n\u00b2 + n + 1. What is the least possible value of\npositive integer b such that there exists a non-negative integer\na for which the set\n\n { P(a + 1), P(a + 2), ..., P(a + b) }\n\nis fragrant?\n-/", "formal_statement": "abbrev Fragrant (s : Set \u2115+) : Prop :=\n 2 \u2264 s.ncard \u2227 \u2200 m \u2208 s, \u2203 n \u2208 s, \u00acNat.Coprime m n\n\nabbrev P (n : \u2115) : \u2115 := n^2 + n + 1\n\nabbrev Solution : \u2115+ := 6\n\ntheorem imo2016_p4 :\n IsLeast\n {b : \u2115+ | \u2203 a : \u2115, Fragrant {p | \u2203 i < b, p = P (a + 1 + i)}}\n Solution := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2016, Problem 4\n\nA set of positive integers is called *fragrant* if it contains\nat least two elements and each of its elements has a prime\nfactor in common with at least one of the other elements.\nLet P(n) = n\u00b2 + n + 1. What is the least possible value of\npositive integer b such that there exists a non-negative integer\na for which the set\n\n { P(a + 1), P(a + 2), ..., P(a + b) }\n\nis fragrant?\n-/\nabbrev Fragrant (s : Set \u2115+) : Prop :=\n 2 \u2264 s.ncard \u2227 \u2200 m \u2208 s, \u2203 n \u2208 s, \u00acNat.Coprime m n\n\nabbrev P (n : \u2115) : \u2115 := n^2 + n + 1\n\nabbrev Solution : \u2115+ := 6\n\ntheorem imo2016_p4 :\n IsLeast\n {b : \u2115+ | \u2203 a : \u2115, Fragrant {p | \u2203 i < b, p = P (a + 1 + i)}}\n Solution := by sorry", "category": "number theory"} {"name": "Usa2018P1", "solved": true, "tags": ["algebra", "inequality"], "problem_id": "Usa2018P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 2018, Problem 1\n\nGiven that a,b,c are positive real numbers such that\n\n a + b + c = 4 \u221b(abc)\n\nprove that 2(ab + bc + ca) + 4min(a\u00b2,b\u00b2,c\u00b2) \u2265 a\u00b2 + b\u00b2 + c\u00b2\n-/", "formal_statement": "theorem usa2018_p1 (a b c : \u211d) :\n a > 0 \u2192 b > 0 \u2192 c > 0 \u2192 a + b + c = 4 * (a * b * c) ^ ((1 : \u211d) / 3) \u2192\n 2 * (a * b + b * c + c * a) +\n 4 * (min (min (a * a) (b * b)) (c * c)) \u2265 a^2 + b^2 + c^2 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 2018, Problem 1\n\nGiven that a,b,c are positive real numbers such that\n\n a + b + c = 4 \u221b(abc)\n\nprove that 2(ab + bc + ca) + 4min(a\u00b2,b\u00b2,c\u00b2) \u2265 a\u00b2 + b\u00b2 + c\u00b2\n-/\ntheorem usa2018_p1 (a b c : \u211d) :\n a > 0 \u2192 b > 0 \u2192 c > 0 \u2192 a + b + c = 4 * (a * b * c) ^ ((1 : \u211d) / 3) \u2192\n 2 * (a * b + b * c + c * a) +\n 4 * (min (min (a * a) (b * b)) (c * c)) \u2265 a^2 + b^2 + c^2 := by sorry", "category": "algebra"} {"name": "ZeroesOnesAndTwos1", "problem_id": "ZeroesOnesAndTwos1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n(From Mathematical Puzzles: A Connoisseur's Collection by Peter Winkler.)\n\nLet n be a natural number. Prove that\n\n (a) n has a (nonzero) multiple whose representation in base 10 contains\n only zeroes and ones; and\n-/", "formal_statement": "theorem zeroes_and_ones\n (n : \u2115) : \u2203 k : \u2115+, \u2200 e \u2208 Nat.digits 10 (n * k), e = 0 \u2228 e = 1 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n(From Mathematical Puzzles: A Connoisseur's Collection by Peter Winkler.)\n\nLet n be a natural number. Prove that\n\n (a) n has a (nonzero) multiple whose representation in base 10 contains\n only zeroes and ones; and\n-/\ntheorem zeroes_and_ones\n (n : \u2115) : \u2203 k : \u2115+, \u2200 e \u2208 Nat.digits 10 (n * k), e = 0 \u2228 e = 1 := by sorry", "tags": [], "solved": false, "category": "number theory"} {"name": "Imo2008P4", "solved": true, "tags": ["algebra"], "problem_id": "Imo2008P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2008, Problem 4\n\nDetermine all functions f from the positive reals to the positive reals\nsuch that\n\n (f(w)\u00b2 + f(x)\u00b2) / (f(y)\u00b2 + f(z)\u00b2) = (w\u00b2 + x\u00b2) / (y\u00b2 + z\u00b2)\n\nfor all positive real numbers w,x,y,z satisfying xw = yz.\n-/", "formal_statement": "abbrev PosReal : Type := { x : \u211d // 0 < x }\n\nabbrev solution_set : Set (PosReal \u2192 PosReal) := { f | f = id \u2228 f = fun x \u21a6 1 / x }\n\ntheorem imo2008_p4 (f : PosReal \u2192 PosReal) :\n f \u2208 solution_set \u2194\n \u2200 w x y z, w * x = y * z \u2192\n ((f w)^2 + (f x)^2) * (y^2 + z^2) = (w^2 + x^2) * (f (y^2) + f (z^2)) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2008, Problem 4\n\nDetermine all functions f from the positive reals to the positive reals\nsuch that\n\n (f(w)\u00b2 + f(x)\u00b2) / (f(y)\u00b2 + f(z)\u00b2) = (w\u00b2 + x\u00b2) / (y\u00b2 + z\u00b2)\n\nfor all positive real numbers w,x,y,z satisfying xw = yz.\n-/\nabbrev PosReal : Type := { x : \u211d // 0 < x }\n\nabbrev solution_set : Set (PosReal \u2192 PosReal) := { f | f = id \u2228 f = fun x \u21a6 1 / x }\n\ntheorem imo2008_p4 (f : PosReal \u2192 PosReal) :\n f \u2208 solution_set \u2194\n \u2200 w x y z, w * x = y * z \u2192\n ((f w)^2 + (f x)^2) * (y^2 + z^2) = (w^2 + x^2) * (f (y^2) + f (z^2)) := by sorry", "category": "algebra"} {"name": "Imo2012P2", "solved": false, "tags": ["algebra"], "problem_id": "Imo2012P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2012, Problem 2\n\nLet a\u2082, a\u2083, ..., a\u2099 be positive reals with product 1, where n \u2265 3.\nShow that\n (1 + a\u2082)\u00b2(1 + a\u2083)\u00b3...(1 + a\u2099)\u207f > n\u207f.\n-/", "formal_statement": "theorem imo2012_p2 (n : \u2115) (hn : 3 \u2264 n) (a : Finset.Icc 2 n \u2192 \u211d)\n (apos : \u2200 i, 0 < a i) (aprod : \u220f i, a i = 1) :\n (n:\u211d)^n < \u220f i, (1 + a i)^i.val := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2012, Problem 2\n\nLet a\u2082, a\u2083, ..., a\u2099 be positive reals with product 1, where n \u2265 3.\nShow that\n (1 + a\u2082)\u00b2(1 + a\u2083)\u00b3...(1 + a\u2099)\u207f > n\u207f.\n-/\ntheorem imo2012_p2 (n : \u2115) (hn : 3 \u2264 n) (a : Finset.Icc 2 n \u2192 \u211d)\n (apos : \u2200 i, 0 < a i) (aprod : \u220f i, a i = 1) :\n (n:\u211d)^n < \u220f i, (1 + a i)^i.val := by sorry", "category": "algebra"} {"name": "Singapore2019P4", "solved": true, "tags": ["algebra"], "problem_id": "Singapore2019P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# Singapore Math Olympiad (Senior) 2019 (Round 1), Problem 4\n\nhttp://www.realsutra.com/limjeck/SMO_Senior_2019.pdf\n\nIf $\\log_{21} 3 = x$, express $\\log_7 9$ in terms of $x$.\n-/", "formal_statement": "noncomputable abbrev solution (x : \u211d) : \u211d := 2*x / (1-x)\n\ntheorem singapore2019_r1_p4 (x : \u211d) (hx : Real.logb 21 3 = x) :\n Real.logb 7 9 = solution x := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# Singapore Math Olympiad (Senior) 2019 (Round 1), Problem 4\n\nhttp://www.realsutra.com/limjeck/SMO_Senior_2019.pdf\n\nIf $\\log_{21} 3 = x$, express $\\log_7 9$ in terms of $x$.\n-/\nnoncomputable abbrev solution (x : \u211d) : \u211d := 2*x / (1-x)\n\ntheorem singapore2019_r1_p4 (x : \u211d) (hx : Real.logb 21 3 = x) :\n Real.logb 7 9 = solution x := by sorry", "category": "algebra"} {"name": "Imo2001P6", "solved": true, "tags": ["number theory"], "problem_id": "Imo2001P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2001, Problem 6\n\nLet a, b, c, d be integers with a > b > c > d > 0. Suppose that\n\n ac + bd = (a + b - c + d) * (-a + b + c + d).\n\nProve that ab + cd is not prime.\n-/", "formal_statement": "theorem imo2001_p6 {a b c d : \u2124} (hd : 0 < d) (hdc : d < c) (hcb : c < b) (hba : b < a)\n (h : a * c + b * d = (a + b - c + d) * (-a + b + c + d)) : \u00acPrime (a * b + c * d) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2001, Problem 6\n\nLet a, b, c, d be integers with a > b > c > d > 0. Suppose that\n\n ac + bd = (a + b - c + d) * (-a + b + c + d).\n\nProve that ab + cd is not prime.\n-/\ntheorem imo2001_p6 {a b c d : \u2124} (hd : 0 < d) (hdc : d < c) (hcb : c < b) (hba : b < a)\n (h : a * c + b * d = (a + b - c + d) * (-a + b + c + d)) : \u00acPrime (a * b + c * d) := by sorry", "category": "number theory"} {"name": "Imo2008P5", "solved": false, "tags": ["combinatorics"], "problem_id": "Imo2008P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2008, Problem 5\n\nLet n and k be positive integers with k \u2265 n and k - n an even number.\nThere are 2n lamps labelled 1, 2, ..., 2n each of which can be\neither on or off. Initially all the lamps are off. We consider\nsequences of steps: at each step one of the lamps is switched (from\non to off or from off to on). Let N be the number of such sequences\nconsisting of k steps and resulting in the state where lamps 1 through\nn are all on, and lamps n + 1 through 2n are all off. Let M be the\nnumber of such sequences consisting of k steps, resulting in the state\nwhere lamps 1 through n are all on, and lamps n + 1 through 2n are all off,\nbut where none of the lamps n + 1 through 2n is ever switched on.\n\nDetermine N/M.\n-/", "formal_statement": "abbrev Sequence (n k : \u2115) := Fin k \u2192 Fin (2 * n)\n\nabbrev NSequence (n k : \u2115) (f : Sequence n k) : Prop :=\n (\u2200 i < n, Odd (Nat.card { j | f j = i })) \u2227\n (\u2200 i, n \u2264 i \u2192 i < 2 * n \u2192 Even (Nat.card { j | f j = i }))\n\nabbrev MSequence (n k : \u2115) (f : Sequence n k) : Prop :=\n NSequence n k f \u2227\n (\u2200 i : Fin (2 * n), n \u2264 i \u2192 \u2200 j : Fin k, f j \u2260 i)\n\nabbrev solution (n k : \u2115) : \u211a := 2 ^ (k - n)\n\ntheorem imo2008_p5 (n k : \u2115) (hn : 0 < n)\n (hnk : n \u2264 k) (he : Even (k - n))\n : Set.ncard (MSequence n k) * solution n k = Set.ncard (NSequence n k) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2008, Problem 5\n\nLet n and k be positive integers with k \u2265 n and k - n an even number.\nThere are 2n lamps labelled 1, 2, ..., 2n each of which can be\neither on or off. Initially all the lamps are off. We consider\nsequences of steps: at each step one of the lamps is switched (from\non to off or from off to on). Let N be the number of such sequences\nconsisting of k steps and resulting in the state where lamps 1 through\nn are all on, and lamps n + 1 through 2n are all off. Let M be the\nnumber of such sequences consisting of k steps, resulting in the state\nwhere lamps 1 through n are all on, and lamps n + 1 through 2n are all off,\nbut where none of the lamps n + 1 through 2n is ever switched on.\n\nDetermine N/M.\n-/\nabbrev Sequence (n k : \u2115) := Fin k \u2192 Fin (2 * n)\n\nabbrev NSequence (n k : \u2115) (f : Sequence n k) : Prop :=\n (\u2200 i < n, Odd (Nat.card { j | f j = i })) \u2227\n (\u2200 i, n \u2264 i \u2192 i < 2 * n \u2192 Even (Nat.card { j | f j = i }))\n\nabbrev MSequence (n k : \u2115) (f : Sequence n k) : Prop :=\n NSequence n k f \u2227\n (\u2200 i : Fin (2 * n), n \u2264 i \u2192 \u2200 j : Fin k, f j \u2260 i)\n\nabbrev solution (n k : \u2115) : \u211a := 2 ^ (k - n)\n\ntheorem imo2008_p5 (n k : \u2115) (hn : 0 < n)\n (hnk : n \u2264 k) (he : Even (k - n))\n : Set.ncard (MSequence n k) * solution n k = Set.ncard (NSequence n k) := by sorry", "category": "combinatorics"} {"name": "Imo2016P5", "solved": false, "tags": ["algebra"], "problem_id": "Imo2016P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2016, Problem 5\n\nThe equation\n\n (x - 1)(x - 2) ... (x - 2016) = (x - 1)(x - 2) ... (x - 2016)\n\nis written on the board. What is the least possible value of k\nfor which it is possible to erase exactly k of these 4032 factors\nsuch that at least one factor remains on each side and the resulting\nequation has no real solutions?\n-/", "formal_statement": "abbrev solution_value : \u2115 := 2016\n\ntheorem imo2015_p5 :\n IsLeast { k | \u2203 L R : Finset \u2115,\n L \u2282 Finset.Icc 1 2016 \u2227\n R \u2282 Finset.Icc 1 2016 \u2227\n L.card + R.card = k \u2227\n \u00ac\u2203 x : \u211d,\n \u220f i \u2208 Finset.Icc 1 2016 \\ L, (x - (i : \u211d)) =\n \u220f i \u2208 Finset.Icc 1 2016 \\ R, (x - (i : \u211d)) }\n solution_value := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2016, Problem 5\n\nThe equation\n\n (x - 1)(x - 2) ... (x - 2016) = (x - 1)(x - 2) ... (x - 2016)\n\nis written on the board. What is the least possible value of k\nfor which it is possible to erase exactly k of these 4032 factors\nsuch that at least one factor remains on each side and the resulting\nequation has no real solutions?\n-/\nabbrev solution_value : \u2115 := 2016\n\ntheorem imo2015_p5 :\n IsLeast { k | \u2203 L R : Finset \u2115,\n L \u2282 Finset.Icc 1 2016 \u2227\n R \u2282 Finset.Icc 1 2016 \u2227\n L.card + R.card = k \u2227\n \u00ac\u2203 x : \u211d,\n \u220f i \u2208 Finset.Icc 1 2016 \\ L, (x - (i : \u211d)) =\n \u220f i \u2208 Finset.Icc 1 2016 \\ R, (x - (i : \u211d)) }\n solution_value := by sorry", "category": "algebra"} {"name": "Imo1963P5", "solved": true, "tags": ["algebra"], "problem_id": "Imo1963P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1963, Problem 5\n\nProve that cos(\u03c0/7) - cos(2\u03c0/7) + cos(3\u03c0/7) = 1/2.\n-/", "formal_statement": "theorem imo1963_p5 :\n Real.cos (Real.pi/7) - Real.cos (2*Real.pi/7) + Real.cos (3*Real.pi/7) = 1/2 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1963, Problem 5\n\nProve that cos(\u03c0/7) - cos(2\u03c0/7) + cos(3\u03c0/7) = 1/2.\n-/\ntheorem imo1963_p5 :\n Real.cos (Real.pi/7) - Real.cos (2*Real.pi/7) + Real.cos (3*Real.pi/7) = 1/2 := by sorry", "category": "algebra"} {"name": "Imo1964P1b", "problem_id": "Imo1964P1b", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1964, Problem 1\n\n(b) Prove that there is no positive integer n for which 2\u207f + 1 is divisible by 7.\n-/", "formal_statement": "theorem imo_1964_p1b (n : \u2115) : \u00ac 7 \u2223 (2^n + 1) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1964, Problem 1\n\n(b) Prove that there is no positive integer n for which 2\u207f + 1 is divisible by 7.\n-/\ntheorem imo_1964_p1b (n : \u2115) : \u00ac 7 \u2223 (2^n + 1) := by sorry", "tags": ["number theory"], "solved": true, "category": "number theory"} {"name": "Imo2000P2", "solved": true, "tags": ["algebra", "inequality"], "problem_id": "Imo2000P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2000, Problem 2\n\nLet a, b, c be positive real numbers such that abc = 1. Show that\n\n (a - 1 + 1/b)(b - 1 + 1/c)(c - 1 + 1/a) \u2264 1.\n-/", "formal_statement": "theorem imo2000_p2 (a b c : \u211d) (ha : 0 < a) (hb : 0 < b) (hc : 0 < c)\n (habc : a * b * c = 1) :\n (a - 1 + 1 / b) * (b - 1 + 1 / c) * (c - 1 + 1 / a) \u2264 1 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2000, Problem 2\n\nLet a, b, c be positive real numbers such that abc = 1. Show that\n\n (a - 1 + 1/b)(b - 1 + 1/c)(c - 1 + 1/a) \u2264 1.\n-/\ntheorem imo2000_p2 (a b c : \u211d) (ha : 0 < a) (hb : 0 < b) (hc : 0 < c)\n (habc : a * b * c = 1) :\n (a - 1 + 1 / b) * (b - 1 + 1 / c) * (c - 1 + 1 / a) \u2264 1 := by sorry", "category": "algebra"} {"name": "Imo1975P2", "solved": false, "tags": ["algebra"], "problem_id": "Imo1975P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1975, Problem 2\n\nLet a1 < a2 < a3 < ... be positive integers.\nProve that for every i >= 1,\nthere are infinitely many a_n that can be written in the form a_n = ra_i + sa_j,\nwith r, s positive integers and j > i.\n-/", "formal_statement": "theorem imo1975_p2 (a : \u2115 \u2192 \u2124)\n (apos : \u2200 i : \u2115, 0 < a i)\n (ha : \u2200 i : \u2115, a i < a (i + 1)) :\n ( \u2200 i n0 : \u2115 ,\n \u2203 n, n0 \u2264 n \u2227\n \u2203 r s : \u2115,\n \u2203 j : \u2115,\n a n = r * a i + s * a j \u2227\n i < j \u2227\n 0 < r \u2227\n 0 < s ):= by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1975, Problem 2\n\nLet a1 < a2 < a3 < ... be positive integers.\nProve that for every i >= 1,\nthere are infinitely many a_n that can be written in the form a_n = ra_i + sa_j,\nwith r, s positive integers and j > i.\n-/\ntheorem imo1975_p2 (a : \u2115 \u2192 \u2124)\n (apos : \u2200 i : \u2115, 0 < a i)\n (ha : \u2200 i : \u2115, a i < a (i + 1)) :\n ( \u2200 i n0 : \u2115 ,\n \u2203 n, n0 \u2264 n \u2227\n \u2203 r s : \u2115,\n \u2203 j : \u2115,\n a n = r * a i + s * a j \u2227\n i < j \u2227\n 0 < r \u2227\n 0 < s ):= by sorry", "category": "algebra"} {"name": "UpperLowerContinuous", "solved": true, "tags": [], "problem_id": "UpperLowerContinuous", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\nSuppose f : \u211d -> \u211d is continuous in both the upper topology (where\nthe basic open sets are half-open intervals (a, b]) and lower topology\n(where the basic open sets are half-open intervals [a,b)).\nThen f is continuous in the usual topology (where the basic open sets are\n-/", "formal_statement": "def upper_intervals : Set (Set \u211d) := {s : Set \u211d | \u2203 a b : \u211d, Set.Ioc a b = s}\ndef lower_intervals : Set (Set \u211d) := {s : Set \u211d | \u2203 a b : \u211d, Set.Ico a b = s}\ndef open_intervals : Set (Set \u211d) := {s : Set \u211d | \u2203 a b : \u211d, Set.Ioo a b = s}\n\n/-- Generate the toplogy on \u211d by intervals of the form (a, b]. -/\ndef t\u1d64 : TopologicalSpace \u211d := TopologicalSpace.generateFrom upper_intervals\n\n/-- Generate the toplogy on \u211d by intervals of the form [a, b). -/\ndef t\u2097 : TopologicalSpace \u211d := TopologicalSpace.generateFrom lower_intervals\n\n/-- This should be equivalent to the default instance\nfor `TopologicalSpace \u211d`, which goes through `UniformSpace`, but for\nnow I don't want to bother with proving that equivalence.\n-/\ndef t\u209b : TopologicalSpace \u211d := TopologicalSpace.generateFrom open_intervals\n\n-- activate the Continuous[t1, t2] notation\n\ntheorem properties_of_upper_lower_continuous\n (f : \u211d \u2192 \u211d)\n (huc : Continuous[t\u1d64, t\u1d64] f)\n (hlc : Continuous[t\u2097, t\u2097] f)\n : Continuous[t\u209b, t\u209b] f \u2227 Monotone f := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\nSuppose f : \u211d -> \u211d is continuous in both the upper topology (where\nthe basic open sets are half-open intervals (a, b]) and lower topology\n(where the basic open sets are half-open intervals [a,b)).\nThen f is continuous in the usual topology (where the basic open sets are\n-/\ndef upper_intervals : Set (Set \u211d) := {s : Set \u211d | \u2203 a b : \u211d, Set.Ioc a b = s}\ndef lower_intervals : Set (Set \u211d) := {s : Set \u211d | \u2203 a b : \u211d, Set.Ico a b = s}\ndef open_intervals : Set (Set \u211d) := {s : Set \u211d | \u2203 a b : \u211d, Set.Ioo a b = s}\n\n/-- Generate the toplogy on \u211d by intervals of the form (a, b]. -/\ndef t\u1d64 : TopologicalSpace \u211d := TopologicalSpace.generateFrom upper_intervals\n\n/-- Generate the toplogy on \u211d by intervals of the form [a, b). -/\ndef t\u2097 : TopologicalSpace \u211d := TopologicalSpace.generateFrom lower_intervals\n\n/-- This should be equivalent to the default instance\nfor `TopologicalSpace \u211d`, which goes through `UniformSpace`, but for\nnow I don't want to bother with proving that equivalence.\n-/\ndef t\u209b : TopologicalSpace \u211d := TopologicalSpace.generateFrom open_intervals\n\n-- activate the Continuous[t1, t2] notation\n\ntheorem properties_of_upper_lower_continuous\n (f : \u211d \u2192 \u211d)\n (huc : Continuous[t\u1d64, t\u1d64] f)\n (hlc : Continuous[t\u2097, t\u2097] f)\n : Continuous[t\u209b, t\u209b] f \u2227 Monotone f := by sorry", "category": "number theory"} {"name": "UK2024R1P1", "solved": true, "tags": ["combinatorics"], "problem_id": "UK2024R1P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# British Mathematical Olympiad 2024, Round 1, Problem 1\n\nAn unreliable typist can guarantee that when they try to type a word with\ndifferent letters, every letter of the word will appear exactly once in what\nthey type, and each letter will occur at most one letter late (though it may\noccur more than one letter early). Thus, when trying to type MATHS, the\ntypist may type MATHS, MTAHS or TMASH, but not ATMSH.\n\nDetermine, with proof, the number of possible spellings of OLYMPIADS\nthat might be typed.\n-/", "formal_statement": "abbrev solution_value : \u2115 := 256\n\n/-\nSince OLYMPIADS has no duplicate letters, then the set of spellings is just a\nsubset of the permutations of 9 elements.\n-/\ntheorem uk2024_r1_p1 :\n {f : Equiv.Perm (Fin 9) | \u2200 k, (f k : \u2115) \u2264 k + 1}.ncard = solution_value := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# British Mathematical Olympiad 2024, Round 1, Problem 1\n\nAn unreliable typist can guarantee that when they try to type a word with\ndifferent letters, every letter of the word will appear exactly once in what\nthey type, and each letter will occur at most one letter late (though it may\noccur more than one letter early). Thus, when trying to type MATHS, the\ntypist may type MATHS, MTAHS or TMASH, but not ATMSH.\n\nDetermine, with proof, the number of possible spellings of OLYMPIADS\nthat might be typed.\n-/\nabbrev solution_value : \u2115 := 256\n\n/-\nSince OLYMPIADS has no duplicate letters, then the set of spellings is just a\nsubset of the permutations of 9 elements.\n-/\ntheorem uk2024_r1_p1 :\n {f : Equiv.Perm (Fin 9) | \u2200 k, (f k : \u2115) \u2264 k + 1}.ncard = solution_value := by sorry", "category": "combinatorics"} {"name": "Imo2017P1", "solved": false, "tags": ["number theory"], "problem_id": "Imo2017P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2017, Problem 1\n\nFor any integer a\u2080 > 1, define the sequence\n\n a\u2099\u208a\u2081 = \u221aa\u2099, if a\u2099 is a perfect square\n or a\u2099 + 3 otherwise.\n\nFind all values of a\u2080 for which there exists A such that a\u2099 = A for\ninfinitely many values of n.\n-/", "formal_statement": "noncomputable def a (a0 : \u2115) : \u2115 \u2192 \u2115\n| 0 => a0\n| n + 1 => if (Nat.sqrt (a a0 n))^2 = a a0 n\n then Nat.sqrt (a a0 n)\n else a a0 n + 3\n\nabbrev solution_set : Set \u2115 := {n : \u2115 | n > 1 \u2227 n % 3 = 0}\n\ntheorem imo2017_p1 (a0 : \u2115) :\n a0 \u2208 solution_set \u2194 \u2203 A, { n | a a0 n = A }.Infinite := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2017, Problem 1\n\nFor any integer a\u2080 > 1, define the sequence\n\n a\u2099\u208a\u2081 = \u221aa\u2099, if a\u2099 is a perfect square\n or a\u2099 + 3 otherwise.\n\nFind all values of a\u2080 for which there exists A such that a\u2099 = A for\ninfinitely many values of n.\n-/\nnoncomputable def a (a0 : \u2115) : \u2115 \u2192 \u2115\n| 0 => a0\n| n + 1 => if (Nat.sqrt (a a0 n))^2 = a a0 n\n then Nat.sqrt (a a0 n)\n else a a0 n + 3\n\nabbrev solution_set : Set \u2115 := {n : \u2115 | n > 1 \u2227 n % 3 = 0}\n\ntheorem imo2017_p1 (a0 : \u2115) :\n a0 \u2208 solution_set \u2194 \u2203 A, { n | a a0 n = A }.Infinite := by sorry", "category": "number theory"} {"name": "Imo1978P6", "solved": false, "tags": ["combinatorics"], "problem_id": "Imo1978P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1978, Problem 6\n\nAn international society has its members from six different countries.\nThe list of members has 1978 names, numbered $1, 2, \\ldots, 1978$.\nProve that there is at least one member whose number is\nthe sum of the numbers of two (not necessarily distinct) members from his own country.\n-/", "formal_statement": "theorem imo1978_p6 (n : \u2115) (hn : n = 1978) (C : Fin n \u2192 Fin 6) :\n \u2203 j : Fin n, \u2203 i : Fin n, \u2203 k : Fin n,\n C i = C j \u2227\n C j = C k \u2227\n (i:\u2115) + 1 + (k:\u2115) + 1 = (j:\u2115) + 1 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1978, Problem 6\n\nAn international society has its members from six different countries.\nThe list of members has 1978 names, numbered $1, 2, \\ldots, 1978$.\nProve that there is at least one member whose number is\nthe sum of the numbers of two (not necessarily distinct) members from his own country.\n-/\ntheorem imo1978_p6 (n : \u2115) (hn : n = 1978) (C : Fin n \u2192 Fin 6) :\n \u2203 j : Fin n, \u2203 i : Fin n, \u2203 k : Fin n,\n C i = C j \u2227\n C j = C k \u2227\n (i:\u2115) + 1 + (k:\u2115) + 1 = (j:\u2115) + 1 := by sorry", "category": "combinatorics"} {"name": "Imo1971P5", "solved": false, "tags": ["combinatorics"], "problem_id": "Imo1971P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1971, Problem 5\n\nProve that for every natural number m there exists a finite set S of\npoints in the plane with the following property:\nFor every point s in S, there are exactly m points which are at a unit\ndistance from s.\n-/", "formal_statement": "/- special open -/ open EuclideanGeometry\n\n\n\n\n\n\nabbrev Pt := EuclideanSpace \u211d (Fin 2)\n\ntheorem imo1971_p5 (m : \u2115) :\n \u2203 S : Set Pt, S.Finite \u2227 \u2200 s \u2208 S, Nat.card {t | dist s t = 1} = m := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1971, Problem 5\n\nProve that for every natural number m there exists a finite set S of\npoints in the plane with the following property:\nFor every point s in S, there are exactly m points which are at a unit\ndistance from s.\n-/\n/- special open -/ open EuclideanGeometry\n\n\n\n\n\n\nabbrev Pt := EuclideanSpace \u211d (Fin 2)\n\ntheorem imo1971_p5 (m : \u2115) :\n \u2203 S : Set Pt, S.Finite \u2227 \u2200 s \u2208 S, Nat.card {t | dist s t = 1} = m := by sorry", "category": "combinatorics"} {"name": "Imo1962P1", "solved": true, "tags": ["number theory"], "problem_id": "Imo1962P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1962, Problem 1\n\nFind the smallest natural number $n$ which has the following properties:\n\n(a) Its decimal representation has 6 as the last digit.\n\n(b) If the last digit 6 is erased and placed in front of the remaining digits,\nthe resulting number is four times as large as the original number $n$.\n-/", "formal_statement": "def ProblemPredicate (n : \u2115) : Prop :=\n (digits 10 n).headI = 6 \u2227 ofDigits 10 ((digits 10 n).tail.concat 6) = 4 * n\n\nabbrev solution : \u2115 := 153846\n\ntheorem imo1962_p1 : IsLeast {n | ProblemPredicate n} solution := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1962, Problem 1\n\nFind the smallest natural number $n$ which has the following properties:\n\n(a) Its decimal representation has 6 as the last digit.\n\n(b) If the last digit 6 is erased and placed in front of the remaining digits,\nthe resulting number is four times as large as the original number $n$.\n-/\ndef ProblemPredicate (n : \u2115) : Prop :=\n (digits 10 n).headI = 6 \u2227 ofDigits 10 ((digits 10 n).tail.concat 6) = 4 * n\n\nabbrev solution : \u2115 := 153846\n\ntheorem imo1962_p1 : IsLeast {n | ProblemPredicate n} solution := by sorry", "category": "number theory"} {"name": "Canada1998P3", "solved": true, "tags": ["algebra", "inequality"], "problem_id": "Canada1998P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\nCanadian Mathematical Olympiad 1998, Problem 3\n\nLet n be a natural number such that n \u2265 2. Show that\n\n (1/(n + 1))(1 + 1/3 + ... + 1/(2n - 1)) > (1/n)(1/2 + 1/4 + ... + 1/2n).\n-/", "formal_statement": "theorem canada1998_p3 (n : \u2115) (hn : 2 \u2264 n) :\n (1/(n:\u211d)) * \u2211 i \u2208 Finset.range n, (1/(2 * (i:\u211d) + 2)) <\n (1/((n:\u211d) + 1)) * \u2211 i \u2208 Finset.range n, (1/(2 * (i:\u211d) + 1)) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\nCanadian Mathematical Olympiad 1998, Problem 3\n\nLet n be a natural number such that n \u2265 2. Show that\n\n (1/(n + 1))(1 + 1/3 + ... + 1/(2n - 1)) > (1/n)(1/2 + 1/4 + ... + 1/2n).\n-/\ntheorem canada1998_p3 (n : \u2115) (hn : 2 \u2264 n) :\n (1/(n:\u211d)) * \u2211 i \u2208 Finset.range n, (1/(2 * (i:\u211d) + 2)) <\n (1/((n:\u211d) + 1)) * \u2211 i \u2208 Finset.range n, (1/(2 * (i:\u211d) + 1)) := by sorry", "category": "algebra"} {"name": "Imo2010P3", "solved": false, "tags": ["algebra"], "problem_id": "Imo2010P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2010, Problem 3\n\nDetermine all functions g : \u2124>0 \u2192 \u2124>0 such that\n\n (g(m) + n)(g(n) + m)\n\nis always a perfect square.\n-/", "formal_statement": "abbrev PosInt : Type := { x : \u2124 // 0 < x }\n\nnotation \"\u2124>0\" => PosInt\n\nabbrev SolutionSet : Set (\u2124>0 \u2192 \u2124>0) := { f | f = id \u2228 \u2203 c, \u2200 x, f x = x + c }\n\ntheorem imo2010_p3 (g : \u2124>0 \u2192 \u2124>0) :\n g \u2208 SolutionSet \u2194 \u2200 m n, IsSquare ((g m + n) * (g n + m)) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2010, Problem 3\n\nDetermine all functions g : \u2124>0 \u2192 \u2124>0 such that\n\n (g(m) + n)(g(n) + m)\n\nis always a perfect square.\n-/\nabbrev PosInt : Type := { x : \u2124 // 0 < x }\n\nnotation \"\u2124>0\" => PosInt\n\nabbrev SolutionSet : Set (\u2124>0 \u2192 \u2124>0) := { f | f = id \u2228 \u2203 c, \u2200 x, f x = x + c }\n\ntheorem imo2010_p3 (g : \u2124>0 \u2192 \u2124>0) :\n g \u2208 SolutionSet \u2194 \u2200 m n, IsSquare ((g m + n) * (g n + m)) := by sorry", "category": "algebra"} {"name": "Imo2021P1", "solved": true, "tags": ["algebra"], "problem_id": "Imo2021P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2021, Problem 1\n\nLet `n\u2265100` be an integer. Ivan writes the numbers `n, n+1,..., 2n` each on different cards.\nHe then shuffles these `n+1` cards, and divides them into two piles. Prove that at least one\nof the piles contains two cards such that the sum of their numbers is a perfect square.\n-/", "formal_statement": "theorem imo2021_p1 :\n \u2200 n : \u2115, 100 \u2264 n \u2192 \u2200 (A) (_ : A \u2286 Finset.Icc n (2 * n)),\n (\u2203 (a : _) (_ : a \u2208 A) (b : _) (_ : b \u2208 A), a \u2260 b \u2227 \u2203 k : \u2115, a + b = k ^ 2) \u2228\n \u2203 (a : _) (_ : a \u2208 Finset.Icc n (2 * n) \\ A) (b : _) (_ : b \u2208 Finset.Icc n (2 * n) \\ A),\n a \u2260 b \u2227 \u2203 k : \u2115, a + b = k ^ 2 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2021, Problem 1\n\nLet `n\u2265100` be an integer. Ivan writes the numbers `n, n+1,..., 2n` each on different cards.\nHe then shuffles these `n+1` cards, and divides them into two piles. Prove that at least one\nof the piles contains two cards such that the sum of their numbers is a perfect square.\n-/\ntheorem imo2021_p1 :\n \u2200 n : \u2115, 100 \u2264 n \u2192 \u2200 (A) (_ : A \u2286 Finset.Icc n (2 * n)),\n (\u2203 (a : _) (_ : a \u2208 A) (b : _) (_ : b \u2208 A), a \u2260 b \u2227 \u2203 k : \u2115, a + b = k ^ 2) \u2228\n \u2203 (a : _) (_ : a \u2208 Finset.Icc n (2 * n) \\ A) (b : _) (_ : b \u2208 Finset.Icc n (2 * n) \\ A),\n a \u2260 b \u2227 \u2203 k : \u2115, a + b = k ^ 2 := by sorry", "category": "algebra"} {"name": "Usa2017P5", "solved": false, "tags": ["combinatorics"], "problem_id": "Usa2017P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 2017, Problem 5\n\nDetermine the set of positive real numbers c such that there exists\na labeling of the lattice points in \u2124\u00b2 with positive integers for which:\n\n 1. only finitely many distinct labels occur, and\n 2. for each label i, the distance between any two points labeled i\n is at most c\u2071.\n-/", "formal_statement": "abbrev solution_set : Set \u211d := {c : \u211d | 0 < c \u2227 c < Real.sqrt 2}\n\nnoncomputable def _dist : \u2124 \u00d7 \u2124 \u2192 \u2124 \u00d7 \u2124 \u2192 \u211d\n| \u27e8x1, y1\u27e9, \u27e8x2, y2\u27e9 => Real.sqrt ((x2 - x1)^2 + (y2 - y1)^2)\n\ntheorem usa2017_p5 (c : \u211d) :\n c \u2208 solution_set \u2194\n (0 < c \u2227\n \u2203 l : \u2124 \u00d7 \u2124 \u2192 \u2115,\n (Set.range l).Finite \u2227\n (\u2200 p, 0 < l p) \u2227\n \u2200 {p1 p2}, p1 \u2260 p2 \u2192 (l p1 = l p2) \u2192\n _dist (l p1) (l p2) \u2264 c ^ (l p1)) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 2017, Problem 5\n\nDetermine the set of positive real numbers c such that there exists\na labeling of the lattice points in \u2124\u00b2 with positive integers for which:\n\n 1. only finitely many distinct labels occur, and\n 2. for each label i, the distance between any two points labeled i\n is at most c\u2071.\n-/\nabbrev solution_set : Set \u211d := {c : \u211d | 0 < c \u2227 c < Real.sqrt 2}\n\nnoncomputable def _dist : \u2124 \u00d7 \u2124 \u2192 \u2124 \u00d7 \u2124 \u2192 \u211d\n| \u27e8x1, y1\u27e9, \u27e8x2, y2\u27e9 => Real.sqrt ((x2 - x1)^2 + (y2 - y1)^2)\n\ntheorem usa2017_p5 (c : \u211d) :\n c \u2208 solution_set \u2194\n (0 < c \u2227\n \u2203 l : \u2124 \u00d7 \u2124 \u2192 \u2115,\n (Set.range l).Finite \u2227\n (\u2200 p, 0 < l p) \u2227\n \u2200 {p1 p2}, p1 \u2260 p2 \u2192 (l p1 = l p2) \u2192\n _dist (l p1) (l p2) \u2264 c ^ (l p1)) := by sorry", "category": "combinatorics"} {"name": "Imo2014P4", "solved": false, "tags": ["geometry"], "problem_id": "Imo2014P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2014, Problem 4\n\nLet P and Q be on segment BC of an acute triangle ABC such that\n\u2220PAB = \u2220BCA and \u2220CAQ = \u2220ABC. Let M and N be points on lines AB\nand AQ, respectively, such that P is the midpoint of AM and Q\nis the midpoint of AN. Prove that BM and CN meet on the\ncircumcircle of triangle ABC.\n-/", "formal_statement": "/- special open -/ open EuclideanGeometry\n\n\n\n\n\n\ntheorem imo2014_p4\n (A B C P Q M N : EuclideanSpace \u211d (Fin 2))\n (hABC : AffineIndependent \u211d ![A, B, C])\n (acuteA : \u2220 C A B < Real.pi / 2)\n (acuteB : \u2220 A B C < Real.pi / 2)\n (acuteC : \u2220 B C A < Real.pi / 2)\n (hP : Sbtw \u211d P B C)\n (hQ : Sbtw \u211d Q B C)\n (hPAB : \u2220 P A B = \u2220 B C A)\n (hCAQ : \u2220 C A Q = \u2220 A B C)\n (hM : M \u2208 line[\u211d, A, M])\n (hN : Q \u2208 line[\u211d, A, N])\n (hPAM : P = midpoint \u211d A M)\n (hQAN : Q = midpoint \u211d A N)\n : let ABC : Affine.Triangle _ _ := \u27e8![A, B, C], hABC\u27e9\n let D := (line[\u211d, B, M] : Set _) \u2229 (line[\u211d, C, N] : Set (EuclideanSpace \u211d (Fin 2)))\n Set.Nonempty D \u2227 D \u2286 Affine.Simplex.circumsphere ABC := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2014, Problem 4\n\nLet P and Q be on segment BC of an acute triangle ABC such that\n\u2220PAB = \u2220BCA and \u2220CAQ = \u2220ABC. Let M and N be points on lines AB\nand AQ, respectively, such that P is the midpoint of AM and Q\nis the midpoint of AN. Prove that BM and CN meet on the\ncircumcircle of triangle ABC.\n-/\n/- special open -/ open EuclideanGeometry\n\n\n\n\n\n\ntheorem imo2014_p4\n (A B C P Q M N : EuclideanSpace \u211d (Fin 2))\n (hABC : AffineIndependent \u211d ![A, B, C])\n (acuteA : \u2220 C A B < Real.pi / 2)\n (acuteB : \u2220 A B C < Real.pi / 2)\n (acuteC : \u2220 B C A < Real.pi / 2)\n (hP : Sbtw \u211d P B C)\n (hQ : Sbtw \u211d Q B C)\n (hPAB : \u2220 P A B = \u2220 B C A)\n (hCAQ : \u2220 C A Q = \u2220 A B C)\n (hM : M \u2208 line[\u211d, A, M])\n (hN : Q \u2208 line[\u211d, A, N])\n (hPAM : P = midpoint \u211d A M)\n (hQAN : Q = midpoint \u211d A N)\n : let ABC : Affine.Triangle _ _ := \u27e8![A, B, C], hABC\u27e9\n let D := (line[\u211d, B, M] : Set _) \u2229 (line[\u211d, C, N] : Set (EuclideanSpace \u211d (Fin 2)))\n Set.Nonempty D \u2227 D \u2286 Affine.Simplex.circumsphere ABC := by sorry", "category": "geometry"} {"name": "Russia1998P42", "solved": true, "tags": ["algebra"], "problem_id": "Russia1998P42", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n Russian Mathematical Olympiad 1998, problem 42\n\n A binary operation \u22c6 on real numbers has the property that\n (a \u22c6 b) \u22c6 c = a + b + c.\n\n Prove that a \u22c6 b = a + b.\n\n-/", "formal_statement": "variable (star : \u211d \u2192 \u211d \u2192 \u211d)\n\nlocal infixl:80 \" \u22c6 \" => star\n\ntheorem russia1998_p42\n (stardef : \u2200 a b c, a \u22c6 b \u22c6 c = a + b + c) :\n (\u2200 a b, a \u22c6 b = a + b) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n Russian Mathematical Olympiad 1998, problem 42\n\n A binary operation \u22c6 on real numbers has the property that\n (a \u22c6 b) \u22c6 c = a + b + c.\n\n Prove that a \u22c6 b = a + b.\n\n-/\nvariable (star : \u211d \u2192 \u211d \u2192 \u211d)\n\nlocal infixl:80 \" \u22c6 \" => star\n\ntheorem russia1998_p42\n (stardef : \u2200 a b c, a \u22c6 b \u22c6 c = a + b + c) :\n (\u2200 a b, a \u22c6 b = a + b) := by sorry", "category": "algebra"} {"name": "Imo2024P2", "solved": true, "tags": ["number theory"], "problem_id": "Imo2024P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2024, Problem 2\n\nDetermine all pairs (a,b) of positive integers for which there exist positive integers\ng and N such that\n\n gcd(a\u207f + b, b\u207f + a), n = 1, 2, ...\n\nholds for all integers n \u2265 N.\n-/", "formal_statement": "abbrev solutionSet : Set (\u2115+ \u00d7 \u2115+) := {(1, 1)}\n\ntheorem imo2024_p2 (a b : \u2115+) :\n (a, b) \u2208 solutionSet \u2194\n \u2203 g N : \u2115+,\n \u2200 n : \u2115, N \u2264 n \u2192 Nat.gcd (a^n + b) (b^n + a) = g := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2024, Problem 2\n\nDetermine all pairs (a,b) of positive integers for which there exist positive integers\ng and N such that\n\n gcd(a\u207f + b, b\u207f + a), n = 1, 2, ...\n\nholds for all integers n \u2265 N.\n-/\nabbrev solutionSet : Set (\u2115+ \u00d7 \u2115+) := {(1, 1)}\n\ntheorem imo2024_p2 (a b : \u2115+) :\n (a, b) \u2208 solutionSet \u2194\n \u2203 g N : \u2115+,\n \u2200 n : \u2115, N \u2264 n \u2192 Nat.gcd (a^n + b) (b^n + a) = g := by sorry", "category": "number theory"} {"name": "Usa1974P2", "solved": true, "tags": ["algebra", "inequality"], "problem_id": "Usa1974P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 1974, Problem 2\n\nProve that if a, b, and c are positive real numbers, then\na^a * b^b * c^c \u2265 (abc)^((a+b+c)/3)\n-/", "formal_statement": "theorem usa1974_p2 :\n \u2200 (a b c : \u211d), a > 0 \u2192 b > 0 \u2192 c > 0 \u2192 a^a * b^b * c^c \u2265 (a*b*c)^((a+b+c)/3) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 1974, Problem 2\n\nProve that if a, b, and c are positive real numbers, then\na^a * b^b * c^c \u2265 (abc)^((a+b+c)/3)\n-/\ntheorem usa1974_p2 :\n \u2200 (a b c : \u211d), a > 0 \u2192 b > 0 \u2192 c > 0 \u2192 a^a * b^b * c^c \u2265 (a*b*c)^((a+b+c)/3) := by sorry", "category": "algebra"} {"name": "Imo1961P1a", "problem_id": "Imo1961P1a", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1961, Problem 1.\n\nGiven constants a and b, solve the system of equations\n\n x + y + z = a\n x\u00b2 + y\u00b2 + z\u00b2 = b\u00b2\n xy = z\u00b2\n\nfor x,y,z. Give the conditions that a and b must satisfy so that\nthe solutions x,y,z are distinct positive numbers.\n-/", "formal_statement": "abbrev IsSolution (a b x y z : \u211d) : Prop :=\n x + y + z = a \u2227\n x^2 + y^2 + z^2 = b^2 \u2227\n x * y = z^2\n\nabbrev xyz_of_ab (a b : \u211d) : Set (\u211d \u00d7 \u211d \u00d7 \u211d) :=\n { p | let \u27e8x,y,z\u27e9 := p\n z = (a^2 - b^2) / (2 * a) \u2227\n \u2200 m, (m - x) * (m - y) =\n m^2 - (a^2 + b^2) / (2 * a) * m + ((a^2 - b^2) / (2 * a))^2 }\n\ntheorem imo1961_p1a (a b x y z : \u211d) :\n \u27e8x,y,z\u27e9 \u2208 xyz_of_ab a b \u2194 IsSolution a b x y z := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1961, Problem 1.\n\nGiven constants a and b, solve the system of equations\n\n x + y + z = a\n x\u00b2 + y\u00b2 + z\u00b2 = b\u00b2\n xy = z\u00b2\n\nfor x,y,z. Give the conditions that a and b must satisfy so that\nthe solutions x,y,z are distinct positive numbers.\n-/\nabbrev IsSolution (a b x y z : \u211d) : Prop :=\n x + y + z = a \u2227\n x^2 + y^2 + z^2 = b^2 \u2227\n x * y = z^2\n\nabbrev xyz_of_ab (a b : \u211d) : Set (\u211d \u00d7 \u211d \u00d7 \u211d) :=\n { p | let \u27e8x,y,z\u27e9 := p\n z = (a^2 - b^2) / (2 * a) \u2227\n \u2200 m, (m - x) * (m - y) =\n m^2 - (a^2 + b^2) / (2 * a) * m + ((a^2 - b^2) / (2 * a))^2 }\n\ntheorem imo1961_p1a (a b x y z : \u211d) :\n \u27e8x,y,z\u27e9 \u2208 xyz_of_ab a b \u2194 IsSolution a b x y z := by sorry", "tags": ["algebra"], "solved": false, "category": "algebra"} {"name": "Usa2008P1", "solved": false, "tags": ["number theory"], "problem_id": "Usa2008P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 2008, Problem 1\n\nProve that for each positive integer n, there are pairwise relatively prime\nintegers k\u2080,k\u2081,...,k\u2099, all strictly greater than 1, such that k\u2080k\u2081...k\u2099 - 1\nis a product of two consecutive integers.\n-/", "formal_statement": "theorem usa2008_p1 (n : \u2115) (hn : 0 < n) :\n \u2203 k : Fin (n + 1) \u2192 \u2115,\n (\u2200 i, 1 < k i) \u2227\n (\u2200 i j, i \u2260 j \u2192 Nat.Coprime (k i) (k j)) \u2227\n \u2203 m, \u220f i : Fin (n + 1), k i = 1 + m * (m + 1) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 2008, Problem 1\n\nProve that for each positive integer n, there are pairwise relatively prime\nintegers k\u2080,k\u2081,...,k\u2099, all strictly greater than 1, such that k\u2080k\u2081...k\u2099 - 1\nis a product of two consecutive integers.\n-/\ntheorem usa2008_p1 (n : \u2115) (hn : 0 < n) :\n \u2203 k : Fin (n + 1) \u2192 \u2115,\n (\u2200 i, 1 < k i) \u2227\n (\u2200 i j, i \u2260 j \u2192 Nat.Coprime (k i) (k j)) \u2227\n \u2203 m, \u220f i : Fin (n + 1), k i = 1 + m * (m + 1) := by sorry", "category": "number theory"} {"name": "Usa2023P4", "solved": false, "tags": ["number theory"], "problem_id": "Usa2023P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 2023, Problem 4\n\nPositive integers a and N are fixed, and N positive integers are written on\na blackboard. Alice and Bob play the following game. On Alice's turn, she must\nreplace some integer n on the board with n + a, and on Bob's turn he must\nreplace some even integer n on the board with n/2. Alice goes first and they\nalternate turns. If Bob has no valid moves on his turn the game ends.\n\nAfter analyzing the N integers on the board, Bob realizes that, regardless of\nwhat moves Alices makes, he will be able to force the game to end eventually.\nShow that, in fact, no matter what either player does, for these values of a and N\nand these particular N integers, the game is guaranteed to end, regardless of\neither player's moves.\n-/", "formal_statement": "inductive Player where\n| Alice : Player\n| Bob : Player\n\nabbrev Blackboard (n : \u2115) := Fin n \u2192 \u2115+\n\nstructure State (n : \u2115) where\n board : Blackboard n\n turn : Player\n\nlemma halve_even (x : \u2115+) (he : Even x.val) : 0 < x.val / 2 := by\n obtain \u27e8x, hx\u27e9 := x\n obtain \u27e8t, ht\u27e9 := he\n dsimp at *; omega\n\ndef valid_moves (a : \u2115+) (n : \u2115) : State n \u2192 Set (State n)\n| \u27e8b, .Alice\u27e9 =>\n {s | \u2203 i : Fin n, s = \u27e8Function.update b i (b i + a), .Bob\u27e9}\n| \u27e8b, .Bob\u27e9 =>\n {s | \u2203 i : Fin n,\n \u2203 he : Even (b i).val,\n s = \u27e8Function.update b i \u27e8b i / 2, halve_even _ he\u27e9,\n .Alice\u27e9}\n\ninductive BobCanForceEnd (a : \u2115+) (n : \u2115) : State n \u2192 Prop where\n| BaseCase (b : Blackboard n) :\n valid_moves a n \u27e8b, .Bob\u27e9 = \u2205 \u2192 BobCanForceEnd a n \u27e8b, .Bob\u27e9\n| BobTurn (b : Blackboard n) (m : State n) :\n (m \u2208 valid_moves a n \u27e8b, .Bob\u27e9) \u2192 BobCanForceEnd a n m \u2192\n BobCanForceEnd a n \u27e8b, .Bob\u27e9\n| AliceTurn (b : Blackboard n) :\n (\u2200 m \u2208 valid_moves a n \u27e8b, .Alice\u27e9, BobCanForceEnd a n m) \u2192\n BobCanForceEnd a n \u27e8b, .Alice\u27e9\n\ninductive EndInevitable (a : \u2115+) (n : \u2115) : State n \u2192 Prop where\n| BaseCase (s : State n) : valid_moves a n s = \u2205 \u2192 EndInevitable a n s\n| Step (s : State n)\n (h : \u2200 m \u2208 valid_moves a n s, EndInevitable a n m) :\n EndInevitable a n s\n\ntheorem usa2023_p4 (a : \u2115+) (N : \u2115) (hN : 0 < N) (b0 : Blackboard N)\n (he : BobCanForceEnd a N \u27e8b0, .Alice\u27e9) :\n EndInevitable a N \u27e8b0, .Alice\u27e9 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 2023, Problem 4\n\nPositive integers a and N are fixed, and N positive integers are written on\na blackboard. Alice and Bob play the following game. On Alice's turn, she must\nreplace some integer n on the board with n + a, and on Bob's turn he must\nreplace some even integer n on the board with n/2. Alice goes first and they\nalternate turns. If Bob has no valid moves on his turn the game ends.\n\nAfter analyzing the N integers on the board, Bob realizes that, regardless of\nwhat moves Alices makes, he will be able to force the game to end eventually.\nShow that, in fact, no matter what either player does, for these values of a and N\nand these particular N integers, the game is guaranteed to end, regardless of\neither player's moves.\n-/\ninductive Player where\n| Alice : Player\n| Bob : Player\n\nabbrev Blackboard (n : \u2115) := Fin n \u2192 \u2115+\n\nstructure State (n : \u2115) where\n board : Blackboard n\n turn : Player\n\nlemma halve_even (x : \u2115+) (he : Even x.val) : 0 < x.val / 2 := by\n obtain \u27e8x, hx\u27e9 := x\n obtain \u27e8t, ht\u27e9 := he\n dsimp at *; omega\n\ndef valid_moves (a : \u2115+) (n : \u2115) : State n \u2192 Set (State n)\n| \u27e8b, .Alice\u27e9 =>\n {s | \u2203 i : Fin n, s = \u27e8Function.update b i (b i + a), .Bob\u27e9}\n| \u27e8b, .Bob\u27e9 =>\n {s | \u2203 i : Fin n,\n \u2203 he : Even (b i).val,\n s = \u27e8Function.update b i \u27e8b i / 2, halve_even _ he\u27e9,\n .Alice\u27e9}\n\ninductive BobCanForceEnd (a : \u2115+) (n : \u2115) : State n \u2192 Prop where\n| BaseCase (b : Blackboard n) :\n valid_moves a n \u27e8b, .Bob\u27e9 = \u2205 \u2192 BobCanForceEnd a n \u27e8b, .Bob\u27e9\n| BobTurn (b : Blackboard n) (m : State n) :\n (m \u2208 valid_moves a n \u27e8b, .Bob\u27e9) \u2192 BobCanForceEnd a n m \u2192\n BobCanForceEnd a n \u27e8b, .Bob\u27e9\n| AliceTurn (b : Blackboard n) :\n (\u2200 m \u2208 valid_moves a n \u27e8b, .Alice\u27e9, BobCanForceEnd a n m) \u2192\n BobCanForceEnd a n \u27e8b, .Alice\u27e9\n\ninductive EndInevitable (a : \u2115+) (n : \u2115) : State n \u2192 Prop where\n| BaseCase (s : State n) : valid_moves a n s = \u2205 \u2192 EndInevitable a n s\n| Step (s : State n)\n (h : \u2200 m \u2208 valid_moves a n s, EndInevitable a n m) :\n EndInevitable a n s\n\ntheorem usa2023_p4 (a : \u2115+) (N : \u2115) (hN : 0 < N) (b0 : Blackboard N)\n (he : BobCanForceEnd a N \u27e8b0, .Alice\u27e9) :\n EndInevitable a N \u27e8b0, .Alice\u27e9 := by sorry", "category": "number theory"} {"name": "Imo2020P5", "solved": false, "tags": ["algebra"], "problem_id": "Imo2020P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2020, Problem 5\n\nA deck of n > 1 cards is given. A positive integer is written on\neach card. The deck has the property that the arithmetic mean of\nthe numbers on each pair of cards is also the geometric mean of\nthe numbers on some collection of one or more cards.\n\nFor which n does it follow that the numbers on the cards are all equal?\n-/", "formal_statement": "abbrev SolutionSet : Set \u2115 := {n : \u2115 | n > 1}\n\nnoncomputable def geometric_mean {\u03b1 : Type} (f : \u03b1 \u2192 \u2115+) (s : Finset \u03b1) : \u211d :=\n (\u220f i \u2208 s, (f i : \u211d))^((1:\u211d)/s.card)\n\ntheorem imo2020_p5 (n : \u2115) :\n n \u2208 SolutionSet \u2194\n (1 < n \u2227\n (\u2200 \u03b1 : Type, [Fintype \u03b1] \u2192 Fintype.card \u03b1 = n \u2192\n \u2200 f : \u03b1 \u2192 \u2115+,\n (Pairwise fun a b \u21a6 \u2203 s : Finset \u03b1,\n s.Nonempty \u2227 geometric_mean f s = (((f a):\u211d) + f b) / 2)\n \u2192 \u2203 y, \u2200 a, f a = y )) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2020, Problem 5\n\nA deck of n > 1 cards is given. A positive integer is written on\neach card. The deck has the property that the arithmetic mean of\nthe numbers on each pair of cards is also the geometric mean of\nthe numbers on some collection of one or more cards.\n\nFor which n does it follow that the numbers on the cards are all equal?\n-/\nabbrev SolutionSet : Set \u2115 := {n : \u2115 | n > 1}\n\nnoncomputable def geometric_mean {\u03b1 : Type} (f : \u03b1 \u2192 \u2115+) (s : Finset \u03b1) : \u211d :=\n (\u220f i \u2208 s, (f i : \u211d))^((1:\u211d)/s.card)\n\ntheorem imo2020_p5 (n : \u2115) :\n n \u2208 SolutionSet \u2194\n (1 < n \u2227\n (\u2200 \u03b1 : Type, [Fintype \u03b1] \u2192 Fintype.card \u03b1 = n \u2192\n \u2200 f : \u03b1 \u2192 \u2115+,\n (Pairwise fun a b \u21a6 \u2203 s : Finset \u03b1,\n s.Nonempty \u2227 geometric_mean f s = (((f a):\u211d) + f b) / 2)\n \u2192 \u2203 y, \u2200 a, f a = y )) := by sorry", "category": "algebra"} {"name": "Imo1998P2", "solved": true, "tags": ["combinatorics"], "problem_id": "Imo1998P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1998, Problem 2\nIn a competition, there are `a` contestants and `b` judges, where `b \u2265 3` is an odd integer. Each\njudge rates each contestant as either \"pass\" or \"fail\". Suppose `k` is a number such that, for any\ntwo judges, their ratings coincide for at most `k` contestants.\n\nProve that `k / a \u2265 (b - 1) / (2b)`.\n-/", "formal_statement": "/- special open -/ open Classical\n\n\n\n\n\nvariable {C J : Type*} (r : C \u2192 J \u2192 Prop)\n\n\nnoncomputable section\n\n/-- An ordered pair of judges. -/\nabbrev JudgePair (J : Type*) :=\n J \u00d7 J\n\n/-- The first judge from an ordered pair of judges. -/\nabbrev JudgePair.judge\u2081 : JudgePair J \u2192 J :=\n Prod.fst\n\n/-- The second judge from an ordered pair of judges. -/\nabbrev JudgePair.judge\u2082 : JudgePair J \u2192 J :=\n Prod.snd\n\n/-- The proposition that the judges in an ordered pair are distinct. -/\nabbrev JudgePair.Distinct (p : JudgePair J) :=\n p.judge\u2081 \u2260 p.judge\u2082\n\n/-- The proposition that the judges in an ordered pair agree about a contestant's rating. -/\nabbrev JudgePair.Agree (p : JudgePair J) (c : C) :=\n r c p.judge\u2081 \u2194 r c p.judge\u2082\n\n/-- The set of contestants on which two judges agree. -/\ndef agreedContestants [Fintype C] (p : JudgePair J) : Finset C :=\n Finset.univ.filter fun c => p.Agree r c\n\n\ntheorem imo1998_p2 [Fintype J] [Fintype C] (a b k : \u2115) (hC : Fintype.card C = a)\n (hJ : Fintype.card J = b) (ha : 0 < a) (hb : Odd b)\n (hk : \u2200 p : JudgePair J, p.Distinct \u2192 (agreedContestants r p).card \u2264 k) :\n (b - 1 : \u211a) / (2 * b) \u2264 k / a := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1998, Problem 2\nIn a competition, there are `a` contestants and `b` judges, where `b \u2265 3` is an odd integer. Each\njudge rates each contestant as either \"pass\" or \"fail\". Suppose `k` is a number such that, for any\ntwo judges, their ratings coincide for at most `k` contestants.\n\nProve that `k / a \u2265 (b - 1) / (2b)`.\n-/\n/- special open -/ open Classical\n\n\n\n\n\nvariable {C J : Type*} (r : C \u2192 J \u2192 Prop)\n\n\nnoncomputable section\n\n/-- An ordered pair of judges. -/\nabbrev JudgePair (J : Type*) :=\n J \u00d7 J\n\n/-- The first judge from an ordered pair of judges. -/\nabbrev JudgePair.judge\u2081 : JudgePair J \u2192 J :=\n Prod.fst\n\n/-- The second judge from an ordered pair of judges. -/\nabbrev JudgePair.judge\u2082 : JudgePair J \u2192 J :=\n Prod.snd\n\n/-- The proposition that the judges in an ordered pair are distinct. -/\nabbrev JudgePair.Distinct (p : JudgePair J) :=\n p.judge\u2081 \u2260 p.judge\u2082\n\n/-- The proposition that the judges in an ordered pair agree about a contestant's rating. -/\nabbrev JudgePair.Agree (p : JudgePair J) (c : C) :=\n r c p.judge\u2081 \u2194 r c p.judge\u2082\n\n/-- The set of contestants on which two judges agree. -/\ndef agreedContestants [Fintype C] (p : JudgePair J) : Finset C :=\n Finset.univ.filter fun c => p.Agree r c\n\n\ntheorem imo1998_p2 [Fintype J] [Fintype C] (a b k : \u2115) (hC : Fintype.card C = a)\n (hJ : Fintype.card J = b) (ha : 0 < a) (hb : Odd b)\n (hk : \u2200 p : JudgePair J, p.Distinct \u2192 (agreedContestants r p).card \u2264 k) :\n (b - 1 : \u211a) / (2 * b) \u2264 k / a := by sorry", "category": "combinatorics"} {"name": "Imo1983P1", "solved": true, "tags": ["algebra"], "problem_id": "Imo1983P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1983, Problem 1\n\nLet \u211d+ be the set of positive real numbers.\n\nDetermine all functions f : \u211d+ \u2192 \u211d+ which satisfy:\n i) f(xf(y)) = yf(x) for all x y \u2208 \u211d+.\n ii) f(x) \u2192 0 as x \u2192 \u221e.\n-/", "formal_statement": "abbrev PosReal : Type := { x : \u211d // 0 < x }\n\nnotation \"\u211d+\" => PosReal\n\nabbrev SolutionSet : Set (\u211d+ \u2192 \u211d+) := { fun x \u21a6 1 / x }\n\ntheorem imo1983_p1 (f : \u211d+ \u2192 \u211d+) :\n f \u2208 SolutionSet \u2194\n ((\u2200 x y, f (x * f y) = y * f x) \u2227\n (\u2200 \u03b5, \u2203 x, \u2200 y, x < y \u2192 f y < \u03b5)) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1983, Problem 1\n\nLet \u211d+ be the set of positive real numbers.\n\nDetermine all functions f : \u211d+ \u2192 \u211d+ which satisfy:\n i) f(xf(y)) = yf(x) for all x y \u2208 \u211d+.\n ii) f(x) \u2192 0 as x \u2192 \u221e.\n-/\nabbrev PosReal : Type := { x : \u211d // 0 < x }\n\nnotation \"\u211d+\" => PosReal\n\nabbrev SolutionSet : Set (\u211d+ \u2192 \u211d+) := { fun x \u21a6 1 / x }\n\ntheorem imo1983_p1 (f : \u211d+ \u2192 \u211d+) :\n f \u2208 SolutionSet \u2194\n ((\u2200 x y, f (x * f y) = y * f x) \u2227\n (\u2200 \u03b5, \u2203 x, \u2200 y, x < y \u2192 f y < \u03b5)) := by sorry", "category": "algebra"} {"name": "Imo1999P6", "solved": true, "tags": ["algebra"], "problem_id": "Imo1999P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1999, Problem 6\n\nDetermine all functions f : \u211d \u2192 \u211d such that\n\n f(x - f(y)) = f(f(y)) + xf(y) + f(x) - 1\n\nfor all x,y \u2208 \u211d.\n-/", "formal_statement": "abbrev SolutionSet : Set (\u211d \u2192 \u211d) := { fun x \u21a6 1 - x^2 / 2 }\n\ntheorem imo1999_p6 (f : \u211d \u2192 \u211d) :\n f \u2208 SolutionSet \u2194\n \u2200 x y, f (x - f y) = f (f y) + x * f y + f x - 1 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1999, Problem 6\n\nDetermine all functions f : \u211d \u2192 \u211d such that\n\n f(x - f(y)) = f(f(y)) + xf(y) + f(x) - 1\n\nfor all x,y \u2208 \u211d.\n-/\nabbrev SolutionSet : Set (\u211d \u2192 \u211d) := { fun x \u21a6 1 - x^2 / 2 }\n\ntheorem imo1999_p6 (f : \u211d \u2192 \u211d) :\n f \u2208 SolutionSet \u2194\n \u2200 x y, f (x - f y) = f (f y) + x * f y + f x - 1 := by sorry", "category": "algebra"} {"name": "Imo1987P6", "solved": true, "tags": ["number theory"], "problem_id": "Imo1987P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1987, Problem 6\n\nLet $n$ be an integer greater than or equal to 2. Prove that\nif $k^2 + k + n$ is prime for all integers $k$ such that\n$0 <= k <= \\sqrt{n/3}$, then $k^2 + k + n$ is prime for all\nintegers $k$ such that $0 <= k <= n - 2$.\n-/", "formal_statement": "theorem imo1987_p6\n (p : \u2115)\n (h\u2081 : \u2200 k : \u2115, k \u2264 Nat.floor (Real.sqrt ((p:\u211d) / 3)) \u2192 Nat.Prime (k^2 + k + p)) :\n \u2200 i \u2264 p - 2, Nat.Prime (i^2 + i + p) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1987, Problem 6\n\nLet $n$ be an integer greater than or equal to 2. Prove that\nif $k^2 + k + n$ is prime for all integers $k$ such that\n$0 <= k <= \\sqrt{n/3}$, then $k^2 + k + n$ is prime for all\nintegers $k$ such that $0 <= k <= n - 2$.\n-/\ntheorem imo1987_p6\n (p : \u2115)\n (h\u2081 : \u2200 k : \u2115, k \u2264 Nat.floor (Real.sqrt ((p:\u211d) / 3)) \u2192 Nat.Prime (k^2 + k + p)) :\n \u2200 i \u2264 p - 2, Nat.Prime (i^2 + i + p) := by sorry", "category": "number theory"} {"name": "Usa1983P5", "solved": false, "tags": ["number theory"], "problem_id": "Usa1983P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 1983, Problem 5\n\nConsider an open interval of length 1/2 on the real number line, where\nn is a positive integer. Prove that the number of irreducible fractions\np/q, with 1 \u2264 q \u2264 n, contained in the given interval is at most (n + 1) / 2.\n-/", "formal_statement": "theorem usa1983_p5 (x : \u211d) (n : \u2115) (hn : 0 < n) :\n let fracs := { q : \u211a | q.den \u2264 n \u2227 \u2191q \u2208 Set.Ioo x (x + 1 / n)}\n fracs.Finite \u2227 fracs.ncard \u2264 (n + 1) / 2 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 1983, Problem 5\n\nConsider an open interval of length 1/2 on the real number line, where\nn is a positive integer. Prove that the number of irreducible fractions\np/q, with 1 \u2264 q \u2264 n, contained in the given interval is at most (n + 1) / 2.\n-/\ntheorem usa1983_p5 (x : \u211d) (n : \u2115) (hn : 0 < n) :\n let fracs := { q : \u211a | q.den \u2264 n \u2227 \u2191q \u2208 Set.Ioo x (x + 1 / n)}\n fracs.Finite \u2227 fracs.ncard \u2264 (n + 1) / 2 := by sorry", "category": "number theory"} {"name": "India1998P1b", "problem_id": "India1998P1b", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\nIndian Mathematical Olympiad 1998, problem 1\n\n(b) If an integer n is such that 7n is of the form a\u00b2 + 3b\u00b2, prove that n is also of that form.\n-/", "formal_statement": "theorem india1998_p1b (n a b : \u2124) (hn : a^2 + 3 * b^2 = 7 * n) :\n (\u2203 a b : \u2124, a^2 + 3 * b^2 = n) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\nIndian Mathematical Olympiad 1998, problem 1\n\n(b) If an integer n is such that 7n is of the form a\u00b2 + 3b\u00b2, prove that n is also of that form.\n-/\ntheorem india1998_p1b (n a b : \u2124) (hn : a^2 + 3 * b^2 = 7 * n) :\n (\u2203 a b : \u2124, a^2 + 3 * b^2 = n) := by sorry", "tags": ["number theory"], "solved": true, "category": "number theory"} {"name": "Poland2016S1P8", "solved": true, "tags": ["number theory"], "problem_id": "Poland2016S1P8", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\nPolish Mathematical Olympiad 2016, Stage 1, Problem 8\nAuthor of the problem: Nguyen Hung Son\nSource of the problem: https://om.sem.edu.pl/static/app_main/problems/om68_1r.pdf\n\nLet a, b, c be integers. Show that there exists a positive integer n, such that\n\n n\u00b3 + an\u00b2 + bn + c\n\nis not a square of any integer.\n-/", "formal_statement": "theorem poland2016_s1_p8 (a b c : \u2124) : \u2203 n : \u2124, n > 0 \u2227 \u00ac IsSquare (n^3 + a * n^2 + b * n + c) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\nPolish Mathematical Olympiad 2016, Stage 1, Problem 8\nAuthor of the problem: Nguyen Hung Son\nSource of the problem: https://om.sem.edu.pl/static/app_main/problems/om68_1r.pdf\n\nLet a, b, c be integers. Show that there exists a positive integer n, such that\n\n n\u00b3 + an\u00b2 + bn + c\n\nis not a square of any integer.\n-/\ntheorem poland2016_s1_p8 (a b c : \u2124) : \u2203 n : \u2124, n > 0 \u2227 \u00ac IsSquare (n^3 + a * n^2 + b * n + c) := by sorry", "category": "number theory"} {"name": "Imo1988P3", "solved": false, "tags": ["algebra"], "problem_id": "Imo1988P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1988, Problem 3\n\nA function $f$ defined on the positive integers (and taking positive integers values) is given by:\nf(1) = 1\nf(3) = 3\nf(2 \\cdot n) = f(n)\nf(4 \\cdot n + 1) = 2 \\cdot f(2 \\cdot n + 1) - f(n)\nf(4 \\cdot n + 3) = 3 \\cdot f(2 \\cdot n + 1) - 2 \\cdot f(n)\nfor all positive integers $n.$\nDetermine with proof the number of positive integers $\\leq 1988$ for which $f(n) = n.$\n-/", "formal_statement": "abbrev solution : \u2115 := 92\n\ntheorem imo1988_p3 (f : \u2115 \u2192 \u2115)\n (h\u2080 : f 1 = 1)\n (h\u2081 : f 3 = 3)\n (h\u2082 : \u2200 n, f (2 * n) = f n)\n (h\u2083 : \u2200 n, f (4 * n + 1) + f n = 2 * f (2 * n + 1))\n (h\u2084 : \u2200 n, f (4 * n + 3) + 2 * f n = 3 * f (2 * n + 1))\n (A: Finset {n | 0 < n \u2227 n \u2264 1988 \u2227 f n = n}) :\n A.card = solution := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1988, Problem 3\n\nA function $f$ defined on the positive integers (and taking positive integers values) is given by:\nf(1) = 1\nf(3) = 3\nf(2 \\cdot n) = f(n)\nf(4 \\cdot n + 1) = 2 \\cdot f(2 \\cdot n + 1) - f(n)\nf(4 \\cdot n + 3) = 3 \\cdot f(2 \\cdot n + 1) - 2 \\cdot f(n)\nfor all positive integers $n.$\nDetermine with proof the number of positive integers $\\leq 1988$ for which $f(n) = n.$\n-/\nabbrev solution : \u2115 := 92\n\ntheorem imo1988_p3 (f : \u2115 \u2192 \u2115)\n (h\u2080 : f 1 = 1)\n (h\u2081 : f 3 = 3)\n (h\u2082 : \u2200 n, f (2 * n) = f n)\n (h\u2083 : \u2200 n, f (4 * n + 1) + f n = 2 * f (2 * n + 1))\n (h\u2084 : \u2200 n, f (4 * n + 3) + 2 * f n = 3 * f (2 * n + 1))\n (A: Finset {n | 0 < n \u2227 n \u2264 1988 \u2227 f n = n}) :\n A.card = solution := by sorry", "category": "algebra"} {"name": "Imo1959P2c", "problem_id": "Imo1959P2c", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1959, Problem 2\n\nFor what real values of x is\n\n \u221a(x+\u221a(2x-1)) + \u221a(x-\u221a(2x-1)) = A,\n\ngiven:\n (a) A = \u221a2\n (b) A = 1\n (c) A = 2,\nwhere only non-negative real numbers are admitted for square roots?\n-/", "formal_statement": "/- special open -/ open Set\n\n\n\n\n\n\ndef IsGood (x A : \u211d) : Prop :=\n sqrt (x + sqrt (2 * x - 1)) + sqrt (x - sqrt (2 * x - 1)) = A \u2227 0 \u2264 2 * x - 1 \u2227\n 0 \u2264 x + sqrt (2 * x - 1) \u2227 0 \u2264 x - sqrt (2 * x - 1)\n\nvariable {x A : \u211d}\n\nabbrev solution_set_two : Set \u211d := { 3 / 2 }\n\ntheorem imo1959_p2c : IsGood x 2 \u2194 x \u2208 solution_set_two := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1959, Problem 2\n\nFor what real values of x is\n\n \u221a(x+\u221a(2x-1)) + \u221a(x-\u221a(2x-1)) = A,\n\ngiven:\n (a) A = \u221a2\n (b) A = 1\n (c) A = 2,\nwhere only non-negative real numbers are admitted for square roots?\n-/\n/- special open -/ open Set\n\n\n\n\n\n\ndef IsGood (x A : \u211d) : Prop :=\n sqrt (x + sqrt (2 * x - 1)) + sqrt (x - sqrt (2 * x - 1)) = A \u2227 0 \u2264 2 * x - 1 \u2227\n 0 \u2264 x + sqrt (2 * x - 1) \u2227 0 \u2264 x - sqrt (2 * x - 1)\n\nvariable {x A : \u211d}\n\nabbrev solution_set_two : Set \u211d := { 3 / 2 }\n\ntheorem imo1959_p2c : IsGood x 2 \u2194 x \u2208 solution_set_two := by sorry", "tags": ["algebra"], "solved": true, "category": "algebra"} {"name": "Imo1996P3", "solved": false, "tags": ["algebra"], "problem_id": "Imo1996P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1996, Problem 3\n\nLet S denote the set of nonnegative integers. Find\nall functions f from S to itself such that\n\n f(m + f(n)) = f(f(m)) + f(n)\n\nfor all m,n in S.\n-/", "formal_statement": "abbrev SolutionSet : Set (\u2115 \u2192 \u2115) := \n {f : \u2115 \u2192 \u2115 | \u2203 (k : \u2115) (n : Fin k \u2192 \u2115), \n (k = 0 \u2227 f = \u03bb _ => 0) \u2228 \n (k > 0 \u2227 \u2200 (q r : \u2115) (h : r < k), f (q * k + r) = q * k + n \u27e8r, h\u27e9 * k)}\n\ntheorem imo1996_p3 (f : \u2115 \u2192 \u2115) :\n f \u2208 SolutionSet \u2194 \u2200 m n, f (m + f n) = f (f m) + f n := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1996, Problem 3\n\nLet S denote the set of nonnegative integers. Find\nall functions f from S to itself such that\n\n f(m + f(n)) = f(f(m)) + f(n)\n\nfor all m,n in S.\n-/\nabbrev SolutionSet : Set (\u2115 \u2192 \u2115) := \n {f : \u2115 \u2192 \u2115 | \u2203 (k : \u2115) (n : Fin k \u2192 \u2115), \n (k = 0 \u2227 f = \u03bb _ => 0) \u2228 \n (k > 0 \u2227 \u2200 (q r : \u2115) (h : r < k), f (q * k + r) = q * k + n \u27e8r, h\u27e9 * k)}\n\ntheorem imo1996_p3 (f : \u2115 \u2192 \u2115) :\n f \u2208 SolutionSet \u2194 \u2200 m n, f (m + f n) = f (f m) + f n := by sorry", "category": "algebra"} {"name": "Imo1986P1", "solved": true, "tags": ["number theory"], "problem_id": "Imo1986P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1986, Problem 1\n\nLet d be any positive integer not equal to 2, 5 or 13.\nShow that one can find distinct a, b in the set {2, 5, 13, d} such that ab - 1\nis not a perfect square.\n-/", "formal_statement": "theorem imo1986_p1 (d : \u2124) (_hdpos : 1 \u2264 d) (h2 : d \u2260 2) (h5 : d \u2260 5) (h13 : d \u2260 13) :\n \u2203 a b :({2, 5, 13, d} : Finset \u2124), (a \u2260 b) \u2227 \u00ac \u2203 z, z^2 = (a * (b : \u2124) - 1) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1986, Problem 1\n\nLet d be any positive integer not equal to 2, 5 or 13.\nShow that one can find distinct a, b in the set {2, 5, 13, d} such that ab - 1\nis not a perfect square.\n-/\ntheorem imo1986_p1 (d : \u2124) (_hdpos : 1 \u2264 d) (h2 : d \u2260 2) (h5 : d \u2260 5) (h13 : d \u2260 13) :\n \u2203 a b :({2, 5, 13, d} : Finset \u2124), (a \u2260 b) \u2227 \u00ac \u2203 z, z^2 = (a * (b : \u2124) - 1) := by sorry", "category": "number theory"} {"name": "Imo1994P1", "solved": true, "tags": ["combinatorics"], "problem_id": "Imo1994P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathmatical Olympiad 1994, Problem 1\n\nLet `m` and `n` be two positive integers.\nLet `a\u2081, a\u2082, ..., a\u2098` be `m` different numbers from the set `{1, 2, ..., n}`\nsuch that for any two indices `i` and `j` with `1 \u2264 i \u2264 j \u2264 m` and `a\u1d62 + a\u2c7c \u2264 n`,\nthere exists an index `k` such that `a\u1d62 + a\u2c7c = a\u2096`.\nShow that `(a\u2081+a\u2082+...+a\u2098)/m \u2265 (n+1)/2`\n-/", "formal_statement": "/- special open -/ open Finset\n\n\n\n\n\n\ntheorem imo1994_p1 (n : \u2115) (m : \u2115) (A : Finset \u2115) (hm : A.card = m + 1)\n (hrange : \u2200 a \u2208 A, 0 < a \u2227 a \u2264 n)\n (hadd : \u2200 a \u2208 A, \u2200 b \u2208 A, a + b \u2264 n \u2192 a + b \u2208 A) :\n (m + 1) * (n + 1) \u2264 2 * \u2211 x \u2208 A, x := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathmatical Olympiad 1994, Problem 1\n\nLet `m` and `n` be two positive integers.\nLet `a\u2081, a\u2082, ..., a\u2098` be `m` different numbers from the set `{1, 2, ..., n}`\nsuch that for any two indices `i` and `j` with `1 \u2264 i \u2264 j \u2264 m` and `a\u1d62 + a\u2c7c \u2264 n`,\nthere exists an index `k` such that `a\u1d62 + a\u2c7c = a\u2096`.\nShow that `(a\u2081+a\u2082+...+a\u2098)/m \u2265 (n+1)/2`\n-/\n/- special open -/ open Finset\n\n\n\n\n\n\ntheorem imo1994_p1 (n : \u2115) (m : \u2115) (A : Finset \u2115) (hm : A.card = m + 1)\n (hrange : \u2200 a \u2208 A, 0 < a \u2227 a \u2264 n)\n (hadd : \u2200 a \u2208 A, \u2200 b \u2208 A, a + b \u2264 n \u2192 a + b \u2208 A) :\n (m + 1) * (n + 1) \u2264 2 * \u2211 x \u2208 A, x := by sorry", "category": "combinatorics"} {"name": "Usa1990P2", "solved": true, "tags": ["algebra"], "problem_id": "Usa1990P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 1990, Problem 2\n\nA sequence of functions {f\u2099(x)} is defined recursively as follows:\n\n f\u2080(x) = 8\n f\u2099\u208a\u2081(x) = \u221a(x\u00b2 + 6f\u2099(x)).\n\nFor each nonnegative integer n, find all real solutions of the equation\n\n f\u2099(x) = 2x.\n-/", "formal_statement": "noncomputable def f : \u2115 \u2192 \u211d \u2192 \u211d\n| 0, _ => 8\n| n + 1, x => Real.sqrt (x^2 + 6 * f n x)\n\nabbrev solution_set (n : \u2115) : Set \u211d := { 4 }\n\ntheorem usa1990_p2 (n : \u2115) (x : \u211d) : x \u2208 solution_set n \u2194 f n x = 2 * x := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 1990, Problem 2\n\nA sequence of functions {f\u2099(x)} is defined recursively as follows:\n\n f\u2080(x) = 8\n f\u2099\u208a\u2081(x) = \u221a(x\u00b2 + 6f\u2099(x)).\n\nFor each nonnegative integer n, find all real solutions of the equation\n\n f\u2099(x) = 2x.\n-/\nnoncomputable def f : \u2115 \u2192 \u211d \u2192 \u211d\n| 0, _ => 8\n| n + 1, x => Real.sqrt (x^2 + 6 * f n x)\n\nabbrev solution_set (n : \u2115) : Set \u211d := { 4 }\n\ntheorem usa1990_p2 (n : \u2115) (x : \u211d) : x \u2208 solution_set n \u2194 f n x = 2 * x := by sorry", "category": "algebra"} {"name": "Usa1999P1", "solved": false, "tags": ["combinatorics"], "problem_id": "Usa1999P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\nUSA Mathematical Olympiad 1999, Problem 1\n\nSome checkers placed on an n \u00d7 n checkerboard satisfy the following conditions:\n a. every square that does not contain a checker shares a side with one that does;\n b. given any pair of squares that contain checkers, there is a sequence of squares\n containing checkers, starting and ending with the given squares, such that\n every two consecutive squares of the sequence share a side.\n\nProve that at least (n\u00b2-2)/3 checkers have been placed on the board.\n-/", "formal_statement": "def checkerboard (n : \u2115) := Fin n \u00d7 Fin n\n\ndef adjacent {n : \u2115} : checkerboard n \u2192 checkerboard n \u2192 Prop\n| \u27e8a1, a2\u27e9, \u27e8b1, b2\u27e9 =>\n (a1.val = b1.val \u2227 a2.val = b2.val + 1) \u2228\n (a1.val = b1.val \u2227 a2.val + 1 = b2.val) \u2228\n (a2.val = b2.val \u2227 a1.val = b1.val + 1) \u2228\n (a2.val = b2.val \u2227 a1.val + 1 = b1.val )\n\ntheorem usa1999_p1 (n : \u2115) (c : Finset (checkerboard n))\n (ha : \u2200 x : checkerboard n, x \u2208 c \u2228 (\u2203 y \u2208 c, adjacent x y))\n (hb : \u2200 x \u2208 c, \u2200 y \u2208 c,\n \u2203 p : List (checkerboard n),\n List.Chain' adjacent p \u2227\n List.head? p = x \u2227\n List.getLast? p = y) :\n n^2 \u2264 c.card * 3 + 2 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\nUSA Mathematical Olympiad 1999, Problem 1\n\nSome checkers placed on an n \u00d7 n checkerboard satisfy the following conditions:\n a. every square that does not contain a checker shares a side with one that does;\n b. given any pair of squares that contain checkers, there is a sequence of squares\n containing checkers, starting and ending with the given squares, such that\n every two consecutive squares of the sequence share a side.\n\nProve that at least (n\u00b2-2)/3 checkers have been placed on the board.\n-/\ndef checkerboard (n : \u2115) := Fin n \u00d7 Fin n\n\ndef adjacent {n : \u2115} : checkerboard n \u2192 checkerboard n \u2192 Prop\n| \u27e8a1, a2\u27e9, \u27e8b1, b2\u27e9 =>\n (a1.val = b1.val \u2227 a2.val = b2.val + 1) \u2228\n (a1.val = b1.val \u2227 a2.val + 1 = b2.val) \u2228\n (a2.val = b2.val \u2227 a1.val = b1.val + 1) \u2228\n (a2.val = b2.val \u2227 a1.val + 1 = b1.val )\n\ntheorem usa1999_p1 (n : \u2115) (c : Finset (checkerboard n))\n (ha : \u2200 x : checkerboard n, x \u2208 c \u2228 (\u2203 y \u2208 c, adjacent x y))\n (hb : \u2200 x \u2208 c, \u2200 y \u2208 c,\n \u2203 p : List (checkerboard n),\n List.Chain' adjacent p \u2227\n List.head? p = x \u2227\n List.getLast? p = y) :\n n^2 \u2264 c.card * 3 + 2 := by sorry", "category": "combinatorics"} {"name": "India1998P1a", "problem_id": "India1998P1a", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\nIndian Mathematical Olympiad 1998, problem 1\n\n(a) Show that the product of two numbers of the form a\u00b2 + 3b\u00b2 is again of that form.\n-/", "formal_statement": "theorem india1998_p1a (a\u2081 a\u2082 b\u2081 b\u2082 : \u2124) :\n (\u2203 a\u2083 b\u2083, (a\u2081^2 + 3 * b\u2081^2) * (a\u2082^2 + 3 * b\u2082^2) = (a\u2083^2 + 3 * b\u2083^2)) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\nIndian Mathematical Olympiad 1998, problem 1\n\n(a) Show that the product of two numbers of the form a\u00b2 + 3b\u00b2 is again of that form.\n-/\ntheorem india1998_p1a (a\u2081 a\u2082 b\u2081 b\u2082 : \u2124) :\n (\u2203 a\u2083 b\u2083, (a\u2081^2 + 3 * b\u2081^2) * (a\u2082^2 + 3 * b\u2082^2) = (a\u2083^2 + 3 * b\u2083^2)) := by sorry", "tags": ["number theory"], "solved": true, "category": "number theory"} {"name": "Usa1987P1", "solved": true, "tags": ["algebra"], "problem_id": "Usa1987P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 1987, Problem 1\n\nDetermine all solutions to\n\n (m\u00b2 + n)(m + n\u00b2) = (m - n)\u00b3\n\nwhere m and n are non-zero integers.\n-/", "formal_statement": "abbrev solution_set : Set (\u2124 \u00d7 \u2124) :=\n { (-1, -1), (8, -10), (9, -6), (9, -21) }\n\ntheorem usa1987_p1 (m n : \u2124) :\n (m, n) \u2208 solution_set \u2194\n m \u2260 0 \u2227 n \u2260 0 \u2227 (m^2 + n) * (m + n^2) = (m - n)^3 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 1987, Problem 1\n\nDetermine all solutions to\n\n (m\u00b2 + n)(m + n\u00b2) = (m - n)\u00b3\n\nwhere m and n are non-zero integers.\n-/\nabbrev solution_set : Set (\u2124 \u00d7 \u2124) :=\n { (-1, -1), (8, -10), (9, -6), (9, -21) }\n\ntheorem usa1987_p1 (m n : \u2124) :\n (m, n) \u2208 solution_set \u2194\n m \u2260 0 \u2227 n \u2260 0 \u2227 (m^2 + n) * (m + n^2) = (m - n)^3 := by sorry", "category": "algebra"} {"name": "Imo1981P3", "solved": true, "tags": ["algebra"], "problem_id": "Imo1981P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1981, Problem 3\n\nDetermine the maximum value of `m ^ 2 + n ^ 2`, where `m` and `n` are integers in\n`{1, 2, ..., 1981}` and `(n ^ 2 - m * n - m ^ 2) ^ 2 = 1`.\n-/", "formal_statement": "/- special open -/ open Int Set\n\n\n\n\n\n\n/-\nWe generalize the problem to `{1, 2, ..., N}` and then specialize to `N = 1981`.\n-/\nvariable (N : \u2115)\n\n-- N = 1981\n@[mk_iff]\nstructure ProblemPredicate (m n : \u2124) : Prop where\n m_range : m \u2208 Ioc 0 (N : \u2124)\n n_range : n \u2208 Ioc 0 (N : \u2124)\n eq_one : (n ^ 2 - m * n - m ^ 2) ^ 2 = 1\n\ndef specifiedSet : Set \u2124 :=\n {k : \u2124 | \u2203 m : \u2124, \u2203 n : \u2124, k = m ^ 2 + n ^ 2 \u2227 ProblemPredicate N m n}\n\nabbrev solution : \u2115 := 3524578\n\ntheorem imo1981_p3 : IsGreatest (specifiedSet 1981) solution := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1981, Problem 3\n\nDetermine the maximum value of `m ^ 2 + n ^ 2`, where `m` and `n` are integers in\n`{1, 2, ..., 1981}` and `(n ^ 2 - m * n - m ^ 2) ^ 2 = 1`.\n-/\n/- special open -/ open Int Set\n\n\n\n\n\n\n/-\nWe generalize the problem to `{1, 2, ..., N}` and then specialize to `N = 1981`.\n-/\nvariable (N : \u2115)\n\n-- N = 1981\n@[mk_iff]\nstructure ProblemPredicate (m n : \u2124) : Prop where\n m_range : m \u2208 Ioc 0 (N : \u2124)\n n_range : n \u2208 Ioc 0 (N : \u2124)\n eq_one : (n ^ 2 - m * n - m ^ 2) ^ 2 = 1\n\ndef specifiedSet : Set \u2124 :=\n {k : \u2124 | \u2203 m : \u2124, \u2203 n : \u2124, k = m ^ 2 + n ^ 2 \u2227 ProblemPredicate N m n}\n\nabbrev solution : \u2115 := 3524578\n\ntheorem imo1981_p3 : IsGreatest (specifiedSet 1981) solution := by sorry", "category": "algebra"} {"name": "Usa1998P5", "solved": true, "tags": ["number theory"], "problem_id": "Usa1998P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 1998, Problem 5\n\nProve that for each n \u2265 2, there is a set S of n integers such that\n(a-b)\u00b2 divides ab for every distinct a,b \u2208 S.\n-/", "formal_statement": "theorem usa1998_p5 (n : \u2115) (_hn : 2 \u2264 n) :\n \u2203 S : Finset \u2124,\n S.card = n \u2227\n \u2200 a \u2208 S, \u2200 b \u2208 S, a \u2260 b \u2192 (a - b)^2 \u2223 a * b := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 1998, Problem 5\n\nProve that for each n \u2265 2, there is a set S of n integers such that\n(a-b)\u00b2 divides ab for every distinct a,b \u2208 S.\n-/\ntheorem usa1998_p5 (n : \u2115) (_hn : 2 \u2264 n) :\n \u2203 S : Finset \u2124,\n S.card = n \u2227\n \u2200 a \u2208 S, \u2200 b \u2208 S, a \u2260 b \u2192 (a - b)^2 \u2223 a * b := by sorry", "category": "number theory"} {"name": "Imo1985P4", "solved": false, "tags": ["number theory"], "problem_id": "Imo1985P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1985, Problem 4\n\nGiven a set M of 1985 distinct positive integers, none of which has a prime\ndivisor greater than 23, prove that M contains a subset of 4 elements\nwhose product is the 4th power of an integer.\n-/", "formal_statement": "theorem imo1985_p4 (M : Finset \u2115) (Mpos : \u2200 m \u2208 M, 0 < m)\n (Mdivisors : \u2200 m \u2208 M, \u2200 n, m.Prime \u2227 n \u2223 m \u2192 m \u2264 23)\n : \u2203 M' : Finset \u2115, M' \u2286 M \u2227 \u2203 k, M'.prod id = k^4 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1985, Problem 4\n\nGiven a set M of 1985 distinct positive integers, none of which has a prime\ndivisor greater than 23, prove that M contains a subset of 4 elements\nwhose product is the 4th power of an integer.\n-/\ntheorem imo1985_p4 (M : Finset \u2115) (Mpos : \u2200 m \u2208 M, 0 < m)\n (Mdivisors : \u2200 m \u2208 M, \u2200 n, m.Prime \u2227 n \u2223 m \u2192 m \u2264 23)\n : \u2203 M' : Finset \u2115, M' \u2286 M \u2227 \u2203 k, M'.prod id = k^4 := by sorry", "category": "number theory"} {"name": "Bulgaria1998P11", "solved": true, "tags": ["number theory"], "problem_id": "Bulgaria1998P11", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\nBulgarian Mathematical Olympiad 1998, Problem 11\n\nLet m,n be natural numbers such that\n\n A = ((m + 3)\u207f + 1) / (3m)\n\nis an integer. Prove that A is odd.\n-/", "formal_statement": "theorem bulgaria1998_p11\n (m n A : \u2115)\n (h : 3 * m * A = (m + 3)^n + 1) : Odd A := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\nBulgarian Mathematical Olympiad 1998, Problem 11\n\nLet m,n be natural numbers such that\n\n A = ((m + 3)\u207f + 1) / (3m)\n\nis an integer. Prove that A is odd.\n-/\ntheorem bulgaria1998_p11\n (m n A : \u2115)\n (h : 3 * m * A = (m + 3)^n + 1) : Odd A := by sorry", "category": "number theory"} {"name": "Singapore2019P7", "solved": true, "tags": ["algebra"], "problem_id": "Singapore2019P7", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# Singapore Math Olympiad (Senior) 2019 (Round 1), Problem 7\n\nhttp://www.realsutra.com/limjeck/SMO_Senior_2019.pdf\n\nSuppose that $\\tan x = 5$. Find the value of $\\frac{6 + \\sin 2x}{1 + \\cos 2x}$.\n-/", "formal_statement": "noncomputable abbrev solution : \u211d := 83\n\ntheorem singapore2019_r1_p7 (x : \u211d) (hx : tan x = 5) :\n (6 + sin (2 * x)) / (1 + cos (2 * x)) = solution := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# Singapore Math Olympiad (Senior) 2019 (Round 1), Problem 7\n\nhttp://www.realsutra.com/limjeck/SMO_Senior_2019.pdf\n\nSuppose that $\\tan x = 5$. Find the value of $\\frac{6 + \\sin 2x}{1 + \\cos 2x}$.\n-/\nnoncomputable abbrev solution : \u211d := 83\n\ntheorem singapore2019_r1_p7 (x : \u211d) (hx : tan x = 5) :\n (6 + sin (2 * x)) / (1 + cos (2 * x)) = solution := by sorry", "category": "algebra"} {"name": "Imo1974P5", "solved": true, "tags": ["algebra"], "problem_id": "Imo1974P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1974, Problem 5\n\nWhat are the possible values of\n\n a / (a + b + d) + b / (a + b + c) + c / (b + c + d) + d / (a + c + d)\n\nas a,b,c,d range over the positive real numbers?\n-/", "formal_statement": "abbrev solution_set : Set \u211d := Set.Ioo 1 2\n\ntheorem imo1974_p5 (s : \u211d) :\n s \u2208 solution_set \u2194\n \u2203 a b c d : \u211d, 0 < a \u2227 0 < b \u2227 0 < c \u2227 0 < d \u2227\n s = a / (a + b + d) + b / (a + b + c) +\n c / (b + c + d) + d / (a + c + d) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1974, Problem 5\n\nWhat are the possible values of\n\n a / (a + b + d) + b / (a + b + c) + c / (b + c + d) + d / (a + c + d)\n\nas a,b,c,d range over the positive real numbers?\n-/\nabbrev solution_set : Set \u211d := Set.Ioo 1 2\n\ntheorem imo1974_p5 (s : \u211d) :\n s \u2208 solution_set \u2194\n \u2203 a b c d : \u211d, 0 < a \u2227 0 < b \u2227 0 < c \u2227 0 < d \u2227\n s = a / (a + b + d) + b / (a + b + c) +\n c / (b + c + d) + d / (a + c + d) := by sorry", "category": "algebra"} {"name": "Imo1979P1", "solved": true, "tags": ["number theory"], "problem_id": "Imo1979P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1979, Problem 1\n\nSuppose that p and q are positive integers such that\n\n p / q = 1 - 1/2 + 1/3 - 1/4 + ... - 1/1318 + 1/1319.\n\nProve that p is divisible by 1979.\n-/", "formal_statement": "theorem imo1979_p1 (p q : \u2124) (hp : 0 < p) (hq : 0 < q)\n (h : (p : \u211a) / q = \u2211 i \u2208 Finset.range 1319, (-1 : \u211a)^i / (i + 1)) :\n 1979 \u2223 p := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1979, Problem 1\n\nSuppose that p and q are positive integers such that\n\n p / q = 1 - 1/2 + 1/3 - 1/4 + ... - 1/1318 + 1/1319.\n\nProve that p is divisible by 1979.\n-/\ntheorem imo1979_p1 (p q : \u2124) (hp : 0 < p) (hq : 0 < q)\n (h : (p : \u211a) / q = \u2211 i \u2208 Finset.range 1319, (-1 : \u211a)^i / (i + 1)) :\n 1979 \u2223 p := by sorry", "category": "number theory"} {"name": "Imo2023P3", "solved": false, "tags": ["number theory"], "problem_id": "Imo2023P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2023, Problem 3\n\nFor each integer k \u2265 2, determine all infinite sequences of positive\nintegers a\u2081, a\u2082, ... for which there exists a polynomial P of the form\n\n P(x) = x\u1d4f + c\u2096\u208b\u2081x\u1d4f\u207b\u00b9 + ... + c\u2081x + c\u2080,\n\nwhere c\u2080, c\u2081, ..., c\u2096\u208b\u2081 are non-negative integers, such that\n\n P(a\u2099) = a\u2099\u208a\u2081a\u2099\u208a\u2082\u22efa\u2099\u208a\u2096\n\nfor every integer n \u2265 1.\n-/", "formal_statement": "abbrev SolutionSet {k : \u2115} (hk : 2 \u2264 k) : Set (\u2115+ \u2192 \u2115+) := \n {a | \u2203 (a\u2081 m : \u2115), 0 < a\u2081 \u2227 0 \u2264 m \u2227 \u2200 n : \u2115+, a n = a\u2081 + (n - 1) * m}\n\ntheorem imo2023_p3 {k : \u2115} (hk : 2 \u2264 k) (a : \u2115+ \u2192 \u2115+) :\n a \u2208 SolutionSet hk \u2194\n (\u2203 P : Polynomial \u2124, P.Monic \u2227 P.degree = k \u2227\n (\u2200 n, n \u2264 k \u2192 0 \u2264 P.coeff n) \u2227\n \u2200 n : \u2115+,\n P.eval ((a n) : \u2124) =\n \u220f i \u2208 Finset.range k, a \u27e8n + i + 1, Nat.succ_pos _\u27e9) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2023, Problem 3\n\nFor each integer k \u2265 2, determine all infinite sequences of positive\nintegers a\u2081, a\u2082, ... for which there exists a polynomial P of the form\n\n P(x) = x\u1d4f + c\u2096\u208b\u2081x\u1d4f\u207b\u00b9 + ... + c\u2081x + c\u2080,\n\nwhere c\u2080, c\u2081, ..., c\u2096\u208b\u2081 are non-negative integers, such that\n\n P(a\u2099) = a\u2099\u208a\u2081a\u2099\u208a\u2082\u22efa\u2099\u208a\u2096\n\nfor every integer n \u2265 1.\n-/\nabbrev SolutionSet {k : \u2115} (hk : 2 \u2264 k) : Set (\u2115+ \u2192 \u2115+) := \n {a | \u2203 (a\u2081 m : \u2115), 0 < a\u2081 \u2227 0 \u2264 m \u2227 \u2200 n : \u2115+, a n = a\u2081 + (n - 1) * m}\n\ntheorem imo2023_p3 {k : \u2115} (hk : 2 \u2264 k) (a : \u2115+ \u2192 \u2115+) :\n a \u2208 SolutionSet hk \u2194\n (\u2203 P : Polynomial \u2124, P.Monic \u2227 P.degree = k \u2227\n (\u2200 n, n \u2264 k \u2192 0 \u2264 P.coeff n) \u2227\n \u2200 n : \u2115+,\n P.eval ((a n) : \u2124) =\n \u220f i \u2208 Finset.range k, a \u27e8n + i + 1, Nat.succ_pos _\u27e9) := by sorry", "category": "number theory"} {"name": "Imo2013P5", "solved": true, "tags": ["algebra"], "problem_id": "Imo2013P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2013, Problem 5\n\nLet \u211a>\u2080 be the set of positive rational numbers. Let f: \u211a>\u2080 \u2192 \u211d be a function satisfying\nthe conditions\n\n (1) f(x) * f(y) \u2265 f(x * y)\n (2) f(x + y) \u2265 f(x) + f(y)\n\nfor all x,y \u2208 \u211a>\u2080. Given that f(a) = a for some rational a > 1, prove that f(x) = x for\nall x \u2208 \u211a>\u2080.\n\n-/", "formal_statement": "theorem imo2013_p5\n (f : \u211a \u2192 \u211d)\n (H1 : \u2200 x y, 0 < x \u2192 0 < y \u2192 f (x * y) \u2264 f x * f y)\n (H2 : \u2200 x y, 0 < x \u2192 0 < y \u2192 f x + f y \u2264 f (x + y))\n (H_fixed_point : \u2203 a, 1 < a \u2227 f a = a) :\n \u2200 x, 0 < x \u2192 f x = x := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2013, Problem 5\n\nLet \u211a>\u2080 be the set of positive rational numbers. Let f: \u211a>\u2080 \u2192 \u211d be a function satisfying\nthe conditions\n\n (1) f(x) * f(y) \u2265 f(x * y)\n (2) f(x + y) \u2265 f(x) + f(y)\n\nfor all x,y \u2208 \u211a>\u2080. Given that f(a) = a for some rational a > 1, prove that f(x) = x for\nall x \u2208 \u211a>\u2080.\n\n-/\ntheorem imo2013_p5\n (f : \u211a \u2192 \u211d)\n (H1 : \u2200 x y, 0 < x \u2192 0 < y \u2192 f (x * y) \u2264 f x * f y)\n (H2 : \u2200 x y, 0 < x \u2192 0 < y \u2192 f x + f y \u2264 f (x + y))\n (H_fixed_point : \u2203 a, 1 < a \u2227 f a = a) :\n \u2200 x, 0 < x \u2192 f x = x := by sorry", "category": "algebra"} {"name": "Imo1964P1a", "problem_id": "Imo1964P1a", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1964, Problem 1\n\n(a) Find all natural numbers n for which 2\u207f - 1 is divisible by 7.\n-/", "formal_statement": "abbrev solution_set : Set \u2115 := { n | n % 3 = 0 }\n\ntheorem imo_1964_p1a (n : \u2115) : n \u2208 solution_set \u2194 2^n \u2261 1 [MOD 7] := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1964, Problem 1\n\n(a) Find all natural numbers n for which 2\u207f - 1 is divisible by 7.\n-/\nabbrev solution_set : Set \u2115 := { n | n % 3 = 0 }\n\ntheorem imo_1964_p1a (n : \u2115) : n \u2208 solution_set \u2194 2^n \u2261 1 [MOD 7] := by sorry", "tags": ["number theory"], "solved": true, "category": "number theory"} {"name": "Iran1998P9", "solved": true, "tags": ["algebra", "inequality"], "problem_id": "Iran1998P9", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# Iranian Mathematical Olympiad 1998, Problem 9\n\nLet x,y,z > 1 and 1/x + 1/y + 1/z = 2. Prove that\n\n \u221a(x + y + z) \u2265 \u221a(x - 1) + \u221a(y - 1) + \u221a(z - 1).\n\n-/", "formal_statement": "theorem iran1998_p9\n (x y z : \u211d)\n (hx : 1 < x)\n (hy : 1 < y)\n (hz : 1 < z)\n (h : 1/x + 1/y + 1/z = 2) :\n \u221a(x - 1) + \u221a(y - 1) + \u221a(z - 1) \u2264 \u221a(x + y + z) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# Iranian Mathematical Olympiad 1998, Problem 9\n\nLet x,y,z > 1 and 1/x + 1/y + 1/z = 2. Prove that\n\n \u221a(x + y + z) \u2265 \u221a(x - 1) + \u221a(y - 1) + \u221a(z - 1).\n\n-/\ntheorem iran1998_p9\n (x y z : \u211d)\n (hx : 1 < x)\n (hy : 1 < y)\n (hz : 1 < z)\n (h : 1/x + 1/y + 1/z = 2) :\n \u221a(x - 1) + \u221a(y - 1) + \u221a(z - 1) \u2264 \u221a(x + y + z) := by sorry", "category": "algebra"} {"name": "Imo1975P1", "solved": true, "tags": ["algebra"], "problem_id": "Imo1975P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1975, Problem 1\n\nLet `x\u2081, x\u2082, ... , x\u2099` and `y\u2081, y\u2082, ... , y\u2099` be two sequences of real numbers, such that\n`x\u2081 \u2265 x\u2082 \u2265 ... \u2265 x\u2099` and `y\u2081 \u2265 y\u2082 \u2265 ... \u2265 y\u2099`. Prove that if `z\u2081, z\u2082, ... , z\u2099` is any permutation\nof `y\u2081, y\u2082, ... , y\u2099`, then `\u2211 (x\u1d62 - y\u1d62)^2 \u2264 \u2211 (x\u1d62 - z\u1d62)^2`\n-/", "formal_statement": "/- Let `n` be a natural number, `x` and `y` be as in the problem statement and `\u03c3` be the\npermutation of natural numbers such that `z = y \u2218 \u03c3` -/\nvariable (n : \u2115) (\u03c3 : Equiv.Perm \u2115) (x y : \u2115 \u2192 \u211d)\n\ntheorem imo1975_p1\n (hx : AntitoneOn x (Finset.Icc 1 n)) (hy : AntitoneOn y (Finset.Icc 1 n))\n (h\u03c3 : {x | \u03c3 x \u2260 x} \u2286 Finset.Icc 1 n) :\n \u2211 i \u2208 Finset.Icc 1 n, (x i - y i) ^ 2 \u2264 \u2211 i \u2208 Finset.Icc 1 n, (x i - y (\u03c3 i)) ^ 2 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1975, Problem 1\n\nLet `x\u2081, x\u2082, ... , x\u2099` and `y\u2081, y\u2082, ... , y\u2099` be two sequences of real numbers, such that\n`x\u2081 \u2265 x\u2082 \u2265 ... \u2265 x\u2099` and `y\u2081 \u2265 y\u2082 \u2265 ... \u2265 y\u2099`. Prove that if `z\u2081, z\u2082, ... , z\u2099` is any permutation\nof `y\u2081, y\u2082, ... , y\u2099`, then `\u2211 (x\u1d62 - y\u1d62)^2 \u2264 \u2211 (x\u1d62 - z\u1d62)^2`\n-/\n/- Let `n` be a natural number, `x` and `y` be as in the problem statement and `\u03c3` be the\npermutation of natural numbers such that `z = y \u2218 \u03c3` -/\nvariable (n : \u2115) (\u03c3 : Equiv.Perm \u2115) (x y : \u2115 \u2192 \u211d)\n\ntheorem imo1975_p1\n (hx : AntitoneOn x (Finset.Icc 1 n)) (hy : AntitoneOn y (Finset.Icc 1 n))\n (h\u03c3 : {x | \u03c3 x \u2260 x} \u2286 Finset.Icc 1 n) :\n \u2211 i \u2208 Finset.Icc 1 n, (x i - y i) ^ 2 \u2264 \u2211 i \u2208 Finset.Icc 1 n, (x i - y (\u03c3 i)) ^ 2 := by sorry", "category": "algebra"} {"name": "Bulgaria1998P6", "solved": false, "tags": ["number theory"], "problem_id": "Bulgaria1998P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# Bulgarian Mathematical Olympiad 1998, Problem 6\n\nProve that the equation\n\n x\u00b2y\u00b2 = z\u00b2(z\u00b2 - x\u00b2 - y\u00b2)\n\nhas no solutions in positive integers.\n\n-/", "formal_statement": "theorem bulgaria1998_p6\n (x y z : \u2124)\n (hx : 0 < x)\n (hy : 0 < y)\n (_hz : 0 < z)\n (h : x^2 * y^2 = z^2 * (z^2 - x^2 - y^2)) :\n False := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# Bulgarian Mathematical Olympiad 1998, Problem 6\n\nProve that the equation\n\n x\u00b2y\u00b2 = z\u00b2(z\u00b2 - x\u00b2 - y\u00b2)\n\nhas no solutions in positive integers.\n\n-/\ntheorem bulgaria1998_p6\n (x y z : \u2124)\n (hx : 0 < x)\n (hy : 0 < y)\n (_hz : 0 < z)\n (h : x^2 * y^2 = z^2 * (z^2 - x^2 - y^2)) :\n False := by sorry", "category": "number theory"} {"name": "Imo2017P2", "solved": true, "tags": ["algebra"], "problem_id": "Imo2017P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2017, Problem 2\n\nFind all functions `f : \u211d \u2192 \u211d` that satisfy\n\n \u2200 x,y \u2208 \u211d, f(f(x)f(y)) + f(x + y) = f(xy).\n-/", "formal_statement": "abbrev solution_set : Set (\u211d \u2192 \u211d) :=\n { fun _ \u21a6 0, fun x \u21a6 x - 1, fun x \u21a6 1 - x }\n\ntheorem imo2017_p2 (f : \u211d \u2192 \u211d) :\n f \u2208 solution_set \u2194 \u2200 x y, f (f x * f y) + f (x + y) = f (x * y) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2017, Problem 2\n\nFind all functions `f : \u211d \u2192 \u211d` that satisfy\n\n \u2200 x,y \u2208 \u211d, f(f(x)f(y)) + f(x + y) = f(xy).\n-/\nabbrev solution_set : Set (\u211d \u2192 \u211d) :=\n { fun _ \u21a6 0, fun x \u21a6 x - 1, fun x \u21a6 1 - x }\n\ntheorem imo2017_p2 (f : \u211d \u2192 \u211d) :\n f \u2208 solution_set \u2194 \u2200 x y, f (f x * f y) + f (x + y) = f (x * y) := by sorry", "category": "algebra"} {"name": "Imo2004P6", "solved": false, "tags": ["number theory"], "problem_id": "Imo2004P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2004, Problem 6\n\nWe call a positive integer *alternating* if every two consecutive\ndigits in its decimal representation are of different parity.\n\nFind all positive integers n such that n has a multiple that is\nalternating.\n-/", "formal_statement": "abbrev SolutionSet : Set \u2115 := \n {n : \u2115 | 0 < n \u2227 \u00ac(20 \u2223 n)}\n\nabbrev Alternating (n : Nat) : Prop :=\n (n.digits 10).Chain' (fun k l \u21a6 \u00ac k \u2261 l [MOD 2])\n\ntheorem imo2004_p6 (n : \u2115) :\n n \u2208 SolutionSet \u2194 0 < n \u2227 \u2203 k, Alternating (n * k) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2004, Problem 6\n\nWe call a positive integer *alternating* if every two consecutive\ndigits in its decimal representation are of different parity.\n\nFind all positive integers n such that n has a multiple that is\nalternating.\n-/\nabbrev SolutionSet : Set \u2115 := \n {n : \u2115 | 0 < n \u2227 \u00ac(20 \u2223 n)}\n\nabbrev Alternating (n : Nat) : Prop :=\n (n.digits 10).Chain' (fun k l \u21a6 \u00ac k \u2261 l [MOD 2])\n\ntheorem imo2004_p6 (n : \u2115) :\n n \u2208 SolutionSet \u2194 0 < n \u2227 \u2203 k, Alternating (n * k) := by sorry", "category": "number theory"} {"name": "UK2024R1P2", "solved": true, "tags": ["algebra"], "problem_id": "UK2024R1P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# British Mathematical Olympiad 2024, Round 1, Problem 2\n\nThe sequence of integers a\u2080, a\u2081, \u22ef has the property that for each\ni \u2265 2, a\u1d62 is either 2 * a\u1d62\u208b\u2081 - a\u1d62\u208b\u2082, or 2 * a\u1d62\u208b\u2082 - a\u1d62\u208b\u2081.\n\nGiven that a\u2082\u2080\u2082\u2083 and a\u2082\u2080\u2082\u2084 are consecutive integers, prove that a\u2080\nand a\u2081 are consecutive.\n-/", "formal_statement": "theorem uk2024_r1_p2 (a : \u2115 \u2192 \u2124)\n (ha : \u2200 i \u2265 2, a i = 2 * a (i - 1) - a (i - 2) \u2228 a i = 2 * a (i - 2) - a (i - 1))\n (ha' : |a 2023 - a 2024| = 1) :\n |a 0 - a 1| = 1 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# British Mathematical Olympiad 2024, Round 1, Problem 2\n\nThe sequence of integers a\u2080, a\u2081, \u22ef has the property that for each\ni \u2265 2, a\u1d62 is either 2 * a\u1d62\u208b\u2081 - a\u1d62\u208b\u2082, or 2 * a\u1d62\u208b\u2082 - a\u1d62\u208b\u2081.\n\nGiven that a\u2082\u2080\u2082\u2083 and a\u2082\u2080\u2082\u2084 are consecutive integers, prove that a\u2080\nand a\u2081 are consecutive.\n-/\ntheorem uk2024_r1_p2 (a : \u2115 \u2192 \u2124)\n (ha : \u2200 i \u2265 2, a i = 2 * a (i - 1) - a (i - 2) \u2228 a i = 2 * a (i - 2) - a (i - 1))\n (ha' : |a 2023 - a 2024| = 1) :\n |a 0 - a 1| = 1 := by sorry", "category": "algebra"} {"name": "Imo1962P2", "solved": true, "tags": ["algebra"], "problem_id": "Imo1962P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1962, Problem 2\n\nDetermine all real numbers x which satisfy\n\n \u221a(3 - x) - \u221a(x + 1) > 1/2.\n-/", "formal_statement": "abbrev SolutionSet : Set \u211d := Set.Ico (-1) (1 - \u221a31 / 8)\n\ntheorem imo1962_p2 (x : \u211d) :\n x \u2208 SolutionSet \u2194\n x \u2264 3 \u2227 -1 \u2264 x \u2227 1/2 < \u221a(3 - x) - \u221a(x + 1) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1962, Problem 2\n\nDetermine all real numbers x which satisfy\n\n \u221a(3 - x) - \u221a(x + 1) > 1/2.\n-/\nabbrev SolutionSet : Set \u211d := Set.Ico (-1) (1 - \u221a31 / 8)\n\ntheorem imo1962_p2 (x : \u211d) :\n x \u2208 SolutionSet \u2194\n x \u2264 3 \u2227 -1 \u2264 x \u2227 1/2 < \u221a(3 - x) - \u221a(x + 1) := by sorry", "category": "algebra"} {"name": "Imo1978P5", "solved": true, "tags": ["algebra"], "problem_id": "Imo1978P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1978, Problem 5\n\nLet a_k be a sequence of distinct positive integers for k = 1,2,3, ...\n\nProve that for all natral numbers n, we have:\n\nsum_{k=1}^{n} a(k)/(k^2) >= sum_{k=1}^{n} (1/k).\n-/", "formal_statement": "/- special open -/ open Finset\n\n\n\n\n\n\n\ntheorem imo_1978_p5\n (n : \u2115)\n (f : \u2115 \u2192 \u2115)\n (h\u2080 : \u2200 (m : \u2115), 0 < m \u2192 0 < f m)\n (h\u2081 : \u2200 (p q : \u2115), 0 < p \u2192 0 < q \u2192 p \u2260 q \u2192 f p \u2260 f q)\n (h\u2082 : 0 < n) :\n (\u2211 k \u2208 Finset.Icc 1 n, (1 : \u211d) / k) \u2264 \u2211 k \u2208 Finset.Icc 1 n, ((f k):\u211d) / k ^ 2 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1978, Problem 5\n\nLet a_k be a sequence of distinct positive integers for k = 1,2,3, ...\n\nProve that for all natral numbers n, we have:\n\nsum_{k=1}^{n} a(k)/(k^2) >= sum_{k=1}^{n} (1/k).\n-/\n/- special open -/ open Finset\n\n\n\n\n\n\n\ntheorem imo_1978_p5\n (n : \u2115)\n (f : \u2115 \u2192 \u2115)\n (h\u2080 : \u2200 (m : \u2115), 0 < m \u2192 0 < f m)\n (h\u2081 : \u2200 (p q : \u2115), 0 < p \u2192 0 < q \u2192 p \u2260 q \u2192 f p \u2260 f q)\n (h\u2082 : 0 < n) :\n (\u2211 k \u2208 Finset.Icc 1 n, (1 : \u211d) / k) \u2264 \u2211 k \u2208 Finset.Icc 1 n, ((f k):\u211d) / k ^ 2 := by sorry", "category": "algebra"} {"name": "Imo1976P4", "solved": false, "tags": ["number theory"], "problem_id": "Imo1976P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1976, Problem 4\n\nDetermine, with proof, the largest number which is the product\nof positive integers whose sum is 1976.\n-/", "formal_statement": "abbrev solution : \u2115 := 2 * 3^658\n\ntheorem imo1976_p4 :\n IsGreatest\n { n | \u2203 s : Finset \u2115, \u2211 i \u2208 s, i = 1976 \u2227 \u220f i \u2208 s, i = n }\n solution := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1976, Problem 4\n\nDetermine, with proof, the largest number which is the product\nof positive integers whose sum is 1976.\n-/\nabbrev solution : \u2115 := 2 * 3^658\n\ntheorem imo1976_p4 :\n IsGreatest\n { n | \u2203 s : Finset \u2115, \u2211 i \u2208 s, i = 1976 \u2227 \u220f i \u2208 s, i = n }\n solution := by sorry", "category": "number theory"} {"name": "Usa2000P5", "solved": false, "tags": ["geometry"], "problem_id": "Usa2000P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# Usa Mathematical Olympiad 2000, Problem 5\n\nLet A\u2081A\u2082A\u2083 be a triangle, and let \u03c9\u2081 be a circle in its plane\npassing through A\u2081 and A\u2082. Suppose there exist circles \u03c9\u2082,\u03c9\u2083,\u22ef,\u03c9\u2087\nsuch that for k=2,3,\u22ef,7, circle \u03c9\u2096 is externally tangent to \u03c9\u2096\u208b\u2081\nand passes through A\u2096 and A\u2096\u208a\u2081 (indices mod 3).\n\nProve that \u03c9\u2087 = \u03c9\u2081.\n-/", "formal_statement": "/- special open -/ open EuclideanGeometry\n\n\n\n\n\n\nabbrev Circle := EuclideanGeometry.Sphere (EuclideanSpace \u211d (Fin 2))\n\ndef ExternallyTangent (c1 c2 : Circle) : Prop :=\n dist c1.center c2.center = c1.radius + c2.radius\n\ntheorem imo2000_p5\n (A : ZMod 3 \u2192 EuclideanSpace \u211d (Fin 2))\n (hABC : AffineIndependent \u211d ![A 0, A 1, A 2])\n (\u03c9 : Fin 7 \u2192 Circle)\n (hTangent : \u2200 i, i < 6 \u2192 ExternallyTangent (\u03c9 i) (\u03c9 (i + 1)))\n (hA : \u2200 i : Fin 7, (A i \u2208 \u03c9 i \u2227 A (i + 1) \u2208 \u03c9 i))\n : \u03c9 0 = \u03c9 6 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# Usa Mathematical Olympiad 2000, Problem 5\n\nLet A\u2081A\u2082A\u2083 be a triangle, and let \u03c9\u2081 be a circle in its plane\npassing through A\u2081 and A\u2082. Suppose there exist circles \u03c9\u2082,\u03c9\u2083,\u22ef,\u03c9\u2087\nsuch that for k=2,3,\u22ef,7, circle \u03c9\u2096 is externally tangent to \u03c9\u2096\u208b\u2081\nand passes through A\u2096 and A\u2096\u208a\u2081 (indices mod 3).\n\nProve that \u03c9\u2087 = \u03c9\u2081.\n-/\n/- special open -/ open EuclideanGeometry\n\n\n\n\n\n\nabbrev Circle := EuclideanGeometry.Sphere (EuclideanSpace \u211d (Fin 2))\n\ndef ExternallyTangent (c1 c2 : Circle) : Prop :=\n dist c1.center c2.center = c1.radius + c2.radius\n\ntheorem imo2000_p5\n (A : ZMod 3 \u2192 EuclideanSpace \u211d (Fin 2))\n (hABC : AffineIndependent \u211d ![A 0, A 1, A 2])\n (\u03c9 : Fin 7 \u2192 Circle)\n (hTangent : \u2200 i, i < 6 \u2192 ExternallyTangent (\u03c9 i) (\u03c9 (i + 1)))\n (hA : \u2200 i : Fin 7, (A i \u2208 \u03c9 i \u2227 A (i + 1) \u2208 \u03c9 i))\n : \u03c9 0 = \u03c9 6 := by sorry", "category": "geometry"} {"name": "Usa2022P3", "solved": true, "tags": ["algebra"], "problem_id": "Usa2022P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 2022, Problem 3\n\nLet \u211d+ be the set of all positive real numbers. Find all\nfunctions \u211d+ \u2192 \u211d+ such that for all x, y \u2208 \u211d+ we have\n\n f(x) = f(f(f(x)) + y) + f(xf(y))f(x+y).\n-/", "formal_statement": "abbrev PosReal : Type := { x : \u211d // 0 < x }\nnotation \"\u211d+\" => PosReal\n\nabbrev solution_set : Set (\u211d+ \u2192 \u211d+) :=\n { f : \u211d+ \u2192 \u211d+ | \u2203 c : \u211d+, f = fun x \u21a6 c / x }\n\ntheorem usa2022_p3 (f : \u211d+ \u2192 \u211d+) :\n f \u2208 solution_set \u2194\n (\u2200 x y : \u211d+, f x = f (f (f x) + y) + f (x * f y) * f (x + y)) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 2022, Problem 3\n\nLet \u211d+ be the set of all positive real numbers. Find all\nfunctions \u211d+ \u2192 \u211d+ such that for all x, y \u2208 \u211d+ we have\n\n f(x) = f(f(f(x)) + y) + f(xf(y))f(x+y).\n-/\nabbrev PosReal : Type := { x : \u211d // 0 < x }\nnotation \"\u211d+\" => PosReal\n\nabbrev solution_set : Set (\u211d+ \u2192 \u211d+) :=\n { f : \u211d+ \u2192 \u211d+ | \u2203 c : \u211d+, f = fun x \u21a6 c / x }\n\ntheorem usa2022_p3 (f : \u211d+ \u2192 \u211d+) :\n f \u2208 solution_set \u2194\n (\u2200 x y : \u211d+, f x = f (f (f x) + y) + f (x * f y) * f (x + y)) := by sorry", "category": "algebra"} {"name": "Imo2021P2", "solved": false, "tags": ["algebra"], "problem_id": "Imo2021P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2021, Problem 2\n\nLet n be a natural number, and let x\u2081, ..., x\u2099 be real numbers.\nShow that\n\n \u2211\u1d62\u2211\u2c7c \u221a|x\u1d62 - x\u2c7c| \u2264 \u2211\u1d62\u2211\u2c7c \u221a|x\u1d62 + x\u2c7c|.\n\n-/", "formal_statement": "theorem imo2021_p2 (n : \u2115) (x : Fin n \u2192 \u211d) :\n \u2211 i, \u2211 j, \u221a|x i - x j| \u2264 \u2211 i, \u2211 j, \u221a|x i + x j| := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2021, Problem 2\n\nLet n be a natural number, and let x\u2081, ..., x\u2099 be real numbers.\nShow that\n\n \u2211\u1d62\u2211\u2c7c \u221a|x\u1d62 - x\u2c7c| \u2264 \u2211\u1d62\u2211\u2c7c \u221a|x\u1d62 + x\u2c7c|.\n\n-/\ntheorem imo2021_p2 (n : \u2115) (x : Fin n \u2192 \u211d) :\n \u2211 i, \u2211 j, \u221a|x i - x j| \u2264 \u2211 i, \u2211 j, \u221a|x i + x j| := by sorry", "category": "algebra"} {"name": "Imo1972P3", "solved": true, "tags": ["number theory"], "problem_id": "Imo1972P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1972, Problem 3\n\nLet m and n be non-negative integers. Prove that\n\n (2m)!(2n)! / (m!n!(m + n)!)\n\nis an integer.\n-/", "formal_statement": "theorem imo1972_p3 (m n : \u2115) :\n m ! * n ! * (m + n)! \u2223 (2 * m)! * (2 * n)! := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1972, Problem 3\n\nLet m and n be non-negative integers. Prove that\n\n (2m)!(2n)! / (m!n!(m + n)!)\n\nis an integer.\n-/\ntheorem imo1972_p3 (m n : \u2115) :\n m ! * n ! * (m + n)! \u2223 (2 * m)! * (2 * n)! := by sorry", "category": "number theory"} {"name": "Usa1978P1", "solved": true, "tags": ["algebra", "inequality"], "problem_id": "Usa1978P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 1978, Problem 1\n\nGiven that a,b,c,d,e are real numbers such that\n\n a + b + c + d + e = 8\n a\u00b2 + b\u00b2 + c\u00b2 + d\u00b2 + e\u00b2 = 16,\n\ndetermine the maximum value of e.\n-/", "formal_statement": "noncomputable abbrev max_e : \u211d := (16 : \u211d) / 5\n\nabbrev IsGood (a b c d e : \u211d) : Prop :=\n a + b + c + d + e = 8 \u2227 a^2 + b^2 + c^2 + d^2 + e^2 = 16\n\ntheorem usa1978_p1 :\n IsGreatest { e : \u211d | \u2203 a b c d : \u211d, IsGood a b c d e } max_e := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 1978, Problem 1\n\nGiven that a,b,c,d,e are real numbers such that\n\n a + b + c + d + e = 8\n a\u00b2 + b\u00b2 + c\u00b2 + d\u00b2 + e\u00b2 = 16,\n\ndetermine the maximum value of e.\n-/\nnoncomputable abbrev max_e : \u211d := (16 : \u211d) / 5\n\nabbrev IsGood (a b c d e : \u211d) : Prop :=\n a + b + c + d + e = 8 \u2227 a^2 + b^2 + c^2 + d^2 + e^2 = 16\n\ntheorem usa1978_p1 :\n IsGreatest { e : \u211d | \u2203 a b c d : \u211d, IsGood a b c d e } max_e := by sorry", "category": "algebra"} {"name": "Imo2024P1", "solved": true, "tags": ["algebra"], "problem_id": "Imo2024P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2024, Problem 1\n\nDetermine all real numbers \u03b1 such that, for every positive integer n, the\ninteger\n\n \u230a\u03b1\u230b + \u230a2\u03b1\u230b + ... + \u230an\u03b1\u230b\n\nis a multiple of n.\n-/", "formal_statement": "abbrev solutionSet : Set \u211d := {\u03b1 : \u211d | \u2203 m : \u2124, \u03b1 = 2 * m}\n\ntheorem imo2024_p1 (\u03b1 : \u211d) :\n \u03b1 \u2208 solutionSet \u2194\n \u2200 n : \u2115, 0 < n \u2192 (n : \u2124) \u2223 \u2211 i \u2208 Finset.Icc 1 n, \u230ai * \u03b1\u230b := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2024, Problem 1\n\nDetermine all real numbers \u03b1 such that, for every positive integer n, the\ninteger\n\n \u230a\u03b1\u230b + \u230a2\u03b1\u230b + ... + \u230an\u03b1\u230b\n\nis a multiple of n.\n-/\nabbrev solutionSet : Set \u211d := {\u03b1 : \u211d | \u2203 m : \u2124, \u03b1 = 2 * m}\n\ntheorem imo2024_p1 (\u03b1 : \u211d) :\n \u03b1 \u2208 solutionSet \u2194\n \u2200 n : \u2115, 0 < n \u2192 (n : \u2124) \u2223 \u2211 i \u2208 Finset.Icc 1 n, \u230ai * \u03b1\u230b := by sorry", "category": "algebra"} {"name": "Imo1964P4", "solved": true, "tags": ["combinatorics"], "problem_id": "Imo1964P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1964, Problem 4\n\nSeventeen people correspond by mail with one another -- each one with\nall the rest. In their letters only three different topics are\ndiscussed. Each pair of correspondents deals with only one of the topics.\nProve that there are at least three people who write to each other\nabout the same topic.\n\n-/", "formal_statement": "theorem imo1964_p4\n (Person Topic : Type)\n [Fintype Person] [DecidableEq Person]\n [Fintype Topic] [DecidableEq Topic]\n (card_person : Fintype.card Person = 17)\n (card_topic : Fintype.card Topic = 3)\n (discusses : Person \u2192 Person \u2192 Topic)\n (discussion_sym : \u2200 p1 p2 : Person, discusses p1 p2 = discusses p2 p1) :\n \u2203 t : Topic, \u2203 s : Finset Person,\n 2 < s.card \u2227\n \u2200 p1 \u2208 s, \u2200 p2 \u2208 s, p1 \u2260 p2 \u2192 discusses p1 p2 = t := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1964, Problem 4\n\nSeventeen people correspond by mail with one another -- each one with\nall the rest. In their letters only three different topics are\ndiscussed. Each pair of correspondents deals with only one of the topics.\nProve that there are at least three people who write to each other\nabout the same topic.\n\n-/\ntheorem imo1964_p4\n (Person Topic : Type)\n [Fintype Person] [DecidableEq Person]\n [Fintype Topic] [DecidableEq Topic]\n (card_person : Fintype.card Person = 17)\n (card_topic : Fintype.card Topic = 3)\n (discusses : Person \u2192 Person \u2192 Topic)\n (discussion_sym : \u2200 p1 p2 : Person, discusses p1 p2 = discusses p2 p1) :\n \u2203 t : Topic, \u2203 s : Finset Person,\n 2 < s.card \u2227\n \u2200 p1 \u2208 s, \u2200 p2 \u2208 s, p1 \u2260 p2 \u2192 discusses p1 p2 = t := by sorry", "category": "combinatorics"} {"name": "Imo1961P1b", "problem_id": "Imo1961P1b", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1961, Problem 1.\n\nGiven constants a and b, solve the system of equations\n\n x + y + z = a\n x\u00b2 + y\u00b2 + z\u00b2 = b\u00b2\n xy = z\u00b2\n\nfor x,y,z. Give the conditions that a and b must satisfy so that\nthe solutions x,y,z are distinct positive numbers.\n-/", "formal_statement": "abbrev IsSolution (a b x y z : \u211d) : Prop :=\n x + y + z = a \u2227\n x^2 + y^2 + z^2 = b^2 \u2227\n x * y = z^2\n\nabbrev ab_that_make_xyz_positive_distinct : Set (\u211d \u00d7 \u211d) :=\n { q | let \u27e8a,b\u27e9 := q\n b^2 < a^2 \u2227 a^2 < 3 * b ^ 2 }\n\ntheorem imo1961_p1b (a b : \u211d) :\n \u27e8a,b\u27e9 \u2208 ab_that_make_xyz_positive_distinct \u2194\n (\u2200 x y z, IsSolution a b x y z \u2192 0 < x \u2227 0 < y \u2227 0 < z \u2227 [x,y,z].Nodup) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1961, Problem 1.\n\nGiven constants a and b, solve the system of equations\n\n x + y + z = a\n x\u00b2 + y\u00b2 + z\u00b2 = b\u00b2\n xy = z\u00b2\n\nfor x,y,z. Give the conditions that a and b must satisfy so that\nthe solutions x,y,z are distinct positive numbers.\n-/\nabbrev IsSolution (a b x y z : \u211d) : Prop :=\n x + y + z = a \u2227\n x^2 + y^2 + z^2 = b^2 \u2227\n x * y = z^2\n\nabbrev ab_that_make_xyz_positive_distinct : Set (\u211d \u00d7 \u211d) :=\n { q | let \u27e8a,b\u27e9 := q\n b^2 < a^2 \u2227 a^2 < 3 * b ^ 2 }\n\ntheorem imo1961_p1b (a b : \u211d) :\n \u27e8a,b\u27e9 \u2208 ab_that_make_xyz_positive_distinct \u2194\n (\u2200 x y z, IsSolution a b x y z \u2192 0 < x \u2227 0 < y \u2227 0 < z \u2227 [x,y,z].Nodup) := by sorry", "tags": ["algebra"], "solved": false, "category": "algebra"} {"name": "Usa2001P1", "solved": false, "tags": ["combinatorics"], "problem_id": "Usa2001P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 2001, Problem 1\n\nEach of eight boxes contains six balls.\nEach ball has been colored with one of n colors, such that no two balls\nin the same box are the same color, and no two colors occur together in\nmore than one box. Determine, with justification, the smallest integer n\nfor which this is possible.\n-/", "formal_statement": "def possible_num_colors : Set \u2115 :=\n{ n : \u2115 | \u2203 f : Fin 8 \u2192 Finset (Fin n),\n (\u2200 i, (f i).card = 6) \u2227\n (\u2200 x y : Fin n, \u2200 i j : Fin 8,\n i \u2260 j \u2192 x \u2208 f i \u2192 y \u2208 f i \u2192\n (\u00ac (x \u2208 f j \u2227 y \u2208 f j))) }\n\nabbrev min_colors : \u2115 := 23\n\ntheorem usa2001_p1 : IsLeast possible_num_colors min_colors := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 2001, Problem 1\n\nEach of eight boxes contains six balls.\nEach ball has been colored with one of n colors, such that no two balls\nin the same box are the same color, and no two colors occur together in\nmore than one box. Determine, with justification, the smallest integer n\nfor which this is possible.\n-/\ndef possible_num_colors : Set \u2115 :=\n{ n : \u2115 | \u2203 f : Fin 8 \u2192 Finset (Fin n),\n (\u2200 i, (f i).card = 6) \u2227\n (\u2200 x y : Fin n, \u2200 i j : Fin 8,\n i \u2260 j \u2192 x \u2208 f i \u2192 y \u2208 f i \u2192\n (\u00ac (x \u2208 f j \u2227 y \u2208 f j))) }\n\nabbrev min_colors : \u2115 := 23\n\ntheorem usa2001_p1 : IsLeast possible_num_colors min_colors := by sorry", "category": "combinatorics"} {"name": "Imo2015P2", "solved": false, "tags": ["number theory"], "problem_id": "Imo2015P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2015, Problem 2\n\nDetermine all triples of positive integers a, b, c such that each of\nab - c, bc - a, ca - b is a power of two.\n-/", "formal_statement": "abbrev SolutionSet : Set (\u2124 \u00d7 \u2124 \u00d7 \u2124) := \n {(2, 2, 2), (2, 2, 3), (3, 2, 2), (2, 3, 2),\n (2, 6, 11), (2, 11, 6), (6, 2, 11), (6, 11, 2), (11, 2, 6), (11, 6, 2),\n (3, 5, 7), (3, 7, 5), (5, 3, 7), (5, 7, 3), (7, 3, 5), (7, 5, 3)}\n\ndef is_power_of_two (n : \u2124) : Prop := \u2203 m : \u2115, n = 2 ^ m\n\ntheorem imo2015_p2 (a b c : \u2124) :\n (a,b,c) \u2208 SolutionSet \u2194\n 0 < a \u2227 0 < b \u2227 0 < c \u2227\n is_power_of_two (a * b - c) \u2227\n is_power_of_two (b * c - a) \u2227\n is_power_of_two (c * a - b) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2015, Problem 2\n\nDetermine all triples of positive integers a, b, c such that each of\nab - c, bc - a, ca - b is a power of two.\n-/\nabbrev SolutionSet : Set (\u2124 \u00d7 \u2124 \u00d7 \u2124) := \n {(2, 2, 2), (2, 2, 3), (3, 2, 2), (2, 3, 2),\n (2, 6, 11), (2, 11, 6), (6, 2, 11), (6, 11, 2), (11, 2, 6), (11, 6, 2),\n (3, 5, 7), (3, 7, 5), (5, 3, 7), (5, 7, 3), (7, 3, 5), (7, 5, 3)}\n\ndef is_power_of_two (n : \u2124) : Prop := \u2203 m : \u2115, n = 2 ^ m\n\ntheorem imo2015_p2 (a b c : \u2124) :\n (a,b,c) \u2208 SolutionSet \u2194\n 0 < a \u2227 0 < b \u2227 0 < c \u2227\n is_power_of_two (a * b - c) \u2227\n is_power_of_two (b * c - a) \u2227\n is_power_of_two (c * a - b) := by sorry", "category": "number theory"} {"name": "Imo1960P2", "solved": true, "tags": ["algebra"], "problem_id": "Imo1960P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1960, Problem 2\n\nFor what values of the variable $x$ does the following inequality hold:\n\n\\[\\dfrac{4x^2}{(1 - \\sqrt {2x + 1})^2} < 2x + 9 \\ ?\\]\n-/", "formal_statement": "/- special open -/ open Set\n\n\n\n\n\n\n/-- The predicate says that `x` satisfies the inequality\n\n\\[\\dfrac{4x^2}{(1 - \\sqrt {2x + 1})^2} < 2x + 9\\]\n\nand belongs to the domain of the function on the left-hand side.\n-/\n@[mk_iff isGood_iff']\nstructure IsGood (x : \u211d) : Prop where\n /-- The number satisfies the inequality. -/\n ineq : 4 * x ^ 2 / (1 - sqrt (2 * x + 1)) ^ 2 < 2 * x + 9\n /-- The number belongs to the domain of \\(\\sqrt {2x + 1}\\). -/\n sqrt_dom : 0 \u2264 2 * x + 1\n /-- The number belongs to the domain of the denominator. -/\n denom_dom : (1 - sqrt (2 * x + 1)) ^ 2 \u2260 0\n\nabbrev SolutionSet : Set \u211d := Ico (-1/2) (45/8) \\ {0}\n\ntheorem imo1960_p2 {x} : IsGood x \u2194 x \u2208 SolutionSet := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1960, Problem 2\n\nFor what values of the variable $x$ does the following inequality hold:\n\n\\[\\dfrac{4x^2}{(1 - \\sqrt {2x + 1})^2} < 2x + 9 \\ ?\\]\n-/\n/- special open -/ open Set\n\n\n\n\n\n\n/-- The predicate says that `x` satisfies the inequality\n\n\\[\\dfrac{4x^2}{(1 - \\sqrt {2x + 1})^2} < 2x + 9\\]\n\nand belongs to the domain of the function on the left-hand side.\n-/\n@[mk_iff isGood_iff']\nstructure IsGood (x : \u211d) : Prop where\n /-- The number satisfies the inequality. -/\n ineq : 4 * x ^ 2 / (1 - sqrt (2 * x + 1)) ^ 2 < 2 * x + 9\n /-- The number belongs to the domain of \\(\\sqrt {2x + 1}\\). -/\n sqrt_dom : 0 \u2264 2 * x + 1\n /-- The number belongs to the domain of the denominator. -/\n denom_dom : (1 - sqrt (2 * x + 1)) ^ 2 \u2260 0\n\nabbrev SolutionSet : Set \u211d := Ico (-1/2) (45/8) \\ {0}\n\ntheorem imo1960_p2 {x} : IsGood x \u2194 x \u2208 SolutionSet := by sorry", "category": "algebra"} {"name": "Imo1969P1", "solved": true, "tags": ["number theory"], "problem_id": "Imo1969P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1969, Problem 1\n\nProve that there are infinitely many natural numbers a with the following property:\nthe number z = n\u2074 + a is not prime for any natural number n.\n-/", "formal_statement": "/- special open -/ open Int\n\n\n\n\n\n\ntheorem imo1969_p1 : Set.Infinite {a : \u2115 | \u2200 n : \u2115, \u00acNat.Prime (n ^ 4 + a)} := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1969, Problem 1\n\nProve that there are infinitely many natural numbers a with the following property:\nthe number z = n\u2074 + a is not prime for any natural number n.\n-/\n/- special open -/ open Int\n\n\n\n\n\n\ntheorem imo1969_p1 : Set.Infinite {a : \u2115 | \u2200 n : \u2115, \u00acNat.Prime (n ^ 4 + a)} := by sorry", "category": "number theory"} {"name": "Imo2011P5", "solved": false, "tags": ["number theory"], "problem_id": "Imo2011P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2011, Problem 5\n\nLet f be a function from the set of integers to the set\nof positive integers. Suppose that, for any two integers\nm and n, the difference f(m) - f(n) is divisible by\nf (m - n). Prove that, for all integers m and n with\nf(m) \u2264 f(n), the number f(n) is divisible by f(m).\n-/", "formal_statement": "theorem imo2011_p5 (f : \u2124 \u2192 \u2124)\n (fpos : \u2200 n, 0 < f n)\n (fpos : \u2200 m n, f (m - n) \u2223 f m - f n)\n : \u2200 m n, f m \u2264 f n \u2192 f m \u2223 f n := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2011, Problem 5\n\nLet f be a function from the set of integers to the set\nof positive integers. Suppose that, for any two integers\nm and n, the difference f(m) - f(n) is divisible by\nf (m - n). Prove that, for all integers m and n with\nf(m) \u2264 f(n), the number f(n) is divisible by f(m).\n-/\ntheorem imo2011_p5 (f : \u2124 \u2192 \u2124)\n (fpos : \u2200 n, 0 < f n)\n (fpos : \u2200 m n, f (m - n) \u2223 f m - f n)\n : \u2200 m n, f m \u2264 f n \u2192 f m \u2223 f n := by sorry", "category": "number theory"} {"name": "Imo2019P2", "solved": true, "tags": ["geometry"], "problem_id": "Imo2019P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2019, Problem 2\n\nIn triangle `ABC`, point `A\u2081` lies on side `BC` and point `B\u2081` lies on side `AC`. Let `P` and\n`Q` be points on segments `AA\u2081` and `BB\u2081`, respectively, such that `PQ` is parallel to `AB`.\nLet `P\u2081` be a point on line `PB\u2081`, such that `B\u2081` lies strictly between `P` and `P\u2081`, and\n`\u2220PP\u2081C = \u2220BAC`. Similarly, let `Q\u2081` be a point on line `QA\u2081`, such that `A\u2081` lies strictly\nbetween `Q` and `Q\u2081`, and `\u2220CQ\u2081Q = \u2220CBA`.\n\nProve that points `P`, `Q`, `P\u2081`, and `Q\u2081` are concyclic.\n-/", "formal_statement": "/- special open -/ open Affine EuclideanGeometry FiniteDimensional Module Simplex\n\n\n\n\n\n\nattribute [local instance] FiniteDimensional.of_fact_finrank_eq_two\n\nvariable (V : Type*) (Pt : Type*)\n\nvariable [NormedAddCommGroup V] [InnerProductSpace \u211d V] [MetricSpace Pt]\n\nvariable [NormedAddTorsor V Pt]\n\n\ntheorem imo2019_p2 [Fact (finrank \u211d V = 2)] (A B C A\u2081 B\u2081 P Q P\u2081 Q\u2081 : Pt)\n (affine_independent_ABC : AffineIndependent \u211d ![A, B, C]) (wbtw_B_A\u2081_C : Wbtw \u211d B A\u2081 C)\n (wbtw_A_B\u2081_C : Wbtw \u211d A B\u2081 C) (wbtw_A_P_A\u2081 : Wbtw \u211d A P A\u2081) (wbtw_B_Q_B\u2081 : Wbtw \u211d B Q B\u2081)\n (PQ_parallel_AB : line[\u211d, P, Q] \u2225 line[\u211d, A, B]) (P_ne_Q : P \u2260 Q)\n (sbtw_P_B\u2081_P\u2081 : Sbtw \u211d P B\u2081 P\u2081) (angle_PP\u2081C_eq_angle_BAC : \u2220 P P\u2081 C = \u2220 B A C)\n (C_ne_P\u2081 : C \u2260 P\u2081) (sbtw_Q_A\u2081_Q\u2081 : Sbtw \u211d Q A\u2081 Q\u2081)\n (angle_CQ\u2081Q_eq_angle_CBA : \u2220 C Q\u2081 Q = \u2220 C B A) (C_ne_Q\u2081 : C \u2260 Q\u2081) :\n Concyclic ({P, Q, P\u2081, Q\u2081} : Set Pt) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2019, Problem 2\n\nIn triangle `ABC`, point `A\u2081` lies on side `BC` and point `B\u2081` lies on side `AC`. Let `P` and\n`Q` be points on segments `AA\u2081` and `BB\u2081`, respectively, such that `PQ` is parallel to `AB`.\nLet `P\u2081` be a point on line `PB\u2081`, such that `B\u2081` lies strictly between `P` and `P\u2081`, and\n`\u2220PP\u2081C = \u2220BAC`. Similarly, let `Q\u2081` be a point on line `QA\u2081`, such that `A\u2081` lies strictly\nbetween `Q` and `Q\u2081`, and `\u2220CQ\u2081Q = \u2220CBA`.\n\nProve that points `P`, `Q`, `P\u2081`, and `Q\u2081` are concyclic.\n-/\n/- special open -/ open Affine EuclideanGeometry FiniteDimensional Module Simplex\n\n\n\n\n\n\nattribute [local instance] FiniteDimensional.of_fact_finrank_eq_two\n\nvariable (V : Type*) (Pt : Type*)\n\nvariable [NormedAddCommGroup V] [InnerProductSpace \u211d V] [MetricSpace Pt]\n\nvariable [NormedAddTorsor V Pt]\n\n\ntheorem imo2019_p2 [Fact (finrank \u211d V = 2)] (A B C A\u2081 B\u2081 P Q P\u2081 Q\u2081 : Pt)\n (affine_independent_ABC : AffineIndependent \u211d ![A, B, C]) (wbtw_B_A\u2081_C : Wbtw \u211d B A\u2081 C)\n (wbtw_A_B\u2081_C : Wbtw \u211d A B\u2081 C) (wbtw_A_P_A\u2081 : Wbtw \u211d A P A\u2081) (wbtw_B_Q_B\u2081 : Wbtw \u211d B Q B\u2081)\n (PQ_parallel_AB : line[\u211d, P, Q] \u2225 line[\u211d, A, B]) (P_ne_Q : P \u2260 Q)\n (sbtw_P_B\u2081_P\u2081 : Sbtw \u211d P B\u2081 P\u2081) (angle_PP\u2081C_eq_angle_BAC : \u2220 P P\u2081 C = \u2220 B A C)\n (C_ne_P\u2081 : C \u2260 P\u2081) (sbtw_Q_A\u2081_Q\u2081 : Sbtw \u211d Q A\u2081 Q\u2081)\n (angle_CQ\u2081Q_eq_angle_CBA : \u2220 C Q\u2081 Q = \u2220 C B A) (C_ne_Q\u2081 : C \u2260 Q\u2081) :\n Concyclic ({P, Q, P\u2081, Q\u2081} : Set Pt) := by sorry", "category": "geometry"} {"name": "Imo2010P1", "solved": true, "tags": ["algebra"], "problem_id": "Imo2010P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2010, Problem 1\n\nDetermine all functions f : \u211d \u2192 \u211d such that for all x,y \u2208 \u211d,\n\n f(\u230ax\u230by) = f(x)\u230af(y)\u230b.\n-/", "formal_statement": "abbrev solution_set : Set (\u211d \u2192 \u211d) :=\n { f | (\u2203 C, \u230aC\u230b = 1 \u2227 f = Function.const _ C) \u2228 f = Function.const _ 0 }\n\ntheorem imo2010_p1 (f : \u211d \u2192 \u211d) :\n f \u2208 solution_set \u2194 \u2200 x y, f (\u230ax\u230b * y) = f x * \u230af y\u230b := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2010, Problem 1\n\nDetermine all functions f : \u211d \u2192 \u211d such that for all x,y \u2208 \u211d,\n\n f(\u230ax\u230by) = f(x)\u230af(y)\u230b.\n-/\nabbrev solution_set : Set (\u211d \u2192 \u211d) :=\n { f | (\u2203 C, \u230aC\u230b = 1 \u2227 f = Function.const _ C) \u2228 f = Function.const _ 0 }\n\ntheorem imo2010_p1 (f : \u211d \u2192 \u211d) :\n f \u2208 solution_set \u2194 \u2200 x y, f (\u230ax\u230b * y) = f x * \u230af y\u230b := by sorry", "category": "algebra"} {"name": "Imo1965P1", "solved": true, "tags": ["algebra"], "problem_id": "Imo1965P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1965, Problem 1\n\nDetermine all values x in the interval 0 \u2264 x \u2264 2\u03c0 which\nsatisfy the inequality\n\n 2 cos x \u2264 |\u221a(1 + sin 2x) \u2212 \u221a(1 \u2212 sin 2x)| \u2264 \u221a2.\n-/", "formal_statement": "/- special open -/ open Set\n\n\n\n\nabbrev the_answer : Set \u211d := Set.Icc (Real.pi/4) (7*Real.pi/4)\n\ntheorem imo1965_p1 :\n {x \u2208 Set.Icc 0 (2*Real.pi) |\n |Real.sqrt (1 + Real.sin (2*x)) - Real.sqrt (1 - Real.sin (2*x))| \u2208 Set.Icc (2 * Real.cos x) (Real.sqrt 2)}\n = the_answer := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1965, Problem 1\n\nDetermine all values x in the interval 0 \u2264 x \u2264 2\u03c0 which\nsatisfy the inequality\n\n 2 cos x \u2264 |\u221a(1 + sin 2x) \u2212 \u221a(1 \u2212 sin 2x)| \u2264 \u221a2.\n-/\n/- special open -/ open Set\n\n\n\n\nabbrev the_answer : Set \u211d := Set.Icc (Real.pi/4) (7*Real.pi/4)\n\ntheorem imo1965_p1 :\n {x \u2208 Set.Icc 0 (2*Real.pi) |\n |Real.sqrt (1 + Real.sin (2*x)) - Real.sqrt (1 - Real.sin (2*x))| \u2208 Set.Icc (2 * Real.cos x) (Real.sqrt 2)}\n = the_answer := by sorry", "category": "algebra"} {"name": "Imo1966P4", "solved": true, "tags": ["algebra"], "problem_id": "Imo1966P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1966, Problem 4\n\nProve that for every natural number n and for every real\nnumber x that is not of the form k\u03c0/2\u1d57 for t a non-negative\ninteger and k any integer,\n\n 1 / (sin 2x) + 1 / (sin 4x) + ... + 1 / (sin 2\u207fx) = cot x - cot 2\u207f x.\n-/", "formal_statement": "theorem imo1966_p4 (n : \u2115) (x : \u211d)\n (hx : \u2200 t : \u2115, \u2200 k : \u2124, x \u2260 k * Real.pi / 2^t) :\n \u2211 i \u2208 Finset.range n, 1 / Real.sin (2^(i + 1) * x) =\n Real.cot x - Real.cot (2^n * x) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1966, Problem 4\n\nProve that for every natural number n and for every real\nnumber x that is not of the form k\u03c0/2\u1d57 for t a non-negative\ninteger and k any integer,\n\n 1 / (sin 2x) + 1 / (sin 4x) + ... + 1 / (sin 2\u207fx) = cot x - cot 2\u207f x.\n-/\ntheorem imo1966_p4 (n : \u2115) (x : \u211d)\n (hx : \u2200 t : \u2115, \u2200 k : \u2124, x \u2260 k * Real.pi / 2^t) :\n \u2211 i \u2208 Finset.range n, 1 / Real.sin (2^(i + 1) * x) =\n Real.cot x - Real.cot (2^n * x) := by sorry", "category": "algebra"} {"name": "Usa2003P1", "solved": true, "tags": ["number theory"], "problem_id": "Usa2003P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 2003, Problem 1\n\nProve that for every positive integer n there exists an n-digit\nnumber divisible by 5\u207f, all of whose digits are odd.\n-/", "formal_statement": "theorem usa2003_p1 (n : \u2115) :\n \u2203 m, (Nat.digits 10 m).length = n \u2227\n 5^n \u2223 m \u2227 (Nat.digits 10 m).all (Odd \u00b7) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 2003, Problem 1\n\nProve that for every positive integer n there exists an n-digit\nnumber divisible by 5\u207f, all of whose digits are odd.\n-/\ntheorem usa2003_p1 (n : \u2115) :\n \u2203 m, (Nat.digits 10 m).length = n \u2227\n 5^n \u2223 m \u2227 (Nat.digits 10 m).all (Odd \u00b7) := by sorry", "category": "number theory"} {"name": "Imo2023P2", "solved": false, "tags": ["geometry"], "problem_id": "Imo2023P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2023, Problem 2\n\nLet ABC be an acute-angled triangle with AB < AC.\nLet \u03a9 be the circumcircle of ABC.\nLet S be the midpoint of the arc CB of \u03a9 containing A.\nThe perpendicular from A to BC meets BS at D and meets \u03a9 again at E \u2260 A.\nThe line through D parallel to BC meets line BE at L.\nDenote the circumcircle of triangle BDL by \u03c9.\nLet \u03c9 meet \u03a9 again at P \u2260 B.\nProve that the line tangent to \u03c9 at P meets line BS on the internal angle bisector of \u2220BAC.\n-/", "formal_statement": "/- special open -/ open Affine EuclideanGeometry FiniteDimensional InnerProductSpace Module Simplex\n\n\n\n\n\n\nattribute [local instance] FiniteDimensional.of_fact_finrank_eq_two\n\nvariable (V : Type*) (Pt : Type*)\n\nvariable [NormedAddCommGroup V] [InnerProductSpace \u211d V] [MetricSpace Pt]\n\nvariable [NormedAddTorsor V Pt] [hd2 : Fact (finrank \u211d V = 2)]\n\nvariable [Module.Oriented \u211d V (Fin 2)]\n\ndef acute (A B C : Pt) : Prop :=\n \u2220 A B C < Real.pi / 2 \u2227 \u2220 B C A < Real.pi / 2 \u2227 \u2220 C A B < Real.pi / 2\n\ndef perp_to (l : AffineSubspace \u211d Pt) (m : AffineSubspace \u211d Pt) : Prop :=\n \u2200 x \u2208 l.direction, \u2200 y \u2208 m.direction, \u27eax, y\u27eb_\u211d = 0\n\n/-- A space is tangent to a sphere if it intersects it at exactly one point -/\ndef is_tangent (L : AffineSubspace \u211d Pt) (\u03c9 : Sphere Pt) : Prop :=\n \u2203! P : Pt, P \u2208 (\u03c9 : Set Pt) \u2227 P \u2208 L\n\n\ntheorem imo2023_p1\n -- Points\n ( A B C D E L S P : Pt )\n -- Circles\n ( \u03a9 \u03c9 : Sphere Pt )\n -- Lines\n ( perp_A_BC prll_D_BC tang_P_\u03c9 : AffineSubspace \u211d Pt )\n -- Let ABC be an acute-angled triangle\n ( h_acute_ABC : acute V Pt A B C )\n -- with AB < AC.\n ( h_AB_lt_BC : dist A B < dist A C )\n -- Let \u03a9 be the circumcircle of ABC.\n ( h_\u03a9 : {A, B, C} \u2286 (\u03a9 : Set Pt) )\n -- Let S be the midpoint of the arc CB of \u03a9\n ( h_S_\u03a9 : dist S C = dist S B \u2227 S \u2208 (\u03a9 : Set Pt))\n -- ... containing A.\n (h_S_A : (\u2221 C B S).sign = (\u2221 C B A).sign)\n -- The perpendicular from A to BC ...\n (h_perp_A_BC : perp_to V Pt perp_A_BC (affineSpan \u211d {B, C}) \u2227 A \u2208 perp_A_BC)\n -- ... meets BS at D\n ( h_D : D \u2208 (perp_A_BC : Set Pt) \u2229 (affineSpan \u211d {B, S}) )\n -- ... and meets \u03a9 again at E ...\n ( h_E : E \u2208 (perp_A_BC : Set Pt) \u2229 \u03a9 )\n -- ... E \u2260 A.\n ( h_E_ne_A : E \u2260 A )\n -- The line through D parallel to BC ...\n ( h_prll_D_BC : D \u2208 prll_D_BC \u2227 AffineSubspace.Parallel prll_D_BC (affineSpan \u211d {B, C}))\n --- ... meets line BE at L.\n ( h_L : L \u2208 (prll_D_BC : Set Pt) \u2229 affineSpan \u211d {B, E} )\n -- Denote the circumcircle of triangle BDL by \u03c9.\n ( h_\u03c9 : {B, D, L} \u2286 (\u03c9 : Set Pt) )\n -- Let \u03c9 meet \u03a9 again at P ...\n ( h_P : P \u2208 (\u03c9 : Set Pt) \u2229 \u03a9 )\n -- P \u2260 B.\n ( h_P_ne_B : P \u2260 B )\n -- Prove that the line tangent to \u03c9 at P ...\n ( h_tang_P_\u03c9 : is_tangent V Pt tang_P_\u03c9 \u03c9 \u2227 P \u2208 tang_P_\u03c9) :\n -- meets line BS on the internal angle bisector of \u2220BAC.\n \u2203 X : Pt,\n X \u2208 (tang_P_\u03c9 : Set Pt) \u2229 affineSpan \u211d {B, S}\n \u2227 \u2220 B A X = \u2220 X A C\n \u2227 \u2220 B A X < Real.pi / 2 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2023, Problem 2\n\nLet ABC be an acute-angled triangle with AB < AC.\nLet \u03a9 be the circumcircle of ABC.\nLet S be the midpoint of the arc CB of \u03a9 containing A.\nThe perpendicular from A to BC meets BS at D and meets \u03a9 again at E \u2260 A.\nThe line through D parallel to BC meets line BE at L.\nDenote the circumcircle of triangle BDL by \u03c9.\nLet \u03c9 meet \u03a9 again at P \u2260 B.\nProve that the line tangent to \u03c9 at P meets line BS on the internal angle bisector of \u2220BAC.\n-/\n/- special open -/ open Affine EuclideanGeometry FiniteDimensional InnerProductSpace Module Simplex\n\n\n\n\n\n\nattribute [local instance] FiniteDimensional.of_fact_finrank_eq_two\n\nvariable (V : Type*) (Pt : Type*)\n\nvariable [NormedAddCommGroup V] [InnerProductSpace \u211d V] [MetricSpace Pt]\n\nvariable [NormedAddTorsor V Pt] [hd2 : Fact (finrank \u211d V = 2)]\n\nvariable [Module.Oriented \u211d V (Fin 2)]\n\ndef acute (A B C : Pt) : Prop :=\n \u2220 A B C < Real.pi / 2 \u2227 \u2220 B C A < Real.pi / 2 \u2227 \u2220 C A B < Real.pi / 2\n\ndef perp_to (l : AffineSubspace \u211d Pt) (m : AffineSubspace \u211d Pt) : Prop :=\n \u2200 x \u2208 l.direction, \u2200 y \u2208 m.direction, \u27eax, y\u27eb_\u211d = 0\n\n/-- A space is tangent to a sphere if it intersects it at exactly one point -/\ndef is_tangent (L : AffineSubspace \u211d Pt) (\u03c9 : Sphere Pt) : Prop :=\n \u2203! P : Pt, P \u2208 (\u03c9 : Set Pt) \u2227 P \u2208 L\n\n\ntheorem imo2023_p1\n -- Points\n ( A B C D E L S P : Pt )\n -- Circles\n ( \u03a9 \u03c9 : Sphere Pt )\n -- Lines\n ( perp_A_BC prll_D_BC tang_P_\u03c9 : AffineSubspace \u211d Pt )\n -- Let ABC be an acute-angled triangle\n ( h_acute_ABC : acute V Pt A B C )\n -- with AB < AC.\n ( h_AB_lt_BC : dist A B < dist A C )\n -- Let \u03a9 be the circumcircle of ABC.\n ( h_\u03a9 : {A, B, C} \u2286 (\u03a9 : Set Pt) )\n -- Let S be the midpoint of the arc CB of \u03a9\n ( h_S_\u03a9 : dist S C = dist S B \u2227 S \u2208 (\u03a9 : Set Pt))\n -- ... containing A.\n (h_S_A : (\u2221 C B S).sign = (\u2221 C B A).sign)\n -- The perpendicular from A to BC ...\n (h_perp_A_BC : perp_to V Pt perp_A_BC (affineSpan \u211d {B, C}) \u2227 A \u2208 perp_A_BC)\n -- ... meets BS at D\n ( h_D : D \u2208 (perp_A_BC : Set Pt) \u2229 (affineSpan \u211d {B, S}) )\n -- ... and meets \u03a9 again at E ...\n ( h_E : E \u2208 (perp_A_BC : Set Pt) \u2229 \u03a9 )\n -- ... E \u2260 A.\n ( h_E_ne_A : E \u2260 A )\n -- The line through D parallel to BC ...\n ( h_prll_D_BC : D \u2208 prll_D_BC \u2227 AffineSubspace.Parallel prll_D_BC (affineSpan \u211d {B, C}))\n --- ... meets line BE at L.\n ( h_L : L \u2208 (prll_D_BC : Set Pt) \u2229 affineSpan \u211d {B, E} )\n -- Denote the circumcircle of triangle BDL by \u03c9.\n ( h_\u03c9 : {B, D, L} \u2286 (\u03c9 : Set Pt) )\n -- Let \u03c9 meet \u03a9 again at P ...\n ( h_P : P \u2208 (\u03c9 : Set Pt) \u2229 \u03a9 )\n -- P \u2260 B.\n ( h_P_ne_B : P \u2260 B )\n -- Prove that the line tangent to \u03c9 at P ...\n ( h_tang_P_\u03c9 : is_tangent V Pt tang_P_\u03c9 \u03c9 \u2227 P \u2208 tang_P_\u03c9) :\n -- meets line BS on the internal angle bisector of \u2220BAC.\n \u2203 X : Pt,\n X \u2208 (tang_P_\u03c9 : Set Pt) \u2229 affineSpan \u211d {B, S}\n \u2227 \u2220 B A X = \u2220 X A C\n \u2227 \u2220 B A X < Real.pi / 2 := by sorry", "category": "geometry"} {"name": "Imo2005P3", "solved": true, "tags": ["algebra"], "problem_id": "Imo2005P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2005, Problem 3\nLet `x`, `y` and `z` be positive real numbers such that `xyz \u2265 1`. Prove that:\n`(x^5 - x^2)/(x^5 + y^2 + z^2) + (y^5 - y^2)/(y^5 + z^2 + x^2) + (z^5 - z^2)/(z^5 + x^2 + y^2) \u2265 0`\n-/", "formal_statement": "theorem imo2005_p3 (x y z : \u211d) (hx : x > 0) (hy : y > 0) (hz : z > 0) (h : x * y * z \u2265 1) :\n (x ^ 5 - x ^ 2) / (x ^ 5 + y ^ 2 + z ^ 2) + (y ^ 5 - y ^ 2) / (y ^ 5 + z ^ 2 + x ^ 2) +\n (z ^ 5 - z ^ 2) / (z ^ 5 + x ^ 2 + y ^ 2) \u2265\n 0 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2005, Problem 3\nLet `x`, `y` and `z` be positive real numbers such that `xyz \u2265 1`. Prove that:\n`(x^5 - x^2)/(x^5 + y^2 + z^2) + (y^5 - y^2)/(y^5 + z^2 + x^2) + (z^5 - z^2)/(z^5 + x^2 + y^2) \u2265 0`\n-/\ntheorem imo2005_p3 (x y z : \u211d) (hx : x > 0) (hy : y > 0) (hz : z > 0) (h : x * y * z \u2265 1) :\n (x ^ 5 - x ^ 2) / (x ^ 5 + y ^ 2 + z ^ 2) + (y ^ 5 - y ^ 2) / (y ^ 5 + z ^ 2 + x ^ 2) +\n (z ^ 5 - z ^ 2) / (z ^ 5 + x ^ 2 + y ^ 2) \u2265\n 0 := by sorry", "category": "algebra"} {"name": "KolmogorovStreams", "solved": true, "tags": ["combinatorics"], "problem_id": "KolmogorovStreams", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n\nPuzzle referenced from this tweet: https://twitter.com/sigfpe/status/1474173467016589323\n\nFrom the book _Out of their Minds: The Lives and Discoveries of 15 Great Computer Scientists_\nby Dennis Shasha and Cathy Lazere.\n\n\nProblem: Suppose each (finite) word is either \"decent\" or \"indecent\". Given an infinite\nsequence of characters, can you always break it into finite words so that all of them\nexcept perhaps the first one belong to the same class?\n\n-/", "formal_statement": "/- special open -/ open Stream\n\n\n\n\n\nvariable {\u03b1 : Type}\n\ndef break_into_words :\n (Stream' \u2115) \u2192 -- word lengths\n (Stream' \u03b1) \u2192 -- original sequence\n (Stream' (List \u03b1)) -- sequence of words\n := Function.curry\n (Stream'.corec\n (\u03bb \u27e8lengths, a'\u27e9 \u21a6 a'.take lengths.head)\n (\u03bb \u27e8lengths, a'\u27e9 \u21a6 \u27e8lengths.tail, a'.drop lengths.head\u27e9))\n\ndef all_same_class\n (is_decent : List \u03b1 \u2192 Prop)\n (b : Stream' (List \u03b1))\n : Prop :=\n b.All is_decent \u2228 b.All (\u03bb w \u21a6 \u00acis_decent w)\n\ntheorem kolmogorov_streams\n (is_decent : List \u03b1 \u2192 Prop)\n (a : Stream' \u03b1)\n : (\u2203 (lengths : Stream' \u2115),\n (lengths.All (0 < \u00b7) \u2227\n all_same_class is_decent (break_into_words lengths a).tail)) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n\nPuzzle referenced from this tweet: https://twitter.com/sigfpe/status/1474173467016589323\n\nFrom the book _Out of their Minds: The Lives and Discoveries of 15 Great Computer Scientists_\nby Dennis Shasha and Cathy Lazere.\n\n\nProblem: Suppose each (finite) word is either \"decent\" or \"indecent\". Given an infinite\nsequence of characters, can you always break it into finite words so that all of them\nexcept perhaps the first one belong to the same class?\n\n-/\n/- special open -/ open Stream\n\n\n\n\n\nvariable {\u03b1 : Type}\n\ndef break_into_words :\n (Stream' \u2115) \u2192 -- word lengths\n (Stream' \u03b1) \u2192 -- original sequence\n (Stream' (List \u03b1)) -- sequence of words\n := Function.curry\n (Stream'.corec\n (\u03bb \u27e8lengths, a'\u27e9 \u21a6 a'.take lengths.head)\n (\u03bb \u27e8lengths, a'\u27e9 \u21a6 \u27e8lengths.tail, a'.drop lengths.head\u27e9))\n\ndef all_same_class\n (is_decent : List \u03b1 \u2192 Prop)\n (b : Stream' (List \u03b1))\n : Prop :=\n b.All is_decent \u2228 b.All (\u03bb w \u21a6 \u00acis_decent w)\n\ntheorem kolmogorov_streams\n (is_decent : List \u03b1 \u2192 Prop)\n (a : Stream' \u03b1)\n : (\u2203 (lengths : Stream' \u2115),\n (lengths.All (0 < \u00b7) \u2227\n all_same_class is_decent (break_into_words lengths a).tail)) := by sorry", "category": "combinatorics"} {"name": "ZeroesOnesAndTwos2", "problem_id": "ZeroesOnesAndTwos2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n(From Mathematical Puzzles: A Connoisseur's Collection by Peter Winkler.)\n\nLet n be a natural number. Prove that\n\n (b) 2^n has a multiple whose representation contains only ones and twos.\n-/", "formal_statement": "theorem ones_and_twos\n (n : \u2115) : \u2203 k : \u2115+, \u2200 e \u2208 Nat.digits 10 (2^n * k), e = 1 \u2228 e = 2 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n(From Mathematical Puzzles: A Connoisseur's Collection by Peter Winkler.)\n\nLet n be a natural number. Prove that\n\n (b) 2^n has a multiple whose representation contains only ones and twos.\n-/\ntheorem ones_and_twos\n (n : \u2115) : \u2203 k : \u2115+, \u2200 e \u2208 Nat.digits 10 (2^n * k), e = 1 \u2228 e = 2 := by sorry", "tags": [], "solved": false, "category": "number theory"} {"name": "Imo1959P2a", "problem_id": "Imo1959P2a", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1959, Problem 2\n\nFor what real values of x is\n\n \u221a(x+\u221a(2x-1)) + \u221a(x-\u221a(2x-1)) = A,\n\ngiven:\n (a) A = \u221a2\n (b) A = 1\n (c) A = 2,\nwhere only non-negative real numbers are admitted for square roots?\n-/", "formal_statement": "/- special open -/ open Set\n\n\n\n\n\n\ndef IsGood (x A : \u211d) : Prop :=\n sqrt (x + sqrt (2 * x - 1)) + sqrt (x - sqrt (2 * x - 1)) = A \u2227 0 \u2264 2 * x - 1 \u2227\n 0 \u2264 x + sqrt (2 * x - 1) \u2227 0 \u2264 x - sqrt (2 * x - 1)\n\nvariable {x A : \u211d}\n\nabbrev solution_set_sqrt2 : Set \u211d := Icc (1 / 2) 1\n\ntheorem imo1959_p2a : IsGood x (Real.sqrt 2) \u2194 x \u2208 solution_set_sqrt2 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1959, Problem 2\n\nFor what real values of x is\n\n \u221a(x+\u221a(2x-1)) + \u221a(x-\u221a(2x-1)) = A,\n\ngiven:\n (a) A = \u221a2\n (b) A = 1\n (c) A = 2,\nwhere only non-negative real numbers are admitted for square roots?\n-/\n/- special open -/ open Set\n\n\n\n\n\n\ndef IsGood (x A : \u211d) : Prop :=\n sqrt (x + sqrt (2 * x - 1)) + sqrt (x - sqrt (2 * x - 1)) = A \u2227 0 \u2264 2 * x - 1 \u2227\n 0 \u2264 x + sqrt (2 * x - 1) \u2227 0 \u2264 x - sqrt (2 * x - 1)\n\nvariable {x A : \u211d}\n\nabbrev solution_set_sqrt2 : Set \u211d := Icc (1 / 2) 1\n\ntheorem imo1959_p2a : IsGood x (Real.sqrt 2) \u2194 x \u2208 solution_set_sqrt2 := by sorry", "tags": ["algebra"], "solved": true, "category": "algebra"} {"name": "Imo1968P5b", "problem_id": "Imo1968P5b", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1968, Problem 5\n\nLet f be a real-valued function defined for all real numbers x such that,\nfor some positive constant a, the equation\n\n f(x + a) = a/2 + \u221a(f(x) - (f(x))\u00b2)\n\nholds for all x.\n\n(b) For a = 1, give an example of a non-constant function with the required properties.\n-/", "formal_statement": "abbrev P (a : \u211d) (f : \u211d \u2192 \u211d) : Prop :=\n 0 < a \u2227\n \u2200 x, (f x)^2 \u2264 f x \u2227 f (x + a) = 1/2 + \u221a(f x - (f x)^2)\n\nnoncomputable abbrev solution_func : \u211d \u2192 \u211d := fun x \u21a6\n if Even \u230ax\u230b then 1 else 1/2\n\ntheorem imo1968_p5b :\n P 1 solution_func \u2227 \u00ac\u2203c, solution_func = Function.const \u211d c := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1968, Problem 5\n\nLet f be a real-valued function defined for all real numbers x such that,\nfor some positive constant a, the equation\n\n f(x + a) = a/2 + \u221a(f(x) - (f(x))\u00b2)\n\nholds for all x.\n\n(b) For a = 1, give an example of a non-constant function with the required properties.\n-/\nabbrev P (a : \u211d) (f : \u211d \u2192 \u211d) : Prop :=\n 0 < a \u2227\n \u2200 x, (f x)^2 \u2264 f x \u2227 f (x + a) = 1/2 + \u221a(f x - (f x)^2)\n\nnoncomputable abbrev solution_func : \u211d \u2192 \u211d := fun x \u21a6\n if Even \u230ax\u230b then 1 else 1/2\n\ntheorem imo1968_p5b :\n P 1 solution_func \u2227 \u00ac\u2203c, solution_func = Function.const \u211d c := by sorry", "tags": ["algebra"], "solved": true, "category": "algebra"} {"name": "Usa1998P4", "solved": false, "tags": ["combinatorics"], "problem_id": "Usa1998P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 1998, Problem 4\n\nA computer screen shows a 98 \u00d7 98 chessboard, colored in the usual way.\nOne can select with a mouse any rectangle with sides on the lines of the\nchessboard and click the mouse button: as a result, the colors in the\nselected rectangle switch (black becomes white, white becomes black).\nFind, with proof, the minimum number of mouse clicks needed to make the\nchessboard all one color.\n-/", "formal_statement": "def chessboard : Type := Fin 98 \u00d7 Fin 98\n\ndef coloring := chessboard \u2192 ZMod 2\n\ndef all_same_color (f : coloring) : Prop :=\n \u2203 c : ZMod 2, \u2200 s : chessboard, f s = c\n\nstructure Rectangle where\n x : \u2115\n y : \u2115\n width : \u2115\n height : \u2115\n\ndef recolor_rect (f : coloring) (r : Rectangle) : coloring :=\nfun \u27e8x, y\u27e9 \u21a6 if r.x \u2264 x.val \u2227\n r.y \u2264 y.val \u2227\n x.val < r.x + r.width \u2227\n y.val < r.y + r.height\n then\n f \u27e8x, y\u27e9 + 1\n else\n f \u27e8x, y\u27e9\n\ndef start_coloring : coloring := fun \u27e8x, y\u27e9 \u21a6 x.val + y.val\n\ndef possible_num_clicks : Set \u2115 :=\n { n : \u2115 | \u2203 rs : List Rectangle,\n (all_same_color (rs.foldl recolor_rect start_coloring) \u2227\n rs.length = n) }\n\nabbrev min_clicks : \u2115 := 98\n\ntheorem usa1998_p4 : IsLeast possible_num_clicks min_clicks := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 1998, Problem 4\n\nA computer screen shows a 98 \u00d7 98 chessboard, colored in the usual way.\nOne can select with a mouse any rectangle with sides on the lines of the\nchessboard and click the mouse button: as a result, the colors in the\nselected rectangle switch (black becomes white, white becomes black).\nFind, with proof, the minimum number of mouse clicks needed to make the\nchessboard all one color.\n-/\ndef chessboard : Type := Fin 98 \u00d7 Fin 98\n\ndef coloring := chessboard \u2192 ZMod 2\n\ndef all_same_color (f : coloring) : Prop :=\n \u2203 c : ZMod 2, \u2200 s : chessboard, f s = c\n\nstructure Rectangle where\n x : \u2115\n y : \u2115\n width : \u2115\n height : \u2115\n\ndef recolor_rect (f : coloring) (r : Rectangle) : coloring :=\nfun \u27e8x, y\u27e9 \u21a6 if r.x \u2264 x.val \u2227\n r.y \u2264 y.val \u2227\n x.val < r.x + r.width \u2227\n y.val < r.y + r.height\n then\n f \u27e8x, y\u27e9 + 1\n else\n f \u27e8x, y\u27e9\n\ndef start_coloring : coloring := fun \u27e8x, y\u27e9 \u21a6 x.val + y.val\n\ndef possible_num_clicks : Set \u2115 :=\n { n : \u2115 | \u2203 rs : List Rectangle,\n (all_same_color (rs.foldl recolor_rect start_coloring) \u2227\n rs.length = n) }\n\nabbrev min_clicks : \u2115 := 98\n\ntheorem usa1998_p4 : IsLeast possible_num_clicks min_clicks := by sorry", "category": "combinatorics"} {"name": "Imo1997P5", "solved": true, "tags": ["number theory"], "problem_id": "Imo1997P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1997, Problem 5\n\nDetermine all pairs of integers 1 \u2264 a,b that satisfy a ^ (b ^ 2) = b ^ a.\n-/", "formal_statement": "abbrev solution_set : Set (\u2115 \u00d7 \u2115) := {(1, 1), (16, 2), (27, 3)}\n\ntheorem imo1997_p5 (a b : \u2115) (ha : 1 \u2264 a) (hb : 1 \u2264 b) :\n \u27e8a,b\u27e9 \u2208 solution_set \u2194 a ^ (b ^ 2) = b ^ a := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1997, Problem 5\n\nDetermine all pairs of integers 1 \u2264 a,b that satisfy a ^ (b ^ 2) = b ^ a.\n-/\nabbrev solution_set : Set (\u2115 \u00d7 \u2115) := {(1, 1), (16, 2), (27, 3)}\n\ntheorem imo1997_p5 (a b : \u2115) (ha : 1 \u2264 a) (hb : 1 \u2264 b) :\n \u27e8a,b\u27e9 \u2208 solution_set \u2194 a ^ (b ^ 2) = b ^ a := by sorry", "category": "number theory"} {"name": "Imo1984P1", "solved": true, "tags": ["algebra"], "problem_id": "Imo1984P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1984, Problem 1\n\nLet $x$, $y$, $z$ be nonnegative real numbers with $x + y + z = 1$.\nShow that $0 \\leq xy+yz+zx-2xyz \\leq \\frac{7}{27}$\n-/", "formal_statement": "theorem imo1984_p1 (x y z : \u211d)\n (h\u2080 : 0 \u2264 x \u2227 0 \u2264 y \u2227 0 \u2264 z)\n (h\u2081 : x + y + z = 1) :\n 0 \u2264 x * y + y * z + z * x - 2 * x * y * z \u2227 x * y + y * z + z * x - 2 * x * y * z \u2264\n (7:\u211d) / 27 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1984, Problem 1\n\nLet $x$, $y$, $z$ be nonnegative real numbers with $x + y + z = 1$.\nShow that $0 \\leq xy+yz+zx-2xyz \\leq \\frac{7}{27}$\n-/\ntheorem imo1984_p1 (x y z : \u211d)\n (h\u2080 : 0 \u2264 x \u2227 0 \u2264 y \u2227 0 \u2264 z)\n (h\u2081 : x + y + z = 1) :\n 0 \u2264 x * y + y * z + z * x - 2 * x * y * z \u2227 x * y + y * z + z * x - 2 * x * y * z \u2264\n (7:\u211d) / 27 := by sorry", "category": "algebra"} {"name": "Imo1989P5", "solved": true, "tags": ["number theory"], "problem_id": "Imo1989P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1989, Problem 5\n\nProve that for each positive integer n there exist n consecutive positive\nintegers, none of which is an integral power of a prime number.\n-/", "formal_statement": "theorem imo1989_p5 (n : \u2115) : \u2203 m, \u2200 j < n, \u00acIsPrimePow (m + j) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1989, Problem 5\n\nProve that for each positive integer n there exist n consecutive positive\nintegers, none of which is an integral power of a prime number.\n-/\ntheorem imo1989_p5 (n : \u2115) : \u2203 m, \u2200 j < n, \u00acIsPrimePow (m + j) := by sorry", "category": "number theory"} {"name": "Imo1987P4", "solved": true, "tags": ["algebra"], "problem_id": "Imo1987P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1987, Problem 4\n\nProve that there is no function f : \u2115 \u2192 \u2115 such that f(f(n)) = n + 1987\nfor every n.\n-/", "formal_statement": "theorem imo1987_p4 : \u00ac\u2203 f : \u2115 \u2192 \u2115, \u2200 n, f (f n) = n + 1987 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1987, Problem 4\n\nProve that there is no function f : \u2115 \u2192 \u2115 such that f(f(n)) = n + 1987\nfor every n.\n-/\ntheorem imo1987_p4 : \u00ac\u2203 f : \u2115 \u2192 \u2115, \u2200 n, f (f n) = n + 1987 := by sorry", "category": "algebra"} {"name": "Imo1999P4", "solved": false, "tags": ["number theory"], "problem_id": "Imo1999P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1999, Problem 4\n\nDetermine all pairs of positive integers (x,p) such that p is\na prime and x\u1d56\u207b\u00b9 is a divisor of (p-1)\u02e3 + 1.\n-/", "formal_statement": "abbrev SolutionSet : Set (\u2115 \u00d7 \u2115) := \n {\u27e8x, p\u27e9 | (x = 1 \u2227 Nat.Prime p) \u2228 (x = 2 \u2227 p = 2) \u2228 (x = 3 \u2227 p = 3)}\n\ntheorem imo1999_p4 (x p : \u2115) :\n \u27e8x,p\u27e9 \u2208 SolutionSet \u2194\n 0 < x \u2227 p.Prime \u2227 x^(p - 1) \u2223 (p - 1)^x + 1 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1999, Problem 4\n\nDetermine all pairs of positive integers (x,p) such that p is\na prime and x\u1d56\u207b\u00b9 is a divisor of (p-1)\u02e3 + 1.\n-/\nabbrev SolutionSet : Set (\u2115 \u00d7 \u2115) := \n {\u27e8x, p\u27e9 | (x = 1 \u2227 Nat.Prime p) \u2228 (x = 2 \u2227 p = 2) \u2228 (x = 3 \u2227 p = 3)}\n\ntheorem imo1999_p4 (x p : \u2115) :\n \u27e8x,p\u27e9 \u2208 SolutionSet \u2194\n 0 < x \u2227 p.Prime \u2227 x^(p - 1) \u2223 (p - 1)^x + 1 := by sorry", "category": "number theory"} {"name": "Usa1985P1", "solved": true, "tags": ["algebra"], "problem_id": "Usa1985P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 1985, Problem 1\n\nDetermine whether or not there are any positive integral solutions of\nthe simultaneous equations\n\n x\u2081\u00b2 + x\u2082\u00b2 + \u22ef + x\u2081\u2089\u2088\u2085\u00b2 = y\u00b3\n x\u2081\u00b3 + x\u2082\u00b3 + \u22ef + x\u2081\u2089\u2088\u2085\u00b3 = z\u00b2\n\nwith distinct integers x\u2081, x\u2082, \u22ef, x\u2081\u2089\u2088\u2085.\n-/", "formal_statement": "abbrev does_exist : Bool := true\n\nabbrev is_valid (x : \u2115 \u2192 \u2124) (y z : \u2124) : Prop :=\n (\u2200 i \u2208 Finset.range 1985, 0 < x i) \u2227\n 0 < y \u2227 0 < z \u2227\n \u2211 i \u2208 Finset.range 1985, x i ^ 2 = y ^ 3 \u2227\n \u2211 i \u2208 Finset.range 1985, x i ^ 3 = z ^ 2 \u2227\n \u2200 i \u2208 Finset.range 1985, \u2200 j \u2208 Finset.range 1985, i \u2260 j \u2192 x i \u2260 x j\n\ntheorem usa1985_p1 :\n if does_exist\n then \u2203 x y z, is_valid x y z\n else \u00ac \u2203 x y z, is_valid x y z := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 1985, Problem 1\n\nDetermine whether or not there are any positive integral solutions of\nthe simultaneous equations\n\n x\u2081\u00b2 + x\u2082\u00b2 + \u22ef + x\u2081\u2089\u2088\u2085\u00b2 = y\u00b3\n x\u2081\u00b3 + x\u2082\u00b3 + \u22ef + x\u2081\u2089\u2088\u2085\u00b3 = z\u00b2\n\nwith distinct integers x\u2081, x\u2082, \u22ef, x\u2081\u2089\u2088\u2085.\n-/\nabbrev does_exist : Bool := true\n\nabbrev is_valid (x : \u2115 \u2192 \u2124) (y z : \u2124) : Prop :=\n (\u2200 i \u2208 Finset.range 1985, 0 < x i) \u2227\n 0 < y \u2227 0 < z \u2227\n \u2211 i \u2208 Finset.range 1985, x i ^ 2 = y ^ 3 \u2227\n \u2211 i \u2208 Finset.range 1985, x i ^ 3 = z ^ 2 \u2227\n \u2200 i \u2208 Finset.range 1985, \u2200 j \u2208 Finset.range 1985, i \u2260 j \u2192 x i \u2260 x j\n\ntheorem usa1985_p1 :\n if does_exist\n then \u2203 x y z, is_valid x y z\n else \u00ac \u2203 x y z, is_valid x y z := by sorry", "category": "algebra"} {"name": "Imo1995P4", "solved": false, "tags": ["algebra"], "problem_id": "Imo1995P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1995, Problem 4\n\nThe positive real numbers $x_0, x_1, x_2,.....x_{1994}, x_{1995}$ satisfy the relations\n$x_0=x_{1995}$ and $x_{i-1}+\\frac{2}{x_{i-1}}=2{x_i}+\\frac{1}{x_i}$\nfor $i=1,2,3,....1995$\nFind the maximum value that $x_0$ can have.\n-/", "formal_statement": "abbrev solution : \u211d := 2^997\n\ntheorem imo1995_p4\n (x : \u2115 \u2192 \u211d)\n (h : x 0 = x 1995)\n (h1 : \u2200 i : \u2115, 0 < i \u2227 i \u2264 1995 \u2192 x (i - 1) + (2 / x (i - 1)) = 2 * x i + (1 / x i)) :\n x 0 \u2264 solution \u2227\n (\u2203 x : \u2115 \u2192 \u211d, x 0 = solution \u2227\n x 0 = x 1995 \u2227\n \u2200 i : \u2115, 0 < i \u2227 i \u2264 1995 \u2192 x (i - 1) + (2 / x (i - 1)) = 2 * x i + (1 / x i)) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1995, Problem 4\n\nThe positive real numbers $x_0, x_1, x_2,.....x_{1994}, x_{1995}$ satisfy the relations\n$x_0=x_{1995}$ and $x_{i-1}+\\frac{2}{x_{i-1}}=2{x_i}+\\frac{1}{x_i}$\nfor $i=1,2,3,....1995$\nFind the maximum value that $x_0$ can have.\n-/\nabbrev solution : \u211d := 2^997\n\ntheorem imo1995_p4\n (x : \u2115 \u2192 \u211d)\n (h : x 0 = x 1995)\n (h1 : \u2200 i : \u2115, 0 < i \u2227 i \u2264 1995 \u2192 x (i - 1) + (2 / x (i - 1)) = 2 * x i + (1 / x i)) :\n x 0 \u2264 solution \u2227\n (\u2203 x : \u2115 \u2192 \u211d, x 0 = solution \u2227\n x 0 = x 1995 \u2227\n \u2200 i : \u2115, 0 < i \u2227 i \u2264 1995 \u2192 x (i - 1) + (2 / x (i - 1)) = 2 * x i + (1 / x i)) := by sorry", "category": "algebra"} {"name": "Usa1992P2", "solved": true, "tags": ["algebra"], "problem_id": "Usa1992P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 1992, Problem 2\n\nProve that\n\n1 / cos 0\u00b0 / cos 1\u00b0 + 1 / cos 1\u00b0 / cos 2\u00b0 + ... + 1 / cos 88\u00b0 / cos 99\u00b0 = cos 1\u00b0 / sin\u00b2 1\u00b0\n-/", "formal_statement": "theorem usa1992_p2 :\n \u2211 i \u2208 Finset.range 89, 1 / Real.cos (i * Real.pi / 180) / Real.cos ((i + 1) * Real.pi / 180) =\n Real.cos (Real.pi / 180) / Real.sin (Real.pi / 180) ^ 2 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 1992, Problem 2\n\nProve that\n\n1 / cos 0\u00b0 / cos 1\u00b0 + 1 / cos 1\u00b0 / cos 2\u00b0 + ... + 1 / cos 88\u00b0 / cos 99\u00b0 = cos 1\u00b0 / sin\u00b2 1\u00b0\n-/\ntheorem usa1992_p2 :\n \u2211 i \u2208 Finset.range 89, 1 / Real.cos (i * Real.pi / 180) / Real.cos ((i + 1) * Real.pi / 180) =\n Real.cos (Real.pi / 180) / Real.sin (Real.pi / 180) ^ 2 := by sorry", "category": "algebra"} {"name": "Imo2001P3", "solved": true, "tags": ["combinatorics"], "problem_id": "Imo2001P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2001, Problem 3\n\nTwenty-one girls and twenty-one boys took part in a mathematical competition.\nIt turned out that each contestant solved at most six problems, and for each\npair of a girl and a boy, there was at most one problem solved by both the\ngirl and the boy. Show that there was a problem solved by at least three\ngirls and at least three boys.\n-/", "formal_statement": "/- special open -/ open Finset\n\n\n\n\n\n\n/-- A problem is easy for a cohort (boys or girls) if at least three\n of its members solved it. -/\n\ndef Easy {\u03b1 : Type} [Fintype \u03b1] (F : \u03b1 \u2192 Finset \u2115) (p : \u2115) : Prop := \n 3 \u2264 Finset.card (filter (\u03bb i => p \u2208 F i) (univ : Finset \u03b1))\n\ntheorem imo2001_p3\n {Girl Boy : Type}\n [Fintype Girl] [Fintype Boy] [DecidableEq Girl] [DecidableEq Boy]\n {G : Girl \u2192 Finset \u2115} {B : Boy \u2192 Finset \u2115} -- solved problems\n (hcard_girl : 21 = Fintype.card Girl)\n (hcard_boy : 21 = Fintype.card Boy)\n (G_le_6 : \u2200 i, Finset.card (G i) \u2264 6) -- Every girl solved at most six problems.\n (B_le_6 : \u2200 j, Finset.card (B j) \u2264 6) -- Every boy solved at most six problems.\n (G_inter_B : \u2200 i j, \u00acDisjoint (G i) (B j)) :\n \u2203 p, Easy G p \u2227 Easy B p := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2001, Problem 3\n\nTwenty-one girls and twenty-one boys took part in a mathematical competition.\nIt turned out that each contestant solved at most six problems, and for each\npair of a girl and a boy, there was at most one problem solved by both the\ngirl and the boy. Show that there was a problem solved by at least three\ngirls and at least three boys.\n-/\n/- special open -/ open Finset\n\n\n\n\n\n\n/-- A problem is easy for a cohort (boys or girls) if at least three\n of its members solved it. -/\n\ndef Easy {\u03b1 : Type} [Fintype \u03b1] (F : \u03b1 \u2192 Finset \u2115) (p : \u2115) : Prop := \n 3 \u2264 Finset.card (filter (\u03bb i => p \u2208 F i) (univ : Finset \u03b1))\n\ntheorem imo2001_p3\n {Girl Boy : Type}\n [Fintype Girl] [Fintype Boy] [DecidableEq Girl] [DecidableEq Boy]\n {G : Girl \u2192 Finset \u2115} {B : Boy \u2192 Finset \u2115} -- solved problems\n (hcard_girl : 21 = Fintype.card Girl)\n (hcard_boy : 21 = Fintype.card Boy)\n (G_le_6 : \u2200 i, Finset.card (G i) \u2264 6) -- Every girl solved at most six problems.\n (B_le_6 : \u2200 j, Finset.card (B j) \u2264 6) -- Every boy solved at most six problems.\n (G_inter_B : \u2200 i j, \u00acDisjoint (G i) (B j)) :\n \u2203 p, Easy G p \u2227 Easy B p := by sorry", "category": "combinatorics"} {"name": "Imo1974P3", "solved": true, "tags": ["number theory"], "problem_id": "Imo1974P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1974, Problem 3\n\nProve that the sum from k = 0 to n inclusive of\n Choose[2n + 1, 2k + 1] * 2\u00b3\u1d4f\nis not divisible by 5 for any integer n \u2265 0.\n-/", "formal_statement": "theorem imo1974_p3\n (n : \u2115) :\n \u00ac 5 \u2223 \u2211 k \u2208 Finset.range (n + 1),\n (Nat.choose (2 * n + 1) (2 * k + 1)) * (2^(3 * k)) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1974, Problem 3\n\nProve that the sum from k = 0 to n inclusive of\n Choose[2n + 1, 2k + 1] * 2\u00b3\u1d4f\nis not divisible by 5 for any integer n \u2265 0.\n-/\ntheorem imo1974_p3\n (n : \u2115) :\n \u00ac 5 \u2223 \u2211 k \u2208 Finset.range (n + 1),\n (Nat.choose (2 * n + 1) (2 * k + 1)) * (2^(3 * k)) := by sorry", "category": "number theory"} {"name": "Imo2005P4", "solved": true, "tags": ["number theory"], "problem_id": "Imo2005P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# Intertional Mathematical Olympiad 2005, Problem 4\n\nDetermine all positive integers relatively prime to all the terms of the infinite sequence\n`a n = 2 ^ n + 3 ^ n + 6 ^ n - 1`, for `n \u2265 1`.\n-/", "formal_statement": "def a (n : \u2115) : \u2124 := 2 ^ n + 3 ^ n + 6 ^ n - 1\n\nabbrev SolutionSet : Set \u2115+ := { 1 }\n\ntheorem imo2005_p4 {k : \u2115} (hk : 0 < k) :\n (\u2200 n : \u2115, 1 \u2264 n \u2192 IsCoprime (a n) k) \u2194 \u27e8k, hk\u27e9 \u2208 SolutionSet := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# Intertional Mathematical Olympiad 2005, Problem 4\n\nDetermine all positive integers relatively prime to all the terms of the infinite sequence\n`a n = 2 ^ n + 3 ^ n + 6 ^ n - 1`, for `n \u2265 1`.\n-/\ndef a (n : \u2115) : \u2124 := 2 ^ n + 3 ^ n + 6 ^ n - 1\n\nabbrev SolutionSet : Set \u2115+ := { 1 }\n\ntheorem imo2005_p4 {k : \u2115} (hk : 0 < k) :\n (\u2200 n : \u2115, 1 \u2264 n \u2192 IsCoprime (a n) k) \u2194 \u27e8k, hk\u27e9 \u2208 SolutionSet := by sorry", "category": "number theory"} {"name": "Usa2015P1", "solved": true, "tags": ["number theory"], "problem_id": "Usa2015P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 2015, Problem 1\n\nSolve in integers the equation x\u00b2 + xy + y\u00b2 = ((x + y) / 3 + 1)\u00b3.\n-/", "formal_statement": "abbrev SolutionSet : Set (\u2124 \u00d7 \u2124) :=\n {\u27e8x, y\u27e9 | \u2203 n, x = n ^ 3 + 3 * n ^ 2 - 1 \u2227 y = -n ^ 3 + 3 * n + 1} \u222a\n {\u27e8x, y\u27e9 | \u2203 n, y = n ^ 3 + 3 * n ^ 2 - 1 \u2227 x = -n ^ 3 + 3 * n + 1}\n\ntheorem usa2015_p1 (x y : \u2124) :\n \u27e8x, y\u27e9 \u2208 SolutionSet \u2194\n x^2 + x * y + y^2 = ((x + y) / (3 : \u211a) + 1)^3 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 2015, Problem 1\n\nSolve in integers the equation x\u00b2 + xy + y\u00b2 = ((x + y) / 3 + 1)\u00b3.\n-/\nabbrev SolutionSet : Set (\u2124 \u00d7 \u2124) :=\n {\u27e8x, y\u27e9 | \u2203 n, x = n ^ 3 + 3 * n ^ 2 - 1 \u2227 y = -n ^ 3 + 3 * n + 1} \u222a\n {\u27e8x, y\u27e9 | \u2203 n, y = n ^ 3 + 3 * n ^ 2 - 1 \u2227 x = -n ^ 3 + 3 * n + 1}\n\ntheorem usa2015_p1 (x y : \u2124) :\n \u27e8x, y\u27e9 \u2208 SolutionSet \u2194\n x^2 + x * y + y^2 = ((x + y) / (3 : \u211a) + 1)^3 := by sorry", "category": "number theory"} {"name": "Imo2023P5", "solved": false, "tags": ["combinatorics"], "problem_id": "Imo2023P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2023, Problem 5\n\nLet n be a positive integer. A _Japanese triangle_ is defined as\na set of 1 + 2 + ... + n dots arranged as an equilateral\ntriangle. Each dot is colored white or red, such that each row\nhas exactly one red dot.\n\nA _ninja path_ is a sequence of n dots obtained by starting in the\ntop row (which has length 1), and then at each step going to one of\nthe dot immediately below the current dot, until the bottom\nrow is reached.\n\nIn terms of n, determine the greatest k such that in each Japanese triangle\nthere is a ninja path containing at least k red dots.\n-/", "formal_statement": "structure JapaneseTriangle (n : \u2115) where\n red : (i : Finset.Icc 1 n) \u2192 Fin i.val\n\ndef next_row {n} (i : Finset.Icc 1 n) (h : i.val + 1 \u2264 n) : Finset.Icc 1 n :=\n \u27e8i.val + 1, by aesop\u27e9\n\nstructure NinjaPath (n : \u2115) where\n steps : (i : Finset.Icc 1 n) \u2192 Fin i.val\n steps_valid : \u2200 i : Finset.Icc 1 n, (h : i.val + 1 \u2264 n) \u2192\n ((steps i).val = steps (next_row i h) \u2228\n (steps i).val + 1 = steps (next_row i h))\n\nnoncomputable abbrev solution_value (n : \u2115) : \u2115 := Nat.floor (Real.log n / Real.log 2) + 1\n\ntheorem imo2023_p5 (n : \u2115) :\n IsGreatest {k | \u2200 j : JapaneseTriangle n,\n \u2203 p : NinjaPath n,\n k \u2264 Fintype.card {i // j.red i = p.steps i}}\n (solution_value n) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2023, Problem 5\n\nLet n be a positive integer. A _Japanese triangle_ is defined as\na set of 1 + 2 + ... + n dots arranged as an equilateral\ntriangle. Each dot is colored white or red, such that each row\nhas exactly one red dot.\n\nA _ninja path_ is a sequence of n dots obtained by starting in the\ntop row (which has length 1), and then at each step going to one of\nthe dot immediately below the current dot, until the bottom\nrow is reached.\n\nIn terms of n, determine the greatest k such that in each Japanese triangle\nthere is a ninja path containing at least k red dots.\n-/\nstructure JapaneseTriangle (n : \u2115) where\n red : (i : Finset.Icc 1 n) \u2192 Fin i.val\n\ndef next_row {n} (i : Finset.Icc 1 n) (h : i.val + 1 \u2264 n) : Finset.Icc 1 n :=\n \u27e8i.val + 1, by aesop\u27e9\n\nstructure NinjaPath (n : \u2115) where\n steps : (i : Finset.Icc 1 n) \u2192 Fin i.val\n steps_valid : \u2200 i : Finset.Icc 1 n, (h : i.val + 1 \u2264 n) \u2192\n ((steps i).val = steps (next_row i h) \u2228\n (steps i).val + 1 = steps (next_row i h))\n\nnoncomputable abbrev solution_value (n : \u2115) : \u2115 := Nat.floor (Real.log n / Real.log 2) + 1\n\ntheorem imo2023_p5 (n : \u2115) :\n IsGreatest {k | \u2200 j : JapaneseTriangle n,\n \u2203 p : NinjaPath n,\n k \u2264 Fintype.card {i // j.red i = p.steps i}}\n (solution_value n) := by sorry", "category": "combinatorics"} {"name": "Imo1970P4", "solved": true, "tags": ["number theory"], "problem_id": "Imo1970P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1970, Problem 4\n\nDetermine the set of all positive integers n with the property that\nthe set {n, n + 1, n + 2, n + 3, n + 4, n + 5} can be partitioned\ninto two sets such that the product of the numbers in one set\nequals the product of the numbers in the other set.\n-/", "formal_statement": "abbrev SolutionSet : Finset \u2115+ := {}\n\ntheorem imo1970_p4 (n : \u2115+):\n n \u2208 SolutionSet \u2194\n \u2203 s1 s2 : Finset \u2115,\n s1 \u222a s2 = Finset.Icc n.val (n.val + 5) \u2227\n s1 \u2229 s2 = \u2205 \u2227\n \u220f m \u2208 s1, m = \u220f m \u2208 s2, m := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1970, Problem 4\n\nDetermine the set of all positive integers n with the property that\nthe set {n, n + 1, n + 2, n + 3, n + 4, n + 5} can be partitioned\ninto two sets such that the product of the numbers in one set\nequals the product of the numbers in the other set.\n-/\nabbrev SolutionSet : Finset \u2115+ := {}\n\ntheorem imo1970_p4 (n : \u2115+):\n n \u2208 SolutionSet \u2194\n \u2203 s1 s2 : Finset \u2115,\n s1 \u222a s2 = Finset.Icc n.val (n.val + 5) \u2227\n s1 \u2229 s2 = \u2205 \u2227\n \u220f m \u2208 s1, m = \u220f m \u2208 s2, m := by sorry", "category": "number theory"} {"name": "Usa2019P1", "solved": true, "tags": ["algebra"], "problem_id": "Usa2019P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 2019, Problem 1\n\nLet \u2115+ be the set of positive integers.\nA function f: \u2115+ \u2192 \u2115+ satisfies the equation\n\n f\u1da0\u207d\u207f\u207e(n)\u2b1df\u00b2(n) = n^2\n\nfor all positive integers n, where f\u1d4f(m) means f iterated k times on m.\nGiven this information, determine all possible values of f(1000).\n-/", "formal_statement": "abbrev solution_set : Set \u2115+ := { x : \u2115+ | Even x.val }\n\ntheorem usa2019_p1 (m : \u2115+) :\n m \u2208 solution_set \u2194\n (\u2203 f : \u2115+ \u2192 \u2115+,\n (\u2200 n, f^[f n] n * f (f n) = n ^ 2) \u2227\n m = f 1000) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 2019, Problem 1\n\nLet \u2115+ be the set of positive integers.\nA function f: \u2115+ \u2192 \u2115+ satisfies the equation\n\n f\u1da0\u207d\u207f\u207e(n)\u2b1df\u00b2(n) = n^2\n\nfor all positive integers n, where f\u1d4f(m) means f iterated k times on m.\nGiven this information, determine all possible values of f(1000).\n-/\nabbrev solution_set : Set \u2115+ := { x : \u2115+ | Even x.val }\n\ntheorem usa2019_p1 (m : \u2115+) :\n m \u2208 solution_set \u2194\n (\u2203 f : \u2115+ \u2192 \u2115+,\n (\u2200 n, f^[f n] n * f (f n) = n ^ 2) \u2227\n m = f 1000) := by sorry", "category": "algebra"} {"name": "Imo1962P4", "solved": true, "tags": ["algebra"], "problem_id": "Imo1962P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematics Olympiad 1962, Problem 4\n\nSolve the equation\n cos\u00b2 x + cos\u00b2 (2 * x) + cos\u00b2 (3 * x) = 1.\n-/", "formal_statement": "def ProblemEquation (x : \u211d) : Prop :=\n cos x ^ 2 + cos (2 * x) ^ 2 + cos (3 * x) ^ 2 = 1\n\nabbrev solutionSet : Set \u211d :=\n {x : \u211d | \u2203 k : \u2124, x = (2 * \u2191k + 1) * Real.pi / 4 \u2228 x = (2 * \u2191k + 1) * Real.pi / 6}\n\ntheorem imo1962_p4 {x : \u211d} : ProblemEquation x \u2194 x \u2208 solutionSet := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematics Olympiad 1962, Problem 4\n\nSolve the equation\n cos\u00b2 x + cos\u00b2 (2 * x) + cos\u00b2 (3 * x) = 1.\n-/\ndef ProblemEquation (x : \u211d) : Prop :=\n cos x ^ 2 + cos (2 * x) ^ 2 + cos (3 * x) ^ 2 = 1\n\nabbrev solutionSet : Set \u211d :=\n {x : \u211d | \u2203 k : \u2124, x = (2 * \u2191k + 1) * Real.pi / 4 \u2228 x = (2 * \u2191k + 1) * Real.pi / 6}\n\ntheorem imo1962_p4 {x : \u211d} : ProblemEquation x \u2194 x \u2208 solutionSet := by sorry", "category": "algebra"} {"name": "Imo2003P2", "solved": false, "tags": ["number theory"], "problem_id": "Imo2003P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2003, Problem 2\n\nDetermine all pairs of positive integers (a,b) such that\n\n a\u00b2/(2ab\u00b2 - b\u00b3 + 1)\n\nis a positive integer.\n-/", "formal_statement": "abbrev solution_set : Set (\u2124 \u00d7 \u2124) := \n {p | \u2203 k : \u2124, 0 < k \u2227 (p = (2*k, 1) \u2228 p = (k, 2*k) \u2228 p = (8*k^4 - k, 2*k))}\n\ntheorem imo2003_p2 (a b : \u2124) :\n (a,b) \u2208 solution_set \u2194\n 0 < a \u2227 a < b \u2227\n \u2203 c, 0 < c \u2227 c * (2 * a * b^2 - b^3 + 1) = a^2 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2003, Problem 2\n\nDetermine all pairs of positive integers (a,b) such that\n\n a\u00b2/(2ab\u00b2 - b\u00b3 + 1)\n\nis a positive integer.\n-/\nabbrev solution_set : Set (\u2124 \u00d7 \u2124) := \n {p | \u2203 k : \u2124, 0 < k \u2227 (p = (2*k, 1) \u2228 p = (k, 2*k) \u2228 p = (8*k^4 - k, 2*k))}\n\ntheorem imo2003_p2 (a b : \u2124) :\n (a,b) \u2208 solution_set \u2194\n 0 < a \u2227 a < b \u2227\n \u2203 c, 0 < c \u2227 c * (2 * a * b^2 - b^3 + 1) = a^2 := by sorry", "category": "number theory"} {"name": "Imo1968P2", "solved": true, "tags": ["number theory"], "problem_id": "Imo1968P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1968, Problem 2\n\nDetermine the set of natural numbers x such that\nthe sum of the decimal digits of x is equal to x\u00b2 - 10x - 22.\n-/", "formal_statement": "abbrev solution_set : Set \u2115 := { 12 }\n\ntheorem imo1968_p2 (x : \u2115) :\n x \u2208 solution_set \u2194\n x^2 = 10 * x + 22 + (Nat.digits 10 x).prod := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1968, Problem 2\n\nDetermine the set of natural numbers x such that\nthe sum of the decimal digits of x is equal to x\u00b2 - 10x - 22.\n-/\nabbrev solution_set : Set \u2115 := { 12 }\n\ntheorem imo1968_p2 (x : \u2115) :\n x \u2208 solution_set \u2194\n x^2 = 10 * x + 22 + (Nat.digits 10 x).prod := by sorry", "category": "number theory"} {"name": "Imo1972P5", "solved": true, "tags": ["algebra"], "problem_id": "Imo1972P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1972, Problem 5\n\n`f` and `g` are real-valued functions defined on the real line. For all `x` and `y`,\n`f(x + y) + f(x - y) = 2f(x)g(y)`. `f` is not identically zero and `|f(x)| \u2264 1` for all `x`.\nProve that `|g(x)| \u2264 1` for all `x`.\n-/", "formal_statement": "theorem imo1972_p5 (f g : \u211d \u2192 \u211d) (hf1 : \u2200 x, \u2200 y, f (x + y) + f (x - y) = 2 * f x * g y)\n (hf2 : BddAbove (Set.range fun x => \u2016f x\u2016)) (hf3 : \u2203 x, f x \u2260 0) (y : \u211d) : \u2016g y\u2016 \u2264 1 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1972, Problem 5\n\n`f` and `g` are real-valued functions defined on the real line. For all `x` and `y`,\n`f(x + y) + f(x - y) = 2f(x)g(y)`. `f` is not identically zero and `|f(x)| \u2264 1` for all `x`.\nProve that `|g(x)| \u2264 1` for all `x`.\n-/\ntheorem imo1972_p5 (f g : \u211d \u2192 \u211d) (hf1 : \u2200 x, \u2200 y, f (x + y) + f (x - y) = 2 * f x * g y)\n (hf2 : BddAbove (Set.range fun x => \u2016f x\u2016)) (hf3 : \u2203 x, f x \u2260 0) (y : \u211d) : \u2016g y\u2016 \u2264 1 := by sorry", "category": "algebra"} {"name": "Imo2014P1", "solved": true, "tags": ["algebra"], "problem_id": "Imo2014P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2014, Problem 1\n\nLet a\u2080 < a\u2081 < a\u2082 < ... an infinite sequence of positive integers.\nProve that there exists a unique integer n \u2265 1 such that\n\n a\u2099 < (a\u2080 + a\u2081 + ... + a\u2099)/n \u2264 a\u2099\u208a\u2081.\n-/", "formal_statement": "theorem imo2014_p1 (a : \u2115 \u2192 \u2124) (apos : \u2200 i, 0 < a i) (ha : \u2200 i, a i < a (i + 1)) :\n \u2203! n : \u2115, 0 < n \u2227\n n * a n < (\u2211 i \u2208 Finset.range (n + 1), a i) \u2227\n (\u2211 i \u2208 Finset.range (n + 1), a i) \u2264 n * a (n + 1) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2014, Problem 1\n\nLet a\u2080 < a\u2081 < a\u2082 < ... an infinite sequence of positive integers.\nProve that there exists a unique integer n \u2265 1 such that\n\n a\u2099 < (a\u2080 + a\u2081 + ... + a\u2099)/n \u2264 a\u2099\u208a\u2081.\n-/\ntheorem imo2014_p1 (a : \u2115 \u2192 \u2124) (apos : \u2200 i, 0 < a i) (ha : \u2200 i, a i < a (i + 1)) :\n \u2203! n : \u2115, 0 < n \u2227\n n * a n < (\u2211 i \u2208 Finset.range (n + 1), a i) \u2227\n (\u2211 i \u2208 Finset.range (n + 1), a i) \u2264 n * a (n + 1) := by sorry", "category": "algebra"} {"name": "Imo2007P5", "solved": true, "tags": ["number theory"], "problem_id": "Imo2007P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2007, Problem 5\n\nLet a and b be positive integers. Show that if 4ab - 1 divides (4a\u00b2 - 1)\u00b2\nthen a = b.\n-/", "formal_statement": "theorem imo2007_p5 (a b : \u2124) (ha : 0 < a) (hb : 0 < b)\n (hab : 4 * a * b - 1 \u2223 (4 * a^2 - 1)^2) : a = b := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2007, Problem 5\n\nLet a and b be positive integers. Show that if 4ab - 1 divides (4a\u00b2 - 1)\u00b2\nthen a = b.\n-/\ntheorem imo2007_p5 (a b : \u2124) (ha : 0 < a) (hb : 0 < b)\n (hab : 4 * a * b - 1 \u2223 (4 * a^2 - 1)^2) : a = b := by sorry", "category": "number theory"} {"name": "Imo1977P6", "solved": true, "tags": ["algebra"], "problem_id": "Imo1977P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1977, Problem 6\n\nSuppose `f : \u2115+ \u2192 \u2115+` satisfies `f(f(n)) < f(n + 1)` for all `n`.\nProve that `f(n) = n` for all `n`.\n-/", "formal_statement": "theorem imo1977_p6 (f : \u2115+ \u2192 \u2115+) (h : \u2200 n, f (f n) < f (n + 1)) : \u2200 n, f n = n := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1977, Problem 6\n\nSuppose `f : \u2115+ \u2192 \u2115+` satisfies `f(f(n)) < f(n + 1)` for all `n`.\nProve that `f(n) = n` for all `n`.\n-/\ntheorem imo1977_p6 (f : \u2115+ \u2192 \u2115+) (h : \u2200 n, f (f n) < f (n + 1)) : \u2200 n, f n = n := by sorry", "category": "algebra"} {"name": "Imo1964P2", "solved": true, "tags": ["algebra", "inequality"], "problem_id": "Imo1964P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1964, Problem 2\n\nSuppose that a,b,c are the side lengths of a triangle. Prove that\n\n a\u00b2(b + c - a) + b\u00b2(c + a - b) + c\u00b2(a + b - c) \u2264 3abc.\n-/", "formal_statement": "theorem imo1964_p2\n (T : Affine.Triangle \u211d (EuclideanSpace \u211d (Fin 2)))\n (a b c : \u211d)\n (ha : a = dist (T.points 1) (T.points 2))\n (hb : b = dist (T.points 2) (T.points 0))\n (hc : c = dist (T.points 0) (T.points 1)) :\n a^2 * (b + c - a) + b^2 * (c + a - b) + c^2 * (a + b - c) \u2264\n 3 * a * b * c := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1964, Problem 2\n\nSuppose that a,b,c are the side lengths of a triangle. Prove that\n\n a\u00b2(b + c - a) + b\u00b2(c + a - b) + c\u00b2(a + b - c) \u2264 3abc.\n-/\ntheorem imo1964_p2\n (T : Affine.Triangle \u211d (EuclideanSpace \u211d (Fin 2)))\n (a b c : \u211d)\n (ha : a = dist (T.points 1) (T.points 2))\n (hb : b = dist (T.points 2) (T.points 0))\n (hc : c = dist (T.points 0) (T.points 1)) :\n a^2 * (b + c - a) + b^2 * (c + a - b) + c^2 * (a + b - c) \u2264\n 3 * a * b * c := by sorry", "category": "algebra"} {"name": "Imo2015P5", "solved": true, "tags": ["algebra"], "problem_id": "Imo2015P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2015, Problem 5\n\nDetermine all functions f : \u211d \u2192 \u211d that satisfy\n\n f(x + f(x + y)) + f(xy) = x + f(x + y) + yf(x)\n\nfor all x,y.\n-/", "formal_statement": "abbrev SolutionSet : Set (\u211d \u2192 \u211d) := { fun x \u21a6 x, fun x \u21a6 2 - x }\n\ntheorem imo2015_p5 (f : \u211d \u2192 \u211d) :\n f \u2208 SolutionSet \u2194\n \u2200 x y, f (x + f (x + y)) + f (x * y) = x + f (x + y) + y * f x := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2015, Problem 5\n\nDetermine all functions f : \u211d \u2192 \u211d that satisfy\n\n f(x + f(x + y)) + f(xy) = x + f(x + y) + yf(x)\n\nfor all x,y.\n-/\nabbrev SolutionSet : Set (\u211d \u2192 \u211d) := { fun x \u21a6 x, fun x \u21a6 2 - x }\n\ntheorem imo2015_p5 (f : \u211d \u2192 \u211d) :\n f \u2208 SolutionSet \u2194\n \u2200 x y, f (x + f (x + y)) + f (x * y) = x + f (x + y) + y * f x := by sorry", "category": "algebra"} {"name": "Usa1993P1", "solved": true, "tags": ["algebra"], "problem_id": "Usa1993P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 1993, Problem 1\n\nFor each integer n \u2265 2, determine whether a or b is larger,\nwhere a and b are positive real numbers satisfying\n\n a\u207f = a + 1, b\u00b2\u207f = b + 3a.\n-/", "formal_statement": "abbrev a_is_larger : \u2115 \u2192 Bool := fun _ \u21a6 true\n\ntheorem usa1993_p1 (n : \u2115) (hn : 2 \u2264 n) (a b : \u211d) (ha : 0 < a) (hb : 0 < b)\n (han : a^n = a + 1) (hbn : b^(2 * n) = b + 3 * a) :\n if a_is_larger n then b < a else a < b := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 1993, Problem 1\n\nFor each integer n \u2265 2, determine whether a or b is larger,\nwhere a and b are positive real numbers satisfying\n\n a\u207f = a + 1, b\u00b2\u207f = b + 3a.\n-/\nabbrev a_is_larger : \u2115 \u2192 Bool := fun _ \u21a6 true\n\ntheorem usa1993_p1 (n : \u2115) (hn : 2 \u2264 n) (a b : \u211d) (ha : 0 < a) (hb : 0 < b)\n (han : a^n = a + 1) (hbn : b^(2 * n) = b + 3 * a) :\n if a_is_larger n then b < a else a < b := by sorry", "category": "algebra"} {"name": "Usa1980P5", "solved": false, "tags": ["algebra", "inequality"], "problem_id": "Usa1980P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 1980, Problem 5\n\nLet x,y,z be real numbers in the closed interval [0,1]. Show that\n\n x/(y + z + 1) + y/(z + x + 1) + z/(x + y + 1) \u2264 1 + (1 - x)(1 - y)(1 - z).\n-/", "formal_statement": "theorem usa1980_p5 (x y z : \u211d)\n (hx : x \u2208 Set.Icc 0 1)\n (hy : y \u2208 Set.Icc 0 1)\n (hz : z \u2208 Set.Icc 0 1) :\n x / (y + z + 1) + y / (z + x + 1) + z / (x + y + 1) \u2264\n 1 + (1 - x) * (1 - y) * (1 - z) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 1980, Problem 5\n\nLet x,y,z be real numbers in the closed interval [0,1]. Show that\n\n x/(y + z + 1) + y/(z + x + 1) + z/(x + y + 1) \u2264 1 + (1 - x)(1 - y)(1 - z).\n-/\ntheorem usa1980_p5 (x y z : \u211d)\n (hx : x \u2208 Set.Icc 0 1)\n (hy : y \u2208 Set.Icc 0 1)\n (hz : z \u2208 Set.Icc 0 1) :\n x / (y + z + 1) + y / (z + x + 1) + z / (x + y + 1) \u2264\n 1 + (1 - x) * (1 - y) * (1 - z) := by sorry", "category": "algebra"} {"name": "CIIM2022P6", "solved": false, "tags": ["number theory"], "problem_id": "CIIM2022P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# Iberoamerican Interuniversity Mathematics Competition 2022, Problem 6\n\nGiven a positive integer m, let d(m) be the number of postive\ndivisors of m. Show that for every positive integer n, one\nhas\n d((n + 1)!) \u2264 2d(n!).\n-/", "formal_statement": "def d : \u2115 \u2192 \u2115\n| m => (Nat.divisors m).card\n\ntheorem ciim2022_p6 (n : \u2115) (hn : 0 < n) :\n d (Nat.factorial (n + 1)) \u2264 2 * d (Nat.factorial n) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# Iberoamerican Interuniversity Mathematics Competition 2022, Problem 6\n\nGiven a positive integer m, let d(m) be the number of postive\ndivisors of m. Show that for every positive integer n, one\nhas\n d((n + 1)!) \u2264 2d(n!).\n-/\ndef d : \u2115 \u2192 \u2115\n| m => (Nat.divisors m).card\n\ntheorem ciim2022_p6 (n : \u2115) (hn : 0 < n) :\n d (Nat.factorial (n + 1)) \u2264 2 * d (Nat.factorial n) := by sorry", "category": "number theory"} {"name": "Iran1998P3", "solved": true, "tags": ["algebra"], "problem_id": "Iran1998P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# Iranian Mathematical Olympiad 1998, problem 3\n\nLet x\u2081, x\u2082, x\u2083, x\u2084 be positive real numbers such that\n\n x\u2081 \u2b1d x\u2082 \u2b1d x\u2083 \u2b1d x\u2084 = 1.\n\nProve that\n x\u2081\u00b3 + x\u2082\u00b3 + x\u2083\u00b3 + x\u2084\u00b3 \u2265 max(x\u2081 + x\u2082 + x\u2083 + x\u2084, 1/x\u2081 + 1/x\u2082 + 1/x\u2083 + 1/x\u2084).\n\n-/", "formal_statement": "theorem iran1998_p3\n (x : \u2115 \u2192 \u211d)\n (x_positive : \u2200 i, 0 < x i)\n (h : \u220f i \u2208 Finset.range 4, x i = 1)\n : max (\u2211 i \u2208 Finset.range 4, x i) (\u2211 i \u2208 Finset.range 4, 1 / x i)\n \u2264 \u2211 i \u2208 Finset.range 4, (x i)^(3 : \u211d) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# Iranian Mathematical Olympiad 1998, problem 3\n\nLet x\u2081, x\u2082, x\u2083, x\u2084 be positive real numbers such that\n\n x\u2081 \u2b1d x\u2082 \u2b1d x\u2083 \u2b1d x\u2084 = 1.\n\nProve that\n x\u2081\u00b3 + x\u2082\u00b3 + x\u2083\u00b3 + x\u2084\u00b3 \u2265 max(x\u2081 + x\u2082 + x\u2083 + x\u2084, 1/x\u2081 + 1/x\u2082 + 1/x\u2083 + 1/x\u2084).\n\n-/\ntheorem iran1998_p3\n (x : \u2115 \u2192 \u211d)\n (x_positive : \u2200 i, 0 < x i)\n (h : \u220f i \u2208 Finset.range 4, x i = 1)\n : max (\u2211 i \u2208 Finset.range 4, x i) (\u2211 i \u2208 Finset.range 4, 1 / x i)\n \u2264 \u2211 i \u2208 Finset.range 4, (x i)^(3 : \u211d) := by sorry", "category": "algebra"} {"name": "IntegersInACircle", "solved": true, "tags": ["combinatorics"], "problem_id": "IntegersInACircle", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\nThere are 101 positive integers arranged in a circle.\nSuppose that the integers sum to 300.\nProve that there exists a contiguous subarray that sums to 200.\n\nhttps://mathstodon.xyz/@alexdbolton/110292738044661739\nhttps://math.stackexchange.com/questions/282589/101-positive-integers-placed-on-a-circle\n-/", "formal_statement": "theorem integers_in_a_circle\n (a : ZMod 101 \u2192 \u2124)\n (ha : \u2200 i, 1 \u2264 a i)\n (ha_sum : \u2211 i : ZMod 101, a i = 300)\n : \u2203 j : ZMod 101, \u2203 n : \u2115, \u2211 i \u2208 Finset.range n, a (j + i) = 200 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\nThere are 101 positive integers arranged in a circle.\nSuppose that the integers sum to 300.\nProve that there exists a contiguous subarray that sums to 200.\n\nhttps://mathstodon.xyz/@alexdbolton/110292738044661739\nhttps://math.stackexchange.com/questions/282589/101-positive-integers-placed-on-a-circle\n-/\ntheorem integers_in_a_circle\n (a : ZMod 101 \u2192 \u2124)\n (ha : \u2200 i, 1 \u2264 a i)\n (ha_sum : \u2211 i : ZMod 101, a i = 300)\n : \u2203 j : ZMod 101, \u2203 n : \u2115, \u2211 i \u2208 Finset.range n, a (j + i) = 200 := by sorry", "category": "combinatorics"} {"name": "Imo1993P5", "solved": true, "tags": ["algebra"], "problem_id": "Imo1993P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1993, Problem 5\n\nDoes there exist a function f : \u2115 \u2192 \u2115 such that\n i) f(1) = 2\n ii) f(f(n)) = f(n) + n for all n \u2208 \u2115\n iii) f(n + 1) > f(n) for all n \u2208 \u2115?\n-/", "formal_statement": "abbrev DoesExist : Bool := True\n\nabbrev Good (f : \u2115 \u2192 \u2115) : Prop := f 1 = 2 \u2227 \u2200 n, f (f n) = f n + n \u2227 \u2200 n, f n < f (n + 1)\n\ntheorem imo1993_p5 :\n if DoesExist then \u2203 f, Good f else \u00ac\u2203 f, Good f := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1993, Problem 5\n\nDoes there exist a function f : \u2115 \u2192 \u2115 such that\n i) f(1) = 2\n ii) f(f(n)) = f(n) + n for all n \u2208 \u2115\n iii) f(n + 1) > f(n) for all n \u2208 \u2115?\n-/\nabbrev DoesExist : Bool := True\n\nabbrev Good (f : \u2115 \u2192 \u2115) : Prop := f 1 = 2 \u2227 \u2200 n, f (f n) = f n + n \u2227 \u2200 n, f n < f (n + 1)\n\ntheorem imo1993_p5 :\n if DoesExist then \u2203 f, Good f else \u00ac\u2203 f, Good f := by sorry", "category": "algebra"} {"name": "Imo1984P6", "solved": true, "tags": ["number theory"], "problem_id": "Imo1984P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1984, Problem 6\n\nLet a, b, c, and d be odd integers such that 0 < a < b < c < d and ad = bc.\nProve that if a + d = 2\u1d4f and b + c = 2\u1d50 for some integers k and m, then\na = 1.\n-/", "formal_statement": "theorem imo_1984_p6\n (a b c d k m : \u2115)\n (h\u2080 : 0 < a \u2227 0 < b \u2227 0 < c \u2227 0 < d)\n (h\u2081 : Odd a \u2227 Odd b \u2227 Odd c \u2227 Odd d)\n (h\u2082 : a < b \u2227 b < c \u2227 c < d)\n (h\u2083 : a * d = b * c)\n (h\u2084 : a + d = 2^k)\n (h\u2085 : b + c = 2^m) :\n a = 1 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1984, Problem 6\n\nLet a, b, c, and d be odd integers such that 0 < a < b < c < d and ad = bc.\nProve that if a + d = 2\u1d4f and b + c = 2\u1d50 for some integers k and m, then\na = 1.\n-/\ntheorem imo_1984_p6\n (a b c d k m : \u2115)\n (h\u2080 : 0 < a \u2227 0 < b \u2227 0 < c \u2227 0 < d)\n (h\u2081 : Odd a \u2227 Odd b \u2227 Odd c \u2227 Odd d)\n (h\u2082 : a < b \u2227 b < c \u2227 c < d)\n (h\u2083 : a * d = b * c)\n (h\u2084 : a + d = 2^k)\n (h\u2085 : b + c = 2^m) :\n a = 1 := by sorry", "category": "number theory"} {"name": "Usa1982P4", "solved": true, "tags": ["number theory"], "problem_id": "Usa1982P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 1982, Problem 4\n\nProve that there exists a positive integer k such that\nk\u2b1d2\u207f + 1 is composite for every integer n.\n-/", "formal_statement": "theorem usa1982_p4 :\n \u2203 k : \u2115, 0 < k \u2227 \u2200 n : \u2115, \u00ac Nat.Prime (k * (2 ^ n) + 1) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 1982, Problem 4\n\nProve that there exists a positive integer k such that\nk\u2b1d2\u207f + 1 is composite for every integer n.\n-/\ntheorem usa1982_p4 :\n \u2203 k : \u2115, 0 < k \u2227 \u2200 n : \u2115, \u00ac Nat.Prime (k * (2 ^ n) + 1) := by sorry", "category": "number theory"} {"name": "Imo1988P6", "solved": true, "tags": ["number theory"], "problem_id": "Imo1988P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1988, Problem 6\n\nIf a and b are two natural numbers such that a*b+1 divides a^2 + b^2,\nshow that their quotient is a perfect square.\n-/", "formal_statement": "theorem imo1988_p6 {a b : \u2115} (h : a * b + 1 \u2223 a ^ 2 + b ^ 2) :\n \u2203 d, d ^ 2 = (a ^ 2 + b ^ 2) / (a * b + 1) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1988, Problem 6\n\nIf a and b are two natural numbers such that a*b+1 divides a^2 + b^2,\nshow that their quotient is a perfect square.\n-/\ntheorem imo1988_p6 {a b : \u2115} (h : a * b + 1 \u2223 a ^ 2 + b ^ 2) :\n \u2203 d, d ^ 2 = (a ^ 2 + b ^ 2) / (a * b + 1) := by sorry", "category": "number theory"} {"name": "Imo1992P1", "solved": true, "tags": ["number theory"], "problem_id": "Imo1992P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1992, Problem 1\n\nFind all integers 1 < a < b < c such that\n(a - 1)(b - 1)(c - 1) divides abc - 1.\n-/", "formal_statement": "abbrev solution_set : Set (\u2124 \u00d7 \u2124 \u00d7 \u2124) := {(2, 4, 8), (3, 5, 15)}\n\ntheorem imo1992_p1 (a b c : \u2124) (ha : 1 < a) (hb : a < b) (hc : b < c) :\n \u27e8a, b, c\u27e9 \u2208 solution_set \u2194\n (a - 1) * (b - 1) * (c - 1) \u2223 a * b * c - 1 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1992, Problem 1\n\nFind all integers 1 < a < b < c such that\n(a - 1)(b - 1)(c - 1) divides abc - 1.\n-/\nabbrev solution_set : Set (\u2124 \u00d7 \u2124 \u00d7 \u2124) := {(2, 4, 8), (3, 5, 15)}\n\ntheorem imo1992_p1 (a b c : \u2124) (ha : 1 < a) (hb : a < b) (hc : b < c) :\n \u27e8a, b, c\u27e9 \u2208 solution_set \u2194\n (a - 1) * (b - 1) * (c - 1) \u2223 a * b * c - 1 := by sorry", "category": "number theory"} {"name": "Usa1998P3", "solved": true, "tags": ["algebra", "inequality"], "problem_id": "Usa1998P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 1998, Problem 3\n\nLet a\u2080,a\u2081,...,a\u2099 be real numbers from the interval (0,\u03c0/2) such that\n\n tan(a\u2080 - \u03c0/4) + tan(a\u2081 - \u03c0/4) + ... + tan(a\u2099 - \u03c0/4) \u2265 n - 1.\n\nProve that\n\n tan(a\u2080)tan(a\u2081)...tan(a\u2099) \u2265 n\u207f\u207a\u00b9.\n\n-/", "formal_statement": "theorem usa1998_p3\n (n : \u2115)\n (a : \u2115 \u2192 \u211d)\n (ha : \u2200 i \u2208 Finset.range (n + 1), a i \u2208 Set.Ioo 0 (Real.pi / 2))\n (hs : n - 1 \u2264 \u2211 i \u2208 Finset.range (n + 1), Real.tan (a i - (Real.pi / 4)))\n : n ^ (n + 1) \u2264 \u220f i \u2208 Finset.range (n + 1), Real.tan (a i) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 1998, Problem 3\n\nLet a\u2080,a\u2081,...,a\u2099 be real numbers from the interval (0,\u03c0/2) such that\n\n tan(a\u2080 - \u03c0/4) + tan(a\u2081 - \u03c0/4) + ... + tan(a\u2099 - \u03c0/4) \u2265 n - 1.\n\nProve that\n\n tan(a\u2080)tan(a\u2081)...tan(a\u2099) \u2265 n\u207f\u207a\u00b9.\n\n-/\ntheorem usa1998_p3\n (n : \u2115)\n (a : \u2115 \u2192 \u211d)\n (ha : \u2200 i \u2208 Finset.range (n + 1), a i \u2208 Set.Ioo 0 (Real.pi / 2))\n (hs : n - 1 \u2264 \u2211 i \u2208 Finset.range (n + 1), Real.tan (a i - (Real.pi / 4)))\n : n ^ (n + 1) \u2264 \u220f i \u2208 Finset.range (n + 1), Real.tan (a i) := by sorry", "category": "algebra"} {"name": "Hungary1998P6", "solved": true, "tags": ["algebra"], "problem_id": "Hungary1998P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# Hungarian Mathematical Olympiad 1998, Problem 6\n\nLet x, y, z be integers with z > 1. Show that\n\n (x + 1)\u00b2 + (x + 2)\u00b2 + ... + (x + 99)\u00b2 \u2260 y\u1dbb.\n-/", "formal_statement": "theorem hungary1998_p6 (x y : \u2124) (z : \u2115) (hz : 1 < z) :\n \u2211 i \u2208 Finset.range 99, (x + i + 1)^2 \u2260 y^z := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# Hungarian Mathematical Olympiad 1998, Problem 6\n\nLet x, y, z be integers with z > 1. Show that\n\n (x + 1)\u00b2 + (x + 2)\u00b2 + ... + (x + 99)\u00b2 \u2260 y\u1dbb.\n-/\ntheorem hungary1998_p6 (x y : \u2124) (z : \u2115) (hz : 1 < z) :\n \u2211 i \u2208 Finset.range 99, (x + i + 1)^2 \u2260 y^z := by sorry", "category": "algebra"} {"name": "Imo1985P2", "solved": true, "tags": ["combinatorics"], "problem_id": "Imo1985P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1985, Problem 5\nEach of the numbers in the set $N=\\{1, 2, 3, \\dots, n-1\\}$,\nwhere $n \u2265 3$, is colored with one of two colors, say red or black,\nso that:\n\n 1. $i$ and $n-i$ always receive the same color, and\n 2. for some $j \u2208 N$ relatively prime to $n$, $i$ and $|j-i|$ receive\n the same color\n\nfor all $i \u2208 N, i \u2260 j$.\n\nProve that all numbers in $N$ must receive the same color.\n-/", "formal_statement": "/-- The conditions on the problem's coloring `C`.\nAlthough its domain is all of `\u2115`, we only care about its values in `Set.Ico 1 n`. -/\ndef Condition (n j : \u2115) (C : \u2115 \u2192 Fin 2) : Prop :=\n (\u2200 i \u2208 Set.Ico 1 n, C i = C (n - i)) \u2227\n \u2200 i \u2208 Set.Ico 1 n, i \u2260 j \u2192 C i = C (j - i : \u2124).natAbs\n\ntheorem imo2001_p3 {n j : \u2115} (hn : 3 \u2264 n) (hj : j \u2208 Set.Ico 1 n)\n (cpj : Nat.Coprime n j) {C : \u2115 \u2192 Fin 2} (hC : Condition n j C)\n {i : \u2115} (hi : i \u2208 Set.Ico 1 n) :\n C i = C j := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1985, Problem 5\nEach of the numbers in the set $N=\\{1, 2, 3, \\dots, n-1\\}$,\nwhere $n \u2265 3$, is colored with one of two colors, say red or black,\nso that:\n\n 1. $i$ and $n-i$ always receive the same color, and\n 2. for some $j \u2208 N$ relatively prime to $n$, $i$ and $|j-i|$ receive\n the same color\n\nfor all $i \u2208 N, i \u2260 j$.\n\nProve that all numbers in $N$ must receive the same color.\n-/\n/-- The conditions on the problem's coloring `C`.\nAlthough its domain is all of `\u2115`, we only care about its values in `Set.Ico 1 n`. -/\ndef Condition (n j : \u2115) (C : \u2115 \u2192 Fin 2) : Prop :=\n (\u2200 i \u2208 Set.Ico 1 n, C i = C (n - i)) \u2227\n \u2200 i \u2208 Set.Ico 1 n, i \u2260 j \u2192 C i = C (j - i : \u2124).natAbs\n\ntheorem imo2001_p3 {n j : \u2115} (hn : 3 \u2264 n) (hj : j \u2208 Set.Ico 1 n)\n (cpj : Nat.Coprime n j) {C : \u2115 \u2192 Fin 2} (hC : Condition n j C)\n {i : \u2115} (hi : i \u2208 Set.Ico 1 n) :\n C i = C j := by sorry", "category": "combinatorics"} {"name": "Imo1982P3a", "problem_id": "Imo1982P3a", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1982, Problem 3\n\nConsider infinite sequences $\\{x_n \\}$ of positive reals such that $x_0 = 0$ and\n$x_0 \\geq x_1 \\geq x_2 \\geq ...$\n\na) Prove that for every such sequence there is an $n \\geq 1$ such that:\n\n$\\frac{x_0^2}{x_1} + \\ldots + \\frac{x_{n-1}^2}{x_n} \\geq 3.999$\n-/", "formal_statement": "theorem imo1982_q3a {x : \u2115 \u2192 \u211d} (hx : Antitone x) (h0 : x 0 = 1) (hp : \u2200 k, 0 < x k) :\n \u2203 n : \u2115, 3.999 \u2264 \u2211 k \u2208 Finset.range n, (x k) ^ 2 / x (k + 1) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1982, Problem 3\n\nConsider infinite sequences $\\{x_n \\}$ of positive reals such that $x_0 = 0$ and\n$x_0 \\geq x_1 \\geq x_2 \\geq ...$\n\na) Prove that for every such sequence there is an $n \\geq 1$ such that:\n\n$\\frac{x_0^2}{x_1} + \\ldots + \\frac{x_{n-1}^2}{x_n} \\geq 3.999$\n-/\ntheorem imo1982_q3a {x : \u2115 \u2192 \u211d} (hx : Antitone x) (h0 : x 0 = 1) (hp : \u2200 k, 0 < x k) :\n \u2203 n : \u2115, 3.999 \u2264 \u2211 k \u2208 Finset.range n, (x k) ^ 2 / x (k + 1) := by sorry", "tags": ["algebra"], "solved": true, "category": "algebra"} {"name": "Imo1983P5", "solved": false, "tags": ["combinatorics"], "problem_id": "Imo1983P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1983, Problem 5\n\nIs it possible to choose $1983$ distinct positive integers,\nall less than or equal to $10^5$,\nno three of which are consecutive terms of an arithmetic progression?\nJustify your answer.\n-/", "formal_statement": "theorem imo1983_p5 :\n \u2203 S : Finset \u2115, S.card = 1983 \u2227\n (\u2200 x \u2208 S, x \u2264 10^5) \u2227\n \u2200 x \u2208 S, \u2200 y \u2208 S, \u2200 z \u2208 S, x < y \u2227 y < z \u2192 x + z \u2260 2 * y := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1983, Problem 5\n\nIs it possible to choose $1983$ distinct positive integers,\nall less than or equal to $10^5$,\nno three of which are consecutive terms of an arithmetic progression?\nJustify your answer.\n-/\ntheorem imo1983_p5 :\n \u2203 S : Finset \u2115, S.card = 1983 \u2227\n (\u2200 x \u2208 S, x \u2264 10^5) \u2227\n \u2200 x \u2208 S, \u2200 y \u2208 S, \u2200 z \u2208 S, x < y \u2227 y < z \u2192 x + z \u2260 2 * y := by sorry", "category": "combinatorics"} {"name": "Imo1995P2", "solved": true, "tags": ["algebra", "inequality"], "problem_id": "Imo1995P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1995, Problem 2\n\nLet a, b, c be positive real numbers such that abc = 1. Show that\n\n 1 / (a\u00b3(b + c)) + 1 / (b\u00b3(c + a)) + 1 / (c\u00b3(a + b)) \u2265 3/2.\n-/", "formal_statement": "/- special open -/ open Finset\n\n\n\n\n\n\ntheorem imo1995_p2 (a b c : \u211d) (ha : 0 < a) (hb : 0 < b) (hc : 0 < c)\n (habc : a * b * c = 1) :\n 3 / 2 \u2264 1 / (a^3 * (b + c)) + 1 / (b^3 * (c + a)) + 1 / (c^3 * (a + b)) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1995, Problem 2\n\nLet a, b, c be positive real numbers such that abc = 1. Show that\n\n 1 / (a\u00b3(b + c)) + 1 / (b\u00b3(c + a)) + 1 / (c\u00b3(a + b)) \u2265 3/2.\n-/\n/- special open -/ open Finset\n\n\n\n\n\n\ntheorem imo1995_p2 (a b c : \u211d) (ha : 0 < a) (hb : 0 < b) (hc : 0 < c)\n (habc : a * b * c = 1) :\n 3 / 2 \u2264 1 / (a^3 * (b + c)) + 1 / (b^3 * (c + a)) + 1 / (c^3 * (a + b)) := by sorry", "category": "algebra"} {"name": "Imo1982P1", "solved": true, "tags": ["algebra"], "problem_id": "Imo1982P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1982, Problem 1\n\nLet f be a function from positive integers to nonnegative integers such that\n 1) f(2) = 0\n 2) f(3) > 0\n 3) f(9999) = 3333\n 4) for all m,n > 0, f (m + n) - f (m) - f(n) = 1 or 0\n\nDetermine the value of f(1982).\n-/", "formal_statement": "abbrev solution_value : \u2115 := 660\n\ntheorem imo1982_p1 (f : \u2115 \u2192 \u2115)\n (h2 : f 2 = 0)\n (h3 : 0 < f 3)\n (h9999 : f 9999 = 3333)\n (hf : \u2200 m n, 0 < m \u2192 0 < n \u2192 f (m + n) = f m + f n \u2228 f (m + n) = f m + f n + 1) :\n f 1982 = solution_value := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1982, Problem 1\n\nLet f be a function from positive integers to nonnegative integers such that\n 1) f(2) = 0\n 2) f(3) > 0\n 3) f(9999) = 3333\n 4) for all m,n > 0, f (m + n) - f (m) - f(n) = 1 or 0\n\nDetermine the value of f(1982).\n-/\nabbrev solution_value : \u2115 := 660\n\ntheorem imo1982_p1 (f : \u2115 \u2192 \u2115)\n (h2 : f 2 = 0)\n (h3 : 0 < f 3)\n (h9999 : f 9999 = 3333)\n (hf : \u2200 m n, 0 < m \u2192 0 < n \u2192 f (m + n) = f m + f n \u2228 f (m + n) = f m + f n + 1) :\n f 1982 = solution_value := by sorry", "category": "algebra"} {"name": "Imo1998P6", "solved": false, "tags": ["algebra"], "problem_id": "Imo1998P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1998, Problem 6\n\nConsider all functions f from the set of all positive integers into itself satisfying\nf(t^2f(s)) = sf(t)^2 for all s and t.\nDetermine the least possible value of f(1998).\n-/", "formal_statement": "abbrev solution : \u2115+ := 120\n\ntheorem imo1998_p6\n (f : \u2115+ \u2192 \u2115+)\n (h : \u2200 s t, f (t^2 * f s) = s * (f t)^2) :\n IsLeast {n : \u2115 | n = f 1998} solution := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1998, Problem 6\n\nConsider all functions f from the set of all positive integers into itself satisfying\nf(t^2f(s)) = sf(t)^2 for all s and t.\nDetermine the least possible value of f(1998).\n-/\nabbrev solution : \u2115+ := 120\n\ntheorem imo1998_p6\n (f : \u2115+ \u2192 \u2115+)\n (h : \u2200 s t, f (t^2 * f s) = s * (f t)^2) :\n IsLeast {n : \u2115 | n = f 1998} solution := by sorry", "category": "algebra"} {"name": "Poland1998P4", "solved": true, "tags": ["number theory"], "problem_id": "Poland1998P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\nPolish Mathematical Olympiad 1998, Problem 4\n\nProve that the sequence {a_n} defined by a_1 = 1 and\n\n a_n = a_{n - 1} + a_{\u230an/2\u230b} n = 2,3,4,...\n\ncontains infinitely many integers divisible by 7.\n\n-/", "formal_statement": "def a : \u2115 \u2192 \u2115\n| 0 => 1 -- unused dummy value\n| 1 => 1\n| Nat.succ n =>\n have _ : (n.succ / 2) < n.succ := Nat.div_lt_self' n 0\n a n + a (n.succ / 2)\n\ntheorem poland1998_p4 : Set.Infinite { n | 7 \u2223 a n } := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\nPolish Mathematical Olympiad 1998, Problem 4\n\nProve that the sequence {a_n} defined by a_1 = 1 and\n\n a_n = a_{n - 1} + a_{\u230an/2\u230b} n = 2,3,4,...\n\ncontains infinitely many integers divisible by 7.\n\n-/\ndef a : \u2115 \u2192 \u2115\n| 0 => 1 -- unused dummy value\n| 1 => 1\n| Nat.succ n =>\n have _ : (n.succ / 2) < n.succ := Nat.div_lt_self' n 0\n a n + a (n.succ / 2)\n\ntheorem poland1998_p4 : Set.Infinite { n | 7 \u2223 a n } := by sorry", "category": "number theory"} {"name": "Imo2011P3", "solved": true, "tags": ["algebra"], "problem_id": "Imo2011P3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2011, Problem 3\n\nLet f : \u211d \u2192 \u211d be a function that satisfies\n\n f(x + y) \u2264 y * f(x) + f(f(x))\n\nfor all x and y. Prove that f(x) = 0 for all x \u2264 0.\n-/", "formal_statement": "theorem imo2011_p3 (f : \u211d \u2192 \u211d) (hf : \u2200 x y, f (x + y) \u2264 y * f x + f (f x)) :\n \u2200 x \u2264 0, f x = 0 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2011, Problem 3\n\nLet f : \u211d \u2192 \u211d be a function that satisfies\n\n f(x + y) \u2264 y * f(x) + f(f(x))\n\nfor all x and y. Prove that f(x) = 0 for all x \u2264 0.\n-/\ntheorem imo2011_p3 (f : \u211d \u2192 \u211d) (hf : \u2200 x y, f (x + y) \u2264 y * f x + f (f x)) :\n \u2200 x \u2264 0, f x = 0 := by sorry", "category": "algebra"} {"name": "Imo2024P6", "solved": true, "tags": ["algebra"], "problem_id": "Imo2024P6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2024, Problem 6\n\nA function `f: \u211a \u2192 \u211a` is called *aquaesulian* if the following\nproperty holds: for every `x, y \u2208 \u211a`,\n`f(x + f(y)) = f(x) + y` or `f(f(x) + y) = x + f(y)`.\n\nShow that there exists an integer `c` such that for any aquaesulian function `f`\nthere are at most `c` different rational numbers of the form `f(r)+f(-r)` for\nsome rational number `r`, and find the smallest possible value of `c`.\n-/", "formal_statement": "/- special open -/ open Cardinal\n\n\n\n\n\n\ndef Aquaesulian (f : \u211a \u2192 \u211a) : Prop :=\n \u2200 x y, f (x + f y) = f x + y \u2228 f (f x + y) = x + f y\n\n\nabbrev solution : \u2115 := 2\n\ntheorem imo2024_p6 :\n (\u2200 f, Aquaesulian f \u2192 #(Set.range (fun x \u21a6 f x + f (-x))) \u2264 solution) \u2227\n \u2200 c : \u2115,\n (\u2200 f, Aquaesulian f \u2192 #(Set.range (fun x \u21a6 f x + f (-x))) \u2264 c) \u2192\n solution \u2264 c := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2024, Problem 6\n\nA function `f: \u211a \u2192 \u211a` is called *aquaesulian* if the following\nproperty holds: for every `x, y \u2208 \u211a`,\n`f(x + f(y)) = f(x) + y` or `f(f(x) + y) = x + f(y)`.\n\nShow that there exists an integer `c` such that for any aquaesulian function `f`\nthere are at most `c` different rational numbers of the form `f(r)+f(-r)` for\nsome rational number `r`, and find the smallest possible value of `c`.\n-/\n/- special open -/ open Cardinal\n\n\n\n\n\n\ndef Aquaesulian (f : \u211a \u2192 \u211a) : Prop :=\n \u2200 x y, f (x + f y) = f x + y \u2228 f (f x + y) = x + f y\n\n\nabbrev solution : \u2115 := 2\n\ntheorem imo2024_p6 :\n (\u2200 f, Aquaesulian f \u2192 #(Set.range (fun x \u21a6 f x + f (-x))) \u2264 solution) \u2227\n \u2200 c : \u2115,\n (\u2200 f, Aquaesulian f \u2192 #(Set.range (fun x \u21a6 f x + f (-x))) \u2264 c) \u2192\n solution \u2264 c := by sorry", "category": "algebra"} {"name": "Imo1972P4", "solved": false, "tags": ["algebra"], "problem_id": "Imo1972P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1972, Problem 4\n\nFind all positive real solutions to:\n\n(x_1^2 - x_3x_5)(x_2^2 - x_3x_5) \u2264 0\n(x_2^2 - x_4x_1)(x_3^2 - x_4x_1) \u2264 0\n(x_3^2 - x_5x_2)(x_4^2 - x_5x_2) \u2264 0\n(x_4^2 - x_1x_3)(x_5^2 - x_1x_3) \u2264 0\n(x_5^2 - x_2x_4)(x_1^2 - x_2x_4) \u2264 0\n-/", "formal_statement": "abbrev solution_set : Set (\u211d \u00d7 \u211d \u00d7 \u211d \u00d7 \u211d \u00d7 \u211d) :=\n {(a, b, c, d, e) | a = b \u2227 b = c \u2227 c = d \u2227 d = e}\n\ntheorem imo1972_p4 (a b c d e : \u211d)\n (h\u2080 : 0 < a \u2227 0 < b \u2227 0 < c \u2227 0 < d \u2227 0 < e):\n (a^2 - c * e) * (b^2 - c * e) \u2264 0 \u2227\n (b^2 - d * a) * (c^2 - d * a) \u2264 0 \u2227\n (c^2 - e * b) * (d^2 - e * b) \u2264 0 \u2227\n (d^2 - a * c) * (e^2 - a * c) \u2264 0 \u2227\n (e^2 - b * d) * (a^2 - b * d) \u2264 0 \u2194\n (a, b, c, d, e) \u2208 solution_set := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1972, Problem 4\n\nFind all positive real solutions to:\n\n(x_1^2 - x_3x_5)(x_2^2 - x_3x_5) \u2264 0\n(x_2^2 - x_4x_1)(x_3^2 - x_4x_1) \u2264 0\n(x_3^2 - x_5x_2)(x_4^2 - x_5x_2) \u2264 0\n(x_4^2 - x_1x_3)(x_5^2 - x_1x_3) \u2264 0\n(x_5^2 - x_2x_4)(x_1^2 - x_2x_4) \u2264 0\n-/\nabbrev solution_set : Set (\u211d \u00d7 \u211d \u00d7 \u211d \u00d7 \u211d \u00d7 \u211d) :=\n {(a, b, c, d, e) | a = b \u2227 b = c \u2227 c = d \u2227 d = e}\n\ntheorem imo1972_p4 (a b c d e : \u211d)\n (h\u2080 : 0 < a \u2227 0 < b \u2227 0 < c \u2227 0 < d \u2227 0 < e):\n (a^2 - c * e) * (b^2 - c * e) \u2264 0 \u2227\n (b^2 - d * a) * (c^2 - d * a) \u2264 0 \u2227\n (c^2 - e * b) * (d^2 - e * b) \u2264 0 \u2227\n (d^2 - a * c) * (e^2 - a * c) \u2264 0 \u2227\n (e^2 - b * d) * (a^2 - b * d) \u2264 0 \u2194\n (a, b, c, d, e) \u2208 solution_set := by sorry", "category": "algebra"} {"name": "Usa2022P4", "solved": true, "tags": ["number theory"], "problem_id": "Usa2022P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 2022, Problem 4\n\nDetermine all pairs of primes (p, q) where p - q and pq - q\nare both perfect squares.\n-/", "formal_statement": "abbrev solution_set : Set (\u2115 \u00d7 \u2115) := {(3, 2)}\n\ntheorem usa2022_p4 (p q : \u2115) :\n (p, q) \u2208 solution_set \u2194\n p.Prime \u2227 q.Prime \u2227\n \u2203 a, a^2 + q = p \u2227 \u2203 b, b^2 + q = p * q := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 2022, Problem 4\n\nDetermine all pairs of primes (p, q) where p - q and pq - q\nare both perfect squares.\n-/\nabbrev solution_set : Set (\u2115 \u00d7 \u2115) := {(3, 2)}\n\ntheorem usa2022_p4 (p q : \u2115) :\n (p, q) \u2208 solution_set \u2194\n p.Prime \u2227 q.Prime \u2227\n \u2203 a, a^2 + q = p \u2227 \u2203 b, b^2 + q = p * q := by sorry", "category": "number theory"} {"name": "Imo2019P4", "solved": true, "tags": ["number theory"], "problem_id": "Imo2019P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2019, Problem 4\n\nDetermine all positive integers n,k that satisfy the equation\n\n k! = (2\u207f - 2\u2070)(2\u207f - 2\u00b9) ... (2\u207f - 2\u207f\u207b\u00b9).\n-/", "formal_statement": "abbrev solution_set : Set (\u2115 \u00d7 \u2115) := { (1,1), (2,3) }\n\ntheorem imo2018_p2 (n k : \u2115) :\n (n, k) \u2208 solution_set \u2194\n 0 < n \u2227 0 < k \u2227\n (k ! : \u2124) = \u220f i \u2208 Finset.range n, ((2:\u2124)^n - (2:\u2124)^i) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2019, Problem 4\n\nDetermine all positive integers n,k that satisfy the equation\n\n k! = (2\u207f - 2\u2070)(2\u207f - 2\u00b9) ... (2\u207f - 2\u207f\u207b\u00b9).\n-/\nabbrev solution_set : Set (\u2115 \u00d7 \u2115) := { (1,1), (2,3) }\n\ntheorem imo2018_p2 (n k : \u2115) :\n (n, k) \u2208 solution_set \u2194\n 0 < n \u2227 0 < k \u2227\n (k ! : \u2124) = \u220f i \u2208 Finset.range n, ((2:\u2124)^n - (2:\u2124)^i) := by sorry", "category": "number theory"} {"name": "Imo1959P1", "solved": true, "tags": ["number theory"], "problem_id": "Imo1959P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1959, Problem 1.\n\nProve that the fraction `(21n+4)/(14n+3)` is irreducible for every\nnatural number `n`.\n-/", "formal_statement": "/-\nSince Lean doesn't have a concept of \"irreducible fractions\" per se,\nwe just formalize this as saying the numerator and denominator are\nrelatively prime.\n-/\ntheorem imo1959_p1 : \u2200 n : \u2115, Nat.Coprime (21 * n + 4) (14 * n + 3) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1959, Problem 1.\n\nProve that the fraction `(21n+4)/(14n+3)` is irreducible for every\nnatural number `n`.\n-/\n/-\nSince Lean doesn't have a concept of \"irreducible fractions\" per se,\nwe just formalize this as saying the numerator and denominator are\nrelatively prime.\n-/\ntheorem imo1959_p1 : \u2200 n : \u2115, Nat.Coprime (21 * n + 4) (14 * n + 3) := by sorry", "category": "number theory"} {"name": "Bulgaria1998P1", "solved": false, "tags": ["combinatorics"], "problem_id": "Bulgaria1998P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# Bulgarian Mathematical Olympiad 1998, Problem 1\n\nWe will be considering colorings in 2 colors of n (distinct) points\nA\u2081, A\u2082, ..., A\u2099. Call such a coloring \"good\" if there exist three points\nA\u1d62, A\u2c7c, A\u2082\u2c7c\u208b\u1d62, 1 \u2264 i < 2j - i \u2264 n, which are colored the same color.\n\nFind the least natural number n (n \u2265 3) such that all colorings\nof n points are good.\n-/", "formal_statement": "abbrev coloring_is_good {m : \u2115} (color : Set.Icc 1 m \u2192 Fin 2) : Prop :=\n \u2203 i j : Set.Icc 1 m,\n i < j \u2227\n \u2203 h3 : 2 * j.val - i \u2208 Set.Icc 1 m,\n color i = color j \u2227 color i = color \u27e82 * j - i, h3\u27e9\n\nabbrev all_colorings_are_good (m : \u2115) : Prop :=\n 3 \u2264 m \u2227 \u2200 color : Set.Icc 1 m \u2192 Fin 2, coloring_is_good color\n\nabbrev solution_value : \u2115 := 9\n\ntheorem bulgaria1998_p1 : IsLeast { m | all_colorings_are_good m } solution_value := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# Bulgarian Mathematical Olympiad 1998, Problem 1\n\nWe will be considering colorings in 2 colors of n (distinct) points\nA\u2081, A\u2082, ..., A\u2099. Call such a coloring \"good\" if there exist three points\nA\u1d62, A\u2c7c, A\u2082\u2c7c\u208b\u1d62, 1 \u2264 i < 2j - i \u2264 n, which are colored the same color.\n\nFind the least natural number n (n \u2265 3) such that all colorings\nof n points are good.\n-/\nabbrev coloring_is_good {m : \u2115} (color : Set.Icc 1 m \u2192 Fin 2) : Prop :=\n \u2203 i j : Set.Icc 1 m,\n i < j \u2227\n \u2203 h3 : 2 * j.val - i \u2208 Set.Icc 1 m,\n color i = color j \u2227 color i = color \u27e82 * j - i, h3\u27e9\n\nabbrev all_colorings_are_good (m : \u2115) : Prop :=\n 3 \u2264 m \u2227 \u2200 color : Set.Icc 1 m \u2192 Fin 2, coloring_is_good color\n\nabbrev solution_value : \u2115 := 9\n\ntheorem bulgaria1998_p1 : IsLeast { m | all_colorings_are_good m } solution_value := by sorry", "category": "combinatorics"} {"name": "Imo2009P5", "solved": true, "tags": ["algebra"], "problem_id": "Imo2009P5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2009, Problem 5\n\nDetermine all functions f: \u2124>0 \u2192 \u2124>0 such that for all positive integers a and b,\nthe numbers\n\n a, f(b), and f(b + f(a) - 1)\n\nform the sides of a nondegenerate triangle.\n-/", "formal_statement": "abbrev solution_set : Set (\u2115+ \u2192 \u2115+) := { id }\n\ntheorem imo2009_p5 (f : \u2115+ \u2192 \u2115+) :\n f \u2208 solution_set \u2194\n \u2200 a b, (f (b + f a - 1) < f b + a \u2227\n a < f b + f (b + f a - 1) \u2227\n f b < f (b + f a - 1) + a) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2009, Problem 5\n\nDetermine all functions f: \u2124>0 \u2192 \u2124>0 such that for all positive integers a and b,\nthe numbers\n\n a, f(b), and f(b + f(a) - 1)\n\nform the sides of a nondegenerate triangle.\n-/\nabbrev solution_set : Set (\u2115+ \u2192 \u2115+) := { id }\n\ntheorem imo2009_p5 (f : \u2115+ \u2192 \u2115+) :\n f \u2208 solution_set \u2194\n \u2200 a b, (f (b + f a - 1) < f b + a \u2227\n a < f b + f (b + f a - 1) \u2227\n f b < f (b + f a - 1) + a) := by sorry", "category": "algebra"} {"name": "Imo2023P4", "solved": true, "tags": ["algebra"], "problem_id": "Imo2023P4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2023, Problem 4\n\nLet x\u2081, x\u2082, ... x\u2082\u2080\u2082\u2083 be distinct positive real numbers.\nDefine\n\n a\u2099 := \u221a((x\u2081 + x\u2082 + ... + x\u2099)(1/x\u2081 + 1/x\u2082 + ... + 1/x\u2099)).\n\nSuppose that a\u2099 is an integer for all n \u2208 {1,...,2023}.\nProve that 3034 \u2264 a\u2082\u2080\u2082\u2083.\n-/", "formal_statement": "noncomputable def a (x : Finset.Icc 1 2023 \u2192 \u211d) (n : Finset.Icc 1 2023) : \u211d :=\n \u221a((\u2211 i \u2208 Finset.univ.filter (\u00b7 \u2264 n), x i) *\n (\u2211 i \u2208 Finset.univ.filter (\u00b7 \u2264 n), (1 / x i)))\n\ntheorem imo2023_p4\n (x : Finset.Icc 1 2023 \u2192 \u211d)\n (hxp : \u2200 i, 0 < x i)\n (hxi : x.Injective)\n (hxa : \u2200 i : Finset.Icc 1 2023, \u2203 k : \u2124, a x i = k)\n : 3034 \u2264 a x \u27e82023, by simp\u27e9 := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2023, Problem 4\n\nLet x\u2081, x\u2082, ... x\u2082\u2080\u2082\u2083 be distinct positive real numbers.\nDefine\n\n a\u2099 := \u221a((x\u2081 + x\u2082 + ... + x\u2099)(1/x\u2081 + 1/x\u2082 + ... + 1/x\u2099)).\n\nSuppose that a\u2099 is an integer for all n \u2208 {1,...,2023}.\nProve that 3034 \u2264 a\u2082\u2080\u2082\u2083.\n-/\nnoncomputable def a (x : Finset.Icc 1 2023 \u2192 \u211d) (n : Finset.Icc 1 2023) : \u211d :=\n \u221a((\u2211 i \u2208 Finset.univ.filter (\u00b7 \u2264 n), x i) *\n (\u2211 i \u2208 Finset.univ.filter (\u00b7 \u2264 n), (1 / x i)))\n\ntheorem imo2023_p4\n (x : Finset.Icc 1 2023 \u2192 \u211d)\n (hxp : \u2200 i, 0 < x i)\n (hxi : x.Injective)\n (hxa : \u2200 i : Finset.Icc 1 2023, \u2203 k : \u2124, a x i = k)\n : 3034 \u2264 a x \u27e82023, by simp\u27e9 := by sorry", "category": "algebra"} {"name": "Imo1963P1", "solved": true, "tags": ["algebra"], "problem_id": "Imo1963P1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 1963, Problem 1\n\nFind all real roots of the equation\n\n \u221a(x\u00b2-p) + 2\u221a(x\u00b2-1) = x\n\nwhere *p* is a real parameter.\n-/", "formal_statement": "abbrev f (p : \u211d) : Set \u211d :=\n if p \u2265 0 \u2227 p \u2264 (4 : \u211d) / 3\n then { (4 - p) / (2 * Real.sqrt (4 - 2 * p)) }\n else \u2205\n\ntheorem imo1963_p1 : \u2200 (p x : \u211d), (x ^ 2 - p) \u2265 0 \u2192 (x ^ 2 - 1) \u2265 0 \u2192\n (Real.sqrt (x ^ 2 - p) + 2 * Real.sqrt (x ^ 2 - 1) = x \u2194 (x \u2208 f p)) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 1963, Problem 1\n\nFind all real roots of the equation\n\n \u221a(x\u00b2-p) + 2\u221a(x\u00b2-1) = x\n\nwhere *p* is a real parameter.\n-/\nabbrev f (p : \u211d) : Set \u211d :=\n if p \u2265 0 \u2227 p \u2264 (4 : \u211d) / 3\n then { (4 - p) / (2 * Real.sqrt (4 - 2 * p)) }\n else \u2205\n\ntheorem imo1963_p1 : \u2200 (p x : \u211d), (x ^ 2 - p) \u2265 0 \u2192 (x ^ 2 - 1) \u2265 0 \u2192\n (Real.sqrt (x ^ 2 - p) + 2 * Real.sqrt (x ^ 2 - 1) = x \u2194 (x \u2208 f p)) := by sorry", "category": "algebra"} {"name": "Usa2024P2", "solved": false, "tags": ["combinatorics"], "problem_id": "Usa2024P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# USA Mathematical Olympiad 2024, Problem 2\n\nLet S\u2081, S\u2082, ..., S\u2099 be finite sets of integers whose intersection\nis not empty. For each non-empty T \u2286 {S\u2081, S\u2082, ..., S\u2099}, the size of\nthe intersection of the sets in T is a multiple of the number of\nsets in T. What is the least possible number of elements that are in\nat least 50 sets?\n-/", "formal_statement": "abbrev solution : \u2115 := 50 * Nat.choose 100 50\n\nstructure Good (S : Fin 100 \u2192 Set \u2124) : Prop where\n finite : \u2200 i, (S i).Finite\n nonempty_inter : \u22c2 i, S i \u2260 \u2205\n card : \u2200 T : Finset (Fin 100), T.Nonempty \u2192\n \u2203 k : \u2115, (\u22c2 i \u2208 T, S i).ncard * k = T.card\n\n-- z is in at least k of the sets S.\nabbrev InAtLeastKSubsets (S : Fin 100 \u2192 Set \u2124) (k : \u2115) (z : \u2124) : Prop :=\n k \u2264 {i : Fin 100 | z \u2208 S i }.ncard\n\ntheorem usa2024_p2 (n : \u2115) :\n IsLeast\n { k | \u2203 S, Good S \u2227\n k = {z : \u2124 | InAtLeastKSubsets S k z }.ncard } solution := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# USA Mathematical Olympiad 2024, Problem 2\n\nLet S\u2081, S\u2082, ..., S\u2099 be finite sets of integers whose intersection\nis not empty. For each non-empty T \u2286 {S\u2081, S\u2082, ..., S\u2099}, the size of\nthe intersection of the sets in T is a multiple of the number of\nsets in T. What is the least possible number of elements that are in\nat least 50 sets?\n-/\nabbrev solution : \u2115 := 50 * Nat.choose 100 50\n\nstructure Good (S : Fin 100 \u2192 Set \u2124) : Prop where\n finite : \u2200 i, (S i).Finite\n nonempty_inter : \u22c2 i, S i \u2260 \u2205\n card : \u2200 T : Finset (Fin 100), T.Nonempty \u2192\n \u2203 k : \u2115, (\u22c2 i \u2208 T, S i).ncard * k = T.card\n\n-- z is in at least k of the sets S.\nabbrev InAtLeastKSubsets (S : Fin 100 \u2192 Set \u2124) (k : \u2115) (z : \u2124) : Prop :=\n k \u2264 {i : Fin 100 | z \u2208 S i }.ncard\n\ntheorem usa2024_p2 (n : \u2115) :\n IsLeast\n { k | \u2203 S, Good S \u2227\n k = {z : \u2124 | InAtLeastKSubsets S k z }.ncard } solution := by sorry", "category": "combinatorics"} {"name": "Imo2008P2b", "problem_id": "Imo2008P2b", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2008, Problem 2\n\n```\nx^2 / (x-1)^2 + y^2 / (y-1)^2 + z^2 / (z-1)^2 \u2265 1\n```\n\n(b) Prove that equality holds above for infinitely many triples of rational numbers `x`, `y`, `z`,\neach different from 1, and satisfying `xyz = 1`.\n-/", "formal_statement": "def rationalSolutions :=\n {s : \u211a \u00d7 \u211a \u00d7 \u211a | \u2203 x y z : \u211a, s = (x, y, z) \u2227 x \u2260 1 \u2227 y \u2260 1 \u2227 z \u2260 1 \u2227 x * y * z = 1 \u2227\n x ^ 2 / (x - 1) ^ 2 + y ^ 2 / (y - 1) ^ 2 + z ^ 2 / (z - 1) ^ 2 = 1}\n\ntheorem imo2008_p2b : Set.Infinite rationalSolutions := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2008, Problem 2\n\n```\nx^2 / (x-1)^2 + y^2 / (y-1)^2 + z^2 / (z-1)^2 \u2265 1\n```\n\n(b) Prove that equality holds above for infinitely many triples of rational numbers `x`, `y`, `z`,\neach different from 1, and satisfying `xyz = 1`.\n-/\ndef rationalSolutions :=\n {s : \u211a \u00d7 \u211a \u00d7 \u211a | \u2203 x y z : \u211a, s = (x, y, z) \u2227 x \u2260 1 \u2227 y \u2260 1 \u2227 z \u2260 1 \u2227 x * y * z = 1 \u2227\n x ^ 2 / (x - 1) ^ 2 + y ^ 2 / (y - 1) ^ 2 + z ^ 2 / (z - 1) ^ 2 = 1}\n\ntheorem imo2008_p2b : Set.Infinite rationalSolutions := by sorry", "tags": ["algebra"], "solved": true, "category": "algebra"} {"name": "Imo2001P2", "solved": true, "tags": ["algebra", "inequality"], "problem_id": "Imo2001P2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2001, Problem 2\n\nLet a, b, c be positive reals. Prove that\n\n a / \u221a(a\u00b2 + 8bc) + b / \u221a(b\u00b2 + 8ca) + c / \u221a(c\u00b2 + 8ab) \u2265 1.\n-/", "formal_statement": "variable {a b c : \u211d}\n\ntheorem imo2001_p2 (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : 1 \u2264\n a / Real.sqrt (a ^ 2 + 8 * b * c) + b / Real.sqrt (b ^ 2 + 8 * c * a) +\n c / Real.sqrt (c ^ 2 + 8 * a * b) := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2001, Problem 2\n\nLet a, b, c be positive reals. Prove that\n\n a / \u221a(a\u00b2 + 8bc) + b / \u221a(b\u00b2 + 8ca) + c / \u221a(c\u00b2 + 8ab) \u2265 1.\n-/\nvariable {a b c : \u211d}\n\ntheorem imo2001_p2 (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) : 1 \u2264\n a / Real.sqrt (a ^ 2 + 8 * b * c) + b / Real.sqrt (b ^ 2 + 8 * c * a) +\n c / Real.sqrt (c ^ 2 + 8 * a * b) := by sorry", "category": "algebra"} {"name": "Imo2007P1a", "problem_id": "Imo2007P1a", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# International Mathematical Olympiad 2007, Problem 1\n\nReal numbers a\u2081, a\u2082, ..., a\u2099 are fixed. For each 1 \u2264 i \u2264 n,\nwe let d\u1d62 = max {a\u2c7c : 1 \u2264 j \u2264 i} - min {a\u2c7c : i \u2264 j \u2264 n},\nand let d = max {d\u1d62 : 1 \u2264 i \u2264 n}.\n\n(a) Prove that for any real numbers x\u2081 \u2264 ... \u2264 x\u2099, we have\n max { |x\u1d62 - a\u1d62| : 1 \u2264 i \u2264 n } \u2265 d / 2.\n-/", "formal_statement": "noncomputable abbrev d {n : \u2115} (a : Fin n \u2192 \u211d) (i : Fin n) :=\n (\u2a06 j : {j // j \u2264 i}, a j - \u2a05 j : {j // i \u2264 j}, a j)\n\ntheorem imo2007_p1a {n : \u2115} (hn : 0 < n) {a x : Fin n \u2192 \u211d} (h : Monotone x) :\n (\u2a06 i, d a i) / 2 \u2264 \u2a06 i, |x i - a i| := by sorry", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# International Mathematical Olympiad 2007, Problem 1\n\nReal numbers a\u2081, a\u2082, ..., a\u2099 are fixed. For each 1 \u2264 i \u2264 n,\nwe let d\u1d62 = max {a\u2c7c : 1 \u2264 j \u2264 i} - min {a\u2c7c : i \u2264 j \u2264 n},\nand let d = max {d\u1d62 : 1 \u2264 i \u2264 n}.\n\n(a) Prove that for any real numbers x\u2081 \u2264 ... \u2264 x\u2099, we have\n max { |x\u1d62 - a\u1d62| : 1 \u2264 i \u2264 n } \u2265 d / 2.\n-/\nnoncomputable abbrev d {n : \u2115} (a : Fin n \u2192 \u211d) (i : Fin n) :=\n (\u2a06 j : {j // j \u2264 i}, a j - \u2a05 j : {j // i \u2264 j}, a j)\n\ntheorem imo2007_p1a {n : \u2115} (hn : 0 < n) {a x : Fin n \u2192 \u211d} (h : Monotone x) :\n (\u2a06 i, d a i) / 2 \u2264 \u2a06 i, |x i - a i| := by sorry", "tags": ["algebra"], "solved": false, "category": "algebra"} {"name": "Singapore2019P11", "solved": true, "tags": ["algebra"], "problem_id": "Singapore2019P11", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# Singapore Math Olympiad (Senior) 2019 (Round 1), Problem 11\n\nhttp://www.realsutra.com/limjeck/SMO_Senior_2019.pdf\n\nFind the value of 448 * (sin 12 degrees) * (sin 39 degrees) * (sin 51 degrees) / sin 24 degrees\n-/", "formal_statement": "noncomputable abbrev solution : \u211d := 112\n\ntheorem 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", "split": "test", "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# Singapore Math Olympiad (Senior) 2019 (Round 1), Problem 11\n\nhttp://www.realsutra.com/limjeck/SMO_Senior_2019.pdf\n\nFind the value of 448 * (sin 12 degrees) * (sin 39 degrees) * (sin 51 degrees) / sin 24 degrees\n-/\nnoncomputable abbrev solution : \u211d := 112\n\ntheorem 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", "category": "algebra"} {"name": "imo_sl_2006_A1", "problem_id": "2006_A1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2006 A1\n\nLet $R$ be an archimedean ring with floor.\nDefine the function $f : R \u2192 R$ by $$ f(x) = \u230ax\u230b (x - \u230ax\u230b). $$\nProve that for any $r \u2208 R$, there exists $N \u2208 \u2115$ such that for all $k \u2265 N$,\n$$ f^{k + 2}(r) = f^k(r). $$\n-/", "formal_statement": "/- special open -/ open Finset\nabbrev f [LinearOrderedRing R] [FloorRing R] (r : R) := \u2308r\u2309 * (r - \u2308r\u2309)\n\ntheorem imo_sl_2006_A1 [LinearOrderedRing R] [FloorRing R] [Archimedean R] (r : R) : \n \u2203 N, \u2200 n \u2265 N, f^[n + 2] r = f^[n] r := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2006 A1\n\nLet $R$ be an archimedean ring with floor.\nDefine the function $f : R \u2192 R$ by $$ f(x) = \u230ax\u230b (x - \u230ax\u230b). $$\nProve that for any $r \u2208 R$, there exists $N \u2208 \u2115$ such that for all $k \u2265 N$,\n$$ f^{k + 2}(r) = f^k(r). $$\n-/\n/- special open -/ open Finset\nabbrev f [LinearOrderedRing R] [FloorRing R] (r : R) := \u2308r\u2309 * (r - \u2308r\u2309)\n\ntheorem imo_sl_2006_A1 [LinearOrderedRing R] [FloorRing R] [Archimedean R] (r : R) : \n \u2203 N, \u2200 n \u2265 N, f^[n + 2] r = f^[n] r := by sorry", "category": "algebra"} {"name": "imo_sl_2006_A2", "problem_id": "2006_A2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2006 A2\n\nConsider the sequence $(a_n)_{n \u2265 0}$ of rational nuimbers defined by $a_0 = 1$ and\n$$ a_n = -\\sum_{k = 0}^{n - 1} \\frac{a_k}{n + 1 - k}. $$\nProve that $a_n > 0$ for all $n \u2260 0$.\n-/", "formal_statement": "/- special open -/ open Finset\ndef a : \u2115 \u2192 \u211a\n | 0 => -1\n | n + 1 => -(univ : Finset (Fin (n + 1))).sum \u03bb i \u21a6 a i / (n + 2 - i : \u2115)\n\ntheorem imo_sl_2006_A2 (h : n \u2260 0) : 0 < a n := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2006 A2\n\nConsider the sequence $(a_n)_{n \u2265 0}$ of rational nuimbers defined by $a_0 = 1$ and\n$$ a_n = -\\sum_{k = 0}^{n - 1} \\frac{a_k}{n + 1 - k}. $$\nProve that $a_n > 0$ for all $n \u2260 0$.\n-/\n/- special open -/ open Finset\ndef a : \u2115 \u2192 \u211a\n | 0 => -1\n | n + 1 => -(univ : Finset (Fin (n + 1))).sum \u03bb i \u21a6 a i / (n + 2 - i : \u2115)\n\ntheorem imo_sl_2006_A2 (h : n \u2260 0) : 0 < a n := by sorry", "category": "algebra"} {"name": "imo_sl_2006_A4", "problem_id": "2006_A4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2006 A4\n\nLet $F$ be a totally ordered field and $a_1, a_2, \u2026, a_n \u2208 F$ be positive.\nProve the inequality\n$$ \\sum_{i < j} \\frac{a_i a_j}{a_i + a_j}\n \u2264 \\frac{n}{2(a_1 + a_2 + \u2026 + a_n)} \\sum_{i < j} a_i a_j. $$\n-/", "formal_statement": "theorem imo_sl_2006_A4 [LinearOrderedField F] [LinearOrder \u03b9]\n (a : \u03b9 \u2192 F) {S : Finset \u03b9} (hS : \u2200 i \u2208 S, 0 < a i) :\n let T := (S \u00d7\u02e2 S).filter \u03bb p \u21a6 p.1 < p.2\n T.sum (\u03bb p \u21a6 a p.1 * a p.2 / (a p.1 + a p.2))\n \u2264 S.card \u2022 T.sum (\u03bb p \u21a6 a p.1 * a p.2) / (2 * S.sum a) := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2006 A4\n\nLet $F$ be a totally ordered field and $a_1, a_2, \u2026, a_n \u2208 F$ be positive.\nProve the inequality\n$$ \\sum_{i < j} \\frac{a_i a_j}{a_i + a_j}\n \u2264 \\frac{n}{2(a_1 + a_2 + \u2026 + a_n)} \\sum_{i < j} a_i a_j. $$\n-/\ntheorem imo_sl_2006_A4 [LinearOrderedField F] [LinearOrder \u03b9]\n (a : \u03b9 \u2192 F) {S : Finset \u03b9} (hS : \u2200 i \u2208 S, 0 < a i) :\n let T := (S \u00d7\u02e2 S).filter \u03bb p \u21a6 p.1 < p.2\n T.sum (\u03bb p \u21a6 a p.1 * a p.2 / (a p.1 + a p.2))\n \u2264 S.card \u2022 T.sum (\u03bb p \u21a6 a p.1 * a p.2) / (2 * S.sum a) := by sorry", "category": "algebra"} {"name": "imo_sl_2006_A6", "problem_id": "2006_A6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\nInternational Mathematical Olympiad 2006, Problem 3\n\nFind the smallest M \u2208 \u211d such that for any a, b, c \u2208 \u211d,\n|ab(a\u00b2 - b\u00b2) + bc(b\u00b2 - c\u00b2) + ca(c\u00b2 - a\u00b2)| \u2264 M(a\u00b2 + b\u00b2 + c\u00b2)\u00b2.\n-/", "formal_statement": "def good [LinearOrderedCommRing R] (M : R) :=\n \u2200 a b c : R, |a * b * (a ^ 2 - b ^ 2) + b * c * (b ^ 2 - c ^ 2) + c * a * (c ^ 2 - a ^ 2)|\n \u2264 M * (a ^ 2 + b ^ 2 + c ^ 2) ^ 2\n\ntheorem good_iff : good M \u2194 9 * \u221a2 \u2264 32 * M := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\nInternational Mathematical Olympiad 2006, Problem 3\n\nFind the smallest M \u2208 \u211d such that for any a, b, c \u2208 \u211d,\n|ab(a\u00b2 - b\u00b2) + bc(b\u00b2 - c\u00b2) + ca(c\u00b2 - a\u00b2)| \u2264 M(a\u00b2 + b\u00b2 + c\u00b2)\u00b2.\n-/\ndef good [LinearOrderedCommRing R] (M : R) :=\n \u2200 a b c : R, |a * b * (a ^ 2 - b ^ 2) + b * c * (b ^ 2 - c ^ 2) + c * a * (c ^ 2 - a ^ 2)|\n \u2264 M * (a ^ 2 + b ^ 2 + c ^ 2) ^ 2\n\ntheorem good_iff : good M \u2194 9 * \u221a2 \u2264 32 * M := by sorry", "category": "algebra"} {"name": "imo_sl_2006_N1", "problem_id": "2006_N1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2006 N1 (P4)\n\nDetermine all pairs $(x, y) \u2208 \u2115 \u00d7 \u2124$ such that $1 + 2^x + 2^{2x + 1} = y^2$.\n-/", "formal_statement": "/- special open -/ open Finset\ndef good (x : \u2115) (y : \u2124) := 2 ^ (2 * x + 1) + 2 ^ x + 1 = y ^ 2\n\ntheorem imo_sl_2006_N1 :\n good x y \u2194 (x = 0 \u2227 (y = 2 \u2228 y = -2)) \u2228 (x = 4 \u2227 (y = 23 \u2228 y = -23)) := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2006 N1 (P4)\n\nDetermine all pairs $(x, y) \u2208 \u2115 \u00d7 \u2124$ such that $1 + 2^x + 2^{2x + 1} = y^2$.\n-/\n/- special open -/ open Finset\ndef good (x : \u2115) (y : \u2124) := 2 ^ (2 * x + 1) + 2 ^ x + 1 = y ^ 2\n\ntheorem imo_sl_2006_N1 :\n good x y \u2194 (x = 0 \u2227 (y = 2 \u2228 y = -2)) \u2228 (x = 4 \u2227 (y = 23 \u2228 y = -23)) := by sorry", "category": "number theory"} {"name": "imo_sl_2006_N3", "problem_id": "2006_N3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2006 N3\n\nFor each $n \u2208 \u2115$, define\n$$ f(n) = \\frac{1}{n} \\sum_{k = 1}^n \\left\\lfloor \\frac{n}{k} \\right\\rfloor. $$\n1. Prove that $f(n + 1) > f(n)$ infinitely often.\n2. Prove that $f(n + 1) < f(n)$ infinitely often.\n-/", "formal_statement": "/- special open -/ open Finset\ndef g (n : \u2115) : \u2115 := (range n).sum \u03bb k \u21a6 n / (k + 1)\ndef f (n : \u2115) : \u211a := ((g n : \u2124) : \u211a) / ((n : \u2124) : \u211a)\n\ntheorem imo_sl_2006_N3 : {n : \u2115 | f n < f n.succ}.Infinite \u2227 {n : \u2115 | f n.succ < f n}.Infinite := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2006 N3\n\nFor each $n \u2208 \u2115$, define\n$$ f(n) = \\frac{1}{n} \\sum_{k = 1}^n \\left\\lfloor \\frac{n}{k} \\right\\rfloor. $$\n1. Prove that $f(n + 1) > f(n)$ infinitely often.\n2. Prove that $f(n + 1) < f(n)$ infinitely often.\n-/\n/- special open -/ open Finset\ndef g (n : \u2115) : \u2115 := (range n).sum \u03bb k \u21a6 n / (k + 1)\ndef f (n : \u2115) : \u211a := ((g n : \u2124) : \u211a) / ((n : \u2124) : \u211a)\n\ntheorem imo_sl_2006_N3 : {n : \u2115 | f n < f n.succ}.Infinite \u2227 {n : \u2115 | f n.succ < f n}.Infinite := by sorry", "category": "number theory"} {"name": "imo_sl_2006_N5", "problem_id": "2006_N5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2006 N5\n\nLet $p > 3$ be a prime.\nDetermine all pairs $(x, y)$ of integers such that\n$$ \\sum_{k = 0}^{p - 1} x^k = y^{p - 2} - 1. $$\n-/", "formal_statement": "/- special open -/ open Finset\ntheorem imo_sl_2006_N5 {p : \u2115} (hp : p.Prime) (h : 3 < p) (x y : \u2124) :\n \u00ac(range p).sum (x ^ \u00b7) = y ^ (p - 2) - 1 := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2006 N5\n\nLet $p > 3$ be a prime.\nDetermine all pairs $(x, y)$ of integers such that\n$$ \\sum_{k = 0}^{p - 1} x^k = y^{p - 2} - 1. $$\n-/\n/- special open -/ open Finset\ntheorem imo_sl_2006_N5 {p : \u2115} (hp : p.Prime) (h : 3 < p) (x y : \u2124) :\n \u00ac(range p).sum (x ^ \u00b7) = y ^ (p - 2) - 1 := by sorry", "category": "number theory"} {"name": "imo_sl_2006_N7", "problem_id": "2006_N7", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2006 N7\n\nProve that for any $b \u2208 \u2115$ and $n \u2208 \u2115^+$, there exists $m \u2208 \u2115$ such that $n \u2223 b^m + m$.\n-/", "formal_statement": "theorem imo_sl_2006_N7 (hn : 0 < n) (b) : \u2203 m, n \u2223 b ^ m + m := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2006 N7\n\nProve that for any $b \u2208 \u2115$ and $n \u2208 \u2115^+$, there exists $m \u2208 \u2115$ such that $n \u2223 b^m + m$.\n-/\ntheorem imo_sl_2006_N7 (hn : 0 < n) (b) : \u2203 m, n \u2223 b ^ m + m := by sorry", "category": "number theory"} {"name": "imo_sl_2007_A1a", "problem_id": "2007_A1a", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2007 A1, Part 1\n\nFix a linearly ordered abelian group $G$ and a positive integer $n$.\nConsider a sequence $(a_i)_{i=0}^n$ of elements of $G$.\n\nLet $(x_i)_{i=0}^n$ be a non-decreasing sequence in $G$, and let\n$$ L = \\max_{j \\le n} |x_j - a_j|. $$\nProve that for any non-decreasing sequence $(x_i)$, the inequality $2L \\ge a_k - a_m$ holds for any $k \\le m \\le n$.\n-/", "formal_statement": "/- special open -/ open Finset\nvariable [LinearOrder \u03b1]\n\n/--\nThe sequence `seqMax f` represents the running maximum of a sequence `f`.\n`seqMax f n = max(f 0, f 1, ..., f n)`.\n-/\ndef seqMax (f : Nat \u2192 \u03b1) : Nat \u2192 \u03b1\n | 0 => f 0\n | n + 1 => max (seqMax f n) (f n.succ)\n\ntheorem imo_sl_2007_A1a_part1 [LinearOrderedAddCommGroup G]\n (a : \u2115 \u2192 G) (n : \u2115) (x : \u2115 \u2192 G) (k m : \u2115)\n (h_mono : Monotone x) (h_le : k \u2264 m) (h_n : m \u2264 n) :\n a k - a m \u2264 2 \u2022 seqMax (\u03bb i \u21a6 |x i - a i|) n := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2007 A1, Part 1\n\nFix a linearly ordered abelian group $G$ and a positive integer $n$.\nConsider a sequence $(a_i)_{i=0}^n$ of elements of $G$.\n\nLet $(x_i)_{i=0}^n$ be a non-decreasing sequence in $G$, and let\n$$ L = \\max_{j \\le n} |x_j - a_j|. $$\nProve that for any non-decreasing sequence $(x_i)$, the inequality $2L \\ge a_k - a_m$ holds for any $k \\le m \\le n$.\n-/\n/- special open -/ open Finset\nvariable [LinearOrder \u03b1]\n\n/--\nThe sequence `seqMax f` represents the running maximum of a sequence `f`.\n`seqMax f n = max(f 0, f 1, ..., f n)`.\n-/\ndef seqMax (f : Nat \u2192 \u03b1) : Nat \u2192 \u03b1\n | 0 => f 0\n | n + 1 => max (seqMax f n) (f n.succ)\n\ntheorem imo_sl_2007_A1a_part1 [LinearOrderedAddCommGroup G]\n (a : \u2115 \u2192 G) (n : \u2115) (x : \u2115 \u2192 G) (k m : \u2115)\n (h_mono : Monotone x) (h_le : k \u2264 m) (h_n : m \u2264 n) :\n a k - a m \u2264 2 \u2022 seqMax (\u03bb i \u21a6 |x i - a i|) n := by sorry", "category": "algebra"} {"name": "imo_sl_2007_A1b", "problem_id": "2007_A1b", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2007 A1, Part 2\n\nFix a linearly ordered abelian group $G$ and a positive integer $n$.\nConsider a sequence $(a_i)_{i=0}^n$ of elements of $G$.\nLet $L(x) = \\max_{j \\le n} |x_j - a_j|$ for a non-decreasing sequence $(x_i)$.\n\nProve that for any $g \\in G$ such that $2g \\ge a_k - a_m$ for any $k \\le m \\le n$,\nthere exists a non-decreasing sequence $(x_i)$ such that $L(x) \\le g$.\n-/", "formal_statement": "/- special open -/ open Finset\nvariable [LinearOrder \u03b1]\n\n/--\nThe sequence `seqMax f` represents the running maximum of a sequence `f`.\n`seqMax f n = max(f 0, f 1, ..., f n)`.\n-/\ndef seqMax (f : Nat \u2192 \u03b1) : Nat \u2192 \u03b1\n | 0 => f 0\n | n + 1 => max (seqMax f n) (f n.succ)\n\n\ntheorem imo_sl_2007_A1b_part2 [LinearOrderedAddCommGroup G]\n (a : \u2115 \u2192 G) (n : \u2115) (g : G)\n (h_g : \u2200 k m : \u2115, k \u2264 m \u2192 m \u2264 n \u2192 a k - a m \u2264 2 \u2022 g) :\n \u2203 x : \u2115 \u2192 G, Monotone x \u2227 seqMax (\u03bb i \u21a6 |x i - a i|) n \u2264 g := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2007 A1, Part 2\n\nFix a linearly ordered abelian group $G$ and a positive integer $n$.\nConsider a sequence $(a_i)_{i=0}^n$ of elements of $G$.\nLet $L(x) = \\max_{j \\le n} |x_j - a_j|$ for a non-decreasing sequence $(x_i)$.\n\nProve that for any $g \\in G$ such that $2g \\ge a_k - a_m$ for any $k \\le m \\le n$,\nthere exists a non-decreasing sequence $(x_i)$ such that $L(x) \\le g$.\n-/\n/- special open -/ open Finset\nvariable [LinearOrder \u03b1]\n\n/--\nThe sequence `seqMax f` represents the running maximum of a sequence `f`.\n`seqMax f n = max(f 0, f 1, ..., f n)`.\n-/\ndef seqMax (f : Nat \u2192 \u03b1) : Nat \u2192 \u03b1\n | 0 => f 0\n | n + 1 => max (seqMax f n) (f n.succ)\n\n\ntheorem imo_sl_2007_A1b_part2 [LinearOrderedAddCommGroup G]\n (a : \u2115 \u2192 G) (n : \u2115) (g : G)\n (h_g : \u2200 k m : \u2115, k \u2264 m \u2192 m \u2264 n \u2192 a k - a m \u2264 2 \u2022 g) :\n \u2203 x : \u2115 \u2192 G, Monotone x \u2227 seqMax (\u03bb i \u21a6 |x i - a i|) n \u2264 g := by sorry", "category": "algebra"} {"name": "imo_sl_2007_A2", "problem_id": "2007_A2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2007 A2\n\nA function $f : \\mathbb{N}^+ \\to \\mathbb{N}^+$ is called *good* if, for any positive integers $m, n$, the following inequality holds:\n$$ f(m + n) + 1 \\ge f(m) + f(f(n)). $$\nFor 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$.\n\nThe solution states that:\n- If $N=1$, the only possible value is $k=1$.\n- If $N > 1$, the possible values are all $k$ such that $k \\le N+1$.\n-/", "formal_statement": "/- special open -/ open Finset\n/--\nA function `f : \u2115+ \u2192 \u2115+` is \"good\" if it satisfies the problem's inequality.\nNote the inequality is rearranged to use `\u2264` to align with Lean's conventions.\n-/\ndef goodPNat (f : \u2115+ \u2192 \u2115+) := \u2200 m n, f m + f (f n) \u2264 f (m + n) + 1\n\ntheorem imo_sl_2007_A2 {N k : \u2115+} :\n (\u2203 f : \u2115+ \u2192 \u2115+, goodPNat f \u2227 f N = k) \u2194 if N = 1 then k = 1 else k \u2264 N + 1 := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2007 A2\n\nA function $f : \\mathbb{N}^+ \\to \\mathbb{N}^+$ is called *good* if, for any positive integers $m, n$, the following inequality holds:\n$$ f(m + n) + 1 \\ge f(m) + f(f(n)). $$\nFor 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$.\n\nThe solution states that:\n- If $N=1$, the only possible value is $k=1$.\n- If $N > 1$, the possible values are all $k$ such that $k \\le N+1$.\n-/\n/- special open -/ open Finset\n/--\nA function `f : \u2115+ \u2192 \u2115+` is \"good\" if it satisfies the problem's inequality.\nNote the inequality is rearranged to use `\u2264` to align with Lean's conventions.\n-/\ndef goodPNat (f : \u2115+ \u2192 \u2115+) := \u2200 m n, f m + f (f n) \u2264 f (m + n) + 1\n\ntheorem imo_sl_2007_A2 {N k : \u2115+} :\n (\u2203 f : \u2115+ \u2192 \u2115+, goodPNat f \u2227 f N = k) \u2194 if N = 1 then k = 1 else k \u2264 N + 1 := by sorry", "category": "algebra"} {"name": "imo_sl_2007_A3", "problem_id": "2007_A3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2007 A3\n\nLet $F$ be a totally ordered field, and let $n$ be a positive integer.\nLet $x, y \\in F$ be positive elements such that $x^n + y^n = 1$.\nProve that\n$$ \\left(\\sum_{k = 1}^n \\frac{1 + x^{2k}}{1 + x^{4k}}\\right)\n \\left(\\sum_{k = 1}^n \\frac{1 + y^{2k}}{1 + y^{4k}}\\right)\n < \\frac{1}{(1 - x)(1 - y)}. $$\n-/", "formal_statement": "/- special open -/ open Finset\ntheorem imo_sl_2007_A3 [LinearOrderedField F] (n : Nat) {x y : F} (hx : 0 < x) (hy : 0 < y) (h : x ^ n + y ^ n = 1) :\n (range n).sum (\u03bb i \u21a6 (1 + x ^ (2 * i.succ)) / (1 + x ^ (4 * i.succ)))\n * (range n).sum (\u03bb i \u21a6 (1 + y ^ (2 * i.succ)) / (1 + y ^ (4 * i.succ)))\n < ((1 - x) * (1 - y))\u207b\u00b9 := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2007 A3\n\nLet $F$ be a totally ordered field, and let $n$ be a positive integer.\nLet $x, y \\in F$ be positive elements such that $x^n + y^n = 1$.\nProve that\n$$ \\left(\\sum_{k = 1}^n \\frac{1 + x^{2k}}{1 + x^{4k}}\\right)\n \\left(\\sum_{k = 1}^n \\frac{1 + y^{2k}}{1 + y^{4k}}\\right)\n < \\frac{1}{(1 - x)(1 - y)}. $$\n-/\n/- special open -/ open Finset\ntheorem imo_sl_2007_A3 [LinearOrderedField F] (n : Nat) {x y : F} (hx : 0 < x) (hy : 0 < y) (h : x ^ n + y ^ n = 1) :\n (range n).sum (\u03bb i \u21a6 (1 + x ^ (2 * i.succ)) / (1 + x ^ (4 * i.succ)))\n * (range n).sum (\u03bb i \u21a6 (1 + y ^ (2 * i.succ)) / (1 + y ^ (4 * i.succ)))\n < ((1 - x) * (1 - y))\u207b\u00b9 := by sorry", "category": "algebra"} {"name": "imo_sl_2007_A4", "problem_id": "2007_A4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2007 A4\n\nLet $G$ be a totally ordered abelian group and $G_{>0} = \\{x \\in G : x > 0\\}$.\nFind all functions $f : G_{>0} \\to G_{>0}$ such that for any $x, y \\in G_{>0}$,\n$$ f(x + f(y)) = f(x + y) + f(y). $$\n-/", "formal_statement": "variable [LinearOrderedAddCommGroup G]\n\n/--\nThis defines the property of a function `f` satisfying the given functional equation\non the subtype of positive elements `{x : G // 0 < x}`.\n-/\ndef IsGood (f : {x : G // 0 < x} \u2192 {x : G // 0 < x}) : Prop :=\n \u2200 x y, f (x + f y) = f (x + y) + f y\n\n/--\nThe solutions to the functional equation are functions that double the input.\n-/\ntheorem imo_sl_2007_A4 (f : {x : G // 0 < x} \u2192 {x : G // 0 < x}) :\n IsGood f \u2194 f = (fun x \u21a6 x + x) := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2007 A4\n\nLet $G$ be a totally ordered abelian group and $G_{>0} = \\{x \\in G : x > 0\\}$.\nFind all functions $f : G_{>0} \\to G_{>0}$ such that for any $x, y \\in G_{>0}$,\n$$ f(x + f(y)) = f(x + y) + f(y). $$\n-/\nvariable [LinearOrderedAddCommGroup G]\n\n/--\nThis defines the property of a function `f` satisfying the given functional equation\non the subtype of positive elements `{x : G // 0 < x}`.\n-/\ndef IsGood (f : {x : G // 0 < x} \u2192 {x : G // 0 < x}) : Prop :=\n \u2200 x y, f (x + f y) = f (x + y) + f y\n\n/--\nThe solutions to the functional equation are functions that double the input.\n-/\ntheorem imo_sl_2007_A4 (f : {x : G // 0 < x} \u2192 {x : G // 0 < x}) :\n IsGood f \u2194 f = (fun x \u21a6 x + x) := by sorry", "category": "algebra"} {"name": "imo_sl_2007_A6", "problem_id": "2007_A6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2007 A6\n\nLet $R$ be a totally ordered commutative ring and let $n \\ge 5$ be an integer.\nProve that for any sequence $a_1, a_2, \\dots, a_n \\in R$, the following inequality holds:\n$$ \\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 $$\nwhere the sum is cyclic, i.e., $a_{n+1} = a_1$.\n-/", "formal_statement": "/- special open -/ open Finset\ntheorem imo_sl_2007_A6 [LinearOrderedCommRing R] (n : \u2115) (hn : 5 \u2264 n) (a : Fin n \u2192 R) :\n (3 * \u2211 i, a i ^ 2 * a (finRotate n i)) ^ 2 \u2264 2 * (\u2211 i, a i ^ 2) ^ 3 := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2007 A6\n\nLet $R$ be a totally ordered commutative ring and let $n \\ge 5$ be an integer.\nProve that for any sequence $a_1, a_2, \\dots, a_n \\in R$, the following inequality holds:\n$$ \\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 $$\nwhere the sum is cyclic, i.e., $a_{n+1} = a_1$.\n-/\n/- special open -/ open Finset\ntheorem imo_sl_2007_A6 [LinearOrderedCommRing R] (n : \u2115) (hn : 5 \u2264 n) (a : Fin n \u2192 R) :\n (3 * \u2211 i, a i ^ 2 * a (finRotate n i)) ^ 2 \u2264 2 * (\u2211 i, a i ^ 2) ^ 3 := by sorry", "category": "algebra"} {"name": "imo_sl_2007_C3", "problem_id": "2007_C3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2007 C3\n\nFind all finite groups $G$ such that there exists a subset $S \\subseteq G$ for which\n the number of triples $(x, y, z) \\in S^3 \\cup (G \\setminus S)^3$ such that $xyz = 1$ is $2007$.\n-/", "formal_statement": "/- special open -/ open Finset\nvariable [Fintype G] [DecidableEq G] [Group G]\n\ndef tripleSet (S : Finset G) : Finset (Fin 3 \u2192 G) :=\n (Fintype.piFinset fun _ \u21a6 S) \u222a (Fintype.piFinset fun _ \u21a6 S\u1d9c)\n\ndef filtered_tripleSet (S : Finset G) : Finset (Fin 3 \u2192 G) :=\n (tripleSet S).filter fun p \u21a6 p 0 * p 1 * p 2 = 1\n\ntheorem imo_sl_2007_C3 :\n (\u2203 S : Finset G, (filtered_tripleSet S).card = 2007) \u2194\n Fintype.card G = 69 \u2228 Fintype.card G = 84 := by sorry", "split": "test", "tags": ["combinatorics"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2007 C3\n\nFind all finite groups $G$ such that there exists a subset $S \\subseteq G$ for which\n the number of triples $(x, y, z) \\in S^3 \\cup (G \\setminus S)^3$ such that $xyz = 1$ is $2007$.\n-/\n/- special open -/ open Finset\nvariable [Fintype G] [DecidableEq G] [Group G]\n\ndef tripleSet (S : Finset G) : Finset (Fin 3 \u2192 G) :=\n (Fintype.piFinset fun _ \u21a6 S) \u222a (Fintype.piFinset fun _ \u21a6 S\u1d9c)\n\ndef filtered_tripleSet (S : Finset G) : Finset (Fin 3 \u2192 G) :=\n (tripleSet S).filter fun p \u21a6 p 0 * p 1 * p 2 = 1\n\ntheorem imo_sl_2007_C3 :\n (\u2203 S : Finset G, (filtered_tripleSet S).card = 2007) \u2194\n Fintype.card G = 69 \u2228 Fintype.card G = 84 := by sorry", "category": "combinatorics"} {"name": "imo_sl_2007_N1", "problem_id": "2007_N1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2007 N1\n\nFind all pairs $(k, n) \\in \\mathbb{N}^2$ such that $7^k - 3^n \\mid k^4 + n^2$.\n-/", "formal_statement": "def good (k n : \u2115) : Prop := (7 : \u2124) ^ k - 3 ^ n \u2223 (k ^ 4 + n ^ 2 : \u2115)\n\ntheorem imo_sl_2007_N1 (k n : \u2115) :\n good k n \u2194 (k = 0 \u2227 n = 0) \u2228 (k = 2 \u2227 n = 4) := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2007 N1\n\nFind all pairs $(k, n) \\in \\mathbb{N}^2$ such that $7^k - 3^n \\mid k^4 + n^2$.\n-/\ndef good (k n : \u2115) : Prop := (7 : \u2124) ^ k - 3 ^ n \u2223 (k ^ 4 + n ^ 2 : \u2115)\n\ntheorem imo_sl_2007_N1 (k n : \u2115) :\n good k n \u2194 (k = 0 \u2227 n = 0) \u2228 (k = 2 \u2227 n = 4) := by sorry", "category": "number theory"} {"name": "imo_sl_2007_N2", "problem_id": "2007_N2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2007 N2\n\nFix integers $b > 0$ and $n \u2265 0$.\nSuppose that for each $k \u2208 \u2115^+$, there exists an integer $a$ such that $k \u2223 b - a^n$.\nProve that $b = A^n$ for some integer $A$.\n-/", "formal_statement": "/- special open -/ open Finset\ntheorem imo_sl_2007_N2 (h : 0 < b) (h0 : \u2200 k : \u2115, 0 < k \u2192 \u2203 c : \u2124, (k : \u2124) \u2223 b - c ^ n) :\n \u2203 a : \u2124, b = a ^ n := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2007 N2\n\nFix integers $b > 0$ and $n \u2265 0$.\nSuppose that for each $k \u2208 \u2115^+$, there exists an integer $a$ such that $k \u2223 b - a^n$.\nProve that $b = A^n$ for some integer $A$.\n-/\n/- special open -/ open Finset\ntheorem imo_sl_2007_N2 (h : 0 < b) (h0 : \u2200 k : \u2115, 0 < k \u2192 \u2203 c : \u2124, (k : \u2124) \u2223 b - c ^ n) :\n \u2203 a : \u2124, b = a ^ n := by sorry", "category": "number theory"} {"name": "imo_sl_2007_N6", "problem_id": "2007_N6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2007 N6 (P5)\n\nFix $n > 1$, and let $a$ and $b$ be positive integers such that $nab - 1 \u2223 (na^2 - 1)^2$.\nProve that $a = b$.\n-/", "formal_statement": "/- special open -/ open Finset\nabbrev bad_pair (n : \u2124) (a b : \u2115) := n * a * b - 1 \u2223 (n * a ^ 2 - 1) ^ 2\n\ntheorem imo_sl_2007_N6 (hn : 1 < n) (ha : 0 < a) (hb : 0 < b) (h : bad_pair n a b) :\n a = b := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2007 N6 (P5)\n\nFix $n > 1$, and let $a$ and $b$ be positive integers such that $nab - 1 \u2223 (na^2 - 1)^2$.\nProve that $a = b$.\n-/\n/- special open -/ open Finset\nabbrev bad_pair (n : \u2124) (a b : \u2115) := n * a * b - 1 \u2223 (n * a ^ 2 - 1) ^ 2\n\ntheorem imo_sl_2007_N6 (hn : 1 < n) (ha : 0 < a) (hb : 0 < b) (h : bad_pair n a b) :\n a = b := by sorry", "category": "number theory"} {"name": "imo_sl_2008_A1", "problem_id": "2008_A1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2008 A1 (P4)\n\nLet $R$ be a totally ordered commutative ring, and let $R_{>0} = \\{x \u2208 R : x > 0\\}$.\nFind all functions $f : R_{>0} \u2192 R_{>0}$ such that for any $p, q, r, s > 0$ with $pq = rs$,\n$$ (f(p)^2 + f(q)^2) (r^2 + s^2) = (p^2 + q^2) (f(r^2) + f(s^2)). $$\n-/", "formal_statement": "/- special open -/ open Finset\nstructure weakGood [OrderedSemiring R] (f : R \u2192 R) : Prop where\n map_pos_of_pos : \u2200 x > 0, f x > 0\n good' : \u2200 p > 0, \u2200 q > 0, \u2200 r > 0, \u2200 s > 0, p * q = r * s \u2192\n (f p ^ 2 + f q ^ 2) * (r ^ 2 + s ^ 2) = (p ^ 2 + q ^ 2) * (f (r ^ 2) + f (s ^ 2))\n\nvariable [LinearOrderedField R]\n\ndef good (f : {x : R // 0 < x} \u2192 {x : R // 0 < x}) :=\n \u2200 p q r s, p * q = r * s \u2192\n (f p ^ 2 + f q ^ 2) * (r ^ 2 + s ^ 2) = (p ^ 2 + q ^ 2) * (f (r ^ 2) + f (s ^ 2))\n\ntheorem imo_sl_2008_A1 [ExistsAddOfLE R] {f : {x : R // 0 < x} \u2192 {x : R // 0 < x}} :\n good f \u2194 f = id \u2228 \u2200 x, x * f x = 1 := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2008 A1 (P4)\n\nLet $R$ be a totally ordered commutative ring, and let $R_{>0} = \\{x \u2208 R : x > 0\\}$.\nFind all functions $f : R_{>0} \u2192 R_{>0}$ such that for any $p, q, r, s > 0$ with $pq = rs$,\n$$ (f(p)^2 + f(q)^2) (r^2 + s^2) = (p^2 + q^2) (f(r^2) + f(s^2)). $$\n-/\n/- special open -/ open Finset\nstructure weakGood [OrderedSemiring R] (f : R \u2192 R) : Prop where\n map_pos_of_pos : \u2200 x > 0, f x > 0\n good' : \u2200 p > 0, \u2200 q > 0, \u2200 r > 0, \u2200 s > 0, p * q = r * s \u2192\n (f p ^ 2 + f q ^ 2) * (r ^ 2 + s ^ 2) = (p ^ 2 + q ^ 2) * (f (r ^ 2) + f (s ^ 2))\n\nvariable [LinearOrderedField R]\n\ndef good (f : {x : R // 0 < x} \u2192 {x : R // 0 < x}) :=\n \u2200 p q r s, p * q = r * s \u2192\n (f p ^ 2 + f q ^ 2) * (r ^ 2 + s ^ 2) = (p ^ 2 + q ^ 2) * (f (r ^ 2) + f (s ^ 2))\n\ntheorem imo_sl_2008_A1 [ExistsAddOfLE R] {f : {x : R // 0 < x} \u2192 {x : R // 0 < x}} :\n good f \u2194 f = id \u2228 \u2200 x, x * f x = 1 := by sorry", "category": "algebra"} {"name": "imo_sl_2008_A2a", "problem_id": "2008_A2a", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2008 A2\n\n1. Let $F$ be an ordered field, and consider $x, y, z \\in F \\setminus \\{1\\}$ with $xyz = 1$.\nProve that $$ \\frac{x^2}{(x - 1)^2} + \\frac{y^2}{(y - 1)^2} + \\frac{z^2}{(z - 1)^2} \\ge 1. $$\n\n-/", "formal_statement": "theorem imo_sl_2008_A2a_part1 [LinearOrderedField F]\n {x y z : F} (hx : x \u2260 1) (hy : y \u2260 1) (hz : z \u2260 1) (h : x * y * z = 1) :\n 1 \u2264 (x / (x - 1)) ^ 2 + (y / (y - 1)) ^ 2 + (z / (z - 1)) ^ 2 := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2008 A2\n\n1. Let $F$ be an ordered field, and consider $x, y, z \\in F \\setminus \\{1\\}$ with $xyz = 1$.\nProve that $$ \\frac{x^2}{(x - 1)^2} + \\frac{y^2}{(y - 1)^2} + \\frac{z^2}{(z - 1)^2} \\ge 1. $$\n\n-/\ntheorem imo_sl_2008_A2a_part1 [LinearOrderedField F]\n {x y z : F} (hx : x \u2260 1) (hy : y \u2260 1) (hz : z \u2260 1) (h : x * y * z = 1) :\n 1 \u2264 (x / (x - 1)) ^ 2 + (y / (y - 1)) ^ 2 + (z / (z - 1)) ^ 2 := by sorry", "category": "algebra"} {"name": "imo_sl_2008_A2b", "problem_id": "2008_A2b", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2008 A2\n\n2. Show that there exists infinitely many triplets $(x, y, z) \\in (\\mathbb{Q} \\setminus \\{1\\})^3$\n with $xyz = 1$ such that the above inequality becomes equality.\n-/", "formal_statement": "structure IsGood (p : Fin 3 \u2192 \u211a) : Prop where\n p_ne_one : \u2200 i, p i \u2260 1\n p_mul_eq_one : p 0 * p 1 * p 2 = 1\n spec : (p 0 / (p 0 - 1)) ^ 2 + (p 1 / (p 1 - 1)) ^ 2 + (p 2 / (p 2 - 1)) ^ 2 = 1\n\ntheorem imo_sl_2008_A2b_part2 : {p : Fin 3 \u2192 \u211a | IsGood p}.Infinite := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2008 A2\n\n2. Show that there exists infinitely many triplets $(x, y, z) \\in (\\mathbb{Q} \\setminus \\{1\\})^3$\n with $xyz = 1$ such that the above inequality becomes equality.\n-/\nstructure IsGood (p : Fin 3 \u2192 \u211a) : Prop where\n p_ne_one : \u2200 i, p i \u2260 1\n p_mul_eq_one : p 0 * p 1 * p 2 = 1\n spec : (p 0 / (p 0 - 1)) ^ 2 + (p 1 / (p 1 - 1)) ^ 2 + (p 2 / (p 2 - 1)) ^ 2 = 1\n\ntheorem imo_sl_2008_A2b_part2 : {p : Fin 3 \u2192 \u211a | IsGood p}.Infinite := by sorry", "category": "algebra"} {"name": "imo_sl_2008_A3a", "problem_id": "2008_A3a", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2008 A3\n\nLet $\u03b1$ be a totally ordered type.\nA **Spanish couple** on $\u03b1$ is a pair of strictly increasing functions $(f, g)$\nfrom $\u03b1$ to itself such that for all $x \\in \u03b1$, $f(g(g(x))) < g(f(x))$.\n\nDetermine whether there exists a Spanish couple on:\n1. The set of natural numbers $\u2115$.\n-/", "formal_statement": "structure SpanishCouple [Preorder \u03b1] (f g : \u03b1 \u2192 \u03b1) : Prop where\n f_mono : StrictMono f\n g_mono : StrictMono g\n spec : f \u2218 g \u2218 g < g \u2218 f\n\ntheorem imo_sl_2008_A3a_part1 : \u00ac \u2203 f g : \u2115 \u2192 \u2115, SpanishCouple f g := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2008 A3\n\nLet $\u03b1$ be a totally ordered type.\nA **Spanish couple** on $\u03b1$ is a pair of strictly increasing functions $(f, g)$\nfrom $\u03b1$ to itself such that for all $x \\in \u03b1$, $f(g(g(x))) < g(f(x))$.\n\nDetermine whether there exists a Spanish couple on:\n1. The set of natural numbers $\u2115$.\n-/\nstructure SpanishCouple [Preorder \u03b1] (f g : \u03b1 \u2192 \u03b1) : Prop where\n f_mono : StrictMono f\n g_mono : StrictMono g\n spec : f \u2218 g \u2218 g < g \u2218 f\n\ntheorem imo_sl_2008_A3a_part1 : \u00ac \u2203 f g : \u2115 \u2192 \u2115, SpanishCouple f g := by sorry", "category": "algebra"} {"name": "imo_sl_2008_A3b", "problem_id": "2008_A3b", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2008 A3\n\nLet $\u03b1$ be a totally ordered type.\nA **Spanish couple** on $\u03b1$ is a pair of strictly increasing functions $(f, g)$\nfrom $\u03b1$ to itself such that for all $x \\in \u03b1$, $f(g(g(x))) < g(f(x))$.\n\nDetermine whether there exists a Spanish couple on:\n2. The set $\u2115 \\times \u2115$ with the lexicographical order.\n-/", "formal_statement": "structure SpanishCouple [Preorder \u03b1] (f g : \u03b1 \u2192 \u03b1) : Prop where\n f_mono : StrictMono f\n g_mono : StrictMono g\n spec : f \u2218 g \u2218 g < g \u2218 f\n\ntheorem imo_sl_2008_A3b_part2 : \u2203 f g : (\u2115 \u00d7\u2097 \u2115) \u2192 (\u2115 \u00d7\u2097 \u2115), SpanishCouple f g := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2008 A3\n\nLet $\u03b1$ be a totally ordered type.\nA **Spanish couple** on $\u03b1$ is a pair of strictly increasing functions $(f, g)$\nfrom $\u03b1$ to itself such that for all $x \\in \u03b1$, $f(g(g(x))) < g(f(x))$.\n\nDetermine whether there exists a Spanish couple on:\n2. The set $\u2115 \\times \u2115$ with the lexicographical order.\n-/\nstructure SpanishCouple [Preorder \u03b1] (f g : \u03b1 \u2192 \u03b1) : Prop where\n f_mono : StrictMono f\n g_mono : StrictMono g\n spec : f \u2218 g \u2218 g < g \u2218 f\n\ntheorem imo_sl_2008_A3b_part2 : \u2203 f g : (\u2115 \u00d7\u2097 \u2115) \u2192 (\u2115 \u00d7\u2097 \u2115), SpanishCouple f g := by sorry", "category": "algebra"} {"name": "imo_sl_2008_A5", "problem_id": "2008_A5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2008 A5\n\nLet $F$ be a totally ordered field and $a_1, a_2, a_3, a_4 \\in F$ be positive elements.\nSuppose that $a_1 a_2 a_3 a_4 = 1$ and\n$$ \\sum_{i = 1}^4 \\frac{a_i}{a_{i + 1}} < \\sum_{i = 1}^4 a_i. $$\nProve that\n$$ \\sum_{i = 1}^4 a_i < \\sum_{i = 1}^4 \\frac{a_{i + 1}}{a_i}. $$\n-/", "formal_statement": "theorem imo_sl_2008_A5 [LinearOrderedField F]\n {a b c d : F} (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) (hd : 0 < d)\n (h_prod : a * b * c * d = 1)\n (h_ineq : a / b + b / c + c / d + d / a < a + b + c + d) :\n a + b + c + d < b / a + c / b + d / c + a / d := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2008 A5\n\nLet $F$ be a totally ordered field and $a_1, a_2, a_3, a_4 \\in F$ be positive elements.\nSuppose that $a_1 a_2 a_3 a_4 = 1$ and\n$$ \\sum_{i = 1}^4 \\frac{a_i}{a_{i + 1}} < \\sum_{i = 1}^4 a_i. $$\nProve that\n$$ \\sum_{i = 1}^4 a_i < \\sum_{i = 1}^4 \\frac{a_{i + 1}}{a_i}. $$\n-/\ntheorem imo_sl_2008_A5 [LinearOrderedField F]\n {a b c d : F} (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) (hd : 0 < d)\n (h_prod : a * b * c * d = 1)\n (h_ineq : a / b + b / c + c / d + d / a < a + b + c + d) :\n a + b + c + d < b / a + c / b + d / c + a / d := by sorry", "category": "algebra"} {"name": "imo_sl_2008_A7", "problem_id": "2008_A7", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2008 A7\n\nLet $F$ be a totally ordered field.\n1. Prove that, for any $a, b, c, d \\in F$ positive,\n$$ \\frac{(a - b)(a - c)}{a + b + c} + \\frac{(b - c)(b - d)}{b + c + d} +\n \\frac{(c - d)(c - a)}{c + d + a} + \\frac{(d - a)(d - b)}{d + a + b} \\ge 0. $$\n2. Find all cases of equality.\n-/", "formal_statement": "theorem imo_sl_2008_A7 [LinearOrderedField F]\n {a b c d : F} (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) (hd : 0 < d) :\n (0 \u2264 (a - b) * (a - c) / (a + b + c) + (b - c) * (b - d) / (b + c + d) +\n (c - d) * (c - a) / (c + d + a) + (d - a) * (d - b) / (d + a + b)) \u2227\n ((a - b) * (a - c) / (a + b + c) + (b - c) * (b - d) / (b + c + d) +\n (c - d) * (c - a) / (c + d + a) + (d - a) * (d - b) / (d + a + b) = 0 \u2194\n a = c \u2227 b = d) := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2008 A7\n\nLet $F$ be a totally ordered field.\n1. Prove that, for any $a, b, c, d \\in F$ positive,\n$$ \\frac{(a - b)(a - c)}{a + b + c} + \\frac{(b - c)(b - d)}{b + c + d} +\n \\frac{(c - d)(c - a)}{c + d + a} + \\frac{(d - a)(d - b)}{d + a + b} \\ge 0. $$\n2. Find all cases of equality.\n-/\ntheorem imo_sl_2008_A7 [LinearOrderedField F]\n {a b c d : F} (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) (hd : 0 < d) :\n (0 \u2264 (a - b) * (a - c) / (a + b + c) + (b - c) * (b - d) / (b + c + d) +\n (c - d) * (c - a) / (c + d + a) + (d - a) * (d - b) / (d + a + b)) \u2227\n ((a - b) * (a - c) / (a + b + c) + (b - c) * (b - d) / (b + c + d) +\n (c - d) * (c - a) / (c + d + a) + (d - a) * (d - b) / (d + a + b) = 0 \u2194\n a = c \u2227 b = d) := by sorry", "category": "algebra"} {"name": "imo_sl_2008_C4", "problem_id": "2008_C4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2008 C4\n\nLet $n$ and $d$ be positive integers. Consider $2n$ lamps labelled with a pair $(b, m)$ where\n$b \\in \\{0, 1\\}$ and $m \\in \\{0, 1, \\ldots, n - 1\\}$. Initially, all the lamps are off.\n\nConsider sequences of $k = 2d + n$ steps, where at each step, one of the lamps is switched\n(off to on and vice versa).\n\nLet $S_N$ be the set of $k$-step sequences ending in a state where the lamps labelled $(b, m)$\nare on if and only if $b = 0$.\n\nLet $S_M \\subseteq S_N$ consist of the sequences that do not touch the lamps labelled\n$(0, m)$ at all.\n\nFind the ratio $|S_N|/|S_M|$.\n-/", "formal_statement": "/- special open -/ open Finset\nvariable (I \u039b : Type) [Fintype I] [Fintype \u039b]\n\ndef IsNSequence [DecidableEq I] [DecidableEq \u039b] (f : I \u2192 Fin 2 \u00d7 \u039b) : Prop :=\n \u2200 p : Fin 2 \u00d7 \u039b, (univ.filter (f \u00b7 = p)).card % 2 = p.1.val\n\nnoncomputable instance IsNSequence.instDecidablePred [DecidableEq I] [DecidableEq \u039b] :\n DecidablePred (IsNSequence I \u039b) := by\n unfold IsNSequence; infer_instance\n\ndef IsMSequence [DecidableEq I] [DecidableEq \u039b] (f : I \u2192 \u039b) : Prop :=\n \u2200 l : \u039b, (univ.filter (f \u00b7 = l)).card % 2 = 1\n\nnoncomputable instance IsMSequence.instDecidablePred [DecidableEq I] [DecidableEq \u039b] :\n DecidablePred (IsMSequence I \u039b) := by\n unfold IsMSequence; infer_instance\n\ntheorem imo_sl_2008_C4 [DecidableEq I] [DecidableEq \u039b] :\n Fintype.card { f : I \u2192 Fin 2 \u00d7 \u039b // IsNSequence I \u039b f } =\n 2 ^ (Fintype.card I - Fintype.card \u039b) * Fintype.card { f : I \u2192 \u039b // IsMSequence I \u039b f } := by sorry", "split": "test", "tags": ["combinatorics"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2008 C4\n\nLet $n$ and $d$ be positive integers. Consider $2n$ lamps labelled with a pair $(b, m)$ where\n$b \\in \\{0, 1\\}$ and $m \\in \\{0, 1, \\ldots, n - 1\\}$. Initially, all the lamps are off.\n\nConsider sequences of $k = 2d + n$ steps, where at each step, one of the lamps is switched\n(off to on and vice versa).\n\nLet $S_N$ be the set of $k$-step sequences ending in a state where the lamps labelled $(b, m)$\nare on if and only if $b = 0$.\n\nLet $S_M \\subseteq S_N$ consist of the sequences that do not touch the lamps labelled\n$(0, m)$ at all.\n\nFind the ratio $|S_N|/|S_M|$.\n-/\n/- special open -/ open Finset\nvariable (I \u039b : Type) [Fintype I] [Fintype \u039b]\n\ndef IsNSequence [DecidableEq I] [DecidableEq \u039b] (f : I \u2192 Fin 2 \u00d7 \u039b) : Prop :=\n \u2200 p : Fin 2 \u00d7 \u039b, (univ.filter (f \u00b7 = p)).card % 2 = p.1.val\n\nnoncomputable instance IsNSequence.instDecidablePred [DecidableEq I] [DecidableEq \u039b] :\n DecidablePred (IsNSequence I \u039b) := by\n unfold IsNSequence; infer_instance\n\ndef IsMSequence [DecidableEq I] [DecidableEq \u039b] (f : I \u2192 \u039b) : Prop :=\n \u2200 l : \u039b, (univ.filter (f \u00b7 = l)).card % 2 = 1\n\nnoncomputable instance IsMSequence.instDecidablePred [DecidableEq I] [DecidableEq \u039b] :\n DecidablePred (IsMSequence I \u039b) := by\n unfold IsMSequence; infer_instance\n\ntheorem imo_sl_2008_C4 [DecidableEq I] [DecidableEq \u039b] :\n Fintype.card { f : I \u2192 Fin 2 \u00d7 \u039b // IsNSequence I \u039b f } =\n 2 ^ (Fintype.card I - Fintype.card \u039b) * Fintype.card { f : I \u2192 \u039b // IsMSequence I \u039b f } := by sorry", "category": "combinatorics"} {"name": "imo_sl_2009_A2", "problem_id": "2009_A2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2009 A2\n\nLet $F$ be a totally ordered field, and let $a, b, c \\in F$ be positive elements.\nProve that\n$$ \\frac{1}{(2a + b + c)^2} + \\frac{1}{(2b + c + a)^2} + \\frac{1}{(2c + a + b)^2}\n \\le \\frac{3}{16(ab+bc+ca)}. $$\n-/", "formal_statement": "theorem imo_sl_2009_A2 [LinearOrderedField F]\n {a b c : F} (ha : 0 < a) (hb : 0 < b) (hc : 0 < c)\n (h_norm : a\u207b\u00b9 + b\u207b\u00b9 + c\u207b\u00b9 = a + b + c) :\n ((2 * a + b + c) ^ 2)\u207b\u00b9 + ((2 * b + c + a) ^ 2)\u207b\u00b9 + ((2 * c + a + b) ^ 2)\u207b\u00b9 \u2264 3 / 16 := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2009 A2\n\nLet $F$ be a totally ordered field, and let $a, b, c \\in F$ be positive elements.\nProve that\n$$ \\frac{1}{(2a + b + c)^2} + \\frac{1}{(2b + c + a)^2} + \\frac{1}{(2c + a + b)^2}\n \\le \\frac{3}{16(ab+bc+ca)}. $$\n-/\ntheorem imo_sl_2009_A2 [LinearOrderedField F]\n {a b c : F} (ha : 0 < a) (hb : 0 < b) (hc : 0 < c)\n (h_norm : a\u207b\u00b9 + b\u207b\u00b9 + c\u207b\u00b9 = a + b + c) :\n ((2 * a + b + c) ^ 2)\u207b\u00b9 + ((2 * b + c + a) ^ 2)\u207b\u00b9 + ((2 * c + a + b) ^ 2)\u207b\u00b9 \u2264 3 / 16 := by sorry", "category": "algebra"} {"name": "imo_sl_2009_A3a", "problem_id": "2009_A3a", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2009 A3\n\nFind all functions $f : \\mathbb{N} \\to \\mathbb{N}$ such that for any $x, y \\in \\mathbb{N}$, the numbers\n$x$, $f(y)$, and $f(y + f(x))$ form the sides of a possibly degenerate triangle.\n\n-/", "formal_statement": "structure IsNatTriangle (x y z : \u2115) : Prop where\n side_x : x \u2264 y + z\n side_y : y \u2264 z + x\n side_z : z \u2264 x + y\n\ndef IsGoodNat (f : \u2115 \u2192 \u2115) : Prop :=\n \u2200 x y, IsNatTriangle x (f y) (f (y + f x))\n\ntheorem imo_sl_2009_A3a_nat (f : \u2115 \u2192 \u2115) : IsGoodNat f \u2194 f = id := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2009 A3\n\nFind all functions $f : \\mathbb{N} \\to \\mathbb{N}$ such that for any $x, y \\in \\mathbb{N}$, the numbers\n$x$, $f(y)$, and $f(y + f(x))$ form the sides of a possibly degenerate triangle.\n\n-/\nstructure IsNatTriangle (x y z : \u2115) : Prop where\n side_x : x \u2264 y + z\n side_y : y \u2264 z + x\n side_z : z \u2264 x + y\n\ndef IsGoodNat (f : \u2115 \u2192 \u2115) : Prop :=\n \u2200 x y, IsNatTriangle x (f y) (f (y + f x))\n\ntheorem imo_sl_2009_A3a_nat (f : \u2115 \u2192 \u2115) : IsGoodNat f \u2194 f = id := by sorry", "category": "algebra"} {"name": "imo_sl_2009_A3b", "problem_id": "2009_A3b", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2009 A3\n\nThe original problem statement. Find all functions $f : \\mathbb{N}^+ \\to \\mathbb{N}^+$ such that for any\n$x, y \\in \\mathbb{N}^+$, the numbers $x$, $f(y)$, and $f(y + f(x) - 1)$ form the sides of a\nnon-degenerate triangle.\n-/", "formal_statement": "structure IsPNatTriangle (x y z : \u2115+) : Prop where\n side_x : x < y + z\n side_y : y < z + x\n side_z : z < x + y\n\ndef IsGoodPNat (f : \u2115+ \u2192 \u2115+) : Prop :=\n \u2200 x y, IsPNatTriangle x (f y) (f (y + f x - 1))\n\ntheorem imo_sl_2009_A3b_pnat (f : \u2115+ \u2192 \u2115+) : IsGoodPNat f \u2194 f = id := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2009 A3\n\nThe original problem statement. Find all functions $f : \\mathbb{N}^+ \\to \\mathbb{N}^+$ such that for any\n$x, y \\in \\mathbb{N}^+$, the numbers $x$, $f(y)$, and $f(y + f(x) - 1)$ form the sides of a\nnon-degenerate triangle.\n-/\nstructure IsPNatTriangle (x y z : \u2115+) : Prop where\n side_x : x < y + z\n side_y : y < z + x\n side_z : z < x + y\n\ndef IsGoodPNat (f : \u2115+ \u2192 \u2115+) : Prop :=\n \u2200 x y, IsPNatTriangle x (f y) (f (y + f x - 1))\n\ntheorem imo_sl_2009_A3b_pnat (f : \u2115+ \u2192 \u2115+) : IsGoodPNat f \u2194 f = id := by sorry", "category": "algebra"} {"name": "imo_sl_2009_A5", "problem_id": "2009_A5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2009 A5\n\nLet $R$ be a totally ordered ring.\nProve that there does not exist a function $f : R \u2192 R$ such that for all $x, y \u2208 R$,\n$$ f(x - f(y)) \u2264 y f(x) + x. $$\n-/", "formal_statement": "theorem imo_sl_2009_A5 [LinearOrderedRing R] (f : R \u2192 R) :\n \u00ac\u2200 x y, f (x - f y) \u2264 y * f x + x := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2009 A5\n\nLet $R$ be a totally ordered ring.\nProve that there does not exist a function $f : R \u2192 R$ such that for all $x, y \u2208 R$,\n$$ f(x - f(y)) \u2264 y f(x) + x. $$\n-/\ntheorem imo_sl_2009_A5 [LinearOrderedRing R] (f : R \u2192 R) :\n \u00ac\u2200 x y, f (x - f y) \u2264 y * f x + x := by sorry", "category": "algebra"} {"name": "imo_sl_2009_A6", "problem_id": "2009_A6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2009 A6 (P3)\n\nLet $f : \u2115 \u2192 \u2115$ be a strictly increasing function.\nSuppose that there exists $A, B, C, D \u2208 \u2115$ such that\n $f(f(n)) = An + B$ and $f(f(n) + 1) = Cn + D$ for any $n \u2208 \u2115$.\nProve that there exists $M, N \u2208 \u2115$ such that $f(n) = Mn + N$ for all $n \u2208 \u2115$.\n-/", "formal_statement": "theorem imo_sl_2009_A6 {f : \u2115 \u2192 \u2115} (hf : StrictMono f)\n (h : \u2203 A B, \u2200 n, f (f n) = A * n + B) (h0 : \u2203 C D, \u2200 n, f (f n + 1) = C * n + D) :\n \u2203 M N, \u2200 n, f n = M * n + N := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2009 A6 (P3)\n\nLet $f : \u2115 \u2192 \u2115$ be a strictly increasing function.\nSuppose that there exists $A, B, C, D \u2208 \u2115$ such that\n $f(f(n)) = An + B$ and $f(f(n) + 1) = Cn + D$ for any $n \u2208 \u2115$.\nProve that there exists $M, N \u2208 \u2115$ such that $f(n) = Mn + N$ for all $n \u2208 \u2115$.\n-/\ntheorem imo_sl_2009_A6 {f : \u2115 \u2192 \u2115} (hf : StrictMono f)\n (h : \u2203 A B, \u2200 n, f (f n) = A * n + B) (h0 : \u2203 C D, \u2200 n, f (f n + 1) = C * n + D) :\n \u2203 M N, \u2200 n, f n = M * n + N := by sorry", "category": "algebra"} {"name": "imo_sl_2009_A7", "problem_id": "2009_A7", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2009 A7\n\nFix a domain $R$ (a ring with no zero divisors).\nFind all functions $f : R \\to R$ such that for all $x, y \\in R$,\n$$ f(x f(x + y)) = f(y f(x)) + x^2. $$\n\n**Note:** There appears to be a typo in the provided formalization's statement\nof the problem. The term `f(f(x) y)` from the source code has been changed to `f(y f(x))`\nto match the official problem statement.\n-/", "formal_statement": "variable [Ring R]\n\ndef IsGood (f : R \u2192 R) : Prop :=\n \u2200 x y, f (x * f (x + y)) = f (y * f x) + x ^ 2\n\ntheorem imo_sl_2009_A7 [NoZeroDivisors R] (f : R \u2192 R) :\n IsGood f \u2194 f = id \u2228 f = neg := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2009 A7\n\nFix a domain $R$ (a ring with no zero divisors).\nFind all functions $f : R \\to R$ such that for all $x, y \\in R$,\n$$ f(x f(x + y)) = f(y f(x)) + x^2. $$\n\n**Note:** There appears to be a typo in the provided formalization's statement\nof the problem. The term `f(f(x) y)` from the source code has been changed to `f(y f(x))`\nto match the official problem statement.\n-/\nvariable [Ring R]\n\ndef IsGood (f : R \u2192 R) : Prop :=\n \u2200 x y, f (x * f (x + y)) = f (y * f x) + x ^ 2\n\ntheorem imo_sl_2009_A7 [NoZeroDivisors R] (f : R \u2192 R) :\n IsGood f \u2194 f = id \u2228 f = neg := by sorry", "category": "algebra"} {"name": "imo_sl_2009_C1a", "problem_id": "2009_C1a", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2009 C1\n\nFix non-negative integers $M$ and $n$.\nTwo players, $A$ and $B$, play the following game on the board.\nThe board consists of $M$ cards in a row, one side labelled $0$ and another side labelled $1$.\n\nInitially, all cards are labelled $1$.\nThen $A$ and $B$ take turns performing a move of the following form.\nChoose an index $i \u2208 \u2115$ such that $i + n < M$ and the $(i + n)^{\\text{th}}$ card shows $1$.\nThen flip the $j^{\\text{th}}$ card for any $i \u2264 j \u2264 i + n$.\nThe last player who can make a legal move wins.\n\nAssume that $A$ and $B$ uses the best strategy.\n1. Show that the game always ends.\n-/", "formal_statement": "/- special open -/ open Relation Finset\nstructure GameState (n : \u2115) where\n board : Finset \u2115\n numMoves : \u2115\n\nnamespace GameState\n\ndef init (M n : \u2115) : GameState n where\n board := range M\n numMoves := 0\n\ninductive ValidMove (X : GameState n) : GameState n \u2192 Prop\n | flip (i : \u2115) (h : i + n \u2208 X.board) :\n ValidMove X \u27e8symmDiff X.board (Icc i (i + n)), X.numMoves.succ\u27e9\n\ndef IsReachable : GameState n \u2192 GameState n \u2192 Prop := ReflTransGen ValidMove\n\ndef Ends (X : GameState n) := \u2200 Y : GameState n, \u00acX.ValidMove Y\n\ndef P1Wins {X : GameState n} (_ : X.Ends) : Prop := X.numMoves % 2 = 1\n\ntheorem imo_sl_2009_C1a_part1 {M n : \u2115} {X : GameState n} (h : (init M n).IsReachable X) :\n X.numMoves < 2 ^ M := by sorry", "split": "test", "tags": ["combinatorics"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2009 C1\n\nFix non-negative integers $M$ and $n$.\nTwo players, $A$ and $B$, play the following game on the board.\nThe board consists of $M$ cards in a row, one side labelled $0$ and another side labelled $1$.\n\nInitially, all cards are labelled $1$.\nThen $A$ and $B$ take turns performing a move of the following form.\nChoose an index $i \u2208 \u2115$ such that $i + n < M$ and the $(i + n)^{\\text{th}}$ card shows $1$.\nThen flip the $j^{\\text{th}}$ card for any $i \u2264 j \u2264 i + n$.\nThe last player who can make a legal move wins.\n\nAssume that $A$ and $B$ uses the best strategy.\n1. Show that the game always ends.\n-/\n/- special open -/ open Relation Finset\nstructure GameState (n : \u2115) where\n board : Finset \u2115\n numMoves : \u2115\n\nnamespace GameState\n\ndef init (M n : \u2115) : GameState n where\n board := range M\n numMoves := 0\n\ninductive ValidMove (X : GameState n) : GameState n \u2192 Prop\n | flip (i : \u2115) (h : i + n \u2208 X.board) :\n ValidMove X \u27e8symmDiff X.board (Icc i (i + n)), X.numMoves.succ\u27e9\n\ndef IsReachable : GameState n \u2192 GameState n \u2192 Prop := ReflTransGen ValidMove\n\ndef Ends (X : GameState n) := \u2200 Y : GameState n, \u00acX.ValidMove Y\n\ndef P1Wins {X : GameState n} (_ : X.Ends) : Prop := X.numMoves % 2 = 1\n\ntheorem imo_sl_2009_C1a_part1 {M n : \u2115} {X : GameState n} (h : (init M n).IsReachable X) :\n X.numMoves < 2 ^ M := by sorry", "category": "combinatorics"} {"name": "imo_sl_2009_C1b", "problem_id": "2009_C1b", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2009 C1\n\nFix non-negative integers $M$ and $n$.\nTwo players, $A$ and $B$, play the following game on the board.\nThe board consists of $M$ cards in a row, one side labelled $0$ and another side labelled $1$.\n\nInitially, all cards are labelled $1$.\nThen $A$ and $B$ take turns performing a move of the following form.\nChoose an index $i \u2208 \u2115$ such that $i + n < M$ and the $(i + n)^{\\text{th}}$ card shows $1$.\nThen flip the $j^{\\text{th}}$ card for any $i \u2264 j \u2264 i + n$.\nThe last player who can make a legal move wins.\n\nAssume that $A$ and $B$ uses the best strategy.\n2. Determine the outcome of the game.\n-/", "formal_statement": "/- special open -/ open Relation Finset\nstructure GameState (n : \u2115) where\n board : Finset \u2115\n numMoves : \u2115\n\nnamespace GameState\n\ndef init (M n : \u2115) : GameState n where\n board := range M\n numMoves := 0\n\ninductive ValidMove (X : GameState n) : GameState n \u2192 Prop\n | flip (i : \u2115) (h : i + n \u2208 X.board) :\n ValidMove X \u27e8symmDiff X.board (Icc i (i + n)), X.numMoves.succ\u27e9\n\ndef IsReachable : GameState n \u2192 GameState n \u2192 Prop := ReflTransGen ValidMove\n\ndef Ends (X : GameState n) := \u2200 Y : GameState n, \u00acX.ValidMove Y\n\ndef P1Wins {X : GameState n} (_ : X.Ends) : Prop := X.numMoves % 2 = 1\n\ntheorem imo_sl_2009_C1b_part2 {M n : \u2115} {X : GameState n}\n (h : (init M n).IsReachable X) (h0 : X.Ends) :\n P1Wins h0 \u2194 M / n.succ % 2 = 1 := by sorry", "split": "test", "tags": ["combinatorics"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2009 C1\n\nFix non-negative integers $M$ and $n$.\nTwo players, $A$ and $B$, play the following game on the board.\nThe board consists of $M$ cards in a row, one side labelled $0$ and another side labelled $1$.\n\nInitially, all cards are labelled $1$.\nThen $A$ and $B$ take turns performing a move of the following form.\nChoose an index $i \u2208 \u2115$ such that $i + n < M$ and the $(i + n)^{\\text{th}}$ card shows $1$.\nThen flip the $j^{\\text{th}}$ card for any $i \u2264 j \u2264 i + n$.\nThe last player who can make a legal move wins.\n\nAssume that $A$ and $B$ uses the best strategy.\n2. Determine the outcome of the game.\n-/\n/- special open -/ open Relation Finset\nstructure GameState (n : \u2115) where\n board : Finset \u2115\n numMoves : \u2115\n\nnamespace GameState\n\ndef init (M n : \u2115) : GameState n where\n board := range M\n numMoves := 0\n\ninductive ValidMove (X : GameState n) : GameState n \u2192 Prop\n | flip (i : \u2115) (h : i + n \u2208 X.board) :\n ValidMove X \u27e8symmDiff X.board (Icc i (i + n)), X.numMoves.succ\u27e9\n\ndef IsReachable : GameState n \u2192 GameState n \u2192 Prop := ReflTransGen ValidMove\n\ndef Ends (X : GameState n) := \u2200 Y : GameState n, \u00acX.ValidMove Y\n\ndef P1Wins {X : GameState n} (_ : X.Ends) : Prop := X.numMoves % 2 = 1\n\ntheorem imo_sl_2009_C1b_part2 {M n : \u2115} {X : GameState n}\n (h : (init M n).IsReachable X) (h0 : X.Ends) :\n P1Wins h0 \u2194 M / n.succ % 2 = 1 := by sorry", "category": "combinatorics"} {"name": "imo_sl_2009_C2", "problem_id": "2009_C2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2009 C2\n\nFor each $n \u2208 \u2115$, find the largest integer $k$ such that the following holds:\n there exists injective functions $a_1, a_2, a_3 : [k] \u2192 \u2115$ such that\n $a_1(i) + a_2(i) + a_3(i) = n$ for all $i \u2208 [k]$.\n-/", "formal_statement": "/- special open -/ open Finset\nstructure GoodTripleFn (n : \u2115) (\u03b9 : Type*) where\n toFun : Fin 3 \u2192 \u03b9 \u2192 \u2115\n toFun_inj : \u2200 j, (toFun j).Injective\n toFun_sum : \u2200 i, \u2211 j : Fin 3, toFun j i = n\n\n/-- Final solution -/\ntheorem imo_sl_2009_C2 [Fintype \u03b9] :\n Nonempty (GoodTripleFn n \u03b9) \u2194 Fintype.card \u03b9 \u2264 2 * n / 3 + 1 := by sorry", "split": "test", "tags": ["combinatorics"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2009 C2\n\nFor each $n \u2208 \u2115$, find the largest integer $k$ such that the following holds:\n there exists injective functions $a_1, a_2, a_3 : [k] \u2192 \u2115$ such that\n $a_1(i) + a_2(i) + a_3(i) = n$ for all $i \u2208 [k]$.\n-/\n/- special open -/ open Finset\nstructure GoodTripleFn (n : \u2115) (\u03b9 : Type*) where\n toFun : Fin 3 \u2192 \u03b9 \u2192 \u2115\n toFun_inj : \u2200 j, (toFun j).Injective\n toFun_sum : \u2200 i, \u2211 j : Fin 3, toFun j i = n\n\n/-- Final solution -/\ntheorem imo_sl_2009_C2 [Fintype \u03b9] :\n Nonempty (GoodTripleFn n \u03b9) \u2194 Fintype.card \u03b9 \u2264 2 * n / 3 + 1 := by sorry", "category": "combinatorics"} {"name": "imo_sl_2009_C3", "problem_id": "2009_C3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2009 C3\n\nLet $\\{0, 1\\}^*$ denote the set of finite-length binary words with letters $0$ and $1$.\nLet $\u03b5$ denote the empty word.\n\nDefine the function $f : \\{0, 1\\}^* \u2192 \u2115$ recursively by $f(\u03b5) = 1$, $f(0) = f(1) = 7$, and\n$$ f(wa0) = 2 f(wa) + 3 f(w) \\quad \\text{and} \\quad f(wa1) = 3 f(wa) + f(w). $$\nFix a word $w \u2208 L$, and let $w'$ denote the reversal of $w$.\nProve that $f(w') = f(w)$.\n-/", "formal_statement": "/- special open -/ open List\ndef f : List Bool \u2192 Nat \u00d7 Nat :=\n foldr (\u03bb a (x, y) \u21a6 (y, match a with | false => 2 * x + 3 * y | true => 3 * x + y)) (1, 7)\n\ntheorem imo_sl_2009_C3 : \u2200 l, (f l.reverse).2 = (f l).2 := by sorry", "split": "test", "tags": ["combinatorics"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2009 C3\n\nLet $\\{0, 1\\}^*$ denote the set of finite-length binary words with letters $0$ and $1$.\nLet $\u03b5$ denote the empty word.\n\nDefine the function $f : \\{0, 1\\}^* \u2192 \u2115$ recursively by $f(\u03b5) = 1$, $f(0) = f(1) = 7$, and\n$$ f(wa0) = 2 f(wa) + 3 f(w) \\quad \\text{and} \\quad f(wa1) = 3 f(wa) + f(w). $$\nFix a word $w \u2208 L$, and let $w'$ denote the reversal of $w$.\nProve that $f(w') = f(w)$.\n-/\n/- special open -/ open List\ndef f : List Bool \u2192 Nat \u00d7 Nat :=\n foldr (\u03bb a (x, y) \u21a6 (y, match a with | false => 2 * x + 3 * y | true => 3 * x + y)) (1, 7)\n\ntheorem imo_sl_2009_C3 : \u2200 l, (f l.reverse).2 = (f l).2 := by sorry", "category": "combinatorics"} {"name": "imo_sl_2009_N1", "problem_id": "2009_N1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2009 N1 (P1)\n\nLet $n$ be a positive integer.\nLet $a_1, a_2, \u2026, a_k$ be distinct integers in $\\{1, 2, \u2026, n\\}$, with $k > 1$.\nProve that there exists $i \u2264 k$ such that $n$ does not divide $a_i (a_{i + 1} - 1)$.\nHere, we denote $a_{k + 1} = a_1$.\n-/", "formal_statement": "theorem imo_sl_2009_N1 (hk : 1 < Nat.succ k) {a : Fin (Nat.succ k) \u2192 \u2124}\n (ha : a.Injective) {n : \u2115} (ha0 : \u2200 i, 0 < a i \u2227 a i \u2264 n) :\n \u00ac\u2200 i, (n : \u2124) \u2223 a i * (a (i + 1) - 1) := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2009 N1 (P1)\n\nLet $n$ be a positive integer.\nLet $a_1, a_2, \u2026, a_k$ be distinct integers in $\\{1, 2, \u2026, n\\}$, with $k > 1$.\nProve that there exists $i \u2264 k$ such that $n$ does not divide $a_i (a_{i + 1} - 1)$.\nHere, we denote $a_{k + 1} = a_1$.\n-/\ntheorem imo_sl_2009_N1 (hk : 1 < Nat.succ k) {a : Fin (Nat.succ k) \u2192 \u2124}\n (ha : a.Injective) {n : \u2115} (ha0 : \u2200 i, 0 < a i \u2227 a i \u2264 n) :\n \u00ac\u2200 i, (n : \u2124) \u2223 a i * (a (i + 1) - 1) := by sorry", "category": "number theory"} {"name": "imo_sl_2009_N2b", "problem_id": "2009_N2b", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2009 N2\n\nFor each positive integer $n$, let $\u03a9(n)$ denote the number of\n prime factors of $n$, counting multiplicity.\nFor convenience, we denote $\u03a9(0) = 0$.\n2. Prove that for any $a, b \u2208 \u2115$, if $\u03a9((a + k)(b + k))$ is even\n for all $k \u2208 \u2115$, then $a = b$.\n-/", "formal_statement": "/- special open -/ open ArithmeticFunction\ntheorem imo_sl_2009_N2b_part2 (h : \u2200 k, Even (\u03a9 ((a + k) * (b + k)))) : a = b := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2009 N2\n\nFor each positive integer $n$, let $\u03a9(n)$ denote the number of\n prime factors of $n$, counting multiplicity.\nFor convenience, we denote $\u03a9(0) = 0$.\n2. Prove that for any $a, b \u2208 \u2115$, if $\u03a9((a + k)(b + k))$ is even\n for all $k \u2208 \u2115$, then $a = b$.\n-/\n/- special open -/ open ArithmeticFunction\ntheorem imo_sl_2009_N2b_part2 (h : \u2200 k, Even (\u03a9 ((a + k) * (b + k)))) : a = b := by sorry", "category": "number theory"} {"name": "imo_sl_2009_N2a", "problem_id": "2009_N2a", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2009 N2\n\nFor each positive integer $n$, let $\u03a9(n)$ denote the number of\n prime factors of $n$, counting multiplicity.\nFor convenience, we denote $\u03a9(0) = 0$.\n1. Prove that for any $N \u2208 \u2115$, there exists $a, b \u2208 \u2115$ distinct\n such that $\u03a9((a + k)(b + k))$ is even for all $k < N$.\n-/", "formal_statement": "/- special open -/ open ArithmeticFunction\ntheorem imo_sl_2009_N2a_part1 (N) : \u2203 a b, a \u2260 b \u2227 \u2200 k < N, Even (\u03a9 ((a + k) * (b + k))) := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2009 N2\n\nFor each positive integer $n$, let $\u03a9(n)$ denote the number of\n prime factors of $n$, counting multiplicity.\nFor convenience, we denote $\u03a9(0) = 0$.\n1. Prove that for any $N \u2208 \u2115$, there exists $a, b \u2208 \u2115$ distinct\n such that $\u03a9((a + k)(b + k))$ is even for all $k < N$.\n-/\n/- special open -/ open ArithmeticFunction\ntheorem imo_sl_2009_N2a_part1 (N) : \u2203 a b, a \u2260 b \u2227 \u2200 k < N, Even (\u03a9 ((a + k) * (b + k))) := by sorry", "category": "number theory"} {"name": "imo_sl_2009_N3", "problem_id": "2009_N3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2009 N3\n\nLet $f : \u2115 \u2192 \u2124$ be a non-constant function such that\n $a - b \u2223 f(a) - f(b)$ for any $a, b \u2208 \u2115$.\nProve that there exists infinitely many primes $p$\n that divide $f(c)$ for some $c \u2208 \u2115$.\n\n### Notes\n\nIn this file, the infinitude of such primes is rephrased as follows:\n for any $k \u2208 \u2115$, there exists a prime $p \u2265 k$ such that\n $p \u2223 f(c)$ for some $c \u2208 \u2115$.\nThe equivalence is clear, and this avoids importing `Mathlib.Data.Set.Finite`.\n-/", "formal_statement": "variable {f : \u2115 \u2192 \u2124} (h : \u2200 a b : \u2115, (a : \u2124) - b \u2223 f a - f b)\n\ntheorem imo_sl_2009_N3 (h0 : \u2200 C : \u2124, \u2203 b : \u2115, f b \u2260 C) (K : \u2115) :\n \u2203 p : \u2115, K \u2264 p \u2227 p.Prime \u2227 \u2203 c, (p : \u2124) \u2223 f c := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2009 N3\n\nLet $f : \u2115 \u2192 \u2124$ be a non-constant function such that\n $a - b \u2223 f(a) - f(b)$ for any $a, b \u2208 \u2115$.\nProve that there exists infinitely many primes $p$\n that divide $f(c)$ for some $c \u2208 \u2115$.\n\n### Notes\n\nIn this file, the infinitude of such primes is rephrased as follows:\n for any $k \u2208 \u2115$, there exists a prime $p \u2265 k$ such that\n $p \u2223 f(c)$ for some $c \u2208 \u2115$.\nThe equivalence is clear, and this avoids importing `Mathlib.Data.Set.Finite`.\n-/\nvariable {f : \u2115 \u2192 \u2124} (h : \u2200 a b : \u2115, (a : \u2124) - b \u2223 f a - f b)\n\ntheorem imo_sl_2009_N3 (h0 : \u2200 C : \u2124, \u2203 b : \u2115, f b \u2260 C) (K : \u2115) :\n \u2203 p : \u2115, K \u2264 p \u2227 p.Prime \u2227 \u2203 c, (p : \u2124) \u2223 f c := by sorry", "category": "number theory"} {"name": "imo_sl_2010_A1", "problem_id": "2010_A1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2010 A1\n\nLet $R$ and $S$ be totally ordered rings with a floor function (i.e., `FloorRing`s).\nFind all functions $f : R \u2192 S$ such that for any $x, y \\in R$,\n$$ f(\\lfloor x \\rfloor y) = f(x) \\lfloor f(y) \\rfloor. $$\n-/", "formal_statement": "/- special open -/ open Classical\n/-- A function `f` is \"good\" if it satisfies the functional equation. -/\ndef IsGood [LinearOrderedRing R] [FloorRing R] [LinearOrderedRing S] [FloorRing S] (f : R \u2192 S) : Prop :=\n \u2200 x y, f (\u2308x\u2309 \u2022 y) = f x * \u2308f y\u2309\n\n/--\nA helper definition for the discrete case: `\u03b5` is \"infinitesimal\" if all its\nnatural number multiples are less than 1 in absolute value.\n-/\ndef IsInfinitesimal [LinearOrderedRing S] (\u03b5 : S) : Prop :=\n \u2200 n : \u2115, n \u2022 |\u03b5| < 1\n\n/--\nFor the case where `R` is isomorphic to `\u2124`, the solutions fall into one of\nthree families, captured by this inductive proposition.\n-/\ninductive IsAnswer [LinearOrderedRing R] [MulOneClass R]\n [LinearOrderedRing S] [FloorRing S] : (R \u2192 S) \u2192 Prop\n /-- Solutions that are integer-valued monoid homomorphisms. -/\n | MonoidHom_cast (phi : R \u2192* \u2124) :\n IsAnswer (fun x \u21a6 (phi x : S))\n /-- Solutions of the form `n \u21a6 (1 + \u03b5)^n`, where `\u03b5` is a positive infinitesimal. -/\n | one_add_\u03b5 (\u03b5 : S) (_ : 0 < \u03b5) (_ : IsInfinitesimal \u03b5) (phi : R \u2192* \u2115) :\n IsAnswer (fun x \u21a6 phi x \u2022 (1 + \u03b5))\n /-- Solutions that are indicator functions on submonoids of `R`. -/\n | indicator (A : Set R) (_ : \u2200 m n, m * n \u2208 A \u2194 m \u2208 A \u2227 n \u2208 A) (C : S) (_ : \u2308C\u2309 = 1) :\n IsAnswer (fun x \u21a6 if x \u2208 A then C else 0)\n\n/--\nThe final solution, which splits depending on the properties of the domain `R`.\n-/\ntheorem imo_sl_2010_A1 [LinearOrderedRing R] [FloorRing R]\n [LinearOrderedRing S] [FloorRing S] (f : R \u2192 S) :\n IsGood f \u2194 if DenselyOrdered R then (\u2203 C, \u2308C\u2309 = 1 \u2227 f = fun _ \u21a6 C) \u2228 f = (fun _ \u21a6 0)\n else IsAnswer f := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2010 A1\n\nLet $R$ and $S$ be totally ordered rings with a floor function (i.e., `FloorRing`s).\nFind all functions $f : R \u2192 S$ such that for any $x, y \\in R$,\n$$ f(\\lfloor x \\rfloor y) = f(x) \\lfloor f(y) \\rfloor. $$\n-/\n/- special open -/ open Classical\n/-- A function `f` is \"good\" if it satisfies the functional equation. -/\ndef IsGood [LinearOrderedRing R] [FloorRing R] [LinearOrderedRing S] [FloorRing S] (f : R \u2192 S) : Prop :=\n \u2200 x y, f (\u2308x\u2309 \u2022 y) = f x * \u2308f y\u2309\n\n/--\nA helper definition for the discrete case: `\u03b5` is \"infinitesimal\" if all its\nnatural number multiples are less than 1 in absolute value.\n-/\ndef IsInfinitesimal [LinearOrderedRing S] (\u03b5 : S) : Prop :=\n \u2200 n : \u2115, n \u2022 |\u03b5| < 1\n\n/--\nFor the case where `R` is isomorphic to `\u2124`, the solutions fall into one of\nthree families, captured by this inductive proposition.\n-/\ninductive IsAnswer [LinearOrderedRing R] [MulOneClass R]\n [LinearOrderedRing S] [FloorRing S] : (R \u2192 S) \u2192 Prop\n /-- Solutions that are integer-valued monoid homomorphisms. -/\n | MonoidHom_cast (phi : R \u2192* \u2124) :\n IsAnswer (fun x \u21a6 (phi x : S))\n /-- Solutions of the form `n \u21a6 (1 + \u03b5)^n`, where `\u03b5` is a positive infinitesimal. -/\n | one_add_\u03b5 (\u03b5 : S) (_ : 0 < \u03b5) (_ : IsInfinitesimal \u03b5) (phi : R \u2192* \u2115) :\n IsAnswer (fun x \u21a6 phi x \u2022 (1 + \u03b5))\n /-- Solutions that are indicator functions on submonoids of `R`. -/\n | indicator (A : Set R) (_ : \u2200 m n, m * n \u2208 A \u2194 m \u2208 A \u2227 n \u2208 A) (C : S) (_ : \u2308C\u2309 = 1) :\n IsAnswer (fun x \u21a6 if x \u2208 A then C else 0)\n\n/--\nThe final solution, which splits depending on the properties of the domain `R`.\n-/\ntheorem imo_sl_2010_A1 [LinearOrderedRing R] [FloorRing R]\n [LinearOrderedRing S] [FloorRing S] (f : R \u2192 S) :\n IsGood f \u2194 if DenselyOrdered R then (\u2203 C, \u2308C\u2309 = 1 \u2227 f = fun _ \u21a6 C) \u2228 f = (fun _ \u21a6 0)\n else IsAnswer f := by sorry", "category": "algebra"} {"name": "imo_sl_2010_A2", "problem_id": "2010_A2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2010 A2\n\nLet $R$ be a totally ordered commutative ring.\nFix some $a, b, c, d \\in R$ such that $a + b + c + d = 6$ and $a^2 + b^2 + c^2 + d^2 = 12$.\nProve that\n$$ 36 \\le 4(a^3 + b^3 + c^3 + d^3) - (a^4 + b^4 + c^4 + d^4) \\le 48. $$\n-/", "formal_statement": "theorem imo_sl_2010_A2 [LinearOrderedCommRing R] (a b c d : R)\n (h_sum : a + b + c + d = 6)\n (h_sq_sum : a ^ 2 + b ^ 2 + c ^ 2 + d ^ 2 = 12) :\n let S := 4 * (a ^ 3 + b ^ 3 + c ^ 3 + d ^ 3) - (a ^ 4 + b ^ 4 + c ^ 4 + d ^ 4)\n 36 \u2264 S \u2227 S \u2264 48 := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2010 A2\n\nLet $R$ be a totally ordered commutative ring.\nFix some $a, b, c, d \\in R$ such that $a + b + c + d = 6$ and $a^2 + b^2 + c^2 + d^2 = 12$.\nProve that\n$$ 36 \\le 4(a^3 + b^3 + c^3 + d^3) - (a^4 + b^4 + c^4 + d^4) \\le 48. $$\n-/\ntheorem imo_sl_2010_A2 [LinearOrderedCommRing R] (a b c d : R)\n (h_sum : a + b + c + d = 6)\n (h_sq_sum : a ^ 2 + b ^ 2 + c ^ 2 + d ^ 2 = 12) :\n let S := 4 * (a ^ 3 + b ^ 3 + c ^ 3 + d ^ 3) - (a ^ 4 + b ^ 4 + c ^ 4 + d ^ 4)\n 36 \u2264 S \u2227 S \u2264 48 := by sorry", "category": "algebra"} {"name": "imo_sl_2010_A3", "problem_id": "2010_A3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2010 A3\n\nFix a positive integer $N$, a totally ordered commutative ring $R$, and an element $c \\ge 0$.\nConsider all $2N$-periodic sequences $(x_n)_{n \\ge 0}$ such that for any $n$,\n$$ x_n + x_{n + 1} + x_{n + 2} \\le 2c. $$\nDetermine the maximum possible value of\n$$ \\sum_{k = 0}^{2N-1} (x_k x_{k + 2} + x_{k + 1} x_{k + 3}). $$\n-/", "formal_statement": "/- special open -/ open Finset\nvariable (R : Type*) [LinearOrderedCommRing R]\n\n/--\nA sequence `x` is a \"good periodic sequence\" if it satisfies the conditions of the problem:\n- `nonneg`: All its elements are non-negative.\n- `good_sum`: The sum of any three consecutive elements is at most `2c`.\n- `periodic`: The sequence is periodic with period `2N`.\n-/\nstructure IsGoodPeriodicSeq (c : R) (N : \u2115) where\n x : \u2115 \u2192 R\n nonneg : \u2200 i, 0 \u2264 x i\n good_sum : \u2200 i, x i + x (i + 1) + x (i + 2) \u2264 2 \u2022 c\n periodic : \u2200 k, x (k + 2 * N) = x k\n\n/-- The expression to be maximized. -/\ndef targetSum (x : \u2115 \u2192 R) (N : \u2115) : R :=\n \u2211 i \u2208 range (2 * N), (x i * x (i + 2) + x (i + 1) * x (i + 3))\n\n/--\nThe maximum value of the target sum is $2Nc^2$.\n`IsGreatest S m` means `m` is the maximum value of the set `S`.\n-/\ntheorem imo_sl_2010_A3 {c : R} (hc : 0 \u2264 c) {N : \u2115} (hN : 0 < N) :\n IsGreatest (Set.range fun (s : IsGoodPeriodicSeq R c N) \u21a6 targetSum R s.x N) (2 * N \u2022 c ^ 2) :=\n by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2010 A3\n\nFix a positive integer $N$, a totally ordered commutative ring $R$, and an element $c \\ge 0$.\nConsider all $2N$-periodic sequences $(x_n)_{n \\ge 0}$ such that for any $n$,\n$$ x_n + x_{n + 1} + x_{n + 2} \\le 2c. $$\nDetermine the maximum possible value of\n$$ \\sum_{k = 0}^{2N-1} (x_k x_{k + 2} + x_{k + 1} x_{k + 3}). $$\n-/\n/- special open -/ open Finset\nvariable (R : Type*) [LinearOrderedCommRing R]\n\n/--\nA sequence `x` is a \"good periodic sequence\" if it satisfies the conditions of the problem:\n- `nonneg`: All its elements are non-negative.\n- `good_sum`: The sum of any three consecutive elements is at most `2c`.\n- `periodic`: The sequence is periodic with period `2N`.\n-/\nstructure IsGoodPeriodicSeq (c : R) (N : \u2115) where\n x : \u2115 \u2192 R\n nonneg : \u2200 i, 0 \u2264 x i\n good_sum : \u2200 i, x i + x (i + 1) + x (i + 2) \u2264 2 \u2022 c\n periodic : \u2200 k, x (k + 2 * N) = x k\n\n/-- The expression to be maximized. -/\ndef targetSum (x : \u2115 \u2192 R) (N : \u2115) : R :=\n \u2211 i \u2208 range (2 * N), (x i * x (i + 2) + x (i + 1) * x (i + 3))\n\n/--\nThe maximum value of the target sum is $2Nc^2$.\n`IsGreatest S m` means `m` is the maximum value of the set `S`.\n-/\ntheorem imo_sl_2010_A3 {c : R} (hc : 0 \u2264 c) {N : \u2115} (hN : 0 < N) :\n IsGreatest (Set.range fun (s : IsGoodPeriodicSeq R c N) \u21a6 targetSum R s.x N) (2 * N \u2022 c ^ 2) :=\n by sorry", "category": "algebra"} {"name": "imo_sl_2010_A4", "problem_id": "2010_A4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2010 A4\n\nDefine the sequence $(x_n)_{n \\ge 0}$ recursively by $x_0 = 1$,\n$x_{2k} = (-1)^k x_k$, and $x_{2k + 1} = -x_k$ for all $k \\in \\mathbb{N}$.\nProve that for any $n \\in \\mathbb{N}$, $$ \\sum_{i = 0}^{n-1} x_i \\ge 0. $$\n\n**Extra**: Prove that equality holds if and only if the\nbase $4$ representation of $n$ only contains $0$ and $2$ as its digits.\n-/", "formal_statement": "/- special open -/ open Finset\n/--\nThe sequence `x n` is defined recursively on the binary representation of `n`.\n`false` corresponds to the integer value `1`, and `true` to `-1`.\n-/\ndef x : \u2115 \u2192 Bool :=\n Nat.binaryRec false fun bit k \u21a6 xor (bit || Nat.bodd k)\n\n/--\nThe sum $S(n) = \\sum_{i = 0}^{n-1} x_i$.\n-/\ndef S (n : \u2115) : \u2124 :=\n \u2211 k in range n, if x k then -1 else 1\n\n/--\nThis theorem states both parts of the problem:\n1. The sum `S n` is always non-negative.\n2. The sum is zero if and only if the base-4 digits of `n` are all either 0 or 2.\n-/\ntheorem imo_sl_2010_A4 (n : \u2115) :\n (0 \u2264 S n) \u2227 (S n = 0 \u2194 \u2200 c \u2208 Nat.digits 4 n, c = 0 \u2228 c = 2) := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2010 A4\n\nDefine the sequence $(x_n)_{n \\ge 0}$ recursively by $x_0 = 1$,\n$x_{2k} = (-1)^k x_k$, and $x_{2k + 1} = -x_k$ for all $k \\in \\mathbb{N}$.\nProve that for any $n \\in \\mathbb{N}$, $$ \\sum_{i = 0}^{n-1} x_i \\ge 0. $$\n\n**Extra**: Prove that equality holds if and only if the\nbase $4$ representation of $n$ only contains $0$ and $2$ as its digits.\n-/\n/- special open -/ open Finset\n/--\nThe sequence `x n` is defined recursively on the binary representation of `n`.\n`false` corresponds to the integer value `1`, and `true` to `-1`.\n-/\ndef x : \u2115 \u2192 Bool :=\n Nat.binaryRec false fun bit k \u21a6 xor (bit || Nat.bodd k)\n\n/--\nThe sum $S(n) = \\sum_{i = 0}^{n-1} x_i$.\n-/\ndef S (n : \u2115) : \u2124 :=\n \u2211 k in range n, if x k then -1 else 1\n\n/--\nThis theorem states both parts of the problem:\n1. The sum `S n` is always non-negative.\n2. The sum is zero if and only if the base-4 digits of `n` are all either 0 or 2.\n-/\ntheorem imo_sl_2010_A4 (n : \u2115) :\n (0 \u2264 S n) \u2227 (S n = 0 \u2194 \u2200 c \u2208 Nat.digits 4 n, c = 0 \u2228 c = 2) := by sorry", "category": "algebra"} {"name": "imo_sl_2010_A6", "problem_id": "2010_A6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2010 A6\n\nLet $f, g : \u2115 \u2192 \u2115$ be functions such that $f(g(x)) = f(x) + 1$\n and $g(f(x)) = g(x) + 1$ for all $x \u2208 \u2115$.\nProve that $f = g$.\n-/", "formal_statement": "/- special open -/ open Classical\ndef good (f g : \u2115 \u2192 \u2115) := \u2200 n : \u2115, f (g n) = (f n).succ\n\nvariable {f g : \u2115 \u2192 \u2115} (h : good f g) (h0 : good g f)\n\ntheorem imo_sl_2010_A6 : f = g := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2010 A6\n\nLet $f, g : \u2115 \u2192 \u2115$ be functions such that $f(g(x)) = f(x) + 1$\n and $g(f(x)) = g(x) + 1$ for all $x \u2208 \u2115$.\nProve that $f = g$.\n-/\n/- special open -/ open Classical\ndef good (f g : \u2115 \u2192 \u2115) := \u2200 n : \u2115, f (g n) = (f n).succ\n\nvariable {f g : \u2115 \u2192 \u2115} (h : good f g) (h0 : good g f)\n\ntheorem imo_sl_2010_A6 : f = g := by sorry", "category": "algebra"} {"name": "imo_sl_2010_C4", "problem_id": "2010_C4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2010 C4 (P5)\n\nIn the board, $N = 6$ stacks of coins are given, with each stack initially containing one coin.\nAt any time, one of the following operations can be performed:\n* **Type 1:** Remove one coin from a non-empty stack $k+1$ and add two coins to stack $k$ (for $k < 5$).\n* **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$).\n\nIs it possible that, after some operations, we are left with stack 0\n containing $A = 2010^{2010^{2010}}$ coins and all other stacks empty?\n-/", "formal_statement": "/- special open -/ open List\ninductive isReachable : List Nat \u2192 List Nat \u2192 Prop\n | type1_move (k m) : isReachable [k + 1, m] [k, m + 2]\n | type2_move (k m n) : isReachable [k + 1, m, n] [k, n, m]\n | refl (l) : isReachable l l\n | trans (h : isReachable l\u2081 l\u2082) (h : isReachable l\u2082 l\u2083) : isReachable l\u2081 l\u2083\n | append_right (h : isReachable l\u2081 l\u2082) (l) : isReachable (l\u2081 ++ l) (l\u2082 ++ l)\n | cons_left (h : isReachable l\u2081 l\u2082) (k) : isReachable (k :: l\u2081) (k :: l\u2082)\n\ntheorem imo_sl_2010_C4 :\n isReachable (replicate 6 1) (replicate 5 0 ++ [2010 ^ 2010 ^ 2010]) := by sorry", "split": "test", "tags": ["combinatorics"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2010 C4 (P5)\n\nIn the board, $N = 6$ stacks of coins are given, with each stack initially containing one coin.\nAt any time, one of the following operations can be performed:\n* **Type 1:** Remove one coin from a non-empty stack $k+1$ and add two coins to stack $k$ (for $k < 5$).\n* **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$).\n\nIs it possible that, after some operations, we are left with stack 0\n containing $A = 2010^{2010^{2010}}$ coins and all other stacks empty?\n-/\n/- special open -/ open List\ninductive isReachable : List Nat \u2192 List Nat \u2192 Prop\n | type1_move (k m) : isReachable [k + 1, m] [k, m + 2]\n | type2_move (k m n) : isReachable [k + 1, m, n] [k, n, m]\n | refl (l) : isReachable l l\n | trans (h : isReachable l\u2081 l\u2082) (h : isReachable l\u2082 l\u2083) : isReachable l\u2081 l\u2083\n | append_right (h : isReachable l\u2081 l\u2082) (l) : isReachable (l\u2081 ++ l) (l\u2082 ++ l)\n | cons_left (h : isReachable l\u2081 l\u2082) (k) : isReachable (k :: l\u2081) (k :: l\u2082)\n\ntheorem imo_sl_2010_C4 :\n isReachable (replicate 6 1) (replicate 5 0 ++ [2010 ^ 2010 ^ 2010]) := by sorry", "category": "combinatorics"} {"name": "imo_sl_2010_N5", "problem_id": "2010_N5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2010 N5 (P3)\n\nGiven $c \u2208 \u2115$, find all functions $f : \u2115 \u2192 \u2115$ such that\n $(f(m) + n + c)(f(n) + m + c)$ is a square for all $m, n \u2208 \u2115$.\n-/", "formal_statement": "def good (c : \u2115) (f : \u2115 \u2192 \u2115) := \u2200 m n, \u2203 k, (f m + n + c) * (f n + m + c) = k ^ 2\n\nvariable (hp : Nat.Prime p) (h : \u2203 k : \u2115, a * b = k ^ 2)\n\ntheorem imo_sl_2010_N5 : good c f \u2194 \u2203 k, f = (\u00b7 + k) := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2010 N5 (P3)\n\nGiven $c \u2208 \u2115$, find all functions $f : \u2115 \u2192 \u2115$ such that\n $(f(m) + n + c)(f(n) + m + c)$ is a square for all $m, n \u2208 \u2115$.\n-/\ndef good (c : \u2115) (f : \u2115 \u2192 \u2115) := \u2200 m n, \u2203 k, (f m + n + c) * (f n + m + c) = k ^ 2\n\nvariable (hp : Nat.Prime p) (h : \u2203 k : \u2115, a * b = k ^ 2)\n\ntheorem imo_sl_2010_N5 : good c f \u2194 \u2203 k, f = (\u00b7 + k) := by sorry", "category": "number theory"} {"name": "imo_sl_2011_A1", "problem_id": "2011_A1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2011 A1\n\nConsider an arbitrary set $A = \\{a_1, a_2, a_3, a_4\\}$ of four distinct positive integers.\nLet $p_A$ be the number of pairs $(i, j)$ with $1 \\le i < j \\le 4$\nsuch that $a_i + a_j$ divides $a_1 + a_2 + a_3 + a_4$.\nDetermine all sets $A$ of size $4$ such that $p_A \\ge p_B$ for all sets $B$ of size $4$.\n-/", "formal_statement": "/- special open -/ open Finset\n/--\nA `Card4NatSet` represents a set of four distinct positive integers,\nformalized as a strictly increasing sequence of length 4.\n-/\n@[ext] structure Card4NatSet where\n f : Fin 4 \u2192 \u2115\n f_pos : \u2200 i, 0 < f i\n f_strict_mono : StrictMono f\n\n/--\n`p_val A` is the number $p_A$ from the problem statement.\nIt counts the pairs `(i, j)` with `i < j` such that `a\u1d62 + a\u2c7c` divides the total sum.\n-/\ndef p_val (A : Card4NatSet) : \u2115 :=\n let S := A.f 0 + A.f 1 + A.f 2 + A.f 3\n (univ.filter fun (p : Fin 4 \u00d7 Fin 4) \u21a6 p.1 < p.2 \u2227 A.f p.1 + A.f p.2 \u2223 S).card\n\n/--\nThe main theorem characterizes the sets `A` which maximize `p_val`.\nThe solutions are precisely the positive integer multiples of the sets\n$\\{1, 5, 7, 11\\}$ and $\\{1, 11, 19, 29\\}$.\n-/\ntheorem imo_sl_2011_A1 (A : Card4NatSet) :\n (\u2200 B : Card4NatSet, p_val B \u2264 p_val A) \u2194\n (\u2203 (n : \u2115) (_ : 0 < n), A.f = n \u2022 ![1, 5, 7, 11] \u2228 A.f = n \u2022 ![1, 11, 19, 29]) := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2011 A1\n\nConsider an arbitrary set $A = \\{a_1, a_2, a_3, a_4\\}$ of four distinct positive integers.\nLet $p_A$ be the number of pairs $(i, j)$ with $1 \\le i < j \\le 4$\nsuch that $a_i + a_j$ divides $a_1 + a_2 + a_3 + a_4$.\nDetermine all sets $A$ of size $4$ such that $p_A \\ge p_B$ for all sets $B$ of size $4$.\n-/\n/- special open -/ open Finset\n/--\nA `Card4NatSet` represents a set of four distinct positive integers,\nformalized as a strictly increasing sequence of length 4.\n-/\n@[ext] structure Card4NatSet where\n f : Fin 4 \u2192 \u2115\n f_pos : \u2200 i, 0 < f i\n f_strict_mono : StrictMono f\n\n/--\n`p_val A` is the number $p_A$ from the problem statement.\nIt counts the pairs `(i, j)` with `i < j` such that `a\u1d62 + a\u2c7c` divides the total sum.\n-/\ndef p_val (A : Card4NatSet) : \u2115 :=\n let S := A.f 0 + A.f 1 + A.f 2 + A.f 3\n (univ.filter fun (p : Fin 4 \u00d7 Fin 4) \u21a6 p.1 < p.2 \u2227 A.f p.1 + A.f p.2 \u2223 S).card\n\n/--\nThe main theorem characterizes the sets `A` which maximize `p_val`.\nThe solutions are precisely the positive integer multiples of the sets\n$\\{1, 5, 7, 11\\}$ and $\\{1, 11, 19, 29\\}$.\n-/\ntheorem imo_sl_2011_A1 (A : Card4NatSet) :\n (\u2200 B : Card4NatSet, p_val B \u2264 p_val A) \u2194\n (\u2203 (n : \u2115) (_ : 0 < n), A.f = n \u2022 ![1, 5, 7, 11] \u2228 A.f = n \u2022 ![1, 11, 19, 29]) := by sorry", "category": "algebra"} {"name": "imo_sl_2011_A3", "problem_id": "2011_A3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2011 A3\n\nLet $R$ be a commutative ring where $2$ is not a zero divisor.\nFind all functions $f, g : R \u2192 R$ such that for any $x, y \u2208 R$,\n$$ g(f(x + y)) = f(x) + (2x + y) g(y). $$\n-/", "formal_statement": "def good [NonUnitalNonAssocSemiring R] (f g : R \u2192 R) :=\n \u2200 x y, g (f (x + y)) = f x + (2 \u2022 x + y) * g y\n\ntheorem imo_sl_2011_A3 [CommRing R] [IsDomain R] (hR : (2 : R) \u2260 0) {f g : R \u2192 R} :\n good f g \u2194 (f, g) = (\u03bb _ \u21a6 0, \u03bb _ \u21a6 0) \u2228 \u2203 c, (f, g) = (\u03bb x \u21a6 x * x + c, id) := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2011 A3\n\nLet $R$ be a commutative ring where $2$ is not a zero divisor.\nFind all functions $f, g : R \u2192 R$ such that for any $x, y \u2208 R$,\n$$ g(f(x + y)) = f(x) + (2x + y) g(y). $$\n-/\ndef good [NonUnitalNonAssocSemiring R] (f g : R \u2192 R) :=\n \u2200 x y, g (f (x + y)) = f x + (2 \u2022 x + y) * g y\n\ntheorem imo_sl_2011_A3 [CommRing R] [IsDomain R] (hR : (2 : R) \u2260 0) {f g : R \u2192 R} :\n good f g \u2194 (f, g) = (\u03bb _ \u21a6 0, \u03bb _ \u21a6 0) \u2228 \u2203 c, (f, g) = (\u03bb x \u21a6 x * x + c, id) := by sorry", "category": "algebra"} {"name": "imo_sl_2011_A4", "problem_id": "2011_A4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2011 A4\n\nFind all functions $f, g : \u2115 \u2192 \u2115$ such that, for any $k \u2208 \u2115$,\n$$ f^{g(k) + 2}(k) + g^{f(k) + 1}(k) + g(k + 1) + 1 = f(k + 1). $$\n\n### Extra Notes\n\nThe original version using signature $\u2115^+ \u2192 \u2115^+$ is:\n$$ f^{g(k) + 1}(k) + g^{f(k)}(k) + g(k + 1) = f(k + 1) + 1. $$\n-/", "formal_statement": "/- special open -/ open Function\ntheorem imo_sl_2011_A4 {f g : \u2115+ \u2192 \u2115+} :\n (\u2200 n, f^[g n + 1] n + (g^[f n] n + g (n + 1)) = f (n + 1) + 1)\n \u2194 f = id \u2227 g = \u03bb _ \u21a6 1 := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2011 A4\n\nFind all functions $f, g : \u2115 \u2192 \u2115$ such that, for any $k \u2208 \u2115$,\n$$ f^{g(k) + 2}(k) + g^{f(k) + 1}(k) + g(k + 1) + 1 = f(k + 1). $$\n\n### Extra Notes\n\nThe original version using signature $\u2115^+ \u2192 \u2115^+$ is:\n$$ f^{g(k) + 1}(k) + g^{f(k)}(k) + g(k + 1) = f(k + 1) + 1. $$\n-/\n/- special open -/ open Function\ntheorem imo_sl_2011_A4 {f g : \u2115+ \u2192 \u2115+} :\n (\u2200 n, f^[g n + 1] n + (g^[f n] n + g (n + 1)) = f (n + 1) + 1)\n \u2194 f = id \u2227 g = \u03bb _ \u21a6 1 := by sorry", "category": "algebra"} {"name": "imo_sl_2011_A6", "problem_id": "2011_A6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2011 A6 (P3)\n\nLet $R$ be a totally ordered commutative ring.\nLet $f : R \u2192 R$ be a function such that, for any $x, y \u2208 R$,\n$$ f(x + y) \u2264 y f(x) + f(f(x)). $$\nShow that $f(x) = 0$ for any $x \u2208 R$ such that $x \u2264 0$.\n-/", "formal_statement": "theorem imo_sl_2011_A6 [LinearOrderedCommRing R]\n {f : R \u2192 R} (h : \u2200 x y : R, f (x + y) \u2264 y * f x + f (f x)) :\n \u2200 x : R, x \u2264 0 \u2192 f x = 0 := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2011 A6 (P3)\n\nLet $R$ be a totally ordered commutative ring.\nLet $f : R \u2192 R$ be a function such that, for any $x, y \u2208 R$,\n$$ f(x + y) \u2264 y f(x) + f(f(x)). $$\nShow that $f(x) = 0$ for any $x \u2208 R$ such that $x \u2264 0$.\n-/\ntheorem imo_sl_2011_A6 [LinearOrderedCommRing R]\n {f : R \u2192 R} (h : \u2200 x y : R, f (x + y) \u2264 y * f x + f (f x)) :\n \u2200 x : R, x \u2264 0 \u2192 f x = 0 := by sorry", "category": "algebra"} {"name": "imo_sl_2011_N5", "problem_id": "2011_N5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2011 N5\n\nLet $G$ be an additive group. Find all functions $f : G \\to \\mathbb{Z}$ such that\nfor any $x, y \\in G$:\n1. $f(x) > 0$\n2. $f(x - y)$ divides $f(x) - f(y)$.\n-/", "formal_statement": "variable [AddGroup G]\n\n/--\nA function `f` is \"good\" if it satisfies the conditions of the problem.\nThe codomain is taken to be `\u2124` with a positivity constraint, which is\nequivalent to the original problem's `\u2115+` codomain.\n-/\nstructure IsGood (f : G \u2192 \u2124) : Prop where\n pos : \u2200 x, 0 < f x\n dvd : \u2200 x y, f (x - y) \u2223 f x - f y\n\n/--\nThis theorem establishes a key property of any solution `f`.\nIt shows that if `f(x) \u2264 f(y)`, then `f(x)` must divide `f(y)`.\nThis implies that the set of values taken by `f` must form a divisor chain.\n-/\ntheorem solution_property {f : G \u2192 \u2124} (hf : IsGood f) {x y : G} (h_le : f x \u2264 f y) :\n f x \u2223 f y := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2011 N5\n\nLet $G$ be an additive group. Find all functions $f : G \\to \\mathbb{Z}$ such that\nfor any $x, y \\in G$:\n1. $f(x) > 0$\n2. $f(x - y)$ divides $f(x) - f(y)$.\n-/\nvariable [AddGroup G]\n\n/--\nA function `f` is \"good\" if it satisfies the conditions of the problem.\nThe codomain is taken to be `\u2124` with a positivity constraint, which is\nequivalent to the original problem's `\u2115+` codomain.\n-/\nstructure IsGood (f : G \u2192 \u2124) : Prop where\n pos : \u2200 x, 0 < f x\n dvd : \u2200 x y, f (x - y) \u2223 f x - f y\n\n/--\nThis theorem establishes a key property of any solution `f`.\nIt shows that if `f(x) \u2264 f(y)`, then `f(x)` must divide `f(y)`.\nThis implies that the set of values taken by `f` must form a divisor chain.\n-/\ntheorem solution_property {f : G \u2192 \u2124} (hf : IsGood f) {x y : G} (h_le : f x \u2264 f y) :\n f x \u2223 f y := by sorry", "category": "number theory"} {"name": "imo_sl_2012_A3", "problem_id": "2012_A3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2012 A3\n\nLet $m \\ge 2$ be an integer, $R$ be a totally ordered commutative ring, and\n$x_0, x_1, \\dots, x_{m-1} \\in R$ be positive elements such that\n$x_0 x_1 \\cdots x_{m-1} = 1$. Prove that\n$$ (1 + x_0)^2 (1 + x_1)^3 \\cdots (1 + x_{m-1})^{m+1} > (m + 1)^{m+1}. $$\n-/", "formal_statement": "/- special open -/ open Finset\ntheorem imo_sl_2012_A3 [LinearOrderedCommRing R] (m : Nat) (hm : 2 \u2264 m)\n (x : Fin m \u2192 R) (hx_pos : \u2200 i, 0 < x i) (hx_prod : \u220f i, x i = 1) :\n (m + 1) ^ (m + 1) < \u220f i, (1 + x i) ^ ((i : Nat) + 2) := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2012 A3\n\nLet $m \\ge 2$ be an integer, $R$ be a totally ordered commutative ring, and\n$x_0, x_1, \\dots, x_{m-1} \\in R$ be positive elements such that\n$x_0 x_1 \\cdots x_{m-1} = 1$. Prove that\n$$ (1 + x_0)^2 (1 + x_1)^3 \\cdots (1 + x_{m-1})^{m+1} > (m + 1)^{m+1}. $$\n-/\n/- special open -/ open Finset\ntheorem imo_sl_2012_A3 [LinearOrderedCommRing R] (m : Nat) (hm : 2 \u2264 m)\n (x : Fin m \u2192 R) (hx_pos : \u2200 i, 0 < x i) (hx_prod : \u220f i, x i = 1) :\n (m + 1) ^ (m + 1) < \u220f i, (1 + x i) ^ ((i : Nat) + 2) := by sorry", "category": "algebra"} {"name": "imo_sl_2012_A5", "problem_id": "2012_A5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2012 A5\n\nLet $R$ be a ring and $S$ be a domain (a ring with no zero divisors).\nFind all functions $f : R \\to S$ such that for any $x, y \\in R$,\n$$ f(xy + 1) = f(x) f(y) + f(x + y). $$\n-/", "formal_statement": "universe u v\n\nvariable {R S : Type*}\n\n/-- A function `f` is \"good\" if it satisfies the functional equation. -/\ndef IsGood [Ring R] [Ring S] (f : R \u2192 S) : Prop :=\n \u2200 x y, f (x * y + 1) = f x * f y + f (x + y)\n\n/--\nThe formal statement of the solution requires bundling the rings with the function\nto handle the variety of domains and codomains of the archetypal solutions.\n-/\nstructure RingFunction where\n source : Type u\n source_ring : Ring source\n target : Type v\n target_ring : Ring target\n f : source \u2192 target\n\n-- These instances let the typechecker automatically find the Ring structure for the source/target\ninstance (X : RingFunction) : Ring X.source := X.source_ring\ninstance (X : RingFunction) : Ring X.target := X.target_ring\n\n/-- A homomorphism between two `RingFunction`s. -/\nstructure RingFunctionHom (X Y : RingFunction) where\n sourceHom : Y.source \u2192+* X.source\n targetHom : X.target \u2192+* Y.target\n spec : \u2200 r, Y.f r = targetHom (X.f (sourceHom r))\n\n/-- A helper to construct a `RingFunction` from a regular function. -/\ndef ofFun [hR : Ring R] [hS : Ring S] (f : R \u2192 S) : RingFunction :=\n \u27e8R, hR, S, hS, f\u27e9\n\n/--\nThe set of all solutions, up to ring homomorphisms. Any solution can be constructed\nfrom one of these archetypes by composing it with homomorphisms.\n-/\ninductive IsArchetype : RingFunction \u2192 Prop\n -- Polynomial-like solutions\n | sub_one (R) [hR : Ring R] : IsArchetype \u27e8R, hR, R, hR, fun x \u21a6 x - 1\u27e9\n | sq_sub_one (R) [hR : CommRing R] :\n IsArchetype \u27e8R, inferInstance, R, inferInstance, fun x \u21a6 x ^ 2 - 1\u27e9\n -- Six special solutions on finite rings\n | f2_map : IsArchetype \u27e8ZMod 2, inferInstance, \u2124, inferInstance, fun x \u21a6 if x = 0 then -1 else 0\u27e9\n | f3_map1 : IsArchetype \u27e8ZMod 3, inferInstance, \u2124, inferInstance, fun x \u21a6 \n if x = 0 then -1 else if x = 1 then 0 else 1\u27e9\n | f3_map2 : IsArchetype \u27e8ZMod 3, inferInstance, \u2124, inferInstance, fun x \u21a6 \n if x = 0 then -1 else if x = 1 then 0 else -1\u27e9\n | z4_map : IsArchetype \u27e8ZMod 4, inferInstance, \u2124, inferInstance, \n fun x \u21a6 if x = 0 then -1 else if x = 2 then 1 else 0\u27e9\n -- For brevity, the archetypes on F\u2082(\u03b5) and F\u2084 are omitted from this summary.\n\n/--\nA function `f` is a \"nontrivial answer\" if it can be expressed as a composition\n`\u03b9 \u2218 g \u2218 \u03c6` where `g` is an archetype, and `\u03c6`, `\u03b9` are ring homomorphisms.\n-/\ndef IsNontrivialAnswer [Ring R] [Ring S] (f : R \u2192 S) : Prop :=\n \u2203 (A : RingFunction) (_ : IsArchetype A), Nonempty (RingFunctionHom A (ofFun f))\n\n/--\nThe final theorem: a function `f` is a solution if and only if it is the zero function\nor it is a \"nontrivial answer\" (a homomorphic image of an archetype).\n-/\ntheorem imo_sl_2012_A5 [Ring R] [Ring S] [IsDomain S] (f : R \u2192 S) :\n IsGood f \u2194 f = 0 \u2228 IsNontrivialAnswer f := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2012 A5\n\nLet $R$ be a ring and $S$ be a domain (a ring with no zero divisors).\nFind all functions $f : R \\to S$ such that for any $x, y \\in R$,\n$$ f(xy + 1) = f(x) f(y) + f(x + y). $$\n-/\nuniverse u v\n\nvariable {R S : Type*}\n\n/-- A function `f` is \"good\" if it satisfies the functional equation. -/\ndef IsGood [Ring R] [Ring S] (f : R \u2192 S) : Prop :=\n \u2200 x y, f (x * y + 1) = f x * f y + f (x + y)\n\n/--\nThe formal statement of the solution requires bundling the rings with the function\nto handle the variety of domains and codomains of the archetypal solutions.\n-/\nstructure RingFunction where\n source : Type u\n source_ring : Ring source\n target : Type v\n target_ring : Ring target\n f : source \u2192 target\n\n-- These instances let the typechecker automatically find the Ring structure for the source/target\ninstance (X : RingFunction) : Ring X.source := X.source_ring\ninstance (X : RingFunction) : Ring X.target := X.target_ring\n\n/-- A homomorphism between two `RingFunction`s. -/\nstructure RingFunctionHom (X Y : RingFunction) where\n sourceHom : Y.source \u2192+* X.source\n targetHom : X.target \u2192+* Y.target\n spec : \u2200 r, Y.f r = targetHom (X.f (sourceHom r))\n\n/-- A helper to construct a `RingFunction` from a regular function. -/\ndef ofFun [hR : Ring R] [hS : Ring S] (f : R \u2192 S) : RingFunction :=\n \u27e8R, hR, S, hS, f\u27e9\n\n/--\nThe set of all solutions, up to ring homomorphisms. Any solution can be constructed\nfrom one of these archetypes by composing it with homomorphisms.\n-/\ninductive IsArchetype : RingFunction \u2192 Prop\n -- Polynomial-like solutions\n | sub_one (R) [hR : Ring R] : IsArchetype \u27e8R, hR, R, hR, fun x \u21a6 x - 1\u27e9\n | sq_sub_one (R) [hR : CommRing R] :\n IsArchetype \u27e8R, inferInstance, R, inferInstance, fun x \u21a6 x ^ 2 - 1\u27e9\n -- Six special solutions on finite rings\n | f2_map : IsArchetype \u27e8ZMod 2, inferInstance, \u2124, inferInstance, fun x \u21a6 if x = 0 then -1 else 0\u27e9\n | f3_map1 : IsArchetype \u27e8ZMod 3, inferInstance, \u2124, inferInstance, fun x \u21a6 \n if x = 0 then -1 else if x = 1 then 0 else 1\u27e9\n | f3_map2 : IsArchetype \u27e8ZMod 3, inferInstance, \u2124, inferInstance, fun x \u21a6 \n if x = 0 then -1 else if x = 1 then 0 else -1\u27e9\n | z4_map : IsArchetype \u27e8ZMod 4, inferInstance, \u2124, inferInstance, \n fun x \u21a6 if x = 0 then -1 else if x = 2 then 1 else 0\u27e9\n -- For brevity, the archetypes on F\u2082(\u03b5) and F\u2084 are omitted from this summary.\n\n/--\nA function `f` is a \"nontrivial answer\" if it can be expressed as a composition\n`\u03b9 \u2218 g \u2218 \u03c6` where `g` is an archetype, and `\u03c6`, `\u03b9` are ring homomorphisms.\n-/\ndef IsNontrivialAnswer [Ring R] [Ring S] (f : R \u2192 S) : Prop :=\n \u2203 (A : RingFunction) (_ : IsArchetype A), Nonempty (RingFunctionHom A (ofFun f))\n\n/--\nThe final theorem: a function `f` is a solution if and only if it is the zero function\nor it is a \"nontrivial answer\" (a homomorphic image of an archetype).\n-/\ntheorem imo_sl_2012_A5 [Ring R] [Ring S] [IsDomain S] (f : R \u2192 S) :\n IsGood f \u2194 f = 0 \u2228 IsNontrivialAnswer f := by sorry", "category": "algebra"} {"name": "imo_sl_2012_A7", "problem_id": "2012_A7", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2012 A7\n\nLet $R$ be a totally ordered commutative ring and $\\sigma$ be a set of variables.\nLet $R[\\sigma]$ denote the set of multivariate polynomials in these variables. A function\n$f : R^\\sigma \\to R$ is called a **metapolynomial** if it can be represented as\n$$ f(\\mathbf{x}) = \\max_{i \\le m} \\min_{j \\le n_i} P_{i, j}(\\mathbf{x}) $$\nfor some polynomials $P_{i, j} \\in R[\\sigma]$. This set of functions is the \"meta-closure\"\nof the set of functions represented by polynomials.\n\nProve that the set of metapolynomials forms a subring of the ring of all functions\nfrom $R^\\sigma$ to $R$.\n-/", "formal_statement": "inductive BinOpClosure {\u03b1 : Type*} (op : \u03b1 \u2192 \u03b1 \u2192 \u03b1) (P : \u03b1 \u2192 Prop) : \u03b1 \u2192 Prop where\n | ofMem {a} (h : P a) : BinOpClosure op P a\n | ofOp {a b} (ha : BinOpClosure op P a) (hb : BinOpClosure op P b) : BinOpClosure op P (op a b)\n\n\ndef MetaClosure {\u03b1 : Type*} [Lattice \u03b1] (S : Set \u03b1) : Set \u03b1 :=\n {x | BinOpClosure (\u00b7 \u2294 \u00b7) (BinOpClosure (\u00b7 \u2293 \u00b7) (\u00b7 \u2208 S)) x}\n\nabbrev MvPolynomialImage (\u03c3 R : Type*) [CommRing R] : Subring ((\u03c3 \u2192 R) \u2192 R) :=\n (Pi.ringHom (MvPolynomial.eval (R := R) (\u03c3 := \u03c3))).range\n\ntheorem imo_sl_2012_A7 (\u03c3 R : Type*) [LinearOrderedCommRing R] :\n \u2203 (T : Subring ((\u03c3 \u2192 R) \u2192 R)), T.carrier = MetaClosure (MvPolynomialImage \u03c3 R).carrier := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2012 A7\n\nLet $R$ be a totally ordered commutative ring and $\\sigma$ be a set of variables.\nLet $R[\\sigma]$ denote the set of multivariate polynomials in these variables. A function\n$f : R^\\sigma \\to R$ is called a **metapolynomial** if it can be represented as\n$$ f(\\mathbf{x}) = \\max_{i \\le m} \\min_{j \\le n_i} P_{i, j}(\\mathbf{x}) $$\nfor some polynomials $P_{i, j} \\in R[\\sigma]$. This set of functions is the \"meta-closure\"\nof the set of functions represented by polynomials.\n\nProve that the set of metapolynomials forms a subring of the ring of all functions\nfrom $R^\\sigma$ to $R$.\n-/\ninductive BinOpClosure {\u03b1 : Type*} (op : \u03b1 \u2192 \u03b1 \u2192 \u03b1) (P : \u03b1 \u2192 Prop) : \u03b1 \u2192 Prop where\n | ofMem {a} (h : P a) : BinOpClosure op P a\n | ofOp {a b} (ha : BinOpClosure op P a) (hb : BinOpClosure op P b) : BinOpClosure op P (op a b)\n\n\ndef MetaClosure {\u03b1 : Type*} [Lattice \u03b1] (S : Set \u03b1) : Set \u03b1 :=\n {x | BinOpClosure (\u00b7 \u2294 \u00b7) (BinOpClosure (\u00b7 \u2293 \u00b7) (\u00b7 \u2208 S)) x}\n\nabbrev MvPolynomialImage (\u03c3 R : Type*) [CommRing R] : Subring ((\u03c3 \u2192 R) \u2192 R) :=\n (Pi.ringHom (MvPolynomial.eval (R := R) (\u03c3 := \u03c3))).range\n\ntheorem imo_sl_2012_A7 (\u03c3 R : Type*) [LinearOrderedCommRing R] :\n \u2203 (T : Subring ((\u03c3 \u2192 R) \u2192 R)), T.carrier = MetaClosure (MvPolynomialImage \u03c3 R).carrier := by sorry", "category": "algebra"} {"name": "imo_sl_2012_N1", "problem_id": "2012_N1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2012 N1\n\nLet $R$ be a commutative ring.\nA set $A \u2286 R$ is called *admissible* if $x^2 + rxy + y^2 \u2208 A$ for any $x, y \u2208 A$ and $r \u2208 R$.\nDetermine all pairs $(x, y) \u2208 R^2$ such that the only\n admissible set containing $x$ and $y$ is $R$.\n-/", "formal_statement": "def admissible [Semiring R] (A : Set R) :=\n \u2200 x y : R, x \u2208 A \u2192 y \u2208 A \u2192 \u2200 r : R, x ^ 2 + r * x * y + y ^ 2 \u2208 A\n\ntheorem imo_sl_2012_N1 [CommRing R] (x y : R) :\n (\u2200 A : Set R, admissible A \u2192 x \u2208 A \u2192 y \u2208 A \u2192 \u2200 z : R, z \u2208 A) \u2194 IsCoprime x y := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2012 N1\n\nLet $R$ be a commutative ring.\nA set $A \u2286 R$ is called *admissible* if $x^2 + rxy + y^2 \u2208 A$ for any $x, y \u2208 A$ and $r \u2208 R$.\nDetermine all pairs $(x, y) \u2208 R^2$ such that the only\n admissible set containing $x$ and $y$ is $R$.\n-/\ndef admissible [Semiring R] (A : Set R) :=\n \u2200 x y : R, x \u2208 A \u2192 y \u2208 A \u2192 \u2200 r : R, x ^ 2 + r * x * y + y ^ 2 \u2208 A\n\ntheorem imo_sl_2012_N1 [CommRing R] (x y : R) :\n (\u2200 A : Set R, admissible A \u2192 x \u2208 A \u2192 y \u2208 A \u2192 \u2200 z : R, z \u2208 A) \u2194 IsCoprime x y := by sorry", "category": "number theory"} {"name": "imo_sl_2012_N3", "problem_id": "2012_N3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2012 N3\n\nDetermine all integers $m > 1$ such that $n \u2223 \\binom{n}{m - 2n}$ for every $n \u2264 m/2$.\n-/", "formal_statement": "theorem imo_sl_2012_N3 (h : 1 < m) :\n (\u2200 n : \u2115, 2 * n \u2264 m \u2192 n \u2223 n.choose (m - 2 * n)) \u2194 m.Prime := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2012 N3\n\nDetermine all integers $m > 1$ such that $n \u2223 \\binom{n}{m - 2n}$ for every $n \u2264 m/2$.\n-/\ntheorem imo_sl_2012_N3 (h : 1 < m) :\n (\u2200 n : \u2115, 2 * n \u2264 m \u2192 n \u2223 n.choose (m - 2 * n)) \u2194 m.Prime := by sorry", "category": "number theory"} {"name": "imo_sl_2012_N4", "problem_id": "2012_N4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2012 N4\n\nAn integer $a$ is called *friendly* if there exist positive integers $m, n$ such that\n$$ (m^2 + n)(n^2 + m) = a(m - n)^3. $$\n\n1. Prove that $\\{1, 2, \\dots, 2012\\}$ contains at least $500$ friendly integers.\n2. Is $2$ friendly?\n-/", "formal_statement": "/- special open -/ open Finset Classical\n/-- An integer `a` is friendly if it satisfies the given condition for some positive integers `m` and `n`. -/\ndef IsFriendly (a : \u2124) : Prop :=\n \u2203 m > 0, \u2203 n > 0, (m ^ 2 + n) * (n ^ 2 + m) = a * (m - n) ^ 3\n\ntheorem imo_sl_2012_N4 :\n 500 \u2264 ((Icc 1 2012).filter (IsFriendly)).card \u2227\n \u00ac IsFriendly 2 := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2012 N4\n\nAn integer $a$ is called *friendly* if there exist positive integers $m, n$ such that\n$$ (m^2 + n)(n^2 + m) = a(m - n)^3. $$\n\n1. Prove that $\\{1, 2, \\dots, 2012\\}$ contains at least $500$ friendly integers.\n2. Is $2$ friendly?\n-/\n/- special open -/ open Finset Classical\n/-- An integer `a` is friendly if it satisfies the given condition for some positive integers `m` and `n`. -/\ndef IsFriendly (a : \u2124) : Prop :=\n \u2203 m > 0, \u2203 n > 0, (m ^ 2 + n) * (n ^ 2 + m) = a * (m - n) ^ 3\n\ntheorem imo_sl_2012_N4 :\n 500 \u2264 ((Icc 1 2012).filter (IsFriendly)).card \u2227\n \u00ac IsFriendly 2 := by sorry", "category": "number theory"} {"name": "imo_sl_2013_A1", "problem_id": "2013_A1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2013 A1\n\nLet $R$ be a commutative ring.\nGiven a list of elements $a_0, \\dots, a_{n-1} \\in R$, we define a sequence $(u_k)$ by\n$u_0 = u_1 = 1$, and $u_{k + 2} = u_{k + 1} + a_k u_k$ for each $0 \\le k < n$.\nWe then define the function $f(a_0, \\dots, a_{n-1}) = u_{n + 1}$.\n\nProve that $f(a_0, \\dots, a_{n-1}) = f(a_{n-1}, \\dots, a_0)$.\n-/", "formal_statement": "variable {R : Type*} [CommRing R]\n\n/--\nA helper function to compute the pair `(u_{k+1}, u_k)` recursively.\n`f_aux [a\u2080, a\u2081, ..., a_{k-1}]` returns `(u_{k+1}, u_k)`.\n-/\ndef f_aux : List R \u2192 R \u00d7 R\n | [] => (1, 1)\n | r :: l => let (a, b) := f_aux l; (a + r * b, a)\n\ndef f (l : List R) : R := (f_aux l).1\n\ntheorem imo_sl_2013_A1 (l : List R) : f l.reverse = f l := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2013 A1\n\nLet $R$ be a commutative ring.\nGiven a list of elements $a_0, \\dots, a_{n-1} \\in R$, we define a sequence $(u_k)$ by\n$u_0 = u_1 = 1$, and $u_{k + 2} = u_{k + 1} + a_k u_k$ for each $0 \\le k < n$.\nWe then define the function $f(a_0, \\dots, a_{n-1}) = u_{n + 1}$.\n\nProve that $f(a_0, \\dots, a_{n-1}) = f(a_{n-1}, \\dots, a_0)$.\n-/\nvariable {R : Type*} [CommRing R]\n\n/--\nA helper function to compute the pair `(u_{k+1}, u_k)` recursively.\n`f_aux [a\u2080, a\u2081, ..., a_{k-1}]` returns `(u_{k+1}, u_k)`.\n-/\ndef f_aux : List R \u2192 R \u00d7 R\n | [] => (1, 1)\n | r :: l => let (a, b) := f_aux l; (a + r * b, a)\n\ndef f (l : List R) : R := (f_aux l).1\n\ntheorem imo_sl_2013_A1 (l : List R) : f l.reverse = f l := by sorry", "category": "algebra"} {"name": "imo_sl_2013_A5", "problem_id": "2013_A5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2013 A5\n\nFind all functions $f : \\mathbb{N} \\to \\mathbb{N}$ such that for any $n \\in \\mathbb{N}$,\n$$ f(f(f(n))) = f(n + 1) + 1. $$\n-/", "formal_statement": "def IsGood (f : \u2115 \u2192 \u2115) : Prop :=\n \u2200 n, f^[3] n = f (n + 1) + 1\n\ndef answer2 : \u2115 \u2192 \u2115\n | 0 => 1\n | 1 => 6\n | 2 => 3\n | 3 => 0\n | n + 4 => answer2 n + 4\n\ntheorem imo_sl_2013_A5 (f : \u2115 \u2192 \u2115) :\n IsGood f \u2194 f = Nat.succ \u2228 f = answer2 := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2013 A5\n\nFind all functions $f : \\mathbb{N} \\to \\mathbb{N}$ such that for any $n \\in \\mathbb{N}$,\n$$ f(f(f(n))) = f(n + 1) + 1. $$\n-/\ndef IsGood (f : \u2115 \u2192 \u2115) : Prop :=\n \u2200 n, f^[3] n = f (n + 1) + 1\n\ndef answer2 : \u2115 \u2192 \u2115\n | 0 => 1\n | 1 => 6\n | 2 => 3\n | 3 => 0\n | n + 4 => answer2 n + 4\n\ntheorem imo_sl_2013_A5 (f : \u2115 \u2192 \u2115) :\n IsGood f \u2194 f = Nat.succ \u2228 f = answer2 := by sorry", "category": "algebra"} {"name": "imo_sl_2013_N1", "problem_id": "2013_N1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2013 N1\n\nFind all functions $f : \u2115^+ \u2192 \u2115^+$ such that, for any $m, n : \u2115^+$,\n$$ m^2 + f(n) \u2223 m f(m) + n. $$\n-/", "formal_statement": "theorem imo_sl_2013_N1 {f : \u2115+ \u2192 \u2115+} :\n (\u2200 m n : \u2115+, m * m + f n \u2223 m * f m + n) \u2194 f = id := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2013 N1\n\nFind all functions $f : \u2115^+ \u2192 \u2115^+$ such that, for any $m, n : \u2115^+$,\n$$ m^2 + f(n) \u2223 m f(m) + n. $$\n-/\ntheorem imo_sl_2013_N1 {f : \u2115+ \u2192 \u2115+} :\n (\u2200 m n : \u2115+, m * m + f n \u2223 m * f m + n) \u2194 f = id := by sorry", "category": "number theory"} {"name": "imo_sl_2013_N2", "problem_id": "2013_N2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2013 N2\n\nProve that for any positive integers $k, n$, there exist positive integers $m_1, m_2, \\dots, m_k$\nsuch that\n$$ 1 + \\frac{2^k - 1}{n} = \\prod_{i = 1}^k \\left(1 + \\frac{1}{m_i}\\right). $$\n-/", "formal_statement": "/- special open -/ open Finset\ntheorem imo_sl_2013_N2 (k n : \u2115+) :\n \u2203 (m : Fin k \u2192 \u2115+), (1 : \u211a) + ((2 : \u211a) ^ (k : \u2115) - 1) / (n : \u211a) =\n \u220f i : Fin k, (1 + 1 / (m i : \u211a)) := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2013 N2\n\nProve that for any positive integers $k, n$, there exist positive integers $m_1, m_2, \\dots, m_k$\nsuch that\n$$ 1 + \\frac{2^k - 1}{n} = \\prod_{i = 1}^k \\left(1 + \\frac{1}{m_i}\\right). $$\n-/\n/- special open -/ open Finset\ntheorem imo_sl_2013_N2 (k n : \u2115+) :\n \u2203 (m : Fin k \u2192 \u2115+), (1 : \u211a) + ((2 : \u211a) ^ (k : \u2115) - 1) / (n : \u211a) =\n \u220f i : Fin k, (1 + 1 / (m i : \u211a)) := by sorry", "category": "number theory"} {"name": "imo_sl_2013_N3", "problem_id": "2013_N3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2013 N3\n\nFor each positive integer $n$, let $P(n)$ denote the largest prime divisor of $n$.\nProve that there exists infinitely many $n \u2208 \u2115$ such that\n$$ P(n^4 + n^2 + 1) = P((n + 1)^4 + (n + 1)^2 + 1). $$\n-/", "formal_statement": "noncomputable def lpf (n : \u2115) : \u2115 :=\n ((Nat.primeFactors n).toList.maximum?).getD 1\n\ntheorem imo_sl_2013_N3 :\n \u2200 (C : \u2115), \u2203 n \u2265 C, lpf (n ^ 4 + n ^ 2 + 1)\n = lpf ((n + 1) ^ 4 + (n + 1) ^ 2 + 1) := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2013 N3\n\nFor each positive integer $n$, let $P(n)$ denote the largest prime divisor of $n$.\nProve that there exists infinitely many $n \u2208 \u2115$ such that\n$$ P(n^4 + n^2 + 1) = P((n + 1)^4 + (n + 1)^2 + 1). $$\n-/\nnoncomputable def lpf (n : \u2115) : \u2115 :=\n ((Nat.primeFactors n).toList.maximum?).getD 1\n\ntheorem imo_sl_2013_N3 :\n \u2200 (C : \u2115), \u2203 n \u2265 C, lpf (n ^ 4 + n ^ 2 + 1)\n = lpf ((n + 1) ^ 4 + (n + 1) ^ 2 + 1) := by sorry", "category": "number theory"} {"name": "imo_sl_2013_N6", "problem_id": "2013_N6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2013 N6\n\nDetermine all functions $f : \u211a \u2192 \u2124$ such that for any $x \u2208 \u211a$, $a \u2208 \u2124$, and $b \u2208 \u2115^+$,\n$$ f\\left(\\frac{f(x) + a}{b}\\right) = f\\left(\\frac{x + a}{b}\\right). $$\n-/", "formal_statement": "def good (f : \u211a \u2192 \u2124) :=\n \u2200 (x : \u211a) (a : \u2124) (b : \u2115), 0 < b \u2192 f ((f x + a) / b) = f ((x + a) / b)\n\n\ntheorem imo_sl_2013_N6 : good f \u2194 (\u2203 C, f = \u03bb _ \u21a6 C) \u2228 f = Int.floor \u2228 f = Int.ceil := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2013 N6\n\nDetermine all functions $f : \u211a \u2192 \u2124$ such that for any $x \u2208 \u211a$, $a \u2208 \u2124$, and $b \u2208 \u2115^+$,\n$$ f\\left(\\frac{f(x) + a}{b}\\right) = f\\left(\\frac{x + a}{b}\\right). $$\n-/\ndef good (f : \u211a \u2192 \u2124) :=\n \u2200 (x : \u211a) (a : \u2124) (b : \u2115), 0 < b \u2192 f ((f x + a) / b) = f ((x + a) / b)\n\n\ntheorem imo_sl_2013_N6 : good f \u2194 (\u2203 C, f = \u03bb _ \u21a6 C) \u2228 f = Int.floor \u2228 f = Int.ceil := by sorry", "category": "number theory"} {"name": "imo_sl_2014_A1", "problem_id": "2014_A1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2014 A1\n\nLet $(z_n)_{n \\ge 0}$ be an infinite sequence of positive integers.\n1. Prove that there exists a unique non-negative integer $N$ such that\n $$ N z_N < \\sum_{j = 0}^N z_j \\le (N + 1) z_{N + 1}. $$\n (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\n above is what is used in the formalization).\n2. Prove that $N$ is positive.\n3. Show that $\\binom{N}{2} < z_0$.\n-/", "formal_statement": "/- special open -/ open Finset\nvariable {z : \u2115 \u2192 \u2124}\n\n/-- `IsTheN z N` is the property that `N` satisfies the double inequality from the problem. -/\ndef IsTheN (z : \u2115 \u2192 \u2124) (N : \u2115) : Prop :=\n (N : \u2124) * z N < (\u2211 i in range (N + 1), z i) \u2227\n (\u2211 i in range (N + 1), z i) \u2264 (N + 1) * z (N + 1)\n\ntheorem imo_sl_2014_A1 (hz_pos : \u2200 n, 0 < z n) (hz_mono : StrictMono z) :\n (\u2203! N, IsTheN z N) \u2227\n (\u2200 N, IsTheN z N \u2192 0 < N \u2227 N.choose 2 < (z 0).natAbs) := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2014 A1\n\nLet $(z_n)_{n \\ge 0}$ be an infinite sequence of positive integers.\n1. Prove that there exists a unique non-negative integer $N$ such that\n $$ N z_N < \\sum_{j = 0}^N z_j \\le (N + 1) z_{N + 1}. $$\n (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\n above is what is used in the formalization).\n2. Prove that $N$ is positive.\n3. Show that $\\binom{N}{2} < z_0$.\n-/\n/- special open -/ open Finset\nvariable {z : \u2115 \u2192 \u2124}\n\n/-- `IsTheN z N` is the property that `N` satisfies the double inequality from the problem. -/\ndef IsTheN (z : \u2115 \u2192 \u2124) (N : \u2115) : Prop :=\n (N : \u2124) * z N < (\u2211 i in range (N + 1), z i) \u2227\n (\u2211 i in range (N + 1), z i) \u2264 (N + 1) * z (N + 1)\n\ntheorem imo_sl_2014_A1 (hz_pos : \u2200 n, 0 < z n) (hz_mono : StrictMono z) :\n (\u2203! N, IsTheN z N) \u2227\n (\u2200 N, IsTheN z N \u2192 0 < N \u2227 N.choose 2 < (z 0).natAbs) := by sorry", "category": "algebra"} {"name": "imo_sl_2014_A4", "problem_id": "2014_A4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2014 A4\n\nLet $b$ and $c$ be integers with $|b| > 1$ and $c \u2260 0$.\nFind all functions $f : \u2124 \u2192 \u2124$ such that, for any $x, y \u2208 \u2124$,\n$$ f(y + f(x)) - f(y) = f(bx) - f(x) + c. $$\n-/", "formal_statement": "/- special open -/ open Finset\ndef good (b c : \u2124) (f : \u2124 \u2192 \u2124) := \u2200 x y : \u2124, f (y + f x) - f y = f (b * x) - f x + c\n\ntheorem imo_sl_2014_A4 {b c : \u2124} (h : 1 < b.natAbs) (h0 : c \u2260 0) :\n good b c f \u2194 b - 1 \u2223 c \u2227 f = ((b - 1) * \u00b7 + c / (b - 1)) := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2014 A4\n\nLet $b$ and $c$ be integers with $|b| > 1$ and $c \u2260 0$.\nFind all functions $f : \u2124 \u2192 \u2124$ such that, for any $x, y \u2208 \u2124$,\n$$ f(y + f(x)) - f(y) = f(bx) - f(x) + c. $$\n-/\n/- special open -/ open Finset\ndef good (b c : \u2124) (f : \u2124 \u2192 \u2124) := \u2200 x y : \u2124, f (y + f x) - f y = f (b * x) - f x + c\n\ntheorem imo_sl_2014_A4 {b c : \u2124} (h : 1 < b.natAbs) (h0 : c \u2260 0) :\n good b c f \u2194 b - 1 \u2223 c \u2227 f = ((b - 1) * \u00b7 + c / (b - 1)) := by sorry", "category": "algebra"} {"name": "imo_sl_2014_C4", "problem_id": "2014_C4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2014 C4\n\nConsider 4 types of skew-tetrominoes in $\u2115^2$, classified by its orientation.\nLet $S \u2286 \u2115^2$ be a multiset, and suppose that it can be partitioned into skew-tetrominos.\nProve that the parity of the number of skew-tetrominoes used for\n each type in the partition does not depend on the partition.\n-/", "formal_statement": "/- special open -/ open Multiset\n/-- Base skew-tetrominoes, representing the four orientations. -/\ndef BaseSkewT4 : Fin 4 \u2192 Multiset (\u2115 \u00d7 \u2115)\n | 1 => {(0, 0), (1, 0), (1, 1), (2, 1)}\n | 2 => {(1, 0), (1, 1), (0, 1), (0, 2)}\n | 3 => {(0, 1), (1, 1), (1, 0), (2, 0)}\n | 4 => {(0, 0), (0, 1), (1, 1), (1, 2)}\n\n/-- A specific skew-tetromino piece, defined by its type and position. -/\ndef SkewT4 (q : Fin 4 \u00d7 \u2115 \u00d7 \u2115) : Multiset (\u2115 \u00d7 \u2115) :=\n (BaseSkewT4 q.1).map \u03bb p \u21a6 q.2 + p\n\n/--\nLet `P` and `Q` be two different partitions of the same shape `S` into skew-tetrominoes.\nThis is formally stated as `(map SkewT4 P).sum = (map SkewT4 Q).sum`.\nThe theorem asserts that for any type `i`, the number of tetrominoes of that type\nhas the same parity in both partitions.\n-/\ntheorem imo_sl_2014_C4 {P Q : Multiset (Fin 4 \u00d7 \u2115 \u00d7 \u2115)}\n (h : (map SkewT4 P).sum = (map SkewT4 Q).sum) (i : Fin 4) :\n (P.map Prod.fst).count i % 2 = (Q.map Prod.fst).count i % 2 := by sorry", "split": "test", "tags": ["combinatorics"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2014 C4\n\nConsider 4 types of skew-tetrominoes in $\u2115^2$, classified by its orientation.\nLet $S \u2286 \u2115^2$ be a multiset, and suppose that it can be partitioned into skew-tetrominos.\nProve that the parity of the number of skew-tetrominoes used for\n each type in the partition does not depend on the partition.\n-/\n/- special open -/ open Multiset\n/-- Base skew-tetrominoes, representing the four orientations. -/\ndef BaseSkewT4 : Fin 4 \u2192 Multiset (\u2115 \u00d7 \u2115)\n | 1 => {(0, 0), (1, 0), (1, 1), (2, 1)}\n | 2 => {(1, 0), (1, 1), (0, 1), (0, 2)}\n | 3 => {(0, 1), (1, 1), (1, 0), (2, 0)}\n | 4 => {(0, 0), (0, 1), (1, 1), (1, 2)}\n\n/-- A specific skew-tetromino piece, defined by its type and position. -/\ndef SkewT4 (q : Fin 4 \u00d7 \u2115 \u00d7 \u2115) : Multiset (\u2115 \u00d7 \u2115) :=\n (BaseSkewT4 q.1).map \u03bb p \u21a6 q.2 + p\n\n/--\nLet `P` and `Q` be two different partitions of the same shape `S` into skew-tetrominoes.\nThis is formally stated as `(map SkewT4 P).sum = (map SkewT4 Q).sum`.\nThe theorem asserts that for any type `i`, the number of tetrominoes of that type\nhas the same parity in both partitions.\n-/\ntheorem imo_sl_2014_C4 {P Q : Multiset (Fin 4 \u00d7 \u2115 \u00d7 \u2115)}\n (h : (map SkewT4 P).sum = (map SkewT4 Q).sum) (i : Fin 4) :\n (P.map Prod.fst).count i % 2 = (Q.map Prod.fst).count i % 2 := by sorry", "category": "combinatorics"} {"name": "imo_sl_2014_N2", "problem_id": "2014_N2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-\n# IMO 2014 N2\n\nDetermine all pairs $(x, y)$ of integers such that\n$$ 7x^2 - 13xy + y^2 = (|x - y| + 1)^3. $$\n-/", "formal_statement": "def good (x y : \u2124) := 7 * x ^ 2 - 13 * x * y + 7 * y ^ 2 = (|x - y| + 1) ^ 3\n\ntheorem imo_sl_2014_N2 :\n good x y \u2194 (\u2203 m, (x, y) = (m ^ 3 + 2 * m ^ 2 - m - 1, m ^ 3 + m ^ 2 - 2 * m - 1)) \u2228\n (\u2203 m, (x, y) = (m ^ 3 + m ^ 2 - 2 * m - 1, m ^ 3 + 2 * m ^ 2 - m - 1)) := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-\n# IMO 2014 N2\n\nDetermine all pairs $(x, y)$ of integers such that\n$$ 7x^2 - 13xy + y^2 = (|x - y| + 1)^3. $$\n-/\ndef good (x y : \u2124) := 7 * x ^ 2 - 13 * x * y + 7 * y ^ 2 = (|x - y| + 1) ^ 3\n\ntheorem imo_sl_2014_N2 :\n good x y \u2194 (\u2203 m, (x, y) = (m ^ 3 + 2 * m ^ 2 - m - 1, m ^ 3 + m ^ 2 - 2 * m - 1)) \u2228\n (\u2203 m, (x, y) = (m ^ 3 + m ^ 2 - 2 * m - 1, m ^ 3 + 2 * m ^ 2 - m - 1)) := by sorry", "category": "number theory"} {"name": "imo_sl_2014_N3", "problem_id": "2014_N3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2014 N3\n\nConsider a collection $C$ of coins, where each coin has a value of $1/n$ for some positive\ninteger $n$. A partition of $C$ into $N$ groups is called an *$N$-Cape Town* partition\nif the total value of coins in each group is at most $1$.\n\nProve that if the total value of all coins in $C$ is at most $N + 1/2$,\nthen $C$ has an $(N + 1)$-Cape Town partition.\n-/", "formal_statement": "/- special open -/ open Multiset\nvariable (N : \u2115) (C : Multiset \u2115)\n\n/--\nA `CapeTownPartition N C` is a partition of the multiset of coins `C` into `N + 1` groups,\nwhere the sum of the values of the coins in each group is at most 1.\n-/\nstructure CapeTownPartition where\n /-- The list of groups in the partition. -/\n part : Multiset (Multiset \u2115)\n /-- The number of groups is `N + 1`. -/\n card_part : card part = N + 1\n /-- The groups form a partition of `C`. -/\n sum_part : part.sum = C\n /-- The total value of coins in each group is at most 1. -/\n total_bound : \u2200 G \u2208 part, (G.map (fun x \u21a6 (x : \u211a)\u207b\u00b9)).sum \u2264 1\n\ntheorem imo_sl_2014_N3 (h_total_value : (C.map (fun x \u21a6 (x : \u211a)\u207b\u00b9)).sum \u2264 (N : \u211a) + 1/2) :\n Nonempty (CapeTownPartition N C) := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2014 N3\n\nConsider a collection $C$ of coins, where each coin has a value of $1/n$ for some positive\ninteger $n$. A partition of $C$ into $N$ groups is called an *$N$-Cape Town* partition\nif the total value of coins in each group is at most $1$.\n\nProve that if the total value of all coins in $C$ is at most $N + 1/2$,\nthen $C$ has an $(N + 1)$-Cape Town partition.\n-/\n/- special open -/ open Multiset\nvariable (N : \u2115) (C : Multiset \u2115)\n\n/--\nA `CapeTownPartition N C` is a partition of the multiset of coins `C` into `N + 1` groups,\nwhere the sum of the values of the coins in each group is at most 1.\n-/\nstructure CapeTownPartition where\n /-- The list of groups in the partition. -/\n part : Multiset (Multiset \u2115)\n /-- The number of groups is `N + 1`. -/\n card_part : card part = N + 1\n /-- The groups form a partition of `C`. -/\n sum_part : part.sum = C\n /-- The total value of coins in each group is at most 1. -/\n total_bound : \u2200 G \u2208 part, (G.map (fun x \u21a6 (x : \u211a)\u207b\u00b9)).sum \u2264 1\n\ntheorem imo_sl_2014_N3 (h_total_value : (C.map (fun x \u21a6 (x : \u211a)\u207b\u00b9)).sum \u2264 (N : \u211a) + 1/2) :\n Nonempty (CapeTownPartition N C) := by sorry", "category": "number theory"} {"name": "imo_sl_2014_N4", "problem_id": "2014_N4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2014 N4\n\nProve that, for any positive integer $n > 1$, there exists infinitely many\n positive integers $k$ such that $\u230an^k/k\u230b$ is odd.\n-/", "formal_statement": "theorem imo_sl_2014_N4 (hn : 1 < n) (N) : \u2203 k > N, Odd (n ^ k / k) := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2014 N4\n\nProve that, for any positive integer $n > 1$, there exists infinitely many\n positive integers $k$ such that $\u230an^k/k\u230b$ is odd.\n-/\ntheorem imo_sl_2014_N4 (hn : 1 < n) (N) : \u2203 k > N, Odd (n ^ k / k) := by sorry", "category": "number theory"} {"name": "imo_sl_2015_A1", "problem_id": "2015_A1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2015 A1\n\nLet $F$ be a totally ordered field.\nLet $(a_n)_{n \u2265 0}$ be a sequence of positive elements of $F$ such that\n $a_{k + 1} \u2265 \\dfrac{(k + 1) a_k}{a_k^2 + k}$ for all $k \u2208 \u2115$.\nProve that, for every $n \u2265 2$,\n$$ a_0 + a_1 + \u2026 + a_{n - 1} \u2265 n. $$\n\n### Further directions\n\nGeneralize to totally ordered semirings `R` with `ExistsAddOfLE R`.\n\nIf impossible, we can alternatively generalize the above sequence to\n two sequences $(a_n)_{n \u2265 0}$, $(b_n)_{n \u2265 0}$ satisfying\n $b_{k + 1} \u2264 a_k + b_k$ and $a_k b_k \u2265 k$ for all $k \u2208 \u2115$.\n-/", "formal_statement": "/- special open -/ open Finset\ntheorem imo_sl_2015_A1 [LinearOrderedField F]\n {a : \u2115 \u2192 F} (h : \u2200 k : \u2115, 0 < a k)\n (h0 : \u2200 k : \u2115, ((k.succ : F) * a k) / (a k ^ 2 + (k : F)) \u2264 a k.succ) :\n \u2200 n : \u2115, 2 \u2264 n \u2192 (n : F) \u2264 (range n).sum (fun i => a i) := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2015 A1\n\nLet $F$ be a totally ordered field.\nLet $(a_n)_{n \u2265 0}$ be a sequence of positive elements of $F$ such that\n $a_{k + 1} \u2265 \\dfrac{(k + 1) a_k}{a_k^2 + k}$ for all $k \u2208 \u2115$.\nProve that, for every $n \u2265 2$,\n$$ a_0 + a_1 + \u2026 + a_{n - 1} \u2265 n. $$\n\n### Further directions\n\nGeneralize to totally ordered semirings `R` with `ExistsAddOfLE R`.\n\nIf impossible, we can alternatively generalize the above sequence to\n two sequences $(a_n)_{n \u2265 0}$, $(b_n)_{n \u2265 0}$ satisfying\n $b_{k + 1} \u2264 a_k + b_k$ and $a_k b_k \u2265 k$ for all $k \u2208 \u2115$.\n-/\n/- special open -/ open Finset\ntheorem imo_sl_2015_A1 [LinearOrderedField F]\n {a : \u2115 \u2192 F} (h : \u2200 k : \u2115, 0 < a k)\n (h0 : \u2200 k : \u2115, ((k.succ : F) * a k) / (a k ^ 2 + (k : F)) \u2264 a k.succ) :\n \u2200 n : \u2115, 2 \u2264 n \u2192 (n : F) \u2264 (range n).sum (fun i => a i) := by sorry", "category": "algebra"} {"name": "imo_sl_2015_A2", "problem_id": "2015_A2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2015 A2\n\nFind all functions $f : \u2124 \u2192 \u2124$ such that, for any $x, y \u2208 \u2124$,\n$$ f(x - f(y)) = f(f(x)) - f(y) - 1. $$\n-/", "formal_statement": "/- special open -/ open Finset\ntheorem imo_sl_2015_A2 {f : Int \u2192 Int} :\n (\u2200 x y, f (x - f y) = f (f x) - f y - 1) \u2194 (f = \u03bb _ \u21a6 -1) \u2228 f = (\u00b7 + 1) := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2015 A2\n\nFind all functions $f : \u2124 \u2192 \u2124$ such that, for any $x, y \u2208 \u2124$,\n$$ f(x - f(y)) = f(f(x)) - f(y) - 1. $$\n-/\n/- special open -/ open Finset\ntheorem imo_sl_2015_A2 {f : Int \u2192 Int} :\n (\u2200 x y, f (x - f y) = f (f x) - f y - 1) \u2194 (f = \u03bb _ \u21a6 -1) \u2228 f = (\u00b7 + 1) := by sorry", "category": "algebra"} {"name": "imo_sl_2015_N1", "problem_id": "2015_N1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2015 N1\n\nDefine the function $f : \u2124 \u2192 \u2124$ by $f(n) = n \u230an/2\u230b$.\nFind all integers $M$ such that $f^k(M)$ is even for some $k \u2208 \u2115$.\n\n### Notes\n\nThe original formulation is slightly different.\nInstead of $f : \u2124 \u2192 \u2124$, we define $f : \u211a \u2192 \u211a$ by $f(q) = q \u230aq\u230b$.\nThen the problem asks for which $M \u2208 \u2115^+$ does there exists\n $k \u2208 \u2115$ such that $f^k(M + 1/2)$ is an integer.\n-/", "formal_statement": "/- special open -/ open Finset\nabbrev f (n : \u2124) := n * (n / 2)\n\ntheorem imo_sl_2015_N1 : (\u2203 k : \u2115, 2 \u2223 f^[k] M) \u2194 M \u2260 3 := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2015 N1\n\nDefine the function $f : \u2124 \u2192 \u2124$ by $f(n) = n \u230an/2\u230b$.\nFind all integers $M$ such that $f^k(M)$ is even for some $k \u2208 \u2115$.\n\n### Notes\n\nThe original formulation is slightly different.\nInstead of $f : \u2124 \u2192 \u2124$, we define $f : \u211a \u2192 \u211a$ by $f(q) = q \u230aq\u230b$.\nThen the problem asks for which $M \u2208 \u2115^+$ does there exists\n $k \u2208 \u2115$ such that $f^k(M + 1/2)$ is an integer.\n-/\n/- special open -/ open Finset\nabbrev f (n : \u2124) := n * (n / 2)\n\ntheorem imo_sl_2015_N1 : (\u2203 k : \u2115, 2 \u2223 f^[k] M) \u2194 M \u2260 3 := by sorry", "category": "number theory"} {"name": "imo_sl_2015_N2", "problem_id": "2015_N2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2015 N2\n\nLet $a, b \u2208 \u2115$ such that $a! + b! \u2223 a! b!$.\nProve that $3a \u2265 2b + 2$, and find all the equality cases.\n-/", "formal_statement": "/- special open -/ open Finset\ndef good (c d : \u2115) := c + d \u2223 c * d\n\ntheorem imo_sl_2015_N2 (h : good a.factorial b.factorial) :\n 2 * b + 2 \u2264 3 * a \u2227 (2 * b + 2 = 3 * a \u2194 a = 2 \u2227 b = 2 \u2228 a = 4 \u2227 b = 5) := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2015 N2\n\nLet $a, b \u2208 \u2115$ such that $a! + b! \u2223 a! b!$.\nProve that $3a \u2265 2b + 2$, and find all the equality cases.\n-/\n/- special open -/ open Finset\ndef good (c d : \u2115) := c + d \u2223 c * d\n\ntheorem imo_sl_2015_N2 (h : good a.factorial b.factorial) :\n 2 * b + 2 \u2264 3 * a \u2227 (2 * b + 2 = 3 * a \u2194 a = 2 \u2227 b = 2 \u2228 a = 4 \u2227 b = 5) := by sorry", "category": "number theory"} {"name": "imo_sl_2015_N3", "problem_id": "2015_N3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2015 N3\n\nLet $m$ and $n > 1$ be positive integers such that $k \u2223 m$ whenever $n \u2264 k < 2n$.\nProve that $L - 1$ is not a power of $2$, where\n$$ L = \\prod_{k = n}^{2n - 1} \\left(\\frac{m}{k} + 1\\right). $$\n-/", "formal_statement": "/- special open -/ open Finset\ntheorem imo_sl_2015_N3 (hm : 0 < m) (hn : 1 < n) (h : \u2200 k \u2208 Ico n (2 * n), k \u2223 m) :\n \u2200 N, \u220f k \u2208 Ico n (2 * n), (m / k + 1) \u2260 2 ^ N + 1 := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2015 N3\n\nLet $m$ and $n > 1$ be positive integers such that $k \u2223 m$ whenever $n \u2264 k < 2n$.\nProve that $L - 1$ is not a power of $2$, where\n$$ L = \\prod_{k = n}^{2n - 1} \\left(\\frac{m}{k} + 1\\right). $$\n-/\n/- special open -/ open Finset\ntheorem imo_sl_2015_N3 (hm : 0 < m) (hn : 1 < n) (h : \u2200 k \u2208 Ico n (2 * n), k \u2223 m) :\n \u2200 N, \u220f k \u2208 Ico n (2 * n), (m / k + 1) \u2260 2 ^ N + 1 := by sorry", "category": "number theory"} {"name": "imo_sl_2016_A1", "problem_id": "2016_A1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2016 A1\n\nLet $R$ be a totally ordered commutative ring.\nLet $a_1, a_2, \\dots, a_n, c \\in R$ be non-negative elements such that $a_i a_j \\ge c$\nwhenever $i \\ne j$.\nLet $r \\in R$ be an element such that $n r \\ge a_1 + a_2 + \\dots + a_n$.\nProve that\n$$ \\prod_{i = 1}^n (a_i^2 + c) \\le (r^2 + c)^n. $$\n-/", "formal_statement": "/- special open -/ open Finset\ntheorem imo_sl_2016_A1 [LinearOrderedCommRing R] (n : \u2115) (a : Fin n \u2192 R) (c r : R)\n (ha : \u2200 i, 0 \u2264 a i)\n (hc : 0 \u2264 c)\n (h_prod_ge : \u2200 i j, i \u2260 j \u2192 c \u2264 a i * a j)\n (hr_ge_avg : \u2211 i, a i \u2264 n \u2022 r) :\n \u220f i, (a i ^ 2 + c) \u2264 (r ^ 2 + c) ^ n := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2016 A1\n\nLet $R$ be a totally ordered commutative ring.\nLet $a_1, a_2, \\dots, a_n, c \\in R$ be non-negative elements such that $a_i a_j \\ge c$\nwhenever $i \\ne j$.\nLet $r \\in R$ be an element such that $n r \\ge a_1 + a_2 + \\dots + a_n$.\nProve that\n$$ \\prod_{i = 1}^n (a_i^2 + c) \\le (r^2 + c)^n. $$\n-/\n/- special open -/ open Finset\ntheorem imo_sl_2016_A1 [LinearOrderedCommRing R] (n : \u2115) (a : Fin n \u2192 R) (c r : R)\n (ha : \u2200 i, 0 \u2264 a i)\n (hc : 0 \u2264 c)\n (h_prod_ge : \u2200 i j, i \u2260 j \u2192 c \u2264 a i * a j)\n (hr_ge_avg : \u2211 i, a i \u2264 n \u2022 r) :\n \u220f i, (a i ^ 2 + c) \u2264 (r ^ 2 + c) ^ n := by sorry", "category": "algebra"} {"name": "imo_sl_2016_A4", "problem_id": "2016_A4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2016 A4\n\nLet $M$ be an integral multiplicative monoid with a cancellative, distributive addition.\nFind all functions $f : M \u2192 M$ such that, for all $x, y \u2208 M$,\n$$ x f(x^2) f(f(y)) + f(y f(x)) = f(xy) \\left(f(f(y^2)) + f(f(x^2))\\right). $$\n-/", "formal_statement": "def good [Mul M] [Add M] (f : M \u2192 M) :=\n \u2200 x y, x * f (x * x) * f (f y) + f (y * f x) = f (x * y) * (f (f (y * y)) + f (f (x * x)))\n\nclass CancelCommDistribMonoid (M) extends CancelCommMonoid M, Distrib M\n\nvariable [CancelCommDistribMonoid M]\n\ntheorem imo_sl_2016_A4 [IsCancelAdd M] {f : M \u2192 M} : good f \u2194 \u2200 x, x * f x = 1 := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2016 A4\n\nLet $M$ be an integral multiplicative monoid with a cancellative, distributive addition.\nFind all functions $f : M \u2192 M$ such that, for all $x, y \u2208 M$,\n$$ x f(x^2) f(f(y)) + f(y f(x)) = f(xy) \\left(f(f(y^2)) + f(f(x^2))\\right). $$\n-/\ndef good [Mul M] [Add M] (f : M \u2192 M) :=\n \u2200 x y, x * f (x * x) * f (f y) + f (y * f x) = f (x * y) * (f (f (y * y)) + f (f (x * x)))\n\nclass CancelCommDistribMonoid (M) extends CancelCommMonoid M, Distrib M\n\nvariable [CancelCommDistribMonoid M]\n\ntheorem imo_sl_2016_A4 [IsCancelAdd M] {f : M \u2192 M} : good f \u2194 \u2200 x, x * f x = 1 := by sorry", "category": "algebra"} {"name": "imo_sl_2016_A5a", "problem_id": "2016_A5a", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2016 A5\n\n1. Prove that, for every $n \u2208 \u2115$, there exists some $a, b \u2208 \u2115$\n such that $0 < b \u2264 \\sqrt{n} + 1$ and $b^2 n \u2264 a^2 \u2264 b^2 (n + 1)$.\n-/", "formal_statement": "theorem imo_sl_2016_A5a_part1 (n) :\n \u2203 a b, 0 < b \u2227 b \u2264 n.sqrt + 1 \u2227 b ^ 2 * n \u2264 a ^ 2 \u2227 a ^ 2 \u2264 b ^ 2 * (n + 1) := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2016 A5\n\n1. Prove that, for every $n \u2208 \u2115$, there exists some $a, b \u2208 \u2115$\n such that $0 < b \u2264 \\sqrt{n} + 1$ and $b^2 n \u2264 a^2 \u2264 b^2 (n + 1)$.\n-/\ntheorem imo_sl_2016_A5a_part1 (n) :\n \u2203 a b, 0 < b \u2227 b \u2264 n.sqrt + 1 \u2227 b ^ 2 * n \u2264 a ^ 2 \u2227 a ^ 2 \u2264 b ^ 2 * (n + 1) := by sorry", "category": "algebra"} {"name": "imo_sl_2016_A5b", "problem_id": "2016_A5b", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2016 A5\n\n2. Prove that, for infinitely many $n \u2208 \u2115$, there does not exist $a, b \u2208 \u2115$\n such that $0 < b \u2264 \\sqrt{n}$ and $b^2 n \u2264 a^2 \u2264 b^2 (n + 1)$.\n-/", "formal_statement": "theorem imo_sl_2016_A5b_part2 (N) :\n \u2203 n > N, \u00ac\u2203 a b, 0 < b \u2227 b \u2264 n.sqrt \u2227 b ^ 2 * n \u2264 a ^ 2 \u2227 a ^ 2 \u2264 b ^ 2 * (n + 1) := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2016 A5\n\n2. Prove that, for infinitely many $n \u2208 \u2115$, there does not exist $a, b \u2208 \u2115$\n such that $0 < b \u2264 \\sqrt{n}$ and $b^2 n \u2264 a^2 \u2264 b^2 (n + 1)$.\n-/\ntheorem imo_sl_2016_A5b_part2 (N) :\n \u2203 n > N, \u00ac\u2203 a b, 0 < b \u2227 b \u2264 n.sqrt \u2227 b ^ 2 * n \u2264 a ^ 2 \u2227 a ^ 2 \u2264 b ^ 2 * (n + 1) := by sorry", "category": "algebra"} {"name": "imo_sl_2016_A7", "problem_id": "2016_A7", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2016 A7\n\nLet $R$ be a ring and $S$ be a totally ordered commutative ring.\nFind all functions $f : R \\to S$ such that for any $x, y \\in R$,\n$$ f(x + y)^2 = 2 f(x) f(y) + \\max\\{f(x^2) + f(y^2), f(x^2 + y^2)\\}. $$\n-/", "formal_statement": "variable {R : Type*} [Ring R] {S : Type*} [LinearOrderedCommRing S]\n\n/-- A function `f` is a solution if it satisfies the functional equation. -/\ndef IsSolution (f : R \u2192 S) : Prop :=\n \u2200 x y : R, f (x + y) ^ 2 = 2 * f x * f y + max (f (x ^ 2) + f (y ^ 2)) (f (x ^ 2 + y ^ 2))\n\ntheorem imo_sl_2016_A7 (f : R \u2192 S) :\n IsSolution f \u2194\n (f = (fun _ \u21a6 (0 : S)) \u2228 \u2203 (phi : RingHom R S), f = phi) \u2228\n (f = (fun _ \u21a6 (-1 : S)) \u2228 \u2203 (phi : RingHom R S), f = (fun x \u21a6 phi x - 1)) := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2016 A7\n\nLet $R$ be a ring and $S$ be a totally ordered commutative ring.\nFind all functions $f : R \\to S$ such that for any $x, y \\in R$,\n$$ f(x + y)^2 = 2 f(x) f(y) + \\max\\{f(x^2) + f(y^2), f(x^2 + y^2)\\}. $$\n-/\nvariable {R : Type*} [Ring R] {S : Type*} [LinearOrderedCommRing S]\n\n/-- A function `f` is a solution if it satisfies the functional equation. -/\ndef IsSolution (f : R \u2192 S) : Prop :=\n \u2200 x y : R, f (x + y) ^ 2 = 2 * f x * f y + max (f (x ^ 2) + f (y ^ 2)) (f (x ^ 2 + y ^ 2))\n\ntheorem imo_sl_2016_A7 (f : R \u2192 S) :\n IsSolution f \u2194\n (f = (fun _ \u21a6 (0 : S)) \u2228 \u2203 (phi : RingHom R S), f = phi) \u2228\n (f = (fun _ \u21a6 (-1 : S)) \u2228 \u2203 (phi : RingHom R S), f = (fun x \u21a6 phi x - 1)) := by sorry", "category": "algebra"} {"name": "imo_sl_2016_N4", "problem_id": "2016_N4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2016 N4\n\nConsider some $k, \u2113, m, n \u2208 \u2115^+$ with $n > 1$ such that\n$$ n^k + mn^\u2113 + 1 \u2223 n^{k + \u2113} - 1. $$\nProve that one of the following holds:\n* $m = 1$ and $\u2113 = 2k$; or\n* $k = (t + 1)\u2113$ and $m(n^\u2113 - 1) = n^{t \u2113} - 1$ for some $t > 0$.\n-/", "formal_statement": "theorem imo_sl_2016_N4 (hk : 0 < k) (hl : 0 < l) (hm : 0 < m) (hn : 1 < n)\n (h : n ^ k + m * n ^ l + 1 \u2223 n ^ (k + l) - 1) :\n (m = 1 \u2227 l = 2 * k) \u2228 (\u2203 t > 0, k = (t + 1) * l \u2227 m * (n ^ l - 1) = n ^ (l * t) - 1) := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2016 N4\n\nConsider some $k, \u2113, m, n \u2208 \u2115^+$ with $n > 1$ such that\n$$ n^k + mn^\u2113 + 1 \u2223 n^{k + \u2113} - 1. $$\nProve that one of the following holds:\n* $m = 1$ and $\u2113 = 2k$; or\n* $k = (t + 1)\u2113$ and $m(n^\u2113 - 1) = n^{t \u2113} - 1$ for some $t > 0$.\n-/\ntheorem imo_sl_2016_N4 (hk : 0 < k) (hl : 0 < l) (hm : 0 < m) (hn : 1 < n)\n (h : n ^ k + m * n ^ l + 1 \u2223 n ^ (k + l) - 1) :\n (m = 1 \u2227 l = 2 * k) \u2228 (\u2203 t > 0, k = (t + 1) * l \u2227 m * (n ^ l - 1) = n ^ (l * t) - 1) := by sorry", "category": "number theory"} {"name": "imo_sl_2016_N5", "problem_id": "2016_N5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2016 N5\n\nFix some $k, a \u2208 \u2124$ with $k \u2265 0$ and $a > 0$.\nA pair $(x, y) \u2208 \u2124^2$ is called *nice* if $(k + 1) y^2 - k x^2 = a$.\nProve that the following two statements are equivalent:\n* There exists a nice pair $(x, y)$ with $x \u2265 0$ and $x^2 > a$;\n* There exists a nice pair $(x, y)$ with $x \u2265 0$ and $x^2 \u2264 a$.\n-/", "formal_statement": "def nice (k a x y : \u2124) := (k + 1) * y ^ 2 - k * x ^ 2 = a\n\ntheorem imo_sl_2016_N5 :\n (\u2203 x y, 0 \u2264 x \u2227 a < x ^ 2 \u2227 nice k a x y)\n \u2194 (\u2203 x y, 0 \u2264 x \u2227 x ^ 2 \u2264 a \u2227 nice k a x y) := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2016 N5\n\nFix some $k, a \u2208 \u2124$ with $k \u2265 0$ and $a > 0$.\nA pair $(x, y) \u2208 \u2124^2$ is called *nice* if $(k + 1) y^2 - k x^2 = a$.\nProve that the following two statements are equivalent:\n* There exists a nice pair $(x, y)$ with $x \u2265 0$ and $x^2 > a$;\n* There exists a nice pair $(x, y)$ with $x \u2265 0$ and $x^2 \u2264 a$.\n-/\ndef nice (k a x y : \u2124) := (k + 1) * y ^ 2 - k * x ^ 2 = a\n\ntheorem imo_sl_2016_N5 :\n (\u2203 x y, 0 \u2264 x \u2227 a < x ^ 2 \u2227 nice k a x y)\n \u2194 (\u2203 x y, 0 \u2264 x \u2227 x ^ 2 \u2264 a \u2227 nice k a x y) := by sorry", "category": "number theory"} {"name": "imo_sl_2017_A1", "problem_id": "2017_A1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2017 A1\n\nLet $a_1, a_2, \\dots, a_n$ and $k$ be positive integers such that the sum of the reciprocals\nof the $a_i$ is equal to $k$, i.e., $\\sum_{i=1}^n \\frac{1}{a_i} = k$.\nSuppose that at least one of the $a_i$ is greater than $1$.\n\nProve that for any totally ordered commutative semiring $R$ and any positive element $x \\in R$,\n$$ \\left(\\prod_{i=1}^n a_i\\right) (x + 1)^k < \\prod_{i=1}^n (x + a_i). $$\n-/", "formal_statement": "/- special open -/ open Finset\ntheorem imo_sl_2017_A1 [LinearOrderedField R] (n : \u2115) (a : Fin n \u2192 \u2115) (k : \u2115) (x : R)\n (ha_pos : \u2200 i, 0 < a i)\n (ha_gt_one : \u2203 i, 1 < a i)\n (hk_sum : (\u2211 i, (a i : \u211a)\u207b\u00b9) = k)\n (hx : 0 < x) :\n ((\u220f i, a i) : R) * (x + 1) ^ k < \u220f i, (x + (a i : R)) := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2017 A1\n\nLet $a_1, a_2, \\dots, a_n$ and $k$ be positive integers such that the sum of the reciprocals\nof the $a_i$ is equal to $k$, i.e., $\\sum_{i=1}^n \\frac{1}{a_i} = k$.\nSuppose that at least one of the $a_i$ is greater than $1$.\n\nProve that for any totally ordered commutative semiring $R$ and any positive element $x \\in R$,\n$$ \\left(\\prod_{i=1}^n a_i\\right) (x + 1)^k < \\prod_{i=1}^n (x + a_i). $$\n-/\n/- special open -/ open Finset\ntheorem imo_sl_2017_A1 [LinearOrderedField R] (n : \u2115) (a : Fin n \u2192 \u2115) (k : \u2115) (x : R)\n (ha_pos : \u2200 i, 0 < a i)\n (ha_gt_one : \u2203 i, 1 < a i)\n (hk_sum : (\u2211 i, (a i : \u211a)\u207b\u00b9) = k)\n (hx : 0 < x) :\n ((\u220f i, a i) : R) * (x + 1) ^ k < \u220f i, (x + (a i : R)) := by sorry", "category": "algebra"} {"name": "imo_sl_2017_A3", "problem_id": "2017_A3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2017 A3\n\nLet $S$ be a finite set, and fix some $f : S \u2192 S$.\nSuppose that, for any $g : S \u2192 S$, $$f \u2218 g \u2218 f = g \u2218 f \u2218 g \\implies g = f. $$\nProve that $f^2(S) = f(S)$.\n-/", "formal_statement": "theorem imo_sl_2017_A3 (h : \u2200 g : S \u2192 S, f \u2218 g \u2218 f = g \u2218 f \u2218 g \u2192 g = f) :\n Set.range f^[2] = Set.range f := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2017 A3\n\nLet $S$ be a finite set, and fix some $f : S \u2192 S$.\nSuppose that, for any $g : S \u2192 S$, $$f \u2218 g \u2218 f = g \u2218 f \u2218 g \\implies g = f. $$\nProve that $f^2(S) = f(S)$.\n-/\ntheorem imo_sl_2017_A3 (h : \u2200 g : S \u2192 S, f \u2218 g \u2218 f = g \u2218 f \u2218 g \u2192 g = f) :\n Set.range f^[2] = Set.range f := by sorry", "category": "algebra"} {"name": "imo_sl_2017_A4", "problem_id": "2017_A4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2017 A4\n\nLet $G$ be a totally ordered abelian group and let $D$ be a natural number.\nA sequence $(a_n)_{n \\ge 0}$ of elements of $G$ satisfies the following properties:\n* for any $i, j \\in \\mathbb{N}$ with $i + j \\ge D$, we have $a_{i + j + 1} \\le -a_i - a_j$,\n* for any $n \\ge D$, there exists $i, j \\in \\mathbb{N}$ such that\n $i + j = n$ and $a_{n + 1} = -a_i - a_j$.\n\nProve that $(a_n)_{n \\ge 0}$ is bounded. Explicitly, prove that for all $n$,\n$|a_n| \\le 2 \\max\\{B, C - B\\}$, where\n$B = \\max_{k \\le D} a_k$ and $C = \\max_{k \\le D} (-a_k)$.\n-/", "formal_statement": "variable {G : Type*} [LinearOrderedAddCommGroup G]\n\ndef seqMax (a : \u2115 \u2192 G) (n : \u2115) : G :=\n if h : n = 0 then\n a 0\n else\n max (seqMax a (n-1)) (a n)\n\ndef IsGood1 (D : \u2115) (a : \u2115 \u2192 G) : Prop :=\n \u2200 i j : \u2115, D \u2264 i + j \u2192 a (i + j + 1) \u2264 -(a i) - (a j)\n\ndef IsGood2 (D : \u2115) (a : \u2115 \u2192 G) : Prop :=\n \u2200 n \u2265 D, \u2203 i j : \u2115, i + j = n \u2227 a (n + 1) = -(a i) - (a j)\n\ntheorem imo_sl_2017_A4 (D : \u2115) (a : \u2115 \u2192 G) (h1 : IsGood1 D a) (h2 : IsGood2 D a) (n : \u2115) :\n |a n| \u2264 max ((2 : \u2115) \u2022 seqMax a D) ((2 : \u2115) \u2022 (seqMax (fun i => -a i) D - seqMax a D)) := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2017 A4\n\nLet $G$ be a totally ordered abelian group and let $D$ be a natural number.\nA sequence $(a_n)_{n \\ge 0}$ of elements of $G$ satisfies the following properties:\n* for any $i, j \\in \\mathbb{N}$ with $i + j \\ge D$, we have $a_{i + j + 1} \\le -a_i - a_j$,\n* for any $n \\ge D$, there exists $i, j \\in \\mathbb{N}$ such that\n $i + j = n$ and $a_{n + 1} = -a_i - a_j$.\n\nProve that $(a_n)_{n \\ge 0}$ is bounded. Explicitly, prove that for all $n$,\n$|a_n| \\le 2 \\max\\{B, C - B\\}$, where\n$B = \\max_{k \\le D} a_k$ and $C = \\max_{k \\le D} (-a_k)$.\n-/\nvariable {G : Type*} [LinearOrderedAddCommGroup G]\n\ndef seqMax (a : \u2115 \u2192 G) (n : \u2115) : G :=\n if h : n = 0 then\n a 0\n else\n max (seqMax a (n-1)) (a n)\n\ndef IsGood1 (D : \u2115) (a : \u2115 \u2192 G) : Prop :=\n \u2200 i j : \u2115, D \u2264 i + j \u2192 a (i + j + 1) \u2264 -(a i) - (a j)\n\ndef IsGood2 (D : \u2115) (a : \u2115 \u2192 G) : Prop :=\n \u2200 n \u2265 D, \u2203 i j : \u2115, i + j = n \u2227 a (n + 1) = -(a i) - (a j)\n\ntheorem imo_sl_2017_A4 (D : \u2115) (a : \u2115 \u2192 G) (h1 : IsGood1 D a) (h2 : IsGood2 D a) (n : \u2115) :\n |a n| \u2264 max ((2 : \u2115) \u2022 seqMax a D) ((2 : \u2115) \u2022 (seqMax (fun i => -a i) D - seqMax a D)) := by sorry", "category": "algebra"} {"name": "imo_sl_2017_A6", "problem_id": "2017_A6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2017 A6\n\nLet $R$ be a ring, $G$ be an abelian (additive) group, and $\\iota : G \\to R$ be a group\nhomomorphism. Find all functions $f : R \\to G$ such that for any $x, y \\in R$,\n$$ f(\\iota(f(x)) \\iota(f(y))) + f(x + y) = f(xy). $$\n-/", "formal_statement": "variable {R G : Type*}\n\ndef IsGoodFun [Ring R] [AddCommGroup G] (\u03b9 : G \u2192+ R) (f : R \u2192 G) : Prop :=\n \u2200 x y : R, f (\u03b9 (f x) * \u03b9 (f y)) + f (x + y) = f (x * y)\n\n@[ext] structure CentralInvolutive (R : Type*) [Ring R] where\n val : R\n val_mul_self_eq_one : val * val = 1\n val_mul_comm (x : R) : x * val = val * x\n\ntheorem imo_sl_2017_A6 [Ring R] [AddCommGroup G]\n (hG2 : \u2200 x y : G, 2 \u2022 x = 2 \u2022 y \u2192 x = y)\n (hG3 : \u2200 x y : G, 3 \u2022 x = 3 \u2022 y \u2192 x = y)\n (\u03b9 : G \u2192+ R) (f : R \u2192 G) :\n IsGoodFun \u03b9 f \u2194\n \u2203 (rc : RingCon R) (a : CentralInvolutive (rc.Quotient))\n (phi : {\u03c8 : rc.Quotient \u2192+ G // \u2200 x, rc.toQuotient (\u03b9 (\u03c8 x)) = x}),\n f = fun x \u21a6 phi.1 (a.val * (rc.toQuotient (1 - x))) := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2017 A6\n\nLet $R$ be a ring, $G$ be an abelian (additive) group, and $\\iota : G \\to R$ be a group\nhomomorphism. Find all functions $f : R \\to G$ such that for any $x, y \\in R$,\n$$ f(\\iota(f(x)) \\iota(f(y))) + f(x + y) = f(xy). $$\n-/\nvariable {R G : Type*}\n\ndef IsGoodFun [Ring R] [AddCommGroup G] (\u03b9 : G \u2192+ R) (f : R \u2192 G) : Prop :=\n \u2200 x y : R, f (\u03b9 (f x) * \u03b9 (f y)) + f (x + y) = f (x * y)\n\n@[ext] structure CentralInvolutive (R : Type*) [Ring R] where\n val : R\n val_mul_self_eq_one : val * val = 1\n val_mul_comm (x : R) : x * val = val * x\n\ntheorem imo_sl_2017_A6 [Ring R] [AddCommGroup G]\n (hG2 : \u2200 x y : G, 2 \u2022 x = 2 \u2022 y \u2192 x = y)\n (hG3 : \u2200 x y : G, 3 \u2022 x = 3 \u2022 y \u2192 x = y)\n (\u03b9 : G \u2192+ R) (f : R \u2192 G) :\n IsGoodFun \u03b9 f \u2194\n \u2203 (rc : RingCon R) (a : CentralInvolutive (rc.Quotient))\n (phi : {\u03c8 : rc.Quotient \u2192+ G // \u2200 x, rc.toQuotient (\u03b9 (\u03c8 x)) = x}),\n f = fun x \u21a6 phi.1 (a.val * (rc.toQuotient (1 - x))) := by sorry", "category": "algebra"} {"name": "imo_sl_2017_A7", "problem_id": "2017_A7", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2017 A7\n\nLet $(b_n)_{n \\ge 0}$ be a sequence of positive integers.\nLet $(a_n)_{n \\ge 0}$ be a sequence of integers defined by $a_0 = 0$, $a_1 = 1$, and\nfor $n \\ge 0$:\n- $a_{n + 2} = a_{n + 1} b_{n + 1} + a_n$ if $b_n = 1$;\n- $a_{n + 2} = a_{n + 1} b_{n + 1} - a_n$ if $b_n > 1$.\n\nProve that $\\max\\{a_n, a_{n + 1}\\} \\ge n$ for any $n \\ge 0$.\n-/", "formal_statement": "def a (b : \u2115 \u2192 \u2124) : \u2115 \u2192 \u2124\n | 0 => 0\n | 1 => 1\n | n + 2 => a b (n + 1) * b (n + 1) + a b n * if b n = 1 then 1 else -1\n\ntheorem imo_sl_2017_A7 (b : \u2115 \u2192 \u2124) (b_pos : \u2200 n, 0 < b n) (n : \u2115) :\n (n : \u2124) \u2264 a b n \u2228 (n : \u2124) \u2264 a b (n + 1) := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2017 A7\n\nLet $(b_n)_{n \\ge 0}$ be a sequence of positive integers.\nLet $(a_n)_{n \\ge 0}$ be a sequence of integers defined by $a_0 = 0$, $a_1 = 1$, and\nfor $n \\ge 0$:\n- $a_{n + 2} = a_{n + 1} b_{n + 1} + a_n$ if $b_n = 1$;\n- $a_{n + 2} = a_{n + 1} b_{n + 1} - a_n$ if $b_n > 1$.\n\nProve that $\\max\\{a_n, a_{n + 1}\\} \\ge n$ for any $n \\ge 0$.\n-/\ndef a (b : \u2115 \u2192 \u2124) : \u2115 \u2192 \u2124\n | 0 => 0\n | 1 => 1\n | n + 2 => a b (n + 1) * b (n + 1) + a b n * if b n = 1 then 1 else -1\n\ntheorem imo_sl_2017_A7 (b : \u2115 \u2192 \u2124) (b_pos : \u2200 n, 0 < b n) (n : \u2115) :\n (n : \u2124) \u2264 a b n \u2228 (n : \u2124) \u2264 a b (n + 1) := by sorry", "category": "algebra"} {"name": "imo_sl_2017_A8", "problem_id": "2017_A8", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2017 A8\n\nLet $G$ be a totally ordered abelian group. We are interested in functions $f : G \\to G$\nthat satisfy the following property: for any $x, y \\in G$,\n$$ \\text{if } f(x) + y < f(y) + x, \\text{ then } f(x) + y \\le 0 \\le f(y) + x. $$\n\nThe problem is to show that if $G$ is densely ordered, then every function $f$ with the\nabove property also satisfies:\n$$ f(y) + x \\le f(x) + y \\quad \\text{for all } x, y \\in G \\text{ with } x \\le y. $$\n\n-/", "formal_statement": "def IsGood {G : Type*} [AddCommGroup G] [LinearOrder G] (f : G \u2192 G) : Prop :=\n \u2200 x y : G, f x + y < f y + x \u2192 f x + y \u2264 0 \u2227 0 \u2264 f y + x\n\ntheorem imo_sl_2017_A8 {G : Type*} [AddCommGroup G] [LinearOrder G] :\n (\u2200 (f : G \u2192 G), IsGood f \u2192 (\u2200 x y, x \u2264 y \u2192 f y + x \u2264 f x + y)) \u2194 DenselyOrdered G := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2017 A8\n\nLet $G$ be a totally ordered abelian group. We are interested in functions $f : G \\to G$\nthat satisfy the following property: for any $x, y \\in G$,\n$$ \\text{if } f(x) + y < f(y) + x, \\text{ then } f(x) + y \\le 0 \\le f(y) + x. $$\n\nThe problem is to show that if $G$ is densely ordered, then every function $f$ with the\nabove property also satisfies:\n$$ f(y) + x \\le f(x) + y \\quad \\text{for all } x, y \\in G \\text{ with } x \\le y. $$\n\n-/\ndef IsGood {G : Type*} [AddCommGroup G] [LinearOrder G] (f : G \u2192 G) : Prop :=\n \u2200 x y : G, f x + y < f y + x \u2192 f x + y \u2264 0 \u2227 0 \u2264 f y + x\n\ntheorem imo_sl_2017_A8 {G : Type*} [AddCommGroup G] [LinearOrder G] :\n (\u2200 (f : G \u2192 G), IsGood f \u2192 (\u2200 x y, x \u2264 y \u2192 f y + x \u2264 f x + y)) \u2194 DenselyOrdered G := by sorry", "category": "algebra"} {"name": "imo_sl_2017_C1", "problem_id": "2017_C1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2017 C1\n\nA rectangle in $\u2115^2$ is a subset of form $\\{a, a + 1, \u2026, a + w - 1\\}\n \u00d7 \\{b, b + 1, \u2026, b + h - 1\\}$ for some $a, b, w, h \u2208 \u2115$.\nGiven such rectangle, the quantity $w$ and $h$ are called the\n *width* and *height* of the rectangle, respectively.\n\nA rectangle $R$ in $\u2115^2$ with odd width and height is\n partitioned into small rectangles.\nProve that there exists a small rectangle $R'$ with the following property:\n the distances from the sides of $R'$ to the respective sides\n of $R$ all have the same parity.\n-/", "formal_statement": "/- special open -/ open Finset\ndef latticeRect (q : (\u2115 \u00d7 \u2115) \u00d7 \u2115 \u00d7 \u2115) : Finset (\u2115 \u00d7 \u2115) :=\n Ico q.1.1 (q.1.1 + q.2.1) \u00d7\u02e2 Ico q.1.2 (q.1.2 + q.2.2)\n\ntheorem imo_sl_2017_C1 {I : Finset \u03b9}\n (h : (I : Set \u03b9).PairwiseDisjoint (latticeRect \u2218 Q))\n (h0 : m.bodd = true \u2227 n.bodd = true)\n (h1 : latticeRect \u27e8\u27e80, 0\u27e9, \u27e8m, n\u27e9\u27e9 = I.disjiUnion (latticeRect \u2218 Q) h) :\n \u2203 i \u2208 I, ((Q i).2.1.bodd = true \u2227 (Q i).2.2.bodd = true)\n \u2227 ((Q i).1.1 + (Q i).1.2).bodd = false := by sorry", "split": "test", "tags": ["combinatorics"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2017 C1\n\nA rectangle in $\u2115^2$ is a subset of form $\\{a, a + 1, \u2026, a + w - 1\\}\n \u00d7 \\{b, b + 1, \u2026, b + h - 1\\}$ for some $a, b, w, h \u2208 \u2115$.\nGiven such rectangle, the quantity $w$ and $h$ are called the\n *width* and *height* of the rectangle, respectively.\n\nA rectangle $R$ in $\u2115^2$ with odd width and height is\n partitioned into small rectangles.\nProve that there exists a small rectangle $R'$ with the following property:\n the distances from the sides of $R'$ to the respective sides\n of $R$ all have the same parity.\n-/\n/- special open -/ open Finset\ndef latticeRect (q : (\u2115 \u00d7 \u2115) \u00d7 \u2115 \u00d7 \u2115) : Finset (\u2115 \u00d7 \u2115) :=\n Ico q.1.1 (q.1.1 + q.2.1) \u00d7\u02e2 Ico q.1.2 (q.1.2 + q.2.2)\n\ntheorem imo_sl_2017_C1 {I : Finset \u03b9}\n (h : (I : Set \u03b9).PairwiseDisjoint (latticeRect \u2218 Q))\n (h0 : m.bodd = true \u2227 n.bodd = true)\n (h1 : latticeRect \u27e8\u27e80, 0\u27e9, \u27e8m, n\u27e9\u27e9 = I.disjiUnion (latticeRect \u2218 Q) h) :\n \u2203 i \u2208 I, ((Q i).2.1.bodd = true \u2227 (Q i).2.2.bodd = true)\n \u2227 ((Q i).1.1 + (Q i).1.2).bodd = false := by sorry", "category": "combinatorics"} {"name": "imo_sl_2017_N1", "problem_id": "2017_N1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2017 N1 (P1)\n\nFor each $n \u2208 \u2115$, define $f(n)$ by $\\sqrt{n}$ if $n$ is a square and $n + 3$ otherwise.\nFind all $N \u2208 \u2115$ such that $\\{n : f^n(N) = a\\}$ is infinite for some $a \u2208 \u2115$.\n\n-/", "formal_statement": "/- special open -/ open Finset\ndef f (p k : \u2115) : \u2115 := if k.sqrt ^ 2 = k then k.sqrt else k + p\n\ndef good (p N : \u2115) := \u2203 a, \u2200 m, \u2203 n \u2265 m, (f p)^[n] N = a\n\ntheorem imo_sl_2017_N1 : good 3 N \u2194 N = 1 \u2228 3 \u2223 N := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2017 N1 (P1)\n\nFor each $n \u2208 \u2115$, define $f(n)$ by $\\sqrt{n}$ if $n$ is a square and $n + 3$ otherwise.\nFind all $N \u2208 \u2115$ such that $\\{n : f^n(N) = a\\}$ is infinite for some $a \u2208 \u2115$.\n\n-/\n/- special open -/ open Finset\ndef f (p k : \u2115) : \u2115 := if k.sqrt ^ 2 = k then k.sqrt else k + p\n\ndef good (p N : \u2115) := \u2203 a, \u2200 m, \u2203 n \u2265 m, (f p)^[n] N = a\n\ntheorem imo_sl_2017_N1 : good 3 N \u2194 N = 1 \u2228 3 \u2223 N := by sorry", "category": "number theory"} {"name": "imo_sl_2017_N3", "problem_id": "2017_N3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2017 N3\n\nLet $n > 1$ be an integer.\nA *special $n$-tuple* is an $n$-tuple $\\mathbf{a} = (a_0, a_1, \u2026, a_{n - 1})$ of integers\n such that there exists an indexing function $f : [n] \u2192 [n]$ such that for all $i$,\n$$ n \u2223 a_i + a_{i + 1} + \u2026 + a_{i + f(i)}. $$\nDetermine all $n > 1$ such that any special $n$-tuple $\\mathbf{a}$ satisfies\n$$ n \u2223 a_0 + a_1 + \u2026 + a_{n-1}. $$\n-/", "formal_statement": "/- special open -/ open Finset Function\nstructure SpecialTuple (n : \u2115) where\n toFun : Fin n.pred.succ \u2192 \u2124\n jump_shift : Fin n.pred.succ \u2192 Fin n.pred.succ\n jump_shift_spec : \u2200 i, (n : \u2124) \u2223 \u2211 j \u2208 Ico i.1 (i.1 + ((jump_shift i).1 + 1)), toFun j\n\ndef sum (X : SpecialTuple n) : \u2124 := \u2211 i, X.toFun i\n\ntheorem imo_sl_2017_N3 (hn : 1 < n) : (\u2200 X : SpecialTuple n, (n : \u2124) \u2223 sum X) \u2194 n.Prime := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2017 N3\n\nLet $n > 1$ be an integer.\nA *special $n$-tuple* is an $n$-tuple $\\mathbf{a} = (a_0, a_1, \u2026, a_{n - 1})$ of integers\n such that there exists an indexing function $f : [n] \u2192 [n]$ such that for all $i$,\n$$ n \u2223 a_i + a_{i + 1} + \u2026 + a_{i + f(i)}. $$\nDetermine all $n > 1$ such that any special $n$-tuple $\\mathbf{a}$ satisfies\n$$ n \u2223 a_0 + a_1 + \u2026 + a_{n-1}. $$\n-/\n/- special open -/ open Finset Function\nstructure SpecialTuple (n : \u2115) where\n toFun : Fin n.pred.succ \u2192 \u2124\n jump_shift : Fin n.pred.succ \u2192 Fin n.pred.succ\n jump_shift_spec : \u2200 i, (n : \u2124) \u2223 \u2211 j \u2208 Ico i.1 (i.1 + ((jump_shift i).1 + 1)), toFun j\n\ndef sum (X : SpecialTuple n) : \u2124 := \u2211 i, X.toFun i\n\ntheorem imo_sl_2017_N3 (hn : 1 < n) : (\u2200 X : SpecialTuple n, (n : \u2124) \u2223 sum X) \u2194 n.Prime := by sorry", "category": "number theory"} {"name": "imo_sl_2017_N6", "problem_id": "2017_N6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2017 N6\n\nA multiset $S$ of positive rational numbers is called *nice* if\n both $\\sum_{q \u2208 S} q$ and $\\sum_{q \u2208 S} 1/q$ are integers.\nFind all $n \u2208 \u2115$ such that there exists infinitely many nice multisets $S$ of size $n$.\n-/", "formal_statement": "/- special open -/ open Multiset\nstructure nice (S : Multiset \u211a) : Prop where\n pos : \u2200 q : \u211a, q \u2208 S \u2192 0 < q\n sum_eq_int : \u2203 k : \u2124, S.sum = k\n sum_inv_eq_int : \u2203 k : \u2124, (S.map (\u00b7\u207b\u00b9)).sum = k\n\ndef good (n : \u2115) := {S : Multiset \u211a | card S = n \u2227 nice S}.Infinite\n\n\ntheorem imo_sl_2017_N6 : good n \u2194 3 \u2264 n := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2017 N6\n\nA multiset $S$ of positive rational numbers is called *nice* if\n both $\\sum_{q \u2208 S} q$ and $\\sum_{q \u2208 S} 1/q$ are integers.\nFind all $n \u2208 \u2115$ such that there exists infinitely many nice multisets $S$ of size $n$.\n-/\n/- special open -/ open Multiset\nstructure nice (S : Multiset \u211a) : Prop where\n pos : \u2200 q : \u211a, q \u2208 S \u2192 0 < q\n sum_eq_int : \u2203 k : \u2124, S.sum = k\n sum_inv_eq_int : \u2203 k : \u2124, (S.map (\u00b7\u207b\u00b9)).sum = k\n\ndef good (n : \u2115) := {S : Multiset \u211a | card S = n \u2227 nice S}.Infinite\n\n\ntheorem imo_sl_2017_N6 : good n \u2194 3 \u2264 n := by sorry", "category": "number theory"} {"name": "imo_sl_2018_A2", "problem_id": "2018_A2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2018 A2 (P2)\n\nLet $R$ be a totally ordered commutative ring.\nFind all periodic sequences $(a_k)_{k \u2265 0}$ such that for any $k \u2265 0$,\n$$ a_{k + 2} = a_k a_{k + 1} + 1. $$\n\nOriginal problem: Find all possible periods of such sequence.\n-/", "formal_statement": "/- special open -/ open Finset\ndef good [NonAssocSemiring R] (a : \u2115 \u2192 R) := \u2200 k, a (k + 2) = a k * a (k + 1) + 1\n\nvariable (R) [NonAssocRing R] (d : Fin 3)\n\ndef stdGoodSeq : \u2115 \u2192 R := \u03bb n \u21a6 ![2, -1, -1] (n + d)\n\nvariable [LinearOrderedCommRing R] {a : \u2115 \u2192 R} (ha : good a) (hn : a.Periodic (n + 1))\n\ntheorem imo_sl_2018_A2 [LinearOrderedCommRing R] {n : \u2115} :\n (\u2203 a : \u2115 \u2192 R, good a \u2227 a.Periodic (n + 1)) \u2194 3 \u2223 n + 1 := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2018 A2 (P2)\n\nLet $R$ be a totally ordered commutative ring.\nFind all periodic sequences $(a_k)_{k \u2265 0}$ such that for any $k \u2265 0$,\n$$ a_{k + 2} = a_k a_{k + 1} + 1. $$\n\nOriginal problem: Find all possible periods of such sequence.\n-/\n/- special open -/ open Finset\ndef good [NonAssocSemiring R] (a : \u2115 \u2192 R) := \u2200 k, a (k + 2) = a k * a (k + 1) + 1\n\nvariable (R) [NonAssocRing R] (d : Fin 3)\n\ndef stdGoodSeq : \u2115 \u2192 R := \u03bb n \u21a6 ![2, -1, -1] (n + d)\n\nvariable [LinearOrderedCommRing R] {a : \u2115 \u2192 R} (ha : good a) (hn : a.Periodic (n + 1))\n\ntheorem imo_sl_2018_A2 [LinearOrderedCommRing R] {n : \u2115} :\n (\u2203 a : \u2115 \u2192 R, good a \u2227 a.Periodic (n + 1)) \u2194 3 \u2223 n + 1 := by sorry", "category": "algebra"} {"name": "imo_sl_2018_C1", "problem_id": "2018_C1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2018 C1\n\nLet $n \u2265 4$ be an integer and $S \u2286 \u2115^+$.\nWe say that $S$ is *good* if for each $m \u2208 \u2115$ with $2 \u2264 m \u2264 n - 2$, there exists\n $T \u2286 S$ of size $m$ such that the sum of all elements in $T$ and $S \\ T$ are equal.\nProve that for any $n \u2265 4$, there exists a good set of size $n$.\n-/", "formal_statement": "/- special open -/ open Finset\ndef good (S : Finset \u2115) :=\n \u2200 m \u2265 2, m + 2 \u2264 S.card \u2192 \u2203 T \u2286 S, T.card = m \u2227 T.sum id = (S \\ T).sum id\n\ntheorem imo_sl_2018_C1 (n : \u2115) : \u2203 S : Finset \u2115, S.card = n \u2227 (\u2200 x \u2208 S, 0 < x) \u2227 good S := by sorry", "split": "test", "tags": ["combinatorics"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2018 C1\n\nLet $n \u2265 4$ be an integer and $S \u2286 \u2115^+$.\nWe say that $S$ is *good* if for each $m \u2208 \u2115$ with $2 \u2264 m \u2264 n - 2$, there exists\n $T \u2286 S$ of size $m$ such that the sum of all elements in $T$ and $S \\ T$ are equal.\nProve that for any $n \u2265 4$, there exists a good set of size $n$.\n-/\n/- special open -/ open Finset\ndef good (S : Finset \u2115) :=\n \u2200 m \u2265 2, m + 2 \u2264 S.card \u2192 \u2203 T \u2286 S, T.card = m \u2227 T.sum id = (S \\ T).sum id\n\ntheorem imo_sl_2018_C1 (n : \u2115) : \u2203 S : Finset \u2115, S.card = n \u2227 (\u2200 x \u2208 S, 0 < x) \u2227 good S := by sorry", "category": "combinatorics"} {"name": "imo_sl_2018_N2", "problem_id": "2018_N2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2018 N2\n\nLet $n$ and $k$ be positive integers.\nConsider an $k \u00d7 k$ table, where each cell contains an integer $1 \\pmod{n}$.\nSuppose that the sum of all numbers in an arbitrary row or column is $k \\pmod{n^2}$.\nFor each $i \u2264 n$, let $R_i$ and $C_i$ be the product of\n numbers in the $i$th row and $i$th column, respectively.\nProve that\n$$ \\sum_{i = 1}^n R_i \u2261 \\sum_{i = 1}^n C_i \\pmod{n^4}. $$\n-/", "formal_statement": "/- special open -/ open Finset\ntheorem imo_sl_2018_N2 {n : \u2124} {f : \u03b9 \u2192 \u03b9 \u2192 \u2124} (h : \u2200 i \u2208 S, \u2200 j \u2208 S, f i j \u2261 1 [ZMOD n])\n (h0 : \u2200 i \u2208 S, \u2211 j \u2208 S, f i j \u2261 S.card [ZMOD n ^ 2])\n (h1 : \u2200 j \u2208 S, \u2211 i \u2208 S, f i j \u2261 S.card [ZMOD n ^ 2]) :\n (S.sum \u03bb i \u21a6 \u220f j \u2208 S, f i j) \u2261 (S.sum \u03bb j \u21a6 \u220f i \u2208 S, f i j) [ZMOD n ^ 4] := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2018 N2\n\nLet $n$ and $k$ be positive integers.\nConsider an $k \u00d7 k$ table, where each cell contains an integer $1 \\pmod{n}$.\nSuppose that the sum of all numbers in an arbitrary row or column is $k \\pmod{n^2}$.\nFor each $i \u2264 n$, let $R_i$ and $C_i$ be the product of\n numbers in the $i$th row and $i$th column, respectively.\nProve that\n$$ \\sum_{i = 1}^n R_i \u2261 \\sum_{i = 1}^n C_i \\pmod{n^4}. $$\n-/\n/- special open -/ open Finset\ntheorem imo_sl_2018_N2 {n : \u2124} {f : \u03b9 \u2192 \u03b9 \u2192 \u2124} (h : \u2200 i \u2208 S, \u2200 j \u2208 S, f i j \u2261 1 [ZMOD n])\n (h0 : \u2200 i \u2208 S, \u2211 j \u2208 S, f i j \u2261 S.card [ZMOD n ^ 2])\n (h1 : \u2200 j \u2208 S, \u2211 i \u2208 S, f i j \u2261 S.card [ZMOD n ^ 2]) :\n (S.sum \u03bb i \u21a6 \u220f j \u2208 S, f i j) \u2261 (S.sum \u03bb j \u21a6 \u220f i \u2208 S, f i j) [ZMOD n ^ 4] := by sorry", "category": "number theory"} {"name": "imo_sl_2018_N4", "problem_id": "2018_N4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2018 N4 (P5)\n\nLet $(a_n)_{n \u2265 1}$ be a sequence of positive integers such that for $n$ large enough,\n$$ \\frac{a_1}{a_2} + \\frac{a_2}{a_3} + \u2026 + \\frac{a_{n - 1}}{a_n} + \\frac{a_n}{a_1} \u2208 \u2124. $$\nProve that $(a_n)_{n \u2265 1}$ is eventually constant.\n-/", "formal_statement": "/- special open -/ open Finset\ntheorem imo_sl_2018_N4 {a : \u2115 \u2192 \u2115} (ha : \u2200 n, 0 < a n)\n (ha0 : \u2203 K, \u2200 n \u2265 K, \u2203 z : \u2124, (z : \u211a) =\n (\u2211 i \u2208 Finset.range n, (a i : \u211a) / a (i + 1)) + a n / a 0) :\n \u2203 C N, \u2200 n, a (n + N) = C := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2018 N4 (P5)\n\nLet $(a_n)_{n \u2265 1}$ be a sequence of positive integers such that for $n$ large enough,\n$$ \\frac{a_1}{a_2} + \\frac{a_2}{a_3} + \u2026 + \\frac{a_{n - 1}}{a_n} + \\frac{a_n}{a_1} \u2208 \u2124. $$\nProve that $(a_n)_{n \u2265 1}$ is eventually constant.\n-/\n/- special open -/ open Finset\ntheorem imo_sl_2018_N4 {a : \u2115 \u2192 \u2115} (ha : \u2200 n, 0 < a n)\n (ha0 : \u2203 K, \u2200 n \u2265 K, \u2203 z : \u2124, (z : \u211a) =\n (\u2211 i \u2208 Finset.range n, (a i : \u211a) / a (i + 1)) + a n / a 0) :\n \u2203 C N, \u2200 n, a (n + N) = C := by sorry", "category": "number theory"} {"name": "imo_sl_2018_N5", "problem_id": "2018_N5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2018 N5\n\nDetermine whether there exists $x, y, z, t \u2208 \u2115^+$ such that\n $xy - zt = x + y = z + t$ and both $xy$ and $zt$ are perfect squares.\n-/", "formal_statement": "/- special open -/ open Finset\ndef good (v : Fin 4 \u2192 \u2124) := v 0 * v 1 - v 2 * v 3 = v 0 + v 1 \u2227 v 0 + v 1 = v 2 + v 3\n\nvariable (hv : good v)\n\ntheorem imo_sl_2018_N5 (hv0 : \u2200 i, v i \u2260 0) :\n \u00ac((\u2203 x, v 0 * v 1 = x ^ 2) \u2227 \u2203 y, v 2 * v 3 = y ^ 2) := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2018 N5\n\nDetermine whether there exists $x, y, z, t \u2208 \u2115^+$ such that\n $xy - zt = x + y = z + t$ and both $xy$ and $zt$ are perfect squares.\n-/\n/- special open -/ open Finset\ndef good (v : Fin 4 \u2192 \u2124) := v 0 * v 1 - v 2 * v 3 = v 0 + v 1 \u2227 v 0 + v 1 = v 2 + v 3\n\nvariable (hv : good v)\n\ntheorem imo_sl_2018_N5 (hv0 : \u2200 i, v i \u2260 0) :\n \u00ac((\u2203 x, v 0 * v 1 = x ^ 2) \u2227 \u2203 y, v 2 * v 3 = y ^ 2) := by sorry", "category": "number theory"} {"name": "imo_sl_2018_N6", "problem_id": "2018_N6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2018 N6\n\nLet $f : \\mathbb{N}^+ \\to \\mathbb{N}^+$ be a function such that $f(m + n)$ divides $f(m) + f(n)$\nfor all $m, n \\in \\mathbb{N}^+$.\n\nProve that there exists $n_0 \\in \\mathbb{N}^+$ such that $f(n_0)$ divides $f(n)$ for all\n$n \\in \\mathbb{N}^+$.\n-/", "formal_statement": "def IsGood (f : \u2115+ \u2192 \u2115+) : Prop :=\n \u2200 m n, f (m + n) \u2223 f m + f n\n\ntheorem imo_sl_2018_N6 (f : \u2115+ \u2192 \u2115+) (hf : IsGood f) :\n \u2203 n\u2080, \u2200 n, f n\u2080 \u2223 f n := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2018 N6\n\nLet $f : \\mathbb{N}^+ \\to \\mathbb{N}^+$ be a function such that $f(m + n)$ divides $f(m) + f(n)$\nfor all $m, n \\in \\mathbb{N}^+$.\n\nProve that there exists $n_0 \\in \\mathbb{N}^+$ such that $f(n_0)$ divides $f(n)$ for all\n$n \\in \\mathbb{N}^+$.\n-/\ndef IsGood (f : \u2115+ \u2192 \u2115+) : Prop :=\n \u2200 m n, f (m + n) \u2223 f m + f n\n\ntheorem imo_sl_2018_N6 (f : \u2115+ \u2192 \u2115+) (hf : IsGood f) :\n \u2203 n\u2080, \u2200 n, f n\u2080 \u2223 f n := by sorry", "category": "number theory"} {"name": "imo_sl_2019_A1", "problem_id": "2019_A1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2019 A1 (P1)\n\nFix an integer $N \u2260 0$.\nFind all functions $f : \u2124 \u2192 \u2124$ such that, for any $a, b \u2208 \u2124$,\n$$ f(Na) + N f(b) = f(f(a + b)). $$\n-/", "formal_statement": "theorem imo_sl_2019_A1 (h : N \u2260 0) {f : Int \u2192 Int} :\n (\u2200 a b : Int, f (N * a) + N * f b = f (f (a + b)))\n \u2194 (f = \u03bb _ \u21a6 0) \u2228 \u2203 c : Int, f = (N * \u00b7 + c) := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2019 A1 (P1)\n\nFix an integer $N \u2260 0$.\nFind all functions $f : \u2124 \u2192 \u2124$ such that, for any $a, b \u2208 \u2124$,\n$$ f(Na) + N f(b) = f(f(a + b)). $$\n-/\ntheorem imo_sl_2019_A1 (h : N \u2260 0) {f : Int \u2192 Int} :\n (\u2200 a b : Int, f (N * a) + N * f b = f (f (a + b)))\n \u2194 (f = \u03bb _ \u21a6 0) \u2228 \u2203 c : Int, f = (N * \u00b7 + c) := by sorry", "category": "algebra"} {"name": "imo_sl_2019_A2", "problem_id": "2019_A2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2019 A2\n\nLet $R$ be a totally ordered ring and $x_1, x_2, \u2026, x_n \u2208 R$ be elements with\n$$ x_1 + x_2 + \u2026 + x_n = 0. $$\nLet $a, b \u2208 R$ such that $b \u2264 x_i \u2264 a$ for all $i \u2264 n$.\nShow that $$ nab + \\sum_{i = 1}^n x_i^2 \u2264 0. $$\n-/", "formal_statement": "/- special open -/ open Multiset\ntheorem imo_sl_2019_A2 [LinearOrderedCommRing R]\n {a b : R} {M : Multiset R} (hM : M.sum = 0) (ha : \u2200 x \u2208 M, x \u2264 a) (hb : \u2200 x \u2208 M, b \u2264 x) :\n card M \u2022 (a * b) + (M.map \u03bb x \u21a6 x ^ 2).sum \u2264 0 := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2019 A2\n\nLet $R$ be a totally ordered ring and $x_1, x_2, \u2026, x_n \u2208 R$ be elements with\n$$ x_1 + x_2 + \u2026 + x_n = 0. $$\nLet $a, b \u2208 R$ such that $b \u2264 x_i \u2264 a$ for all $i \u2264 n$.\nShow that $$ nab + \\sum_{i = 1}^n x_i^2 \u2264 0. $$\n-/\n/- special open -/ open Multiset\ntheorem imo_sl_2019_A2 [LinearOrderedCommRing R]\n {a b : R} {M : Multiset R} (hM : M.sum = 0) (ha : \u2200 x \u2208 M, x \u2264 a) (hb : \u2200 x \u2208 M, b \u2264 x) :\n card M \u2022 (a * b) + (M.map \u03bb x \u21a6 x ^ 2).sum \u2264 0 := by sorry", "category": "algebra"} {"name": "imo_sl_2019_C2", "problem_id": "2019_C2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2019 C2\n\nLet $G$ be a totally ordered abelian group, and fix a non-negative element $g \\in G$.\nFor a multiset $S$ of elements of $G$, let $\\Sigma_S$ denote the sum of the elements of $S$,\ncounting multiplicity.\n\nLet $S$ be a multiset of elements of $G$ such that $\\Sigma_S \\le 2|S|g$. Suppose that\neach element of $S$ is greater than or equal to $g$.\n\nProve that for any $r \\in G$ with $-2g \\le r \\le \\Sigma_S$, there exists a sub-multiset\n$S'$ of $S$ such that $r \\le \\Sigma_{S'} \\le r + 2g$.\n-/", "formal_statement": "/- special open -/ open Multiset\ntheorem imo_sl_2019_C2 [LinearOrderedAddCommGroup G] (g : G) (hg : 0 \u2264 g) (S : Multiset G)\n (hS_elems : \u2200 x \u2208 S, g \u2264 x)\n (hS_sum : S.sum \u2264 (2 * card S) \u2022 g)\n (r : G) (hr_lower : -(2 \u2022 g) \u2264 r) (hr_upper : r \u2264 S.sum) :\n \u2203 T \u2264 S, r \u2264 T.sum \u2227 T.sum \u2264 r + 2 \u2022 g := by sorry", "split": "test", "tags": ["combinatorics"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2019 C2\n\nLet $G$ be a totally ordered abelian group, and fix a non-negative element $g \\in G$.\nFor a multiset $S$ of elements of $G$, let $\\Sigma_S$ denote the sum of the elements of $S$,\ncounting multiplicity.\n\nLet $S$ be a multiset of elements of $G$ such that $\\Sigma_S \\le 2|S|g$. Suppose that\neach element of $S$ is greater than or equal to $g$.\n\nProve that for any $r \\in G$ with $-2g \\le r \\le \\Sigma_S$, there exists a sub-multiset\n$S'$ of $S$ such that $r \\le \\Sigma_{S'} \\le r + 2g$.\n-/\n/- special open -/ open Multiset\ntheorem imo_sl_2019_C2 [LinearOrderedAddCommGroup G] (g : G) (hg : 0 \u2264 g) (S : Multiset G)\n (hS_elems : \u2200 x \u2208 S, g \u2264 x)\n (hS_sum : S.sum \u2264 (2 * card S) \u2022 g)\n (r : G) (hr_lower : -(2 \u2022 g) \u2264 r) (hr_upper : r \u2264 S.sum) :\n \u2203 T \u2264 S, r \u2264 T.sum \u2227 T.sum \u2264 r + 2 \u2022 g := by sorry", "category": "combinatorics"} {"name": "imo_sl_2019_N3", "problem_id": "2019_N3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2019 N3\n\nA set $S \u2286 \u2124$ is called *rootiful* if for any $a_0, a_1, \u2026 a_n \u2208 S$, not all zero,\n and $x \u2208 \u2124$ such that $a_0 + a_1 x + \u2026 + a_n x^n = 0$, we have $x \u2208 S$.\n\nFix an integer $N$ with $|N| > 1$.\nFind all rootiful sets containing $N^{a + 1} - N^{b + 1}$ for all $a, b \u2208 \u2115$.\n-/", "formal_statement": "/- special open -/ open List\ndef rootiful (S : Set \u2124) :=\n \u2200 (x : \u2124) (P : List \u2124) (_ : \u2200 a : \u2124, a \u2208 P \u2192 a \u2208 S) (_ : \u2203 a : \u2124, a \u2208 P \u2227 a \u2260 0),\n P.foldr (\u00b7 + x * \u00b7) 0 = 0 \u2192 x \u2208 S\n\ntheorem imo_sl_2019_N3 {N : \u2124} (h : 1 < |N|) {S : Set \u2124} :\n (rootiful S \u2227 \u2200 a b : \u2115, N ^ (a + 1) - N ^ (b + 1) \u2208 S) \u2194 S = Set.univ := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2019 N3\n\nA set $S \u2286 \u2124$ is called *rootiful* if for any $a_0, a_1, \u2026 a_n \u2208 S$, not all zero,\n and $x \u2208 \u2124$ such that $a_0 + a_1 x + \u2026 + a_n x^n = 0$, we have $x \u2208 S$.\n\nFix an integer $N$ with $|N| > 1$.\nFind all rootiful sets containing $N^{a + 1} - N^{b + 1}$ for all $a, b \u2208 \u2115$.\n-/\n/- special open -/ open List\ndef rootiful (S : Set \u2124) :=\n \u2200 (x : \u2124) (P : List \u2124) (_ : \u2200 a : \u2124, a \u2208 P \u2192 a \u2208 S) (_ : \u2203 a : \u2124, a \u2208 P \u2227 a \u2260 0),\n P.foldr (\u00b7 + x * \u00b7) 0 = 0 \u2192 x \u2208 S\n\ntheorem imo_sl_2019_N3 {N : \u2124} (h : 1 < |N|) {S : Set \u2124} :\n (rootiful S \u2227 \u2200 a b : \u2115, N ^ (a + 1) - N ^ (b + 1) \u2208 S) \u2194 S = Set.univ := by sorry", "category": "number theory"} {"name": "imo_sl_2019_N4", "problem_id": "2019_N4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2019 N4\n\nFix some $C \u2208 \u2115$.\nFind all functions $f : \u2115 \u2192 \u2115$ such that $a + f(b) \u2223 a^2 + b f(a)$\n for any $a, b \u2208 \u2115$ satisfying $a + b > C$.\n-/", "formal_statement": "/- special open -/ open List\ndef goodPNat (C : \u2115+) (f : \u2115+ \u2192 \u2115+) :=\n \u2200 a b : \u2115+, C < a + b \u2192 a + f b \u2223 a ^ 2 + b * f a\n\ntheorem imo_sl_2019_N4 : goodPNat C f \u2194 \u2203 k : \u2115+, f = (k * \u00b7) := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2019 N4\n\nFix some $C \u2208 \u2115$.\nFind all functions $f : \u2115 \u2192 \u2115$ such that $a + f(b) \u2223 a^2 + b f(a)$\n for any $a, b \u2208 \u2115$ satisfying $a + b > C$.\n-/\n/- special open -/ open List\ndef goodPNat (C : \u2115+) (f : \u2115+ \u2192 \u2115+) :=\n \u2200 a b : \u2115+, C < a + b \u2192 a + f b \u2223 a ^ 2 + b * f a\n\ntheorem imo_sl_2019_N4 : goodPNat C f \u2194 \u2203 k : \u2115+, f = (k * \u00b7) := by sorry", "category": "number theory"} {"name": "imo_sl_2020_A3", "problem_id": "2020_A3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2020 A3\n\nLet $a, b, c, d$ be positive real numbers such that $(a + c)(b + d) = ac + bd$.\nFind the smallest possible value of\n$$ \\frac{a}{b} + \\frac{b}{c} + \\frac{c}{d} + \\frac{d}{a}. $$\n-/", "formal_statement": "variable {F : Type*} [LinearOrderedField F]\n\ndef IsGood (a b c d : F) : Prop :=\n (a + c) * (b + d) = a * c + b * d\n\ndef targetVal (a b c d : F) : F :=\n a / b + b / c + c / d + d / a\n\ntheorem imo_sl_2020_A3 :\n (\u2200 a b c d : F, 0 < a \u2192 0 < b \u2192 0 < c \u2192 0 < d \u2192 IsGood a b c d \u2192 (8 : F) \u2264 targetVal a b c d) \u2227\n (\u2203 a b c d : F, 0 < a \u2227 0 < b \u2227 0 < c \u2227 0 < d \u2227 IsGood a b c d \u2227 targetVal a b c d = (8 : F)) :=\n by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2020 A3\n\nLet $a, b, c, d$ be positive real numbers such that $(a + c)(b + d) = ac + bd$.\nFind the smallest possible value of\n$$ \\frac{a}{b} + \\frac{b}{c} + \\frac{c}{d} + \\frac{d}{a}. $$\n-/\nvariable {F : Type*} [LinearOrderedField F]\n\ndef IsGood (a b c d : F) : Prop :=\n (a + c) * (b + d) = a * c + b * d\n\ndef targetVal (a b c d : F) : F :=\n a / b + b / c + c / d + d / a\n\ntheorem imo_sl_2020_A3 :\n (\u2200 a b c d : F, 0 < a \u2192 0 < b \u2192 0 < c \u2192 0 < d \u2192 IsGood a b c d \u2192 (8 : F) \u2264 targetVal a b c d) \u2227\n (\u2203 a b c d : F, 0 < a \u2227 0 < b \u2227 0 < c \u2227 0 < d \u2227 IsGood a b c d \u2227 targetVal a b c d = (8 : F)) :=\n by sorry", "category": "algebra"} {"name": "imo_sl_2020_A4", "problem_id": "2020_A4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2020 A4\n\nLet $a, b, c, d$ be real numbers with $a \\ge b \\ge c \\ge d > 0$ and $a + b + c + d = 1$.\nProve that\n$$ (a + 2b + 3c + 4d) a^a b^b c^c d^d < 1. $$\n-/", "formal_statement": "/- special open -/ open NNReal\ntheorem imo_sl_2020_A4 (a b c d : NNReal)\n (h_ord : a \u2265 b \u2227 b \u2265 c \u2227 c \u2265 d \u2227 d > 0)\n (h_sum : a + b + c + d = 1) :\n (a + 2 * b + 3 * c + 4 * d) *\n (a.toReal ^ a.toReal * b.toReal ^ b.toReal * c.toReal ^ c.toReal * d.toReal ^ d.toReal) < 1 := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2020 A4\n\nLet $a, b, c, d$ be real numbers with $a \\ge b \\ge c \\ge d > 0$ and $a + b + c + d = 1$.\nProve that\n$$ (a + 2b + 3c + 4d) a^a b^b c^c d^d < 1. $$\n-/\n/- special open -/ open NNReal\ntheorem imo_sl_2020_A4 (a b c d : NNReal)\n (h_ord : a \u2265 b \u2227 b \u2265 c \u2227 c \u2265 d \u2227 d > 0)\n (h_sum : a + b + c + d = 1) :\n (a + 2 * b + 3 * c + 4 * d) *\n (a.toReal ^ a.toReal * b.toReal ^ b.toReal * c.toReal ^ c.toReal * d.toReal ^ d.toReal) < 1 := by sorry", "category": "algebra"} {"name": "imo_sl_2020_A6", "problem_id": "2020_A6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2020 A6\n\nFind all functions $f : \u2124 \u2192 \u2124$ such that, for any $a, b \u2208 \u2124$,\n$$ f^{a^2 + b^2}(a + b) = a f(a) + b f(b). $$\n-/", "formal_statement": "/- special open -/ open Function\ndef good (f : \u2124 \u2192 \u2124) := \u2200 a b, f^[a.natAbs ^ 2 + b.natAbs ^ 2] (a + b) = a * f a + b * f b\n\ntheorem imo_sl_2020_A6 {f : \u2124 \u2192 \u2124} : good f \u2194 f = (\u00b7 + 1) \u2228 f = \u03bb _ \u21a6 0 := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2020 A6\n\nFind all functions $f : \u2124 \u2192 \u2124$ such that, for any $a, b \u2208 \u2124$,\n$$ f^{a^2 + b^2}(a + b) = a f(a) + b f(b). $$\n-/\n/- special open -/ open Function\ndef good (f : \u2124 \u2192 \u2124) := \u2200 a b, f^[a.natAbs ^ 2 + b.natAbs ^ 2] (a + b) = a * f a + b * f b\n\ntheorem imo_sl_2020_A6 {f : \u2124 \u2192 \u2124} : good f \u2194 f = (\u00b7 + 1) \u2228 f = \u03bb _ \u21a6 0 := by sorry", "category": "algebra"} {"name": "imo_sl_2020_N1", "problem_id": "2020_N1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2020 N1\n\nProve that, for any positive integer $k$, there exists a prime $p$ and\n distinct elements $x_1, x_2, \u2026, x_{k + 3} \\in \ud835\udd3d_p^\u00d7$ such that for all $i \u2264 k$,\n$$ x_i x_{i + 1} x_{i + 2} x_{i + 3} = i. $$\n-/", "formal_statement": "/- special open -/ open Function\nabbrev ratSeq : \u2115 \u2192 \u211a\n | 0 => 2\n | 1 => 2\u207b\u00b9\n | 2 => -4\n | 3 => -4\u207b\u00b9\n | n + 4 => (1 + (n.succ : \u211a)\u207b\u00b9) * ratSeq n\n\ntheorem imo_sl_2020_N1 (k : \u2115) :\n \u2203 (p : \u2115) (_ : p.Prime) (a : Fin (k + 4) \u2192 ZMod p), a.Injective \u2227 (\u2200 i, a i \u2260 0) \u2227\n (\u2200 i \u2264 k, a i * a (i + 1) * a (i + 2) * a (i + 3) = i.succ) := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2020 N1\n\nProve that, for any positive integer $k$, there exists a prime $p$ and\n distinct elements $x_1, x_2, \u2026, x_{k + 3} \\in \ud835\udd3d_p^\u00d7$ such that for all $i \u2264 k$,\n$$ x_i x_{i + 1} x_{i + 2} x_{i + 3} = i. $$\n-/\n/- special open -/ open Function\nabbrev ratSeq : \u2115 \u2192 \u211a\n | 0 => 2\n | 1 => 2\u207b\u00b9\n | 2 => -4\n | 3 => -4\u207b\u00b9\n | n + 4 => (1 + (n.succ : \u211a)\u207b\u00b9) * ratSeq n\n\ntheorem imo_sl_2020_N1 (k : \u2115) :\n \u2203 (p : \u2115) (_ : p.Prime) (a : Fin (k + 4) \u2192 ZMod p), a.Injective \u2227 (\u2200 i, a i \u2260 0) \u2227\n (\u2200 i \u2264 k, a i * a (i + 1) * a (i + 2) * a (i + 3) = i.succ) := by sorry", "category": "number theory"} {"name": "imo_sl_2021_A1", "problem_id": "2021_A1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2021 A1\n\nLet $n$ be an integer and $A$ be a subset of $\\{0, 1, \u2026, 5^n\\}$ of size $4n + 2$.\nProve that there exists $a, b, c \u2208 A$ such that $a < b < c$ and $c + 2a > 3b$.\n-/", "formal_statement": "/- special open -/ open List\ntheorem imo_sl_2021_A1 (hn : n \u2260 0) {A : Finset \u2115}\n (hA : A.card = 4 * n + 2) (hA0 : \u2200 a \u2208 A, a \u2264 5 ^ n) :\n \u2203 a \u2208 A, \u2203 b \u2208 A, \u2203 c \u2208 A, a < b \u2227 b < c \u2227 3 * b < c + 2 * a := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2021 A1\n\nLet $n$ be an integer and $A$ be a subset of $\\{0, 1, \u2026, 5^n\\}$ of size $4n + 2$.\nProve that there exists $a, b, c \u2208 A$ such that $a < b < c$ and $c + 2a > 3b$.\n-/\n/- special open -/ open List\ntheorem imo_sl_2021_A1 (hn : n \u2260 0) {A : Finset \u2115}\n (hA : A.card = 4 * n + 2) (hA0 : \u2200 a \u2208 A, a \u2264 5 ^ n) :\n \u2203 a \u2208 A, \u2203 b \u2208 A, \u2203 c \u2208 A, a < b \u2227 b < c \u2227 3 * b < c + 2 * a := by sorry", "category": "algebra"} {"name": "imo_sl_2021_A2", "problem_id": "2021_A2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2021 A2\n\nFor any positive integer $n$, prove that\n$$ 4 \\sum_{i = 1}^n \\sum_{j = 1}^n \\left\\lfloor \\frac{ij}{n + 1} \\right\\rfloor\n \u2265 n^2 (n - 1). $$\nDetermine the equality cases.\n-/", "formal_statement": "/- special open -/ open Finset\nabbrev targetSum (n : \u2115) := 4 * \u2211 i \u2208 range n, \u2211 j \u2208 range n, (i + 1) * (j + 1) / (n + 1)\n\ntheorem imo_sl_2021_A2 (hn : n \u2260 0) : targetSum n = n ^ 2 * (n - 1) \u2194 (n + 1).Prime := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2021 A2\n\nFor any positive integer $n$, prove that\n$$ 4 \\sum_{i = 1}^n \\sum_{j = 1}^n \\left\\lfloor \\frac{ij}{n + 1} \\right\\rfloor\n \u2265 n^2 (n - 1). $$\nDetermine the equality cases.\n-/\n/- special open -/ open Finset\nabbrev targetSum (n : \u2115) := 4 * \u2211 i \u2208 range n, \u2211 j \u2208 range n, (i + 1) * (j + 1) / (n + 1)\n\ntheorem imo_sl_2021_A2 (hn : n \u2260 0) : targetSum n = n ^ 2 * (n - 1) \u2194 (n + 1).Prime := by sorry", "category": "algebra"} {"name": "imo_sl_2021_A3", "problem_id": "2021_A3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2021 A3\n\nFind the smallest possible value of\n$$ \\sum_{j = 1}^n \\left\\lfloor \\frac{a_j}{j} \\right\\rfloor $$\n across all permutations $(a_1, a_2, \\ldots, a_n)$ of $(1, 2, \\ldots, n)$.\n-/", "formal_statement": "/- special open -/ open List\ndef targetSum : List \u2115 \u2192 \u2115\n | [] => 0\n | a :: l => a / (a :: l).length + targetSum l\n\ntheorem imo_sl_2021_A3 :\n IsLeast (targetSum '' {l : List \u2115 | l ~ (List.range' 1 n).reverse}) n.size := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2021 A3\n\nFind the smallest possible value of\n$$ \\sum_{j = 1}^n \\left\\lfloor \\frac{a_j}{j} \\right\\rfloor $$\n across all permutations $(a_1, a_2, \\ldots, a_n)$ of $(1, 2, \\ldots, n)$.\n-/\n/- special open -/ open List\ndef targetSum : List \u2115 \u2192 \u2115\n | [] => 0\n | a :: l => a / (a :: l).length + targetSum l\n\ntheorem imo_sl_2021_A3 :\n IsLeast (targetSum '' {l : List \u2115 | l ~ (List.range' 1 n).reverse}) n.size := by sorry", "category": "algebra"} {"name": "imo_sl_2021_A5", "problem_id": "2021_A5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n### IMO 2021 A5\n\nLet $F$ be a totally ordered field.\nLet $a_1, a_2, \u2026, a_n \u2208 F$ be non-negative elements.\nLet $r \u2208 F$ be any positive element such that $r \u2265 a_1 + a_2 + \u2026 + a_n$.\nProve that\n$$ \\sum_{k = 1}^n \\frac{a_k}{r - a_k} (a_1 + a_2 + \u2026 + a_{k - 1})^2 < \\frac{r^2}{3}. $$\n-/", "formal_statement": "def targetSumPair [Field F] (r : F) (l : List F) : F \u00d7 F :=\n l.foldr (\u03bb a p \u21a6 (a / (r - a) * p.2 ^ 2 + p.1, a + p.2)) (0, 0)\n\ntheorem imo_sl_2021_A5 [LinearOrderedField F]\n {r : F} (hr : 0 < r) (l : List F)\n (hl : \u2200 x \u2208 l, 0 \u2264 x) (h : l.foldr (\u00b7 + \u00b7) 0 \u2264 r) :\n (targetSumPair r l).1 < r ^ 2 / 3 := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n### IMO 2021 A5\n\nLet $F$ be a totally ordered field.\nLet $a_1, a_2, \u2026, a_n \u2208 F$ be non-negative elements.\nLet $r \u2208 F$ be any positive element such that $r \u2265 a_1 + a_2 + \u2026 + a_n$.\nProve that\n$$ \\sum_{k = 1}^n \\frac{a_k}{r - a_k} (a_1 + a_2 + \u2026 + a_{k - 1})^2 < \\frac{r^2}{3}. $$\n-/\ndef targetSumPair [Field F] (r : F) (l : List F) : F \u00d7 F :=\n l.foldr (\u03bb a p \u21a6 (a / (r - a) * p.2 ^ 2 + p.1, a + p.2)) (0, 0)\n\ntheorem imo_sl_2021_A5 [LinearOrderedField F]\n {r : F} (hr : 0 < r) (l : List F)\n (hl : \u2200 x \u2208 l, 0 \u2264 x) (h : l.foldr (\u00b7 + \u00b7) 0 \u2264 r) :\n (targetSumPair r l).1 < r ^ 2 / 3 := by sorry", "category": "algebra"} {"name": "imo_sl_2021_A6", "problem_id": "2021_A6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2021 A6 (P6)\n\nLet $m \u2208 \u2115$ and $a_0, a_1, \u2026, a_{k - 1}$ be integers.\nSuppose that there exists subsets $B_0, B_1, \u2026, B_{m - 1}$ of $[k]$\n such that for each $i \u2208 [m]$, $$ \\sum_{j \u2208 B_i} a_j = m^{i + 1}. $$\nProve that $k \u2265 m/2$.\n-/", "formal_statement": "/- special open -/ open Finset\nvariable [Fintype \u03ba] [DecidableEq \u03ba] {a : \u03ba \u2192 \u2124}\n\ntheorem imo_sl_2021_A6 {a : \u03ba \u2192 \u2124} {B : Fin m \u2192 Finset \u03ba}\n [\u2200 i j, Decidable (j \u2208 B i)] (h : \u2200 i : Fin m, (B i).sum a = m ^ (i.1 + 1)) :\n m \u2264 2 * Fintype.card \u03ba := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2021 A6 (P6)\n\nLet $m \u2208 \u2115$ and $a_0, a_1, \u2026, a_{k - 1}$ be integers.\nSuppose that there exists subsets $B_0, B_1, \u2026, B_{m - 1}$ of $[k]$\n such that for each $i \u2208 [m]$, $$ \\sum_{j \u2208 B_i} a_j = m^{i + 1}. $$\nProve that $k \u2265 m/2$.\n-/\n/- special open -/ open Finset\nvariable [Fintype \u03ba] [DecidableEq \u03ba] {a : \u03ba \u2192 \u2124}\n\ntheorem imo_sl_2021_A6 {a : \u03ba \u2192 \u2124} {B : Fin m \u2192 Finset \u03ba}\n [\u2200 i j, Decidable (j \u2208 B i)] (h : \u2200 i : Fin m, (B i).sum a = m ^ (i.1 + 1)) :\n m \u2264 2 * Fintype.card \u03ba := by sorry", "category": "algebra"} {"name": "imo_sl_2021_A7", "problem_id": "2021_A7", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2021 A7\n\nLet $R$ be a totally ordered commutative ring.\nLet $(x_n)_{n \u2265 0}$ be a sequence of elements of $R$ such that, for each $n \u2208 \u2115$,\n$$ x_{n + 1} x_{n + 2} \u2265 x_n^2 + 1. $$\nShow that for any $N \u2208 \u2115$,\n$$ 27 (x_0 + x_1 + \u2026 + x_{N + 1})^2 > 8 N^3. $$\n-/", "formal_statement": "/- special open -/ open Finset\nvariable [LinearOrderedField R] [ExistsAddOfLE R]\n\ntheorem imo_sl_2021_A7 {x : \u2115 \u2192 R} (hx : \u2200 n, 0 \u2264 x n)\n (hx0 : \u2200 n, x n ^ 2 + 1 \u2264 x (n + 1) * x (n + 2)) (N) :\n 8 * N ^ 3 < 27 * (range (N + 2)).sum x ^ 2 := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2021 A7\n\nLet $R$ be a totally ordered commutative ring.\nLet $(x_n)_{n \u2265 0}$ be a sequence of elements of $R$ such that, for each $n \u2208 \u2115$,\n$$ x_{n + 1} x_{n + 2} \u2265 x_n^2 + 1. $$\nShow that for any $N \u2208 \u2115$,\n$$ 27 (x_0 + x_1 + \u2026 + x_{N + 1})^2 > 8 N^3. $$\n-/\n/- special open -/ open Finset\nvariable [LinearOrderedField R] [ExistsAddOfLE R]\n\ntheorem imo_sl_2021_A7 {x : \u2115 \u2192 R} (hx : \u2200 n, 0 \u2264 x n)\n (hx0 : \u2200 n, x n ^ 2 + 1 \u2264 x (n + 1) * x (n + 2)) (N) :\n 8 * N ^ 3 < 27 * (range (N + 2)).sum x ^ 2 := by sorry", "category": "algebra"} {"name": "imo_sl_2021_C1", "problem_id": "2021_C1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2021 C1\n\nConsider a complete graph with an infinite vertex set $V$.\nEach edge $xy$ is coloured such that for each vertex $v$, there exists only\n finitely many colours assigned to an edge incident with $v$.\nProve that if some of the edges has distinct colours, then there exists\n $x, y, z \u2208 V$, pairwise distinct, such that $c_{xy} = c_{xz} \u2260 c_{yz}$.\n-/", "formal_statement": "structure FiniteIncidenceColouring (V \u03b1 : Type*) where\n colour : V \u2192 V \u2192 \u03b1\n colour_symm (x y : V) : colour x y = colour y x\n incidence_finite (v : V) : Finite (Set.range (colour v))\n\nvariable [Infinite V] (C : FiniteIncidenceColouring V \u03b1)\n\ntheorem imo_sl_2021_C1 (h : \u2200 c : \u03b1, \u2203 x y : V, x \u2260 y \u2227 C.colour x y \u2260 c) :\n \u2203 x y z, y \u2260 z \u2227 C.colour x y = C.colour x z \u2227 C.colour y z \u2260 C.colour x z := by sorry", "split": "test", "tags": ["combinatorics"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2021 C1\n\nConsider a complete graph with an infinite vertex set $V$.\nEach edge $xy$ is coloured such that for each vertex $v$, there exists only\n finitely many colours assigned to an edge incident with $v$.\nProve that if some of the edges has distinct colours, then there exists\n $x, y, z \u2208 V$, pairwise distinct, such that $c_{xy} = c_{xz} \u2260 c_{yz}$.\n-/\nstructure FiniteIncidenceColouring (V \u03b1 : Type*) where\n colour : V \u2192 V \u2192 \u03b1\n colour_symm (x y : V) : colour x y = colour y x\n incidence_finite (v : V) : Finite (Set.range (colour v))\n\nvariable [Infinite V] (C : FiniteIncidenceColouring V \u03b1)\n\ntheorem imo_sl_2021_C1 (h : \u2200 c : \u03b1, \u2203 x y : V, x \u2260 y \u2227 C.colour x y \u2260 c) :\n \u2203 x y z, y \u2260 z \u2227 C.colour x y = C.colour x z \u2227 C.colour y z \u2260 C.colour x z := by sorry", "category": "combinatorics"} {"name": "imo_sl_2021_C2", "problem_id": "2021_C2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2021 C2\n\nFix some positive integer $n$, and denote $[n] = \\{0, 1, \u2026, n - 1\\}$.\nFind all positive integers $m \u2208 \u2115$ such that there exists a\n function $f : \u2124/m\u2124 \u2192 [n]$ with the following property:\n for any $k \u2208 \u2124/m\u2124$ and $i \u2208 [n]$, there exists $j \u2264 n$ such that $f(k + j) = i$.\n-/", "formal_statement": "/- special open -/ open Finset\ndef good (f : Fin (m + 1) \u2192 Fin n) := \u2200 k i, \u2203 j \u2264 n, f (k + j) = i\n\ntheorem imo_sl_2021_C2 {n m : \u2115} :\n (\u2203 f : Fin m.succ \u2192 Fin n.succ, good f) \u2194 m.succ % n.succ \u2264 m.succ / n.succ := by sorry", "split": "test", "tags": ["combinatorics"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2021 C2\n\nFix some positive integer $n$, and denote $[n] = \\{0, 1, \u2026, n - 1\\}$.\nFind all positive integers $m \u2208 \u2115$ such that there exists a\n function $f : \u2124/m\u2124 \u2192 [n]$ with the following property:\n for any $k \u2208 \u2124/m\u2124$ and $i \u2208 [n]$, there exists $j \u2264 n$ such that $f(k + j) = i$.\n-/\n/- special open -/ open Finset\ndef good (f : Fin (m + 1) \u2192 Fin n) := \u2200 k i, \u2203 j \u2264 n, f (k + j) = i\n\ntheorem imo_sl_2021_C2 {n m : \u2115} :\n (\u2203 f : Fin m.succ \u2192 Fin n.succ, good f) \u2194 m.succ % n.succ \u2264 m.succ / n.succ := by sorry", "category": "combinatorics"} {"name": "imo_sl_2021_N1", "problem_id": "2021_N1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2021 N1\n\nFind all triplets $(a, b, n)$ of positive integers such that\n* $a^2 + b + 3$ is cubefree; and\n* $ab + 3b + 8 = n(a^2 + b + 3)$.\n-/", "formal_statement": "@[mk_iff] structure good (a b n : \u2115+) : Prop where\n cubefree : \u2200 p, (a ^ 2 + b + 3).factorMultiset.count p \u2264 2\n eqn : a * b + 3 * b + 8 = n * (a ^ 2 + b + 3)\n\ntheorem imo_sl_2021_N1 :\n good a b n \u2194 n = 2 \u2227 \u2203 k : \u2115+,\n (\u2200 p, (k + 2).factorMultiset.count p \u2264 1) \u2227 a = k + 1 \u2227 b = 2 * k := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2021 N1\n\nFind all triplets $(a, b, n)$ of positive integers such that\n* $a^2 + b + 3$ is cubefree; and\n* $ab + 3b + 8 = n(a^2 + b + 3)$.\n-/\n@[mk_iff] structure good (a b n : \u2115+) : Prop where\n cubefree : \u2200 p, (a ^ 2 + b + 3).factorMultiset.count p \u2264 2\n eqn : a * b + 3 * b + 8 = n * (a ^ 2 + b + 3)\n\ntheorem imo_sl_2021_N1 :\n good a b n \u2194 n = 2 \u2227 \u2203 k : \u2115+,\n (\u2200 p, (k + 2).factorMultiset.count p \u2264 1) \u2227 a = k + 1 \u2227 b = 2 * k := by sorry", "category": "number theory"} {"name": "imo_sl_2021_N2", "problem_id": "2021_N2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2021 N2 (P1)\n\nLet $n \u2265 99$ be an integer.\nThe non-negative integers are coloured using two colours.\nProve that there exists $a, b \u2208 \u2115$ of the same colour such that\n $n \u2264 a < b \u2264 2n$ and $a + b$ is a square.\n-/", "formal_statement": "def good (n : \u2115) :=\n \u2200 x : \u2115 \u2192 Bool, \u2203 a b, n \u2264 a \u2227 a < b \u2227 b \u2264 2 * n \u2227 x a = x b \u2227 \u2203 k, a + b = k ^ 2\n\ntheorem imo_sl_2021_N2 (h : 99 \u2264 n) : good n := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2021 N2 (P1)\n\nLet $n \u2265 99$ be an integer.\nThe non-negative integers are coloured using two colours.\nProve that there exists $a, b \u2208 \u2115$ of the same colour such that\n $n \u2264 a < b \u2264 2n$ and $a + b$ is a square.\n-/\ndef good (n : \u2115) :=\n \u2200 x : \u2115 \u2192 Bool, \u2203 a b, n \u2264 a \u2227 a < b \u2227 b \u2264 2 * n \u2227 x a = x b \u2227 \u2203 k, a + b = k ^ 2\n\ntheorem imo_sl_2021_N2 (h : 99 \u2264 n) : good n := by sorry", "category": "number theory"} {"name": "imo_sl_2022_A1", "problem_id": "2022_A1", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2022 A1\n\nLet $R$ be a totally ordered ring.\nLet $(a_n)_{n \u2265 0}$ be a sequence of non-negative elements of $R$ such that for any $n \u2208 \u2115$,\n$$ a_{n + 1}^2 + a_n a_{n + 2} \u2264 a_n + a_{n + 2}. $$\nShow that $a_N \u2264 1$ for all $N \u2265 2$.\n-/", "formal_statement": "variable [LinearOrderedRing R]\n\ntheorem imo_sl_2022_A1 {a : \u2115 \u2192 R} (h : \u2200 i, 0 \u2264 a i)\n (h0 : \u2200 i, a (i + 1) ^ 2 + a i * a (i + 2) \u2264 a i + a (i + 2))\n (N : \u2115) (h1 : 2 \u2264 N) : a N \u2264 1 := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2022 A1\n\nLet $R$ be a totally ordered ring.\nLet $(a_n)_{n \u2265 0}$ be a sequence of non-negative elements of $R$ such that for any $n \u2208 \u2115$,\n$$ a_{n + 1}^2 + a_n a_{n + 2} \u2264 a_n + a_{n + 2}. $$\nShow that $a_N \u2264 1$ for all $N \u2265 2$.\n-/\nvariable [LinearOrderedRing R]\n\ntheorem imo_sl_2022_A1 {a : \u2115 \u2192 R} (h : \u2200 i, 0 \u2264 a i)\n (h0 : \u2200 i, a (i + 1) ^ 2 + a i * a (i + 2) \u2264 a i + a (i + 2))\n (N : \u2115) (h1 : 2 \u2264 N) : a N \u2264 1 := by sorry", "category": "algebra"} {"name": "imo_sl_2022_A3", "problem_id": "2022_A3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2022 A3 (P2)\n\nLet $R$ be a totally ordered commutative ring, and let $R_{>0} = \\{x \u2208 R : x > 0\\}$.\nFind all functions $f : R_{>0} \u2192 R_{>0}$ such that for any $x \u2208 R_{>0}$,\n there exists a unique $y \u2208 R_{>0}$ such that $x f(y) + y f(x) \u2264 2$.\n-/", "formal_statement": "variable [LinearOrderedField R]\n\ndef good (f : {x : R // 0 < x} \u2192 {x : R // 0 < x}) :=\n \u2200 x, \u2203! y, x * f y + y * f x \u2264 \u27e82, two_pos\u27e9\n\ntheorem imo_sl_2022_A3 [ExistsAddOfLE R] {f : {x : R // 0 < x} \u2192 {x : R // 0 < x}} :\n good f \u2194 \u2200 x, x * f x = 1 := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2022 A3 (P2)\n\nLet $R$ be a totally ordered commutative ring, and let $R_{>0} = \\{x \u2208 R : x > 0\\}$.\nFind all functions $f : R_{>0} \u2192 R_{>0}$ such that for any $x \u2208 R_{>0}$,\n there exists a unique $y \u2208 R_{>0}$ such that $x f(y) + y f(x) \u2264 2$.\n-/\nvariable [LinearOrderedField R]\n\ndef good (f : {x : R // 0 < x} \u2192 {x : R // 0 < x}) :=\n \u2200 x, \u2203! y, x * f y + y * f x \u2264 \u27e82, two_pos\u27e9\n\ntheorem imo_sl_2022_A3 [ExistsAddOfLE R] {f : {x : R // 0 < x} \u2192 {x : R // 0 < x}} :\n good f \u2194 \u2200 x, x * f x = 1 := by sorry", "category": "algebra"} {"name": "imo_sl_2022_A6", "problem_id": "2022_A6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2022 A6\n\nLet $G$ be a commutative group.\nA function $f : G \u2192 G$ is called *infectious* if\n$$ f(x + f(y)) = f(x) + f(y) \\quad \u2200 x, y \u2208 G. $$\nFind all pairs $(m, n)$ of integers such that for any infectious functions\n $f : G \u2192 G$, there exists $z \u2208 G$ such that $m f(z) = nz$.\n-/", "formal_statement": "structure InfectiousFun (G) [Add G] where\n toFun : G \u2192 G\n infectious_def' : \u2200 x y, toFun (x + toFun y) = toFun x + toFun y\n\ninstance [Add G] : FunLike (InfectiousFun G) G G where\n coe f := f.toFun\n coe_injective' f g h := by rwa [InfectiousFun.mk.injEq]\n\ndef good (G) [AddGroup G] (m n : \u2124) := \u2200 f : InfectiousFun G, \u2203 z, m \u2022 f z = n \u2022 z\n\ntheorem imo_sl_2022_A6 [AddCommGroup G] :\n good G m n \u2194 \u2200 g : G, (m - n).gcd (addOrderOf g) \u2223 m.natAbs := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2022 A6\n\nLet $G$ be a commutative group.\nA function $f : G \u2192 G$ is called *infectious* if\n$$ f(x + f(y)) = f(x) + f(y) \\quad \u2200 x, y \u2208 G. $$\nFind all pairs $(m, n)$ of integers such that for any infectious functions\n $f : G \u2192 G$, there exists $z \u2208 G$ such that $m f(z) = nz$.\n-/\nstructure InfectiousFun (G) [Add G] where\n toFun : G \u2192 G\n infectious_def' : \u2200 x y, toFun (x + toFun y) = toFun x + toFun y\n\ninstance [Add G] : FunLike (InfectiousFun G) G G where\n coe f := f.toFun\n coe_injective' f g h := by rwa [InfectiousFun.mk.injEq]\n\ndef good (G) [AddGroup G] (m n : \u2124) := \u2200 f : InfectiousFun G, \u2203 z, m \u2022 f z = n \u2022 z\n\ntheorem imo_sl_2022_A6 [AddCommGroup G] :\n good G m n \u2194 \u2200 g : G, (m - n).gcd (addOrderOf g) \u2223 m.natAbs := by sorry", "category": "algebra"} {"name": "imo_sl_2022_C7", "problem_id": "2022_C7", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2022 C7\n\nLet $m$ be a positive integer and consider an arbitrary subset $S \\subseteq \\mathbb{Z}^m$.\nWe say that $S$ is *add-sup closed* if for any $v, w \\in S$, their pointwise sum $v+w$ and\ntheir pointwise maximum (or sup) $v \\lor w$ are also in $S$.\nA set $G \\subseteq \\mathbb{Z}^m$ is called an *add-sup generator* if the only add-sup\nclosed set containing $G$ is $\\mathbb{Z}^m$ itself.\n\nFind the smallest possible size of an add-sup generator, in terms of $m$.\n-/", "formal_statement": "/- special open -/ open Finset Classical\nclass IsAddSupClosed {m : \u2115} (S : Set (Fin m \u2192 \u2124)) : Prop where\n add_mem : \u2200 {v w}, v \u2208 S \u2192 w \u2208 S \u2192 v + w \u2208 S\n sup_mem : \u2200 {v w}, v \u2208 S \u2192 w \u2208 S \u2192 v \u2294 w \u2208 S\n\ndef IsAddSupGenerator {m : \u2115} (G : Finset (Fin m \u2192 \u2124)) : Prop :=\n \u2200 S : Set (Fin m \u2192 \u2124), \u2191G \u2286 S \u2192 IsAddSupClosed S \u2192 S = Set.univ\n\ndef IsGoodSize (m n : \u2115) : Prop :=\n \u2203 G : Finset (Fin m \u2192 \u2124), G.card \u2264 n \u2227 IsAddSupGenerator G\n\ntheorem imo_sl_2022_C7 (m n : \u2115) :\n IsGoodSize m n \u2194 n \u2265 (if m = 0 then 1 else if m \u2264 2 then 2 else 3) := by sorry", "split": "test", "tags": ["combinatorics"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2022 C7\n\nLet $m$ be a positive integer and consider an arbitrary subset $S \\subseteq \\mathbb{Z}^m$.\nWe say that $S$ is *add-sup closed* if for any $v, w \\in S$, their pointwise sum $v+w$ and\ntheir pointwise maximum (or sup) $v \\lor w$ are also in $S$.\nA set $G \\subseteq \\mathbb{Z}^m$ is called an *add-sup generator* if the only add-sup\nclosed set containing $G$ is $\\mathbb{Z}^m$ itself.\n\nFind the smallest possible size of an add-sup generator, in terms of $m$.\n-/\n/- special open -/ open Finset Classical\nclass IsAddSupClosed {m : \u2115} (S : Set (Fin m \u2192 \u2124)) : Prop where\n add_mem : \u2200 {v w}, v \u2208 S \u2192 w \u2208 S \u2192 v + w \u2208 S\n sup_mem : \u2200 {v w}, v \u2208 S \u2192 w \u2208 S \u2192 v \u2294 w \u2208 S\n\ndef IsAddSupGenerator {m : \u2115} (G : Finset (Fin m \u2192 \u2124)) : Prop :=\n \u2200 S : Set (Fin m \u2192 \u2124), \u2191G \u2286 S \u2192 IsAddSupClosed S \u2192 S = Set.univ\n\ndef IsGoodSize (m n : \u2115) : Prop :=\n \u2203 G : Finset (Fin m \u2192 \u2124), G.card \u2264 n \u2227 IsAddSupGenerator G\n\ntheorem imo_sl_2022_C7 (m n : \u2115) :\n IsGoodSize m n \u2194 n \u2265 (if m = 0 then 1 else if m \u2264 2 then 2 else 3) := by sorry", "category": "combinatorics"} {"name": "imo_sl_2022_N8", "problem_id": "2022_N8", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2022 N8\n\nGiven $n \u2208 \u2115$ such that $2^n + 65 \u2223 5^n - 3^n$, prove that $n = 0$.\n-/", "formal_statement": "theorem imo_sl_2022_N8 (h : 5 ^ n \u2261 3 ^ n [MOD 2 ^ n + 65]) : n = 0 := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2022 N8\n\nGiven $n \u2208 \u2115$ such that $2^n + 65 \u2223 5^n - 3^n$, prove that $n = 0$.\n-/\ntheorem imo_sl_2022_N8 (h : 5 ^ n \u2261 3 ^ n [MOD 2 ^ n + 65]) : n = 0 := by sorry", "category": "number theory"} {"name": "imo_sl_2023_A2", "problem_id": "2023_A2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2023 A2\n\nLet $G$ be a $2$-divisible abelian group and $R$ be a totally ordered ring.\nLet $f : G \u2192 R$ be a function such that\n* $f(x + y) f(x - y) \u2265 f(x)^2 - f(y)^2$ for all $x, y \u2208 G$,\n* $f(x_0 + y_0) f(x_0 - y_0) > f(x_0)^2 - f(y_0)^2$ for some $x_0, y_0 \u2208 G$.\n\nProve that either $f \u2265 0$ or $f \u2264 0$.\n-/", "formal_statement": "theorem imo_sl_2023_A2 [AddCommGroup G] (hG : \u2200 x : G, \u2203 y, 2 \u2022 y = x) [LinearOrderedRing R]\n {f : G \u2192 R} (hf : \u2200 x y, f x ^ 2 - f y ^ 2 \u2264 f (x + y) * f (x - y))\n (hf0 : \u2203 x0 y0, f x0 ^ 2 - f y0 ^ 2 < f (x0 + y0) * f (x0 - y0)) :\n (\u2200 x, 0 \u2264 f x) \u2228 (\u2200 x, f x \u2264 0) := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2023 A2\n\nLet $G$ be a $2$-divisible abelian group and $R$ be a totally ordered ring.\nLet $f : G \u2192 R$ be a function such that\n* $f(x + y) f(x - y) \u2265 f(x)^2 - f(y)^2$ for all $x, y \u2208 G$,\n* $f(x_0 + y_0) f(x_0 - y_0) > f(x_0)^2 - f(y_0)^2$ for some $x_0, y_0 \u2208 G$.\n\nProve that either $f \u2265 0$ or $f \u2264 0$.\n-/\ntheorem imo_sl_2023_A2 [AddCommGroup G] (hG : \u2200 x : G, \u2203 y, 2 \u2022 y = x) [LinearOrderedRing R]\n {f : G \u2192 R} (hf : \u2200 x y, f x ^ 2 - f y ^ 2 \u2264 f (x + y) * f (x - y))\n (hf0 : \u2203 x0 y0, f x0 ^ 2 - f y0 ^ 2 < f (x0 + y0) * f (x0 - y0)) :\n (\u2200 x, 0 \u2264 f x) \u2228 (\u2200 x, f x \u2264 0) := by sorry", "category": "algebra"} {"name": "imo_sl_2023_A3", "problem_id": "2023_A3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2023 A3\n\nLet $F$ be a totally ordered field and $N$ be a positive integer.\nLet $x_0, x_1, \\dots, x_{N-1} \\in F$ be distinct positive elements.\nSuppose that for each $n \\in \\{0, \\dots, N\\}$, there exists an integer $a_n \\in \\mathbb{N}$ such that\n$$ \\left(\\sum_{i=0}^{n-1} x_i\\right) \\left(\\sum_{i=0}^{n-1} \\frac{1}{x_i}\\right) = a_n^2. $$\nProve that $a_N \\ge \\lfloor 3N/2 \\rfloor$.\n-/", "formal_statement": "/- special open -/ open Finset\nstructure GoodSeq (N : \u2115) (F : Type*) [LinearOrderedField F] where\n x : \u2115 \u2192 F\n a : \u2115 \u2192 \u2115\n x_pos : \u2200 i < N, 0 < x i\n x_inj : \u2200 i < N, \u2200 j < N, x i = x j \u2192 i = j\n spec : \u2200 i \u2264 N, (a i : F) ^ 2 = (\u2211 j \u2208 range i, x j) * (\u2211 j \u2208 range i, (x j)\u207b\u00b9)\n\ntheorem imo_sl_2023_A3 {N : \u2115} {F : Type*} [LinearOrderedField F]\n (hN : 0 < N) (X : GoodSeq N F) :\n 3 * N / 2 \u2264 X.a N := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2023 A3\n\nLet $F$ be a totally ordered field and $N$ be a positive integer.\nLet $x_0, x_1, \\dots, x_{N-1} \\in F$ be distinct positive elements.\nSuppose that for each $n \\in \\{0, \\dots, N\\}$, there exists an integer $a_n \\in \\mathbb{N}$ such that\n$$ \\left(\\sum_{i=0}^{n-1} x_i\\right) \\left(\\sum_{i=0}^{n-1} \\frac{1}{x_i}\\right) = a_n^2. $$\nProve that $a_N \\ge \\lfloor 3N/2 \\rfloor$.\n-/\n/- special open -/ open Finset\nstructure GoodSeq (N : \u2115) (F : Type*) [LinearOrderedField F] where\n x : \u2115 \u2192 F\n a : \u2115 \u2192 \u2115\n x_pos : \u2200 i < N, 0 < x i\n x_inj : \u2200 i < N, \u2200 j < N, x i = x j \u2192 i = j\n spec : \u2200 i \u2264 N, (a i : F) ^ 2 = (\u2211 j \u2208 range i, x j) * (\u2211 j \u2208 range i, (x j)\u207b\u00b9)\n\ntheorem imo_sl_2023_A3 {N : \u2115} {F : Type*} [LinearOrderedField F]\n (hN : 0 < N) (X : GoodSeq N F) :\n 3 * N / 2 \u2264 X.a N := by sorry", "category": "algebra"} {"name": "imo_sl_2023_A5", "problem_id": "2023_A5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2023 A5\n\nLet $N > 0$ be an integer and $(a_0, a_1, \\dots, a_N)$ be a permutation of $(0, 1, \\dots, N)$.\nSuppose that the sequence of absolute differences $(|a_0 - a_1|, \\dots, |a_{N - 1} - a_N|)$\nis a permutation of $(1, 2, \\dots, N)$.\n\nProve that $\\max\\{a_0, a_N\\} \\ge \\lfloor (N + 1)/4 \\rfloor + 1$.\n-/", "formal_statement": "/- special open -/ open Fin\n/--\nA `NicePerm N` is a structure containing the permutations that satisfy the problem's conditions.\n- `toPerm`: The permutation `a` of `{0, ..., N}`.\n- `distPerm`: The permutation of `{1, ..., N}` given by the absolute differences.\n- `distPerm_spec`: The proof that the differences `|a\u1d62 - a\u1d62\u208a\u2081|` match the `distPerm`.\n-/\nstructure NicePerm (N : \u2115) where\n toPerm : Equiv (Fin (N + 1)) (Fin (N + 1))\n distPerm : Equiv (Fin N) (Fin N)\n distPerm_spec : \u2200 i : Fin N,\n Nat.dist (toPerm i.castSucc).val (toPerm i.succ).val = (distPerm i).val + 1\n\ntheorem imo_sl_2023_A5 (N : \u2115) (p : NicePerm N) :\n (if N = 0 then 0 else (N + 1) / 4 + 1) \u2264 max (p.toPerm (last N)).val (p.toPerm 0).val := by sorry", "split": "test", "tags": ["algebra"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2023 A5\n\nLet $N > 0$ be an integer and $(a_0, a_1, \\dots, a_N)$ be a permutation of $(0, 1, \\dots, N)$.\nSuppose that the sequence of absolute differences $(|a_0 - a_1|, \\dots, |a_{N - 1} - a_N|)$\nis a permutation of $(1, 2, \\dots, N)$.\n\nProve that $\\max\\{a_0, a_N\\} \\ge \\lfloor (N + 1)/4 \\rfloor + 1$.\n-/\n/- special open -/ open Fin\n/--\nA `NicePerm N` is a structure containing the permutations that satisfy the problem's conditions.\n- `toPerm`: The permutation `a` of `{0, ..., N}`.\n- `distPerm`: The permutation of `{1, ..., N}` given by the absolute differences.\n- `distPerm_spec`: The proof that the differences `|a\u1d62 - a\u1d62\u208a\u2081|` match the `distPerm`.\n-/\nstructure NicePerm (N : \u2115) where\n toPerm : Equiv (Fin (N + 1)) (Fin (N + 1))\n distPerm : Equiv (Fin N) (Fin N)\n distPerm_spec : \u2200 i : Fin N,\n Nat.dist (toPerm i.castSucc).val (toPerm i.succ).val = (distPerm i).val + 1\n\ntheorem imo_sl_2023_A5 (N : \u2115) (p : NicePerm N) :\n (if N = 0 then 0 else (N + 1) / 4 + 1) \u2264 max (p.toPerm (last N)).val (p.toPerm 0).val := by sorry", "category": "algebra"} {"name": "imo_sl_2023_N2", "problem_id": "2023_N2", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2023 N2\n\nFind all pairs $(a, p) \u2208 \u2115^2$ with $a > 0$ and $p$ prime\n such that $p^a + a^4$ is a perfect square.\n-/", "formal_statement": "def good (a p : \u2115) := \u2203 b, p ^ a + a ^ 4 = b ^ 2\n\ntheorem imo_sl_2023_N2 {a p : \u2115} (ha : 0 < a) (hp : p.Prime) :\n good a p \u2194 p = 3 \u2227 (a = 1 \u2228 a = 2 \u2228 a = 6 \u2228 a = 9) := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2023 N2\n\nFind all pairs $(a, p) \u2208 \u2115^2$ with $a > 0$ and $p$ prime\n such that $p^a + a^4$ is a perfect square.\n-/\ndef good (a p : \u2115) := \u2203 b, p ^ a + a ^ 4 = b ^ 2\n\ntheorem imo_sl_2023_N2 {a p : \u2115} (ha : 0 < a) (hp : p.Prime) :\n good a p \u2194 p = 3 \u2227 (a = 1 \u2228 a = 2 \u2228 a = 6 \u2228 a = 9) := by sorry", "category": "number theory"} {"name": "imo_sl_2023_N3", "problem_id": "2023_N3", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2023 N3\n\nFor any positive integer $n$ and $k \u2265 2$, define $\u03bd_k(n)$\n as the largest exponent $r$ such that $k^r \u2223 n$.\nProve the following:\n1. there are infinitely many $n$ such that $\u03bd_{10}(n!) > \u03bd_9(n!)$; and\n2. there are infinitely many $n$ such that $\u03bd_{10}(n!) < \u03bd_9(n!)$.\n-/", "formal_statement": "theorem imo_sl_2023_N3 (N : \u2115) :\n (\u2203 n > N, padicValNat 9 n.factorial < padicValNat 10 n.factorial) \u2227 \n (\u2203 n > N, padicValNat 10 n.factorial < padicValNat 9 n.factorial) := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2023 N3\n\nFor any positive integer $n$ and $k \u2265 2$, define $\u03bd_k(n)$\n as the largest exponent $r$ such that $k^r \u2223 n$.\nProve the following:\n1. there are infinitely many $n$ such that $\u03bd_{10}(n!) > \u03bd_9(n!)$; and\n2. there are infinitely many $n$ such that $\u03bd_{10}(n!) < \u03bd_9(n!)$.\n-/\ntheorem imo_sl_2023_N3 (N : \u2115) :\n (\u2203 n > N, padicValNat 9 n.factorial < padicValNat 10 n.factorial) \u2227 \n (\u2203 n > N, padicValNat 10 n.factorial < padicValNat 9 n.factorial) := by sorry", "category": "number theory"} {"name": "imo_sl_2023_N4", "problem_id": "2023_N4", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2023 N4\n\nLet $a_0, a_1, \u2026, a_{n - 1}, b_0, b_1, \u2026, b_{n - 1} \u2208 \u2115^+$ and\n $D$ be a positive integer such that for each $i \u2264 n$,\n$$ b_0 b_1 \u2026 b_i a_{i + 1} \u2026 a_{n - 1} = b_0 b_1 \u2026 b_{i - 1} a_i \u2026 a_{n - 1} + D. $$\nDetermine the smallest possible value of $D$.\n-/", "formal_statement": "/- special open -/ open Finset\nstructure goodSeq (n : \u2115) where\n a : \u2115 \u2192 \u2115\n a_pos : \u2200 i, 0 < a i\n b : \u2115 \u2192 \u2115\n b_pos : \u2200 i, 0 < b i\n D : \u2115\n D_pos : 0 < D\n spec : \u2200 i < n, (range (i + 1)).prod b * (Ico (i + 1) n).prod a\n = (range i).prod b * (Ico i n).prod a + D\n\ntheorem imo_sl_2023_N4 (n : \u2115) : IsLeast (Set.range (goodSeq.D (n := n))) n.factorial := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2023 N4\n\nLet $a_0, a_1, \u2026, a_{n - 1}, b_0, b_1, \u2026, b_{n - 1} \u2208 \u2115^+$ and\n $D$ be a positive integer such that for each $i \u2264 n$,\n$$ b_0 b_1 \u2026 b_i a_{i + 1} \u2026 a_{n - 1} = b_0 b_1 \u2026 b_{i - 1} a_i \u2026 a_{n - 1} + D. $$\nDetermine the smallest possible value of $D$.\n-/\n/- special open -/ open Finset\nstructure goodSeq (n : \u2115) where\n a : \u2115 \u2192 \u2115\n a_pos : \u2200 i, 0 < a i\n b : \u2115 \u2192 \u2115\n b_pos : \u2200 i, 0 < b i\n D : \u2115\n D_pos : 0 < D\n spec : \u2200 i < n, (range (i + 1)).prod b * (Ico (i + 1) n).prod a\n = (range i).prod b * (Ico i n).prod a + D\n\ntheorem imo_sl_2023_N4 (n : \u2115) : IsLeast (Set.range (goodSeq.D (n := n))) n.factorial := by sorry", "category": "number theory"} {"name": "imo_sl_2023_N5", "problem_id": "2023_N5", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2023 N5\n\nLet $(a_n)_{n \\ge 0}$ be a strictly increasing sequence of positive integers such that:\n* For all $k \\ge 1$, $a_k$ divides $2(a_0 + a_1 + \\dots + a_{k - 1})$.\n* For each prime $p$, there exists some $k$ such that $p$ divides $a_k$.\n\nProve that for any positive integer $n$, there exists some $k$ such that $n$ divides $a_k$.\n-/", "formal_statement": "/- special open -/ open Finset\nstructure GoodSeq where\n a : \u2115 \u2192 \u2115\n a_strictMono : StrictMono a\n a_pos : \u2200 k, 0 < a k\n a_spec : \u2200 k, a k \u2223 2 * \u2211 i \u2208 range k, a i\n exists_dvd_a_of_prime : \u2200 p : \u2115, p.Prime \u2192 \u2203 k, p \u2223 a k\n\ntheorem imo_sl_2023_N5 (X : GoodSeq) (N : \u2115) (hN : 0 < N) :\n \u2203 k, N \u2223 X.a k := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2023 N5\n\nLet $(a_n)_{n \\ge 0}$ be a strictly increasing sequence of positive integers such that:\n* For all $k \\ge 1$, $a_k$ divides $2(a_0 + a_1 + \\dots + a_{k - 1})$.\n* For each prime $p$, there exists some $k$ such that $p$ divides $a_k$.\n\nProve that for any positive integer $n$, there exists some $k$ such that $n$ divides $a_k$.\n-/\n/- special open -/ open Finset\nstructure GoodSeq where\n a : \u2115 \u2192 \u2115\n a_strictMono : StrictMono a\n a_pos : \u2200 k, 0 < a k\n a_spec : \u2200 k, a k \u2223 2 * \u2211 i \u2208 range k, a i\n exists_dvd_a_of_prime : \u2200 p : \u2115, p.Prime \u2192 \u2203 k, p \u2223 a k\n\ntheorem imo_sl_2023_N5 (X : GoodSeq) (N : \u2115) (hN : 0 < N) :\n \u2203 k, N \u2223 X.a k := by sorry", "category": "number theory"} {"name": "imo_sl_2023_N6", "problem_id": "2023_N6", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2023 N6\n\nA sequence $(a_n)_{n \u2265 0}$ is called *kawaii* if $a_0 = 0$, $a_1 = 1$, and for any $n \u2208 \u2115$,\n$$ a_{n + 2} + 2 a_n = 3 a_{n + 1} \\text{ or } a_{n + 2} + 3 a_n = 4 a_{n + 1}. $$\nA non-negative integer $m$ is said to be *kawaii* if it belongs to some kawaii sequence.\n\nLet $m \u2208 \u2115$ such that both $m$ and $m + 1$ are kawaii.\nProve that $3 \u2223 m$ and $m/3$ belongs to a kawaii sequence.\n-/", "formal_statement": "@[ext] structure KawaiiSequence (S : Set \u2115) where\n a : \u2115 \u2192 \u2115\n a_zero : a 0 = 0\n a_one : a 1 = 1\n a_step : \u2200 n, \u2203 c : S, a (n + 2) + c * a n = (c + 1) * a (n + 1)\n\ntheorem imo_sl_2023_N6 (hn : \u2203 (X : KawaiiSequence {2, 3}) (k : \u2115), n = X.a k)\n (hn0 : \u2203 (X : KawaiiSequence {2, 3}) (k : \u2115), n + 1 = X.a k) :\n \u2203 m, (\u2203 (X : KawaiiSequence {2, 3}) (k : \u2115), m = X.a k) \u2227 n = 3 * m := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2023 N6\n\nA sequence $(a_n)_{n \u2265 0}$ is called *kawaii* if $a_0 = 0$, $a_1 = 1$, and for any $n \u2208 \u2115$,\n$$ a_{n + 2} + 2 a_n = 3 a_{n + 1} \\text{ or } a_{n + 2} + 3 a_n = 4 a_{n + 1}. $$\nA non-negative integer $m$ is said to be *kawaii* if it belongs to some kawaii sequence.\n\nLet $m \u2208 \u2115$ such that both $m$ and $m + 1$ are kawaii.\nProve that $3 \u2223 m$ and $m/3$ belongs to a kawaii sequence.\n-/\n@[ext] structure KawaiiSequence (S : Set \u2115) where\n a : \u2115 \u2192 \u2115\n a_zero : a 0 = 0\n a_one : a 1 = 1\n a_step : \u2200 n, \u2203 c : S, a (n + 2) + c * a n = (c + 1) * a (n + 1)\n\ntheorem imo_sl_2023_N6 (hn : \u2203 (X : KawaiiSequence {2, 3}) (k : \u2115), n = X.a k)\n (hn0 : \u2203 (X : KawaiiSequence {2, 3}) (k : \u2115), n + 1 = X.a k) :\n \u2203 m, (\u2203 (X : KawaiiSequence {2, 3}) (k : \u2115), m = X.a k) \u2227 n = 3 * m := by sorry", "category": "number theory"} {"name": "imo_sl_2023_N7", "problem_id": "2023_N7", "header": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n", "informal_prefix": "/-!\n# IMO 2023 N7\n\nFind all possible values of $a + b + c + d$ across all $a, b, c, d \u2208 \u2115^+$ satisfying\n$$ \\frac{ab}{a + b} + \\frac{cd}{c + d} = \\frac{(a + b)(c + d)}{a + b + c + d}. $$\n-/", "formal_statement": "class nice (a b c d : \u2115) : Prop where\n a_pos : 0 < a\n b_pos : 0 < b\n c_pos : 0 < c\n d_pos : 0 < d\n spec : ((a * b : \u2115) : \u211a) / (a + b : \u2115) + (c * d : \u2115) / (c + d : \u2115)\n = (a + b : \u2115) * (c + d : \u2115) / (a + b + c + d : \u2115)\n\ntheorem imo_sl_2023_N7 (hn : 0 < n) :\n (\u2203 a b c d, nice a b c d \u2227 a + b + c + d = n) \u2194 \u00acSquarefree n := by sorry", "split": "test", "tags": ["number theory"], "solved": true, "lean4_code": "\nimport Mathlib\nimport Aesop\n\nset_option maxHeartbeats 0\n\nopen BigOperators Real Nat Topology Rat\n\n/-!\n# IMO 2023 N7\n\nFind all possible values of $a + b + c + d$ across all $a, b, c, d \u2208 \u2115^+$ satisfying\n$$ \\frac{ab}{a + b} + \\frac{cd}{c + d} = \\frac{(a + b)(c + d)}{a + b + c + d}. $$\n-/\nclass nice (a b c d : \u2115) : Prop where\n a_pos : 0 < a\n b_pos : 0 < b\n c_pos : 0 < c\n d_pos : 0 < d\n spec : ((a * b : \u2115) : \u211a) / (a + b : \u2115) + (c * d : \u2115) / (c + d : \u2115)\n = (a + b : \u2115) * (c + d : \u2115) / (a + b + c + d : \u2115)\n\ntheorem imo_sl_2023_N7 (hn : 0 < n) :\n (\u2203 a b c d, nice a b c d \u2227 a + b + c + d = n) \u2194 \u00acSquarefree n := by sorry", "category": "number theory"}