Documentation

Complexitylib.Algebraic.LowerBound.Monotone.MatrixProduct.NegationLimited

Boolean matrix product with few negations #

Every monotone circuit for the Boolean product of two n × n matrices has at least n ^ 3 AND gates (Algebraic.Monotone.MatrixProduct.cube_le_andCost), while circuits with negations compute it with O(n ^ ω) gates through integer matrix multiplication. This file interpolates between the two by the number of negations.

The circuit model is the imported library's De Morgan signature (DeMorgan.signature: the constants, identity, NOT, and fan-in-two AND and OR, with unbounded fan-out). NOT gates are counted by DeMorgan.notCost and AND gates by DeMorgan.andCost; every gate of the program is counted, used or not, and OR gates, constants and identities are free. With no NOT gate the model is that of Algebraic.Monotone.MatrixProduct.card_le_andCost (monotone circuits with constants), and it contains the AND/OR circuits of cube_le_andCost.

Main results #

Proof #

The first NOT gate reads a monotone function h of the inputs. Split the rows of x and the columns of y into halves and evaluate h on the assignment that is one exactly on the first halves. If it is zero, h vanishes once the second halves are set to zero; if it is one, h is one once the first halves are set to one. Either way the NOT gate becomes constant, and the product of the remaining halves is still computed, since an entry of the product reads only its own row and column. Replacing the NOT gate by its constant and the fixed inputs by constants gives a circuit with one NOT gate fewer, the same AND gates, and half the rows and columns. After t steps the monotone bound for circuits with constants applies. If instead every NOT gate depends only on the inputs in S, setting those to zero makes every NOT gate constant at once and leaves a monotone circuit for the partial product over the triples that avoid S. The proofs are in Complexitylib.Algebraic.LowerBound.Monotone.MatrixProduct.NegationLimited.Internal.

Prior art #

No lower bound for the Boolean matrix product by circuits with a bounded number of NOT gates appears in the literature we know. The monotone bound n ^ 3 is due to Pratt (1975), Paterson (1975) and Mehlhorn--Galil (1976). Markov (1958) and Fischer (1975) show that ⌈log₂ (N + 1)⌉ NOT gates suffice for every function of N inputs, with polynomial overhead in Fischer's construction. Jukna (Information Processing Letters, 2004) uses a similar direct-sum restriction for an explicit multi-output function needing log n - O(log log n) NOT gates.

theorem Algebraic.Monotone.MatrixProduct.NegationLimited.div_mul_div_mul_le_andCost {N M I J K : ℕ} (t : ℕ) (x : Fin I → Fin K → Fin N) (y : Fin K → Fin J → Fin N) (distinct : Function.Injective (Sum.elim (Function.uncurry x) (Function.uncurry y))) (z : Fin I → Fin J → Fin M) (circuit : Circuit DeMorgan.signature N M) (nots : circuit.cost DeMorgan.notCost ≤ t) (computes : ∀ (a : Fin N → Bool) (i : Fin I) (j : Fin J), circuit.eval DeMorgan.interpretation a (z i j) = decide (∃ (k : Fin K), a (x i k) = true ∧ a (y k j) = true)) :
I / 2 ^ t * (J / 2 ^ t) * K ≤ circuit.cost DeMorgan.andCost

Boolean matrix product with few negations. Place entry (i, k) of an I × K matrix at input x i k and entry (k, j) of a K × J matrix at input y k j, all at distinct inputs. A De Morgan circuit with at most t NOT gates whose output z i j computes ⋁ k, x i k ∧ y k j for every i and j has at least ⌊I / 2 ^ t⌋ * ⌊J / 2 ^ t⌋ * K AND gates.

