Documentation

Complexitylib.Circuits.Unrolling.Defs

Circuit layouts for bounded Turing-machine traces #

This file defines the wire layout used to unroll a bounded nondeterministic Turing-machine trace. A configuration is represented by one-hot atoms for its state, tape-head positions, and tape-cell symbols. Head positions range over Fin (T + 1) and cells over Fin (T + 2); the extra cell keeps output cell one present even at the zero-step horizon.

The primary-input layout is independent of the configuration layout. This lets later clients place random choices, data, and auxiliary inputs wherever they choose. prefixInputWires supplies the canonical choices-first order.

A named tape of a machine with k work tapes.

Instances For

    A named tape on which a machine transition may write.

    Instances For

      The zero-based position of a writable tape in work/output order.

      Equations
      Instances For

        The zero-based position of a named tape in input/work/output order.

        Equations
        Instances For
          inductive Complexity.CircuitUnrolling.ConfigAtom {k : } (tm : NTM k) (T : ) :

          A one-hot proposition about a bounded machine configuration.

          Instances For

            Number of Boolean wires in one bounded configuration block.

            Equations
            Instances For

              State/head/cell sum representation used to construct the explicit layout.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                Named tapes are explicitly equivalent to their input/work/output indices.

                Equations
                Instances For
                  noncomputable def Complexity.CircuitUnrolling.headAtomEquiv (k T : ) :
                  TapeSlot k × Fin (T + 1) Fin ((k + 2) * (T + 1))

                  Tape-head atoms are explicitly equivalent to their contiguous layout indices.

                  Equations
                  Instances For
                    noncomputable def Complexity.CircuitUnrolling.cellAtomEquiv (k T : ) :
                    (TapeSlot k × Fin (T + 2)) × Γ Fin (4 * (k + 2) * (T + 2))

                    Tape-cell atoms are explicitly equivalent to their contiguous layout indices.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      noncomputable def Complexity.CircuitUnrolling.configAtomEquiv {k : } (tm : NTM k) (T : ) :

                      Explicit equivalence between configuration atoms and their block indices.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        @[implicit_reducible]
                        noncomputable instance Complexity.CircuitUnrolling.instFintypeConfigAtom {k : } (tm : NTM k) (T : ) :

                        Finite enumeration of configuration atoms in explicit wire order.

                        Equations
                        noncomputable def Complexity.CircuitUnrolling.stateIndex {k : } (tm : NTM k) (q : tm.Q) :

                        Zero-based index of a machine state in the fixed finite-state ordering.

                        Equations
                        Instances For
                          noncomputable def Complexity.CircuitUnrolling.configIndex {k : } (tm : NTM k) (T : ) :
                          ConfigAtom tm T

                          Zero-based index of an atom within one configuration block.

                          Equations
                          Instances For
                            theorem Complexity.CircuitUnrolling.configAtomEquiv_apply_val {k : } (tm : NTM k) (T : ) (atom : ConfigAtom tm T) :
                            ((configAtomEquiv tm T) atom) = configIndex tm T atom

                            The explicit arithmetic index agrees with the atom-layout equivalence.

                            theorem Complexity.CircuitUnrolling.configIndex_lt {k : } (tm : NTM k) (T : ) (atom : ConfigAtom tm T) :
                            configIndex tm T atom < configWidth tm T

                            Every explicit atom index lies inside its configuration block.

                            @[simp]

                            State atoms occupy the first portion of a configuration block.

                            @[simp]
                            theorem Complexity.CircuitUnrolling.configIndex_head {k : } (tm : NTM k) (T : ) (tape : TapeSlot k) (position : Fin (T + 1)) :
                            configIndex tm T (ConfigAtom.head tape position) = Fintype.card tm.Q + tape.index * (T + 1) + position

                            Head atoms follow states, ordered first by tape and then position.

                            @[simp]
                            theorem Complexity.CircuitUnrolling.configIndex_cell {k : } (tm : NTM k) (T : ) (tape : TapeSlot k) (position : Fin (T + 2)) (symbol : Γ) :
                            configIndex tm T (ConfigAtom.cell tape position symbol) = Fintype.card tm.Q + (k + 2) * (T + 1) + (tape.index * (T + 2) + position) * 4 + (symbolIndex symbol)

                            Cell atoms follow heads, ordered by tape, position, and symbol.

                            noncomputable def Complexity.CircuitUnrolling.configWire {k : } (tm : NTM k) (T base : ) (atom : ConfigAtom tm T) :

                            Absolute wire carrying a configuration atom after a given prefix.

                            Equations
                            Instances For
                              def Complexity.CircuitUnrolling.ConfigAtom.value {k : } {tm : NTM k} {T : } (c : Cfg k tm.Q) (atom : ConfigAtom tm T) :

                              Boolean truth value of an atom in a concrete configuration.

                              Equations
                              Instances For
                                def Complexity.CircuitUnrolling.EncodesConfig {k : } (tm : NTM k) (T base : ) (wires : Array Bool) (c : Cfg k tm.Q) :

                                An array encodes a configuration at base when every atom wire has its semantic one-hot value.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  structure Complexity.CircuitUnrolling.InputWires (T n available : ) :

                                  Locations of choice and input-data bits among an existing wire prefix.

                                  • choice : Fin TFin available

                                    Wire carrying each nondeterministic choice bit.

                                  • data : Fin nFin available

                                    Wire carrying each input-data bit.

                                  Instances For

                                    Canonical input order: all choice bits, followed by all input-data bits.

                                    Equations
                                    Instances For
                                      @[simp]

                                      In the canonical layout, choice i is primary input wire i.

                                      @[simp]

                                      In the canonical layout, data bit i follows all T choice wires.

                                      A Boolean source used by the one-gate initialization fragment.

                                      • constant {available : } (value : Bool) : InitSource available

                                        A constant Boolean value.

                                      • wire {available : } (input : Fin available) (negated : Bool) : InitSource available

                                        An existing wire, optionally negated.

                                      Instances For
                                        def Complexity.CircuitUnrolling.InitSource.value {available : } (assignment : Fin availableBool) :
                                        InitSource availableBool

                                        Semantic value of an initialization source under a prefix assignment.

                                        Equations
                                        Instances For

                                          Compile an initialization source to exactly one raw gate.

                                          Equations
                                          Instances For
                                            def Complexity.CircuitUnrolling.initSource {k : } (tm : NTM k) (T n available : ) (layout : InputWires T n available) :
                                            ConfigAtom tm TInitSource available

                                            Source for the initial one-hot value of a bounded configuration atom.

                                            Equations
                                            Instances For
                                              noncomputable def Complexity.CircuitUnrolling.configAtoms {k : } (tm : NTM k) (T : ) :

                                              Configuration atoms listed in exactly their explicit wire order.

                                              Equations
                                              Instances For
                                                noncomputable def Complexity.CircuitUnrolling.initFragment {k : } (tm : NTM k) (T n available : ) (layout : InputWires T n available) :

                                                One-gate-per-atom fragment producing the initial configuration block.

                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For