AFTD Auto-Formalizing Theoretical Domains

cycle_power_dyadic_optimal_count_no_middle_island_of_regular_continuation

theoremverified

Conditional proof of the island exclusion for every exponent j+3 ≥ 4. Call a class regular of the first kind if it contains offset 1 and its offsets come in consecutive pairs (2i, 2i+1 both in or both out), and regular of the second kind if it consists of its two endpoints only. Hypotheses, for class models as below: (hIR) without any count, an island class rooted at p forces every class rooted within 7·2^j of p to be regular, of the first kind at even distance from p and of the second kind at odd distance; (hCTr), (hCTl) with exactly t+2 active classes per vertex at exponent t+1 ≥ 4, if the classes on 3·2^t consecutive roots ending (resp. starting) at p0 are regular with the kinds alternating and p0 of the first kind, then the next two classes to the right (resp. left) are regular, of the second and of the first kind. Conclusion: for j ≥ 1, in a tight, exactly dyadically covered, fully covered integer Boolean class model at exponent j+3 with exactly j+4 active classes at every vertex, no class is the island [0, g) ∪ [3g, 5g) ∪ [7g, D), where D = 2^(j+3), g = 2^j.

Statement

theorem cycle_power_dyadic_optimal_count_no_middle_island_of_regular_continuation
    (hIR : ∀ j : ℕ, 1 ≤ j → ∀ (x : ℤ → ℕ → Bool),
      (∀ p, cycle_power_dyadic_class_weight (j+3) (x p) =
        (Finset.range (2^(j+3))).sum (fun a => (x p a).toNat)) →
      (∀ i < j+3, ∀ v : ℤ, (Finset.range (2^i)).sum (fun a =>
        (x (v-(a : ℤ)) a && x (v-(a : ℤ)) (a+2^(j+3)-2^i)).toNat) = 1) →
      (∀ d : ℕ, 1 ≤ d → d < 2^(j+3) → ∀ v : ℤ,
        ∃ a : ℕ, a < 2^(j+3)-d ∧ x (v-(a : ℤ)) a = true ∧
          x (v-(a : ℤ)) (a+d) = true) →
      ∀ p : ℤ, (∀ b < 2^(j+3), x p b =
        (decide (b < 2^j) || (decide (3*2^j ≤ b) && decide (b < 5*2^j)) || decide (7*2^j ≤ b))) →
      ∀ r : ℤ, p - 7*2^j ≤ r → r ≤ p + 7*2^j →
        ((r - p) % 2 = 0 → x r 1 = true ∧ ∀ i < 2^(j+2), x r (2*i) = x r (2*i+1)) ∧
        ((r - p) % 2 = 1 → ∀ a, 0 < a → a < 2^(j+3) - 1 → x r a = false))
    (hCTr : ∀ t : ℕ, 3 ≤ t → ∀ (x : ℤ → ℕ → Bool),
      (∀ p, cycle_power_dyadic_class_weight (t+1) (x p) =
        (Finset.range (2^(t+1))).sum (fun a => (x p a).toNat)) →
      (∀ i < t+1, ∀ v : ℤ, (Finset.range (2^i)).sum (fun a =>
        (x (v-(a : ℤ)) a && x (v-(a : ℤ)) (a+2^(t+1)-2^i)).toNat) = 1) →
      (∀ d : ℕ, 1 ≤ d → d < 2^(t+1) → ∀ v : ℤ,
        ∃ a : ℕ, a < 2^(t+1)-d ∧ x (v-(a : ℤ)) a = true ∧
          x (v-(a : ℤ)) (a+d) = true) →
      (∀ v : ℤ, (Finset.range (2^(t+1))).sum (fun a =>
        (x (v-(a : ℤ)) a).toNat) = (t+1)+1) →
      ∀ p0 : ℤ,
      (∀ r : ℤ, p0 - 3*2^t ≤ r → r ≤ p0 →
        ((p0 - r) % 2 = 0 → x r 1 = true ∧ ∀ i < 2^t, x r (2*i) = x r (2*i+1)) ∧
        ((p0 - r) % 2 = 1 → ∀ a, 0 < a → a < 2^(t+1) - 1 → x r a = false)) →
      (∀ a, 0 < a → a < 2^(t+1) - 1 → x (p0+1) a = false) ∧
      (x (p0+2) 1 = true ∧ ∀ i < 2^t, x (p0+2) (2*i) = x (p0+2) (2*i+1)))
    (hCTl : ∀ t : ℕ, 3 ≤ t → ∀ (x : ℤ → ℕ → Bool),
      (∀ p, cycle_power_dyadic_class_weight (t+1) (x p) =
        (Finset.range (2^(t+1))).sum (fun a => (x p a).toNat)) →
      (∀ i < t+1, ∀ v : ℤ, (Finset.range (2^i)).sum (fun a =>
        (x (v-(a : ℤ)) a && x (v-(a : ℤ)) (a+2^(t+1)-2^i)).toNat) = 1) →
      (∀ d : ℕ, 1 ≤ d → d < 2^(t+1) → ∀ v : ℤ,
        ∃ a : ℕ, a < 2^(t+1)-d ∧ x (v-(a : ℤ)) a = true ∧
          x (v-(a : ℤ)) (a+d) = true) →
      (∀ v : ℤ, (Finset.range (2^(t+1))).sum (fun a =>
        (x (v-(a : ℤ)) a).toNat) = (t+1)+1) →
      ∀ p0 : ℤ,
      (∀ r : ℤ, p0 ≤ r → r ≤ p0 + 3*2^t →
        ((r - p0) % 2 = 0 → x r 1 = true ∧ ∀ i < 2^t, x r (2*i) = x r (2*i+1)) ∧
        ((r - p0) % 2 = 1 → ∀ a, 0 < a → a < 2^(t+1) - 1 → x r a = false)) →
      (∀ a, 0 < a → a < 2^(t+1) - 1 → x (p0-1) a = false) ∧
      (x (p0-2) 1 = true ∧ ∀ i < 2^t, x (p0-2) (2*i) = x (p0-2) (2*i+1)))
    (j : ℕ) (hj : 1 ≤ j) (x : ℤ → ℕ → Bool)
    (htight : ∀ p, cycle_power_dyadic_class_weight (j+3) (x p) =
      (Finset.range (2^(j+3))).sum (fun a => (x p a).toNat))
    (hexact : ∀ i < j+3, ∀ v : ℤ, (Finset.range (2^i)).sum (fun a =>
      (x (v-(a : ℤ)) a && x (v-(a : ℤ)) (a+2^(j+3)-2^i)).toNat) = 1)
    (hcover : ∀ d : ℕ, 1 ≤ d → d < 2^(j+3) → ∀ v : ℤ,
      ∃ a : ℕ, a < 2^(j+3)-d ∧ x (v-(a : ℤ)) a = true ∧
        x (v-(a : ℤ)) (a+d) = true)
    (hcount : ∀ v : ℤ, (Finset.range (2^(j+3))).sum (fun a =>
      (x (v-(a : ℤ)) a).toNat) = (j+3)+1) :
    ∀ p : ℤ, ¬ ∀ b < 2^(j+3), x p b =
      (decide (b < 2^j) || (decide (3*2^j ≤ b) && decide (b < 5*2^j)) || decide (7*2^j ≤ b))
