Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

P versus NP: audited encodings and tableau frontier

Definition
PvsNPFrontier

by alexcarter · Sep 12, 2026 · Mathlib 0df444a (Lean v4.33.1)

complexity-theoryformalizationp-vs-np

Fixed Boolean languages, complement classes, finite-alphabet normalization predicates, canonical CNF parsing, sparse assignment verification, explicit local tableau constraints and intermediate encoding, and same-model EXPTIME. None of these definitions asserts its own correctness or polynomial efficiency.

Definition code
import Definitions.Def_PvsNP

namespace PvsNP

abbrev DecisionProblem := Language Bool

def inputLength (w : Str) : ℕ := w.length

def PolynomialBound (t : ℕ → ℕ) : Prop :=
  ∃ p : Polynomial ℕ, ∀ n, t n ≤ p.eval n

def coP : Set DecisionProblem := {L | Lᶜ ∈ P}

def coNP : Set DecisionProblem := {L | Lᶜ ∈ NP}

def NPHard (L : DecisionProblem) : Prop := ∀ A ∈ NP, PReducible A L

def FiniteWorkAlphabets (M : Turing.FinTM2) : Prop :=
  ∀ k, Finite (M.Γ k)

def FinitePolyTime {α β U V : Type} (ei : α → List U) (eo : β → List V)
    (f : α → β) : Prop :=
  ∃ M : Turing.TM2ComputableInPolyTime ei eo f, FiniteWorkAlphabets M.tm

def parseData : ℕ → Str → Option (Str × Str)
  | 0, _ => none
  | _ + 1, true :: false :: rest => some ([], rest)
  | fuel + 1, false :: b :: rest =>
      (parseData fuel rest).map fun p => (b :: p.1, p.2)
  | _ + 1, _ => none

def bitsValue : Str → ℕ
  | [] => 0
  | b :: rest => Nat.bit b (bitsValue rest)

def parseLiteral (w : Str) : Option (Literal × Str) :=
  match w with
  | false :: sign :: rest =>
      (parseData (rest.length + 1) rest).bind fun p =>
        let i := bitsValue p.1
        if Nat.bits i = p.1 then some ((sign, i), p.2) else none
  | _ => none

def parseClauseAux : ℕ → Str → Option (Clause × Str)
  | 0, _ => none
  | _ + 1, true :: true :: rest => some ([], rest)
  | fuel + 1, w =>
      (parseLiteral w).bind fun p =>
        (parseClauseAux fuel p.2).map fun q => (p.1 :: q.1, q.2)

def parseCNFAux : ℕ → Str → Option CNF
  | _, [] => some []
  | 0, _ :: _ => none
  | fuel + 1, w@(_ :: _) =>
      (parseClauseAux (w.length + 1) w).bind fun p =>
        (parseCNFAux fuel p.2).map (p.1 :: ·)

def parseCNF (w : Str) : Option CNF := parseCNFAux (w.length + 1) w

def variableNames (F : CNF) : List ℕ := (F.flatten.map Prod.snd).eraseDups

def certificateAssignment (F : CNF) (y : Str) (i : ℕ) : Bool :=
  (((variableNames F).zip y).lookup i).getD false

def satVerifier (wy : Str × Str) : Bool :=
  match parseCNF wy.1 with
  | none => false
  | some F =>
      if wy.2.length = (variableNames F).length then
        evalCNF (certificateAssignment F wy.2) F
      else false

structure TableauSpec where
  steps : ℕ
  interior : ℕ
  symbols : ℕ
  initialAllowed : List (List ℕ)
  acceptingSymbols : List ℕ
  allowedWindows : List (List ℕ)

def tableauWidth (S : TableauSpec) : ℕ := S.interior + 2

def tableauAlphabet (S : TableauSpec) : ℕ := S.symbols + 1

def tableauVar (S : TableauSpec) (t c a : ℕ) : ℕ :=
  (t * tableauWidth S + c) * tableauAlphabet S + a

def cellClauses (S : TableauSpec) (t c : ℕ) : CNF :=
  let as := List.range (tableauAlphabet S)
  [as.map fun a => (true, tableauVar S t c a)] ++
    as.flatMap fun a =>
      (as.filter fun b => a < b).map fun b =>
        [(false, tableauVar S t c a), (false, tableauVar S t c b)]

def cellsCNF (S : TableauSpec) : CNF :=
  (List.range (S.steps + 1)).flatMap fun t =>
    (List.range (tableauWidth S)).flatMap fun c => cellClauses S t c

def initialCNF (S : TableauSpec) : CNF :=
  (List.range (tableauWidth S)).flatMap fun c =>
    ((List.range (tableauAlphabet S)).filter fun a =>
      !(S.initialAllowed[c]?.getD []).contains a).map fun a =>
        [(false, tableauVar S 0 c a)]

def boundaryCNF (S : TableauSpec) : CNF :=
  (List.range (S.steps + 1)).flatMap fun t =>
    [[(true, tableauVar S t 0 0)],
     [(true, tableauVar S t (S.interior + 1) 0)]]

def acceptingCNF (S : TableauSpec) : CNF :=
  [(List.range (tableauWidth S)).flatMap fun c =>
    ((List.range (tableauAlphabet S)).filter fun a =>
      S.acceptingSymbols.contains a).map fun a =>
        (true, tableauVar S S.steps c a)]

def wordsOfLength (alphabet : ℕ) : ℕ → List (List ℕ)
  | 0 => [[]]
  | n + 1 => (List.range alphabet).flatMap fun a =>
      (wordsOfLength alphabet n).map (a :: ·)

def windowValues (T : ℕ → ℕ → ℕ) (t c : ℕ) : List ℕ :=
  [T t c, T t (c+1), T t (c+2),
   T (t+1) c, T (t+1) (c+1), T (t+1) (c+2)]

def forbiddenWindowClause (S : TableauSpec) (t c : ℕ) (v : List ℕ) : Clause :=
  [(t,c), (t,c+1), (t,c+2), (t+1,c), (t+1,c+1), (t+1,c+2)].zipWith
    (fun pos a => (false, tableauVar S pos.1 pos.2 a)) v

def transitionCNF (S : TableauSpec) : CNF :=
  (List.range S.steps).flatMap fun t =>
    (List.range S.interior).flatMap fun c =>
      ((wordsOfLength (tableauAlphabet S) 6).filter fun v =>
        !S.allowedWindows.contains v).map (forbiddenWindowClause S t c)

def tableauCNF (S : TableauSpec) : CNF :=
  cellsCNF S ++ initialCNF S ++ boundaryCNF S ++
    acceptingCNF S ++ transitionCNF S

def TableauEncoding (S : TableauSpec) (τ : ℕ → Bool) (T : ℕ → ℕ → ℕ) : Prop :=
  (∀ t ≤ S.steps, ∀ c < tableauWidth S, T t c < tableauAlphabet S) ∧
  ∀ t ≤ S.steps, ∀ c < tableauWidth S, ∀ a < tableauAlphabet S,
    τ (tableauVar S t c a) = true ↔ T t c = a

def ValidTableau (S : TableauSpec) (T : ℕ → ℕ → ℕ) : Prop :=
  (∀ t ≤ S.steps, ∀ c < tableauWidth S, T t c < tableauAlphabet S) ∧
  (∀ c < tableauWidth S, T 0 c ∈ (S.initialAllowed[c]?.getD [])) ∧
  (∀ t ≤ S.steps, T t 0 = 0 ∧ T t (S.interior + 1) = 0) ∧
  (∃ c < tableauWidth S, T S.steps c ∈ S.acceptingSymbols) ∧
  (∀ t < S.steps, ∀ c < S.interior,
    windowValues T t c ∈ S.allowedWindows)

def encodeTableauSpec (S : TableauSpec) : Str :=
  encodeCNF
    ([List.replicate S.steps (true, 0), List.replicate S.interior (true, 0),
      List.replicate S.symbols (true, 0),
      List.replicate S.initialAllowed.length (true, 0)] ++
     S.initialAllowed.map (fun xs => xs.map (fun a => (true, a))) ++
     [S.acceptingSymbols.map (fun a => (true, a))] ++
     S.allowedWindows.map (fun xs => xs.map (fun a => (true, a))))

