AFTD Auto-Formalizing Theoretical Domains

alpha_even_split_blocking_suffix_repeats_prefix

theoremverified

For an even-indexed split after a lexical prefix of a lexical sequence, every suffix obstructing lexicality starts after the inserted cell and begins with a copy of the whole original preceding prefix.

Statement

theorem alpha_even_split_blocking_suffix_repeats_prefix (a : List ℕ) (i k : ℕ) (ha : alpha_is_lexical a) (hi0 : 0 < i) (hi : i < a.length) (he : i % 2 = 0) (hc : 1 < a.getD i 0) (hp : alpha_is_lexical (a.take i)) : let c := a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1); 0 < k → k < c.length → ¬ alpha_lexical_lt (c.drop k) c → i + 1 < k ∧ (c.drop k).take i = a.take i
Source
Helper for the divisor-prefix route to OP-392, arXiv:2610.24758; alternating order as in arXiv:0810.5205.
Verified
18 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 6

The proof, explained

To show that any obstruction to lexicality in the split sequence c starts after the inserted pair and begins with a copy of a.take i, the proof first invokes an early suffix lemma to establish k > i + 1. Because k ≥ i + 2, dropping k elements from c skips past the insertion and reduces to a suffix of a, namely a.drop (k - 1), which is strictly less than a by lexicality. Trapped between being strictly less than a and not strictly less than c, the suffix is forced by an interval lemma to agree with a on the first i signed cells, and since a[i - 1] > 0, this suffix has length at least i and its initial length-i prefix matches a.take i.

  1. Assume a suffix c.drop k obstructs lexicality of c, with 0 < k < |c|.

    We introduce the hypotheses: k is a positive index strictly less than the length of the split sequence c, and the suffix c.drop k is not strictly less than c under alpha_lexical_lt.

    lines 2–3

      dsimp only
      intro hk0 hklen hblock
  2. The obstruction offset k satisfies i + 1 < k.

    By alpha_even_split_early_suffix_lt_of_lexical_prefix, every early suffix of c starting at an index k ≤ i + 1 is strictly less than c in the lexical order. Since the suffix c.drop k is assumed not to be less than c, it cannot start at or before index i + 1.

    lines 4–7

    uses alpha_even_split_early_suffix_lt_of_lexical_prefix

      have hearly := alpha_even_split_early_suffix_lt_of_lexical_prefix a i ha hi0 hi he hc hp
      have hgt : i + 1 < k := by
        by_contra H
        exact hblock (hearly k hk0 hklen (by omega))
  3. It remains to show that (c.drop k).take i = a.take i.

    We resolve the first conjunct i + 1 < k with the inequality just proved, leaving the identity of the length-i prefix of the suffix c.drop k and the prefix of a.

    line 8

      refine ⟨hgt, ?_⟩
  4. i + 2 ≤ k and the length of c is |a| + 1.

    Since i + 1 < k over ℕ, we have i + 2 ≤ k. The sequence c is formed by taking i elements from a, inserting two elements [a[i] - 1, 1], and keeping the remaining elements a.drop (i + 1); adding their lengths gives i + 2 + (|a| - (i + 1)) = |a| + 1.

    lines 9–12

    uses List.length_append, List.length_take, List.length_drop

      have hk2 : i + 2 ≤ k := by omega
      have hclen : (a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).length = a.length + 1 := by
        rw [List.length_append, List.length_append, List.length_take, List.length_drop]
        simp; omega
  5. c.drop k = a.drop (k - 1).

    Because k ≥ i + 2, dropping k elements from c skips past both the initial segment a.take i of length i and the two-element inserted segment. The remaining elements come entirely from a.drop (i + 1), at offset k - (i + 2), which simplifies to dropping (i + 1) + (k - (i + 2)) = k - 1 elements from a.

    lines 13–27

    uses List.drop_append, List.length_take, List.length_append, List.drop_eq_nil_of_le, List.nil_append, List.drop_drop

      have hdrop : (a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).drop k = a.drop (k - 1) := by
        rw [List.drop_append]
        rw [List.drop_append]
        have h1 : (a.take i).length = i := by rw [List.length_take]; omega
        have h2 : (a.take i ++ [a.getD i 0 - 1, 1]).length = i + 2 := by
          rw [List.length_append, h1]; simp
        rw [h1, h2]
        have hd1 : List.drop k (a.take i) = [] := List.drop_eq_nil_of_le (by omega)
        rw [hd1, List.nil_append]
        have hd2 : List.drop (k - i) [a.getD i 0 - 1, 1] = [] := by
          apply List.drop_eq_nil_of_le; simp; omega
        rw [hd2, List.nil_append]
        rw [List.drop_drop]
        congr 1
        omega
  6. c.take i = a.take i.

    Since i is at most the length of a.take i, taking the first i elements of c draws entirely from the first block a.take i, which already has length i.

    lines 28–33

    uses List.take_append_of_le_length, List.take_of_length_le, List.length_take, List.length_append

      have hctake : (a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).take i = a.take i := by
        rw [List.take_append_of_le_length]
        · rw [List.take_append_of_le_length]
          · rw [List.take_of_length_le (by rw [List.length_take]; omega)]
          · rw [List.length_take]; omega
        · rw [List.length_append, List.length_take]; omega
  7. For every index j < i, c[j] = a[j] and their signed cells coincide: alpha_signed_cell a j = alpha_signed_cell c j.

    For indices j < i, the j-th element of c falls within the first block a.take i, so c[j] = a[j]. Because the signed cell at index j is determined solely by the entry value and the parity of j, the signed cells of a and c are equal at all j < i.

    lines 34–45

    uses List.getD_append, List.length_append, List.length_take, List.getD_eq_getElem, List.getElem_take, alpha_signed_cell

      have hgetD_ca : ∀ j < i, (a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).getD j 0 = a.getD j 0 := by
        intro j hj
        rw [List.getD_append (a.take i ++ [a.getD i 0 - 1, 1]) (a.drop (i + 1)) 0 j
          (by rw [List.length_append, List.length_take]; simp; omega)]
        rw [List.getD_append (a.take i) ([a.getD i 0 - 1, 1]) 0 j (by rw [List.length_take]; omega)]
        rw [List.getD_eq_getElem _ 0 (by rw [List.length_take]; omega),
            List.getD_eq_getElem _ 0 (by omega)]
        rw [List.getElem_take]
      have hac : ∀ j < i, alpha_signed_cell a j = alpha_signed_cell (a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)) j := by
        intro j hj
        simp only [alpha_signed_cell]
        rw [hgetD_ca j hj]
  8. For all j < i, alpha_signed_cell (c.drop k) j = alpha_signed_cell a j.

    Since c.drop k = a.drop (k - 1) and a is lexical with 0 < k - 1 < |a|, the suffix is strictly less than a in the lexical order. Since it is not less than c, and a and c agree on their signed cells for all j < i, the lexical interval lemma alpha_signed_prefix_of_lexical_interval forces c.drop k to match a on all signed cells up to index i.

    lines 46–49

    uses alpha_signed_prefix_of_lexical_interval

      have hu : alpha_lexical_lt ((a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).drop k) a := by
        rw [hdrop]
        exact ha.2.2 (k - 1) (by omega) (by omega)
      have hpref := alpha_signed_prefix_of_lexical_interval ((a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).drop k) a (a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)) i (by rw [hclen]; omega) hu hblock hac
  9. For all j < i, (c.drop k).getD j 0 = a.getD j 0.

    By definition of alpha_signed_cell, the signed cell at index j is either the element itself (if j is even) or its negation (if j is odd). In both cases, the equality of signed cells implies equality of the underlying natural numbers.

    lines 50–56

    uses alpha_signed_cell, Nat.cast_injective, neg_inj.mp

      have hcd_eq : ∀ j < i, ((a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).drop k).getD j 0 = a.getD j 0 := by
        intro j hj
        have h := hpref j hj
        unfold alpha_signed_cell at h
        split_ifs at h
        · exact Nat.cast_injective h
        · exact Nat.cast_injective (neg_inj.mp h)
  10. The suffix c.drop k has length at least i.

    Since i > 0, the cell at index i - 1 exists in a and is strictly positive because a is lexical. By the previous step, (c.drop k).getD (i - 1) 0 = a.getD (i - 1) 0 > 0. If c.drop k had length at most i - 1, accessing index i - 1 would yield the default value 0, a contradiction. Thus |c.drop k| ≥ i.

    lines 57–69

    uses alpha_lexical_first_negative_step_exists_cell_pos, not_lt, List.getD_eq_default

      have hlen_ge : i ≤ ((a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).drop k).length := by
        have hposa : 0 < a.getD (i - 1) 0 := alpha_lexical_first_negative_step_exists_cell_pos a ha (i - 1) (by omega)
        have hpos := hcd_eq (i - 1) (by omega)
        have hpos' : 0 < ((a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).drop k).getD (i - 1) 0 := by
          rw [hpos]; exact hposa
        have hlt : i - 1 < ((a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).drop k).length := by
          by_contra H
          rw [not_lt] at H
          have hz : ((a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).drop k).getD (i - 1) 0 = 0 :=
            List.getD_eq_default _ _ H
          rw [hz] at hpos'
          omega
        omega
  11. (c.drop k).take i = a.take i.

    By list extensionality, two lists are equal if their lengths match and their elements agree at each index. Both (c.drop k).take i and a.take i have length i, and at every index j < i, their elements match because (c.drop k).getD j 0 = a.getD j 0.

    lines 70–78

    uses List.ext_getElem, List.length_take, List.getElem_take, List.getD_eq_getElem

      apply List.ext_getElem
      · rw [List.length_take, List.length_take]; omega
      · intro j hj1 hj2
        rw [List.getElem_take, List.getElem_take]
        have hu1 : j < ((a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).drop k).length := by
          rw [List.length_take] at hj1; omega
        have ha1 : j < a.length := by rw [List.length_take] at hj2; omega
        rw [← List.getD_eq_getElem _ 0 hu1, ← List.getD_eq_getElem _ 0 ha1]
        exact hcd_eq j (by rw [List.length_take] at hj1; omega)