Source
Helper step for the main statement of OP-205 (arXiv:2610.15635, the case k+1 = 2^m, n even, (k+1) not dividing n, left open there); it concerns the integer Boolean class models that optimal (m+1)-layer covers give. Reduces the stated cycle_power_dyadic_optimal_count_no_middle_island (j ≥ 1) to cycle_power_dyadic_middle_island_regular_neighbourhood and the two continuation statements, which are not proved here.
Verified
26 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 3
Used by 1

The proof, explained

The proof proceeds by induction on j ≥ 1. The base case j = 1 is discharged by a known lemma for small exponents. In the inductive step, assuming an island class exists at root p at exponent j+4, the local regularity hypothesis (hIR) forces an initial window of 28·2^j roots around p to alternate between two regular class types. The continuation hypotheses (hCTr and hCTl) propagate this alternating regular structure across all of ℤ. Finally, subsampling even roots and even offsets yields a valid class model at exponent j+3 that still contains an island class at root 0, contradicting the induction hypothesis.

  1. The island exclusion holds for the base case j = 1.

    We proceed by induction on j ≥ 1 using `Nat.le_induction`, generalizing over the class assignment x. For the base case j = 1, the island exclusion at exponent 1+3 = 4 is closed directly by the known base result `cycle_power_dyadic_optimal_count_no_middle_island_small`.

    lines 59–62

    uses Nat.le_induction, cycle_power_dyadic_optimal_count_no_middle_island_small, le_rfl

      induction j, hj using Nat.le_induction generalizing x with
      | base =>
        exact cycle_power_dyadic_optimal_count_no_middle_island_small 1 le_rfl (by norm_num) x
          htight hexact hcover hcount
  2. For the inductive step from j to j+1, assuming an island exists at root p, powers of two are expressed in terms of the scale unit G = 2^j.

    In the inductive step, assume for contradiction that there exists an island class rooted at p at exponent (j+1)+3 = j+4. Setting G = 2^j, the relevant powers of two rewrite as 2^(j+1) = 2G, 2^(j+3) = 8G, and 2^(j+4) = 16G, using `pow_succ`. At this scale, the island at root p spans [0, 2G) ∪ [6G, 10G) ∪ [14G, 16G).

    lines 63–73

    uses pow_succ

      | succ j hj ih =>
        intro p hI
        obtain ⟨G, hG⟩ : ∃ G : ℕ, G = 2^j := ⟨_, rfl⟩
        have hGpos : 0 < G := by rw [hG]; positivity
        have e1 : (2:ℕ)^(j+1) = 2*G := by rw [hG, pow_succ]; ring
        have e3 : (2:ℕ)^(j+3) = 8*G := by rw [hG, pow_succ, pow_succ, pow_succ]; ring
        have e4 : (2:ℕ)^(j+1+3) = 16*G := by rw [hG, pow_succ, pow_succ, pow_succ, pow_succ]; ring
        have e4' : (2:ℕ)^(j+3+1) = 16*G := e4
        have e1z : ((2:ℤ))^(j+1) = 2*(G:ℤ) := by exact_mod_cast e1
        have e3z : ((2:ℤ))^(j+3) = 8*(G:ℤ) := by exact_mod_cast e3
        have hGz : (0:ℤ) < (G:ℤ) := by exact_mod_cast hGpos
  3. Within distance 14G of p, classes alternate between regular of the first kind (at even distance) and regular of the second kind (at odd distance).

    Applying hypothesis `hIR` at exponent parameter j+1, the existence of an island at root p forces all roots r within distance 7 · 2^(j+1) = 14G of p to be regular: classes at even distance r - p are regular of the first kind (containing offset 1 with paired offsets), while classes at odd distance r - p are regular of the second kind (having all interior offsets empty).

    lines 74–80

        have hreg0 := hIR (j+1) (by omega) x htight hexact hcover p hI
        -- regular structure, stated with G
        have hR0 : ∀ r : ℤ, p - 14*(G:ℤ) ≤ r → r ≤ p + 14*(G:ℤ) →
            ((r - p) % 2 = 0 → x r 1 = true ∧ ∀ i < 2^(j+3), x r (2*i) = x r (2*i+1)) ∧
            ((r - p) % 2 = 1 → ∀ a, 0 < a → a < 2^(j+1+3) - 1 → x r a = false) := by
          intro r h1 h2
          exact hreg0 r (by rw [e1z]; omega) (by rw [e1z]; omega)
  4. The alternating regular pattern extends infinitely far to the right of p.

    By induction on n, we extend alternating regularity to the interval [p - 14G, p + 14G + 2n]. In the inductive step, the window of 3 · 2^(j+3) = 24G consecutive roots ending at p0 = p + 14G + 2n is entirely contained within the already verified region, because (p + 14G) - 24G = p - 10G ≥ p - 14G. The right continuation hypothesis `hCTr` therefore applies at p0 and extends the regular alternating pattern to p0 + 1 and p0 + 2.

    lines 81–99

        have hright : ∀ n : ℕ, ∀ r : ℤ, p - 14*(G:ℤ) ≤ r → r ≤ p + 14*(G:ℤ) + 2*(n:ℤ) →
            ((r - p) % 2 = 0 → x r 1 = true ∧ ∀ i < 2^(j+3), x r (2*i) = x r (2*i+1)) ∧
            ((r - p) % 2 = 1 → ∀ a, 0 < a → a < 2^(j+1+3) - 1 → x r a = false) := by
          intro n
          induction n with
          | zero => intro r h1 h2; exact hR0 r h1 (by simpa using h2)
          | succ n ihn =>
            intro r h1 h2
            by_cases hle : r ≤ p + 14*(G:ℤ) + 2*(n:ℤ)
            · exact ihn r h1 hle
            · have hstep := hCTr (j+3) (by omega) x htight hexact hcover hcount (p + 14*(G:ℤ) + 2*(n:ℤ))
                (by
                  intro r' hr1 hr2
                  have hw := ihn r' (by rw [e3z] at hr1; omega) hr2
                  refine ⟨fun hpar => hw.1 (by omega), fun hpar => hw.2 (by omega)⟩)
              push_cast at h2
              rcases (show r = p + 14*(G:ℤ) + 2*(n:ℤ) + 1 ∨ r = p + 14*(G:ℤ) + 2*(n:ℤ) + 2 by omega) with rfl | rfl
              · exact ⟨fun hpar => by omega, fun _ => hstep.1⟩
              · exact ⟨fun _ => hstep.2, fun hpar => by omega⟩
  5. The alternating regular pattern extends infinitely far to the left of p.

    Similarly, by induction on n, we extend alternating regularity to [p - 14G - 2n, p + 14G]. The window of 3 · 2^(j+3) = 24G consecutive roots starting at p0 = p - 14G - 2n lies within the already established regular region, so the left continuation hypothesis `hCTl` applies at p0 and extends the regular alternating pattern to p0 - 1 and p0 - 2.

    lines 100–118

        have hleft : ∀ n : ℕ, ∀ r : ℤ, p - 14*(G:ℤ) - 2*(n:ℤ) ≤ r → r ≤ p + 14*(G:ℤ) →
            ((r - p) % 2 = 0 → x r 1 = true ∧ ∀ i < 2^(j+3), x r (2*i) = x r (2*i+1)) ∧
            ((r - p) % 2 = 1 → ∀ a, 0 < a → a < 2^(j+1+3) - 1 → x r a = false) := by
          intro n
          induction n with
          | zero => intro r h1 h2; exact hR0 r (by simpa using h1) h2
          | succ n ihn =>
            intro r h1 h2
            by_cases hle : p - 14*(G:ℤ) - 2*(n:ℤ) ≤ r
            · exact ihn r hle h2
            · have hstep := hCTl (j+3) (by omega) x htight hexact hcover hcount (p - 14*(G:ℤ) - 2*(n:ℤ))
                (by
                  intro r' hr1 hr2
                  have hw := ihn r' hr1 (by rw [e3z] at hr2; omega)
                  refine ⟨fun hpar => hw.1 (by omega), fun hpar => hw.2 (by omega)⟩)
              push_cast at h1
              rcases (show r = p - 14*(G:ℤ) - 2*(n:ℤ) - 1 ∨ r = p - 14*(G:ℤ) - 2*(n:ℤ) - 2 by omega) with rfl | rfl
              · exact ⟨fun hpar => by omega, fun _ => hstep.1⟩
              · exact ⟨fun _ => hstep.2, fun hpar => by omega⟩
  6. Every class in the entire model across all of ℤ is regular, alternating between the first and second kinds according to (r - p) % 2.

    Combining the left and right continuation results, any root r ∈ ℤ lies in the regular region by taking n sufficiently large (either (p - r).toNat or (r - p).toNat, analyzed via `le_total`, `Int.toNat_of_nonneg`, and `Int.toNat_of_nonpos`). Hence every class in the model is regular of the first kind if r - p is even and regular of the second kind if r - p is odd.

    lines 119–130

    uses le_total, Int.toNat_of_nonneg, Int.toNat_of_nonpos

        have hall : ∀ r : ℤ,
            ((r - p) % 2 = 0 → x r 1 = true ∧ ∀ i < 2^(j+3), x r (2*i) = x r (2*i+1)) ∧
            ((r - p) % 2 = 1 → ∀ a, 0 < a → a < 2^(j+1+3) - 1 → x r a = false) := by
          intro r
          rcases le_total r (p + 14*(G:ℤ)) with h | h
          · refine hleft (p - r).toNat r ?_ h
            have := Int.toNat_of_nonneg (show (0:ℤ) ≤ (p - r).toNat by positivity)
            rcases le_total 0 (p - r) with h0 | h0
            · rw [Int.toNat_of_nonneg h0]; omega
            · rw [Int.toNat_of_nonpos h0]; omega
          · refine hright (r - p).toNat r (by omega) ?_
            rw [Int.toNat_of_nonneg (by omega)]; omega
  7. The model satisfies strict parity alternation at offset 1 and the endpoint condition required for halving.

    From global alternating regularity, we deduce using `Int.emod_two_eq_zero_or_one` that the value at offset 1 strictly alternates from each root to the next (x(q+1, 1) = ¬x(q, 1)), that any class with x(q, 1) = false is empty on all interior offsets, and that x(p, 1) = true.

    lines 131–142

    uses Int.emod_two_eq_zero_or_one

        have hone : (1:ℕ) < 2^(j+1+3) - 1 := by rw [e4]; omega
        have halt : ∀ q : ℤ, x (q+1) 1 = !x q 1 := by
          intro q
          rcases Int.emod_two_eq_zero_or_one (q - p) with h | h
          · rw [((hall q).1 h).1, (hall (q+1)).2 (by omega) 1 (by norm_num) hone]; rfl
          · rw [(hall q).2 h 1 (by norm_num) hone, ((hall (q+1)).1 (by omega)).1]; rfl
        have hend : ∀ q : ℤ, x q 1 = false → ∀ a, 0 < a → a < 2^(j+3+1) - 1 → x q a = false := by
          intro q hq a ha1 ha2
          rcases Int.emod_two_eq_zero_or_one (q - p) with h | h
          · rw [((hall q).1 h).1] at hq; exact absurd hq (by decide)
          · exact (hall q).2 h a ha1 ha2
        have hs : x p 1 = true := ((hall p).1 (by simp)).1
  8. Subsampling even roots and even offsets produces a valid Boolean class model at exponent j+3.

    We invoke `cycle_power_dyadic_alternating_half_model` at parameter m = j+3 with base root p and offset shift 0. The lemma establishes that the subsampled model y(q, b) = x(2q+p, 2b) inherits all model axioms (tightness, exact dyadic coverage, full covering, and optimal count) at exponent j+3.

    lines 143–144

    uses cycle_power_dyadic_alternating_half_model

        obtain ⟨yt, yex, ycv, ycn⟩ := cycle_power_dyadic_alternating_half_model (j+3) (by omega) x
          htight hexact hcover hcount halt hend p hs 0 (by norm_num)
  9. The halved model contains an island at root 0, contradicting the induction hypothesis.

    We evaluate the halved model at root 0 (which corresponds to root p in x). Subsampling the island condition at p on even offsets 2b divides all intervals by 2: [0, 2G) becomes [0, G), [6G, 10G) becomes [3G, 5G), and [14G, 16G) becomes [7G, 8G). Since G = 2^j, this matches the exact definition of an island at exponent j+3, which directly contradicts the induction hypothesis `ih`.

    lines 145–152

    uses Nat.add_zero, Bool.eq_iff_iff, Bool.or_eq_true, Bool.and_eq_true, decide_eq_true_eq

        refine ih (fun q b => x (2*q+p) (2*b+0)) yt yex ycv ycn 0 ?_
        intro b hb
        show x (2*0+p) (2*b+0) = _
        rw [show (2*0+p : ℤ) = p by ring, Nat.add_zero, hI (2*b) (by rw [e4]; rw [e3] at hb; omega)]
        rw [e1, ← hG]
        rw [Bool.eq_iff_iff]
        simp only [Bool.or_eq_true, Bool.and_eq_true, decide_eq_true_eq]
        omega