def MachineTableauSpec (S : TableauSpec) : Prop :=
  0 < S.steps ∧ 0 < S.interior ∧ 0 ∉ S.acceptingSymbols ∧
  S.initialAllowed.length = tableauWidth S ∧
  (∀ xs ∈ S.initialAllowed, ∀ a ∈ xs, a < tableauAlphabet S) ∧
  (∀ a ∈ S.acceptingSymbols, a < tableauAlphabet S) ∧
  (∀ xs ∈ S.allowedWindows, xs.length = 6 ∧ ∀ a ∈ xs, a < tableauAlphabet S)

def EXPTIME : Set DecisionProblem :=
  {L | ∃ χ : Str → Bool,
    (∃ M : Turing.TM2ComputableInTime (id : Str → Str) Computability.encodeBool χ,
      ∃ p : Polynomial ℕ, ∀ n, M.time n ≤ 2 ^ p.eval n) ∧
    ∀ w, w ∈ L ↔ χ w = true}

end PvsNP
Source
Mathlib exact revision 0df444a360eaa60ab8c11dca51a86af692955474, Mathlib/Computability/TuringMachine/Computable.lean and StackTuringMachine.lean; https://github.com/leanprover-community/mathlib4/blob/0df444a360eaa60ab8c11dca51a86af692955474/Mathlib/Computability/TuringMachine/Computable.lean; Sipser, Introduction to the Theory of Computation, second edition (2006), Theorem 7.37 and its proof pp. 276–281, Figures 7.38–7.40, Claim 7.41; https://users.math.cas.cz/~jerabek/teaching/mathlog/sipser-book.pdf; see the draft model audit for exact implementation differences.
Read-back

What the Lean code literally says, in plain math · gpt-6-astra

PvsNP.DecisionProblem

A decision problem is a language over the Boolean alphabet, that is, an arbitrary set L⊆B∗L\subseteq B^*L⊆B∗ of finite Boolean lists, with no decidability, finiteness, or complexity requirement. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length.

PvsNP.inputLength

For every finite Boolean list www, its input length is defined to be ∣w∣|w|∣w∣, the number of list entries; in particular the empty list has input length zero. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length.

PvsNP.PolynomialBound

For any function t:N→Nt:\mathbb N\to\mathbb Nt:N→N, having a polynomial bound means that there exists a polynomial ppp with natural-number coefficients such that ∀n∈N, t(n)≤p(n)\forall n\in\mathbb N,\ t(n)\le p(n)∀n∈N, t(n)≤p(n). The inequality is non-strict, includes n=0n=0n=0, and is required for all inputs rather than only eventually; constant and zero polynomials are permitted.

PvsNP.coP

The set coPcoPcoP consists of all languages L⊆B∗L\subseteq B^*L⊆B∗ whose complement B∗∖LB^*\setminus LB∗∖L belongs to PPP; equivalently there exists χ:B∗→B\chi:B^*\to Bχ:B∗→B satisfying D(χ)D(\chi)D(χ) and ∀w, w∉L ⟺ χ(w)=true\forall w,\ w\notin L\ \Longleftrightarrow\ \chi(w)=\mathrm{true}∀w, w∈/L ⟺ χ(w)=true. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length. Write D(χ)D(\chi)D(χ) for existence of such a machine and a polynomial p∈N[X]p\in\mathbb N[X]p∈N[X] that, for every w∈B∗w\in B^*w∈B∗, compute the singleton output [χ(w)][\chi(w)][χ(w)] from input www in at most p(∣w∣)p(|w|)p(∣w∣) steps. A machine in these assertions is a Mathlib TM2 stack machine with finitely many stack indices, instruction labels, and control states, a finite input-stack alphabet, designated input and output stacks, a program, and initial label and control state; its other stack alphabets need not be finite. Input and output alphabet bijections transport the specified encoded lists to the corresponding stack alphabets. Computation starts with only the input stack populated, and reaches a halted configuration with the specified output on the output stack, all other stacks empty, and the control state reset to its initial value. Time counts executions of whole TM2 statements, each of which may contain several stack operations.

PvsNP.coNP

The set coNPcoNPcoNP consists of all languages L⊆B∗L\subseteq B^*L⊆B∗ for which there exist R:B∗×B∗→BR:B^*\times B^*\to BR:B∗×B∗→B and k∈Nk\in\mathbb Nk∈N satisfying C(R)C(R)C(R) and ∀w, w∉L ⟺ ∃y∈B∗, ∣y∣≤∣w∣k∧R(w,y)=true\forall w,\ w\notin L\ \Longleftrightarrow\ \exists y\in B^*,\ |y|\le |w|^k\land R(w,y)=\mathrm{true}∀w, w∈/L ⟺ ∃y∈B∗, ∣y∣≤∣w∣k∧R(w,y)=true. Thus the complement is taken within all finite Boolean lists, including malformed encodings for any separate encoding scheme; 00=10^0=100=1 and 0k=00^k=00k=0 for k>0k>0k>0. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length. Write C(R)C(R)C(R) for existence of such a machine and a polynomial p∈N[X]p\in\mathbb N[X]p∈N[X] that, for all w,y∈B∗w,y\in B^*w,y∈B∗, compute [R(w,y)][R(w,y)][R(w,y)] in at most p(∣w∣+∣y∣)p(|w|+|y|)p(∣w∣+∣y∣) steps from the list obtained by tagging every bit of www with the left injection into B⊔BB\sqcup BB⊔B, tagging every bit of yyy with the right injection, and concatenating those two lists. A machine in these assertions is a Mathlib TM2 stack machine with finitely many stack indices, instruction labels, and control states, a finite input-stack alphabet, designated input and output stacks, a program, and initial label and control state; its other stack alphabets need not be finite. Input and output alphabet bijections transport the specified encoded lists to the corresponding stack alphabets. Computation starts with only the input stack populated, and reaches a halted configuration with the specified output on the output stack, all other stacks empty, and the control state reset to its initial value. Time counts executions of whole TM2 statements, each of which may contain several stack operations.

PvsNP.NPHard

For every language L⊆B∗L\subseteq B^*L⊆B∗, being NP-hard is defined to mean ∀A⊆B∗, A∈NP ⟹ A⪯L\forall A\subseteq B^*,\ A\in NP\ \Longrightarrow\ A\preceq L∀A⊆B∗, A∈NP ⟹ A⪯L; the definition does not additionally require L∈NPL\in NPL∈NP. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length. The set NPNPNP consists exactly of languages L⊆B∗L\subseteq B^*L⊆B∗ for which there exist R:B∗×B∗→BR:B^*\times B^*\to BR:B∗×B∗→B and k∈Nk\in\mathbb Nk∈N satisfying C(R)C(R)C(R) and ∀w∈B∗, w∈L ⟺ ∃y∈B∗, ∣y∣≤∣w∣k ∧ R(w,y)=true\forall w\in B^*,\ w\in L\ \Longleftrightarrow\ \exists y\in B^*,\ |y|\le |w|^k\ \land\ R(w,y)=\mathrm{true}∀w∈B∗, w∈L ⟺ ∃y∈B∗, ∣y∣≤∣w∣k ∧ R(w,y)=true. This includes k=0k=0k=0 and empty input: 00=10^0=100=1, whereas 0k=00^k=00k=0 for k>0k>0k>0. Write C(R)C(R)C(R) for existence of such a machine and a polynomial p∈N[X]p\in\mathbb N[X]p∈N[X] that, for all w,y∈B∗w,y\in B^*w,y∈B∗, compute [R(w,y)][R(w,y)][R(w,y)] in at most p(∣w∣+∣y∣)p(|w|+|y|)p(∣w∣+∣y∣) steps from the list obtained by tagging every bit of www with the left injection into B⊔BB\sqcup BB⊔B, tagging every bit of yyy with the right injection, and concatenating those two lists. For languages A,B0⊆B∗A,B_0\subseteq B^*A,B0​⊆B∗, write A⪯B0A\preceq B_0A⪯B0​ to mean that there exists f:B∗→B∗f:B^*\to B^*f:B∗→B∗ satisfying F(f)F(f)F(f) and ∀w∈B∗, w∈A ⟺ f(w)∈B0\forall w\in B^*,\ w\in A\ \Longleftrightarrow\ f(w)\in B_0∀w∈B∗, w∈A ⟺ f(w)∈B0​. Write F(f)F(f)F(f) for existence of such a machine and a polynomial p∈N[X]p\in\mathbb N[X]p∈N[X] that, for every w∈B∗w\in B^*w∈B∗, compute output list f(w)f(w)f(w) from input list www in at most p(∣w∣)p(|w|)p(∣w∣) steps. Different existential computation witnesses may use different machines and polynomials. A machine in these assertions is a Mathlib TM2 stack machine with finitely many stack indices, instruction labels, and control states, a finite input-stack alphabet, designated input and output stacks, a program, and initial label and control state; its other stack alphabets need not be finite. Input and output alphabet bijections transport the specified encoded lists to the corresponding stack alphabets. Computation starts with only the input stack populated, and reaches a halted configuration with the specified output on the output stack, all other stacks empty, and the control state reset to its initial value. Time counts executions of whole TM2 statements, each of which may contain several stack operations.

