Compfiles/Imo2014P2.lean
Explanation legend Lean4 Domain Explanation Language (L4DEL)
L4DEL explanations are a separate layer. They do not change the Lean source. Intuition is explanatory prose; numbered items are a reading path; sources link the wording back to evidence.
- L4DEL
- Lean4 Domain Explanation Language
Credit: The upstream authors and contributors retain credit for the project and mathematics. lean4-explainer only renders their pinned source and adds the separately disclosed explanation layer.
Project sources: Pinned compfiles documentation, Pinned compfiles corpus index
10 declarations, 0 contain sorry, 0 declared as axioms
International Mathematical Olympiad 2014, Problem 2
Let $n \ge 2$ be an integer. Consider an $n \times n$ chessboard consisting of $n^2$ unit squares. A configuration of $n$ rooks on this board is peaceful if every row and every column contains exactly one rook. Find the greatest positive integer $k$ such that, for each peaceful configuration of $n$ rooks, there is a $k \times k$ square which does not contain a rook on any of its $k^2$ unit squares.
Imports (2)
Imported by 1 file
- def
Imo2014P2.HasEmptySquareA peaceful configuration ofnrooks is a permutationσ: the rook in rowisits in columnσ iline 36 sourceSource documentation
A peaceful configuration of
nrooks is a permutationσ: the rook in rowisits in columnσ i. Such a configuration has a rook-freek × ksquare if there is a block ofkconsecutive rows andkconsecutive columns (fitting on the board) containing no rook.standard axioms: Quot.sound what this means
Statement uses:
Nat,Equiv.Perm,FinProof uses:
Exists,And,LE.le,HAdd.hAdd,LT.lt,Not8 instances, coercions and auxiliary constants left out.
def HasEmptySquare (σ : Equiv.Perm (Fin n)) (k : ℕ) : Prop := …
- lemma
Imo2014P2.hasEmptySquare_monoAn emptyk × ksquare contains an emptyj × jsquare wheneverj ≤ kline 44 sourceSource documentation
An empty
k × ksquare contains an emptyj × jsquare wheneverj ≤ k.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Equiv.Perm,Fin,LE.le, Imo2014P2.HasEmptySquareProof uses:
Exists,And,HAdd.hAdd,LT.lt,Not,Exists.intro,And.intro,And.left14 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.
lemma hasEmptySquare_mono {σ : Equiv.Perm (Fin n)} {j k : ℕ} (hjk : j ≤ k) (h : HasEmptySquare σ k) : HasEmptySquare σ j := by …Mentions: h, Imo2014P2.HasEmptySquare
- lemma
Imo2014P2.sqrt_bounds⌊√(n-1)⌋² < n ≤ (⌊√(n-1)⌋+1)²line 50 sourceSource documentation
⌊√(n-1)⌋² < n ≤ (⌊√(n-1)⌋+1)².standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,And,LT.lt,HMul.hMul,Nat.sqrt,HSub.hSub,HAdd.hAddProof uses:
And.intro,HPow.hPow,Nat.sqrt_le',Nat.succ,Nat.lt_succ_sqrt'23 instances, coercions and auxiliary constants left out.
Tactic trace: 7 steps
Open to load the checked before-and-after goal states.
lemma sqrt_bounds (hn : 2 ≤ n) : Nat.sqrt (n - 1) * Nat.sqrt (n - 1) < n ∧ n ≤ (Nat.sqrt (n - 1) + 1) * (Nat.sqrt (n - 1) + 1) := by … - lemma
Imo2014P2.exists_empty_squareExistence (lower bound): every peaceful configuration has an empty⌊√(n-1)⌋ × ⌊√(n-1)⌋square line 65 sourceSource documentation
Existence (lower bound): every peaceful configuration has an empty
⌊√(n-1)⌋ × ⌊√(n-1)⌋square.Following Evan Chen: let
Rbe the rook in the top row, in columncol₀, and stackksquares of sizek × kdirectly below it. Thekcolumns of that stack containkrooks in total, butR's rook sits at row0, above the stack — so the stack holds at mostk - 1rooks amongkdisjoint squares, and one of them is empty.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,Equiv.Perm,Fin, Imo2014P2.HasEmptySquare,Nat.sqrt,HSub.hSubProof uses:
Eq.mpr,id,Eq,congrArg,rfl,LT.lt,HMul.hMul,And.left,HAdd.hAdd, Imo2014P2.sqrt_bounds,Iff.mpr,Nat.le_sqrt,Nat.mul_le_mul_left,Fin.mk,Fin.isLt,Min.min,min_le_right,And,And.intro,min_le_leftand 73 more82 instances, coercions and auxiliary constants left out.
Tactic trace: 97 steps
Open to load the checked before-and-after goal states.
lemma exists_empty_square (hn : 2 ≤ n) (σ : Equiv.Perm (Fin n)) : HasEmptySquare σ (Nat.sqrt (n - 1)) := by …Mentions: Imo2014P2.HasEmptySquare
- def
Imo2014P2.HasRookσplaces a rook in every axis-alignedK × Ksquare — exactly the negation ofHasEmptySquareline 162 sourceSource documentation
σplaces a rook in every axis-alignedK × Ksquare — exactly the negation ofHasEmptySquare.standard axioms: Quot.sound what this means
Statement uses:
Nat,Equiv.Perm,FinProof uses:
LE.le,HAdd.hAdd,Exists,And,LT.lt8 instances, coercions and auxiliary constants left out.
def HasRook {m : ℕ} (σ : Equiv.Perm (Fin m)) (K : ℕ) : Prop := … - lemma
Imo2014P2.covering_restrictRestriction reduction: a rook-covering configuration on anM × Mboard restricts (top-left, then completed arbitrarily) to one on any smallerN × Nboard line 171 sourceSource documentation
Restriction reduction: a rook-covering configuration on an
M × Mboard restricts (top-left, then completed arbitrarily) to one on any smallerN × Nboard. The key point: everyK × Ksquare of theN × Nboard lies inside[0,N)², so its witnessing rook already has both coordinates< Nand survives the restriction; the arbitrary completion only adds rooks.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,Equiv.Perm,Fin, Imo2014P2.HasRook,ExistsProof uses:
dite,LT.lt,Fin.castLE,Fin.mk,Not,Eq,rfl,Set,Set.ofPred,Set.InjOn,Membership.mem,Eq.mp,congrFun',congrArg,congr,of_eq_true,eq_true,Eq.trans,dite_eq_left_of_eq_true,Fin.castLE_injectiveand 30 more22 instances, coercions and auxiliary constants left out.
Tactic trace: 46 steps
Open to load the checked before-and-after goal states.
lemma covering_restrict {K M N : ℕ} (hNM : N ≤ M) (τ : Equiv.Perm (Fin M)) (hτ : HasRook τ K) : ∃ σ : Equiv.Perm (Fin N), HasRook σ K := by …Mentions: Imo2014P2.HasRook
- lemma
Imo2014P2.transpose_coveringBase case of the construction: the grid-transposei ↦ K·(i % K) + i / Kis a permutation of theK² × K²board placing a rook in everyK × Ksquare line 217 sourceSource documentation
Base case of the construction: the grid-transpose
i ↦ K·(i % K) + i / Kis a permutation of theK² × K²board placing a rook in everyK × Ksquare.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,Exists,Equiv.Perm,Fin,HMul.hMul, Imo2014P2.HasRookProof uses:
LT.lt,HDiv.hDiv,Iff.mpr,Nat.div_lt_iff_lt_mul,Fin.isLt,HAdd.hAdd,HMod.hMod,Nat.mod_lt,Nat.mul_add_lt_mul_of_lt_of_lt,Fin.mk,Eq,rfl,Function.Involutive,Fin.ext,Eq.mpr,id,congrArg,Nat.mul_add_mod,Nat.mod_eq_of_lt,Nat.mul_add_divand 37 more68 instances, coercions and auxiliary constants left out.
Tactic trace: 106 steps
Open to load the checked before-and-after goal states.
lemma transpose_covering (K : ℕ) (hK : 1 ≤ K) : ∃ τ : Equiv.Perm (Fin (K * K)), HasRook τ K := by …Mentions: Imo2014P2.HasRook
- lemma
Imo2014P2.exists_config_no_squareOptimality (upper bound): some peaceful configuration has no empty(⌊√(n-1)⌋+1) × (⌊√(n-1)⌋+1)square line 284 sourceSource documentation
Optimality (upper bound): some peaceful configuration has no empty
(⌊√(n-1)⌋+1) × (⌊√(n-1)⌋+1)square.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,Exists,Equiv.Perm,Fin,Not, Imo2014P2.HasEmptySquare,HAdd.hAdd,Nat.sqrt,HSub.hSubProof uses:
Eq.mpr,id,Eq,congrArg,rfl,HMul.hMul,And.right,LT.lt, Imo2014P2.sqrt_bounds, Imo2014P2.HasRook, Imo2014P2.transpose_covering, Imo2014P2.covering_restrict,Exists.intro,And,False,And.intro22 instances, coercions and auxiliary constants left out.
Tactic trace: 13 steps
Open to load the checked before-and-after goal states.
lemma exists_config_no_square (hn : 2 ≤ n) : ∃ σ : Equiv.Perm (Fin n), ¬ HasEmptySquare σ (Nat.sqrt (n - 1) + 1) := by …Mentions: Imo2014P2.HasEmptySquare
- determine
Imo2014P2.greatestKline 298 sourceno axioms what this means
Statement uses:
NatProof uses:
Nat.sqrt,HSub.hSub,OfNat.ofNat3 instances, coercions and auxiliary constants left out.
- problem
Imo2014P2.imo2014_p2line 300 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,IsGreatest,Set.ofPred,Equiv.Perm,Fin, Imo2014P2.HasEmptySquare, Imo2014P2.greatestKProof uses:
And.intro,Membership.mem,Set,upperBounds, Imo2014P2.exists_empty_square,id,Decidable.byContradiction,Nat.sqrt,HSub.hSub,Not,HAdd.hAdd,Exists,False, Imo2014P2.exists_config_no_square, Imo2014P2.hasEmptySquare_mono12 instances, coercions and auxiliary constants left out.
Tactic trace: 11 steps
Open to load the checked before-and-after goal states.