IMO2004 P3
open: first valid proof sets the record
Compfiles · Imo · Apache-2.0
Copyright (c) 2026 The Compfiles Contributors. All rights reserved. Authors: Kimi K3
Statement
import Mathlib.Tactic
theorem _root_.LeanGolf.compfiles.imo2004_p3 (m n : ℕ) (hm : 0 < m) (hn : 0 < n) :
Tileable (rect m n) ↔ (m, n) ∈ answerTrusted statement context
noncomputable section
namespace Imo2004P3
def rect (m n : ℕ) : Finset (ℤ × ℤ) :=
((Finset.range m) ×ˢ (Finset.range n)).image fun p => ((p.1 : ℤ), (p.2 : ℤ))
def hookShapes : Finset (Finset (ℤ × ℤ)) :=
{ {(0, 0), (0, 1), (0, 2), (1, 0), (1, 2), (2, 0)},
{(0, 0), (0, 1), (0, 2), (1, 0), (1, 2), (2, 2)},
{(0, 0), (0, 1), (0, 2), (1, 0), (2, 0), (2, 1)},
{(0, 0), (0, 1), (1, 0), (2, 0), (2, 1), (2, 2)},
{(0, 0), (1, 0), (1, 2), (2, 0), (2, 1), (2, 2)},
{(0, 2), (1, 0), (1, 2), (2, 0), (2, 1), (2, 2)},
{(0, 1), (0, 2), (1, 2), (2, 0), (2, 1), (2, 2)},
{(0, 0), (0, 1), (0, 2), (1, 2), (2, 1), (2, 2)} }
def IsHook (s : Finset (ℤ × ℤ)) : Prop := ∃ σ ∈ hookShapes, ∃ t, s = σ.image (· + t)
def Tileable (R : Finset (ℤ × ℤ)) : Prop :=
∃ 𝒯 : Finset (Finset (ℤ × ℤ)), (∀ H ∈ 𝒯, IsHook H) ∧
(∀ H₁ ∈ 𝒯, ∀ H₂ ∈ 𝒯, H₁ ≠ H₂ → Disjoint H₁ H₂) ∧ R = 𝒯.biUnion id
def GoodRect (m n : ℕ) : Prop :=
m ≠ 1 ∧ m ≠ 2 ∧ m ≠ 5 ∧ n ≠ 1 ∧ n ≠ 2 ∧ n ≠ 5 ∧ (3 ∣ m ∨ 3 ∣ n) ∧ (4 ∣ m ∨ 4 ∣ n)
abbrev answer : Set (ℕ × ℕ) :=
{p | GoodRect p.1 p.2}