Compfiles/Imo2018P3.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
70 declarations, 0 contain sorry, 0 declared as axioms
International Mathematical Olympiad 2018, Problem 3
An anti-Pascal triangle is an equilateral triangular array of numbers such that, except for the numbers in the bottom row, each number is the absolute value of the difference of the two numbers immediately below it. For example, the following array is an anti-Pascal triangle with four rows which contains every integer from 1 to 10:
4 2 6 5 7 1 8 3 10 9
Does there exist an anti-Pascal triangle with 2018 rows which contains every integer from 1 to 1 + 2 + ... + 2018?
Imported by 1 file
- structure
Imo2018P3.Coordsline 38 sourceno axioms what this means
- def
Imo2018P3.left_childline 42 sourceno axioms what this means
Statement uses: Imo2018P3.Coords
Proof uses:
Imo2018P3.Coords.mk,Nat.succ,Imo2018P3.Coords.row,Imo2018P3.Coords.col - def
Imo2018P3.right_childline 45 sourceno axioms what this means
Statement uses: Imo2018P3.Coords
Proof uses:
Imo2018P3.Coords.mk,Nat.succ,Imo2018P3.Coords.row,Imo2018P3.Coords.col - structure
Imo2018P3.antipascal_triangleantipascal triangle with n rows line 51 sourceSource documentation
antipascal triangle with n rows
no axioms what this means
Statement uses:
Natstructure antipascal_triangle (n : ℕ) where …
- def
Imo2018P3.exists_desired_triangleline 56 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Proof uses:
Exists, Imo2018P3.antipascal_triangle,OfNat.ofNat,Nat,LE.le,Finset.sum,Finset.range,HAdd.hAdd,And,LT.lt,Eq,Imo2018P3.antipascal_triangle.f,Imo2018P3.Coords.mk6 instances, coercions and auxiliary constants left out.
- def
Imo2018P3.NRNumber of rows line 70 sourceSource documentation
Number of rows.
private def NR : ℕ := 2018
- def
Imo2018P3.TNThe total1 + 2 + ⋯ + 2018line 73 sourceSource documentation
The total
1 + 2 + ⋯ + 2018.private def TN : ℕ := ∑ i ∈ Finset.range NR, (i + 1)
Mentions: Imo2018P3.NR
- lemma
Imo2018P3.NR_valline 75 source - lemma
Imo2018P3.TN_defline 77 source - def
Imo2018P3.triThe set of cells of anNR-row triangle: row< NR, column≤ rowline 80 sourceSource documentation
The set of cells of an
NR-row triangle: row< NR, column≤ row.private def tri : Finset Coords := …
Mentions: Imo2018P3.Coords
- lemma
Imo2018P3.mem_triline 86 source - lemma
Imo2018P3.card_triline 94 source - lemma
Imo2018P3.min_sumThe sum ofndistinct positive integers is at least1 + 2 + ⋯ + nline 106 sourceSource documentation
The sum of
ndistinct positive integers is at least1 + 2 + ⋯ + n.private lemma min_sum : ∀ (V : Finset ℕ), (∀ x ∈ V, 1 ≤ x) → ∑ i ∈ Finset.range V.card, (i + 1) ≤ ∑ x ∈ V, x := by … - lemma
Imo2018P3.min_sum_eqndistinct positive integers with sum at most1 + 2 + ⋯ + nare exactly{1, …, n}line 134 sourceSource documentation
ndistinct positive integers with sum at most1 + 2 + ⋯ + nare exactly{1, …, n}.private lemma min_sum_eq (V : Finset ℕ) (hpos : ∀ x ∈ V, 1 ≤ x) : ∑ x ∈ V, x ≤ ∑ i ∈ Finset.range V.card, (i + 1) → V = Finset.Icc 1 V.card := by … - lemma
Imo2018P3.two_mul_sumline 164 source - lemma
Imo2018P3.min_sum_geThe sum ofndistinct integers each> mis at leastn·m + (1 + ⋯ + n)line 170 sourceSource documentation
The sum of
ndistinct integers each> mis at leastn·m + (1 + ⋯ + n).private lemma min_sum_ge (V : Finset ℕ) (m : ℕ) (hpos : ∀ x ∈ V, m < x) : V.card * m + ∑ i ∈ Finset.range V.card, (i + 1) ≤ ∑ x ∈ V, x := by … - lemma
Imo2018P3.bijectionEvery cell value lies in[1, TN]andt.fis injective on the triangle line 195 sourceSource documentation
Every cell value lies in
[1, TN]andt.fis injective on the triangle.private lemma bijection : (∀ x ∈ tri, 1 ≤ t.f x ∧ t.f x ≤ TN) ∧ Set.InjOn t.f ↑tri := by …Mentions: Imo2018P3.tri, Imo2018P3.TN
- def
Imo2018P3.winnerThe child ofxholding the larger value line 242 sourceSource documentation
The child of
xholding the larger value.private def winner (x : Coords) : Coords := …
Mentions: Imo2018P3.Coords
- def
Imo2018P3.loserThe child ofxholding the smaller value line 246 sourceSource documentation
The child of
xholding the smaller value.private def loser (x : Coords) : Coords := …
Mentions: Imo2018P3.Coords
- lemma
Imo2018P3.winner_rowline 249 source - lemma
Imo2018P3.loser_rowline 252 source - lemma
Imo2018P3.winner_colline 255 source - lemma
Imo2018P3.loser_colline 261 source - lemma
Imo2018P3.winner_valThe defining anti-Pascal relation, oriented:winner = parent + loserline 268 sourceSource documentation
The defining anti-Pascal relation, oriented:
winner = parent + loser.private lemma winner_val (x : Coords) (hx : x ∈ tri) (hb : x.row + 1 < NR) : t.f (winner t x) = t.f x + t.f (loser t x) := by …Mentions: Imo2018P3.Coords, Imo2018P3.tri, Imo2018P3.NR, Imo2018P3.winner, Imo2018P3.loser
- lemma
Imo2018P3.left_child_memChildren of a valid parent lie in the triangle line 277 sourceSource documentation
Children of a valid parent lie in the triangle.
private lemma left_child_mem {x : Coords} (hx : x ∈ tri) (hb : x.row + 1 < NR) : left_child x ∈ tri := by …Mentions: Imo2018P3.Coords, Imo2018P3.tri, Imo2018P3.NR, Imo2018P3.left_child
- lemma
Imo2018P3.right_child_memline 282 source - lemma
Imo2018P3.winner_memline 289 source - lemma
Imo2018P3.loser_memline 295 source - def
Imo2018P3.chainThe greedy "always go to the larger child" path starting at the apex line 302 sourceSource documentation
The greedy "always go to the larger child" path starting at the apex.
private def chain : ℕ → Coords | 0 => ⟨0, 0⟩ | (i + 1) => winner t (chain i)
Mentions: Imo2018P3.Coords, Imo2018P3.winner
- lemma
Imo2018P3.chain_zeroline 306 source - lemma
Imo2018P3.chain_succline 308 source - lemma
Imo2018P3.chain_rowline 310 source - lemma
Imo2018P3.chain_memline 315 source - lemma
Imo2018P3.chain_step_valline 322 source - lemma
Imo2018P3.chain_sumline 327 source - def
Imo2018P3.losersThe smaller children dropped along the apex path (the "losers") line 338 sourceSource documentation
The smaller children dropped along the apex path (the "losers").
private def losers : Finset Coords := …
Mentions: Imo2018P3.Coords
- def
Imo2018P3.smallCellsAll cells holding a value≤ NR: the apex together with the losers line 342 sourceSource documentation
All cells holding a value
≤ NR: the apex together with the losers.private def smallCells : Finset Coords := insert (chain t 0) (losers t)
Mentions: Imo2018P3.Coords, Imo2018P3.chain, Imo2018P3.losers
- lemma
Imo2018P3.loser_chain_rowline 344 source - lemma
Imo2018P3.losers_injline 347 source - lemma
Imo2018P3.chain_zero_not_losersline 355 source - lemma
Imo2018P3.losers_cardline 362 source - lemma
Imo2018P3.smallCells_cardline 365 source - lemma
Imo2018P3.smallCells_subsetline 369 source - lemma
Imo2018P3.smallCells_sumline 381 source - lemma
Imo2018P3.smallCells_injOnline 389 source - lemma
Imo2018P3.chain_bottomline 393 source - lemma
Imo2018P3.smallCells_imageline 412 source - lemma
Imo2018P3.not_smallEvery cell outside the band of small cells holds a value> NRline 429 sourceSource documentation
Every cell outside the band of small cells holds a value
> NR.private lemma not_small (x : Coords) (hx : x ∈ tri) (hxs : x ∉ smallCells t) : NR < t.f x := by …Mentions: Imo2018P3.Coords, Imo2018P3.tri, Imo2018P3.smallCells, Imo2018P3.NR
- lemma
Imo2018P3.chain_col_le_succline 445 source - lemma
Imo2018P3.chain_col_succ_leline 448 source - lemma
Imo2018P3.chain_col_monoline 451 source - lemma
Imo2018P3.chain_col_le_addline 457 source - lemma
Imo2018P3.smallCells_colline 467 source - lemma
Imo2018P3.notMem_small_leftline 490 source - lemma
Imo2018P3.notMem_small_rightline 495 source - def
Imo2018P3.walkA winner-path starting from an arbitrary cell line 503 sourceSource documentation
A winner-path starting from an arbitrary cell.
private def walk (s : Coords) : ℕ → Coords | 0 => s | (k + 1) => winner t (walk s k)
Mentions: Imo2018P3.Coords, Imo2018P3.winner
- lemma
Imo2018P3.walk_zeroline 507 source - lemma
Imo2018P3.walk_succline 509 source - lemma
Imo2018P3.walk_rowline 511 source - lemma
Imo2018P3.walk_sumline 516 source - def
Imo2018P3.inSubMembership in the downward sub-triangle with apex(p, q)line 528 sourceSource documentation
Membership in the downward sub-triangle with apex
(p, q).private def inSub (p q : ℕ) (x : Coords) : Prop := …
Mentions: Imo2018P3.Coords
- lemma
Imo2018P3.inSub_leftline 531 source - lemma
Imo2018P3.inSub_rightline 536 source - lemma
Imo2018P3.inSub_winnerline 541 source - lemma
Imo2018P3.inSub_loserline 547 source - lemma
Imo2018P3.walk_inSubline 553 source - lemma
Imo2018P3.corner_contraA downward sub-triangle disjoint from the small cells, reaching≥ 1007rows down, yields a contradiction: its winner-path picks up≥ 1007distinct losers all> NRline 570 sourceSource documentation
A downward sub-triangle disjoint from the small cells, reaching
≥ 1007rows down, yields a contradiction: its winner-path picks up≥ 1007distinct losers all> NR.private lemma corner_contra (p q : ℕ) (hp : p ≤ NR - 1) (hsub : ∀ x : Coords, inSub p q x → x ∈ tri ∧ x ∉ smallCells t) (hlen : 1007 ≤ NR - 1 - p) : False := by …Mentions: Imo2018P3.NR, Imo2018P3.Coords, Imo2018P3.inSub, Imo2018P3.tri, Imo2018P3.smallCells
- lemma
Imo2018P3.not_exists_desiredline 621 source - determine
Imo2018P3.does_existline 661 sourceno axioms what this means
Statement uses:
BoolProof uses:
Bool.false - problem
Imo2018P3.imo2018_p3line 663 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Iff,Eq,Bool, Imo2018P3.does_exist,Bool.true, Imo2018P3.exists_desired_triangleProof uses:
Eq.mpr,Not,Exists, Imo2018P3.antipascal_triangle,OfNat.ofNat,Nat,LE.le,Finset.sum,Finset.range,HAdd.hAdd,And,LT.lt,Imo2018P3.antipascal_triangle.f,Imo2018P3.Coords.mk,id,Eq.trans,False,congrFun',congrArg,Bool.false_eq_trueand 1 more8 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.