Compfiles/Usa1999P1.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
23 declarations, 0 contain sorry, 0 declared as axioms
USA Mathematical Olympiad 1999, Problem 1
Some checkers placed on an n × n checkerboard satisfy the following conditions: a. every square that does not contain a checker shares a side with one that does; b. given any pair of squares that contain checkers, there is a sequence of squares containing checkers, starting and ending with the given squares, such that every two consecutive squares of the sequence share a side.
Prove that at least (n²-2)/3 checkers have been placed on the board.
Imports (12)
- Batteries.Data.List.Basic
- Mathlib.Data.Finset.Basic
- Mathlib.Data.Finset.Card
- Mathlib.Data.Fintype.BigOperators
- Mathlib.Data.Fintype.Prod
- Mathlib.Data.List.Chain
- Mathlib.Combinatorics.SimpleGraph.Acyclic
- Mathlib.Combinatorics.SimpleGraph.DegreeSum
- Mathlib.Combinatorics.SimpleGraph.Connectivity.Connected
- Mathlib.Combinatorics.SimpleGraph.Hasse
- Mathlib.Tactic.Linarith
- ProblemExtraction
Imported by 1 file
- def
Usa1999P1.checkerboardline 41 sourceno axioms what this means
Statement uses:
NatProof uses:
Prod,Fin - def
Usa1999P1.adjacentline 43 sourceno axioms what this means
Statement uses:
Nat, Usa1999P1.checkerboardProof uses:
Usa1999P1.adjacent.match_1,Fin,Or,And,Eq,HAdd.hAdd,OfNat.ofNat4 instances, coercions and auxiliary constants left out.
- instance
Usa1999P1.checkerboardFintypeline 52 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fintype, Usa1999P1.checkerboardProof uses:
Fintype.mk2 instances, coercions and auxiliary constants left out.
- instance
Usa1999P1.checkerboardDecidableEqline 55 sourceno axioms what this means
Statement uses:
Nat,DecidableEq, Usa1999P1.checkerboard1 instances, coercions and auxiliary constants left out.
- instance
Usa1999P1.pathGraphDecidableRelline 58 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,DecidableRel,Fin,SimpleGraph.Adj,SimpleGraph.pathGraphProof uses:
Eq.mpr,Decidable,Or,Eq,HAdd.hAdd,OfNat.ofNat,inferInstance7 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- instance
Usa1999P1.adjacentDecidableRelline 63 sourceno axioms what this means
Statement uses:
Nat,DecidableRel, Usa1999P1.checkerboard, Usa1999P1.adjacentProof uses:
Fin,Decidable,Prod.mk,id,inferInstance,Usa1999P1.adjacent.match_1,Or,And,Eq,HAdd.hAdd,OfNat.ofNat8 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
- def
Usa1999P1.gridGraphUse the full grid graph and the subgraph induced by the checkers line 71 sourceSource comment
Use the full grid graph and the subgraph induced by the checkers.standard axioms: Quot.sound, propext what this means
Statement uses:
Nat,SimpleGraph, Usa1999P1.checkerboardProof uses:
SimpleGraph.boxProd,Fin,SimpleGraph.pathGraphdef gridGraph (n : ℕ) : SimpleGraph (checkerboard n) := …
Mentions: Usa1999P1.checkerboard
- lemma
Usa1999P1.gridGraph_adjline 74 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Usa1999P1.checkerboard,Iff,SimpleGraph.Adj, Usa1999P1.gridGraph, Usa1999P1.adjacentProof uses:
Fin,Prod.mk,Eq.mpr,Or,And,Eq,HAdd.hAdd,OfNat.ofNat,id,congrFun',congrArg,Eq.trans,Prod,SimpleGraph.boxProd,SimpleGraph.pathGraph,Prod.fst,Prod.snd,congr,Iff.intro,Iff.mprand 8 more11 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
- instance
Usa1999P1.gridGraphDecidableRelline 82 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,DecidableRel, Usa1999P1.checkerboard,SimpleGraph.Adj, Usa1999P1.gridGraphProof uses:
decidable_of_iff, Usa1999P1.adjacent2 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- instance
Usa1999P1.gridGraphNeighborSetFintypeline 86 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Usa1999P1.checkerboard,Fintype,SimpleGraph.neighborSet, Usa1999P1.gridGraphProof uses:
Fin,id,Prod.mk,SimpleGraph.pathGraph,Membership.mem,Set,Prod.fst,Prod.snd9 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- def
Usa1999P1.checkerGraphline 93 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Finset, Usa1999P1.checkerboard,SimpleGraph,Subtype,Membership.memProof uses:
SimpleGraph.induce, Usa1999P1.gridGraph4 instances, coercions and auxiliary constants left out.
- instance
Usa1999P1.checkerGraphDecidableRelline 96 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Finset, Usa1999P1.checkerboard,DecidableRel,Subtype,Membership.mem,SimpleGraph.Adj, Usa1999P1.checkerGraphProof uses:
id,inferInstance,SimpleGraph.induce, Usa1999P1.gridGraph,Set,Function.Embedding,Function.Embedding.subtype10 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- lemma
Usa1999P1.pathGraph_degree_le_twoA path vertex has at most one neighbor on each side line 102 sourceSource comment
A path vertex has at most one neighbor on each side.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,LE.le,SimpleGraph.degree,SimpleGraph.pathGraph,Membership.mem,Set,SimpleGraph.neighborSet,OfNat.ofNatProof uses:
Bool,Decidable.decide,Eq,HAdd.hAdd,Eq.mpr,Fintype.card,id,congrArg,Eq.symm,SimpleGraph.card_neighborSet_eq_degree,LE.le.trans_eq,Fintype.card_le_of_injective,Subtype.ext,Fin.ext,Or,Iff.mp,SimpleGraph.Adj,SimpleGraph.pathGraph_adj,Subtype.property,diteand 20 more23 instances, coercions and auxiliary constants left out.
Tactic trace: 18 steps
Open to load the checked before-and-after goal states.
lemma pathGraph_degree_le_two {n : ℕ} (x : Fin n) : (SimpleGraph.pathGraph n).degree x ≤ 2 := by … - lemma
Usa1999P1.gridGraph_degree_le_fourA square has at most four side-neighbors line 121 sourceSource comment
A square has at most four side-neighbors.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Usa1999P1.checkerboard,LE.le,SimpleGraph.degree, Usa1999P1.gridGraph,OfNat.ofNatProof uses:
Prod,Fin,SimpleGraph.boxProd,SimpleGraph.pathGraph,Membership.mem,Set,SimpleGraph.neighborSet,Prod.fst,Prod.snd,Eq.mpr,HAdd.hAdd,id,Eq,congrArg,SimpleGraph.degree_boxProd,Nat.add_le_add, Usa1999P1.pathGraph_degree_le_two13 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
lemma gridGraph_degree_le_four {n : ℕ} (x : checkerboard n) : (gridGraph n).degree x ≤ 4 := by …Mentions: Usa1999P1.checkerboard, Usa1999P1.gridGraph
- lemma
Usa1999P1.checkerGraph_preconnectedThe path hypothesis makes the checker graph preconnected line 131 sourceSource comment
The path hypothesis makes the checker graph preconnected.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Finset, Usa1999P1.checkerboard,Membership.mem,Exists,List,And,List.IsChain, Usa1999P1.adjacent,Eq,Option,List.head?,Option.some,List.getLast?,SimpleGraph.Preconnected,Subtype, Usa1999P1.checkerGraphProof uses:
SimpleGraph.Reachable,Subtype.property,Ne,List.nil,False,False.elim,Eq.mp,eq_false',Option.none,noConfusion_of_Nat,Option.ctorIdx,Eq.symm,List.pmap,Subtype.mk,Eq.mpr,Not,id,congrArg,SimpleGraph.Adj,List.isChain_pmap_of_isChainand 28 more18 instances, coercions and auxiliary constants left out.
Tactic trace: 16 steps
Open to load the checked before-and-after goal states.
lemma checkerGraph_preconnected {n : ℕ} {c : Finset (checkerboard n)} (hb : ∀ x ∈ c, ∀ y ∈ c, ∃ p : List (checkerboard n), (∀ z, z ∈ p → z ∈ c) ∧ List.IsChain adjacent p ∧ List.head? p = x ∧ List.getLast? p = y) : (checkerGraph c).Preconnected := by …Mentions: Usa1999P1.checkerboard, Usa1999P1.adjacent, Usa1999P1.checkerGraph
- lemma
Usa1999P1.preconnected_twice_card_le_sum_degrees_add_twoA preconnected finite graph has internal degree sum at least twice its vertex count minus two line 156 sourceSource comment
A preconnected finite graph has internal degree sum at least twice its vertex count minus two.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Fintype,SimpleGraph,DecidableRel,SimpleGraph.Adj,SimpleGraph.Preconnected,LE.le,Nat,HMul.hMul,OfNat.ofNat,Fintype.card,HAdd.hAdd,Finset.sum,Finset.univ,SimpleGraph.degree,Membership.mem,Set,SimpleGraph.neighborSetProof uses:
IsEmpty,Nonempty,Or,Eq,isEmpty_or_nonempty,Or.inl,of_eq_true,Eq.trans,True,congr,congrArg,Fintype.card_eq_zero,MulZeroClass.mul_zero,congrFun',EmptyCollection.emptyCollection,Finset,Finset.sum_congr,Finset.univ_eq_empty,SimpleGraph.IsIsolated.degree_eq_zero,SimpleGraph.IsIsolatedand 82 more104 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.
lemma preconnected_twice_card_le_sum_degrees_add_two {V : Type*} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj] (hG : G.Preconnected) : 2 * Fintype.card V ≤ (∑ v, G.degree v) + 2 := by … - def
Usa1999P1.emptySquaresline 169 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Finset, Usa1999P1.checkerboardProof uses:
SDiff.sdiff,Finset.univ3 instances, coercions and auxiliary constants left out.
- def
Usa1999P1.boundaryNeighborsline 173 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Finset, Usa1999P1.checkerboard,Subtype,Membership.memProof uses:
SDiff.sdiff,SimpleGraph.neighborFinset, Usa1999P1.gridGraph8 instances, coercions and auxiliary constants left out.
- lemma
Usa1999P1.checkerGraph_degree_eq_interCount checker-neighbors inside the full grid neighborhood line 178 sourceSource comment
Count checker-neighbors inside the full grid neighborhood.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Finset, Usa1999P1.checkerboard,Subtype,Membership.mem,Eq,SimpleGraph.degree, Usa1999P1.checkerGraph,Set,SimpleGraph.neighborSet,Finset.card,Inter.inter,SimpleGraph.neighborFinset, Usa1999P1.gridGraphProof uses:
Function.Embedding,Function.Embedding.mk,Subtype.val_injective,Finset.map,Finset.ext,Eq.mpr,Iff,Exists,SimpleGraph.Adj,Subtype.mk,Iff.mpr,Iff.of_eq,Eq.refl,And,id,congr,congrArg,Eq.trans,funext,congrFun'and 9 more35 instances, coercions and auxiliary constants left out.
Tactic trace: 8 steps
Open to load the checked before-and-after goal states.
lemma checkerGraph_degree_eq_inter {n : ℕ} (c : Finset (checkerboard n)) (x : c) : (checkerGraph c).degree x = ((gridGraph n).neighborFinset x.1 ∩ c).card := by …Mentions: Usa1999P1.checkerboard, Usa1999P1.checkerGraph, Usa1999P1.gridGraph
- lemma
Usa1999P1.gridGraph_degree_eq_checkerGraph_degree_add_boundarySplit each checker degree into internal and boundary neighbors line 192 sourceSource comment
Split each checker degree into internal and boundary neighbors.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Finset, Usa1999P1.checkerboard,Subtype,Membership.mem,Eq,SimpleGraph.degree, Usa1999P1.gridGraph,HAdd.hAdd, Usa1999P1.checkerGraph,Set,SimpleGraph.neighborSet,Finset.card, Usa1999P1.boundaryNeighborsProof uses:
Eq.mpr,SimpleGraph.neighborFinset,id,congrArg,Eq.symm,SimpleGraph.card_neighborFinset_eq_degree,Inter.inter, Usa1999P1.checkerGraph_degree_eq_inter,SDiff.sdiff,Usa1999P1.boundaryNeighbors.eq_1,Finset.card_inter_add_card_sdiff25 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
lemma gridGraph_degree_eq_checkerGraph_degree_add_boundary {n : ℕ} (c : Finset (checkerboard n)) (x : c) : (gridGraph n).degree x.1 = (checkerGraph c).degree x + (boundaryNeighbors c x).card := by …Mentions: Usa1999P1.checkerboard, Usa1999P1.gridGraph, Usa1999P1.checkerGraph, Usa1999P1.boundaryNeighbors
- lemma
Usa1999P1.emptySquares_card_le_boundary_sumEvery empty square is covered by a boundary-neighbor set of some checker line 201 sourceSource comment
Every empty square is covered by a boundary-neighbor set of some checker.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Finset, Usa1999P1.checkerboard,Or,Membership.mem,Exists,And, Usa1999P1.adjacent,LE.le,Finset.card, Usa1999P1.emptySquares,Finset.sum,Subtype,Finset.univ, Usa1999P1.boundaryNeighborsProof uses:
Finset.biUnion,Not,Eq.mp,Eq.trans,SDiff.sdiff,True,congrFun',congrArg,true_and,False.elim,Iff.mpr,Finset.mem_biUnion,Exists.intro,Subtype.mk,And.intro,Finset.mem_univ,Eq.mpr,SimpleGraph.neighborFinset, Usa1999P1.gridGraph,idand 11 more24 instances, coercions and auxiliary constants left out.
Tactic trace: 12 steps
Open to load the checked before-and-after goal states.
lemma emptySquares_card_le_boundary_sum {n : ℕ} (c : Finset (checkerboard n)) (ha : ∀ x : checkerboard n, x ∈ c ∨ (∃ y ∈ c, adjacent x y)) : (emptySquares c).card ≤ ∑ x : c, (boundaryNeighbors c x).card := by …Mentions: Usa1999P1.checkerboard, Usa1999P1.adjacent, Usa1999P1.emptySquares, Usa1999P1.boundaryNeighbors
- lemma
Usa1999P1.emptySquares_card_add_checker_cardEmpty squares and checker squares partition the board line 221 sourceSource comment
Empty squares and checker squares partition the board.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Finset, Usa1999P1.checkerboard,Eq,HAdd.hAdd,Finset.card, Usa1999P1.emptySquares,HPow.hPow,OfNat.ofNatProof uses:
Eq.mpr,SDiff.sdiff,Finset.univ,id,congrArg,Usa1999P1.emptySquares.eq_1,Finset.card_sdiff_add_card_eq_card,of_eq_true,LE.le,Fintype.card,Finset.card_univ,Prod,Fin,HMul.hMul,Fintype.card_prod,Fintype.card_fin,pow_two,Eq.refl28 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.
lemma emptySquares_card_add_checker_card {n : ℕ} (c : Finset (checkerboard n)) : (emptySquares c).card + c.card = n^2 := by …Mentions: Usa1999P1.checkerboard, Usa1999P1.emptySquares
- problem
Usa1999P1.usa1999_p1line 232 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Finset, Usa1999P1.checkerboard,Or,Membership.mem,Exists,And, Usa1999P1.adjacent,List,List.IsChain,Eq,Option,List.head?,Option.some,List.getLast?,LE.le,HPow.hPow,OfNat.ofNat,HAdd.hAdd,HMul.hMuland 1 moreProof uses: Usa1999P1.emptySquares,
Finset.sum,Subtype,Finset.univ, Usa1999P1.boundaryNeighbors,id, Usa1999P1.emptySquares_card_le_boundary_sum, Usa1999P1.emptySquares_card_add_checker_card,SimpleGraph.degree, Usa1999P1.gridGraph,Trans.trans,Finset.sum_le_sum, Usa1999P1.gridGraph_degree_le_four,of_eq_true,Eq.trans,True,congrFun',congrArg,Finset.attach,HSMul.hSMuland 90 more111 instances, coercions and auxiliary constants left out.
Tactic trace: 18 steps
Open to load the checked before-and-after goal states.