AFTD Auto-Formalizing Theoretical Domains

cycle_power_dyadic_rank_right_drop_bound

theoremverified

Coverage one step above a dyadic long distance bounds the drop in right-block occupancy by the old boundary-pair bit, after accounting for the two endpoint bits. The statement holds at every rank and arbitrary dyadic radius.

Statement

theorem cycle_power_dyadic_rank_right_drop_bound
    (m j : ℕ) (hj : 1 ≤ j) (hjm : j < m) (x : ℤ → ℕ → Bool)
    (htight : ∀ p, cycle_power_dyadic_class_weight m (x p) =
      (Finset.range (2 ^ m)).sum (fun a => (x p a).toNat))
    (hexact : ∀ v : ℤ, (Finset.range (2 ^ j)).sum (fun a =>
      (x (v - (a : ℤ)) a && x (v - (a : ℤ)) (a + 2 ^ m - 2 ^ j)).toNat) = 1)
    (hcover : ∀ v : ℤ, ∃ a : ℕ, a < 2 ^ j - 1 ∧
      x (v - (a : ℤ)) a = true ∧
        x (v - (a : ℤ)) (a + (2 ^ m - 2 ^ j + 1)) = true) :
    let q := 2 ^ (j - 1)
    let d := 2 ^ m - 2 ^ j
    ∀ v : ℤ,
      (Finset.range q).sum (fun a => (x (v - (a : ℤ)) (d + a)).toNat) +
        (x (v + 1) d).toNat +
        (x (v - ((2 * q - 1 : ℕ) : ℤ)) (2 * q - 1)).toNat ≤
      (Finset.range q).sum (fun a => (x (v + 1 - (a : ℤ)) (d + a)).toNat) +
        (x (v - ((q - 1 : ℕ) : ℤ)) (q - 1) &&
          x (v - ((q - 1 : ℕ) : ℤ)) (2 ^ m - q)).toNat
Source
Uniform rank-coupling bookkeeping for OP-205 / RT-1, following arXiv:2610.15635. This is an auxiliary consequence of exact dyadic coverage and one neighbouring ordinary distance, not a research advance.
Verified
27 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2

The proof, explained