PvsNP.FiniteWorkAlphabets

For every machine MMM, having finite work alphabets is defined to mean ∀k∈K, Γk\forall k\in K,\ \Gamma_k∀k∈K, Γk​ is a finite type. This quantifies over every stack, including the designated input and output stacks, and asks for propositional finiteness rather than a supplied enumeration. Here MMM is a TM2 machine with a finite type KKK of stack indices and decidable equality on KKK, designated input and output indices k0,k1k_0,k_1k0​,k1​, stack-symbol types Γk\Gamma_kΓk​, a finite type Λ\LambdaΛ of program labels with a main label, a finite type σ\sigmaσ of control states with an initial state, a finite input alphabet Γk0\Gamma_{k_0}Γk0​​, and a statement m(ℓ)m(\ell)m(ℓ) for each label ℓ∈Λ\ell\in\Lambdaℓ∈Λ. No finiteness of Γk\Gamma_kΓk​ for other kkk is assumed. A tagged symbol (k,a)(k,a)(k,a) has k∈Kk\in Kk∈K and a∈Γka\in\Gamma_ka∈Γk​; tags from different stacks remain distinct.

PvsNP.FinitePolyTime

For arbitrary types α,β,U,V\alpha,\beta,U,Vα,β,U,V, arbitrary maps ei:α→U∗e_i:\alpha\to U^*ei​:α→U∗ and eo:β→V∗e_o:\beta\to V^*eo​:β→V∗, and arbitrary f:α→βf:\alpha\to\betaf:α→β, finite-alphabet polynomial-time computability is defined to mean that there exists a machine with input and output alphabet bijections to U,VU,VU,V and a polynomial p∈N[X]p\in\mathbb N[X]p∈N[X] such that, for every a∈αa\in\alphaa∈α, it computes the encoded output eo(f(a))e_o(f(a))eo​(f(a)) from encoded input ei(a)e_i(a)ei​(a) in at most p(∣ei(a)∣)p(|e_i(a)|)p(∣ei​(a)∣) steps, and every stack alphabet of that machine is finite. The encodings are not assumed injective and the domain types are not assumed nonempty; the input/output alphabet bijections and the finiteness requirements still apply if no inputs exist. A machine in these assertions is a Mathlib TM2 stack machine with finitely many stack indices, instruction labels, and control states, a finite input-stack alphabet, designated input and output stacks, a program, and initial label and control state; its other stack alphabets need not be finite. Input and output alphabet bijections transport the specified encoded lists to the corresponding stack alphabets. Computation starts with only the input stack populated, and reaches a halted configuration with the specified output on the output stack, all other stacks empty, and the control state reset to its initial value. Time counts executions of whole TM2 statements, each of which may contain several stack operations.

PvsNP.parseData

For any fuel f∈Nf\in\mathbb Nf∈N and Boolean word www, this partial parser returns either failure or a pair of Boolean words. At fuel zero it fails on every input. At positive fuel, an initial [true,false][\mathrm{true},\mathrm{false}][true,false] is consumed and yields the empty decoded word paired with the suffix. Otherwise an initial [false,b][\mathrm{false},b][false,b] is consumed, the suffix is parsed with fuel decreased by one, and on success bbb is prepended to the returned decoded word while the returned suffix is kept. Every other input shape fails, as does any recursive failure. Thus a terminating delimiter must be reached while fuel is positive; an empty or one-bit input fails. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length.

PvsNP.bitsValue

The value of a finite Boolean digit list is defined recursively by value⁡([])=0\operatorname{value}([])=0value([])=0 and value⁡(b::u)=2value⁡(u)+1b=true\operatorname{value}(b::u)=2\operatorname{value}(u)+\mathbf 1_{b=\mathrm{true}}value(b::u)=2value(u)+1b=true​. Equivalently, for digits b0,…,bm−1b_0,\ldots,b_{m-1}b0​,…,bm−1​ it is ∑j=0m−11bj=true2j\sum_{j=0}^{m-1}\mathbf 1_{b_j=\mathrm{true}}2^j∑j=0m−1​1bj​=true​2j, so the least significant digit comes first. This definition accepts noncanonical lists as well: appending false high digits does not change the value. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length.

PvsNP.parseLiteral

For any Boolean word www, literal parsing fails unless w=[false,b]w=[\mathrm{false},b]w=[false,b] followed by a suffix rrr. It then parses a digit sequence from rrr with fuel ∣r∣+1|r|+1∣r∣+1: at zero fuel fail; with positive fuel consume [true,false][\mathrm{true},\mathrm{false}][true,false] as the terminator, or consume [false,d][\mathrm{false},d][false,d] as the next digit and continue with one less fuel; all other shapes and recursive failures fail. If the decoded digit list is uuu and the remaining suffix is zzz, let j=∑h<∣u∣1uh=true2hj=\sum_{h<|u|}\mathbf 1_{u_h=\mathrm{true}}2^hj=∑h<∣u∣​1uh​=true​2h. Parsing succeeds with ((b,j),z)((b,j),z)((b,j),z) exactly when uuu is the canonical little-endian binary digit list of jjj; otherwise it fails. The canonical digit list for zero is empty, so extra false high digits are rejected. No condition is placed on the suffix zzz. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length.

PvsNP.parseClauseAux

For any natural fuel and Boolean input word, this partial clause parser fails at zero fuel, including on an empty input or a clause delimiter. With positive fuel, a leading [true,true][\mathrm{true},\mathrm{true}][true,true] returns the empty clause and the suffix after that pair. In every other case it parses a literal by the procedure described here; after success with literal lll and suffix zzz, it parses the remainder of the clause from zzz with fuel decreased by one and, on success, prepends lll to the resulting clause and retains the resulting suffix. Any failure propagates. The returned clause is a list of sign/index pairs and the suffix is unconstrained. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length. The parser parse⁡(w)\operatorname{parse}(w)parse(w) works as follows. Its outer recursion starts with fuel ∣w∣+1|w|+1∣w∣+1, returns the empty formula on an empty remainder even at fuel zero, and otherwise fails at fuel zero; with positive fuel it parses one clause from the current nonempty remainder using clause fuel equal to that remainder’s length plus one, then recurses on the returned suffix with outer fuel reduced by one. Clause parsing fails at fuel zero; with positive fuel it consumes [true,true][\mathrm{true},\mathrm{true}][true,true] as the end of an empty remaining clause, or parses one literal and recurses on its suffix with clause fuel reduced by one. Literal parsing requires an initial pair [false,b][\mathrm{false},b][false,b] for the sign. On the remainder rrr it starts data fuel ∣r∣+1|r|+1∣r∣+1: zero data fuel fails; with positive data fuel [true,false][\mathrm{true},\mathrm{false}][true,false] ends the digit sequence, while [false,d][\mathrm{false},d][false,d] contributes digit ddd and decreases fuel by one; all other cases fail. The collected digits are interpreted little-endian and accepted only if they equal the canonical binary digits of the resulting natural number. A parsed literal is that sign/index pair together with the suffix after its delimiter; any failed subparse makes the containing parse fail. Success of the outer parse requires consuming the complete input.

