Two mirrors (squares and doubled squares)

10 of 11 main results in Lean (91%); 1 of 11 certificate-only (gate orbits through level 15 and census checks); 1 open global periodicity conjecture excluded · AI-generated and directed by Tyler B. Hughes · No human mathematician has yet refereed the proof.

Reverse each block of numbers between doubled squares (0, 2, 8, 18, …), then each block between squares (0, 1, 4, 9, …), and repeat. Lean proves every number below 1681 comes back to itself, and that at most one path could run off for ever.

Let f(n) = A(D(n)), where D reverses each block from 2m² to 2(m + 1)² − 1 and A reverses each block from s² to (s + 1)² − 1: then every number below 1681 comes back to itself under f, any return takes a multiple of 4 steps, any two numbers that never come back lie on one path, and every number comes back if and only if every pronic number pairs with a second pronic.

Two simple reversals make a reshuffle of all the whole numbers. Every path that has been followed comes back, yet whether every path does is an open question, much like the 3x + 1 problem. The nearest published relative found in the searches logged on the result page is the work of Alwani and Vivaldi (2017) on products of two block mirrors.

Steps, a gate and a cycle of four

The doubled-square blocks are [0, 1], [2, 7], [8, 17], [18, 31], …, and the square blocks are [0], [1, 3], [4, 8], [9, 15], [16, 24], …. Reversing a block from a to b sends n to a + b − n.

One step from 2: 2 is in the block [2, 7], so D(2) = 2 + 7 − 2 = 7. Then 7 is in the block [4, 8], so A(7) = 4 + 8 − 7 = 5. So f(2) = 5.

The path of 0 is 0 → 3 → 6 → 1 → 0. It comes back after 4 steps. The path of 2 comes back after 28 steps, and 28 = 4 × 7.

The number 8 is a Pell level: 8 = 2·2² and 9 = 3² are one apart. Of the numbers 0 to 7, only 5 steps to 8 or above, since f(5) = A(D(5)) = A(4) = 8. Of the numbers from 8 up, only 17 steps back below 8, since f(17) = A(8) = 4. The gate lemma proves there is no other.

At the same level, 56 = 7·8 and 90 = 9·10 are pronic, and 56 → 79 → 90 → 65 → 56 is a cycle of four steps.

Two mirrors and one reshuffle

A reverses each block between consecutive squares, and D reverses each block between consecutive doubled squares. Each mirror undoes itself, so one step f = A after D can be run backwards, and f reshuffles the whole numbers. A number comes back if some number of steps, at least one, returns it to itself.

  • Every step can be undone
  • The square mirror A
  • The doubled-square mirror D
  • One step: mirror D, then mirror A
  • One step backwards
  • Coming back
  • Pronic numbers
  • Which square block holds n
  • The formula for A inside a block
  • A stays in its block
  • A keeps the square root
  • A undoes itself

    A(A(n)) = n for every n.

    theorem TwoMirrors.mirrorA_involutive :
      Function.Involutive mirrorA
  • A never crosses a square

    For every n and s, A(n) < s² exactly when n < s².

    theorem TwoMirrors.mirrorA_lt_sq_iff (n : ℕ) (s : ℕ) :
      mirrorA n < s ^ 2 ↔ n < s ^ 2
  • Which doubled-square block holds n
  • The formula for D inside a block
  • D stays in its block
  • D keeps the block number
  • D undoes itself

    D(D(n)) = n for every n.

    theorem TwoMirrors.mirrorD_involutive :
      Function.Involutive mirrorD
  • D never crosses a doubled square

    For every n and m, D(n) < 2m² exactly when n < 2m².

    theorem TwoMirrors.mirrorD_lt_dbl_sq_iff (n : ℕ) (m : ℕ) :
      mirrorD n < 2 * m ^ 2 ↔ n < 2 * m ^ 2
  • The reshuffle steps by f
  • The reverse reshuffle steps by f⁻¹
  • The inverse reshuffle steps by f⁻¹
  • k steps of the reshuffle are k steps of f
  • The same for k written as an integer
  • A turns a forward step into a backward one
  • A turns a backward step into a forward one
  • A reverses the direction of every path

    For every integer z and every n, A(fᶻ(n)) = f⁻ᶻ(A(n)). A negative power means steps backwards.

    theorem TwoMirrors.mirrorA_zpow (z : ℤ) (n : ℕ) :
      mirrorA ((fEquiv ^ z) n) = (fEquiv ^ (-z)) (mirrorA n)
  • A trapped path comes back

    For any reshuffle e of the whole numbers, if every forward step from n stays below some bound B, then n comes back under e.

    theorem TwoMirrors.periodic_of_bdd_orbit {e : Equiv.Perm ℕ} {n : ℕ} {B : ℕ} (hbdd : ∀ (k : ℕ), (e ^ k) n < B) :
      IsPeriodic (⇑e) n

