AFTD Auto-Formalizing Theoretical Domains

alpha_signed_prefix_of_lexical_interval

theoremverified

If two sequences agree in their first i signed cells, and a third is below the first sequence but not below the second in alternating order, then the third also agrees in those first i signed cells, provided the second sequence has at least i cells.

Statement

theorem alpha_signed_prefix_of_lexical_interval (u a c : List ℕ) (i : ℕ) (hc : i ≤ c.length) (hu : alpha_lexical_lt u a) (hn : ¬ alpha_lexical_lt u c) (hac : ∀ j < i, alpha_signed_cell a j = alpha_signed_cell c j) : ∀ j < i, alpha_signed_cell u j = alpha_signed_cell a j
Source
First-difference helper for the lexical route to OP-392, arXiv:2610.24758, using the order in arXiv:0810.5205.
Verified
18 Nov 2026
Axioms
Quot.soundpropext
Built on 2
  • alpha_lexical_ltThe source alternating lexicographic order on positive integer sequences.
  • alpha_signed_cellA cell of a positive sequence, with alternating signs and zero padding.
Used by 1

The proof, explained

The proof proceeds by contradiction on the first index $q$ where $u$ differs from $a$. By definition of alternating lexicographic inequality, $u$ and $a$ agree on all signed cells before $q$ and $u$'s signed cell is strictly smaller at $q$. If $q < i$, then because $a$ and $c$ agree up to index $i$ and $c$ has length at least $i$, $q$ would also witness that $u <_{\mathrm{lex}} c$, contradicting the hypothesis that $u$ is not lexicographically below $c$. Hence $i \le q$, which implies that $u$ and $a$ agree on all indices strictly less than $i$.

  1. Extract the first index $q$ where $u$ differs from $a$.

    Unfolding the assumption $u <_{\mathrm{lex}} a$ (`hu`) yields an index $q < \max(|u|, |a|)$ such that $u$ and $a$ have identical signed cells at all indices $j < q$ (`hprev`), and at index $q$ the signed cell of $u$ is strictly less than that of $a$ (`hlt`).

    line 2

      obtain ⟨q, hq, hprev, hlt⟩ := hu
  2. The first discrepancy between $u$ and $a$ occurs at or after index $i$ ($i \le q$).

    We proceed by contradiction (lines 4–5): suppose $q < i$. Since $i \le |c|$ by assumption (`hc`), linear arithmetic gives $q < |c| \le \max(|u|, |c|)$. For any index $j < q$, we have $j < i$, so the signed cells of $a$ and $c$ match at $j$ (`hac`); since $u$ and $a$ match at $j$ (`hprev`), $u$ and $c$ must also match at $j$ (lines 8–10). Furthermore, because $q < i$, the signed cells of $a$ and $c$ match at $q$ (`hac`), which transfers the inequality $u_q < a_q$ (`hlt`) to $u_q < c_q$ (lines 11–12). Thus $q$ witnesses that $u <_{\mathrm{lex}} c$, which directly contradicts the hypothesis $\neg (u <_{\mathrm{lex}} c)$ (`hn`, line 6). Therefore, $i \le q$.

    lines 3–12

      have hiq : i ≤ q := by
        by_contra H
        have hqi : q < i := by omega
        apply hn
        refine ⟨q, by omega, ?_, ?_⟩
        · intro j hj
          rw [← hac j (by omega)]
          exact hprev j hj
        · rw [← hac q hqi]
          exact hlt
  3. For all $j < i$, the $j$-th signed cell of $u$ equals that of $a$.

    Let $j < i$ (line 13). Since $i \le q$, linear arithmetic ensures $j < q$. The equality of signed cells before $q$ (`hprev`) then implies that the signed cell of $u$ at index $j$ equals that of $a$ (line 14).

    lines 13–14

      intro j hj
      exact hprev j (by omega)

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_signed_prefix_of_lexical_interval (u a c : List ℕ) (i : ℕ) (hc : i ≤ c.length) (hu : alpha_lexical_lt u a) (hn : ¬ alpha_lexical_lt u c) (hac : ∀ j < i, alpha_signed_cell a j = alpha_signed_cell c j) : ∀ j < i, alpha_signed_cell u j = alpha_signed_cell a j := by  obtain ⟨q, hq, hprev, hlt⟩ := hu  have hiq : i ≤ q := by    by_contra H    have hqi : q < i := by omega    apply hn    refine ⟨q, by omega, ?_, ?_⟩    · intro j hj      rw [← hac j (by omega)]      exact hprev j hj    · rw [← hac q hqi]      exact hlt  intro j hj  exact hprev j (by omega)
See it in the graphDiscuss this resultChallenge it