FormalConjectures/OEIS/100475.lean

GitHub source file

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 project documentation, Formal Conjectures paper, arXiv v1

13 declarations, 1 contain sorry, 0 declared as axioms

Prime-th recurrence with reversal at each step

$$a(n) = \operatorname{reversal}(p_{a(n-1)})$$ with $a(0)=1$, where $p_k$ is the $k$-th prime number.

References:

Imports (1)
  1. def OeisA100475.reverseDigits Reverses the base 10 digits of a natural number line 37 source

    Source documentation

    Reverses the base 10 digits of a natural number.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat

    Proof uses: Nat.ofDigits, OfNat.ofNat, List.reverse, Nat.digits

    2 instances, coercions and auxiliary constants left out.

    def reverseDigits (k : ℕ) : ℕ :=
    …
  2. def OeisA100475.a The primary defining sequence a line 44 source

    Source documentation

    The primary defining sequence a. a n is the Prime-th recurrence with reversal at each step. $a(n) = \operatorname{reversal}(p_{a(n-1)})$ with $a(0)=1$, where $p_k$ is the $k$-th prime number (i.e., $p_1=2, p_2=3, \dots$).

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat

    2 instances, coercions and auxiliary constants left out.

    noncomputable def a : ℕ → ℕ
      | 0 => 1
      | n + 1 =>
        let k := a n
    …
  3. lemma OeisA100475.a_succ line 52 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Eq, OeisA100475.a, HAdd.hAdd, OfNat.ofNat, ite, OeisA100475.reverseDigits, Nat.nth, Nat.Prime, HSub.hSub

    Proof uses: Eq.refl

    9 instances, coercions and auxiliary constants left out.

    Tactic trace: 1 steps

    Open to load the checked before-and-after goal states.

  4. theorem OeisA100475.a_0 Term theorems verifying the first few values of the sequence against the official OEIS b-file line 58 source

    Source documentation

    Term theorems verifying the first few values of the sequence against the official OEIS b-file

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Eq, Nat, OeisA100475.a, OfNat.ofNat

    Proof uses: Eq.refl

    2 instances, coercions and auxiliary constants left out.

    Tactic trace: 1 steps

    Open to load the checked before-and-after goal states.

    theorem a_0 : a 0 = 1 := by rfl
    …

    Mentions: OeisA100475.a

  5. theorem OeisA100475.a_1 line 61 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Eq, Nat, OeisA100475.a, OfNat.ofNat

    Proof uses: Eq.mpr, ite, OeisA100475.reverseDigits, Nat.nth, Nat.Prime, HSub.hSub, id, congrArg, HAdd.hAdd, OeisA100475.a_succ, OeisA100475.a_0, of_eq_true, Eq.trans, True, congrFun', ite_cond_eq_false, Nat.ofDigits, List.reverse, Nat.digits, List.cons and 18 more

    50 instances, coercions and auxiliary constants left out.

    Tactic trace: 3 steps

    Open to load the checked before-and-after goal states.

  6. theorem OeisA100475.a_2 line 67 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Eq, Nat, OeisA100475.a, OfNat.ofNat

    Proof uses: Eq.mpr, ite, OeisA100475.reverseDigits, Nat.nth, Nat.Prime, HSub.hSub, id, congrArg, HAdd.hAdd, OeisA100475.a_succ, OeisA100475.a_1, of_eq_true, Eq.trans, True, congrFun', ite_cond_eq_false, Nat.ofDigits, List.reverse, Nat.digits, List.cons and 17 more

    38 instances, coercions and auxiliary constants left out.

    Tactic trace: 3 steps

    Open to load the checked before-and-after goal states.

  7. theorem OeisA100475.a_3 line 73 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Eq, Nat, OeisA100475.a, OfNat.ofNat

    Proof uses: Eq.mpr, ite, OeisA100475.reverseDigits, Nat.nth, Nat.Prime, HSub.hSub, id, congrArg, HAdd.hAdd, OeisA100475.a_succ, OeisA100475.a_2, of_eq_true, Eq.trans, True, congrFun', ite_cond_eq_false, Nat.ofDigits, List.reverse, Nat.digits, List.cons and 17 more

    38 instances, coercions and auxiliary constants left out.

    Tactic trace: 3 steps

    Open to load the checked before-and-after goal states.

  8. theorem OeisA100475.a_4 line 79 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Eq, Nat, OeisA100475.a, OfNat.ofNat

    Proof uses: Eq.mpr, ite, OeisA100475.reverseDigits, Nat.nth, Nat.Prime, HSub.hSub, id, congrArg, HAdd.hAdd, OeisA100475.a_succ, OeisA100475.a_3, Nat.ofDigits, List.cons, List.nil, congrFun', Eq.trans, ite_cond_eq_false, List, List.reverse, Nat.digits and 18 more

    53 instances, coercions and auxiliary constants left out.

    Tactic trace: 4 steps

    Open to load the checked before-and-after goal states.

  9. def OeisA100475.aStartAt Definition of the generalized sequence starting at x line 86 source

    Source documentation

    Definition of the generalized sequence starting at x.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat

    2 instances, coercions and auxiliary constants left out.

    noncomputable def aStartAt (x : ℕ) : ℕ → ℕ
      | 0 => x
      | n + 1 =>
        let k := aStartAt x n
    …
  10. def OeisA100475.IsUltimatelyPeriodic A sequence $f : \mathbb{N} \to \mathbb{N}$ is ultimately periodic if there exist $N, P \in \mathbb{N}$, with $P>0$, such that for all $n \ge N$, $f(n+P) = f(n)$ line 95 source

    Source documentation

    A sequence $f : \mathbb{N} \to \mathbb{N}$ is ultimately periodic if there exist $N, P \in \mathbb{N}$, with $P>0$, such that for all $n \ge N$, $f(n+P) = f(n)$.

    no axioms what this means

    Statement uses: Nat

    Proof uses: Exists, And, GT.gt, OfNat.ofNat, GE.ge, Eq, HAdd.hAdd

    5 instances, coercions and auxiliary constants left out.

    def IsUltimatelyPeriodic (f : ℕ → ℕ) : Prop :=
    …
  11. lemma OeisA100475.aStartAt_zero The totalized recurrence stays at zero when initialized at zero line 102 source

    Source documentation

    The totalized recurrence stays at zero when initialized at zero. The OEIS recurrence itself uses one-based prime indices, so this is a boundary behavior of the formalization rather than a term of the original sequence.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Eq, OeisA100475.aStartAt, OfNat.ofNat

    Proof uses: Nat.recAux, Eq.refl, of_eq_true, HAdd.hAdd, Eq.trans, True, congrFun', congrArg, ite_cond_eq_true, OeisA100475.reverseDigits, Nat.nth, Nat.Prime, HSub.hSub, eq_self

    7 instances, coercions and auxiliary constants left out.

    Tactic trace: 3 steps

    Open to load the checked before-and-after goal states.

    lemma aStartAt_zero (n : ℕ) : aStartAt 0 n = 0 := by
    …

    Mentions: OeisA100475.aStartAt

  12. theorem OeisA100475.conjecture_with_zero If zero is admitted as a starting value, then a start other than $1$ does go into a loop: the sequence starting at zero is constant line 113 source

    Source documentation

    If zero is admitted as a starting value, then a start other than $1$ does go into a loop: the sequence starting at zero is constant. This records the degenerate answer created by totalizing the one-based prime recurrence at index zero.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Iff, True, Exists, Nat, And, Ne, OfNat.ofNat, OeisA100475.IsUltimatelyPeriodic, OeisA100475.aStartAt

    Proof uses: id, Iff.intro, Exists.intro, And.intro, Eq, GT.gt, GE.ge, HAdd.hAdd, Decidable.byContradiction, Not, Eq.mpr, congrArg, OeisA100475.aStartAt_zero, Eq.refl, True.intro

    9 instances, coercions and auxiliary constants left out.

    Tactic trace: 12 steps

    Open to load the checked before-and-after goal states.

    theorem conjecture_with_zero :
        answer(True) ↔ ∃ x : ℕ, x ≠ 1 ∧ IsUltimatelyPeriodic (aStartAt x) := by
    …

    Mentions: OeisA100475.IsUltimatelyPeriodic, OeisA100475.aStartAt

  13. theorem OeisA100475.conjecture Starting at a positive value other than $a(0) = 1$, does this sequence ever go into a loop? sorry line 131 source

    Source documentation

    Starting at a positive value other than $a(0) = 1$, does this sequence ever go into a loop?

    The positivity hypothesis is required because the source recurrence uses the one-based prime index p₁ = 2; the x = 0 branch above is only an artifact of making aStartAt total on ℕ.

    depends on sorry what this means

    Statement uses: Iff, True, Exists, Nat, And, LT.lt, OfNat.ofNat, Ne, OeisA100475.IsUltimatelyPeriodic, OeisA100475.aStartAt

    Proof uses: sorryAx, Lean.Name, Bool.false, Lean.Name.num, Lean.Name.str, Lean.Name.anonymous

    4 instances, coercions and auxiliary constants left out.

    Tactic trace: 1 steps

    Open to load the checked before-and-after goal states.

    theorem conjecture :
        answer(sorry) ↔ ∃ x : ℕ, 0 < x ∧ x ≠ 1 ∧ IsUltimatelyPeriodic (aStartAt x) := by
    …

    Mentions: OeisA100475.IsUltimatelyPeriodic, OeisA100475.aStartAt