Every step moves by 3 more than a multiple of 4

A fixes exactly the pronic numbers s·(s + 1), and D fixes nothing. If n lies in the doubled-square block that starts at 2m², and D(n) in the square block that starts at s², one step changes n by 2s(s + 1) − (2m + 1)², which is 3 more than a multiple of 4. After L steps the change is 3L more than a multiple of 4, so a return needs L to be a multiple of 4. Also, a square never equals a doubled square above 0, so the two kinds of block never start at the same place above 0.

  • Every return takes a multiple of 4 steps

    For every n and L, if fᴸ(n) = n then 4 divides L.

    theorem TwoMirrors.cycle_length_dvd_four (n : ℕ) (L : ℕ) (h : f^[L] n = n) :
      4 ∣ L
  • Each step moves by 3 more than a multiple of 4

    For every n, f(n) − n leaves remainder 3 when divided by 4.

    theorem TwoMirrors.f_sub_mod_four (n : ℕ) :
      (↑(f n) - ↑n) % 4 = 3
  • f moves every number
  • L steps move by 3L, up to multiples of 4

    For every n and L, fᴸ(n) − n and 3L leave the same remainder when divided by 4.

    theorem TwoMirrors.f_iterate_sub_mod_four (n : ℕ) (L : ℕ) :
      (↑(f^[L] n) - ↑n) % 4 = 3 * ↑L % 4
  • A fixes exactly the pronic numbers

    A(n) = n exactly when n is pronic.

    theorem TwoMirrors.mirrorA_fixed_iff_pronic (n : ℕ) :
      mirrorA n = n ↔ IsPronic n
  • D moves every number

    D(n) ≠ n for every n.

    theorem TwoMirrors.mirrorD_no_fixed (n : ℕ) :
      mirrorD n ≠ n
  • A square is never a doubled square

    For all whole numbers s and m with m > 0, s² ≠ 2m².

    theorem TwoMirrors.no_exact_walls (s : ℕ) (m : ℕ) (a.0 : 0 < m) :
      s ^ 2 ≠ 2 * m ^ 2

One way in and one way out at each Pell level

