Expected running time and the triangle-detection hypothesis
DefinitionBackreferenceMatching_ExpectedTimeA randomized word RAM may draw an independent uniform word in one instruction. It decides a problem in expected time if all halting outputs give the correct answer and the expected instruction count up to every finite horizon is at most .
The triangle hypothesis asserts a positive exponent gap above linear in the number of edges of a simple undirected graph. Word length is logarithmic in the vertex count. An analogous decision predicate measures the expected time for matching a fixed expression as a function of the input word length.
import Definitions.Def_BackreferenceMatching_Hardness
namespace BackreferenceMatching
open Lax808846.Ram
inductive RandomInstr where
| ordinary (i : Instr)
| draw (cell : ℕ)
abbrev RandomProgram := List RandomInstr
def randomStep (p : RandomProgram) (bits : ℕ) (s : State) (b : Fin (2^bits)) :
Option State :=
match p[s.pc]? with
| none => none
| some (.ordinary i) => i.effect bits s
| some (.draw cell) => some { s with pc := s.pc + 1, mem := setCell bits s.mem cell b.val }
inductive RandomReach (p : RandomProgram) (bits : ℕ) (input : List ℕ) : State → Prop where
| start : RandomReach p bits input (initState input)
| next {s u : State} (h : RandomReach p bits input s) (b : Fin (2^bits))
(hstep : randomStep p bits s b = some u) : RandomReach p bits input u
/-- Expected number of instructions executed up to a finite horizon. -/
noncomputable def truncatedTime (p : RandomProgram) (bits : ℕ) : ℕ → State → ℝ
| 0, _ => 0
| h + 1, s =>
match p[s.pc]? with
| none => 0
| some (.ordinary i) =>
1 + (i.effect bits s).elim 0 (truncatedTime p bits h)
| some (.draw cell) =>
1 + (∑ b : Fin (2^bits), truncatedTime p bits h
{ s with pc := s.pc + 1, mem := setCell bits s.mem cell b.val }) / (2 : ℝ)^bits
def ExpectedDecision (p : RandomProgram) (bits : ℕ) (input : List ℕ) (claim : Prop)
(budget : ℝ) : Prop :=
(∀ (s : State), RandomReach p bits input s →
(∃ b : Fin (2^bits), randomStep p bits s b = none) → CorrectBit claim s.out) ∧
∀ h, truncatedTime p bits h (initState input) ≤ budget
def ExpectedTriangleAlgorithm (exponent : ℝ) : Prop :=
∃ (p : RandomProgram) (a c : ℕ), ∀ g : InputGraph,
ExpectedDecision p (wordBits a (g.vertices + 8)) g.code g.hasTriangle
(c * ((g.edges.length : ℝ) + 2)^exponent)
def TriangleHypothesis : Prop :=
∃ δ : ℝ, 0 < δ ∧ ∀ ε : ℝ, 0 < ε → ¬ ExpectedTriangleAlgorithm (1 + δ - ε)
def ExpectedFixedAlgorithm {q : ℕ} (e : Expr q) (exponent : ℝ) : Prop :=
∃ (p : RandomProgram) (a c : ℕ), ∀ w : Word q,
ExpectedDecision p (wordBits a (w.length + q + 8)) (wordCode w) (Matches e w)
(c * ((w.length : ℝ) + 2)^exponent)
end BackreferenceMatchingRead-back
What the Lean code literally says, in plain math · GPT-6
A randomized -bit word RAM has a finite program of ordinary instructions and draws, for . Each draw writes a fresh uniform word from to its specified cell, addressed modulo , and advances the counter. Initially the counter and memory are zero, output is empty, and the supplied list is both the original input array and the unread tape. The reachable states are exactly those obtained from initialization by finitely many successful steps with arbitrary draw results.
For a state , the expected instruction count at horizon zero is . At horizon an out-of-range counter costs zero. Every fetched instruction costs one, including a halt or a read from an exhausted tape. A continuing ordinary instruction adds at its successor, and a draw adds the mean of over all choices. Deciding a proposition within a real budget requires from the initial state at every finite horizon. Every reachable halt must have exactly the output for true or for false.
Write . For a real exponent , a triangle algorithm consists of one program and deciding, on every finite simple undirected graph, whether it contains three pairwise adjacent vertices. Input lists the vertex and edge counts followed by its edges in list order, each a distinct pair with . The width is and the budget is . The triangle hypothesis asserts that some real rules out such an algorithm at for every real .
For any natural alphabet size , fixed regular expression with captures and backreferences and real exponent , a matching algorithm consists of one program and deciding every word over the symbols, including the empty word. A length- input lists its symbol indices at width and budget . A word matches if there are a final valuation and a read count for which a complete derivation consumes it from initially empty variables. A capture stores its body's matched word, and a read consumes the current stored word.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.