October 2026 · Preprint

Certified upper bounds for the Chvátal–Sankoff constant

Abstract

The expected length of a longest common subsequence of two independent uniformly random binary strings of length n is γ2 n + o(n), where γ2 is the Chvátal–Sankoff constant. Simulations suggest γ2 ≈ 0.8122. In 2009 Lueker obtained the bound γ2 ≤ 0.826280 with a weighted finite automaton that remembers the last h = 8 symbols of each string. We prove γ2 ≤ 0.821963 by the same method with h = 13, where the automaton has about 1.66·1011 reachable states up to symmetry. The proof rests on an explicit vector v > 0 and a number λ < 1 with Av ≤ λv, where A is the weighted transition matrix; a program checks the inequality Av ≤ λv entry by entry, in exact arithmetic. The bound is also proved in the Lean 4 proof assistant.

In plain words

A longest common subsequence of two strings is a longest string that can be read in both by skipping some symbols. The file-comparison program diff is based on longest common subsequences, with lines as symbols. For two random strings of 0s and 1s, each of length n, Chvátal and Sankoff showed in 1975 that the average length of a longest common subsequence, divided by n, approaches a fixed number as n grows. Pushing Lueker’s 2009 method further, this paper proves that the number is at most 0.821963, below the bound 0.824120 obtained by L. Jack in October 2026. The proof assistant Lean has checked the result.

A square grid shaded from white at the top left to dark teal at the bottom right, crossed by thin white staircase lines and sprinkled with small grey dots. A black path runs close to the diagonal from near the top left corner to the bottom right corner, with a yellow dot at each diagonal step and small magenta patches along the path, some of them short bars. Rows of black and white squares run along the top and left edges, and a green square outline, edged in black, sits on the path near the middle, with matching green bars beside the two rows of squares.
Illustration of the canonical decomposition of two random binary strings, A down the left and B across the top. Each cell is shaded by the length of a longest common subsequence of the prefixes that end there. The black path is the canonical traceback, and the magenta patches between its diagonal steps are the minimal match pairs that Lueker's automaton reads one at a time. With history length 12, the automaton keeps only the last 12 symbols that it has read from each string (green square, after the first 24 pairs) and the increments along the last row and column of its own table. It updates these increments from its previous state and the new pair alone, so they need not match the table shown; in this example, one of them differs.

Formal statement and axioms

Each main result as stated in Lean, copied verbatim from the published package, with the axioms that the proof rests on. Lean v4.35.0-rc3, Mathlib c55e6e786f49. The package.

K13TopH13.gamma2_le

γ₂ ≤ 0.821963, kernel-only proof (history length 13)

theorem gamma2_le : gamma2 ≤ 0.821963
Definitions used in the statement
noncomputable def lcsLen (A B : List Bool) : ℕ :=
  sSup {k : ℕ | ∃ s : List Bool, List.Sublist s A ∧ List.Sublist s B ∧ s.length = k}
noncomputable def expLCS (n : ℕ) : ℝ :=
  (∑ A : Fin n → Bool, ∑ B : Fin n → Bool, (lcsLen (List.ofFn A) (List.ofFn B) : ℝ)) / 4 ^ n
noncomputable def gamma2 : ℝ :=
  limUnder atTop fun n : ℕ => expLCS n / n

Source. The generated Lean file is not published, so the statement above is taken from the published script that generates the file.

The package does not record Lean’s axiom report for this theorem, but names the axioms in words: propext, Classical.choice, Quot.sound.

CS31aData.gamma2_le_n13

γ₂ ≤ 0.821963, proof with compiled code (history length 13)

theorem gamma2_le_n13 : gamma2 ≤ 0.821963
Definitions used in the statement
noncomputable def lcsLen (A B : List Bool) : ℕ :=
  sSup {k : ℕ | ∃ s : List Bool, List.Sublist s A ∧ List.Sublist s B ∧ s.length = k}
noncomputable def expLCS (n : ℕ) : ℝ :=
  (∑ A : Fin n → Bool, ∑ B : Fin n → Bool, (lcsLen (List.ofFn A) (List.ofFn B) : ℝ)) / 4 ^ n
noncomputable def gamma2 : ℝ :=
  limUnder atTop fun n : ℕ => expLCS n / n

Source.

The package does not record Lean’s axiom report for this theorem, but names the axioms in words: propext, Classical.choice, Quot.sound and 56 more, for example CS31aData.N13.cert0._native.native_decide.ax_1_1, CS31aData.N13.cert1._native.native_decide.ax_1_1 and CS31aData.N13.cert2._native.native_decide.ax_1_1.

CS31aK.H12.gamma2_le

γ₂ ≤ 0.822579, kernel-only proof (history length 12)

