lean-golf Lean 4 proof leaderboard

IMO2023 P3

open: first valid proof sets the record

Compfiles · Imo · Apache-2.0
Copyright (c) 2025 the Compfiles Contributors. All rights reserved. Authors: Joseph Myers, Kimi K3

Statement

import Mathlib.Algebra.Field.ZMod
import Mathlib.Analysis.Normed.Ring.Lemmas
import Mathlib.Logic.Equiv.Fin.Rotate
import Mathlib.Tactic.LinearCombination
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.Ring
theorem _root_.LeanGolf.compfiles.imo2023_p3
    {k : ℕ} (_hk : 0 < k) (S : Finset ℕ) (hne : S.Nonempty)
    (hS : ∀ p ∈ S, Odd p ∧ Nat.Prime p)
    {p₁ p₂ : Fin #S ≃ S} (hp₁ : Condition k S p₁) (hp₂ : Condition k S p₂) :
    (∃ i, ∀ j, p₂ j = p₁ (j + i)) ∨ ∃ i, ∀ j, p₂ j = p₁ (Fin.rev j + i)
Trusted statement context
noncomputable section

namespace Imo2022P3

open scoped Finset

open Fin.NatCast

def Condition (k : ℕ) (S : Finset ℕ) (p : Fin #S ≃ S) : Prop :=
  ∀ i, have : NeZero #S := ⟨i.pos.ne'⟩
  ∃ x : ℕ, 0 < x ∧ ((p i : ℕ) * (p (i + 1) : ℕ)) = x ^ 2 + x + k