PvsNP.parseCNFAux

For every natural fuel and Boolean input word, this partial formula parser returns the empty formula on the empty input regardless of fuel, fails on nonempty input at zero fuel, and at positive fuel on a nonempty word www parses a clause with fuel ∣w∣+1|w|+1∣w∣+1, then parses the returned suffix with outer fuel decreased by one. If both succeed, it prepends the parsed clause to the returned formula; otherwise it fails. Consequently there is no unconsumed suffix in a successful result, and at most the supplied number of clauses can be parsed from a nonempty input. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length. The parser parse⁡(w)\operatorname{parse}(w)parse(w) works as follows. Its outer recursion starts with fuel ∣w∣+1|w|+1∣w∣+1, returns the empty formula on an empty remainder even at fuel zero, and otherwise fails at fuel zero; with positive fuel it parses one clause from the current nonempty remainder using clause fuel equal to that remainder’s length plus one, then recurses on the returned suffix with outer fuel reduced by one. Clause parsing fails at fuel zero; with positive fuel it consumes [true,true][\mathrm{true},\mathrm{true}][true,true] as the end of an empty remaining clause, or parses one literal and recurses on its suffix with clause fuel reduced by one. Literal parsing requires an initial pair [false,b][\mathrm{false},b][false,b] for the sign. On the remainder rrr it starts data fuel ∣r∣+1|r|+1∣r∣+1: zero data fuel fails; with positive data fuel [true,false][\mathrm{true},\mathrm{false}][true,false] ends the digit sequence, while [false,d][\mathrm{false},d][false,d] contributes digit ddd and decreases fuel by one; all other cases fail. The collected digits are interpreted little-endian and accepted only if they equal the canonical binary digits of the resulting natural number. A parsed literal is that sign/index pair together with the suffix after its delimiter; any failed subparse makes the containing parse fail. Success of the outer parse requires consuming the complete input.

PvsNP.parseCNF

For every Boolean word www, this formula parser is the outer parsing procedure described here, initialized with fuel ∣w∣+1|w|+1∣w∣+1; it returns either a list of clauses of sign/index literals or failure. In particular it returns the empty formula on the empty word. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length. The parser parse⁡(w)\operatorname{parse}(w)parse(w) works as follows. Its outer recursion starts with fuel ∣w∣+1|w|+1∣w∣+1, returns the empty formula on an empty remainder even at fuel zero, and otherwise fails at fuel zero; with positive fuel it parses one clause from the current nonempty remainder using clause fuel equal to that remainder’s length plus one, then recurses on the returned suffix with outer fuel reduced by one. Clause parsing fails at fuel zero; with positive fuel it consumes [true,true][\mathrm{true},\mathrm{true}][true,true] as the end of an empty remaining clause, or parses one literal and recurses on its suffix with clause fuel reduced by one. Literal parsing requires an initial pair [false,b][\mathrm{false},b][false,b] for the sign. On the remainder rrr it starts data fuel ∣r∣+1|r|+1∣r∣+1: zero data fuel fails; with positive data fuel [true,false][\mathrm{true},\mathrm{false}][true,false] ends the digit sequence, while [false,d][\mathrm{false},d][false,d] contributes digit ddd and decreases fuel by one; all other cases fail. The collected digits are interpreted little-endian and accepted only if they equal the canonical binary digits of the resulting natural number. A parsed literal is that sign/index pair together with the suffix after its delimiter; any failed subparse makes the containing parse fail. Success of the outer parse requires consuming the complete input.

PvsNP.variableNames

For every finite formula FFF, the variable-name list is obtained by concatenating its clause lists, extracting the natural-number index from each sign/index literal in that order, and deleting duplicate occurrences while retaining the first occurrence of each index. It has one entry for each index appearing anywhere in FFF, regardless of sign, and is empty when no literals occur; no numerical sorting is performed. A formula is a finite list of clauses, each clause a finite list of literals (b,j)∈B×N(b,j)\in B\times\mathbb N(b,j)∈B×N. Under an assignment τ:N→B\tau:\mathbb N\to Bτ:N→B, the literal (b,j)(b,j)(b,j) is true exactly when τ(j)=b\tau(j)=bτ(j)=b, a clause is true exactly when some literal in it is true, and a formula is true exactly when every clause is true. Thus an empty clause is false and an empty formula is true. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length.

PvsNP.certificateAssignment

For every formula FFF, Boolean word yyy, and natural index jjj, the assigned Boolean value is obtained by zipping the list V(F)V(F)V(F) with yyy, looking up key jjj in that list of pairs, and defaulting to false if no pair has that key. Zipping stops when either list ends, so extra bits of yyy are ignored, and variables whose position exceeds a short yyy are assigned false. The index jjj may be any natural number, including one absent from FFF; no length equality is required by this definition. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length. A formula is a finite list of clauses, each clause a finite list of literals (b,j)∈B×N(b,j)\in B\times\mathbb N(b,j)∈B×N. Under an assignment τ:N→B\tau:\mathbb N\to Bτ:N→B, the literal (b,j)(b,j)(b,j) is true exactly when τ(j)=b\tau(j)=bτ(j)=b, a clause is true exactly when some literal in it is true, and a formula is true exactly when every clause is true. Thus an empty clause is false and an empty formula is true. The variable list V(F)V(F)V(F) is obtained by reading the indices of all literals in the flattened clause list in order and deleting duplicate occurrences while retaining the first occurrence of each index.

PvsNP.satVerifier

For every ordered pair (w,y)(w,y)(w,y) of finite Boolean words, the verifier is the Boolean function defined by the parsing, length check, and formula evaluation described here. It accepts the pair of empty words because the empty word parses as the empty formula, whose variable list is empty and whose evaluation is true. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length. The parser parse⁡(w)\operatorname{parse}(w)parse(w) works as follows. Its outer recursion starts with fuel ∣w∣+1|w|+1∣w∣+1, returns the empty formula on an empty remainder even at fuel zero, and otherwise fails at fuel zero; with positive fuel it parses one clause from the current nonempty remainder using clause fuel equal to that remainder’s length plus one, then recurses on the returned suffix with outer fuel reduced by one. Clause parsing fails at fuel zero; with positive fuel it consumes [true,true][\mathrm{true},\mathrm{true}][true,true] as the end of an empty remaining clause, or parses one literal and recurses on its suffix with clause fuel reduced by one. Literal parsing requires an initial pair [false,b][\mathrm{false},b][false,b] for the sign. On the remainder rrr it starts data fuel ∣r∣+1|r|+1∣r∣+1: zero data fuel fails; with positive data fuel [true,false][\mathrm{true},\mathrm{false}][true,false] ends the digit sequence, while [false,d][\mathrm{false},d][false,d] contributes digit ddd and decreases fuel by one; all other cases fail. The collected digits are interpreted little-endian and accepted only if they equal the canonical binary digits of the resulting natural number. A parsed literal is that sign/index pair together with the suffix after its delimiter; any failed subparse makes the containing parse fail. Success of the outer parse requires consuming the complete input. The variable list V(F)V(F)V(F) is obtained by reading the indices of all literals in the flattened clause list in order and deleting duplicate occurrences while retaining the first occurrence of each index. The Boolean verifier on (w,y)(w,y)(w,y) first applies this parser to www, returning false on failure. For a parsed formula FFF, it returns false unless ∣y∣=∣V(F)∣|y|=|V(F)|∣y∣=∣V(F)∣; if the lengths agree, it evaluates FFF under the assignment that gives the jjjth variable in V(F)V(F)V(F) the jjjth bit of yyy, and gives every unlisted index false. More generally this assignment is formed by zipping V(F)V(F)V(F) with yyy, looking up an index in that truncated list of pairs, and using false when it is absent. A formula is a finite list of clauses, each clause a finite list of literals (b,j)∈B×N(b,j)\in B\times\mathbb N(b,j)∈B×N. Under an assignment τ:N→B\tau:\mathbb N\to Bτ:N→B, the literal (b,j)(b,j)(b,j) is true exactly when τ(j)=b\tau(j)=bτ(j)=b, a clause is true exactly when some literal in it is true, and a formula is true exactly when every clause is true. Thus an empty clause is false and an empty formula is true.

