has_common_subsequence_zero
Any two vectors of length $n$ have the empty sequence as a common subsequence of length 0.
Statement
lemma has_common_subsequence_zero {n : ℕ} {α : Type*} (u v : Fin n → α) : has_common_subsequence u v 0
- Source
- arXiv:2611.21275 Section II-B
- Verified
- 19 Nov 2026
- Axioms
propext- Built on 3
- has_common_subsequenceTwo vectors $u, v \in \alpha^n$ have a common subsequence of length $l$ if there exist strictly increasing index sequences…
- LinearOrder.toTotalPreorderEvery
LinearOrderis aTotalPreorder. - TotalPreorderA total preorder: a preorder where
≤is total (complete). This is weaker thanLinearOrder— it does NOT require antisymmetry or…
Read back from the Lean
For any natural number n, any type α, and any functions u, v : Fin n → α, u and v have a common subsequence of length 0 (i.e., has_common_subsequence u v 0).
Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.
The proof, explained
The theorem is proved by choosing the unique empty map from `Fin 0` to `Fin n` as the index embedding for both vectors. The three conditions required for a common subsequence—strict monotonicity of each index map and agreement of the vector components—then hold vacuously because `Fin 0` is uninhabited.
We provide the empty map from `Fin 0` to `Fin n` for both index embeddings.
By definition, a common subsequence of length 0 requires two index embeddings $i, j : \text{Fin } 0 \to \text{Fin } n$ that are strictly monotone and satisfy $u(i(t)) = v(j(t))$ for all $t$. We choose both $i$ and $j$ to be the empty function mapping $t \in \text{Fin } 0$ via `Fin.elim0 t`, leaving the three conditions to be verified.
uses
Fin.elim0refine ⟨fun t => Fin.elim0 t, fun t => Fin.elim0 t, ?_, ?_, ?_⟩
The first index map is strictly monotone.
Assuming there exist $a, b \in \text{Fin } 0$ with $a < b$, we derive the required inequality vacuously using `Fin.elim0 a`, since the type `Fin 0` has no elements.
uses
Fin.elim0· intro a b hab exact Fin.elim0 a
The second index map is strictly monotone.
Similarly, assuming $a, b \in \text{Fin } 0$ with $a < b$, `Fin.elim0 a` closes the goal vacuously.
uses
Fin.elim0· intro a b hab exact Fin.elim0 a
The entries of $u$ and $v$ agree along the chosen indices.
For any index $t \in \text{Fin } 0$, we must show $u(i(t)) = v(j(t))$. Since `Fin 0` is empty, `Fin.elim0 t` completes the proof vacuously.
uses
Fin.elim0· intro t exact Fin.elim0 t
Fin.elim0- Given an element of the empty type `Fin 0`, produces a term of any requested type (ex falso quodlibet for `Fin 0`).
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
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
/-- Any two words have a common subsequence of length 0. -/lemma has_common_subsequence_zero {n : ℕ} {α : Type*} (u v : Fin n → α) : has_common_subsequence u v 0 := by refine ⟨fun t => Fin.elim0 t, fun t => Fin.elim0 t, ?_, ?_, ?_⟩ · intro a b hab exact Fin.elim0 a · intro a b hab exact Fin.elim0 a · intro t exact Fin.elim0 t