theorem gamma2_le : gamma2 ≤ 0.822579
Definitions used in the statement
noncomputable def lcsLen (A B : List Bool) : ℕ :=
  sSup {k : ℕ | ∃ s : List Bool, List.Sublist s A ∧ List.Sublist s B ∧ s.length = k}
noncomputable def expLCS (n : ℕ) : ℝ :=
  (∑ A : Fin n → Bool, ∑ B : Fin n → Bool, (lcsLen (List.ofFn A) (List.ofFn B) : ℝ)) / 4 ^ n
noncomputable def gamma2 : ℝ :=
  limUnder atTop fun n : ℕ => expLCS n / n

Source. The generated Lean file is not published, so the statement above is taken from the published script that generates the file.

The package does not record Lean’s axiom report for this theorem, but names the axioms in words: propext, Classical.choice, Quot.sound.

4 more formal statements

CS31aData.gamma2_le_h12

γ₂ ≤ 0.822579, proof with compiled code (history length 12)

theorem gamma2_le_h12 : gamma2 ≤ 0.822579
Definitions used in the statement
noncomputable def lcsLen (A B : List Bool) : ℕ :=
  sSup {k : ℕ | ∃ s : List Bool, List.Sublist s A ∧ List.Sublist s B ∧ s.length = k}
noncomputable def expLCS (n : ℕ) : ℝ :=
  (∑ A : Fin n → Bool, ∑ B : Fin n → Bool, (lcsLen (List.ofFn A) (List.ofFn B) : ℝ)) / 4 ^ n
noncomputable def gamma2 : ℝ :=
  limUnder atTop fun n : ℕ => expLCS n / n

Source.

The package does not record Lean’s axiom report for this theorem, but names the axioms in words: propext, Classical.choice, Quot.sound and 7 more, for example CS31aData.H12.cert0._native.native_decide.ax_1_1, CS31aData.H12.cert1._native.native_decide.ax_1_1 and CS31aData.H12.cert2._native.native_decide.ax_1_1.

CS31aK.H11.gamma2_le

γ₂ ≤ 0.823290, kernel-only proof (history length 11)

theorem gamma2_le : gamma2 ≤ 0.823290
Definitions used in the statement
noncomputable def lcsLen (A B : List Bool) : ℕ :=
  sSup {k : ℕ | ∃ s : List Bool, List.Sublist s A ∧ List.Sublist s B ∧ s.length = k}
noncomputable def expLCS (n : ℕ) : ℝ :=
  (∑ A : Fin n → Bool, ∑ B : Fin n → Bool, (lcsLen (List.ofFn A) (List.ofFn B) : ℝ)) / 4 ^ n
noncomputable def gamma2 : ℝ :=
  limUnder atTop fun n : ℕ => expLCS n / n

Source. The generated Lean file is not published, so the statement above is taken from the published script that generates the file.

The package does not record Lean’s axiom report for this theorem, but names the axioms in words: propext, Classical.choice, Quot.sound.

CS31aK.H10.gamma2_le

γ₂ ≤ 0.824120, kernel-only proof (history length 10)

theorem gamma2_le : gamma2 ≤ 0.824120
Definitions used in the statement
noncomputable def lcsLen (A B : List Bool) : ℕ :=
  sSup {k : ℕ | ∃ s : List Bool, List.Sublist s A ∧ List.Sublist s B ∧ s.length = k}
noncomputable def expLCS (n : ℕ) : ℝ :=
  (∑ A : Fin n → Bool, ∑ B : Fin n → Bool, (lcsLen (List.ofFn A) (List.ofFn B) : ℝ)) / 4 ^ n
noncomputable def gamma2 : ℝ :=
  limUnder atTop fun n : ℕ => expLCS n / n

Source. The generated Lean file is not published, so the statement above is taken from the published script that generates the file.

The package does not record Lean’s axiom report for this theorem, but names the axioms in words: propext, Classical.choice, Quot.sound.

CS31aK.H9.gamma2_le

γ₂ ≤ 0.825101, kernel-only proof (history length 9)

theorem gamma2_le : gamma2 ≤ 0.825101
Definitions used in the statement
noncomputable def lcsLen (A B : List Bool) : ℕ :=
  sSup {k : ℕ | ∃ s : List Bool, List.Sublist s A ∧ List.Sublist s B ∧ s.length = k}
noncomputable def expLCS (n : ℕ) : ℝ :=
  (∑ A : Fin n → Bool, ∑ B : Fin n → Bool, (lcsLen (List.ofFn A) (List.ofFn B) : ℝ)) / 4 ^ n
noncomputable def gamma2 : ℝ :=
  limUnder atTop fun n : ℕ => expLCS n / n

Source. The generated Lean file is not published, so the statement above is taken from the published script that generates the file.

The package does not record Lean’s axiom report for this theorem, but names the axioms in words: propext, Classical.choice, Quot.sound.