Compfiles/Usa2000P4.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
14 declarations, 0 contain sorry, 0 declared as axioms
USA Mathematical Olympiad 2000, Problem 4
Find the smallest positive integer $n$ such that if $n$ squares of a $1000 \times 1000$ chessboard are colored, then there will exist three colored squares whose centers form a right triangle with sides parallel to the edges of the board.
Imports (5)
Imported by 1 file
- def
Usa2000P4.GoodDocumented declaration: Good line 34 sourceSource documentation
A set
Sof squares on anm × nboard contains no forbidden triangle: one cannot find three (distinct) chosen squares whose centers form a right triangle with sides parallel to the edges of the board, that is, with two of them in the same row and two of them in the same column.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Finset,Prod,FinProof uses:
Membership.mem,Ne,Not,And,Or,Eq,Prod.fst,Prod.snd2 instances, coercions and auxiliary constants left out.
def Good {m n : ℕ} (S : Finset (Fin m × Fin n)) : Prop := …Mentions: S
- def
Usa2000P4.rowFiberThe squares ofSlying in rowrline 41 sourceSource documentation
The squares of
Slying in rowr.standard axioms: Quot.sound, propext what this means
Statement uses:
Nat,Finset,Prod,FinProof uses:
Finset.filter,Eq,Prod.fst1 instances, coercions and auxiliary constants left out.
def rowFiber {m n : ℕ} (S : Finset (Fin m × Fin n)) (r : Fin m) : Finset (Fin m × Fin n) := …Mentions: S
- def
Usa2000P4.colFiberThe squares ofSlying in columncline 45 sourceSource documentation
The squares of
Slying in columnc.standard axioms: Quot.sound, propext what this means
Statement uses:
Nat,Finset,Prod,FinProof uses:
Finset.filter,Eq,Prod.snd1 instances, coercions and auxiliary constants left out.
def colFiber {m n : ℕ} (S : Finset (Fin m × Fin n)) (c : Fin n) : Finset (Fin m × Fin n) := …Mentions: S
- lemma
Usa2000P4.mem_rowFiberline 48 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Finset,Prod,Fin,Iff,Membership.mem, Usa2000P4.rowFiber,And,Eq,Prod.fstProof uses:
Finset.mem_filter3 instances, coercions and auxiliary constants left out.
- lemma
Usa2000P4.mem_colFiberline 51 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Finset,Prod,Fin,Iff,Membership.mem, Usa2000P4.colFiber,And,Eq,Prod.sndProof uses:
Finset.mem_filter3 instances, coercions and auxiliary constants left out.
- lemma
Usa2000P4.Good.monoAny subset of a good set is good line 55 sourceSource documentation
Any subset of a good set is good.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Finset,Prod,Fin,LE.le, Usa2000P4.GoodProof uses:
Membership.mem8 instances, coercions and auxiliary constants left out.
lemma Good.mono {m n : ℕ} {S T : Finset (Fin m × Fin n)} (hTS : T ⊆ S) (hS : Good S) : Good T := …Mentions: S, Usa2000P4.Good
- lemma
Usa2000P4.alone_of_goodDocumented declaration: alone_of_good line 63 sourceSource documentation
In a good set, every chosen square is the unique chosen square of its row or the unique chosen square of its column: otherwise the square together with a different chosen square in its row and a different chosen square in its column would form a forbidden configuration.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Finset,Prod,Fin, Usa2000P4.Good,Membership.mem,Or,Eq,Prod.fst,Prod.sndProof uses:
Decidable.byContradiction,Not,Exists,And,Ne,False,Eq.mp,Eq.trans,congr,congrArg,Mathlib.Tactic.Push.not_forall_eq,funext,Prod.ext,Ne.symm,And.intro,Or.inl,Eq.symm,Or.inr17 instances, coercions and auxiliary constants left out.
Tactic trace: 7 steps
Open to load the checked before-and-after goal states.
lemma alone_of_good {m n : ℕ} {S : Finset (Fin m × Fin n)} (hS : Good S) {s : Fin m × Fin n} (hs : s ∈ S) : (∀ t ∈ S, t.1 = s.1 → t = s) ∨ (∀ t ∈ S, t.2 = s.2 → t = s) := by …Mentions: S, Usa2000P4.Good
- lemma
Usa2000P4.good_of_aloneDocumented declaration: good_of_alone line 79 sourceSource documentation
Conversely, if every square of
Sis alone in its row or alone in its column, thenSis good: in any would-be forbidden triple, the row-pair and the column-pair share a square, which then has both a row-partner and a column-partner.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Finset,Prod,Fin,Membership.mem,Or,Eq,Prod.fst,Prod.snd, Usa2000P4.GoodProof uses:
Ne,And,False,Eq.symm,absurd,Prod.ext,Ne.symm6 instances, coercions and auxiliary constants left out.
Tactic trace: 28 steps
Open to load the checked before-and-after goal states.
lemma good_of_alone {m n : ℕ} {S : Finset (Fin m × Fin n)} (h : ∀ s ∈ S, (∀ t ∈ S, t.1 = s.1 → t = s) ∨ (∀ t ∈ S, t.2 = s.2 → t = s)) : Good S := by …Mentions: S, h, Usa2000P4.Good
- lemma
Usa2000P4.card_le_of_goodUpper bound: a good set on anm × nboard withm, n ≥ 2has at mostm + n - 2squares line 111 sourceSource documentation
Upper bound: a good set on an
m × nboard withm, n ≥ 2has at mostm + n - 2squares.Proof: call a row (resp. column) light if it contains exactly one chosen square and heavy if it contains at least two. The squares lying in light rows are in bijection with the light rows, and every square in a heavy row is the unique chosen square of its column (by
alone_of_good), so the squares in heavy rows inject into the light columns. Hence|S| ≤ (#light rows) + (#light columns). If there is at least one heavy row and one heavy column, this is at mostm + n - 2; if there is no heavy row then|S| ≤ m, and if there is no heavy column then|S| ≤ n.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,Finset,Prod,Fin, Usa2000P4.Good,Finset.card,HSub.hSub,HAdd.hAddProof uses:
Finset.image,Prod.fst,Eq,rfl,Prod.snd,Finset.filter, Usa2000P4.rowFiber, Usa2000P4.colFiber,Membership.mem,And,Exists,Eq.mp,congrArg,propext,Finset.mem_image,Eq.mpr,id,Eq.symm,Iff.mpr,LT.ltand 48 more62 instances, coercions and auxiliary constants left out.
Tactic trace: 169 steps
Open to load the checked before-and-after goal states.
lemma card_le_of_good {m n : ℕ} (hm : 2 ≤ m) (hn : 2 ≤ n) {S : Finset (Fin m × Fin n)} (hS : Good S) : S.card ≤ m + n - 2 := by …Mentions: S, Usa2000P4.Good
- def
Usa2000P4.constructionThe extremal configuration: every square of row0or of column0, except the corner square(0, 0)line 281 sourceSource documentation
The extremal configuration: every square of row
0or of column0, except the corner square(0, 0).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Finset,Prod,Fin,OfNat.ofNat,NatProof uses:
Union.union,SProd.sprod,Singleton.singleton,Finset.erase,Finset.univ10 instances, coercions and auxiliary constants left out.
def construction : Finset (Fin 1000 × Fin 1000) := …
- lemma
Usa2000P4.card_constructionDocumented declaration: card_construction line 289 sourceSource comment
The `constructorNameAsVariable` linter normalizes the types of all binders; here those are memberships in concrete finsets on the `1000 × 1000` board, whose `whnf` unfolds a 1000-element list and exceeds the recursion limit.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Eq,Nat,Finset.card,Prod,Fin,OfNat.ofNat, Usa2000P4.constructionProof uses:
SProd.sprod,Finset,Singleton.singleton,Finset.erase,Finset.univ,Eq.mpr,HMul.hMul,id,congrArg,Finset.card_product,Finset.card_singleton,HSub.hSub,Finset.card_erase_of_mem,Finset.mem_univ,Fintype.card,Finset.card_univ,Fintype.card_fin,Eq.refl,Disjoint,Membership.memand 16 more20 instances, coercions and auxiliary constants left out.
Tactic trace: 12 steps
Open to load the checked before-and-after goal states.
lemma card_construction : construction.card = 1998 := by …
- lemma
Usa2000P4.good_constructionSee the comment atcard_constructionfor the disabled linter line 312 sourceSource comment
See the comment at `card_construction` for the disabled linter.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2000P4.Good,
OfNat.ofNat,Nat, Usa2000P4.constructionProof uses:
Eq,Finset,Prod,Fin,Union.union,SProd.sprod,Singleton.singleton,Finset.erase,Finset.univ,rfl, Usa2000P4.good_of_alone,Membership.mem,And,Prod.fst,Prod.snd,Or,Eq.mp,congrArg,propext,Finset.mem_productand 11 more14 instances, coercions and auxiliary constants left out.
Tactic trace: 31 steps
Open to load the checked before-and-after goal states.
lemma good_construction : Good construction := by …
Mentions: Usa2000P4.Good, Usa2000P4.construction
- determine
Usa2000P4.smallestNline 345 sourceno axioms what this means
Statement uses:
NatProof uses:
OfNat.ofNat1 instances, coercions and auxiliary constants left out.
- problem
Usa2000P4.usa2000_p4line 347 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
IsLeast,Nat,Set.ofPred,Finset,Prod,Fin,OfNat.ofNat,Eq,Finset.card,Not, Usa2000P4.Good, Usa2000P4.smallestNProof uses:
And.intro,Membership.mem,Set,lowerBounds,LE.le,HSub.hSub,HAdd.hAdd, Usa2000P4.card_le_of_good,Mathlib.Meta.NormNum.isNat_le_true,Mathlib.Meta.NormNum.isNat_ofNat,Eq.refl,Bool,Bool.true,Decidable.byContradiction,LT.lt,Nat.lt_of_not_le,And, Usa2000P4.construction,Exists,Falseand 7 more25 instances, coercions and auxiliary constants left out.
Tactic trace: 18 steps
Open to load the checked before-and-after goal states.