Nat.le_induction
Induction principle for natural numbers starting from a lower bound: if P(m) holds and P(n) implies P(n+1) for all n ≥ m, then P(n) holds for all n ≥ m.
cycle_power_dyadic_optimal_count_no_middle_island_small
Base case theorem establishing that no class is the middle island for small exponents j+3 with 1 ≤ j ≤ 2.
le_rfl
Reflexivity of inequality: a ≤ a for any element in a preorder.
pow_succ
Successor power rule in a monoid: a^(n+1) = a^n * a.
le_total
Totality of a linear order: for any a and b, either a ≤ b or b ≤ a.
Int.toNat_of_nonneg
Non-negative integer conversion: if 0 ≤ a, then (a.toNat : ℤ) = a.
Int.toNat_of_nonpos
Non-positive integer conversion: if z ≤ 0, then z.toNat = 0.
Int.emod_two_eq_zero_or_one
Parity division: for any integer n, n % 2 is either 0 or 1.
cycle_power_dyadic_alternating_half_model
Halving theorem: subsampling even roots and even offsets of an alternating regular model yields a valid dyadic model at the next lower exponent satisfying tightness, exact dyadic coverage, full covering, and optimal count.
Nat.add_zero
Additive identity: n + 0 = n for any natural number n.
Bool.eq_iff_iff
Boolean equality reflection: two Booleans a, b are equal if and only if (a = true ↔ b = true).
Bool.or_eq_true
Boolean disjunction: (a || b) = true if and only if a = true ∨ b = true.
Bool.and_eq_true
Boolean conjunction: (a && b) = true if and only if a = true ∧ b = true.
decide_eq_true_eq
Decidability reflection: decide p = true if and only if the proposition p holds.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

