Compfiles/Imo1996P1.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
20 declarations, 0 contain sorry, 0 declared as axioms
International Mathematical Olympiad 1996, Problem 1
We are given a positive integer r and a rectangular board ABCD with dimensions |AB| = 20, |BC| = 12. The rectangle is divided into a grid of 20 × 12 unit squares. The following moves are permitted on the board: one can move from one square to another only if the distance between the centers of the two squares is √r. The task is to find a sequence of moves leading from the square with A as a vertex to the square with B as a vertex.
(a) Show that the task cannot be done if r is divisible by 2 or 3. (b) Prove that the task is possible when r = 73. (c) Can the task be done when r = 97?
Imports (2)
Imported by 1 file
- abbrev
Imo1996P1.OnBoardThe predicate thatpis a square of the 20 × 12 board line 42 sourceSource documentation
The predicate that
pis a square of the 20 × 12 board.no axioms what this means
Statement uses:
Prod,IntProof uses:
And,LE.le,OfNat.ofNat,Prod.fst,Prod.snd2 instances, coercions and auxiliary constants left out.
abbrev OnBoard (p : ℤ × ℤ) : Prop := 1 ≤ p.1 ∧ p.1 ≤ 20 ∧ 1 ≤ p.2 ∧ p.2 ≤ 12
- abbrev
Imo1996P1.MoveA permitted move between two squares: both lie on the board and the squared distance between their centers equalsrline 46 sourceSource documentation
A permitted move between two squares: both lie on the board and the squared distance between their centers equals
r.standard axioms: propext what this means
Statement uses:
Int,ProdProof uses:
And, Imo1996P1.OnBoard,Eq,HAdd.hAdd,HPow.hPow,Nat,HSub.hSub,Prod.fst,OfNat.ofNat,Prod.snd9 instances, coercions and auxiliary constants left out.
abbrev Move (r : ℤ) (p q : ℤ × ℤ) : Prop := …
- abbrev
Imo1996P1.SqAThe square with vertexAline 50 sourceSource documentation
The square with vertex
A.no axioms what this means
Statement uses:
Prod,IntProof uses:
Prod.mk,OfNat.ofNat1 instances, coercions and auxiliary constants left out.
abbrev SqA : ℤ × ℤ := (1, 1)
- abbrev
Imo1996P1.SqBThe square with vertexBline 53 sourceSource documentation
The square with vertex
B.no axioms what this means
Statement uses:
Prod,IntProof uses:
Prod.mk,OfNat.ofNat1 instances, coercions and auxiliary constants left out.
abbrev SqB : ℤ × ℤ := (20, 1) …
- lemma
Imo1996P1.sq_mod_twoline 59 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Int,Eq,HMod.hMod,HPow.hPow,Nat,OfNat.ofNatProof uses:
Even,Odd,Or,Int.even_or_odd,HAdd.hAdd,HMul.hMul,Mathlib.Tactic.Ring.of_eq,Nat.rawCast,Mathlib.Tactic.Ring.Common.pow_congr,Mathlib.Tactic.Ring.Common.add_congr,Mathlib.Tactic.Ring.Common.atom_pf,rfl,Eq.mpr,id,congrArg,Eq.symm,Eq.refl,Mathlib.Tactic.Ring.Common.add_pf_add_overlap,Mathlib.Tactic.Ring.Common.add_overlap_pf,Mathlib.Meta.NormNum.IsNat.to_raw_eqand 34 more48 instances, coercions and auxiliary constants left out.
Tactic trace: 9 steps
Open to load the checked before-and-after goal states.
- lemma
Imo1996P1.sq_mod_threeline 66 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Int,Or,Eq,HMod.hMod,HPow.hPow,Nat,OfNat.ofNatProof uses:
HAdd.hAdd,HMul.hMul,Exists,Exists.intro,HDiv.hDiv,Or.inl,Eq.mpr,id,congrArg,Mathlib.Tactic.Ring.of_eq,Nat.rawCast,Mathlib.Tactic.Ring.Common.pow_congr,Mathlib.Tactic.Ring.Common.add_congr,Mathlib.Tactic.Ring.Common.mul_congr,Mathlib.Tactic.Ring.cast_pos,Mathlib.Meta.NormNum.isNat_ofNat,Eq.refl,Mathlib.Tactic.Ring.Common.atom_pf,rfl,Eq.symmand 36 more46 instances, coercions and auxiliary constants left out.
Tactic trace: 23 steps
Open to load the checked before-and-after goal states.
- lemma
Imo1996P1.sq_mod_three_eq_zeroline 80 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Int,Eq,HMod.hMod,HPow.hPow,Nat,OfNat.ofNatProof uses:
Or,HAdd.hAdd,HMul.hMul,Exists,Exists.intro,HDiv.hDiv,Eq.mpr,id,congrArg,Mathlib.Tactic.Ring.of_eq,Nat.rawCast,Mathlib.Tactic.Ring.Common.pow_congr,Mathlib.Tactic.Ring.Common.add_congr,Mathlib.Tactic.Ring.Common.mul_congr,Mathlib.Tactic.Ring.cast_pos,Mathlib.Meta.NormNum.isNat_ofNat,Eq.refl,Mathlib.Tactic.Ring.Common.atom_pf,rfl,Eq.symmand 28 more45 instances, coercions and auxiliary constants left out.
Tactic trace: 17 steps
Open to load the checked before-and-after goal states.
- lemma
Imo1996P1.step_twoIfris even anda² + b² = r, thena ≡ b (mod 2), so a move preserves the parity ofp.1 + p.2line 94 sourceSource documentation
If
ris even anda² + b² = r, thena ≡ b (mod 2), so a move preserves the parity ofp.1 + p.2.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Int,Dvd.dvd,OfNat.ofNat,Prod, Imo1996P1.Move,Eq,HMod.hMod,HAdd.hAdd,Prod.fst,Prod.sndProof uses: Imo1996P1.OnBoard,
And,HPow.hPow,Nat,HSub.hSub,HMul.hMul, Imo1996P1.sq_mod_two24 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
lemma step_two {r : ℤ} (hr : 2 ∣ r) {p q : ℤ × ℤ} (h : Move r p q) : (p.1 + p.2) % 2 = 0 → (q.1 + q.2) % 2 = 0 := by …Mentions: h, Imo1996P1.Move
- lemma
Imo1996P1.step_threeIf3 ∣ randa² + b² = r, then3 ∣ aand3 ∣ b, so a move preservesp.1 mod 3line 104 sourceSource documentation
If
3 ∣ randa² + b² = r, then3 ∣ aand3 ∣ b, so a move preservesp.1 mod 3.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Int,Dvd.dvd,OfNat.ofNat,Prod, Imo1996P1.Move,Eq,HMod.hMod,Prod.fstProof uses: Imo1996P1.OnBoard,
And,HAdd.hAdd,HPow.hPow,Nat,HSub.hSub,Prod.snd,HMul.hMul,Or, Imo1996P1.sq_mod_three, Imo1996P1.sq_mod_three_eq_zero24 instances, coercions and auxiliary constants left out.
Tactic trace: 10 steps
Open to load the checked before-and-after goal states.
lemma step_three {r : ℤ} (hr : 3 ∣ r) {p q : ℤ × ℤ} (h : Move r p q) : p.1 % 3 = 1 → q.1 % 3 = 1 := by …Mentions: h, Imo1996P1.Move
- lemma
Imo1996P1.reach_twoline 115 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Int,Dvd.dvd,OfNat.ofNat,Prod,Relation.ReflTransGen, Imo1996P1.Move,Eq,HMod.hMod,HAdd.hAdd,Prod.fst,Prod.sndProof uses:
Relation.ReflTransGen.rec,id, Imo1996P1.step_two12 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
Imo1996P1.reach_threeline 122 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Int,Dvd.dvd,OfNat.ofNat,Prod,Relation.ReflTransGen, Imo1996P1.Move,Eq,HMod.hMod,Prod.fstProof uses:
Relation.ReflTransGen.rec,id, Imo1996P1.step_three8 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
Imo1996P1.abs_le_nineline 131 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Int,Eq,HAdd.hAdd,HPow.hPow,Nat,OfNat.ofNat,LE.le,absProof uses:
Decidable.byContradiction,Not,le_of_not_gt,LT.lt,Mathlib.Tactic.Linarith.lt_irrefl,Eq.mp,Neg.neg,HSub.hSub,congrArg,Mathlib.Tactic.Ring.of_eq,Mathlib.Tactic.Ring.Common.add_congr,HMul.hMul,Nat.rawCast,Int.rawCast,inferInstance,Ring,Int.negOfNat,Mathlib.Tactic.Ring.Common.neg_congr,Mathlib.Tactic.Ring.cast_pos,Mathlib.Meta.NormNum.isNat_ofNatand 72 more89 instances, coercions and auxiliary constants left out.
Tactic trace: 12 steps
Open to load the checked before-and-after goal states.
- lemma
Imo1996P1.sq97_auxline 142 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Int,LE.le,OfNat.ofNat,Eq,HAdd.hAdd,HPow.hPow,Nat,Or,AndProof uses:
dite,Eq.symm,le_antisymm,Nat.rawCast,Mathlib.Tactic.IntervalCases.of_le_right,Mathlib.Meta.NormNum.IsNat.to_raw_eq,Mathlib.Meta.NormNum.isNat_ofNat,Eq.refl,Not,HSub.hSub,Int.le_sub_one_of_not_le,Mathlib.Tactic.IntervalCases.of_le_left126 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
Imo1996P1.move97The only ways to write97as a sum of two squares are81 + 16and16 + 81, so each permitted move forr = 97is of the form(±9, ±4)or(±4, ±9)line 149 sourceSource documentation
The only ways to write
97as a sum of two squares are81 + 16and16 + 81, so each permitted move forr = 97is of the form(±9, ±4)or(±4, ±9).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Int,Eq,HAdd.hAdd,HPow.hPow,Nat,OfNat.ofNat,Or,And,absProof uses:
LE.le, Imo1996P1.abs_le_nine,Mathlib.Tactic.Linarith.eq_of_not_lt_of_not_gt,Not.intro,LT.lt,Mathlib.Tactic.Linarith.lt_irrefl,Eq.mp,Neg.neg,HSub.hSub,congrArg,Mathlib.Tactic.Ring.of_eq,Mathlib.Tactic.Ring.Common.add_congr,Nat.rawCast,Mathlib.Meta.NormNum.instAddMonoidWithOne,inferInstance,Ring,HMul.hMul,Int.rawCast,Int.negOfNat,Mathlib.Tactic.Ring.Common.neg_congrand 56 more76 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.
lemma move97 {a b : ℤ} (h : a ^ 2 + b ^ 2 = 97) : (|a| = 9 ∧ |b| = 4) ∨ (|a| = 4 ∧ |b| = 9) := by …Mentions: h
- lemma
Imo1996P1.step97The invariant for part (c): row membership in the central strip{5, 6, 7, 8}agrees with evenness of the column line 161 sourceSource documentation
The invariant for part (c): row membership in the central strip
{5, 6, 7, 8}agrees with evenness of the column. A "toggle" move(±9, ±4)flips both sides of the equivalence; a move(±4, ±9)flips neither (such a move cannot start or end inside the strip, and it preserves the parity of the column).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Prod,Int, Imo1996P1.Move,OfNat.ofNat,Iff,Eq,HMod.hMod,Prod.fst,And,LE.le,Prod.sndProof uses: Imo1996P1.OnBoard,
HAdd.hAdd,HPow.hPow,Nat,HSub.hSub,Or,abs, Imo1996P1.move97,Neg.neg,eq_or_eq_neg_of_abs_eq34 instances, coercions and auxiliary constants left out.
Tactic trace: 8 steps
Open to load the checked before-and-after goal states.
lemma step97 {p q : ℤ × ℤ} (h : Move 97 p q) : (p.1 % 2 = 0 ↔ 5 ≤ p.2 ∧ p.2 ≤ 8) → (q.1 % 2 = 0 ↔ 5 ≤ q.2 ∧ q.2 ≤ 8) := by …Mentions: h, Imo1996P1.Move
- lemma
Imo1996P1.reach97line 172 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Prod,Int,Relation.ReflTransGen, Imo1996P1.Move,OfNat.ofNat,Iff,Eq,HMod.hMod,Prod.fst,And,LE.le,Prod.sndProof uses:
Relation.ReflTransGen.rec,id, Imo1996P1.step978 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- problem
Imo1996P1.imo1996_p1_aline 180 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Int,Or,Dvd.dvd,OfNat.ofNat,Not,Relation.ReflTransGen,Prod, Imo1996P1.Move, Imo1996P1.SqA, Imo1996P1.SqBProof uses:
False,absurd,Eq,HMod.hMod,HAdd.hAdd,Prod.fst,Prod.snd, Imo1996P1.reach_two,of_decide_eq_true,id,Bool,Decidable.decide,Bool.true,Eq.refl, Imo1996P1.reach_three11 instances, coercions and auxiliary constants left out.
Tactic trace: 10 steps
Open to load the checked before-and-after goal states.
- problem
Imo1996P1.imo1996_p1_bline 187 sourcestandard axioms: propext what this means
Statement uses:
Relation.ReflTransGen,Prod,Int, Imo1996P1.Move,OfNat.ofNat, Imo1996P1.SqA, Imo1996P1.SqBProof uses:
Prod.mk,And.intro, Imo1996P1.OnBoard,And,Eq,HAdd.hAdd,HPow.hPow,Nat,HSub.hSub,Prod.fst,Prod.snd,of_decide_eq_true,LE.le,id,Bool,Decidable.decide,Bool.true,Eq.refl,Relation.ReflTransGen.head,Relation.ReflTransGen.refl15 instances, coercions and auxiliary constants left out.
Tactic trace: 45 steps
Open to load the checked before-and-after goal states.
- determine
Imo1996P1.does_exist_97line 207 sourceno axioms what this means
Statement uses:
BoolProof uses:
Bool.false - problem
Imo1996P1.imo1996_p1_cline 209 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
ite,Eq,Bool, Imo1996P1.does_exist_97,Bool.true,Relation.ReflTransGen,Prod,Int, Imo1996P1.Move,OfNat.ofNat, Imo1996P1.SqA, Imo1996P1.SqB,NotProof uses:
id,absurd,Iff,HMod.hMod,Prod.fst,And,LE.le,Prod.snd,False, Imo1996P1.reach97,of_decide_eq_true,Decidable.decide,Eq.refl12 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.