Documentation

Complexitylib.Circuits.Unrolling.Amplification.Defs

Parallel amplification circuits -- definitions #

This definitions layer emits several independent copies of a bounded-trace acceptance circuit. Every copy reads the same data wires and its own block of choice wires. The copies are serialized consecutively in the raw code, but their semantics are parallel: each copy receives only the shared primary inputs assigned to it and records one verdict wire.

After all copies have been emitted, a unary threshold fragment computes their strict majority. The construction is proof-free. Later modules establish the exact gate count, topological ordering, and evaluation semantics.

def Complexity.CircuitUnrolling.InputWires.weaken {T n available : } (layout : InputWires T n available) (extra : ) :
InputWires T n (available + extra)

Regard an input layout as living in a larger prefix obtained by appending extra wires. The absolute locations of every existing input are unchanged.

Equations
Instances For
    @[simp]
    theorem Complexity.CircuitUnrolling.InputWires.weaken_choice_val {T n available : } (layout : InputWires T n available) (extra : ) (i : Fin T) :
    ((layout.weaken extra).choice i) = (layout.choice i)

    Weakening an input layout does not change a choice wire's absolute index.

    @[simp]
    theorem Complexity.CircuitUnrolling.InputWires.weaken_data_val {T n available : } (layout : InputWires T n available) (extra : ) (i : Fin n) :
    ((layout.weaken extra).data i) = (layout.data i)

    Weakening an input layout does not change a data wire's absolute index.

    structure Complexity.CircuitUnrolling.ParallelInputWires (runs T n available : ) :

    Locations of several choice blocks and one shared data block in an existing wire prefix. Run j reads the choice map choice j and every run reads the same data map.

    • choice : Fin runsFin TFin available

      Choice wire at a run index and a within-run time index.

    • data : Fin nFin available

      Shared input-data wires.

    Instances For
      def Complexity.CircuitUnrolling.ParallelInputWires.run {runs T n available : } (layout : ParallelInputWires runs T n available) (j : Fin runs) :
      InputWires T n available

      Select one run's ordinary bounded-trace input layout.

      Equations
      Instances For
        @[simp]
        theorem Complexity.CircuitUnrolling.ParallelInputWires.run_choice {runs T n available : } (layout : ParallelInputWires runs T n available) (j : Fin runs) (t : Fin T) :
        (layout.run j).choice t = layout.choice j t

        Selecting a run recovers that run's choice map.

        @[simp]
        theorem Complexity.CircuitUnrolling.ParallelInputWires.run_data {runs T n available : } (layout : ParallelInputWires runs T n available) (j : Fin runs) (i : Fin n) :
        (layout.run j).data i = layout.data i

        Selecting a run retains the shared data map.

        Canonical primary-input order for parallel amplification: all runs * T choice bits in row-major run/time order, followed by the shared n data bits.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          @[simp]
          theorem Complexity.CircuitUnrolling.prefixParallelInputWires_choice_val (runs T n : ) (j : Fin runs) (t : Fin T) :
          ((prefixParallelInputWires runs T n).choice j t) = t + T * j

          Canonical parallel choice wire (j, t) has row-major absolute index t + T * j.

          @[simp]
          theorem Complexity.CircuitUnrolling.prefixParallelInputWires_data_val (runs T n : ) (i : Fin n) :
          ((prefixParallelInputWires runs T n).data i) = runs * T + i

          Canonical shared data starts immediately after every choice block.

          Accumulated raw code while emitting independent acceptance copies.

          verdictWires has the final arity from the beginning, avoiding dependent casts while folding over run indices. Before run j is emitted its entry is a dummy value; prefix invariants only interpret entries for completed runs.

          • Acceptance fragments emitted so far.

          • verdictWires : Fin runs

            Absolute output wire assigned to each completed run.

          Instances For

            First unused absolute wire after this build and its primary-input prefix.

            Equations
            Instances For

              Empty acceptance-copy build. Verdict entries are placeholders until their corresponding runs are emitted.

              Equations
              Instances For
                noncomputable def Complexity.CircuitUnrolling.acceptanceCopiesBuildStep {k : } (tm : NTM k) {runs T n primaryAvailable : } (layout : ParallelInputWires runs T n primaryAvailable) (build : AcceptanceCopiesBuild runs) (j : Fin runs) :

                Append one bounded-trace acceptance circuit and record its final wire as the selected run's verdict. The run layout is weakened across all gates emitted by earlier copies without changing any primary-input index.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  noncomputable def Complexity.CircuitUnrolling.acceptanceCopiesBuildFrom {k : } (tm : NTM k) {runs T n primaryAvailable : } (layout : ParallelInputWires runs T n primaryAvailable) (build : AcceptanceCopiesBuild runs) (indices : List (Fin runs)) :

                  Append a listed sequence of acceptance copies to an existing build.

                  Equations
                  Instances For
                    noncomputable def Complexity.CircuitUnrolling.prefixAcceptanceCopiesBuild {k : } (tm : NTM k) (runs T n primaryAvailable i : ) (layout : ParallelInputWires runs T n primaryAvailable) :

                    Build the first i canonical acceptance copies. List take saturates when i exceeds the total number of runs.

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

                      Complete build containing one independent acceptance circuit per run.

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

                        Raw concatenation of every independent acceptance copy.

                        Equations
                        Instances For
                          noncomputable def Complexity.CircuitUnrolling.acceptanceCopiesSize {k : } (tm : NTM k) (runs T n primaryAvailable : ) (layout : ParallelInputWires runs T n primaryAvailable) :

                          Exact gate count recorded after emitting every acceptance copy.

                          Equations
                          Instances For
                            noncomputable def Complexity.CircuitUnrolling.acceptanceCopiesVerdictWires {k : } (tm : NTM k) (runs T n primaryAvailable : ) (layout : ParallelInputWires runs T n primaryAvailable) :
                            Fin runs

                            Absolute wire carrying each run's acceptance verdict.

                            Equations
                            Instances For

                              Smallest integer count constituting a strict majority of runs.

                              Equations
                              Instances For
                                def Complexity.CircuitUnrolling.parallelAcceptanceBits {k n runs : } (tm : NTM k) (T : ) (x : BitString n) (choices : Fin runsBitString T) :

                                Acceptance bits produced by independent bounded runs sharing one input.

                                Equations
                                Instances For
                                  def Complexity.CircuitUnrolling.parallelChoiceBlocks (runs T : ) (seed : BitString (runs * T)) :
                                  Fin runsBitString T

                                  Split a flat row-major seed into one bounded choice block per run.

                                  Equations
                                  Instances For
                                    @[simp]
                                    theorem Complexity.CircuitUnrolling.parallelChoiceBlocks_apply (runs T : ) (seed : BitString (runs * T)) (j : Fin runs) (t : Fin T) :
                                    parallelChoiceBlocks runs T seed j t = seed (finProdFinEquiv (j, t))

                                    Reading a flat seed's (j, t) entry uses the canonical product index.

                                    def Complexity.CircuitUnrolling.canonicalAcceptanceBits {k n : } (tm : NTM k) (runs T : ) (x : BitString n) (seed : BitString (runs * T)) :

                                    Per-run acceptance bits under the canonical flattened-seed layout.

                                    Equations
                                    Instances For
                                      noncomputable def Complexity.CircuitUnrolling.amplifiedAcceptanceRawCircuit {k : } (tm : NTM k) (runs T n primaryAvailable : ) (layout : ParallelInputWires runs T n primaryAvailable) :

                                      Independent bounded-trace acceptance copies followed by a strict-majority threshold over their recorded verdict wires.

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

                                        Absolute wire carrying the amplified circuit's strict-majority output.

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

                                          Canonical amplified raw circuit with all flattened choice blocks before the shared input data.

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