alpha_even_split_early_suffix_lt_of_lexical_prefix
for an even-indexed split of a lexical sequence, any suffix starting at an index k ≤ i + 1 is strictly smaller than the split sequence in lexical order
List.length_append
the length of the concatenation of two lists is the sum of their lengths
List.length_take
the length of the prefix take i l is the minimum of i and the length of l
List.length_drop
the length of drop i l is the length of l minus i
List.drop_append
dropping i elements from l₁ ++ l₂ drops i from l₁, followed by dropping the remainder i - |l₁| from l₂
List.drop_eq_nil_of_le
dropping i elements from a list of length at most i yields the empty list
List.nil_append
prepending the empty list to any list leaves it unchanged
List.drop_drop
dropping i elements from drop j l is equivalent to dropping j + i elements from l
List.take_append_of_le_length
if i is at most the length of l₁, taking the first i elements of l₁ ++ l₂ gives the first i elements of l₁
List.take_of_length_le
taking i elements from a list of length at most i returns the whole list
List.getD_append
accessing an index n < |l| in l ++ l' with a default fallback returns the element l[n]
List.getD_eq_getElem
for an index within list bounds, the get-with-default operation equals direct list indexing
List.getElem_take
the i-th element of take j xs is xs[i] when i < |take j xs|
alpha_signed_cell
the i-th cell of a list evaluated as an integer with sign (-1)ⁱ, defaulting to 0 out of bounds
alpha_signed_prefix_of_lexical_interval
if u is lexically less than a but not lexically less than c, and a and c share their signed cells for indices below i ≤ |c|, then u also shares those signed cells with a
Nat.cast_injective
the natural-to-integer embedding is injective
neg_inj.mp
negation is injective: if -a = -b then a = b
alpha_lexical_first_negative_step_exists_cell_pos
every element of a lexical sequence is strictly positive
not_lt
not strictly less than is equivalent to greater than or equal to
List.getD_eq_default
accessing an index at or beyond a list's length with getD returns the default value
List.ext_getElem
two lists are equal if they have the same length and their elements agree at every valid index

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 alpha_even_split_blocking_suffix_repeats_prefix (a : List ℕ) (i k : ℕ) (ha : alpha_is_lexical a) (hi0 : 0 < i) (hi : i < a.length) (he : i % 2 = 0) (hc : 1 < a.getD i 0) (hp : alpha_is_lexical (a.take i)) : let c := a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1); 0 < k → k < c.length → ¬ alpha_lexical_lt (c.drop k) c → i + 1 < k ∧ (c.drop k).take i = a.take i := by  dsimp only  intro hk0 hklen hblock  have hearly := alpha_even_split_early_suffix_lt_of_lexical_prefix a i ha hi0 hi he hc hp  have hgt : i + 1 < k := by    by_contra H    exact hblock (hearly k hk0 hklen (by omega))  refine ⟨hgt, ?_⟩  have hk2 : i + 2 ≤ k := by omega  have hclen : (a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).length = a.length + 1 := by    rw [List.length_append, List.length_append, List.length_take, List.length_drop]    simp; omega  have hdrop : (a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).drop k = a.drop (k - 1) := by    rw [List.drop_append]    rw [List.drop_append]    have h1 : (a.take i).length = i := by rw [List.length_take]; omega    have h2 : (a.take i ++ [a.getD i 0 - 1, 1]).length = i + 2 := by      rw [List.length_append, h1]; simp    rw [h1, h2]    have hd1 : List.drop k (a.take i) = [] := List.drop_eq_nil_of_le (by omega)    rw [hd1, List.nil_append]    have hd2 : List.drop (k - i) [a.getD i 0 - 1, 1] = [] := by      apply List.drop_eq_nil_of_le; simp; omega    rw [hd2, List.nil_append]    rw [List.drop_drop]    congr 1    omega  have hctake : (a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).take i = a.take i := by    rw [List.take_append_of_le_length]    · rw [List.take_append_of_le_length]      · rw [List.take_of_length_le (by rw [List.length_take]; omega)]      · rw [List.length_take]; omega    · rw [List.length_append, List.length_take]; omega  have hgetD_ca : ∀ j < i, (a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).getD j 0 = a.getD j 0 := by    intro j hj    rw [List.getD_append (a.take i ++ [a.getD i 0 - 1, 1]) (a.drop (i + 1)) 0 j      (by rw [List.length_append, List.length_take]; simp; omega)]    rw [List.getD_append (a.take i) ([a.getD i 0 - 1, 1]) 0 j (by rw [List.length_take]; omega)]    rw [List.getD_eq_getElem _ 0 (by rw [List.length_take]; omega),        List.getD_eq_getElem _ 0 (by omega)]    rw [List.getElem_take]  have hac : ∀ j < i, alpha_signed_cell a j = alpha_signed_cell (a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)) j := by    intro j hj    simp only [alpha_signed_cell]    rw [hgetD_ca j hj]  have hu : alpha_lexical_lt ((a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).drop k) a := by    rw [hdrop]    exact ha.2.2 (k - 1) (by omega) (by omega)  have hpref := alpha_signed_prefix_of_lexical_interval ((a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).drop k) a (a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)) i (by rw [hclen]; omega) hu hblock hac  have hcd_eq : ∀ j < i, ((a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).drop k).getD j 0 = a.getD j 0 := by    intro j hj    have h := hpref j hj    unfold alpha_signed_cell at h    split_ifs at h    · exact Nat.cast_injective h    · exact Nat.cast_injective (neg_inj.mp h)  have hlen_ge : i ≤ ((a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).drop k).length := by    have hposa : 0 < a.getD (i - 1) 0 := alpha_lexical_first_negative_step_exists_cell_pos a ha (i - 1) (by omega)    have hpos := hcd_eq (i - 1) (by omega)    have hpos' : 0 < ((a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).drop k).getD (i - 1) 0 := by      rw [hpos]; exact hposa    have hlt : i - 1 < ((a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).drop k).length := by      by_contra H      rw [not_lt] at H      have hz : ((a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).drop k).getD (i - 1) 0 = 0 :=        List.getD_eq_default _ _ H      rw [hz] at hpos'      omega    omega  apply List.ext_getElem  · rw [List.length_take, List.length_take]; omega  · intro j hj1 hj2    rw [List.getElem_take, List.getElem_take]    have hu1 : j < ((a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1)).drop k).length := by      rw [List.length_take] at hj1; omega    have ha1 : j < a.length := by rw [List.length_take] at hj2; omega    rw [← List.getD_eq_getElem _ 0 hu1, ← List.getD_eq_getElem _ 0 ha1]    exact hcd_eq j (by rw [List.length_take] at hj1; omega)
See it in the graphDiscuss this resultChallenge it