Take whole numbers s, m ≥ 1 with s² and 2m² one apart, and let g be the smaller of the two; the Pell levels 1, 8, 49, 288, 1681, … are of this kind. Exactly one number below g steps to g or above, and exactly one number from g up steps back below g. The proof splits on which of s² and 2m² is larger. A path that comes in below g through one door can only leave through the other, so both doors lie on the path through g.

  • The gate lemma

    Let s, m ≥ 1 with s² − 2m² equal to 1 or −1, and let g be the smaller of s² and 2m². Exactly one number x below g has f(x) ≥ g, exactly one number y ≥ g has f(y) < g, and both lie on the path through g.

    theorem TwoMirrors.pell_gate_lemma {s : ℕ} {m : ℕ} (hs : 1 ≤ s) (hm : 1 ≤ m) (hpell : ↑s ^ 2 - 2 * ↑m ^ 2 = 1 ∨ ↑s ^ 2 - 2 * ↑m ^ 2 = -1) :
      have g := min (s ^ 2) (2 * m ^ 2);
    (∃! x, x < g ∧ g ≤ f x) ∧
      (∃! y, g ≤ y ∧ f y < g) ∧
        (∀ x < g, g ≤ f x → ∃ z, (fEquiv ^ z) x = g) ∧ ∀ (y : ℕ), g ≤ y → f y < g → ∃ z, (fEquiv ^ z) y = g
  • The Pell pairs
  • The s of a Pell pair
  • The m of a Pell pair
  • The Pell levels
  • The starting s
  • The starting m
  • The step for s
  • The step for m
  • Every s is at least 1
  • Every m is at least 1
  • The Pell identity

    For every k, sₖ² − 2mₖ² = (−1)ᵏ⁺¹.

    theorem TwoMirrors.pell_eq (k : ℕ) :
      ↑(pellS k) ^ 2 - 2 * ↑(pellM k) ^ 2 = (-1) ^ (k + 1)
  • Every Pell pair is one apart
  • The Pell levels keep growing
  • There is always a higher Pell level

    For every N there is a k with gₖ > N.

    theorem TwoMirrors.exists_pellG_gt (N : ℕ) :
      ∃ k, N < pellG k
  • The Pell levels 1, 8, 49, 288 and 1681
  • The gate when s² is one more than 2m²

    Let s, m ≥ 1 with s² = 2m² + 1, and let g = 2m². The only number below g that f sends to g or above is x₀ = D((s − 1)²), and f(x₀) = g. The only number from g up that f sends below g is y₀ = D(g), and f(y₀) = (s − 1)².

    theorem TwoMirrors.pell_gate_case_pos {s : ℕ} {m : ℕ} (_hs : 1 ≤ s) (hm : 1 ≤ m) (h : s ^ 2 = 2 * m ^ 2 + 1) :
      have g := 2 * m ^ 2;
    have x₀ := mirrorD ((s - 1) ^ 2);
    have y₀ := mirrorD g;
    x₀ < g ∧
      g ≤ y₀ ∧
        f x₀ = g ∧
          f y₀ = (s - 1) ^ 2 ∧ (s - 1) ^ 2 < g ∧ (∀ x < g, g ≤ f x ↔ x = x₀) ∧ ∀ (y : ℕ), g ≤ y → (f y < g ↔ y = y₀)
  • The gate when 2m² is one more than s²

    Let s, m ≥ 1 with 2m² = s² + 1, and let g = s². The only number below g that f sends to g or above is x₀ = 2(m − 1)², with D(x₀) = g and f(x₀) = A(g). The only number from g up that f sends below g is g itself.

    theorem TwoMirrors.pell_gate_case_neg {s : ℕ} {m : ℕ} (_hs : 1 ≤ s) (hm : 1 ≤ m) (h : 2 * m ^ 2 = s ^ 2 + 1) :
      have g := s ^ 2;
    have x₀ := 2 * (m - 1) ^ 2;
    x₀ < g ∧
      mirrorD x₀ = g ∧
        f x₀ = mirrorA g ∧ g ≤ f x₀ ∧ f g < g ∧ (∀ x < g, g ≤ f x ↔ x = x₀) ∧ ∀ (y : ℕ), g ≤ y → (f y < g ↔ y = g)
  • In through one door, out through the other

    Let e be a reshuffle of the whole numbers and g a number. Suppose x₀ is the only number below g that e sends to g or above, and y₀ ≥ g is the only number from g up that e sends below g. Then stepping forward from e(y₀) reaches x₀ after some number of steps.

    theorem TwoMirrors.single_door_connects {e : Equiv.Perm ℕ} {g : ℕ} {x₀ : ℕ} {y₀ : ℕ} (hy₀ : g ≤ y₀) (hx_uniq : ∀ x < g, g ≤ e x ↔ x = x₀) (hy_uniq : ∀ (y : ℕ), g ≤ y → (e y < g ↔ y = y₀)) :
      ∃ k, (e ^ k) (e y₀) = x₀

At most one path can run off

