P versus NP: finite reachable symbol support
DefinitionPvsNPSupportSymbols pushable by a finite TM2 program, its input-plus-program symbol support, and the predicate that all current stack symbols lie in a given support. These definitions do not assume finite ambient work alphabets.
import Definitions.Def_PvsNPFrontier
namespace PvsNP
def stmtPushSymbols (M : Turing.FinTM2) : M.Stmt → Set (Sigma M.Γ)
| .push k f q => Set.range (fun v => Sigma.mk k (f v)) ∪ stmtPushSymbols M q
| .peek _ _ q => stmtPushSymbols M q
| .pop _ _ q => stmtPushSymbols M q
| .load _ q => stmtPushSymbols M q
| .branch _ q r => stmtPushSymbols M q ∪ stmtPushSymbols M r
| .goto _ => ∅
| .halt => ∅
def machineSymbols (M : Turing.FinTM2) : Set (Sigma M.Γ) :=
Set.range (fun a => Sigma.mk M.k₀ a) ∪ ⋃ l, stmtPushSymbols M (M.m l)
def SupportedStacks (M : Turing.FinTM2) (S : Set (Sigma M.Γ))
(stk : ∀ k, List (M.Γ k)) : Prop :=
∀ k a, a ∈ stk k → Sigma.mk k a ∈ S
end PvsNP
Read-back
What the Lean code literally says, in plain math · gpt-6-astra
PvsNP.stmtPushSymbols
For every machine and every statement of that machine, this definition returns the set of tagged symbols given by the structural recursion described here. It contains symbols that could be selected by the syntax’s push functions at any control state, even if those states or branch bodies cannot occur in an execution. Here is a TM2 machine with a finite type of stack indices and decidable equality on , designated input and output indices , stack-symbol types , a finite type of program labels with a main label, a finite type of control states with an initial state, a finite input alphabet , and a statement for each label . No finiteness of for other is assumed. A tagged symbol has and ; tags from different stacks remain distinct. For a statement , its set of syntactically possible pushed tagged symbols is recursively defined: a push onto with symbol function and continuation contributes ; a peek, pop, or control-state load contributes only its continuation’s set; a conditional branch contributes the union of both branch sets; a jump to a program label and a halt contribute the empty set. Thus both branch bodies and all control states are counted, regardless of reachability, while a jump does not recursively inspect its target.
PvsNP.machineSymbols
For every machine , this definition returns the set described here, as a subset of the disjoint union of its stack alphabets. It contains all input symbols whether or not they appear in a particular input, and the push sets of every labeled statement whether or not that label is reachable; it need not contain every symbol of the output or other work alphabets. Here is a TM2 machine with a finite type of stack indices and decidable equality on , designated input and output indices , stack-symbol types , a finite type of program labels with a main label, a finite type of control states with an initial state, a finite input alphabet , and a statement for each label . No finiteness of for other is assumed. A tagged symbol has and ; tags from different stacks remain distinct. For a statement , its set of syntactically possible pushed tagged symbols is recursively defined: a push onto with symbol function and continuation contributes ; a peek, pop, or control-state load contributes only its continuation’s set; a conditional branch contributes the union of both branch sets; a jump to a program label and a halt contribute the empty set. Thus both branch bodies and all control states are counted, regardless of reachability, while a jump does not recursively inspect its target. Put , including every input-alphabet symbol and all syntactically possible pushes from every labeled statement.
PvsNP.SupportedStacks
For every machine , every set of tagged symbols, and every family of finite stack lists indexed by all , this predicate means . No finiteness assumption is made on , multiplicity and order in the stacks do not affect the condition, and all-empty stacks satisfy it even for . Here is a TM2 machine with a finite type of stack indices and decidable equality on , designated input and output indices , stack-symbol types , a finite type of program labels with a main label, a finite type of control states with an initial state, a finite input alphabet , and a statement for each label . No finiteness of for other is assumed. A tagged symbol has and ; tags from different stacks remain distinct.