theorem cycle_power_dyadic_optimal_count_no_middle_island_of_regular_continuation    (hIR : ∀ j : ℕ, 1 ≤ j → ∀ (x : ℤ → ℕ → Bool),      (∀ p, cycle_power_dyadic_class_weight (j+3) (x p) =        (Finset.range (2^(j+3))).sum (fun a => (x p a).toNat)) →      (∀ i < j+3, ∀ v : ℤ, (Finset.range (2^i)).sum (fun a =>        (x (v-(a : ℤ)) a && x (v-(a : ℤ)) (a+2^(j+3)-2^i)).toNat) = 1) →      (∀ d : ℕ, 1 ≤ d → d < 2^(j+3) → ∀ v : ℤ,        ∃ a : ℕ, a < 2^(j+3)-d ∧ x (v-(a : ℤ)) a = true ∧          x (v-(a : ℤ)) (a+d) = true) →      ∀ p : ℤ, (∀ b < 2^(j+3), x p b =        (decide (b < 2^j) || (decide (3*2^j ≤ b) && decide (b < 5*2^j)) || decide (7*2^j ≤ b))) →      ∀ r : ℤ, p - 7*2^j ≤ r → r ≤ p + 7*2^j →        ((r - p) % 2 = 0 → x r 1 = true ∧ ∀ i < 2^(j+2), x r (2*i) = x r (2*i+1)) ∧        ((r - p) % 2 = 1 → ∀ a, 0 < a → a < 2^(j+3) - 1 → x r a = false))    (hCTr : ∀ t : ℕ, 3 ≤ t → ∀ (x : ℤ → ℕ → Bool),      (∀ p, cycle_power_dyadic_class_weight (t+1) (x p) =        (Finset.range (2^(t+1))).sum (fun a => (x p a).toNat)) →      (∀ i < t+1, ∀ v : ℤ, (Finset.range (2^i)).sum (fun a =>        (x (v-(a : ℤ)) a && x (v-(a : ℤ)) (a+2^(t+1)-2^i)).toNat) = 1) →      (∀ d : ℕ, 1 ≤ d → d < 2^(t+1) → ∀ v : ℤ,        ∃ a : ℕ, a < 2^(t+1)-d ∧ x (v-(a : ℤ)) a = true ∧          x (v-(a : ℤ)) (a+d) = true) →      (∀ v : ℤ, (Finset.range (2^(t+1))).sum (fun a =>        (x (v-(a : ℤ)) a).toNat) = (t+1)+1) →      ∀ p0 : ℤ,      (∀ r : ℤ, p0 - 3*2^t ≤ r → r ≤ p0 →        ((p0 - r) % 2 = 0 → x r 1 = true ∧ ∀ i < 2^t, x r (2*i) = x r (2*i+1)) ∧        ((p0 - r) % 2 = 1 → ∀ a, 0 < a → a < 2^(t+1) - 1 → x r a = false)) →      (∀ a, 0 < a → a < 2^(t+1) - 1 → x (p0+1) a = false) ∧      (x (p0+2) 1 = true ∧ ∀ i < 2^t, x (p0+2) (2*i) = x (p0+2) (2*i+1)))    (hCTl : ∀ t : ℕ, 3 ≤ t → ∀ (x : ℤ → ℕ → Bool),      (∀ p, cycle_power_dyadic_class_weight (t+1) (x p) =        (Finset.range (2^(t+1))).sum (fun a => (x p a).toNat)) →      (∀ i < t+1, ∀ v : ℤ, (Finset.range (2^i)).sum (fun a =>        (x (v-(a : ℤ)) a && x (v-(a : ℤ)) (a+2^(t+1)-2^i)).toNat) = 1) →      (∀ d : ℕ, 1 ≤ d → d < 2^(t+1) → ∀ v : ℤ,        ∃ a : ℕ, a < 2^(t+1)-d ∧ x (v-(a : ℤ)) a = true ∧          x (v-(a : ℤ)) (a+d) = true) →      (∀ v : ℤ, (Finset.range (2^(t+1))).sum (fun a =>        (x (v-(a : ℤ)) a).toNat) = (t+1)+1) →      ∀ p0 : ℤ,      (∀ r : ℤ, p0 ≤ r → r ≤ p0 + 3*2^t →        ((r - p0) % 2 = 0 → x r 1 = true ∧ ∀ i < 2^t, x r (2*i) = x r (2*i+1)) ∧        ((r - p0) % 2 = 1 → ∀ a, 0 < a → a < 2^(t+1) - 1 → x r a = false)) →      (∀ a, 0 < a → a < 2^(t+1) - 1 → x (p0-1) a = false) ∧      (x (p0-2) 1 = true ∧ ∀ i < 2^t, x (p0-2) (2*i) = x (p0-2) (2*i+1)))    (j : ℕ) (hj : 1 ≤ j) (x : ℤ → ℕ → Bool)    (htight : ∀ p, cycle_power_dyadic_class_weight (j+3) (x p) =      (Finset.range (2^(j+3))).sum (fun a => (x p a).toNat))    (hexact : ∀ i < j+3, ∀ v : ℤ, (Finset.range (2^i)).sum (fun a =>      (x (v-(a : ℤ)) a && x (v-(a : ℤ)) (a+2^(j+3)-2^i)).toNat) = 1)    (hcover : ∀ d : ℕ, 1 ≤ d → d < 2^(j+3) → ∀ v : ℤ,      ∃ a : ℕ, a < 2^(j+3)-d ∧ x (v-(a : ℤ)) a = true ∧        x (v-(a : ℤ)) (a+d) = true)    (hcount : ∀ v : ℤ, (Finset.range (2^(j+3))).sum (fun a =>      (x (v-(a : ℤ)) a).toNat) = (j+3)+1) :    ∀ p : ℤ, ¬ ∀ b < 2^(j+3), x p b =      (decide (b < 2^j) || (decide (3*2^j ≤ b) && decide (b < 5*2^j)) || decide (7*2^j ≤ b)) := by  induction j, hj using Nat.le_induction generalizing x with  | base =>    exact cycle_power_dyadic_optimal_count_no_middle_island_small 1 le_rfl (by norm_num) x      htight hexact hcover hcount  | succ j hj ih =>    intro p hI    obtain ⟨G, hG⟩ : ∃ G : ℕ, G = 2^j := ⟨_, rfl⟩    have hGpos : 0 < G := by rw [hG]; positivity    have e1 : (2:ℕ)^(j+1) = 2*G := by rw [hG, pow_succ]; ring    have e3 : (2:ℕ)^(j+3) = 8*G := by rw [hG, pow_succ, pow_succ, pow_succ]; ring    have e4 : (2:ℕ)^(j+1+3) = 16*G := by rw [hG, pow_succ, pow_succ, pow_succ, pow_succ]; ring    have e4' : (2:ℕ)^(j+3+1) = 16*G := e4    have e1z : ((2:ℤ))^(j+1) = 2*(G:ℤ) := by exact_mod_cast e1    have e3z : ((2:ℤ))^(j+3) = 8*(G:ℤ) := by exact_mod_cast e3    have hGz : (0:ℤ) < (G:ℤ) := by exact_mod_cast hGpos    have hreg0 := hIR (j+1) (by omega) x htight hexact hcover p hI    -- regular structure, stated with G    have hR0 : ∀ r : ℤ, p - 14*(G:ℤ) ≤ r → r ≤ p + 14*(G:ℤ) →        ((r - p) % 2 = 0 → x r 1 = true ∧ ∀ i < 2^(j+3), x r (2*i) = x r (2*i+1)) ∧        ((r - p) % 2 = 1 → ∀ a, 0 < a → a < 2^(j+1+3) - 1 → x r a = false) := by      intro r h1 h2      exact hreg0 r (by rw [e1z]; omega) (by rw [e1z]; omega)    have hright : ∀ n : ℕ, ∀ r : ℤ, p - 14*(G:ℤ) ≤ r → r ≤ p + 14*(G:ℤ) + 2*(n:ℤ) →        ((r - p) % 2 = 0 → x r 1 = true ∧ ∀ i < 2^(j+3), x r (2*i) = x r (2*i+1)) ∧        ((r - p) % 2 = 1 → ∀ a, 0 < a → a < 2^(j+1+3) - 1 → x r a = false) := by      intro n      induction n with      | zero => intro r h1 h2; exact hR0 r h1 (by simpa using h2)      | succ n ihn =>        intro r h1 h2        by_cases hle : r ≤ p + 14*(G:ℤ) + 2*(n:ℤ)        · exact ihn r h1 hle        · have hstep := hCTr (j+3) (by omega) x htight hexact hcover hcount (p + 14*(G:ℤ) + 2*(n:ℤ))            (by              intro r' hr1 hr2              have hw := ihn r' (by rw [e3z] at hr1; omega) hr2              refine ⟨fun hpar => hw.1 (by omega), fun hpar => hw.2 (by omega)⟩)          push_cast at h2          rcases (show r = p + 14*(G:ℤ) + 2*(n:ℤ) + 1 ∨ r = p + 14*(G:ℤ) + 2*(n:ℤ) + 2 by omega) with rfl | rfl          · exact ⟨fun hpar => by omega, fun _ => hstep.1⟩          · exact ⟨fun _ => hstep.2, fun hpar => by omega⟩    have hleft : ∀ n : ℕ, ∀ r : ℤ, p - 14*(G:ℤ) - 2*(n:ℤ) ≤ r → r ≤ p + 14*(G:ℤ) →        ((r - p) % 2 = 0 → x r 1 = true ∧ ∀ i < 2^(j+3), x r (2*i) = x r (2*i+1)) ∧        ((r - p) % 2 = 1 → ∀ a, 0 < a → a < 2^(j+1+3) - 1 → x r a = false) := by      intro n      induction n with      | zero => intro r h1 h2; exact hR0 r (by simpa using h1) h2      | succ n ihn =>        intro r h1 h2        by_cases hle : p - 14*(G:ℤ) - 2*(n:ℤ) ≤ r        · exact ihn r hle h2        · have hstep := hCTl (j+3) (by omega) x htight hexact hcover hcount (p - 14*(G:ℤ) - 2*(n:ℤ))            (by              intro r' hr1 hr2              have hw := ihn r' hr1 (by rw [e3z] at hr2; omega)              refine ⟨fun hpar => hw.1 (by omega), fun hpar => hw.2 (by omega)⟩)          push_cast at h1          rcases (show r = p - 14*(G:ℤ) - 2*(n:ℤ) - 1 ∨ r = p - 14*(G:ℤ) - 2*(n:ℤ) - 2 by omega) with rfl | rfl          · exact ⟨fun hpar => by omega, fun _ => hstep.1⟩          · exact ⟨fun _ => hstep.2, fun hpar => by omega⟩    have hall : ∀ r : ℤ,        ((r - p) % 2 = 0 → x r 1 = true ∧ ∀ i < 2^(j+3), x r (2*i) = x r (2*i+1)) ∧        ((r - p) % 2 = 1 → ∀ a, 0 < a → a < 2^(j+1+3) - 1 → x r a = false) := by      intro r      rcases le_total r (p + 14*(G:ℤ)) with h | h      · refine hleft (p - r).toNat r ?_ h        have := Int.toNat_of_nonneg (show (0:ℤ) ≤ (p - r).toNat by positivity)        rcases le_total 0 (p - r) with h0 | h0        · rw [Int.toNat_of_nonneg h0]; omega        · rw [Int.toNat_of_nonpos h0]; omega      · refine hright (r - p).toNat r (by omega) ?_        rw [Int.toNat_of_nonneg (by omega)]; omega    have hone : (1:ℕ) < 2^(j+1+3) - 1 := by rw [e4]; omega    have halt : ∀ q : ℤ, x (q+1) 1 = !x q 1 := by      intro q      rcases Int.emod_two_eq_zero_or_one (q - p) with h | h      · rw [((hall q).1 h).1, (hall (q+1)).2 (by omega) 1 (by norm_num) hone]; rfl      · rw [(hall q).2 h 1 (by norm_num) hone, ((hall (q+1)).1 (by omega)).1]; rfl    have hend : ∀ q : ℤ, x q 1 = false → ∀ a, 0 < a → a < 2^(j+3+1) - 1 → x q a = false := by      intro q hq a ha1 ha2      rcases Int.emod_two_eq_zero_or_one (q - p) with h | h      · rw [((hall q).1 h).1] at hq; exact absurd hq (by decide)      · exact (hall q).2 h a ha1 ha2    have hs : x p 1 = true := ((hall p).1 (by simp)).1    obtain ⟨yt, yex, ycv, ycn⟩ := cycle_power_dyadic_alternating_half_model (j+3) (by omega) x      htight hexact hcover hcount halt hend p hs 0 (by norm_num)    refine ih (fun q b => x (2*q+p) (2*b+0)) yt yex ycv ycn 0 ?_    intro b hb    show x (2*0+p) (2*b+0) = _    rw [show (2*0+p : ℤ) = p by ring, Nat.add_zero, hI (2*b) (by rw [e4]; rw [e3] at hb; omega)]    rw [e1, ← hG]    rw [Bool.eq_iff_iff]    simp only [Bool.or_eq_true, Bool.and_eq_true, decide_eq_true_eq]    omega
See it in the graphDiscuss this resultChallenge it