AFTD Auto-Formalizing Theoretical Domains

cycle_power_dyadic_domain_wall_cover_sum

theoremverified

Every ordinary positive distance below eight has an owning root in the explicit model, expressed by a positive Boolean pair-count sum.

Statement

theorem cycle_power_dyadic_domain_wall_cover_sum
    (d : ℕ) (hd : 1 ≤ d) (hd8 : d < 8) (v : ℤ) :
    1 ≤ (range (8-d)).sum (fun a =>
      (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&
        cycle_power_dyadic_domain_wall (v-(a : ℤ)) (a+d)).toNat)
Source
OP-205 / RT-1 structural-hypothesis audit following arXiv:2610.15635. A compact five-exception version of the previously computed nonperiodic domain wall6554 was independently audited in experiment7315. This formal countermodel addresses a stronger auxiliary statement without counts or periodicity; it is not a graph cover, a periodic model, an OP-205 refutation, or a research advance.
Verified
28 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 3
Used by 1

The proof, explained

The theorem proves that for every distance 1 ≤ d < 8 and every integer shift v, the sum of bit-pair products over a ∈ {0, ..., 7 - d} for the dyadic domain wall function is at least 1. The proof proceeds by exhaustive case analysis on d ∈ {1, ..., 7}. For each d, the shift v is split into three regimes: v ≤ -4 and v ≥ 11, where the domain wall stabilizes to periodic behavior mod 2 and mod 4 respectively (reducing the check to 4 cases of v mod 4), and the intermediate interval -3 ≤ v ≤ 10, which consists of 14 concrete integers. All finite cases are discharged by computational evaluation using decide.

  1. It suffices to prove the inequality for each distance d ∈ {1, 2, 3, 4, 5, 6, 7}.

    The hypotheses 1 ≤ d and d < 8 restrict the natural number d to the seven values from 1 to 7. The interval_cases tactic reduces the universal goal over d to seven separate cases.

    line 10

      interval_cases d
  2. The sum is at least 1 when the distance is d = 1.

    For d = 1, the sum runs over a ∈ {0, ..., 6}, pairing bit a with bit a + 1. The proof splits the integer shift v into three regimes: 1. When v ≤ -4, every term v - a satisfies v - a ≤ -4. By cycle_power_dyadic_domain_wall_left, the domain wall values simplify to parity tests mod 2 on v - a. Rewriting via sum_congr and lt_of_lt_of_le, the sum depends only on r = v % 4 ∈ {0, 1, 2, 3}. All four cases for r are verified by decide. 2. When v ≥ 11, every term v - a satisfies v - a ≥ 4. By cycle_power_dyadic_domain_wall_right, the values simplify to periodic tests mod 4. Rewriting via sum_congr, the four cases for r = v % 4 are verified by decide. 3. When -3 ≤ v ≤ 10, linear arithmetic (omega) bounds v to 14 integers, each of which is evaluated and checked directly by decide.

    lines 11–57

    uses cycle_power_dyadic_domain_wall_left, cycle_power_dyadic_domain_wall_right, sum_congr, lt_of_lt_of_le

      · by_cases hL : v ≤ -4
        · generalize hr : v % 4 = r
          have hr0 : 0 ≤ r := by omega
          have hr4 : r < 4 := by omega
          let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 2 = 0 then 129 else 243 : ℕ).testBit b
          have hx (a : ℕ) (ha : a < 8) (b : ℕ) :
              cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by
            rw [cycle_power_dyadic_domain_wall_left (v-(a : ℤ)) (by omega) b]
            have he : (v-(a : ℤ)) % 2 = (r-(a : ℤ)) % 2 := by omega
            rw [he]
          have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :
              (range N).sum (fun a =>
                (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&
                  cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =
                (range N).sum (fun a => (f a a && f a (g a)).toNat) := by
            apply sum_congr rfl
            intro a ha
            have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN
            rw [hx a ha8 a, hx a ha8 (g a)]
          rw [heq (8-1) (by norm_num) (fun a => a+1)]
          dsimp only [f]
          interval_cases r <;> decide
        · by_cases hR : 11 ≤ v
          · generalize hr : v % 4 = r
            have hr0 : 0 ≤ r := by omega
            have hr4 : r < 4 := by omega
            let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 4 = 1 then 195 else if (r-(a : ℤ)) % 4 = 3 then 255 else 129 : ℕ).testBit b
            have hx (a : ℕ) (ha : a < 8) (b : ℕ) :
                cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by
              rw [cycle_power_dyadic_domain_wall_right (v-(a : ℤ)) (by omega) b]
              have he : (v-(a : ℤ)) % 4 = (r-(a : ℤ)) % 4 := by omega
              rw [he]
            have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :
                (range N).sum (fun a =>
                  (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&
                    cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =
                  (range N).sum (fun a => (f a a && f a (g a)).toNat) := by
              apply sum_congr rfl
              intro a ha
              have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN
              rw [hx a ha8 a, hx a ha8 (g a)]
            rw [heq (8-1) (by norm_num) (fun a => a+1)]
            dsimp only [f]
            interval_cases r <;> decide
          · have hlo : -3 ≤ v := by omega
            have hhi : v ≤ 10 := by omega
            interval_cases v <;> decide
  3. The sum is at least 1 when the distance is d = 2.

    For d = 2, the sum runs over a ∈ {0, ..., 5}, pairing bit a with bit a + 2. The argument follows the identical three regimes: the left regime v ≤ -4 is simplified via cycle_power_dyadic_domain_wall_left and sum_congr to four cases of r = v % 4, checked by decide; the right regime v ≥ 11 is simplified via cycle_power_dyadic_domain_wall_right and sum_congr to four cases of r, checked by decide; and the bounded range -3 ≤ v ≤ 10 is checked across all 14 points by decide.

    lines 58–104

    uses cycle_power_dyadic_domain_wall_left, cycle_power_dyadic_domain_wall_right, sum_congr, lt_of_lt_of_le

      · by_cases hL : v ≤ -4
        · generalize hr : v % 4 = r
          have hr0 : 0 ≤ r := by omega
          have hr4 : r < 4 := by omega
          let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 2 = 0 then 129 else 243 : ℕ).testBit b
          have hx (a : ℕ) (ha : a < 8) (b : ℕ) :
              cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by
            rw [cycle_power_dyadic_domain_wall_left (v-(a : ℤ)) (by omega) b]
            have he : (v-(a : ℤ)) % 2 = (r-(a : ℤ)) % 2 := by omega
            rw [he]
          have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :
              (range N).sum (fun a =>
                (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&
                  cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =
                (range N).sum (fun a => (f a a && f a (g a)).toNat) := by
            apply sum_congr rfl
            intro a ha
            have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN
            rw [hx a ha8 a, hx a ha8 (g a)]
          rw [heq (8-2) (by norm_num) (fun a => a+2)]
          dsimp only [f]
          interval_cases r <;> decide
        · by_cases hR : 11 ≤ v
          · generalize hr : v % 4 = r
            have hr0 : 0 ≤ r := by omega
            have hr4 : r < 4 := by omega
            let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 4 = 1 then 195 else if (r-(a : ℤ)) % 4 = 3 then 255 else 129 : ℕ).testBit b
            have hx (a : ℕ) (ha : a < 8) (b : ℕ) :
                cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by
              rw [cycle_power_dyadic_domain_wall_right (v-(a : ℤ)) (by omega) b]
              have he : (v-(a : ℤ)) % 4 = (r-(a : ℤ)) % 4 := by omega
              rw [he]
            have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :
                (range N).sum (fun a =>
                  (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&
                    cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =
                  (range N).sum (fun a => (f a a && f a (g a)).toNat) := by
              apply sum_congr rfl
              intro a ha
              have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN
              rw [hx a ha8 a, hx a ha8 (g a)]
            rw [heq (8-2) (by norm_num) (fun a => a+2)]
            dsimp only [f]
            interval_cases r <;> decide
          · have hlo : -3 ≤ v := by omega
            have hhi : v ≤ 10 := by omega
            interval_cases v <;> decide
  4. The sum is at least 1 when the distance is d = 3.

    For d = 3, the sum runs over a ∈ {0, ..., 4}, pairing bit a with bit a + 3. Following the same three-regime structure: v ≤ -4 simplifies via cycle_power_dyadic_domain_wall_left and sum_congr to four cases of r = v % 4, closed by decide; v ≥ 11 simplifies via cycle_power_dyadic_domain_wall_right to four cases of r, closed by decide; and the 14 integers in -3 ≤ v ≤ 10 are checked individually by decide.

    lines 105–151

    uses cycle_power_dyadic_domain_wall_left, cycle_power_dyadic_domain_wall_right, sum_congr, lt_of_lt_of_le

      · by_cases hL : v ≤ -4
        · generalize hr : v % 4 = r
          have hr0 : 0 ≤ r := by omega
          have hr4 : r < 4 := by omega
          let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 2 = 0 then 129 else 243 : ℕ).testBit b
          have hx (a : ℕ) (ha : a < 8) (b : ℕ) :
              cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by
            rw [cycle_power_dyadic_domain_wall_left (v-(a : ℤ)) (by omega) b]
            have he : (v-(a : ℤ)) % 2 = (r-(a : ℤ)) % 2 := by omega
            rw [he]
          have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :
              (range N).sum (fun a =>
                (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&
                  cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =
                (range N).sum (fun a => (f a a && f a (g a)).toNat) := by
            apply sum_congr rfl
            intro a ha
            have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN
            rw [hx a ha8 a, hx a ha8 (g a)]
          rw [heq (8-3) (by norm_num) (fun a => a+3)]
          dsimp only [f]
          interval_cases r <;> decide
        · by_cases hR : 11 ≤ v
          · generalize hr : v % 4 = r
            have hr0 : 0 ≤ r := by omega
            have hr4 : r < 4 := by omega
            let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 4 = 1 then 195 else if (r-(a : ℤ)) % 4 = 3 then 255 else 129 : ℕ).testBit b
            have hx (a : ℕ) (ha : a < 8) (b : ℕ) :
                cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by
              rw [cycle_power_dyadic_domain_wall_right (v-(a : ℤ)) (by omega) b]
              have he : (v-(a : ℤ)) % 4 = (r-(a : ℤ)) % 4 := by omega
              rw [he]
            have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :
                (range N).sum (fun a =>
                  (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&
                    cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =
                  (range N).sum (fun a => (f a a && f a (g a)).toNat) := by
              apply sum_congr rfl
              intro a ha
              have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN
              rw [hx a ha8 a, hx a ha8 (g a)]
            rw [heq (8-3) (by norm_num) (fun a => a+3)]
            dsimp only [f]
            interval_cases r <;> decide
          · have hlo : -3 ≤ v := by omega
            have hhi : v ≤ 10 := by omega
            interval_cases v <;> decide
  5. The sum is at least 1 when the distance is d = 4.

    For d = 4, the sum runs over a ∈ {0, ..., 3}, pairing bit a with bit a + 4. In the regime v ≤ -4, cycle_power_dyadic_domain_wall_left and sum_congr reduce the sum to four checks on r = v % 4 via decide; in v ≥ 11, cycle_power_dyadic_domain_wall_right and sum_congr reduce it to four checks on r via decide; and the 14 values in -3 ≤ v ≤ 10 are checked by decide.

    lines 152–198

    uses cycle_power_dyadic_domain_wall_left, cycle_power_dyadic_domain_wall_right, sum_congr, lt_of_lt_of_le

      · by_cases hL : v ≤ -4
        · generalize hr : v % 4 = r
          have hr0 : 0 ≤ r := by omega
          have hr4 : r < 4 := by omega
          let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 2 = 0 then 129 else 243 : ℕ).testBit b
          have hx (a : ℕ) (ha : a < 8) (b : ℕ) :
              cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by
            rw [cycle_power_dyadic_domain_wall_left (v-(a : ℤ)) (by omega) b]
            have he : (v-(a : ℤ)) % 2 = (r-(a : ℤ)) % 2 := by omega
            rw [he]
          have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :
              (range N).sum (fun a =>
                (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&
                  cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =
                (range N).sum (fun a => (f a a && f a (g a)).toNat) := by
            apply sum_congr rfl
            intro a ha
            have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN
            rw [hx a ha8 a, hx a ha8 (g a)]
          rw [heq (8-4) (by norm_num) (fun a => a+4)]
          dsimp only [f]
          interval_cases r <;> decide
        · by_cases hR : 11 ≤ v
          · generalize hr : v % 4 = r
            have hr0 : 0 ≤ r := by omega
            have hr4 : r < 4 := by omega
            let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 4 = 1 then 195 else if (r-(a : ℤ)) % 4 = 3 then 255 else 129 : ℕ).testBit b
            have hx (a : ℕ) (ha : a < 8) (b : ℕ) :
                cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by
              rw [cycle_power_dyadic_domain_wall_right (v-(a : ℤ)) (by omega) b]
              have he : (v-(a : ℤ)) % 4 = (r-(a : ℤ)) % 4 := by omega
              rw [he]
            have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :
                (range N).sum (fun a =>
                  (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&
                    cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =
                  (range N).sum (fun a => (f a a && f a (g a)).toNat) := by
              apply sum_congr rfl
              intro a ha
              have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN
              rw [hx a ha8 a, hx a ha8 (g a)]
            rw [heq (8-4) (by norm_num) (fun a => a+4)]
            dsimp only [f]
            interval_cases r <;> decide
          · have hlo : -3 ≤ v := by omega
            have hhi : v ≤ 10 := by omega
            interval_cases v <;> decide
  6. The sum is at least 1 when the distance is d = 5.

    For d = 5, the sum runs over a ∈ {0, 1, 2}, pairing bit a with bit a + 5. The cases are handled identically: v ≤ -4 reduces via cycle_power_dyadic_domain_wall_left to r = v % 4, checked by decide; v ≥ 11 reduces via cycle_power_dyadic_domain_wall_right to r = v % 4, checked by decide; and the 14 values in -3 ≤ v ≤ 10 are verified by decide.

    lines 199–245

    uses cycle_power_dyadic_domain_wall_left, cycle_power_dyadic_domain_wall_right, sum_congr, lt_of_lt_of_le

      · by_cases hL : v ≤ -4
        · generalize hr : v % 4 = r
          have hr0 : 0 ≤ r := by omega
          have hr4 : r < 4 := by omega
          let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 2 = 0 then 129 else 243 : ℕ).testBit b
          have hx (a : ℕ) (ha : a < 8) (b : ℕ) :
              cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by
            rw [cycle_power_dyadic_domain_wall_left (v-(a : ℤ)) (by omega) b]
            have he : (v-(a : ℤ)) % 2 = (r-(a : ℤ)) % 2 := by omega
            rw [he]
          have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :
              (range N).sum (fun a =>
                (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&
                  cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =
                (range N).sum (fun a => (f a a && f a (g a)).toNat) := by
            apply sum_congr rfl
            intro a ha
            have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN
            rw [hx a ha8 a, hx a ha8 (g a)]
          rw [heq (8-5) (by norm_num) (fun a => a+5)]
          dsimp only [f]
          interval_cases r <;> decide
        · by_cases hR : 11 ≤ v
          · generalize hr : v % 4 = r
            have hr0 : 0 ≤ r := by omega
            have hr4 : r < 4 := by omega
            let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 4 = 1 then 195 else if (r-(a : ℤ)) % 4 = 3 then 255 else 129 : ℕ).testBit b
            have hx (a : ℕ) (ha : a < 8) (b : ℕ) :
                cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by
              rw [cycle_power_dyadic_domain_wall_right (v-(a : ℤ)) (by omega) b]
              have he : (v-(a : ℤ)) % 4 = (r-(a : ℤ)) % 4 := by omega
              rw [he]
            have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :
                (range N).sum (fun a =>
                  (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&
                    cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =
                  (range N).sum (fun a => (f a a && f a (g a)).toNat) := by
              apply sum_congr rfl
              intro a ha
              have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN
              rw [hx a ha8 a, hx a ha8 (g a)]
            rw [heq (8-5) (by norm_num) (fun a => a+5)]
            dsimp only [f]
            interval_cases r <;> decide
          · have hlo : -3 ≤ v := by omega
            have hhi : v ≤ 10 := by omega
            interval_cases v <;> decide
  7. The sum is at least 1 when the distance is d = 6.

    For d = 6, the sum runs over a ∈ {0, 1}, pairing bit a with bit a + 6. The case v ≤ -4 is reduced via cycle_power_dyadic_domain_wall_left and sum_congr to r = v % 4 and closed by decide; v ≥ 11 is reduced via cycle_power_dyadic_domain_wall_right to r = v % 4 and closed by decide; and the 14 values in -3 ≤ v ≤ 10 are closed by decide.

    lines 246–292

    uses cycle_power_dyadic_domain_wall_left, cycle_power_dyadic_domain_wall_right, sum_congr, lt_of_lt_of_le

      · by_cases hL : v ≤ -4
        · generalize hr : v % 4 = r
          have hr0 : 0 ≤ r := by omega
          have hr4 : r < 4 := by omega
          let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 2 = 0 then 129 else 243 : ℕ).testBit b
          have hx (a : ℕ) (ha : a < 8) (b : ℕ) :
              cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by
            rw [cycle_power_dyadic_domain_wall_left (v-(a : ℤ)) (by omega) b]
            have he : (v-(a : ℤ)) % 2 = (r-(a : ℤ)) % 2 := by omega
            rw [he]
          have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :
              (range N).sum (fun a =>
                (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&
                  cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =
                (range N).sum (fun a => (f a a && f a (g a)).toNat) := by
            apply sum_congr rfl
            intro a ha
            have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN
            rw [hx a ha8 a, hx a ha8 (g a)]
          rw [heq (8-6) (by norm_num) (fun a => a+6)]
          dsimp only [f]
          interval_cases r <;> decide
        · by_cases hR : 11 ≤ v
          · generalize hr : v % 4 = r
            have hr0 : 0 ≤ r := by omega
            have hr4 : r < 4 := by omega
            let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 4 = 1 then 195 else if (r-(a : ℤ)) % 4 = 3 then 255 else 129 : ℕ).testBit b
            have hx (a : ℕ) (ha : a < 8) (b : ℕ) :
                cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by
              rw [cycle_power_dyadic_domain_wall_right (v-(a : ℤ)) (by omega) b]
              have he : (v-(a : ℤ)) % 4 = (r-(a : ℤ)) % 4 := by omega
              rw [he]
            have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :
                (range N).sum (fun a =>
                  (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&
                    cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =
                  (range N).sum (fun a => (f a a && f a (g a)).toNat) := by
              apply sum_congr rfl
              intro a ha
              have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN
              rw [hx a ha8 a, hx a ha8 (g a)]
            rw [heq (8-6) (by norm_num) (fun a => a+6)]
            dsimp only [f]
            interval_cases r <;> decide
          · have hlo : -3 ≤ v := by omega
            have hhi : v ≤ 10 := by omega
            interval_cases v <;> decide
  8. The sum is at least 1 when the distance is d = 7, completing the proof.

    For d = 7, the sum consists of the single term a = 0, pairing bit 0 with bit 7. As before, v ≤ -4 is simplified via cycle_power_dyadic_domain_wall_left and sum_congr and checked for r = v % 4 by decide; v ≥ 11 is simplified via cycle_power_dyadic_domain_wall_right and checked for r = v % 4 by decide; and the 14 integers in -3 ≤ v ≤ 10 are verified individually by decide.

    lines 293–339

    uses cycle_power_dyadic_domain_wall_left, cycle_power_dyadic_domain_wall_right, sum_congr, lt_of_lt_of_le

      · by_cases hL : v ≤ -4
        · generalize hr : v % 4 = r
          have hr0 : 0 ≤ r := by omega
          have hr4 : r < 4 := by omega
          let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 2 = 0 then 129 else 243 : ℕ).testBit b
          have hx (a : ℕ) (ha : a < 8) (b : ℕ) :
              cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by
            rw [cycle_power_dyadic_domain_wall_left (v-(a : ℤ)) (by omega) b]
            have he : (v-(a : ℤ)) % 2 = (r-(a : ℤ)) % 2 := by omega
            rw [he]
          have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :
              (range N).sum (fun a =>
                (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&
                  cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =
                (range N).sum (fun a => (f a a && f a (g a)).toNat) := by
            apply sum_congr rfl
            intro a ha
            have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN
            rw [hx a ha8 a, hx a ha8 (g a)]
          rw [heq (8-7) (by norm_num) (fun a => a+7)]
          dsimp only [f]
          interval_cases r <;> decide
        · by_cases hR : 11 ≤ v
          · generalize hr : v % 4 = r
            have hr0 : 0 ≤ r := by omega
            have hr4 : r < 4 := by omega
            let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 4 = 1 then 195 else if (r-(a : ℤ)) % 4 = 3 then 255 else 129 : ℕ).testBit b
            have hx (a : ℕ) (ha : a < 8) (b : ℕ) :
                cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by
              rw [cycle_power_dyadic_domain_wall_right (v-(a : ℤ)) (by omega) b]
              have he : (v-(a : ℤ)) % 4 = (r-(a : ℤ)) % 4 := by omega
              rw [he]
            have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :
                (range N).sum (fun a =>
                  (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&
                    cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =
                  (range N).sum (fun a => (f a a && f a (g a)).toNat) := by
              apply sum_congr rfl
              intro a ha
              have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN
              rw [hx a ha8 a, hx a ha8 (g a)]
            rw [heq (8-7) (by norm_num) (fun a => a+7)]
            dsimp only [f]
            interval_cases r <;> decide
          · have hlo : -3 ≤ v := by omega
            have hhi : v ≤ 10 := by omega
            interval_cases v <;> decide
cycle_power_dyadic_domain_wall_left
For any integer shift p ≤ -4 and bit index a, the dyadic domain wall value at (p, a) equals the a-th bit of 129 if p is even, or 243 if p is odd.
cycle_power_dyadic_domain_wall_right
For any integer shift p ≥ 4 and bit index a, the dyadic domain wall value at (p, a) equals the a-th bit of 195 if p ≡ 1 mod 4, 255 if p ≡ 3 mod 4, or 129 otherwise.
sum_congr
Two finite sums are equal if their index sets are equal and their summands agree at every element of the index set.
lt_of_lt_of_le
In a preorder, if a < b and b ≤ c, then a < c.

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

Lean’s trace was cut to the first 400 of 498 tactics.

open Finsetset_option maxHeartbeats 2000000set_option maxRecDepth 10000theorem cycle_power_dyadic_domain_wall_cover_sum    (d : ℕ) (hd : 1 ≤ d) (hd8 : d < 8) (v : ℤ) :    1 ≤ (range (8-d)).sum (fun a =>      (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&        cycle_power_dyadic_domain_wall (v-(a : ℤ)) (a+d)).toNat) := by  interval_cases d  · by_cases hL : v ≤ -4    · generalize hr : v % 4 = r      have hr0 : 0 ≤ r := by omega      have hr4 : r < 4 := by omega      let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 2 = 0 then 129 else 243 : ℕ).testBit b      have hx (a : ℕ) (ha : a < 8) (b : ℕ) :          cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by        rw [cycle_power_dyadic_domain_wall_left (v-(a : ℤ)) (by omega) b]        have he : (v-(a : ℤ)) % 2 = (r-(a : ℤ)) % 2 := by omega        rw [he]      have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :          (range N).sum (fun a =>            (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&              cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =            (range N).sum (fun a => (f a a && f a (g a)).toNat) := by        apply sum_congr rfl        intro a ha        have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN        rw [hx a ha8 a, hx a ha8 (g a)]      rw [heq (8-1) (by norm_num) (fun a => a+1)]      dsimp only [f]      interval_cases r <;> decide    · by_cases hR : 11 ≤ v      · generalize hr : v % 4 = r        have hr0 : 0 ≤ r := by omega        have hr4 : r < 4 := by omega        let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 4 = 1 then 195 else if (r-(a : ℤ)) % 4 = 3 then 255 else 129 : ℕ).testBit b        have hx (a : ℕ) (ha : a < 8) (b : ℕ) :            cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by          rw [cycle_power_dyadic_domain_wall_right (v-(a : ℤ)) (by omega) b]          have he : (v-(a : ℤ)) % 4 = (r-(a : ℤ)) % 4 := by omega          rw [he]        have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :            (range N).sum (fun a =>              (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&                cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =              (range N).sum (fun a => (f a a && f a (g a)).toNat) := by          apply sum_congr rfl          intro a ha          have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN          rw [hx a ha8 a, hx a ha8 (g a)]        rw [heq (8-1) (by norm_num) (fun a => a+1)]        dsimp only [f]        interval_cases r <;> decide      · have hlo : -3 ≤ v := by omega        have hhi : v ≤ 10 := by omega        interval_cases v <;> decide  · by_cases hL : v ≤ -4    · generalize hr : v % 4 = r      have hr0 : 0 ≤ r := by omega      have hr4 : r < 4 := by omega      let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 2 = 0 then 129 else 243 : ℕ).testBit b      have hx (a : ℕ) (ha : a < 8) (b : ℕ) :          cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by        rw [cycle_power_dyadic_domain_wall_left (v-(a : ℤ)) (by omega) b]        have he : (v-(a : ℤ)) % 2 = (r-(a : ℤ)) % 2 := by omega        rw [he]      have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :          (range N).sum (fun a =>            (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&              cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =            (range N).sum (fun a => (f a a && f a (g a)).toNat) := by        apply sum_congr rfl        intro a ha        have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN        rw [hx a ha8 a, hx a ha8 (g a)]      rw [heq (8-2) (by norm_num) (fun a => a+2)]      dsimp only [f]      interval_cases r <;> decide    · by_cases hR : 11 ≤ v      · generalize hr : v % 4 = r        have hr0 : 0 ≤ r := by omega        have hr4 : r < 4 := by omega        let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 4 = 1 then 195 else if (r-(a : ℤ)) % 4 = 3 then 255 else 129 : ℕ).testBit b        have hx (a : ℕ) (ha : a < 8) (b : ℕ) :            cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by          rw [cycle_power_dyadic_domain_wall_right (v-(a : ℤ)) (by omega) b]          have he : (v-(a : ℤ)) % 4 = (r-(a : ℤ)) % 4 := by omega          rw [he]        have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :            (range N).sum (fun a =>              (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&                cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =              (range N).sum (fun a => (f a a && f a (g a)).toNat) := by          apply sum_congr rfl          intro a ha          have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN          rw [hx a ha8 a, hx a ha8 (g a)]        rw [heq (8-2) (by norm_num) (fun a => a+2)]        dsimp only [f]        interval_cases r <;> decide      · have hlo : -3 ≤ v := by omega        have hhi : v ≤ 10 := by omega        interval_cases v <;> decide  · by_cases hL : v ≤ -4    · generalize hr : v % 4 = r      have hr0 : 0 ≤ r := by omega      have hr4 : r < 4 := by omega      let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 2 = 0 then 129 else 243 : ℕ).testBit b      have hx (a : ℕ) (ha : a < 8) (b : ℕ) :          cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by        rw [cycle_power_dyadic_domain_wall_left (v-(a : ℤ)) (by omega) b]        have he : (v-(a : ℤ)) % 2 = (r-(a : ℤ)) % 2 := by omega        rw [he]      have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :          (range N).sum (fun a =>            (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&              cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =            (range N).sum (fun a => (f a a && f a (g a)).toNat) := by        apply sum_congr rfl        intro a ha        have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN        rw [hx a ha8 a, hx a ha8 (g a)]      rw [heq (8-3) (by norm_num) (fun a => a+3)]      dsimp only [f]      interval_cases r <;> decide    · by_cases hR : 11 ≤ v      · generalize hr : v % 4 = r        have hr0 : 0 ≤ r := by omega        have hr4 : r < 4 := by omega        let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 4 = 1 then 195 else if (r-(a : ℤ)) % 4 = 3 then 255 else 129 : ℕ).testBit b        have hx (a : ℕ) (ha : a < 8) (b : ℕ) :            cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by          rw [cycle_power_dyadic_domain_wall_right (v-(a : ℤ)) (by omega) b]          have he : (v-(a : ℤ)) % 4 = (r-(a : ℤ)) % 4 := by omega          rw [he]        have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :            (range N).sum (fun a =>              (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&                cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =              (range N).sum (fun a => (f a a && f a (g a)).toNat) := by          apply sum_congr rfl          intro a ha          have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN          rw [hx a ha8 a, hx a ha8 (g a)]        rw [heq (8-3) (by norm_num) (fun a => a+3)]        dsimp only [f]        interval_cases r <;> decide      · have hlo : -3 ≤ v := by omega        have hhi : v ≤ 10 := by omega        interval_cases v <;> decide  · by_cases hL : v ≤ -4    · generalize hr : v % 4 = r      have hr0 : 0 ≤ r := by omega      have hr4 : r < 4 := by omega      let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 2 = 0 then 129 else 243 : ℕ).testBit b      have hx (a : ℕ) (ha : a < 8) (b : ℕ) :          cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by        rw [cycle_power_dyadic_domain_wall_left (v-(a : ℤ)) (by omega) b]        have he : (v-(a : ℤ)) % 2 = (r-(a : ℤ)) % 2 := by omega        rw [he]      have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :          (range N).sum (fun a =>            (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&              cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =            (range N).sum (fun a => (f a a && f a (g a)).toNat) := by        apply sum_congr rfl        intro a ha        have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN        rw [hx a ha8 a, hx a ha8 (g a)]      rw [heq (8-4) (by norm_num) (fun a => a+4)]      dsimp only [f]      interval_cases r <;> decide    · by_cases hR : 11 ≤ v      · generalize hr : v % 4 = r        have hr0 : 0 ≤ r := by omega        have hr4 : r < 4 := by omega        let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 4 = 1 then 195 else if (r-(a : ℤ)) % 4 = 3 then 255 else 129 : ℕ).testBit b        have hx (a : ℕ) (ha : a < 8) (b : ℕ) :            cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by          rw [cycle_power_dyadic_domain_wall_right (v-(a : ℤ)) (by omega) b]          have he : (v-(a : ℤ)) % 4 = (r-(a : ℤ)) % 4 := by omega          rw [he]        have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :            (range N).sum (fun a =>              (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&                cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =              (range N).sum (fun a => (f a a && f a (g a)).toNat) := by          apply sum_congr rfl          intro a ha          have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN          rw [hx a ha8 a, hx a ha8 (g a)]        rw [heq (8-4) (by norm_num) (fun a => a+4)]        dsimp only [f]        interval_cases r <;> decide      · have hlo : -3 ≤ v := by omega        have hhi : v ≤ 10 := by omega        interval_cases v <;> decide  · by_cases hL : v ≤ -4    · generalize hr : v % 4 = r      have hr0 : 0 ≤ r := by omega      have hr4 : r < 4 := by omega      let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 2 = 0 then 129 else 243 : ℕ).testBit b      have hx (a : ℕ) (ha : a < 8) (b : ℕ) :          cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by        rw [cycle_power_dyadic_domain_wall_left (v-(a : ℤ)) (by omega) b]        have he : (v-(a : ℤ)) % 2 = (r-(a : ℤ)) % 2 := by omega        rw [he]      have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :          (range N).sum (fun a =>            (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&              cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =            (range N).sum (fun a => (f a a && f a (g a)).toNat) := by        apply sum_congr rfl        intro a ha        have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN        rw [hx a ha8 a, hx a ha8 (g a)]      rw [heq (8-5) (by norm_num) (fun a => a+5)]      dsimp only [f]      interval_cases r <;> decide    · by_cases hR : 11 ≤ v      · generalize hr : v % 4 = r        have hr0 : 0 ≤ r := by omega        have hr4 : r < 4 := by omega        let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 4 = 1 then 195 else if (r-(a : ℤ)) % 4 = 3 then 255 else 129 : ℕ).testBit b        have hx (a : ℕ) (ha : a < 8) (b : ℕ) :            cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by          rw [cycle_power_dyadic_domain_wall_right (v-(a : ℤ)) (by omega) b]          have he : (v-(a : ℤ)) % 4 = (r-(a : ℤ)) % 4 := by omega          rw [he]        have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :            (range N).sum (fun a =>              (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&                cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =              (range N).sum (fun a => (f a a && f a (g a)).toNat) := by          apply sum_congr rfl          intro a ha          have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN          rw [hx a ha8 a, hx a ha8 (g a)]        rw [heq (8-5) (by norm_num) (fun a => a+5)]        dsimp only [f]        interval_cases r <;> decide      · have hlo : -3 ≤ v := by omega        have hhi : v ≤ 10 := by omega        interval_cases v <;> decide  · by_cases hL : v ≤ -4    · generalize hr : v % 4 = r      have hr0 : 0 ≤ r := by omega      have hr4 : r < 4 := by omega      let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 2 = 0 then 129 else 243 : ℕ).testBit b      have hx (a : ℕ) (ha : a < 8) (b : ℕ) :          cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by        rw [cycle_power_dyadic_domain_wall_left (v-(a : ℤ)) (by omega) b]        have he : (v-(a : ℤ)) % 2 = (r-(a : ℤ)) % 2 := by omega        rw [he]      have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :          (range N).sum (fun a =>            (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&              cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =            (range N).sum (fun a => (f a a && f a (g a)).toNat) := by        apply sum_congr rfl        intro a ha        have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN        rw [hx a ha8 a, hx a ha8 (g a)]      rw [heq (8-6) (by norm_num) (fun a => a+6)]      dsimp only [f]      interval_cases r <;> decide    · by_cases hR : 11 ≤ v      · generalize hr : v % 4 = r        have hr0 : 0 ≤ r := by omega        have hr4 : r < 4 := by omega        let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 4 = 1 then 195 else if (r-(a : ℤ)) % 4 = 3 then 255 else 129 : ℕ).testBit b        have hx (a : ℕ) (ha : a < 8) (b : ℕ) :            cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by          rw [cycle_power_dyadic_domain_wall_right (v-(a : ℤ)) (by omega) b]          have he : (v-(a : ℤ)) % 4 = (r-(a : ℤ)) % 4 := by omega          rw [he]        have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :            (range N).sum (fun a =>              (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&                cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =              (range N).sum (fun a => (f a a && f a (g a)).toNat) := by          apply sum_congr rfl          intro a ha          have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN          rw [hx a ha8 a, hx a ha8 (g a)]        rw [heq (8-6) (by norm_num) (fun a => a+6)]        dsimp only [f]        interval_cases r <;> decide      · have hlo : -3 ≤ v := by omega        have hhi : v ≤ 10 := by omega        interval_cases v <;> decide  · by_cases hL : v ≤ -4    · generalize hr : v % 4 = r      have hr0 : 0 ≤ r := by omega      have hr4 : r < 4 := by omega      let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 2 = 0 then 129 else 243 : ℕ).testBit b      have hx (a : ℕ) (ha : a < 8) (b : ℕ) :          cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by        rw [cycle_power_dyadic_domain_wall_left (v-(a : ℤ)) (by omega) b]        have he : (v-(a : ℤ)) % 2 = (r-(a : ℤ)) % 2 := by omega        rw [he]      have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :          (range N).sum (fun a =>            (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&              cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =            (range N).sum (fun a => (f a a && f a (g a)).toNat) := by        apply sum_congr rfl        intro a ha        have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN        rw [hx a ha8 a, hx a ha8 (g a)]      rw [heq (8-7) (by norm_num) (fun a => a+7)]      dsimp only [f]      interval_cases r <;> decide    · by_cases hR : 11 ≤ v      · generalize hr : v % 4 = r        have hr0 : 0 ≤ r := by omega        have hr4 : r < 4 := by omega        let f : ℕ → ℕ → Bool := fun a b => (if (r-(a : ℤ)) % 4 = 1 then 195 else if (r-(a : ℤ)) % 4 = 3 then 255 else 129 : ℕ).testBit b        have hx (a : ℕ) (ha : a < 8) (b : ℕ) :            cycle_power_dyadic_domain_wall (v-(a : ℤ)) b = f a b := by          rw [cycle_power_dyadic_domain_wall_right (v-(a : ℤ)) (by omega) b]          have he : (v-(a : ℤ)) % 4 = (r-(a : ℤ)) % 4 := by omega          rw [he]        have heq (N : ℕ) (hN : N ≤ 8) (g : ℕ → ℕ) :            (range N).sum (fun a =>              (cycle_power_dyadic_domain_wall (v-(a : ℤ)) a &&                cycle_power_dyadic_domain_wall (v-(a : ℤ)) (g a)).toNat) =              (range N).sum (fun a => (f a a && f a (g a)).toNat) := by          apply sum_congr rfl          intro a ha          have ha8 : a < 8 := lt_of_lt_of_le (mem_range.mp ha) hN          rw [hx a ha8 a, hx a ha8 (g a)]        rw [heq (8-7) (by norm_num) (fun a => a+7)]        dsimp only [f]        interval_cases r <;> decide      · have hlo : -3 ≤ v := by omega        have hhi : v ≤ 10 := by omega        interval_cases v <;> decide
See it in the graphDiscuss this resultChallenge it