PvsNP.TableauSpec

The structure consists of exactly six fields: a natural number sss named steps, a natural number iii named interior, a natural number rrr named symbols, a list III of lists of natural numbers named initialAllowed, a list AAA of natural numbers named acceptingSymbols, and a list HHH of lists of natural numbers named allowedWindows. It contains no equations, inequalities, length requirements, distinctness conditions, alphabet-membership requirements, or other proof fields; in particular all three natural numbers may be zero, all lists may be empty, and entries may be arbitrary natural numbers.

PvsNP.tableauWidth

For every six-field specification SSS, its width is defined to be W=i+2W=i+2W=i+2, so there are always at least two columns, even when the interior field is zero. Here S=(s,i,r,I,A,H)S=(s,i,r,I,A,H)S=(s,i,r,I,A,H) has s,i,r∈Ns,i,r\in\mathbb Ns,i,r∈N, a list III of lists of natural numbers, a list AAA of natural numbers, and a list HHH of lists of natural numbers, with no validity restrictions on these fields. Put W=i+2≥2W=i+2\ge2W=i+2≥2, Q=r+1≥1Q=r+1\ge1Q=r+1≥1, and v(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+a. The list IcI_cIc​ is the zero-based cccth list of III, or the empty list when that entry is missing.

PvsNP.tableauAlphabet

For every six-field specification SSS, its alphabet bound is defined to be Q=r+1Q=r+1Q=r+1, so it is always positive, including when the symbols field is zero. Here S=(s,i,r,I,A,H)S=(s,i,r,I,A,H)S=(s,i,r,I,A,H) has s,i,r∈Ns,i,r\in\mathbb Ns,i,r∈N, a list III of lists of natural numbers, a list AAA of natural numbers, and a list HHH of lists of natural numbers, with no validity restrictions on these fields. Put W=i+2≥2W=i+2\ge2W=i+2≥2, Q=r+1≥1Q=r+1\ge1Q=r+1≥1, and v(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+a. The list IcI_cIc​ is the zero-based cccth list of III, or the empty list when that entry is missing.

PvsNP.tableauVar

For every six-field specification SSS and every t,c,a∈Nt,c,a\in\mathbb Nt,c,a∈N, the variable index is defined to be (t(i+2)+c)(r+1)+a(t(i+2)+c)(r+1)+a(t(i+2)+c)(r+1)+a. The arguments are unrestricted: the definition does not require t≤st\le st≤s, c<i+2c<i+2c<i+2, or a<r+1a<r+1a<r+1, and does not assert injectivity on all triples. Here S=(s,i,r,I,A,H)S=(s,i,r,I,A,H)S=(s,i,r,I,A,H) has s,i,r∈Ns,i,r\in\mathbb Ns,i,r∈N, a list III of lists of natural numbers, a list AAA of natural numbers, and a list HHH of lists of natural numbers, with no validity restrictions on these fields. Put W=i+2≥2W=i+2\ge2W=i+2≥2, Q=r+1≥1Q=r+1\ge1Q=r+1≥1, and v(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+a. The list IcI_cIc​ is the zero-based cccth list of III, or the empty list when that entry is missing.

PvsNP.cellClauses

For every specification SSS and all t,c∈Nt,c\in\mathbb Nt,c∈N, the returned formula starts with the single clause of positive literals (true,v(t,c,a))(\mathrm{true},v(t,c,a))(true,v(t,c,a)) for a=0,…,Q−1a=0,\ldots,Q-1a=0,…,Q−1 in increasing order, then contains the two-negative-literal clause [(false,v(t,c,a)),(false,v(t,c,b))][(\mathrm{false},v(t,c,a)),(\mathrm{false},v(t,c,b))][(false,v(t,c,a)),(false,v(t,c,b))] for each 0≤a<b<Q0\le a<b<Q0≤a<b<Q, ordered first by aaa and then by bbb. No bounds on t,ct,ct,c are required. Since Q≥1Q\ge1Q≥1, the first clause is never empty; when Q=1Q=1Q=1, there are no two-literal clauses. Here S=(s,i,r,I,A,H)S=(s,i,r,I,A,H)S=(s,i,r,I,A,H) has s,i,r∈Ns,i,r\in\mathbb Ns,i,r∈N, a list III of lists of natural numbers, a list AAA of natural numbers, and a list HHH of lists of natural numbers, with no validity restrictions on these fields. Put W=i+2≥2W=i+2\ge2W=i+2≥2, Q=r+1≥1Q=r+1\ge1Q=r+1≥1, and v(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+a. The list IcI_cIc​ is the zero-based cccth list of III, or the empty list when that entry is missing. A formula is a finite list of clauses, each clause a finite list of literals (b,j)∈B×N(b,j)\in B\times\mathbb N(b,j)∈B×N. Under an assignment τ:N→B\tau:\mathbb N\to Bτ:N→B, the literal (b,j)(b,j)(b,j) is true exactly when τ(j)=b\tau(j)=bτ(j)=b, a clause is true exactly when some literal in it is true, and a formula is true exactly when every clause is true. Thus an empty clause is false and an empty formula is true. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length.

PvsNP.cellsCNF

For every specification SSS, this definition returns the cell formula described here, concatenating the clause lists for all of the indicated cells. It covers one row when s=0s=0s=0 and still covers two columns when i=0i=0i=0. Here S=(s,i,r,I,A,H)S=(s,i,r,I,A,H)S=(s,i,r,I,A,H) has s,i,r∈Ns,i,r\in\mathbb Ns,i,r∈N, a list III of lists of natural numbers, a list AAA of natural numbers, and a list HHH of lists of natural numbers, with no validity restrictions on these fields. Put W=i+2≥2W=i+2\ge2W=i+2≥2, Q=r+1≥1Q=r+1\ge1Q=r+1≥1, and v(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+a. The list IcI_cIc​ is the zero-based cccth list of III, or the empty list when that entry is missing. The cell formula consists, in increasing t=0,…,st=0,\ldots,st=0,…,s and then increasing c=0,…,W−1c=0,\ldots,W-1c=0,…,W−1, of the clause of all positive literals (true,v(t,c,a))(\mathrm{true},v(t,c,a))(true,v(t,c,a)) for a=0,…,Q−1a=0,\ldots,Q-1a=0,…,Q−1, followed by every two-literal clause [(false,v(t,c,a)),(false,v(t,c,b))][(\mathrm{false},v(t,c,a)),(\mathrm{false},v(t,c,b))][(false,v(t,c,a)),(false,v(t,c,b))] with 0≤a<b<Q0\le a<b<Q0≤a<b<Q, ordered first by aaa and then by bbb. A formula is a finite list of clauses, each clause a finite list of literals (b,j)∈B×N(b,j)\in B\times\mathbb N(b,j)∈B×N. Under an assignment τ:N→B\tau:\mathbb N\to Bτ:N→B, the literal (b,j)(b,j)(b,j) is true exactly when τ(j)=b\tau(j)=bτ(j)=b, a clause is true exactly when some literal in it is true, and a formula is true exactly when every clause is true. Thus an empty clause is false and an empty formula is true. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length.

PvsNP.initialCNF

For every specification SSS, this definition returns the initial formula described here. A missing list IcI_cIc​ is treated as empty and therefore generates a negative unit clause for every a<Qa<Qa<Q at that column; duplicate allowed entries have no extra effect, entries outside 0,…,Q−10,\ldots,Q-10,…,Q−1 generate no positive permission in this construction, and lists beyond the first WWW columns are ignored. Here S=(s,i,r,I,A,H)S=(s,i,r,I,A,H)S=(s,i,r,I,A,H) has s,i,r∈Ns,i,r\in\mathbb Ns,i,r∈N, a list III of lists of natural numbers, a list AAA of natural numbers, and a list HHH of lists of natural numbers, with no validity restrictions on these fields. Put W=i+2≥2W=i+2\ge2W=i+2≥2, Q=r+1≥1Q=r+1\ge1Q=r+1≥1, and v(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+a. The list IcI_cIc​ is the zero-based cccth list of III, or the empty list when that entry is missing. The initial formula has, in increasing c<Wc<Wc<W and then increasing a<Qa<Qa<Q, the negative unit clause [(false,v(0,c,a))][(\mathrm{false},v(0,c,a))][(false,v(0,c,a))] exactly when a∉Ica\notin I_ca∈/Ic​. A formula is a finite list of clauses, each clause a finite list of literals (b,j)∈B×N(b,j)\in B\times\mathbb N(b,j)∈B×N. Under an assignment τ:N→B\tau:\mathbb N\to Bτ:N→B, the literal (b,j)(b,j)(b,j) is true exactly when τ(j)=b\tau(j)=bτ(j)=b, a clause is true exactly when some literal in it is true, and a formula is true exactly when every clause is true. Thus an empty clause is false and an empty formula is true. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length.

PvsNP.boundaryCNF

For every specification SSS, this definition returns the boundary formula described here: the list of two unit clauses per row asserting symbol zero at the first and last columns. It includes row zero even when s=0s=0s=0; since W=i+2W=i+2W=i+2, the two designated boundary columns are distinct even when i=0i=0i=0. Here S=(s,i,r,I,A,H)S=(s,i,r,I,A,H)S=(s,i,r,I,A,H) has s,i,r∈Ns,i,r\in\mathbb Ns,i,r∈N, a list III of lists of natural numbers, a list AAA of natural numbers, and a list HHH of lists of natural numbers, with no validity restrictions on these fields. Put W=i+2≥2W=i+2\ge2W=i+2≥2, Q=r+1≥1Q=r+1\ge1Q=r+1≥1, and v(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+a. The list IcI_cIc​ is the zero-based cccth list of III, or the empty list when that entry is missing. The boundary formula has, for each t=0,…,st=0,\ldots,st=0,…,s in order, the two positive unit clauses at v(t,0,0)v(t,0,0)v(t,0,0) and v(t,i+1,0)v(t,i+1,0)v(t,i+1,0), in that order. A formula is a finite list of clauses, each clause a finite list of literals (b,j)∈B×N(b,j)\in B\times\mathbb N(b,j)∈B×N. Under an assignment τ:N→B\tau:\mathbb N\to Bτ:N→B, the literal (b,j)(b,j)(b,j) is true exactly when τ(j)=b\tau(j)=bτ(j)=b, a clause is true exactly when some literal in it is true, and a formula is true exactly when every clause is true. Thus an empty clause is false and an empty formula is true. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length.

PvsNP.acceptingCNF

For every specification SSS, this definition returns the accepting formula described here. Membership in AAA is tested as list membership, so duplicate entries do not duplicate literals for a fixed cell/symbol pair, and entries at least QQQ are ignored. Boundary columns are included among the eligible columns, and acceptance is tested at row sss, including row zero when s=0s=0s=0. Here S=(s,i,r,I,A,H)S=(s,i,r,I,A,H)S=(s,i,r,I,A,H) has s,i,r∈Ns,i,r\in\mathbb Ns,i,r∈N, a list III of lists of natural numbers, a list AAA of natural numbers, and a list HHH of lists of natural numbers, with no validity restrictions on these fields. Put W=i+2≥2W=i+2\ge2W=i+2≥2, Q=r+1≥1Q=r+1\ge1Q=r+1≥1, and v(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+a. The list IcI_cIc​ is the zero-based cccth list of III, or the empty list when that entry is missing. The accepting formula is a list containing one clause; its literals are (true,v(s,c,a))(\mathrm{true},v(s,c,a))(true,v(s,c,a)) for every 0≤c<W0\le c<W0≤c<W and 0≤a<Q0\le a<Q0≤a<Q with a∈Aa\in Aa∈A, ordered first by ccc and then by aaa. If no such aaa exists, this is an empty clause rather than an empty formula. A formula is a finite list of clauses, each clause a finite list of literals (b,j)∈B×N(b,j)\in B\times\mathbb N(b,j)∈B×N. Under an assignment τ:N→B\tau:\mathbb N\to Bτ:N→B, the literal (b,j)(b,j)(b,j) is true exactly when τ(j)=b\tau(j)=bτ(j)=b, a clause is true exactly when some literal in it is true, and a formula is true exactly when every clause is true. Thus an empty clause is false and an empty formula is true. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length.

PvsNP.wordsOfLength

For every natural alphabet bound aaa and natural length nnn, this definition returns a list of lists: at n=0n=0n=0 it is the singleton list containing the empty word; at n+1n+1n+1 it concatenates, for d=0,…,a−1d=0,\ldots,a-1d=0,…,a−1 in order, the lists formed by prepending ddd to every previously constructed length-nnn word. Thus it enumerates, in increasing lexicographic order, exactly the words of length nnn with entries below aaa. For a=0a=0a=0 it still returns the singleton empty word at length zero and returns the empty list at every positive length.

PvsNP.windowValues

For every function T:N×N→NT:\mathbb N\times\mathbb N\to\mathbb NT:N×N→N and all t,c∈Nt,c\in\mathbb Nt,c∈N, this definition returns the six-entry list [T(t,c),T(t,c+1),T(t,c+2),T(t+1,c),T(t+1,c+1),T(t+1,c+2)][T(t,c),T(t,c+1),T(t,c+2),T(t+1,c),T(t+1,c+1),T(t+1,c+2)][T(t,c),T(t,c+1),T(t,c+2),T(t+1,c),T(t+1,c+1),T(t+1,c+2)], in the displayed order. There are no bounds on the arguments or values and no reference to a tableau specification.

PvsNP.forbiddenWindowClause

For every specification SSS, all t,c∈Nt,c\in\mathbb Nt,c∈N, and every natural-number list uuu, the clause is obtained by pairing the ordered position list [(t,c),(t,c+1),(t,c+2),(t+1,c),(t+1,c+1),(t+1,c+2)][(t,c),(t,c+1),(t,c+2),(t+1,c),(t+1,c+1),(t+1,c+2)][(t,c),(t,c+1),(t,c+2),(t+1,c),(t+1,c+1),(t+1,c+2)] with uuu, truncating to the shorter list, and replacing each pair ((t0,c0),a)((t_0,c_0),a)((t0​,c0​),a) by the negative literal (false,v(t0,c0,a))(\mathrm{false},v(t_0,c_0,a))(false,v(t0​,c0​,a)). Hence the clause has min⁡(6,∣u∣)\min(6,|u|)min(6,∣u∣) literals, is empty for u=[]u=[]u=[], and ignores entries of uuu after the sixth. Neither ∣u∣=6|u|=6∣u∣=6 nor any bounds on t,c,at,c,at,c,a are assumed. Here S=(s,i,r,I,A,H)S=(s,i,r,I,A,H)S=(s,i,r,I,A,H) has s,i,r∈Ns,i,r\in\mathbb Ns,i,r∈N, a list III of lists of natural numbers, a list AAA of natural numbers, and a list HHH of lists of natural numbers, with no validity restrictions on these fields. Put W=i+2≥2W=i+2\ge2W=i+2≥2, Q=r+1≥1Q=r+1\ge1Q=r+1≥1, and v(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+a. The list IcI_cIc​ is the zero-based cccth list of III, or the empty list when that entry is missing. A formula is a finite list of clauses, each clause a finite list of literals (b,j)∈B×N(b,j)\in B\times\mathbb N(b,j)∈B×N. Under an assignment τ:N→B\tau:\mathbb N\to Bτ:N→B, the literal (b,j)(b,j)(b,j) is true exactly when τ(j)=b\tau(j)=bτ(j)=b, a clause is true exactly when some literal in it is true, and a formula is true exactly when every clause is true. Thus an empty clause is false and an empty formula is true. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length.

PvsNP.transitionCNF

For every specification SSS, this definition returns the transition formula described here. Every generated clause has exactly six literals, since only six-entry words are enumerated; allowed-window lists of other lengths or containing entries at least QQQ cannot match an enumerated word, and repetitions in HHH have no additional effect. Here S=(s,i,r,I,A,H)S=(s,i,r,I,A,H)S=(s,i,r,I,A,H) has s,i,r∈Ns,i,r\in\mathbb Ns,i,r∈N, a list III of lists of natural numbers, a list AAA of natural numbers, and a list HHH of lists of natural numbers, with no validity restrictions on these fields. Put W=i+2≥2W=i+2\ge2W=i+2≥2, Q=r+1≥1Q=r+1\ge1Q=r+1≥1, and v(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+a. The list IcI_cIc​ is the zero-based cccth list of III, or the empty list when that entry is missing. The transition formula ranges in increasing order over 0≤t<s0\le t<s0≤t<s, 0≤c<i0\le c<i0≤c<i, and lexicographically over all six-tuples u∈{0,…,Q−1}6u\in\{0,\ldots,Q-1\}^6u∈{0,…,Q−1}6 absent from the list HHH. For each such tuple it has the clause of the six negative literals at positions (t,c),(t,c+1),(t,c+2),(t+1,c),(t+1,c+1),(t+1,c+2)(t,c),(t,c+1),(t,c+2),(t+1,c),(t+1,c+1),(t+1,c+2)(t,c),(t,c+1),(t,c+2),(t+1,c),(t+1,c+1),(t+1,c+2) with symbol indices given by the corresponding entries of uuu, in that order. If s=0s=0s=0 or i=0i=0i=0, the transition formula is empty. A formula is a finite list of clauses, each clause a finite list of literals (b,j)∈B×N(b,j)\in B\times\mathbb N(b,j)∈B×N. Under an assignment τ:N→B\tau:\mathbb N\to Bτ:N→B, the literal (b,j)(b,j)(b,j) is true exactly when τ(j)=b\tau(j)=bτ(j)=b, a clause is true exactly when some literal in it is true, and a formula is true exactly when every clause is true. Thus an empty clause is false and an empty formula is true. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length.

PvsNP.tableauCNF

For every specification SSS, the returned formula is the five-part concatenation described here, with no extra clauses, tests, or hypotheses on SSS. Here S=(s,i,r,I,A,H)S=(s,i,r,I,A,H)S=(s,i,r,I,A,H) has s,i,r∈Ns,i,r\in\mathbb Ns,i,r∈N, a list III of lists of natural numbers, a list AAA of natural numbers, and a list HHH of lists of natural numbers, with no validity restrictions on these fields. Put W=i+2≥2W=i+2\ge2W=i+2≥2, Q=r+1≥1Q=r+1\ge1Q=r+1≥1, and v(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+a. The list IcI_cIc​ is the zero-based cccth list of III, or the empty list when that entry is missing. The full tableau formula is the concatenation, in order, of the cell, initial, boundary, accepting, and transition formulas described here. The cell formula consists, in increasing t=0,…,st=0,\ldots,st=0,…,s and then increasing c=0,…,W−1c=0,\ldots,W-1c=0,…,W−1, of the clause of all positive literals (true,v(t,c,a))(\mathrm{true},v(t,c,a))(true,v(t,c,a)) for a=0,…,Q−1a=0,\ldots,Q-1a=0,…,Q−1, followed by every two-literal clause [(false,v(t,c,a)),(false,v(t,c,b))][(\mathrm{false},v(t,c,a)),(\mathrm{false},v(t,c,b))][(false,v(t,c,a)),(false,v(t,c,b))] with 0≤a<b<Q0\le a<b<Q0≤a<b<Q, ordered first by aaa and then by bbb. The initial formula has, in increasing c<Wc<Wc<W and then increasing a<Qa<Qa<Q, the negative unit clause [(false,v(0,c,a))][(\mathrm{false},v(0,c,a))][(false,v(0,c,a))] exactly when a∉Ica\notin I_ca∈/Ic​. The boundary formula has, for each t=0,…,st=0,\ldots,st=0,…,s in order, the two positive unit clauses at v(t,0,0)v(t,0,0)v(t,0,0) and v(t,i+1,0)v(t,i+1,0)v(t,i+1,0), in that order. The accepting formula is a list containing one clause; its literals are (true,v(s,c,a))(\mathrm{true},v(s,c,a))(true,v(s,c,a)) for every 0≤c<W0\le c<W0≤c<W and 0≤a<Q0\le a<Q0≤a<Q with a∈Aa\in Aa∈A, ordered first by ccc and then by aaa. If no such aaa exists, this is an empty clause rather than an empty formula. The transition formula ranges in increasing order over 0≤t<s0\le t<s0≤t<s, 0≤c<i0\le c<i0≤c<i, and lexicographically over all six-tuples u∈{0,…,Q−1}6u\in\{0,\ldots,Q-1\}^6u∈{0,…,Q−1}6 absent from the list HHH. For each such tuple it has the clause of the six negative literals at positions (t,c),(t,c+1),(t,c+2),(t+1,c),(t+1,c+1),(t+1,c+2)(t,c),(t,c+1),(t,c+2),(t+1,c),(t+1,c+1),(t+1,c+2)(t,c),(t,c+1),(t,c+2),(t+1,c),(t+1,c+1),(t+1,c+2) with symbol indices given by the corresponding entries of uuu, in that order. If s=0s=0s=0 or i=0i=0i=0, the transition formula is empty. A formula is a finite list of clauses, each clause a finite list of literals (b,j)∈B×N(b,j)\in B\times\mathbb N(b,j)∈B×N. Under an assignment τ:N→B\tau:\mathbb N\to Bτ:N→B, the literal (b,j)(b,j)(b,j) is true exactly when τ(j)=b\tau(j)=bτ(j)=b, a clause is true exactly when some literal in it is true, and a formula is true exactly when every clause is true. Thus an empty clause is false and an empty formula is true. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length.

PvsNP.TableauEncoding

For every specification SSS, Boolean assignment τ:N→B\tau:\mathbb N\to Bτ:N→B, and natural-valued two-argument function TTT, this predicate is exactly the encoding condition described here. The row bound is non-strict and the column and symbol bounds are strict, so row zero is always included and Q≥1Q\ge1Q≥1 even when the symbols field is zero. Here S=(s,i,r,I,A,H)S=(s,i,r,I,A,H)S=(s,i,r,I,A,H) has s,i,r∈Ns,i,r\in\mathbb Ns,i,r∈N, a list III of lists of natural numbers, a list AAA of natural numbers, and a list HHH of lists of natural numbers, with no validity restrictions on these fields. Put W=i+2≥2W=i+2\ge2W=i+2≥2, Q=r+1≥1Q=r+1\ge1Q=r+1≥1, and v(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+a. The list IcI_cIc​ is the zero-based cccth list of III, or the empty list when that entry is missing. The encoding condition for τ:N→B\tau:\mathbb N\to Bτ:N→B and T:N×N→NT:\mathbb N\times\mathbb N\to\mathbb NT:N×N→N is the conjunction of ∀t≤s, ∀c<W, T(t,c)<Q\forall t\le s,\ \forall c<W,\ T(t,c)<Q∀t≤s, ∀c<W, T(t,c)<Q and ∀t≤s, ∀c<W, ∀a<Q, τ(v(t,c,a))=true ⟺ T(t,c)=a\forall t\le s,\ \forall c<W,\ \forall a<Q,\ \tau(v(t,c,a))=\mathrm{true}\ \Longleftrightarrow\ T(t,c)=a∀t≤s, ∀c<W, ∀a<Q, τ(v(t,c,a))=true ⟺ T(t,c)=a. Values of TTT outside this rectangle and Boolean values not constrained by these displayed indices are unrestricted. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length.

PvsNP.ValidTableau

For every specification SSS and function T:N×N→NT:\mathbb N\times\mathbb N\to\mathbb NT:N×N→N, this predicate is exactly the five conjuncts of the validity condition described here. It makes no additional connection between the allowed-window lists and any machine program, includes boundary cells as possible accepting cells, and imposes no requirement that acceptance first occur at the final row. Here S=(s,i,r,I,A,H)S=(s,i,r,I,A,H)S=(s,i,r,I,A,H) has s,i,r∈Ns,i,r\in\mathbb Ns,i,r∈N, a list III of lists of natural numbers, a list AAA of natural numbers, and a list HHH of lists of natural numbers, with no validity restrictions on these fields. Put W=i+2≥2W=i+2\ge2W=i+2≥2, Q=r+1≥1Q=r+1\ge1Q=r+1≥1, and v(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+a. The list IcI_cIc​ is the zero-based cccth list of III, or the empty list when that entry is missing. The validity condition for T:N×N→NT:\mathbb N\times\mathbb N\to\mathbb NT:N×N→N is the conjunction of: ∀t≤s, ∀c<W, T(t,c)<Q\forall t\le s,\ \forall c<W,\ T(t,c)<Q∀t≤s, ∀c<W, T(t,c)<Q; ∀c<W, T(0,c)∈Ic\forall c<W,\ T(0,c)\in I_c∀c<W, T(0,c)∈Ic​; ∀t≤s, T(t,0)=0∧T(t,i+1)=0\forall t\le s,\ T(t,0)=0\land T(t,i+1)=0∀t≤s, T(t,0)=0∧T(t,i+1)=0; ∃c<W, T(s,c)∈A\exists c<W,\ T(s,c)\in A∃c<W, T(s,c)∈A; and ∀t<s, ∀c<i, [T(t,c),T(t,c+1),T(t,c+2),T(t+1,c),T(t+1,c+1),T(t+1,c+2)]∈H\forall t<s,\ \forall c<i,\ [T(t,c),T(t,c+1),T(t,c+2),T(t+1,c),T(t+1,c+1),T(t+1,c+2)]\in H∀t<s, ∀c<i, [T(t,c),T(t,c+1),T(t,c+2),T(t+1,c),T(t+1,c+1),T(t+1,c+2)]∈H. Values outside the rectangle are unrestricted; the last condition is vacuous for s=0s=0s=0 or i=0i=0i=0, and a missing required IcI_cIc​ or an empty AAA makes the condition unsatisfiable.

PvsNP.encodeTableauSpec

For every specification SSS, this definition returns the Boolean word J(S)J(S)J(S) described here. The first four counts are represented by lengths of clauses of repeated positive variable-zero literals, rather than by binary numeral fields. No restriction on the six specification fields is assumed. Here S=(s,i,r,I,A,H)S=(s,i,r,I,A,H)S=(s,i,r,I,A,H) has s,i,r∈Ns,i,r\in\mathbb Ns,i,r∈N, a list III of lists of natural numbers, a list AAA of natural numbers, and a list HHH of lists of natural numbers, with no validity restrictions on these fields. Put W=i+2≥2W=i+2\ge2W=i+2≥2, Q=r+1≥1Q=r+1\ge1Q=r+1≥1, and v(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+a. The list IcI_cIc​ is the zero-based cccth list of III, or the empty list when that entry is missing. The specification encoding J(S)J(S)J(S) is E(GS)E(G_S)E(GS​), where GSG_SGS​ is the following clause list: first a clause of sss copies of (true,0)(\mathrm{true},0)(true,0), then a clause of iii copies, then a clause of rrr copies, then a clause of ∣I∣|I|∣I∣ copies; next, for each list xxx in III in order, the clause [(true,a):a runs through x][(\mathrm{true},a):a\text{ runs through }x][(true,a):a runs through x]; next one clause formed in the same way from AAA; finally one such clause for each list in HHH in order. These are raw formula encodings: no satisfiability condition is part of JJJ. Empty lists and zero replication counts give empty clauses, which still have their clause delimiters. Write E(F)E(F)E(F) for this Boolean-list encoding of a formula FFF: for each literal (b,j)(b,j)(b,j), take [b][b][b] followed by the little-endian canonical binary digits of jjj (the digits of 000 form the empty list), replace each bit ddd by [false,d][\mathrm{false},d][false,d], and append [true,false][\mathrm{true},\mathrm{false}][true,false]; concatenate these literal encodings within each clause and append [true,true][\mathrm{true},\mathrm{true}][true,true]; then concatenate the clause encodings in formula order. In particular E([])=[]E([])=[]E([])=[]. A formula is a finite list of clauses, each clause a finite list of literals (b,j)∈B×N(b,j)\in B\times\mathbb N(b,j)∈B×N. Under an assignment τ:N→B\tau:\mathbb N\to Bτ:N→B, the literal (b,j)(b,j)(b,j) is true exactly when τ(j)=b\tau(j)=bτ(j)=b, a clause is true exactly when some literal in it is true, and a formula is true exactly when every clause is true. Thus an empty clause is false and an empty formula is true. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length.

PvsNP.MachineTableauSpec

For every specification SSS, this predicate is the conjunction of the additional specification conditions described here. In particular it requires positive steps and interior, exactly i+2i+2i+2 initial lists, nonzero accepting symbols, and length-six allowed windows with in-range entries; it does not impose transition consistency with a separately given machine, require satisfiability, or require the listed choices to be nonempty. Here S=(s,i,r,I,A,H)S=(s,i,r,I,A,H)S=(s,i,r,I,A,H) has s,i,r∈Ns,i,r\in\mathbb Ns,i,r∈N, a list III of lists of natural numbers, a list AAA of natural numbers, and a list HHH of lists of natural numbers, with no validity restrictions on these fields. Put W=i+2≥2W=i+2\ge2W=i+2≥2, Q=r+1≥1Q=r+1\ge1Q=r+1≥1, and v(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+av(t,c,a)=(tW+c)Q+a. The list IcI_cIc​ is the zero-based cccth list of III, or the empty list when that entry is missing. The additional specification condition is exactly s>0s>0s>0, i>0i>0i>0, 0∉A0\notin A0∈/A, ∣I∣=W|I|=W∣I∣=W, every entry of every list in III is below QQQ, every entry of AAA is below QQQ, and every list in HHH has length exactly six and every one of its entries is below QQQ. It imposes no nonemptiness condition on an individual list in III, on AAA, or on HHH, and allows r=0r=0r=0; in that case Q=1Q=1Q=1 and the accepting list must be empty.

PvsNP.EXPTIME

This definition gives the class of languages described here, using an everywhere-valid upper bound of the form 2p(n)2^{p(n)}2p(n) on a chosen time-bound function. A witness consists of the Boolean decider, the time-bounded machine, and the natural-coefficient polynomial; it need not specify finite alphabets for all non-input stacks. Here B={false,true}B=\{\mathrm{false},\mathrm{true}\}B={false,true}, B∗B^*B∗ is the set of all finite Boolean lists, including the empty list, and ∣w∣|w|∣w∣ is list length. The set EXPTIMEEXPTIMEEXPTIME consists exactly of languages L⊆B∗L\subseteq B^*L⊆B∗ for which there are a Boolean function χ:B∗→B\chi:B^*\to Bχ:B∗→B, a machine with a natural-valued time bound t:N→Nt:\mathbb N\to\mathbb Nt:N→N computing [χ(w)][\chi(w)][χ(w)] from www within t(∣w∣)t(|w|)t(∣w∣) steps for every www, and p∈N[X]p\in\mathbb N[X]p∈N[X] with ∀n∈N, t(n)≤2p(n)\forall n\in\mathbb N,\ t(n)\le 2^{p(n)}∀n∈N, t(n)≤2p(n), such that ∀w, w∈L ⟺ χ(w)=true\forall w,\ w\in L\ \Longleftrightarrow\ \chi(w)=\mathrm{true}∀w, w∈L ⟺ χ(w)=true. The bound includes n=0n=0n=0. A machine in these assertions is a Mathlib TM2 stack machine with finitely many stack indices, instruction labels, and control states, a finite input-stack alphabet, designated input and output stacks, a program, and initial label and control state; its other stack alphabets need not be finite. Input and output alphabet bijections transport the specified encoded lists to the corresponding stack alphabets. Computation starts with only the input stack populated, and reaches a halted configuration with the specified output on the output stack, all other stacks empty, and the control state reset to its initial value. Time counts executions of whole TM2 statements, each of which may contain several stack operations.

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me