Compfiles/Usa1985P4.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
12 declarations, 0 contain sorry, 0 declared as axioms
USA Mathematical Olympiad 1985, Problem 4
A graph has n > 2 points. Show that we can find two points A and B such that at least ⌊n/2⌋ - 1 of the remaining points are joined to either both or neither of A and B.
Imports (8)
Imported by 1 file
- def
Usa1985P4.mixedRelmixedRel n G X psays that the vertexXis distinct from the two endpoints of the pairpand is adjacent to exactly one of them line 38 sourceSource documentation
mixedRel n G X psays that the vertexXis distinct from the two endpoints of the pairpand is adjacent to exactly one of them.no axioms what this means
Statement uses:
Nat,SimpleGraph,Fin,DecidableRel,SimpleGraph.Adj,ProdProof uses:
And,Ne,Prod.fst,Prod.snd,Or,NotTactic trace: 2 steps
Open to load the checked before-and-after goal states.
def mixedRel (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (X : Fin n) (p : Fin n × Fin n) : Prop := … - instance
Usa1985P4.(instance at line 42)line 42 source - def
Usa1985P4.badPairThe "bad" vertices for a pairp: the remaining vertices that are joined to exactly one of the two endpoints ofpline 49 sourceSource documentation
The "bad" vertices for a pair
p: the remaining vertices that are joined to exactly one of the two endpoints ofp.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,SimpleGraph,Fin,DecidableRel,SimpleGraph.Adj,Prod,FinsetProof uses:
Finset.filter, Usa1985P4.mixedRel,Finset.univ2 instances, coercions and auxiliary constants left out.
def badPair (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (p : Fin n × Fin n) : Finset (Fin n) := … - lemma
Usa1985P4.badPair_eq_bipartiteBelowline 53 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,SimpleGraph,Fin,DecidableRel,SimpleGraph.Adj,Prod,Eq,Finset, Usa1985P4.badPair,Finset.bipartiteBelow, Usa1985P4.mixedRel,Finset.univProof uses:
rfl2 instances, coercions and auxiliary constants left out.
- lemma
Usa1985P4.neighborFinset_subset_eraseThe neighbourhood ofXdoes not containXline 58 sourceSource documentation
The neighbourhood of
Xdoes not containX.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,SimpleGraph,Fin,DecidableRel,SimpleGraph.Adj,LE.le,Finset,SimpleGraph.neighborFinset,Membership.mem,Set,SimpleGraph.neighborSet,Finset.erase,Finset.univProof uses:
Iff.mpr,And,Ne,Finset.mem_erase,And.intro,Ne.symm,SimpleGraph.Adj.ne,Eq.mp,congrArg,propext,SimpleGraph.mem_neighborFinset,Finset.mem_univ15 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
lemma neighborFinset_subset_erase (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (X : Fin n) : G.neighborFinset X ⊆ Finset.univ.erase X := by … - lemma
Usa1985P4.degree_leThe degree of a vertex is at mostn - 1line 65 sourceSource documentation
The degree of a vertex is at most
n - 1.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,SimpleGraph,Fin,DecidableRel,SimpleGraph.Adj,LE.le,SimpleGraph.degree,Membership.mem,Set,SimpleGraph.neighborSet,HSub.hSub,OfNat.ofNatProof uses:
Finset.card,SimpleGraph.neighborFinset,Finset.erase,Finset.univ,Finset.card_le_card, Usa1985P4.neighborFinset_subset_erase,Eq.mp,congrArg,SimpleGraph.card_neighborFinset_eq_degree,Fintype.card,Fintype.card_fin,Finset.card_univ,Finset.card_erase_of_mem,Finset.mem_univ17 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
lemma degree_le (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (X : Fin n) : G.degree X ≤ n - 1 := by … - lemma
Usa1985P4.fiber_cardDocumented declaration: fiber_card line 76 sourceSource documentation
For a fixed vertex
X, the number of ordered pairs(Y, Z)withY ≠ Zsuch thatXis joined to exactly one ofYandZequals2 * (d * (n - 1 - d)), whered = G.degree X: choose which endpoint is adjacent toX, then choose that endpoint (a neighbour ofX) and the other one (a non-neighbour different fromX).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,SimpleGraph,Fin,DecidableRel,SimpleGraph.Adj,Eq,Finset.card,Prod,Finset.bipartiteAbove, Usa1985P4.mixedRel,Finset.offDiag,Finset.univ,HMul.hMul,OfNat.ofNat,SimpleGraph.degree,Membership.mem,Set,SimpleGraph.neighborSet,HSub.hSubProof uses:
Iff,Or,And,Ne,Prod.snd,Prod.fst,Not,id,Prod.mk,Iff.intro,Or.inl,And.intro,Or.inr,SimpleGraph.Adj.ne,Finset,Union.union,Finset.filter,Eq.mpr,congrArg,rfland 58 more60 instances, coercions and auxiliary constants left out.
Tactic trace: 50 steps
Open to load the checked before-and-after goal states.
lemma fiber_card (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (X : Fin n) : ((Finset.offDiag Finset.univ).bipartiteAbove (mixedRel n G) X).card = 2 * (G.degree X * (n - 1 - G.degree X)) := by …Mentions: Usa1985P4.mixedRel
- lemma
Usa1985P4.double_countDouble counting: summing the number of bad vertices over all ordered pairs(Y, Z)withY ≠ Zequals the sum over verticesXof2 * (d_X * (n - 1 - d_X))line 150 sourceSource documentation
Double counting: summing the number of bad vertices over all ordered pairs
(Y, Z)withY ≠ Zequals the sum over verticesXof2 * (d_X * (n - 1 - d_X)).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,SimpleGraph,Fin,DecidableRel,SimpleGraph.Adj,Eq,Finset.sum,Prod,Finset.offDiag,Finset.univ,Finset.card, Usa1985P4.badPair,HMul.hMul,OfNat.ofNat,SimpleGraph.degree,Membership.mem,Set,SimpleGraph.neighborSet,HSub.hSubProof uses:
Trans.trans,Finset.bipartiteAbove, Usa1985P4.mixedRel,id,Eq.symm,Finset.bipartiteBelow,Finset.sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow,Finset.sum_congr,rfl,Finset, Usa1985P4.fiber_card24 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
lemma double_count (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] : (∑ p ∈ Finset.offDiag (Finset.univ : Finset (Fin n)), (badPair n G p).card) = ∑ X : Fin n, 2 * (G.degree X * (n - 1 - G.degree X)) := by …Mentions: Usa1985P4.badPair
- lemma
Usa1985P4.two_mul_sum_badPair_leTwice the total number of bad incidences is at mostn * (n - 1)^2, since for each vertexXof degreedwe have4 * d * (n - 1 - d) ≤ (n - 1)^2(AM-GM) line 164 sourceSource documentation
Twice the total number of bad incidences is at most
n * (n - 1)^2, since for each vertexXof degreedwe have4 * d * (n - 1 - d) ≤ (n - 1)^2(AM-GM).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,SimpleGraph,Fin,DecidableRel,SimpleGraph.Adj,LE.le,HMul.hMul,OfNat.ofNat,Finset.sum,Prod,Finset.offDiag,Finset.univ,Finset.card, Usa1985P4.badPair,HPow.hPow,HSub.hSubProof uses:
Eq.mpr,SimpleGraph.degree,Membership.mem,Set,SimpleGraph.neighborSet,id,Eq,congrArg, Usa1985P4.double_count,Finset.mul_sum,Trans.trans,Finset.sum_le_sum,Finset, Usa1985P4.degree_le,HAdd.hAdd,four_mul_le_sq_add,Mathlib.Tactic.Ring.of_eq,Nat.rawCast,Mathlib.Tactic.Ring.Common.mul_congr,Mathlib.Tactic.Ring.cast_posand 25 more78 instances, coercions and auxiliary constants left out.
Tactic trace: 12 steps
Open to load the checked before-and-after goal states.
lemma two_mul_sum_badPair_le (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] : 2 * (∑ p ∈ Finset.offDiag (Finset.univ : Finset (Fin n)), (badPair n G p).card) ≤ n * (n - 1)^2 := by …Mentions: Usa1985P4.badPair
- lemma
Usa1985P4.exists_pair_leAveraging: some ordered pair(A, B)withA ≠ Bhas at most⌊(n - 1)/2⌋bad remaining vertices line 184 sourceSource documentation
Averaging: some ordered pair
(A, B)withA ≠ Bhas at most⌊(n - 1)/2⌋bad remaining vertices.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,SimpleGraph,Fin,DecidableRel,SimpleGraph.Adj,Exists,Prod,And,Membership.mem,Finset,Finset.offDiag,Finset.univ,LE.le,Finset.card, Usa1985P4.badPair,HDiv.hDiv,HSub.hSubProof uses:
Decidable.byContradiction,Not,Finset.sum,HAdd.hAdd,Finset.sum_le_sum,Iff.mpr,Nat.succ,Nat.succ_le_iff,Eq.mp,Eq.trans,binderNameHint,forall_congr,Mathlib.Tactic.Push.not_and_eq,implies_congr,Eq.refl,HMul.hMul,HPow.hPow,Nat.mul_pos,Eq,Eq.mprand 43 more90 instances, coercions and auxiliary constants left out.
Tactic trace: 27 steps
Open to load the checked before-and-after goal states.
lemma exists_pair_le (n : ℕ) (hn : 2 < n) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] : ∃ p ∈ Finset.offDiag (Finset.univ : Finset (Fin n)), (badPair n G p).card ≤ (n - 1) / 2 := by …Mentions: Usa1985P4.badPair
- lemma
Usa1985P4.answer_cardThe vertices joined to both or neither endpoint ofpare the remaining vertices that are not bad; there are(n - 2) - (#bad)of them line 216 sourceSource documentation
The vertices joined to both or neither endpoint of
pare the remaining vertices that are not bad; there are(n - 2) - (#bad)of them.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,SimpleGraph,Fin,DecidableRel,SimpleGraph.Adj,Prod,Membership.mem,Finset,Finset.offDiag,Finset.univ,Eq,Finset.card,Finset.filter,And,Ne,Prod.fst,Prod.snd,Iff,HSub.hSub,OfNat.ofNatand 1 moreProof uses:
SDiff.sdiff,Finset.ext,Eq.mpr,Not, Usa1985P4.mixedRel,id,congr,congrArg,Eq.trans,True,congrFun',true_and,Or,Usa1985P4.mixedRel.eq_1,Iff.intro,And.intro,False,Iff.mp,Decidable.iff_iff_and_or_not_and_not,False.elimand 20 more33 instances, coercions and auxiliary constants left out.
Tactic trace: 20 steps
Open to load the checked before-and-after goal states.
lemma answer_card (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (p : Fin n × Fin n) (hp : p ∈ Finset.offDiag (Finset.univ : Finset (Fin n))) : (Finset.univ.filter fun X => X ≠ p.1 ∧ X ≠ p.2 ∧ (G.Adj X p.1 ↔ G.Adj X p.2)).card = (n - 2) - (badPair n G p).card := by …Mentions: Usa1985P4.badPair
- problem
Usa1985P4.usa1985_p4line 248 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,SimpleGraph,Fin,DecidableRel,SimpleGraph.Adj,Exists,And,Ne,LE.le,HSub.hSub,HDiv.hDiv,Finset.card,Finset.filter,Iff,Eq,Finset.univProof uses:
Prod,Membership.mem,Finset,Finset.offDiag, Usa1985P4.badPair, Usa1985P4.exists_pair_le,Exists.intro,Prod.fst,Prod.snd,And.intro,And.right,Iff.mp,Finset.mem_offDiag,Eq.mpr,id,congrArg, Usa1985P4.answer_card29 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.