Compfiles/Usa2013P2.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
17 declarations, 0 contain sorry, 0 declared as axioms
USA Mathematical Olympiad 2013, Problem 2
For a positive integer $n \ge 3$ plot $n$ equally spaced points around a circle. Label one of them $A$, and place a marker at $A$. One may move the marker forward in a clockwise direction to either the next point or the point after that. Hence there are a total of $2n$ distinct moves available; two from each point. Let $a_n$ count the number of ways to advance around the circle exactly twice, beginning and ending at $A$, without repeating a move. Prove that $a_{n-1} + a_n = 2^n$ for all $n \ge 4$.
Imports (5)
Imported by 1 file
- abbrev
Usa2013P2.ColSeqA sequence ofn+1columns, each column one of the three symbols ofFin 3(0 = u,1 = v,2 = w) line 70 sourceSource documentation
A sequence of
n+1columns, each column one of the three symbols ofFin 3(0 = u,1 = v,2 = w).no axioms what this means
Statement uses:
NatProof uses:
Fin,HAdd.hAdd,OfNat.ofNat3 instances, coercions and auxiliary constants left out.
abbrev ColSeq (n : ℕ) := Fin (n + 1) → Fin 3
- abbrev
Usa2013P2.AdjDistinctAdjacent columns are distinct line 73 sourceSource documentation
Adjacent columns are distinct.
no axioms what this means
Statement uses:
Nat, Usa2013P2.ColSeqProof uses:
Fin,Ne,OfNat.ofNat,Fin.castSucc,Fin.succ1 instances, coercions and auxiliary constants left out.
abbrev AdjDistinct {n : ℕ} (c : ColSeq n) : Prop := ∀ i : Fin n, c i.castSucc ≠ c i.succMentions: Usa2013P2.ColSeq
- def
Usa2013P2.countColThe number of column sequences of lengthn+1with distinct adjacent columns starting withsand ending withtline 77 sourceSource documentation
The number of column sequences of length
n+1with distinct adjacent columns starting withsand ending witht.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,OfNat.ofNatProof uses:
Nat.card,Subtype, Usa2013P2.ColSeq,And, Usa2013P2.AdjDistinct,Eq,HAdd.hAdd,Fin.last6 instances, coercions and auxiliary constants left out.
noncomputable def countCol (n : ℕ) (s t : Fin 3) : ℕ := …
- def
Usa2013P2.aDocumented declaration: a line 83 sourceSource documentation
The number of ways to advance around the circle exactly twice without repeating a move: sequences starting with
u = 0end inv = 1, and sequences starting withw = 2end inw = 2.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
NatProof uses:
HAdd.hAdd, Usa2013P2.countCol,OfNat.ofNat,Fin5 instances, coercions and auxiliary constants left out.
noncomputable def a (n : ℕ) : ℕ := countCol n 0 1 + countCol n 2 2 …
Mentions: Usa2013P2.countCol
- def
Usa2013P2.permEquivRelabeling columns by a permutation ofFin 3does not change the counts line 88 sourceSource documentation
Relabeling columns by a permutation of
Fin 3does not change the counts.standard axioms: Quot.sound, propext what this means
Statement uses:
Nat,Equiv.Perm,Fin,OfNat.ofNat,Equiv,Subtype, Usa2013P2.ColSeq,And, Usa2013P2.AdjDistinct,Eq,HAdd.hAdd,Fin.lastProof uses:
Equiv.mk,Subtype.mk,Function.comp,Equiv.symm22 instances, coercions and auxiliary constants left out.
Tactic trace: 8 steps
Open to load the checked before-and-after goal states.
def permEquiv {n : ℕ} (σ : Equiv.Perm (Fin 3)) (s t : Fin 3) : {c : ColSeq n // AdjDistinct c ∧ c 0 = s ∧ c (Fin.last n) = t} ≃ {c : ColSeq n // AdjDistinct c ∧ c 0 = σ s ∧ c (Fin.last n) = σ t} where …Mentions: Usa2013P2.ColSeq, Usa2013P2.AdjDistinct
- theorem
Usa2013P2.card_eq_swapSwapping two column symbols does not change the counts line 107 sourceSource documentation
Swapping two column symbols does not change the counts.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,OfNat.ofNat,Eq,Equiv.Perm,Equiv.swap, Usa2013P2.countColProof uses:
id,Eq.mpr,Nat.card,Subtype, Usa2013P2.ColSeq,And, Usa2013P2.AdjDistinct,HAdd.hAdd,Fin.last,congrArg,Eq.symm,Nat.card_congr, Usa2013P2.permEquiv14 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
theorem card_eq_swap {n : ℕ} (s t s' t' p q : Fin 3) (hs : Equiv.swap p q s = s') (ht : Equiv.swap p q t = t') : countCol n s t = countCol n s' t' := by …Mentions: Usa2013P2.countCol
- def
Usa2013P2.dropLastEquivDeleting the last column: sequences of lengthn+2ending intcorrespond to sequences of lengthn+1ending in somer ≠ tline 116 sourceSource documentation
Deleting the last column: sequences of length
n+2ending intcorrespond to sequences of lengthn+1ending in somer ≠ t.standard axioms: Quot.sound, propext what this means
Statement uses:
Nat,Fin,OfNat.ofNat,Equiv,Subtype, Usa2013P2.ColSeq,HAdd.hAdd,And, Usa2013P2.AdjDistinct,Eq,Fin.last,Sigma,NeProof uses:
Equiv.mk,Sigma.mk,Fin.castSucc,Subtype.mk,Fin.init,Fin.snoc,Sigma.fst,Sigma.snd17 instances, coercions and auxiliary constants left out.
Tactic trace: 40 steps
Open to load the checked before-and-after goal states.
def dropLastEquiv {n : ℕ} (s t : Fin 3) : {c : ColSeq (n + 1) // AdjDistinct c ∧ c 0 = s ∧ c (Fin.last (n + 1)) = t} ≃ Σ r : Fin 3, {c : ColSeq n // AdjDistinct c ∧ c 0 = s ∧ c (Fin.last n) = r ∧ r ≠ t} where …Mentions: Usa2013P2.ColSeq, Usa2013P2.AdjDistinct
- theorem
Usa2013P2.countCol_succThe count recurrence obtained fromdropLastEquivline 169 sourceSource documentation
The count recurrence obtained from
dropLastEquiv.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,OfNat.ofNat,Eq, Usa2013P2.countCol,HAdd.hAdd,Finset.sum,Finset.univ,Nat.card,Subtype, Usa2013P2.ColSeq,And, Usa2013P2.AdjDistinct,Fin.last,NeProof uses:
id,Eq.mpr,Sigma,congrArg,Nat.card_congr, Usa2013P2.dropLastEquiv,Nat.card_sigma,Eq.refl20 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
theorem countCol_succ {n : ℕ} (s t : Fin 3) : countCol (n + 1) s t = ∑ r : Fin 3, Nat.card {c : ColSeq n // AdjDistinct c ∧ c 0 = s ∧ c (Fin.last n) = r ∧ r ≠ t} := by …Mentions: Usa2013P2.countCol, Usa2013P2.ColSeq, Usa2013P2.AdjDistinct
- theorem
Usa2013P2.card_drop_neDropping a decidable side condition from a column count line 177 sourceSource documentation
Dropping a decidable side condition from a column count.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,OfNat.ofNat,Ne,Eq,Nat.card,Subtype, Usa2013P2.ColSeq,And, Usa2013P2.AdjDistinct,HAdd.hAdd,Fin.last, Usa2013P2.countColProof uses:
Nat.card_congr,Equiv.subtypeEquivRight,Iff.intro,And.intro,And.left,And.right13 instances, coercions and auxiliary constants left out.
theorem card_drop_ne {n : ℕ} (s r t : Fin 3) (h : r ≠ t) : Nat.card {c : ColSeq n // AdjDistinct c ∧ c 0 = s ∧ c (Fin.last n) = r ∧ r ≠ t} = countCol n s r := …Mentions: h, Usa2013P2.ColSeq, Usa2013P2.AdjDistinct, Usa2013P2.countCol
- theorem
Usa2013P2.card_eq_zero_of_neA column count with contradictory side conditions is zero line 184 sourceSource documentation
A column count with contradictory side conditions is zero.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,OfNat.ofNat,Eq,Nat.card,Subtype, Usa2013P2.ColSeq,And, Usa2013P2.AdjDistinct,HAdd.hAdd,Fin.last,NeProof uses:
Eq.mpr,Fintype.card,Fin.castSucc,Fin.succ,id,congrArg,Nat.card_eq_fintype_card,IsEmpty,propext,Fintype.card_eq_zero_iff,IsEmpty.mk,And.right,Subtype.property,rfl21 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
theorem card_eq_zero_of_ne {n : ℕ} (s r t : Fin 3) (h : r = t) : Nat.card {c : ColSeq n // AdjDistinct c ∧ c 0 = s ∧ c (Fin.last n) = r ∧ r ≠ t} = 0 := by …Mentions: h, Usa2013P2.ColSeq, Usa2013P2.AdjDistinct
- theorem
Usa2013P2.x_succFirst recursion:x_{n+1} = y_n + x_nline 191 sourceSource documentation
First recursion:
x_{n+1} = y_n + x_n.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq, Usa2013P2.countCol,HAdd.hAdd,OfNat.ofNat,FinProof uses:
Eq.mpr,id,congrFun',congrArg,Eq.trans,Finset.sum,Finset.univ,Nat.card,Subtype, Usa2013P2.ColSeq,And, Usa2013P2.AdjDistinct,Fin.last,Ne, Usa2013P2.countCol_succ,Fin.sum_univ_three,congr, Usa2013P2.card_drop_ne,of_decide_eq_true,Booland 20 more39 instances, coercions and auxiliary constants left out.
Tactic trace: 8 steps
Open to load the checked before-and-after goal states.
theorem x_succ (n : ℕ) : countCol (n + 1) 0 1 = countCol n 2 2 + countCol n 0 1 := by …
Mentions: Usa2013P2.countCol
- theorem
Usa2013P2.y_succSecond recursion:y_{n+1} = 2 * x_nline 200 sourceSource documentation
Second recursion:
y_{n+1} = 2 * x_n.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq, Usa2013P2.countCol,HAdd.hAdd,OfNat.ofNat,Fin,HMul.hMulProof uses:
Eq.mpr,id,congrFun',congrArg,Eq.trans,Finset.sum,Finset.univ,Nat.card,Subtype, Usa2013P2.ColSeq,And, Usa2013P2.AdjDistinct,Fin.last,Ne, Usa2013P2.countCol_succ,Fin.sum_univ_three,congr, Usa2013P2.card_drop_ne,of_decide_eq_true,Booland 31 more42 instances, coercions and auxiliary constants left out.
Tactic trace: 10 steps
Open to load the checked before-and-after goal states.
theorem y_succ (n : ℕ) : countCol (n + 1) 2 2 = 2 * countCol n 0 1 := by …
Mentions: Usa2013P2.countCol
- theorem
Usa2013P2.x_zeroBase value: there is no sequence starting withuand ending withvwhenn = 0line 211 sourceSource documentation
Base value: there is no sequence starting with
uand ending withvwhenn = 0.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Eq,Nat, Usa2013P2.countCol,OfNat.ofNat,FinProof uses:
id,Eq.mpr,Nat.card,Subtype, Usa2013P2.ColSeq,And, Usa2013P2.AdjDistinct,HAdd.hAdd,Fin.last,Fintype.card,Ne,Fin.castSucc,Fin.succ,congrArg,Nat.card_eq_fintype_card,IsEmpty,propext,Fintype.card_eq_zero_iff,IsEmpty.mk,And.leftand 11 more18 instances, coercions and auxiliary constants left out.
Tactic trace: 7 steps
Open to load the checked before-and-after goal states.
theorem x_zero : countCol 0 0 1 = 0 := by …
Mentions: Usa2013P2.countCol
- theorem
Usa2013P2.y_zeroBase value: exactly one sequence starts and ends withwwhenn = 0line 220 sourceSource documentation
Base value: exactly one sequence starts and ends with
wwhenn = 0.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Eq,Nat, Usa2013P2.countCol,OfNat.ofNat,FinProof uses:
Unique,Subtype, Usa2013P2.ColSeq,And, Usa2013P2.AdjDistinct,HAdd.hAdd,Fin.last,Unique.mk,Inhabited.mk,Subtype.mk,And.intro,Fin.elim0,Ne,Fin.castSucc,Fin.succ,rfl,Subtype.ext,funext,Eq.mpr,idand 10 more18 instances, coercions and auxiliary constants left out.
Tactic trace: 7 steps
Open to load the checked before-and-after goal states.
theorem y_zero : countCol 0 2 2 = 1 := by …
Mentions: Usa2013P2.countCol
- theorem
Usa2013P2.two_x_add_yThe total number of sequences with fixed first column:2 * x_n + y_n = 2^nline 232 sourceSource documentation
The total number of sequences with fixed first column:
2 * x_n + y_n = 2^n.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq,HAdd.hAdd,HMul.hMul,OfNat.ofNat, Usa2013P2.countCol,Fin,HPow.hPowProof uses:
Nat.recAux,Eq.mpr,id,congrArg, Usa2013P2.x_zero, Usa2013P2.y_zero,Eq.refl, Usa2013P2.x_succ, Usa2013P2.y_succ,pow_succ26 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
theorem two_x_add_y (n : ℕ) : 2 * countCol n 0 1 + countCol n 2 2 = 2 ^ n := by …
Mentions: Usa2013P2.countCol
- theorem
Usa2013P2.keyThe key identity:a_{n+1} + a_n = 2 ^ (n+1)line 240 sourceSource documentation
The key identity:
a_{n+1} + a_n = 2 ^ (n+1).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq,HAdd.hAdd, Usa2013P2.a,OfNat.ofNat,HPow.hPowProof uses:
HMul.hMul, Usa2013P2.countCol,Fin, Usa2013P2.two_x_add_y,id,Eq.mpr,congrArg, Usa2013P2.x_succ, Usa2013P2.y_succ,pow_succ23 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
theorem key (n : ℕ) : a (n + 1) + a n = 2 ^ (n + 1) := by …
Mentions: Usa2013P2.a
- problem
Usa2013P2.usa2013_p2line 248 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,Eq,HAdd.hAdd, Usa2013P2.a,HSub.hSub,HPow.hPowProof uses: Usa2013P2.key,
Eq.mp,congrArg22 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.