Documentation

Complexitylib.Metacomplexity.MCSP.Defs

Minimum Circuit Size Problem -- definitions #

This definitions layer gives MCSP a total, canonical input format and pins its semantics to Complexitylib's exact fan-in-two circuit convention. An instance stores an arity n, a typed 2^n-entry truth table, and a size threshold. Truth-table position k denotes the input whose variable j is bit j of k, so variables are enumerated in little-endian order.

Positive arities use Basis.andOr2: primary inputs and negation flags are free, while every internal and output gate is counted. The circuit type intentionally has no zero-input member. Following CircuitFamily.size, the unique zero-input answer is therefore stored directly and assigned size zero.

The codec is total. It rejects malformed pairing, noncanonical binary natural fields, a truth table of the wrong length, and trailing data. Malformed strings are outside MCSP.

A well-formed MCSP instance with a structurally exact truth-table length.

  • arity :

    Number of inputs of the represented Boolean function.

  • table : BitString (2 ^ self.arity)

    Function values in increasing little-endian input-index order.

  • threshold :

    Maximum allowed circuit size.

Instances For

    Truth-table bits as their canonical variable-length machine payload.

    Equations
    Instances For
      def Complexity.MCSP.Instance.inputIndex {arity : } (input : BitString arity) :
      Fin (2 ^ arity)

      Interpret an input as its little-endian truth-table index.

      Equations
      Instances For
        def Complexity.MCSP.Instance.inputOfIndex {arity : } (index : Fin (2 ^ arity)) :
        BitString arity

        Decode a truth-table index as its fixed-width little-endian input.

        Equations
        Instances For

          The Boolean function denoted by an instance's truth table.

          Equations
          Instances For
            def Complexity.MCSP.Instance.ofFunction (arity threshold : ) (f : BitString arityBool) :

            Package a Boolean function as its exact canonical truth table at a chosen MCSP threshold.

            Equations
            Instances For

              Replace only the size threshold of an instance.

              Equations
              Instances For

                Canonically encode arity, threshold, and the exact truth-table payload.

                The natural fields use minimal little-endian binary and the two nested pairs make both field boundaries self-delimiting.

                Equations
                Instances For

                  Decode exactly one canonical MCSP instance.

                  Every failure mode returns none, including a truth-table payload whose length differs from 2^arity.

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

                    Minimum circuit size under the library's total MCSP convention.

                    At positive arity this is exactly Circuit.sizeComplexity Basis.andOr2. At arity zero it is zero, matching the explicit-bit convention used by CircuitFamily.

                    Equations
                    Instances For

                      A direct circuit-witness formulation of an MCSP yes-instance.

                      For positive arity this asks for a typed circuit no larger than the threshold. At arity zero the separately stored answer has size zero, so every natural threshold accepts it.

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

                        The total Minimum Circuit Size Problem over canonical encoded instances.

                        Malformed strings are no-instances. Positive-arity size uses Basis.andOr2; zero arity uses the explicit size-zero convention documented on MCSP.Instance.minimumSize.

                        Equations
                        Instances For