import Mathlib.Tactic
/-!
# International Mathematical Olympiad 2023, Problem 4
Let x₁, x₂, ... x₂₀₂₃ be distinct positive real numbers.
Define
aₙ := √((x₁ + x₂ + ... + xₙ)(1/x₁ + 1/x₂ + ... + 1/xₙ)).
Suppose that aₙ is an integer for all n ∈ {1,...,2023}.
Prove that 3034 ≤ a₂₀₂₃.
-/
namespace Imo2023P4
noncomputable def a (x : Finset.Icc 1 2023 → ℝ) (n : Finset.Icc 1 2023) : ℝ :=
√((∑ i ∈ Finset.univ.filter (· ≤ n), x i) *
(∑ i ∈ Finset.univ.filter (· ≤ n), (1 / x i)))
theorem imo2023_p4
(x : Finset.Icc 1 2023 → ℝ)
(hxp : ∀ i, 0 < x i)
(hxi : x.Injective)
(hxa : ∀ i : Finset.Icc 1 2023, ∃ k : ℤ, a x i = k)
: 3034 ≤ a x ⟨2023, by simp⟩ := sorry
end Imo2023P4
This problem has a complete formalized solution.