lean-golf Lean 4 proof leaderboard

IMO2014 P2

open: first valid proof sets the record

Compfiles · Imo · Apache-2.0
Copyright (c) 2026 The Compfiles Contributors. All rights reserved.

Statement

import Mathlib
theorem _root_.LeanGolf.compfiles.imo2014_p2 (n : ℕ) (hn : 2 ≤ n) :
    IsGreatest {k : ℕ | ∀ σ : Equiv.Perm (Fin n), HasEmptySquare σ k} (greatestK n)
Trusted statement context
noncomputable section

namespace Imo2014P2

variable {n : ℕ}

def HasEmptySquare (σ : Equiv.Perm (Fin n)) (k : ℕ) : Prop :=
  ∃ r c : ℕ, r + k ≤ n ∧ c + k ≤ n ∧
    ∀ i : Fin n, r ≤ (i : ℕ) → (i : ℕ) < r + k →
      ¬ (c ≤ (σ i : ℕ) ∧ (σ i : ℕ) < c + k)

abbrev greatestK : ℕ → ℕ := fun n ↦ Nat.sqrt (n - 1)