Documentation

Complexitylib.Algebraic.LowerBound.Monotone.MatrixProduct.NegationLimited.Internal

Internals of the negation-limited Boolean matrix product bound #

This file reduces De Morgan circuits with few NOT gates computing the Boolean matrix product to the monotone partial-product bound Algebraic.Monotone.MatrixProduct.Internal.card_le_andCost. The surface statements are in Complexitylib.Algebraic.LowerBound.Monotone.MatrixProduct.NegationLimited.

Circuit surgery #

Few NOT gates (div_mul_div_mul_le_andCost) #

Induction on the bound t on the number of NOT gates. Let G be the first NOT gate. Every wire before it computes a monotone function (isMonotone_trace), in particular its argument h. Let F be the left half of the variables: the rows i < I / 2 of x and the columns j < J / 2 of y, and let c be the value of h on the indicator of F. If c = 0, every assignment that is zero outside F lies below that indicator, so h is zero there; if c = 1, every assignment that is one on F lies above it, so h is one there. Fixing the variables outside F to 0, respectively those of F to 1, therefore makes G constant, so it can be frozen, and keeps a product of (I / 2) × K by K × (J / 2) matrices on the rows and columns whose variables stay free (the first halves if c = 0, the next halves if c = 1). The new circuit has one NOT gate fewer and the same AND gates. With no NOT gate left, the monotone bound gives K * (I / 2 ^ t) * (J / 2 ^ t) AND gates.

NOT gates of few variables (card_le_andCost_of_dependsOnlyOn) #

If every NOT gate computes a function of the variables in S, fixing those variables to zero makes every NOT gate constant. Freezing them leaves a circuit without NOT gates computing the partial product over the triples whose variables avoid S, and at most |S| * max I J triples meet S.

Freezing gates to constants #

Replace the line of every gate G with sel G = some b by the constant gate b.

Equations
Instances For

    Freezing gates that already take their constant values does not change the evaluation.

    Freezing NOT gates keeps the AND-gate count.

    Freezing every NOT gate leaves none.

    Freezing one NOT gate removes exactly one NOT gate.

    Freeze the selected gates of a circuit.

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

      Fixing inputs to a constant #

      Fix every input v with keep v = false to the constant b, read from a single constant gate placed before the circuit.

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

        Wires below the first NOT gate #

        A NOT gate computes the negation of its argument.

        theorem Algebraic.Monotone.MatrixProduct.NegationLimited.Internal.isMonotone_trace {n g : ℕ} (p : Program DeMorgan.signature n g) (B : ℕ) (hB : ∀ (G : Fin g), ↑G < B → (p.lines G).op ≠ DeMorgan.Op.not) (w : Wire n g) (hw : ↑w.index < n + B) :

        Every wire before the first NOT gate computes a monotone function.

        Halving #

        The left half of the variables: rows i < I / 2 of x and columns j < J / 2 of y.

        Equations
        Instances For
          theorem Algebraic.Monotone.MatrixProduct.NegationLimited.Internal.leftHalf_x {N I J K : ℕ} (L : Internal.Layout N I J K) (i : Fin I) (k : Fin K) :
          leftHalf L (L.x i k) = decide (↑i < I / 2)
          theorem Algebraic.Monotone.MatrixProduct.NegationLimited.Internal.leftHalf_y {N I J K : ℕ} (L : Internal.Layout N I J K) (k : Fin K) (j : Fin J) :
          leftHalf L (L.y k j) = decide (↑j < J / 2)

          The kept half of Fin I: the first I / 2 indices when b = false, the next I / 2 when b = true.

          Equations
          Instances For

            The layout of the kept rows and columns.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              theorem Algebraic.Monotone.MatrixProduct.NegationLimited.Internal.exists_halve {N M I J K : ℕ} (L : Internal.Layout N I J K) (z : Fin I → Fin J → Fin M) (C : Circuit DeMorgan.signature N M) (computes : ∀ (a : Fin N → Bool) (i : Fin I) (j : Fin J), C.eval DeMorgan.interpretation a (z i j) = decide (∃ (k : Fin K), a (L.x i k) = true ∧ a (L.y k j) = true)) (hnot : 0 < C.cost DeMorgan.notCost) :
              ∃ (L' : Internal.Layout N (I / 2) (J / 2) K) (z' : Fin (I / 2) → Fin (J / 2) → Fin M) (C' : Circuit DeMorgan.signature N M), C'.cost DeMorgan.notCost + 1 = C.cost DeMorgan.notCost ∧ C'.cost DeMorgan.andCost = C.cost DeMorgan.andCost ∧ ∀ (a : Fin N → Bool) (i : Fin (I / 2)) (j : Fin (J / 2)), C'.eval DeMorgan.interpretation a (z' i j) = decide (∃ (k : Fin K), a (L'.x i k) = true ∧ a (L'.y k j) = true)

              One NOT gate can be traded for halving the numbers of rows and columns.

              Few NOT gates #

              theorem Algebraic.Monotone.MatrixProduct.NegationLimited.Internal.div_mul_div_mul_le_andCost {N K : ℕ} (t : ℕ) {I J : ℕ} (L : Internal.Layout N I J K) {M : ℕ} (z : Fin I → Fin J → Fin M) (C : Circuit DeMorgan.signature N M) :
              C.cost DeMorgan.notCost ≤ t → (∀ (a : Fin N → Bool) (i : Fin I) (j : Fin J), C.eval DeMorgan.interpretation a (z i j) = decide (∃ (k : Fin K), a (L.x i k) = true ∧ a (L.y k j) = true)) → I / 2 ^ t * (J / 2 ^ t) * K ≤ C.cost DeMorgan.andCost

              Few NOT gates. A De Morgan circuit with at most t NOT gates computing the product of an I × K matrix and a K × J matrix, laid out injectively among its inputs, has at least (I / 2 ^ t) * (J / 2 ^ t) * K AND gates.

              NOT gates of few variables #

              theorem Algebraic.Monotone.MatrixProduct.NegationLimited.Internal.mul_mul_le_card_add {N I J K : ℕ} (L : Internal.Layout N I J K) (S : Finset (Fin N)) :
              I * J * K ≤ {t : Fin I × Fin K × Fin J | L.x t.1 t.2.1 ∉ S ∧ L.y t.2.1 t.2.2 ∉ S}.card + S.card * max I J

              At most |S| * max I J triples have a variable in S.

              theorem Algebraic.Monotone.MatrixProduct.NegationLimited.Internal.mul_mul_le_andCost_add {N M I J K : ℕ} (L : Internal.Layout N I J K) (z : Fin I → Fin J → Fin M) (C : Circuit DeMorgan.signature N M) (computes : ∀ (a : Fin N → Bool) (i : Fin I) (j : Fin J), C.eval DeMorgan.interpretation a (z i j) = decide (∃ (k : Fin K), a (L.x i k) = true ∧ a (L.y k j) = true)) (S : Finset (Fin N)) (local_ : ∀ (G : Fin C.size), (C.program.lines G).op = DeMorgan.Op.not → DependsOnlyOn (C.program.gateFunction DeMorgan.interpretation G) S) :

              NOT gates of few variables. If every NOT gate of a De Morgan circuit computing the product of an I × K matrix and a K × J matrix computes a function of the variables in S, the circuit has at least I * J * K - |S| * max I J AND gates.

              Non-monotone gates of few variables #

              A function on assignments that is both monotone and antitone is constant.

              If every gate computing a non-monotone function depends only on the inputs in S, so does every NOT gate.