Compfiles/Usa1996P4.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
19 declarations, 0 contain sorry, 0 declared as axioms
USA Mathematical Olympiad 1996, Problem 4
An n-term sequence (x₁, x₂, …, xₙ) in which each term is either 0 or 1 is called a binary sequence of length n. Let aₙ be the number of binary sequences of length n containing no three consecutive terms equal to 0, 1, 0 in that order. Let bₙ be the number of binary sequences of length n that contain no four consecutive terms equal to 0, 0, 1, 1 or 1, 1, 0, 0 in that order. Prove that bₙ₊₁ = 2aₙ for all positive integers n.
Imported by 1 file
- def
Usa1996P4.sgetThei-th term of a binary sequencex : Fin n → Bool, orfalseifiis out of range line 31 sourceSource documentation
The
i-th term of a binary sequencex : Fin n → Bool, orfalseifiis out of range.no axioms what this means
Statement uses:
Nat,Fin,BoolProof uses:
dite,LT.lt,Fin.mk,Not,Bool.false2 instances, coercions and auxiliary constants left out.
def sget {n : ℕ} (x : Fin n → Bool) (i : ℕ) : Bool := … - abbrev
Usa1996P4.GoodADocumented declaration: GoodA line 37 sourceSource documentation
A binary sequence of length
n(encoded asx : Fin n → Bool, withfalsestanding for0andtruefor1) isA-good if it contains no three consecutive terms equal to0, 1, 0in that order.no axioms what this means
Statement uses:
Nat,Fin,BoolProof uses:
LT.lt,HAdd.hAdd,OfNat.ofNat,Not,And,Eq, Usa1996P4.sget,Bool.false,Bool.true5 instances, coercions and auxiliary constants left out.
abbrev GoodA {n : ℕ} (x : Fin n → Bool) : Prop := … - abbrev
Usa1996P4.GoodBA binary sequence of lengthnisB-good if it contains no four consecutive terms equal to0, 0, 1, 1or1, 1, 0, 0in that order line 43 sourceSource documentation
A binary sequence of length
nisB-good if it contains no four consecutive terms equal to0, 0, 1, 1or1, 1, 0, 0in that order.no axioms what this means
Statement uses:
Nat,Fin,BoolProof uses:
LT.lt,HAdd.hAdd,OfNat.ofNat,Not,Or,And,Eq, Usa1996P4.sget,Bool.false,Bool.true5 instances, coercions and auxiliary constants left out.
abbrev GoodB {n : ℕ} (y : Fin n → Bool) : Prop := … - theorem
Usa1996P4.sget_ltline 52 sourceno axioms what this means
Statement uses:
Nat,Fin,Bool,LT.lt,Eq, Usa1996P4.sget,Fin.mkProof uses:
dite_eq_left,Not,Bool.false3 instances, coercions and auxiliary constants left out.
- def
Usa1996P4.diffThe sequence of successive differences (XORs) ofyline 57 sourceSource documentation
The sequence of successive differences (XORs) of
y.no axioms what this means
Statement uses:
Nat,Fin,HAdd.hAdd,OfNat.ofNat,BoolProof uses:
Bool.xor, Usa1996P4.sget7 instances, coercions and auxiliary constants left out.
def diff {n : ℕ} (y : Fin (n + 1) → Bool) : Fin n → Bool := … - def
Usa1996P4.buildAuxAuxiliary forbuild: thek-th term of the sequence with first termcand successive differences given byxline 62 sourceSource documentation
Auxiliary for
build: thek-th term of the sequence with first termcand successive differences given byx.no axioms what this means
Statement uses:
Nat,Fin,Bool2 instances, coercions and auxiliary constants left out.
def buildAux {n : ℕ} (x : Fin n → Bool) (c : Bool) : ℕ → Bool | 0 => c | k + 1 => xor (buildAux x c k) (sget x k) /-- The sequence of length `n + 1` with first term `c` whose successive differences are given by `x`. -/Mentions: Usa1996P4.sget
- def
Usa1996P4.buildThe sequence of lengthn + 1with first termcwhose successive differences are given byxline 68 sourceSource documentation
The sequence of length
n + 1with first termcwhose successive differences are given byx.no axioms what this means
Statement uses:
Nat,Fin,Bool,HAdd.hAdd,OfNat.ofNatProof uses: Usa1996P4.buildAux
7 instances, coercions and auxiliary constants left out.
def build {n : ℕ} (x : Fin n → Bool) (c : Bool) : Fin (n + 1) → Bool := … - theorem
Usa1996P4.build_zeroline 71 sourcestandard axioms: propext what this means
Statement uses:
Nat,Fin,Bool,Eq, Usa1996P4.build,OfNat.ofNat,HAdd.hAddProof uses:
id,of_eq_true,eq_self12 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- theorem
Usa1996P4.buildAux_succline 76 sourcestandard axioms: propext what this means
Statement uses:
Nat,Fin,Bool,Eq, Usa1996P4.buildAux,HAdd.hAdd,OfNat.ofNat,Bool.xor, Usa1996P4.sgetProof uses:
of_eq_true,eq_self3 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
- theorem
Usa1996P4.sget_buildline 80 sourceno axioms what this means
Statement uses:
Nat,Fin,Bool,LT.lt,HAdd.hAdd,OfNat.ofNat,Eq, Usa1996P4.sget, Usa1996P4.build, Usa1996P4.buildAuxProof uses:
dite_eq_left,Fin.mk,Not,Bool.false9 instances, coercions and auxiliary constants left out.
- theorem
Usa1996P4.sget_diff_buildline 84 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,Bool,LT.lt,Eq,Bool.xor, Usa1996P4.sget,HAdd.hAdd,OfNat.ofNat, Usa1996P4.buildProof uses:
Eq.mpr, Usa1996P4.buildAux,id,congrArg, Usa1996P4.sget_build, Usa1996P4.buildAux_succ,Bool.bne_self_left10 instances, coercions and auxiliary constants left out.
Tactic trace: 7 steps
Open to load the checked before-and-after goal states.
- theorem
Usa1996P4.sget_diffline 93 sourceno axioms what this means
Statement uses:
Nat,Fin,HAdd.hAdd,OfNat.ofNat,Bool,LT.lt,Eq,Bool.xor, Usa1996P4.sget, Usa1996P4.diffProof uses:
Eq.mpr,Fin.mk,id,congrArg, Usa1996P4.sget_lt,Eq.refl8 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- theorem
Usa1996P4.pattern_transferA block0,0,1,1or1,1,0,0inyat positionicorresponds exactly to a block0,1,0in the difference sequence ofyat positioniline 101 sourceSource documentation
A block
0,0,1,1or1,1,0,0inyat positionicorresponds exactly to a block0,1,0in the difference sequence ofyat positioni.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,HAdd.hAdd,OfNat.ofNat,Bool,LT.lt,Eq,Bool.xor, Usa1996P4.sget,Iff,Or,And,Bool.false,Bool.trueProof uses:
of_decide_eq_true,id,Decidable.decide,Eq.refl17 instances, coercions and auxiliary constants left out.
Tactic trace: 16 steps
Open to load the checked before-and-after goal states.
theorem pattern_transfer {n : ℕ} {y : Fin (n + 1) → Bool} {x : Fin n → Bool} (hxe : ∀ j : ℕ, j < n → xor (sget y j) (sget y (j + 1)) = sget x j) {i : ℕ} (hi : i + 3 < n + 1) : ((sget y i = false ∧ sget y (i + 1) = false ∧ sget y (i + 2) = true ∧ sget y (i + 3) = true) ∨ (sget y i = true ∧ sget y (i + 1) = true ∧ sget y (i + 2) = false ∧ sget y (i + 3) = false)) ↔ (sget x i = false ∧ sget x (i + 1) = true ∧ sget x (i + 2) = false) := by …Mentions: Usa1996P4.sget
- theorem
Usa1996P4.goodB_buildline 123 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,Bool, Usa1996P4.GoodA, Usa1996P4.GoodB,HAdd.hAdd,OfNat.ofNat, Usa1996P4.buildProof uses:
LT.lt,Or,And,Eq, Usa1996P4.sget,Bool.false,Bool.true,Iff.mp, Usa1996P4.pattern_transfer, Usa1996P4.sget_diff_build,Fin.mk,id10 instances, coercions and auxiliary constants left out.
Tactic trace: 8 steps
Open to load the checked before-and-after goal states.
- theorem
Usa1996P4.goodA_diffline 133 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,HAdd.hAdd,OfNat.ofNat,Bool, Usa1996P4.GoodB, Usa1996P4.GoodA, Usa1996P4.diffProof uses:
LT.lt,And,Eq, Usa1996P4.sget,Bool.false,Bool.true,Or,Iff.mpr, Usa1996P4.pattern_transfer, Usa1996P4.sget_diff,Fin.mk,id10 instances, coercions and auxiliary constants left out.
Tactic trace: 9 steps
Open to load the checked before-and-after goal states.
- theorem
Usa1996P4.diff_buildline 145 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,Bool,Eq, Usa1996P4.diff, Usa1996P4.buildProof uses:
funext,id,Eq.mpr,Bool.xor, Usa1996P4.sget,HAdd.hAdd,OfNat.ofNat,congrArg, Usa1996P4.sget_diff_build,Fin.isLt,Fin.mk, Usa1996P4.sget_lt,Eq.refl4 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- theorem
Usa1996P4.build_diffline 151 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,HAdd.hAdd,OfNat.ofNat,Bool,Eq, Usa1996P4.build, Usa1996P4.diffProof uses:
funext,LT.lt,id,Fin.mk,Nat.recAux, Usa1996P4.buildAux,of_eq_true,eq_self,Eq.mpr,congrArg,Nat.zero_lt_succ,Fin.zero_eta,Eq.refl,Bool.xor, Usa1996P4.sget, Usa1996P4.buildAux_succ,Eq.symm, Usa1996P4.sget_diff, Usa1996P4.sget_lt,Bool.bne_self_left16 instances, coercions and auxiliary constants left out.
Tactic trace: 16 steps
Open to load the checked before-and-after goal states.
- def
Usa1996P4.seqEquivDocumented declaration: seqEquiv line 172 sourceSource documentation
The 2-to-1 correspondence: a
B-good sequence of lengthn + 1is determined by its first term (two choices) and its difference sequence, which is anA-good sequence of lengthn.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Equiv,Prod,Subtype,Fin,Bool, Usa1996P4.GoodA,HAdd.hAdd,OfNat.ofNat, Usa1996P4.GoodBProof uses:
Equiv.mk,Usa1996P4.seqEquiv.match_1,Subtype.mk, Usa1996P4.build,Prod.mk, Usa1996P4.diff13 instances, coercions and auxiliary constants left out.
Tactic trace: 8 steps
Open to load the checked before-and-after goal states.
def seqEquiv (n : ℕ) : {x : Fin n → Bool // GoodA x} × Bool ≃ {y : Fin (n + 1) → Bool // GoodB y} where …Mentions: Usa1996P4.GoodA, Usa1996P4.GoodB
- problem
Usa1996P4.usa1996_p4line 187 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq,Fintype.card,Subtype,Fin,HAdd.hAdd,OfNat.ofNat,Bool, Usa1996P4.GoodB,LT.lt,Not,Or,And, Usa1996P4.sget,Bool.false,Bool.true,HMul.hMul, Usa1996P4.GoodAProof uses:
Prod,Fintype.card_congr, Usa1996P4.seqEquiv,Eq.mp,congrArg,Fintype.card_bool,Fintype.card_prod40 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.