Documentation

Complexitylib.Circuits.BranchingProgram

Permutation branching programs #

Width-w permutation branching programs: a program is a list of instructions, each of which reads one input variable and applies one of two permutations of Fin w accordingly; the program evaluates to the ordered product of the selected permutations (roadmap track M3, toward Barrington's theorem).

Main definitions and results #

structure Complexity.BPInstr (w : ) :

A single width-w branching-program instruction: read variable var, and apply perm1 if it is true, perm0 if it is false.

  • var :

    The input variable this instruction reads.

  • perm0 : Equiv.Perm (Fin w)

    The permutation applied when the variable is false.

  • perm1 : Equiv.Perm (Fin w)

    The permutation applied when the variable is true.

Instances For
    @[reducible, inline]
    abbrev Complexity.BP (w : ) :

    A width-w permutation branching program is a list of instructions.

    Equations
    Instances For
      def Complexity.BPInstr.eval {w : } (α : Bool) (ins : BPInstr w) :

      The permutation an instruction selects under an assignment.

      Equations
      Instances For
        def Complexity.BP.eval {w : } (α : Bool) (p : BP w) :

        Evaluate a branching program to a permutation: the ordered product of its instructions' selected permutations.

        Equations
        Instances For
          @[simp]
          theorem Complexity.BP.eval_nil {w : } (α : Bool) :
          eval α [] = 1
          theorem Complexity.BP.eval_append {w : } (α : Bool) (p q : BP w) :
          eval α (p ++ q) = eval α p * eval α q

          Product semantics. Concatenating programs multiplies their evaluated permutations — the compositional law underlying Barrington's construction.

          theorem Complexity.BP.eval_cons {w : } (α : Bool) (ins : BPInstr w) (p : BP w) :
          eval α (ins :: p) = BPInstr.eval α ins * eval α p

          Evaluating a cons prepends the head instruction's permutation.

          theorem Complexity.BP.eval_singleton {w : } (α : Bool) (ins : BPInstr w) :
          eval α [ins] = BPInstr.eval α ins

          A single-instruction program evaluates to that instruction's permutation.

          def Complexity.BPInstr.rename {w : } (σ : ) (ins : BPInstr w) :

          Rename the input variables of an instruction along σ.

          Equations
          Instances For
            def Complexity.BP.rename {w : } (σ : ) (p : BP w) :
            BP w

            Rename the input variables throughout a program.

            Equations
            Instances For
              theorem Complexity.BPInstr.eval_rename {w : } (α : Bool) (σ : ) (ins : BPInstr w) :
              eval α (rename σ ins) = eval (α σ) ins

              Renaming an instruction's variables is a semantics-preserving relabeling: evaluating the renamed instruction at α equals evaluating the original at α ∘ σ.

              theorem Complexity.BP.eval_rename {w : } (α : Bool) (σ : ) (p : BP w) :
              eval α (rename σ p) = eval (α σ) p

              Evaluation is invariant under a semantics-preserving variable rename: evaluating the renamed program at α equals evaluating the original at α ∘ σ.

              def Complexity.BP.vars {w : } (p : BP w) :

              The set of input variables a branching program reads.

              Equations
              Instances For
                theorem Complexity.BPInstr.eval_eq_of_agree {w : } (ins : BPInstr w) (α β : Bool) (h : α ins.var = β ins.var) :
                eval α ins = eval β ins

                Agreement on an instruction's variable fixes the permutation it selects.

                theorem Complexity.BP.eval_eq_of_agree {w : } (p : BP w) (α β : Bool) (h : ∀ (i : ), i p.varsα i = β i) :
                eval α p = eval β p

                Locality. A branching program's value depends only on the variables it reads: if two assignments agree on BP.vars p, they yield the same permutation.