A number that is not on the path through a Pell level g never crosses g, in either direction. If it lies below g, its path is trapped in finitely many numbers, so it comes back. Hence a number below g that never comes back lies on the path through g. Because the Pell levels grow without end, any two numbers that never come back lie on one path. And all the numbers below g come back if and only if g itself comes back.

  • At most one path runs off

    If neither a nor b comes back under f, then some number of steps forwards or backwards takes a to b.

    theorem TwoMirrors.at_most_one_infinite_orbit {a : ℕ} {b : ℕ} (ha : ¬IsPeriodic f a) (hb : ¬IsPeriodic f b) :
      ∃ z, (fEquiv ^ z) a = b
  • Everything below a Pell level comes back exactly when the level does

    Let s, m ≥ 1 with s² − 2m² equal to 1 or −1, and let g be the smaller of s² and 2m². Every number below g comes back under f if and only if g comes back under f.

    theorem TwoMirrors.all_below_periodic_iff_gate_periodic {s : ℕ} {m : ℕ} (hs : 1 ≤ s) (hm : 1 ≤ m) (hpell : ↑s ^ 2 - 2 * ↑m ^ 2 = 1 ∨ ↑s ^ 2 - 2 * ↑m ^ 2 = -1) :
      have g := min (s ^ 2) (2 * m ^ 2);
    (∀ n < g, IsPeriodic f n) ↔ IsPeriodic f g
  • Off the path through a Pell level, a number never crosses it

    Let s, m and g be as in the gate lemma, and let n be a number that is not on the path through g. If n < g, every number on the path of n is below g. If n ≥ g, every number on it is at least g.

    theorem TwoMirrors.orbit_separated_by_pell_gate {s : ℕ} {m : ℕ} (hs : 1 ≤ s) (hm : 1 ≤ m) (hpell : ↑s ^ 2 - 2 * ↑m ^ 2 = 1 ∨ ↑s ^ 2 - 2 * ↑m ^ 2 = -1) {n : ℕ} (hnot : ∀ (z : ℤ), (fEquiv ^ z) (min (s ^ 2) (2 * m ^ 2)) ≠ n) :
      have g := min (s ^ 2) (2 * m ^ 2);
    (n < g → ∀ (z : ℤ), (fEquiv ^ z) n < g) ∧ (g ≤ n → ∀ (z : ℤ), g ≤ (fEquiv ^ z) n)
  • A number below a Pell level that never comes back is on the level's path

    Let s, m and g be as in the gate lemma. If a < g and a never comes back under f, then a lies on the path through g.

  • Coming back passes along a path

    If some number of steps forwards or backwards takes a to b, and a comes back under f, then b comes back under f.

    theorem TwoMirrors.isPeriodic_of_zpow {a : ℕ} {b : ℕ} {z : ℤ} (h : (fEquiv ^ z) a = b) (ha : IsPeriodic f a) :
      IsPeriodic f b
  • One path, one answer
  • The conjecture is about the Pell levels alone

    Every whole number comes back under f if and only if every Pell level comes back under f.

Pronic numbers pair up

Walk from a pronic number p by D, then A, then D, and so on. Say p pairs if the walk reaches a second pronic number. Since A reverses the direction of the path and fixes p, p pairs exactly when p comes back. A path that never comes back holds exactly one pronic number, so at most one pronic number fails to pair, and every number comes back if and only if every pronic number pairs. At every Pell level g, the walk from the pronic number (g − 1)·g reaches the pronic number (g + 1)·(g + 2) after three swaps, D, A and D, so it pairs.

  • Every number comes back exactly when every pronic number pairs

    Every whole number comes back under f if and only if every pronic number pairs with a second pronic number.

    theorem TwoMirrors.all_periodic_iff_every_pronic_pairs :
      (∀ (n : ℕ), IsPeriodic f n) ↔ ∀ (p : ℕ), IsPronic p → PronicPairs p
  • A cycle of four at every Pell level

    Let s, m ≥ 1 with s² − 2m² equal to 1 or −1, let g be the smaller of s² and 2m², and let p₀ = (g − 1)·g and p₁ = (g + 1)·(g + 2). Both are pronic, the swaps D, A, D take p₀ to p₁, f²(p₀) = p₁, f⁴(p₀) = p₀, and p₀ < D(p₀) < f(p₀) < p₁.

    theorem TwoMirrors.pell_level_four_cycle {s : ℕ} {m : ℕ} (hs : 1 ≤ s) (hm : 1 ≤ m) (hpell : ↑s ^ 2 - 2 * ↑m ^ 2 = 1 ∨ ↑s ^ 2 - 2 * ↑m ^ 2 = -1) :
      have g := min (s ^ 2) (2 * m ^ 2);
    have p₀ := (g - 1) * g;
    have p₁ := (g + 1) * (g + 2);
    IsPronic p₀ ∧
      IsPronic p₁ ∧ altStep 3 p₀ = p₁ ∧ f^[2] p₀ = p₁ ∧ f^[4] p₀ = p₀ ∧ p₀ < mirrorD p₀ ∧ mirrorD p₀ < f p₀ ∧ f p₀ < p₁
  • The alternating walk
  • The walk starts at n
  • An even number of swaps is a number of steps
  • An odd number of swaps ends with D
  • Pairing
  • Returning backwards counts too
  • A pronic number pairs exactly when it comes back

    If p is pronic, then p pairs if and only if p comes back under f.

  • The mirror image of a path that runs off also runs off
  • A path that runs off holds exactly one pronic number

    If a never comes back under f, then exactly one pronic number lies on the path of a.

  • At most one pronic number fails to pair

    If p₁ and p₂ are pronic and neither pairs, then p₁ = p₂.

  • A product identity at a Pell level

    If s² − 2m² is 1 or −1 and g is the smaller of s² and 2m², then 2(s·m)² = g·(g + 1).

  • The cycle of four at each indexed level
  • The cycle 56, 79, 90, 65 at the level 8

