Theorem 7. Near-linear matching with a repeated substring
ProvedBackreferenceMatching.theorem_7Given four ordinary regular expressions and a word , decide whether for some , , , and . The two copies of are identical. One uniform word-RAM algorithm, including preprocessing, runs in time for and .
import Definitions.Def_BackreferenceMatching_Algorithms
namespace BackreferenceMatching
theorem theorem_7 (q : ℕ) :
∃ (p : Program) (a c : ℕ), 0 < c ∧
∀ (r : Branch q) (w : Word q),
DecidesWithin p a q (r.code ++ wordCode w) (ABCBD r w)
(2 ^ (c * r.size^2) * (w.length + 1) * (logFactor w.length)^2) := by
sorry
end BackreferenceMatchingRead-back
What the Lean code literally says, in plain math · GPT-6
For every , there are a finite deterministic word-RAM program , a natural number , and a positive integer with the following property. Given any four regular expressions over and any word over , decides whether for some , , , and . It halts within instructions, where counts all syntax nodes in the four expressions, , and .
Both occurrences of must be the same word. Any factor may be empty if its expression accepts the empty word. The target may also be empty, and it is the only possible target when . The entire output is when the factorization exists and otherwise.
For an input of entries the machine uses bits per word. Its writable cells start at zero, and the input supports both sequential and indexed reads. Each executed instruction costs one, including a halt or an exhausted sequential read. Reaching an out-of-range program counter ends execution at no additional cost.
The input concatenates the prefix codes of in that order and then appends the numeric letters of . The respective tags for the empty language, the empty word, a letter, union, concatenation, and star are . A letter tag is followed by its value, and an operator tag is followed by the codes of its operands in order.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.