theorem Algebraic.Monotone.MatrixProduct.NegationLimited.mul_div_sq_le_andCost (n t : ℕ) (circuit : Circuit DeMorgan.signature (n * n + n * n) (n * n)) (nots : circuit.cost DeMorgan.notCost ≤ t) (computes : ∀ (a : Fin (n * n + n * n) → Bool) (i j : Fin n), circuit.eval DeMorgan.interpretation a (productEntry n i j) = decide (∃ (k : Fin n), a (leftEntry n i k) = true ∧ a (rightEntry n k j) = true)) :
n * (n / 2 ^ t) ^ 2 ≤ circuit.cost DeMorgan.andCost

Square Boolean matrix product with few negations. A De Morgan circuit with at most t NOT gates computing the Boolean product of two n × n matrices, in the row-major layout of cube_le_andCost, has at least n * ⌊n / 2 ^ t⌋ ^ 2 AND gates.

theorem Algebraic.Monotone.MatrixProduct.NegationLimited.cube_le_four_pow_mul_andCost (n t : ℕ) (circuit : Circuit DeMorgan.signature (n * n + n * n) (n * n)) (nots : circuit.cost DeMorgan.notCost ≤ t) (computes : ∀ (a : Fin (n * n + n * n) → Bool) (i j : Fin n), circuit.eval DeMorgan.interpretation a (productEntry n i j) = decide (∃ (k : Fin n), a (leftEntry n i k) = true ∧ a (rightEntry n k j) = true)) (large : 2 ^ t ≤ n) :
n ^ 3 ≤ 4 ^ (t + 1) * circuit.cost DeMorgan.andCost

Negations needed for a sub-cubic product. If a De Morgan circuit with at most t NOT gates computes the Boolean product of two n × n matrices and 2 ^ t ≤ n, then n ^ 3 ≤ 4 ^ (t + 1) * #AND. Equivalently, a circuit with fewer than n ^ 3 / 4 ^ (t + 1) AND gates has more than t NOT gates, or n < 2 ^ t.

theorem Algebraic.Monotone.MatrixProduct.NegationLimited.mul_mul_le_andCost_add {N M I J K : ℕ} (x : Fin I → Fin K → Fin N) (y : Fin K → Fin J → Fin N) (distinct : Function.Injective (Sum.elim (Function.uncurry x) (Function.uncurry y))) (z : Fin I → Fin J → Fin M) (circuit : Circuit DeMorgan.signature N M) (computes : ∀ (a : Fin N → Bool) (i : Fin I) (j : Fin J), circuit.eval DeMorgan.interpretation a (z i j) = decide (∃ (k : Fin K), a (x i k) = true ∧ a (y k j) = true)) (S : Finset (Fin N)) (localized : ∀ (G : Fin circuit.size), (circuit.program.lines G).op = DeMorgan.Op.not → DependsOnlyOn (circuit.program.gateFunction DeMorgan.interpretation G) S) :
I * J * K ≤ circuit.cost DeMorgan.andCost + S.card * max I J

Boolean matrix product with negations of few variables. Place the entries of an I × K matrix and a K × J matrix at distinct inputs of a De Morgan circuit whose output z i j computes ⋁ k, x i k ∧ y k j for every i and j. If every NOT gate computes a function of the inputs in S, the circuit has at least I * J * K - |S| * max I J AND gates.

theorem Algebraic.Monotone.MatrixProduct.NegationLimited.cube_sub_le_andCost (n : ℕ) (circuit : Circuit DeMorgan.signature (n * n + n * n) (n * n)) (computes : ∀ (a : Fin (n * n + n * n) → Bool) (i j : Fin n), circuit.eval DeMorgan.interpretation a (productEntry n i j) = decide (∃ (k : Fin n), a (leftEntry n i k) = true ∧ a (rightEntry n k j) = true)) (S : Finset (Fin (n * n + n * n))) (localized : ∀ (G : Fin circuit.size), (circuit.program.lines G).op = DeMorgan.Op.not → DependsOnlyOn (circuit.program.gateFunction DeMorgan.interpretation G) S) :
n ^ 3 - S.card * n ≤ circuit.cost DeMorgan.andCost

