Documentation

Complexity.Computability.Circuit.Boolean.MachineSimulation

Circuits simulating multi-tape machines #

The run of a multi-tape machine over Bool on inputs of length n is simulated by a circuit, time step by time step. At each step t the circuit holds the basic features (Turing.MultiTapeTM.Feature) of the configuration: the control state, the input head, the work heads and the work cells within the window |z| ≤ T, and the view of the output. From them it derives the symbols read and the situation of the step, and from the terms of the step equations (Turing.MultiTapeTM.Feature.stepTerms) each basic feature at time t + 1 with a constant number of gates. Running for T steps takes O(T · (n + T)) gates Sipser, Theorem 9.30.

The language of the inputs on which the machine has written [true] after T n steps is therefore in P/poly whenever T is polynomially bounded (acceptedWithin_mem_PPoly); this is the core of P ⊆ P/poly Arora and Barak, Theorem 6.6.

Main definitions #

Main results #

References #

noncomputable def Cslib.Circuits.Boolean.MachineSimulation.cfgAt {k : ℕ} {State : Type} (tm : Turing.MultiTapeTM k Bool State) {n : ℕ} (t : ℕ) (x : Fin n → Bool) :

The configuration of tm after t steps on the input x.

Instances For
    theorem Cslib.Circuits.Boolean.MachineSimulation.cfgAt_succ {k : ℕ} {State : Type} (tm : Turing.MultiTapeTM k Bool State) {n : ℕ} (t : ℕ) (x : Fin n → Bool) :
    cfgAt tm (t + 1) x = Turing.MultiTapeTM.step (cfgAt tm t x)
    theorem Cslib.Circuits.Boolean.MachineSimulation.abs_workTapePos_cfgAt_le {k : ℕ} {State : Type} (tm : Turing.MultiTapeTM k Bool State) {n : ℕ} (t : ℕ) (x : Fin n → Bool) (i : Fin k) :
    |(cfgAt tm t x).workTapePos i| ≤ ↑t

    A work head is within t cells of the origin after t steps.

    noncomputable def Cslib.Circuits.Boolean.MachineSimulation.featureFn {k : ℕ} {State : Type} (tm : Turing.MultiTapeTM k Bool State) {n : ℕ} [DecidableEq State] (t : ℕ) (φ : Turing.MultiTapeTM.Feature k State) :

    A feature of the configuration after t steps, as a Boolean function of the input.

    Instances For

      The input symbol at position j is s, as a Boolean function of the input.

      Instances For

        Feature sets #

        noncomputable def Cslib.Circuits.Boolean.MachineSimulation.basicFeatures {k : ℕ} {State : Type} [DecidableEq State] [Fintype State] (n T : ℕ) :

        The basic features within the window |z| ≤ T, for inputs of length n (Turing.MultiTapeTM.Feature.basic).

        Instances For

          A bound on the number of basic features.

          Instances For
            noncomputable def Cslib.Circuits.Boolean.MachineSimulation.basicAt {k : ℕ} {State : Type} (tm : Turing.MultiTapeTM k Bool State) {n : ℕ} [DecidableEq State] [Fintype State] (T t : ℕ) :

            The basic features at time t, as Boolean functions of the input.

            Instances For
              noncomputable def Cslib.Circuits.Boolean.MachineSimulation.readsAt {k : ℕ} {State : Type} (tm : Turing.MultiTapeTM k Bool State) {n : ℕ} [DecidableEq State] (t : ℕ) :

              The symbols read at time t, as Boolean functions of the input.

              Instances For
                noncomputable def Cslib.Circuits.Boolean.MachineSimulation.sitsAt {k : ℕ} {State : Type} (tm : Turing.MultiTapeTM k Bool State) {n : ℕ} [DecidableEq State] (t : ℕ) :

                The situations at time t, as Boolean functions of the input.

                Instances For
                  noncomputable def Cslib.Circuits.Boolean.MachineSimulation.stepSources {k : ℕ} {State : Type} (tm : Turing.MultiTapeTM k Bool State) {n : ℕ} [DecidableEq State] [Fintype State] (T t : ℕ) :

                  What is available for the third phase of a step: the inputs, the basic features, the symbols read and the situations.

                  Instances For
                    theorem Cslib.Circuits.Boolean.MachineSimulation.featureFn_mem_basicAt {k : ℕ} {State : Type} (tm : Turing.MultiTapeTM k Bool State) {n : ℕ} [DecidableEq State] [Fintype State] {T t : ℕ} {φ : Turing.MultiTapeTM.Feature k State} (h : φ ∈ basicFeatures n T) :
                    featureFn tm t φ ∈ basicAt tm T t
                    theorem Cslib.Circuits.Boolean.MachineSimulation.featureFn_mem_stepSources {k : ℕ} {State : Type} (tm : Turing.MultiTapeTM k Bool State) {n : ℕ} [DecidableEq State] [Fintype State] {T t : ℕ} {φ : Turing.MultiTapeTM.Feature k State} (h : φ ∈ basicFeatures n T) :
                    featureFn tm t φ ∈ stepSources tm T t

                    One step #

                    An input symbol, or a constant, costs at most one gate.

                    theorem Cslib.Circuits.Boolean.MachineSimulation.synthesis_read {k : ℕ} {State : Type} (tm : Turing.MultiTapeTM k Bool State) {n : ℕ} [DecidableEq State] [Fintype State] {T t : ℕ} (ht : t ≤ T) (i : Fin k) (s : Option Bool) :

                    The symbol read by a work head, from the heads and cells in the window.

                    The symbol read by the input head, from its position and the input bits.

                    The cost of the first phase of a step.

                    Instances For
                      theorem Cslib.Circuits.Boolean.MachineSimulation.synthesis_reads {k : ℕ} {State : Type} (tm : Turing.MultiTapeTM k Bool State) {n : ℕ} [DecidableEq State] [Fintype State] {T t : ℕ} (ht : t ≤ T) :

                      Phase 1: the symbols read, from the basic features and the inputs.

                      The indicator of a situation, from the state and the symbols read.

                      Phase 2: every situation indicator.

                      Phase 3: the next configuration #

                      The budget for one basic feature of the next configuration: its step equation has at most 4 |Situation| + 2 terms (Turing.MultiTapeTM.Feature.length_stepTerms_le), each of at most three literals.

                      Instances For
                        theorem Cslib.Circuits.Boolean.MachineSimulation.synthesis_next {k : ℕ} {State : Type} (tm : Turing.MultiTapeTM k Bool State) {n : ℕ} [DecidableEq State] [Fintype State] {T t : ℕ} (ht : t ≤ T) {φ : Turing.MultiTapeTM.Feature k State} (hφ : φ ∈ basicFeatures n T) :

                        Every basic feature of the next configuration, from the terms of its step equation.

                        theorem Cslib.Circuits.Boolean.MachineSimulation.synthesis_nexts {k : ℕ} {State : Type} (tm : Turing.MultiTapeTM k Bool State) {n : ℕ} [DecidableEq State] [Fintype State] {T t : ℕ} (ht : t ≤ T) :
                        Synthesis interpretation (stepSources tm T t) (basicAt tm T (t + 1)) (featureCount n T k State * featureCost k State)

                        Phase 3: all basic features of the next configuration.

                        The cost of one step of the simulation.

                        Instances For
                          theorem Cslib.Circuits.Boolean.MachineSimulation.synthesis_step {k : ℕ} {State : Type} (tm : Turing.MultiTapeTM k Bool State) {n : ℕ} [DecidableEq State] [Fintype State] {T t : ℕ} (ht : t ≤ T) :
                          Synthesis interpretation (inputs n ∪ basicAt tm T t) (basicAt tm T (t + 1)) (stepCost n T k State)

                          One step of the simulation: the basic features at time t + 1, from those at time t.

                          The whole run #

                          theorem Cslib.Circuits.Boolean.MachineSimulation.synthesis_basic_zero {k : ℕ} {State : Type} (tm : Turing.MultiTapeTM k Bool State) {n : ℕ} [DecidableEq State] [Fintype State] {T : ℕ} :

                          The basic features at time 0, which do not depend on the input.

                          theorem Cslib.Circuits.Boolean.MachineSimulation.synthesis_basic {k : ℕ} {State : Type} (tm : Turing.MultiTapeTM k Bool State) {n : ℕ} [DecidableEq State] [Fintype State] {T : ℕ} (t : ℕ) :
                          t ≤ T → Synthesis interpretation (inputs n) (basicAt tm T t) (featureCount n T k State + t * stepCost n T k State)

                          The simulation: the basic features at every time t ≤ T, from the inputs.

                          The total cost of simulating T steps on inputs of length n.

                          Instances For

                            The simulation cost is polynomially bounded when the number of steps is.

                            noncomputable def Cslib.Circuits.Boolean.MachineSimulation.acceptedWithin {k : ℕ} {State : Type} (tm : Turing.MultiTapeTM k Bool State) [DecidableEq State] (T : ℕ → ℕ) :

                            The inputs on which tm has written [true] after T n steps, on inputs of length n.

                            Instances For

                              An input is accepted within T steps when the machine has written [true] by then.

                              Machines with polynomial running time have polynomial circuits. The inputs on which a machine has written [true] within a polynomially bounded number of steps form a language in P/poly.