Documentation

Complexitylib.Circuits.Encoding.Family

Encodings of whole circuit families #

This module adds the length-zero wrapper around the positive-arity circuit codec. A leading tag distinguishes the explicit empty-input answer from an ordinary encoded circuit.

Encode the member of an AND/OR circuit family at input length n.

The zero-length member is the tag false followed by its explicit answer. Positive lengths use the tag true followed by the ordinary circuit code.

Equations
Instances For
    @[simp]

    The length-zero member encodes as the false tag followed by the explicit answer bit.

    @[simp]

    A positive-length member encodes as the true tag followed by its circuit's code.

    Evaluate a tagged family code on a variable-length input.

    The zero tag is accepted only for the empty input and must carry exactly one answer bit. The positive tag is accepted only for a nonempty input and delegates to the exact-arity circuit evaluator.

    Equations
    Instances For

      On the empty input, successful evaluation is exactly a canonical zero tag carrying one answer bit.

      theorem Complexity.CircuitCode.evalFamilyCode_isSome_iff_of_ne_nil (code input : List Bool) (hne : input []) :
      (evalFamilyCode code input).isSome = true ∃ (circuit : RawCircuit), code = true :: circuit.encode RawCircuit.WellFormed input.length circuit

      On a nonempty input, successful evaluation is exactly a positive tag carrying a canonical, topologically well-formed circuit code.

      @[simp]

      Tagged family encoding handles the explicit empty-input bit and agrees with the typed circuit at every positive input length.

      @[simp]

      Machine-facing list form of evalFamilyCode_encodeAt: selecting the member at the supplied input's length agrees with CircuitFamily.evalList.

      The length-zero tagged code has exactly two bits: the tag and the answer.

      @[simp]

      A positive-length tagged code is one bit (the tag) longer than the underlying circuit code.

      theorem Complexity.CircuitCode.encodeAt_succ_length_le (F : CircuitFamily Basis.andOr2) (n : ) :
      (F.encodeAt (n + 1)).length 2 + F.size (n + 1) * (2 * (n + 1 + F.size (n + 1)) + 6)

      The positive-length tagged family code inherits the concrete polynomial bound for its member circuit.