The proof bounds the drop in right-block occupancy between vertices v and v + 1 by decomposing both the original and shifted blocks into smaller sub-blocks and endpoint bits. First, the balance theorem gives L + R = 1, where L splits as Lpre + A (isolating its rightmost bit A) and the shifted right block splits as R_next = B + Rtail (isolating its leftmost bit B). Second, the coverage hypothesis provides a bit-pair separated by d + 1, and a trichotomy on its position shows that this pair must contribute at least 1 to Lpre, Rtail, or the boundary-pair bit C, establishing 1 ≤ Lpre + Rtail + C. Substituting 1 = Lpre + A + R into this lower bound and eliminating Lpre and Rtail immediately yields R + B + A ≤ R_next + C.

  1. Set q = 2^(j - 1) and d = 2^m - 2^j, establish 2^j = 2 * q with 1 ≤ q, and define abbreviations for the block sums and boundary bits L, R, Lpre, Rtail, A, B, C, and R_next.

    We introduce the dyadic half-block size q = 2^(j - 1) and dyadic offset d = 2^m - 2^j for vertex v. Since j ≥ 1, q ≥ 1 by Nat.one_le_two_pow, and 2^j = 2^(j - 1 + 1) = 2 * q using Nat.sub_add_cancel and pow_succ. We then define abbreviations for the terms: L and R for the left- and right-block occupancies; Lpre and Rtail for their length-(q - 1) prefix and suffix sub-blocks; A and B for the boundary bits x(v - (2q - 1), 2q - 1) and x(v + 1, d); C for the conjunction bit-pair x(v - (q - 1), q - 1) && x(v - (q - 1), 2^m - q); and R_next for the right-block occupancy shifted to vertex v + 1.

    lines 19–34

    uses Nat.one_le_two_pow, Nat.sub_add_cancel, pow_succ

      intro q d v
      have hq1 : 1 ≤ q := Nat.one_le_two_pow
      have hj1 : 2 ^ j = 2 * q := by
        change 2 ^ j = 2 * 2 ^ (j - 1)
        conv_lhs => rw [← Nat.sub_add_cancel hj]
        rw [pow_succ]
        ring
      let L := (Finset.range q).sum (fun a => (x (v - ((q + a : ℕ) : ℤ)) (q + a)).toNat)
      let R := (Finset.range q).sum (fun a => (x (v - (a : ℤ)) (d + a)).toNat)
      let Lpre := (Finset.range (q - 1)).sum (fun a => (x (v - ((q + a : ℕ) : ℤ)) (q + a)).toNat)
      let Rtail := (Finset.range (q - 1)).sum (fun a => (x (v - (a : ℤ)) (d + 1 + a)).toNat)
      let A := (x (v - ((2 * q - 1 : ℕ) : ℤ)) (2 * q - 1)).toNat
      let B := (x (v + 1) d).toNat
      let C := (x (v - ((q - 1 : ℕ) : ℤ)) (q - 1) &&
            x (v - ((q - 1 : ℕ) : ℤ)) (2 ^ m - q)).toNat
      let R_next := (Finset.range q).sum (fun a => (x (v + 1 - (a : ℤ)) (d + a)).toNat)
  2. L + R = 1

    The rank count balance theorem cycle_power_dyadic_rank_count_balance guarantees that L plus a dyadically shifted occupancy sum equals 1. For each index a < q, the shifted summand at time v + d - (d + a) = v - a and position d + a coincides with the corresponding summand of R, verified via Nat.cast_add and ring arithmetic. Sum congruence Finset.sum_congr identifies the shifted sum with R, establishing L + R = 1.

    lines 37–56

    uses cycle_power_dyadic_rank_count_balance, Nat.cast_add, Finset.sum_congr

      have hbal : L + R = 1 := by
        have hbal0 := cycle_power_dyadic_rank_count_balance m j hj hjm x htight hexact v
        have h_summand : ∀ a, (x (v + ((2 ^ m - 2 ^ j : ℕ) : ℤ) - ((2 ^ m - 2 ^ j + a : ℕ) : ℤ)) (2 ^ m - 2 ^ j + a)).toNat =
            (x (v - (a : ℤ)) (d + a)).toNat := by
          intro a
          have h1 : ((2 ^ m - 2 ^ j + a : ℕ) : ℤ) = (d : ℤ) + (a : ℤ) := by
            change (((d + a : ℕ) : ℤ)) = (d : ℤ) + (a : ℤ)
            exact Nat.cast_add d a
          have h2 : v + ((2 ^ m - 2 ^ j : ℕ) : ℤ) - ((2 ^ m - 2 ^ j + a : ℕ) : ℤ) = v - (a : ℤ) := by
            change v + (d : ℤ) - ((2 ^ m - 2 ^ j + a : ℕ) : ℤ) = v - (a : ℤ)
            rw [h1]
            ring
          have h3 : 2 ^ m - 2 ^ j + a = d + a := rfl
          rw [h2, h3]
        have hR_eq : (Finset.range (2 ^ (j - 1))).sum (fun a =>
            (x (v + ((2 ^ m - 2 ^ j : ℕ) : ℤ) - ((2 ^ m - 2 ^ j + a : ℕ) : ℤ)) (2 ^ m - 2 ^ j + a)).toNat) = R :=
          Finset.sum_congr rfl (fun a _ => h_summand a)
        change L + _ = 1 at hbal0
        rw [hR_eq] at hbal0
        exact hbal0
  3. L = Lpre + A

    Using Nat.sub_add_cancel to write q = (q - 1) + 1, we split off the final term (a = q - 1) of the sum L via Finset.sum_range_succ. The initial q - 1 terms form Lpre, and the final term at coordinate q + (q - 1) = 2 * q - 1 matches the definition of the boundary bit A.

    lines 59–69

    uses Nat.sub_add_cancel, Finset.sum_range_succ

      have hL : L = Lpre + A := by
        have hq_eq : q = (q - 1) + 1 := (Nat.sub_add_cancel hq1).symm
        change (Finset.range q).sum _ = Lpre + A
        nth_rw 1 [hq_eq]
        rw [Finset.sum_range_succ]
        have h_arg : q + (q - 1) = 2 * q - 1 := by omega
        have h_term : (x (v - ((q + (q - 1) : ℕ) : ℤ)) (q + (q - 1))).toNat = A := by
          have : (q + (q - 1) : ℕ) = 2 * q - 1 := h_arg
          have hcast : ((q + (q - 1) : ℕ) : ℤ) = ((2 * q - 1 : ℕ) : ℤ) := by rw [this]
          rw [hcast, this]
        rw [h_term]
  4. R_next = B + Rtail

    Writing q = (q - 1) + 1 via Nat.sub_add_cancel, we peel off the initial term (a = 0) of the shifted sum R_next via Finset.sum_range_succ'. The a = 0 term evaluates to x(v + 1, d) = B. For the remaining terms indexed by a + 1 for a < q - 1, the time index v + 1 - (a + 1) simplifies to v - a and the position d + (a + 1) to d + 1 + a, matching the summands of Rtail. Finset.sum_congr concludes that R_next = B + Rtail.

    lines 72–89

    uses Nat.sub_add_cancel, Finset.sum_range_succ', add_comm, Finset.sum_congr

      have hR_next : R_next = B + Rtail := by
        have hq_eq : q = (q - 1) + 1 := (Nat.sub_add_cancel hq1).symm
        change (Finset.range q).sum _ = B + Rtail
        nth_rw 1 [hq_eq]
        rw [Finset.sum_range_succ']
        have h0 : (x (v + 1 - ((0 : ℕ) : ℤ)) (d + 0)).toNat = B := by
          have : v + 1 - ((0 : ℕ) : ℤ) = v + 1 := by push_cast; ring
          have : d + 0 = d := rfl
          rw [‹v + 1 - ((0 : ℕ) : ℤ) = v + 1›, ‹d + 0 = d›]
        have hsucc : ∀ a, (x (v + 1 - ((a + 1 : ℕ) : ℤ)) (d + (a + 1))).toNat =
            (x (v - (a : ℤ)) (d + 1 + a)).toNat := by
          intro a
          have : v + 1 - ((a + 1 : ℕ) : ℤ) = v - (a : ℤ) := by push_cast; ring
          have : d + (a + 1) = d + 1 + a := by omega
          rw [‹v + 1 - ((a + 1 : ℕ) : ℤ) = v - (a : ℤ)›, ‹d + (a + 1) = d + 1 + a›]
        rw [h0, add_comm]
        congr 1
        exact Finset.sum_congr rfl (fun a _ => hsucc a)
  5. 1 ≤ Lpre + Rtail + C

    The coverage hypothesis hcover provides an index a < 2^j - 1 = 2 * q - 1 where both x(v - a, a) = true and x(v - a, a + d + 1) = true. We analyze three cases using lt_trichotomy on a and q - 1: 1. If a < q - 1, then a ∈ range (q - 1) (Finset.mem_range.mpr), so the second bit is an active term in Rtail. Since terms are non-negative (Nat.zero_le), Finset.single_le_sum gives Rtail ≥ 1. 2. If a = q - 1, the first bit is at position q - 1 and the second at (q - 1) + (2^m - 2^j + 1) = 2^m - q (using 2 * q ≤ 2^m from Nat.pow_le_pow_right and le_of_lt), so both conjuncts of C hold, yielding C = 1. 3. If a ≥ q, let k = a - q < q - 1 (Finset.mem_range.mpr). The first bit is an active term in Lpre at index k, so Finset.single_le_sum and Nat.zero_le give Lpre ≥ 1. In every case, at least one of Lpre, Rtail, or C is at least 1, so 1 ≤ Lpre + Rtail + C.

    lines 92–140

    uses lt_trichotomy, Finset.mem_range.mpr, Finset.single_le_sum, Nat.zero_le, Nat.pow_le_pow_right, le_of_lt

      have hcov : 1 ≤ Lpre + Rtail + C := by
        obtain ⟨a, ha_lt, hx1, hx2⟩ := hcover v
        rw [hj1] at ha_lt
        rcases lt_trichotomy a (q - 1) with h_lt | h_eq | h_gt
        · -- Case 1: a < q - 1
          have ha_mem : a ∈ Finset.range (q - 1) := Finset.mem_range.mpr h_lt
          have h_term : (x (v - (a : ℤ)) (d + 1 + a)).toNat = 1 := by
            have hd_eq : d + 1 + a = a + (2 ^ m - 2 ^ j + 1) := by
              change (2 ^ m - 2 ^ j) + 1 + a = a + (2 ^ m - 2 ^ j + 1)
              omega
            rw [hd_eq, hx2]
            rfl
          have h_le : (x (v - (a : ℤ)) (d + 1 + a)).toNat ≤ Rtail :=
            Finset.single_le_sum (f := fun (k : ℕ) => (x (v - (k : ℤ)) (d + 1 + k)).toNat)
              (fun _ _ => Nat.zero_le _) ha_mem
          omega
        · -- Case 2: a = q - 1
          have hqm : 2 * q ≤ 2 ^ m := by
            rw [← hj1]
            exact Nat.pow_le_pow_right (by decide) (le_of_lt hjm)
          have hd_eq : (q - 1) + (2 ^ m - 2 ^ j + 1) = 2 ^ m - q := by
            rw [hj1]
            omega
          have hx2' : x (v - ((q - 1 : ℕ) : ℤ)) (2 ^ m - q) = true := by
            have := hx2
            rw [h_eq] at this
            rwa [hd_eq] at this
          have hx1' : x (v - ((q - 1 : ℕ) : ℤ)) (q - 1) = true := by
            rwa [h_eq] at hx1
          have hC : C = 1 := by
            change (x (v - ((q - 1 : ℕ) : ℤ)) (q - 1) && x (v - ((q - 1 : ℕ) : ℤ)) (2 ^ m - q)).toNat = 1
            rw [hx1', hx2']
            rfl
          omega
        · -- Case 3: q ≤ a
          have h_q_le_a : q ≤ a := by omega
          let k := a - q
          have hk_lt : k < q - 1 := by omega
          have hk_mem : k ∈ Finset.range (q - 1) := Finset.mem_range.mpr hk_lt
          have h_qk : q + k = a := by omega
          have h_term : (x (v - ((q + k : ℕ) : ℤ)) (q + k)).toNat = 1 := by
            have : (q + k : ℕ) = a := h_qk
            have h1 : ((q + k : ℕ) : ℤ) = (a : ℤ) := by rw [this]
            rw [h1, this, hx1]
            rfl
          have h_le : (x (v - ((q + k : ℕ) : ℤ)) (q + k)).toNat ≤ Lpre :=
            Finset.single_le_sum (f := fun (k : ℕ) => (x (v - ((q + k : ℕ) : ℤ)) (q + k)).toNat)
              (fun _ _ => Nat.zero_le _) hk_mem
          omega
  6. R + B + A ≤ R_next + C

    The goal inequality is phrased in terms of the introduced definitions as R + B + A ≤ R_next + C. Substituting 1 = L + R = Lpre + A + R into the coverage inequality 1 ≤ Lpre + Rtail + C yields Lpre + A + R ≤ Lpre + Rtail + C, which simplifies to R + A ≤ Rtail + C. Substituting Rtail = R_next - B from R_next = B + Rtail gives R + B + A ≤ R_next + C, which omega verifies automatically.

    lines 143–144

      change R + B + A ≤ R_next + C
      omega
Nat.one_le_two_pow
1 is less than or equal to 2^n for any natural number n
Nat.sub_add_cancel
if m ≤ n, then (n - m) + m = n
pow_succ
a^(n + 1) = a^n * a
cycle_power_dyadic_rank_count_balance
under the dyadic class weight and exactness hypotheses, the sum of occupancies across the left dyadic block and the right dyadic block at rank j equals 1
Nat.cast_add
the cast of a sum of natural numbers to integers equals the sum of their casts, ↑(m + n) = ↑m + ↑n
Finset.sum_congr
two finite sums are equal if their index sets are equal and their summands agree on every element
Finset.sum_range_succ
the sum over range (n + 1) equals the sum over range n plus the term at index n
Finset.sum_range_succ'
the sum over range (n + 1) equals the term at index 0 plus the sum over range n shifted by 1
add_comm
addition is commutative, a + b = b + a
lt_trichotomy
for any two elements in a linear order, either a < b, a = b, or b < a
Finset.mem_range.mpr
if k < n, then k is an element of Finset.range n
Finset.single_le_sum
a single term in a finite sum of non-negative elements is less than or equal to the total sum
Nat.zero_le
every natural number is greater than or equal to 0
Nat.pow_le_pow_right
for a positive base, powers are monotonic in the exponent: if i ≤ j then n^i ≤ n^j
le_of_lt
strict inequality implies non-strict inequality, a < b → a ≤ b

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_rank_right_drop_bound    (m j : ℕ) (hj : 1 ≤ j) (hjm : j < m) (x : ℤ → ℕ → Bool)    (htight : ∀ p, cycle_power_dyadic_class_weight m (x p) =      (Finset.range (2 ^ m)).sum (fun a => (x p a).toNat))    (hexact : ∀ v : ℤ, (Finset.range (2 ^ j)).sum (fun a =>      (x (v - (a : ℤ)) a && x (v - (a : ℤ)) (a + 2 ^ m - 2 ^ j)).toNat) = 1)    (hcover : ∀ v : ℤ, ∃ a : ℕ, a < 2 ^ j - 1 ∧      x (v - (a : ℤ)) a = true ∧        x (v - (a : ℤ)) (a + (2 ^ m - 2 ^ j + 1)) = true) :    let q := 2 ^ (j - 1)    let d := 2 ^ m - 2 ^ j    ∀ v : ℤ,      (Finset.range q).sum (fun a => (x (v - (a : ℤ)) (d + a)).toNat) +        (x (v + 1) d).toNat +        (x (v - ((2 * q - 1 : ℕ) : ℤ)) (2 * q - 1)).toNat ≤      (Finset.range q).sum (fun a => (x (v + 1 - (a : ℤ)) (d + a)).toNat) +        (x (v - ((q - 1 : ℕ) : ℤ)) (q - 1) &&          x (v - ((q - 1 : ℕ) : ℤ)) (2 ^ m - q)).toNat := by  intro q d v  have hq1 : 1 ≤ q := Nat.one_le_two_pow  have hj1 : 2 ^ j = 2 * q := by    change 2 ^ j = 2 * 2 ^ (j - 1)    conv_lhs => rw [← Nat.sub_add_cancel hj]    rw [pow_succ]    ring  let L := (Finset.range q).sum (fun a => (x (v - ((q + a : ℕ) : ℤ)) (q + a)).toNat)  let R := (Finset.range q).sum (fun a => (x (v - (a : ℤ)) (d + a)).toNat)  let Lpre := (Finset.range (q - 1)).sum (fun a => (x (v - ((q + a : ℕ) : ℤ)) (q + a)).toNat)  let Rtail := (Finset.range (q - 1)).sum (fun a => (x (v - (a : ℤ)) (d + 1 + a)).toNat)  let A := (x (v - ((2 * q - 1 : ℕ) : ℤ)) (2 * q - 1)).toNat  let B := (x (v + 1) d).toNat  let C := (x (v - ((q - 1 : ℕ) : ℤ)) (q - 1) &&        x (v - ((q - 1 : ℕ) : ℤ)) (2 ^ m - q)).toNat  let R_next := (Finset.range q).sum (fun a => (x (v + 1 - (a : ℤ)) (d + a)).toNat)  -- L + R = 1  have hbal : L + R = 1 := by    have hbal0 := cycle_power_dyadic_rank_count_balance m j hj hjm x htight hexact v    have h_summand : ∀ a, (x (v + ((2 ^ m - 2 ^ j : ℕ) : ℤ) - ((2 ^ m - 2 ^ j + a : ℕ) : ℤ)) (2 ^ m - 2 ^ j + a)).toNat =        (x (v - (a : ℤ)) (d + a)).toNat := by      intro a      have h1 : ((2 ^ m - 2 ^ j + a : ℕ) : ℤ) = (d : ℤ) + (a : ℤ) := by        change (((d + a : ℕ) : ℤ)) = (d : ℤ) + (a : ℤ)        exact Nat.cast_add d a      have h2 : v + ((2 ^ m - 2 ^ j : ℕ) : ℤ) - ((2 ^ m - 2 ^ j + a : ℕ) : ℤ) = v - (a : ℤ) := by        change v + (d : ℤ) - ((2 ^ m - 2 ^ j + a : ℕ) : ℤ) = v - (a : ℤ)        rw [h1]        ring      have h3 : 2 ^ m - 2 ^ j + a = d + a := rfl      rw [h2, h3]    have hR_eq : (Finset.range (2 ^ (j - 1))).sum (fun a =>        (x (v + ((2 ^ m - 2 ^ j : ℕ) : ℤ) - ((2 ^ m - 2 ^ j + a : ℕ) : ℤ)) (2 ^ m - 2 ^ j + a)).toNat) = R :=      Finset.sum_congr rfl (fun a _ => h_summand a)    change L + _ = 1 at hbal0    rw [hR_eq] at hbal0    exact hbal0  -- L = Lpre + A  have hL : L = Lpre + A := by    have hq_eq : q = (q - 1) + 1 := (Nat.sub_add_cancel hq1).symm    change (Finset.range q).sum _ = Lpre + A    nth_rw 1 [hq_eq]    rw [Finset.sum_range_succ]    have h_arg : q + (q - 1) = 2 * q - 1 := by omega    have h_term : (x (v - ((q + (q - 1) : ℕ) : ℤ)) (q + (q - 1))).toNat = A := by      have : (q + (q - 1) : ℕ) = 2 * q - 1 := h_arg      have hcast : ((q + (q - 1) : ℕ) : ℤ) = ((2 * q - 1 : ℕ) : ℤ) := by rw [this]      rw [hcast, this]    rw [h_term]  -- R_next = B + Rtail  have hR_next : R_next = B + Rtail := by    have hq_eq : q = (q - 1) + 1 := (Nat.sub_add_cancel hq1).symm    change (Finset.range q).sum _ = B + Rtail    nth_rw 1 [hq_eq]    rw [Finset.sum_range_succ']    have h0 : (x (v + 1 - ((0 : ℕ) : ℤ)) (d + 0)).toNat = B := by      have : v + 1 - ((0 : ℕ) : ℤ) = v + 1 := by push_cast; ring      have : d + 0 = d := rfl      rw [‹v + 1 - ((0 : ℕ) : ℤ) = v + 1›, ‹d + 0 = d›]    have hsucc : ∀ a, (x (v + 1 - ((a + 1 : ℕ) : ℤ)) (d + (a + 1))).toNat =        (x (v - (a : ℤ)) (d + 1 + a)).toNat := by      intro a      have : v + 1 - ((a + 1 : ℕ) : ℤ) = v - (a : ℤ) := by push_cast; ring      have : d + (a + 1) = d + 1 + a := by omega      rw [‹v + 1 - ((a + 1 : ℕ) : ℤ) = v - (a : ℤ)›, ‹d + (a + 1) = d + 1 + a›]    rw [h0, add_comm]    congr 1    exact Finset.sum_congr rfl (fun a _ => hsucc a)  -- 1 ≤ Lpre + Rtail + C  have hcov : 1 ≤ Lpre + Rtail + C := by    obtain ⟨a, ha_lt, hx1, hx2⟩ := hcover v    rw [hj1] at ha_lt    rcases lt_trichotomy a (q - 1) with h_lt | h_eq | h_gt    · -- Case 1: a < q - 1      have ha_mem : a ∈ Finset.range (q - 1) := Finset.mem_range.mpr h_lt      have h_term : (x (v - (a : ℤ)) (d + 1 + a)).toNat = 1 := by        have hd_eq : d + 1 + a = a + (2 ^ m - 2 ^ j + 1) := by          change (2 ^ m - 2 ^ j) + 1 + a = a + (2 ^ m - 2 ^ j + 1)          omega        rw [hd_eq, hx2]        rfl      have h_le : (x (v - (a : ℤ)) (d + 1 + a)).toNat ≤ Rtail :=        Finset.single_le_sum (f := fun (k : ℕ) => (x (v - (k : ℤ)) (d + 1 + k)).toNat)          (fun _ _ => Nat.zero_le _) ha_mem      omega    · -- Case 2: a = q - 1      have hqm : 2 * q ≤ 2 ^ m := by        rw [← hj1]        exact Nat.pow_le_pow_right (by decide) (le_of_lt hjm)      have hd_eq : (q - 1) + (2 ^ m - 2 ^ j + 1) = 2 ^ m - q := by        rw [hj1]        omega      have hx2' : x (v - ((q - 1 : ℕ) : ℤ)) (2 ^ m - q) = true := by        have := hx2        rw [h_eq] at this        rwa [hd_eq] at this      have hx1' : x (v - ((q - 1 : ℕ) : ℤ)) (q - 1) = true := by        rwa [h_eq] at hx1      have hC : C = 1 := by        change (x (v - ((q - 1 : ℕ) : ℤ)) (q - 1) && x (v - ((q - 1 : ℕ) : ℤ)) (2 ^ m - q)).toNat = 1        rw [hx1', hx2']        rfl      omega    · -- Case 3: q ≤ a      have h_q_le_a : q ≤ a := by omega      let k := a - q      have hk_lt : k < q - 1 := by omega      have hk_mem : k ∈ Finset.range (q - 1) := Finset.mem_range.mpr hk_lt      have h_qk : q + k = a := by omega      have h_term : (x (v - ((q + k : ℕ) : ℤ)) (q + k)).toNat = 1 := by        have : (q + k : ℕ) = a := h_qk        have h1 : ((q + k : ℕ) : ℤ) = (a : ℤ) := by rw [this]        rw [h1, this, hx1]        rfl      have h_le : (x (v - ((q + k : ℕ) : ℤ)) (q + k)).toNat ≤ Lpre :=        Finset.single_le_sum (f := fun (k : ℕ) => (x (v - ((q + k : ℕ) : ℤ)) (q + k)).toNat)          (fun _ _ => Nat.zero_le _) hk_mem      omega  -- Final combination  change R + B + A ≤ R_next + C  omega
See it in the graphDiscuss this resultChallenge it