Square Boolean matrix product with negations of few variables. If every NOT gate of a De Morgan circuit computing the Boolean product of two n × n matrices, in the row-major layout of cube_le_andCost, computes a function of the inputs in S, the circuit has at least n ^ 3 - |S| * n AND gates.

theorem Algebraic.Monotone.MatrixProduct.NegationLimited.mul_mul_le_andCost_add_of_monotone_or_dependsOnlyOn {N M I J K : ℕ} (x : Fin I → Fin K → Fin N) (y : Fin K → Fin J → Fin N) (distinct : Function.Injective (Sum.elim (Function.uncurry x) (Function.uncurry y))) (z : Fin I → Fin J → Fin M) (circuit : Circuit DeMorgan.signature N M) (computes : ∀ (a : Fin N → Bool) (i : Fin I) (j : Fin J), circuit.eval DeMorgan.interpretation a (z i j) = decide (∃ (k : Fin K), a (x i k) = true ∧ a (y k j) = true)) (S : Finset (Fin N)) (localized : ∀ (G : Fin circuit.size), Monotone (circuit.program.gateFunction DeMorgan.interpretation G) ∨ DependsOnlyOn (circuit.program.gateFunction DeMorgan.interpretation G) S) :
I * J * K ≤ circuit.cost DeMorgan.andCost + S.card * max I J

Boolean matrix product with non-monotone gates of few variables. If every gate of a De Morgan circuit computing the product of an I × K matrix and a K × J matrix, laid out at distinct inputs, computes a monotone function or a function of the inputs in S, the circuit has at least I * J * K - |S| * max I J AND gates.

theorem Algebraic.Monotone.MatrixProduct.NegationLimited.cube_sub_le_andCost_of_monotone_or_dependsOnlyOn (n : ℕ) (circuit : Circuit DeMorgan.signature (n * n + n * n) (n * n)) (computes : ∀ (a : Fin (n * n + n * n) → Bool) (i j : Fin n), circuit.eval DeMorgan.interpretation a (productEntry n i j) = decide (∃ (k : Fin n), a (leftEntry n i k) = true ∧ a (rightEntry n k j) = true)) (S : Finset (Fin (n * n + n * n))) (localized : ∀ (G : Fin circuit.size), Monotone (circuit.program.gateFunction DeMorgan.interpretation G) ∨ DependsOnlyOn (circuit.program.gateFunction DeMorgan.interpretation G) S) :
n ^ 3 - S.card * n ≤ circuit.cost DeMorgan.andCost

Square Boolean matrix product with non-monotone gates of few variables. If every gate of a De Morgan circuit computing the Boolean product of two n × n matrices, in the row-major layout of cube_le_andCost, computes a monotone function or a function of the inputs in S, the circuit has at least n ^ 3 - |S| * n AND gates.

theorem Algebraic.Monotone.MatrixProduct.NegationLimited.mul_logb_sub_one_lt_notCost (n : ℕ) (hn : 1 ≤ n) {ε : ℝ} (hε : ε ≤ 2) (circuit : Circuit DeMorgan.signature (n * n + n * n) (n * n)) (computes : ∀ (a : Fin (n * n + n * n) → Bool) (i j : Fin n), circuit.eval DeMorgan.interpretation a (productEntry n i j) = decide (∃ (k : Fin n), a (leftEntry n i k) = true ∧ a (rightEntry n k j) = true)) (subcubic : ↑(circuit.cost DeMorgan.andCost) < ↑n ^ (3 - ε)) :
ε / 2 * Real.logb 2 ↑n - 1 < ↑(circuit.cost DeMorgan.notCost)

Negations needed for a sub-cubic product, logarithmic form. If a De Morgan circuit computing the Boolean product of two n × n matrices, n ≥ 1, in the row-major layout of cube_le_andCost, has fewer than n ^ (3 - ε) AND gates for some ε ≤ 2, then it has more than (ε / 2) * log₂ n - 1 NOT gates.