Every number below 1681 comes back

Lean follows the path of each of the levels 1, 8, 49, 288 and 1681 and checks that it returns after 4, 28, 28, 128 and 92 steps. To make this fast inside Lean, it uses a square-root routine proved to agree with the usual one, and a path checker proved to be sound. Since 1681 comes back, every number below 1681 comes back, by the chapter At most one path can run off.

  • Every number below 1681 comes back

    Every n < 1681 comes back under f.

    theorem TwoMirrors.all_periodic_lt_1681 (n : ℕ) (a.0 : n < 1681) :
      IsPeriodic f n
  • Every number below 288 comes back
  • A fast square-root routine
  • The fast square root is right

    For every fuel k and every n < 4ᵏ, the routine with fuel k gives ⌊√n⌋.

  • The square mirror, computed fast
  • The doubled-square mirror, computed fast
  • One step, computed fast
  • The fast square mirror is right
  • The fast doubled-square mirror is right
  • The fast step is right
  • A path checker
  • The path checker can be trusted

    For every number of steps L, start a and target b, if the checker answers yes, then fᴸ(a) = b.

  • Some values of A
  • Some values of D
  • 1 returns in 4 steps
  • 8 returns in 28 steps
  • 49 returns in 28 steps
  • 288 returns in 128 steps
  • 1681 returns in 92 steps
  • The level 1 comes back
  • The level 8 comes back
  • The level 49 comes back
  • The level 288 comes back
  • The level 1681 comes back

Three neighbouring pairs of mirrors, settled

Keep A and change the other mirror. With blocks at the triangular numbers, infinitely many squares are also triangular, so they are walls neither mirror crosses and every number comes back. With blocks at the pronic numbers, a simple score rises by exactly 1 at every step, so no number ever comes back. With blocks at 4m², every 4m² = (2m)² is a wall and every number comes back.

  • With triangular blocks, every number comes back

    Every whole number comes back under the step n ↦ A(B(n)).

    theorem TwoMirrors.triangular_all_periodic (n : ℕ) :
      IsPeriodic (mirrorA ∘ mirrorB) n
  • With pronic blocks, no number comes back

    No whole number comes back under the step n ↦ A(C(n)).

    theorem TwoMirrors.pronic_no_periodic (n : ℕ) :
      ¬IsPeriodic (mirrorA ∘ mirrorC) n
  • With blocks at 4m², every number comes back

    Every whole number comes back under the step n ↦ A(M₄(n)).

    theorem TwoMirrors.quadSquare_all_periodic (n : ℕ) :
      IsPeriodic (mirrorA ∘ mirror4) n
  • The triangular numbers
  • Which triangular block holds n
  • The triangular mirror B
  • Twice a triangular number
  • The next triangular number
  • The triangular numbers keep growing
  • The triangular block index is right
  • The formula for B inside a block
  • B stays in its block
  • B undoes itself
  • B never crosses a triangular number

    For every n and t, B(n) < T(t) exactly when n < T(t).

  • Squares that are triangular

    For every k, (sₖ·mₖ)² = T(gₖ).

  • Square triangular numbers as large as you like

    For every N there are s and t with s² > N and s² = T(t).

  • A after B, as a reshuffle
  • The s-th pronic number
  • Which pronic block holds n
  • The pronic mirror C
  • The pronic block index is right
  • The formula for C inside a block
  • C stays in its block
  • C undoes itself
  • The score φ
  • One step of A after C, in a formula

    Write n = s² + d with s = ⌊√n⌋. If s ≤ d, then A(C(n)) = (s + 1)² + d + 2. If d < s, then A(C(n)) = (s − 1)² + d.

  • Each step raises the score by 1

    φ(A(C(n))) = φ(n) + 1 for every n.

  • L steps raise the score by L
  • The mirror M₄ with blocks at 4m²
  • Which 4m² block holds n
  • The formula for M₄ inside a block
  • M₄ stays in its block
  • M₄ never crosses a number 4m²

    For every n and m, M₄(n) < 4m² exactly when n < 4m².

  • A after M₄, as a reshuffle