Documentation

Complexitylib.Algebraic.LowerBound.Monotone.MatrixProduct.Internal

Internals of the monotone Boolean matrix product bound #

This file proves that every De Morgan circuit without NOT gates (AND, OR, constants and identity gates) computing a partial Boolean product z i j = ⋁ {x i k ∧ y k j | (i, k, j) ∈ T} of an I × K matrix and a K × J matrix has at least |T| AND gates (Pratt; Paterson; Mehlhorn--Galil; Wegener, The Complexity of Boolean Functions, Theorem 6.8.1, whose argument never uses the shape of T). Compiling the binary AND/OR basis into the De Morgan basis (ofAndOr) gives the full product bound I * J * K for AND/OR circuits. The surface statements are in Complexitylib.Algebraic.LowerBound.Monotone.MatrixProduct and Complexitylib.Algebraic.LowerBound.Monotone.MatrixProduct.Partial.

Proof #

Call x i k and y k j the variables of type k. The argument runs in stages k = 0, 1, …, K - 1 and never edits the circuit: each stage is a new evaluation of the same program, carried by a single interpretation whose carrier holds the gate functions of every stage at once (stageInterpretation). Stage k is sem p (k + 1); sem p 0 is the ordinary Boolean evaluation.

The creators therefore form |T| distinct AND gates.

theorem Algebraic.Monotone.MatrixProduct.Internal.and_shape (a₀ b₀ c₀ a₁ b₁ c₁ : Bool) :
(a₀ && a₁) = true → (b₀ && b₁) = false → (c₀ && c₁) = false → ¬(a₀ = true ∧ b₀ = false ∧ c₀ = false) → ¬(a₁ = true ∧ b₁ = false ∧ c₁ = false) → (b₀ = true ∧ c₁ = true ∨ b₁ = true ∧ c₀ = true) ∧ ¬(a₀ = true ∧ b₀ = true ∧ c₀ = true) ∧ ¬(a₁ = true ∧ b₁ = true ∧ c₁ = true)

The Boolean core of creator_shape for an AND gate with arguments taking the values a, b, c on the pair and the two singletons.

The pointwise order on assignments.

Equations
Instances For

    A Boolean function is monotone.

    Equations
    Instances For

      The assignment whose only true variable is u.

      Equations
      Instances For

        The assignment whose only true variables are u and w.

        Equations
        Instances For

          The De Morgan basis without negation #

          Every De Morgan operation other than negation is monotone.

          theorem Algebraic.Monotone.MatrixProduct.Internal.isMonotone_interpretation {N : ℕ} {op : DeMorgan.Op} (hop : op ≠ DeMorgan.Op.not) {f : Fin (DeMorgan.arity op) → (Fin N → Bool) → Bool} (hf : ∀ (m : Fin (DeMorgan.arity op)), IsMonotone (f m)) :
          IsMonotone fun (c : Fin N → Bool) => DeMorgan.interpretation op fun (m : Fin (DeMorgan.arity op)) => f m c
          theorem Algebraic.Monotone.MatrixProduct.Internal.creator_shape {N : ℕ} {op : DeMorgan.Op} (hop : op ≠ DeMorgan.Op.not) (F : Fin (DeMorgan.arity op) → (Fin N → Bool) → Bool) {u w : Fin N} (hp : (DeMorgan.interpretation op fun (m : Fin (DeMorgan.arity op)) => F m (pair u w)) = true) (hu : (DeMorgan.interpretation op fun (m : Fin (DeMorgan.arity op)) => F m (single u)) = false) (hw : (DeMorgan.interpretation op fun (m : Fin (DeMorgan.arity op)) => F m (single w)) = false) (hF : ∀ (m : Fin (DeMorgan.arity op)), ¬(F m (pair u w) = true ∧ F m (single u) = false ∧ F m (single w) = false)) :
          op = DeMorgan.Op.and ∧ (∃ (a : Fin (DeMorgan.arity op)) (b : Fin (DeMorgan.arity op)), a ≠ b ∧ F a (single u) = true ∧ F b (single w) = true) ∧ ∀ (m : Fin (DeMorgan.arity op)), ¬∀ (c : Fin N → Bool), F m c = true

          The local shape of a creator. A gate other than NOT whose function has the prime implicant u ∧ w while none of its arguments has it is an AND gate, one argument of which accepts u alone and the other w alone, and no argument of which is constant one.

          The NOT-gate count of a program vanishes only when it has no NOT gate.

          An injective layout of an I × K matrix x and a K × J matrix y among N circuit inputs.

          • x : Fin I → Fin K → Fin N

            The input carrying entry (i, k) of the left matrix.

          • y : Fin K → Fin J → Fin N

            The input carrying entry (k, j) of the right matrix.

          • x_inj {i : Fin I} {k : Fin K} {i' : Fin I} {k' : Fin K} : self.x i k = self.x i' k' → i = i' ∧ k = k'

            Distinct left entries use distinct inputs.

          • y_inj {k : Fin K} {j : Fin J} {k' : Fin K} {j' : Fin J} : self.y k j = self.y k' j' → k = k' ∧ j = j'

            Distinct right entries use distinct inputs.

          • x_ne_y (i : Fin I) (k k' : Fin K) (j : Fin J) : self.x i k ≠ self.y k' j

            Left and right entries use distinct inputs.

          Instances For
            def Algebraic.Monotone.MatrixProduct.Internal.Layout.ofInjective {N 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))) :
            Layout N I J K

            The layout of an injective placement of the entries of both matrices.

            Equations
            Instances For

              Variable v is a left-matrix entry of type < s.

              Equations
              Instances For

                Variable v is a right-matrix entry of type < s.

                Equations
                Instances For
                  noncomputable def Algebraic.Monotone.MatrixProduct.Internal.Layout.fix {N I J K : ℕ} (L : Layout N I J K) (s : ℕ) (c : Fin N → Bool) :
                  Fin N → Bool

                  The restriction of stage s: left entries of type < s read one, right entries of type < s read zero.

                  Equations
                  Instances For
                    def Algebraic.Monotone.MatrixProduct.Internal.Layout.IsType {N I J K : ℕ} (L : Layout N I J K) (s : ℕ) (v : Fin N) :

                    Variable v has type s.

                    Equations
                    Instances For
                      def Algebraic.Monotone.MatrixProduct.Internal.Layout.Bad {N I J K : ℕ} (L : Layout N I J K) (s : ℕ) (h : (Fin N → Bool) → Bool) :

                      A function has two distinct type-s variables among its one-variable implicants.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        def Algebraic.Monotone.MatrixProduct.Internal.Layout.product {N I J K : ℕ} (L : Layout N I J K) (T : Finset (Fin I × Fin K × Fin J)) (s : ℕ) (i : Fin I) (j : Fin J) (c : Fin N → Bool) :

                        The entry (i, j) of the product over the triples of T of type ≥ s.

                        Equations
                        Instances For
                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.isType_x {N I J K : ℕ} (L : Layout N I J K) (i : Fin I) (k : Fin K) :
                          L.IsType (↑k) (L.x i k)
                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.isType_y {N I J K : ℕ} (L : Layout N I J K) (k : Fin K) (j : Fin J) :
                          L.IsType (↑k) (L.y k j)

                          The restriction #

                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.fixedTrue_x {N I J K : ℕ} (L : Layout N I J K) {s : ℕ} {i : Fin I} {k : Fin K} :
                          L.FixedTrue s (L.x i k) ↔ ↑k < s
                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.not_fixedFalse_x {N I J K : ℕ} (L : Layout N I J K) {s : ℕ} {i : Fin I} {k : Fin K} :
                          ¬L.FixedFalse s (L.x i k)
                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.not_fixedTrue_y {N I J K : ℕ} (L : Layout N I J K) {s : ℕ} {k : Fin K} {j : Fin J} :
                          ¬L.FixedTrue s (L.y k j)
                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.fixedFalse_y {N I J K : ℕ} (L : Layout N I J K) {s : ℕ} {k : Fin K} {j : Fin J} :
                          L.FixedFalse s (L.y k j) ↔ ↑k < s
                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.fix_of_fixedTrue {N I J K : ℕ} (L : Layout N I J K) {s : ℕ} {v : Fin N} (h : L.FixedTrue s v) (c : Fin N → Bool) :
                          L.fix s c v = true
                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.fix_of_fixedFalse {N I J K : ℕ} (L : Layout N I J K) {s : ℕ} {v : Fin N} (h : L.FixedFalse s v) (c : Fin N → Bool) :
                          L.fix s c v = false
                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.fix_of_free {N I J K : ℕ} (L : Layout N I J K) {s : ℕ} {v : Fin N} (hT : ¬L.FixedTrue s v) (hF : ¬L.FixedFalse s v) (c : Fin N → Bool) :
                          L.fix s c v = c v
                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.fix_x_of_lt {N I J K : ℕ} (L : Layout N I J K) {s : ℕ} {i : Fin I} {k : Fin K} (hk : ↑k < s) (c : Fin N → Bool) :
                          L.fix s c (L.x i k) = true
                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.fix_x_of_le {N I J K : ℕ} (L : Layout N I J K) {s : ℕ} {i : Fin I} {k : Fin K} (hk : s ≤ ↑k) (c : Fin N → Bool) :
                          L.fix s c (L.x i k) = c (L.x i k)
                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.fix_y_of_lt {N I J K : ℕ} (L : Layout N I J K) {s : ℕ} {k : Fin K} {j : Fin J} (hk : ↑k < s) (c : Fin N → Bool) :
                          L.fix s c (L.y k j) = false
                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.fix_y_of_le {N I J K : ℕ} (L : Layout N I J K) {s : ℕ} {k : Fin K} {j : Fin J} (hk : s ≤ ↑k) (c : Fin N → Bool) :
                          L.fix s c (L.y k j) = c (L.y k j)
                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.fix_zero {N I J K : ℕ} (L : Layout N I J K) (c : Fin N → Bool) :
                          L.fix 0 c = c
                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.fix_fix {N I J K : ℕ} (L : Layout N I J K) {s' s : ℕ} (hs : s' ≤ s) (c : Fin N → Bool) :
                          L.fix s' (L.fix s c) = L.fix s c
                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.fix_mono {N I J K : ℕ} (L : Layout N I J K) (s : ℕ) {a b : Fin N → Bool} (hab : AssignmentLE a b) :
                          AssignmentLE (L.fix s a) (L.fix s b)
                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.isMonotone_fix_apply {N I J K : ℕ} (L : Layout N I J K) (s : ℕ) (v : Fin N) :
                          IsMonotone fun (c : Fin N → Bool) => L.fix s c v
                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.product_fix {N I J K : ℕ} (L : Layout N I J K) (T : Finset (Fin I × Fin K × Fin J)) {s' s : ℕ} (hs : s' ≤ s) (i : Fin I) (j : Fin J) (c : Fin N → Bool) :
                          L.product T s' i j (L.fix s c) = L.product T s i j c

                          Programs #

                          theorem Algebraic.Monotone.MatrixProduct.Internal.wire_induction {N g : ℕ} {σ : Signature} (p : Program σ N g) {P : Wire N g → Prop} (input : ∀ (v : Fin N), P (Wire.input v)) (gate : ∀ (G : Fin g), (∀ (m : Fin (σ.Arity (p.lines G).op)), P ((p.lines G).wires m)) → P (Wire.gate G)) (w : Wire N g) :
                          P w

                          Induction over the wires of a program in topological order.

                          theorem Algebraic.Monotone.MatrixProduct.Internal.trace_gate {N g : ℕ} {σ : Signature} {U : Type u_1} (p : Program σ N g) (interpretation : Interpretation σ U) (x : Fin N → U) (G : Fin g) :
                          p.trace interpretation x (Wire.gate G) = interpretation (p.lines G).op fun (m : Fin (σ.Arity (p.lines G).op)) => p.trace interpretation x ((p.lines G).wires m)

                          A gate wire carries the gate operation applied to its argument wires.

                          The staged evaluation #

                          def Algebraic.Monotone.MatrixProduct.Internal.Layout.stageValue {N I J K : ℕ} (L : Layout N I J K) (op : DeMorgan.Op) (u : Fin (DeMorgan.arity op) → ℕ → (Fin N → Bool) → Bool) :
                          ℕ → (Fin N → Bool) → Bool

                          The functions of one gate at every index, from the functions of its arguments. Index 0 is the ordinary evaluation. Index s + 1 (stage s) forces the gate to one when its function at index s is constant one under the restriction fix s, or when the gate operation applied to the arguments has two type-s implicants of length one (Bad).

                          Equations
                          Instances For

                            The interpretation evaluating all stages at once.

                            Equations
                            Instances For
                              noncomputable def Algebraic.Monotone.MatrixProduct.Internal.Layout.inputValue {N I J K : ℕ} (L : Layout N I J K) (v : Fin N) :
                              ℕ → (Fin N → Bool) → Bool

                              Input v at every index: index 0 reads it, index s + 1 reads it through fix s (and fix 0 changes nothing).

                              Equations
                              Instances For
                                noncomputable def Algebraic.Monotone.MatrixProduct.Internal.Layout.sem {N I J K g : ℕ} (L : Layout N I J K) (p : Program DeMorgan.signature N g) (t : ℕ) (w : Wire N g) :
                                (Fin N → Bool) → Bool

                                The function carried by a wire at index t.

                                Equations
                                Instances For
                                  theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.sem_input {N I J K g : ℕ} (L : Layout N I J K) (p : Program DeMorgan.signature N g) (t : ℕ) (v : Fin N) :
                                  L.sem p t (Wire.input v) = fun (c : Fin N → Bool) => L.fix (t - 1) c v
                                  theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.sem_gate {N I J K g : ℕ} (L : Layout N I J K) (p : Program DeMorgan.signature N g) (t : ℕ) (G : Fin g) :
                                  L.sem p t (Wire.gate G) = L.stageValue (p.lines G).op (fun (m : Fin (DeMorgan.arity (p.lines G).op)) (t : ℕ) => L.sem p t ((p.lines G).wires m)) t
                                  theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.sem_zero_gate {N I J K g : ℕ} (L : Layout N I J K) (p : Program DeMorgan.signature N g) (G : Fin g) (c : Fin N → Bool) :
                                  L.sem p 0 (Wire.gate G) c = DeMorgan.interpretation (p.lines G).op fun (m : Fin (DeMorgan.arity (p.lines G).op)) => L.sem p 0 ((p.lines G).wires m) c
                                  noncomputable def Algebraic.Monotone.MatrixProduct.Internal.Layout.preValue {N I J K g : ℕ} (L : Layout N I J K) (p : Program DeMorgan.signature N g) (s : ℕ) (G : Fin g) :
                                  (Fin N → Bool) → Bool

                                  The function of a gate at index s + 1 before forcing.

                                  Equations
                                  Instances For
                                    theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.sem_succ_gate {N I J K g : ℕ} (L : Layout N I J K) (p : Program DeMorgan.signature N g) (s : ℕ) (G : Fin g) :
                                    L.sem p (s + 1) (Wire.gate G) = if L.sem p s (Wire.gate G) (L.fix s fun (x : Fin N) => false) = true ∨ L.Bad s (L.preValue p s G) then fun (x : Fin N → Bool) => true else L.preValue p s G

                                    One stage #

                                    structure Algebraic.Monotone.MatrixProduct.Internal.Layout.StepHyp {N I J K g : ℕ} (L : Layout N I J K) (p : Program DeMorgan.signature N g) (s : ℕ) (prev next : Wire N g → (Fin N → Bool) → Bool) :

                                    Hypotheses relating the previous stage, restricted by fix s (prev), to the next stage (next) of a program without NOT gates.

                                    Instances For
                                      def Algebraic.Monotone.MatrixProduct.Internal.Layout.Covers {N I J K : ℕ} (L : Layout N I J K) (s : ℕ) (b : Fin N → Bool) :

                                      An assignment sets at most one type-s variable to zero.

                                      Equations
                                      Instances For
                                        theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.StepHyp.mono {N I J K g : ℕ} {L : Layout N I J K} {p : Program DeMorgan.signature N g} {s : ℕ} {prev next : Wire N g → (Fin N → Bool) → Bool} (h : L.StepHyp p s prev next) (w : Wire N g) :
                                        IsMonotone (next w)
                                        theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.StepHyp.le {N I J K g : ℕ} {L : Layout N I J K} {p : Program DeMorgan.signature N g} {s : ℕ} {prev next : Wire N g → (Fin N → Bool) → Bool} (h : L.StepHyp p s prev next) (w : Wire N g) (c : Fin N → Bool) (hc : prev w c = true) :
                                        next w c = true
                                        theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.StepHyp.agree {N I J K g : ℕ} {L : Layout N I J K} {p : Program DeMorgan.signature N g} {s : ℕ} {prev next : Wire N g → (Fin N → Bool) → Bool} (h : L.StepHyp p s prev next) {b : Fin N → Bool} (hb : L.Covers s b) (w : Wire N g) :
                                        next w b = prev w b

                                        Covering assignments #

                                        def Algebraic.Monotone.MatrixProduct.Internal.Layout.cover {N I J K : ℕ} (L : Layout N I J K) (i : Fin I) (j : Fin J) (c : Fin N → Bool) :
                                        Fin N → Bool

                                        Raise every variable that does not create a product x i k ∧ y k j with the variables already true in c.

                                        Equations
                                        Instances For
                                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.le_cover {N I J K : ℕ} (L : Layout N I J K) (i : Fin I) (j : Fin J) (c : Fin N → Bool) :
                                          AssignmentLE c (L.cover i j c)
                                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.cover_y {N I J K : ℕ} (L : Layout N I J K) (i : Fin I) (j : Fin J) (c : Fin N → Bool) (k : Fin K) :
                                          L.cover i j c (L.y k j) = c (L.y k j)
                                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.cover_x {N I J K : ℕ} (L : Layout N I J K) (i : Fin I) (j : Fin J) (c : Fin N → Bool) (k : Fin K) :
                                          L.cover i j c (L.x i k) = (c (L.x i k) || !c (L.y k j))
                                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.product_cover {N I J K : ℕ} (L : Layout N I J K) (T : Finset (Fin I × Fin K × Fin J)) (s : ℕ) (i : Fin I) (j : Fin J) (c : Fin N → Bool) :
                                          L.product T s i j (L.cover i j c) = L.product T s i j c
                                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.cover_eq_false {N I J K : ℕ} (L : Layout N I J K) {s : ℕ} {i : Fin I} {j : Fin J} {c : Fin N → Bool} {v : Fin N} (hv : L.IsType s v) (hb : L.cover i j c v = false) :
                                          ∃ (k : Fin K), ↑k = s ∧ (v = L.y k j ∧ c (L.y k j) = false ∨ v = L.x i k ∧ c (L.y k j) = true)
                                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.covers_cover {N I J K : ℕ} (L : Layout N I J K) (s : ℕ) (i : Fin I) (j : Fin J) (c : Fin N → Bool) :
                                          L.Covers s (L.cover i j c)
                                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.StepHyp.next_output {N I J K g : ℕ} {L : Layout N I J K} {p : Program DeMorgan.signature N g} {s : ℕ} {prev next : Wire N g → (Fin N → Bool) → Bool} (h : L.StepHyp p s prev next) (T : Finset (Fin I × Fin K × Fin J)) (o : Wire N g) (i : Fin I) (j : Fin J) (ho : ∀ (c : Fin N → Bool), prev o c = L.product T s i j c) (c : Fin N → Bool) :
                                          next o c = L.product T s i j c

                                          Forcing preserves every output that computes a restricted product entry.

                                          All stages #

                                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.stepHyp_of_mono {N I J K g : ℕ} (L : Layout N I J K) (p : Program DeMorgan.signature N g) (hp : ∀ (G : Fin g), (p.lines G).op ≠ DeMorgan.Op.not) (s : ℕ) (hmono : ∀ (w : Wire N g), IsMonotone (L.sem p s w)) :
                                          L.StepHyp p s (fun (w : Wire N g) (c : Fin N → Bool) => L.sem p s w (L.fix s c)) (L.sem p (s + 1))
                                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.sem_mono {N I J K g : ℕ} (L : Layout N I J K) (p : Program DeMorgan.signature N g) (hp : ∀ (G : Fin g), (p.lines G).op ≠ DeMorgan.Op.not) (t : ℕ) (w : Wire N g) :
                                          IsMonotone (L.sem p t w)
                                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.stepHyp {N I J K g : ℕ} (L : Layout N I J K) (p : Program DeMorgan.signature N g) (hp : ∀ (G : Fin g), (p.lines G).op ≠ DeMorgan.Op.not) (s : ℕ) :
                                          L.StepHyp p s (fun (w : Wire N g) (c : Fin N → Bool) => L.sem p s w (L.fix s c)) (L.sem p (s + 1))
                                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.sem_zero {N I J K g : ℕ} (L : Layout N I J K) (p : Program DeMorgan.signature N g) (w : Wire N g) (c : Fin N → Bool) :

                                          Index 0 is the ordinary Boolean evaluation.

                                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.sem_output {N I J K : ℕ} (L : Layout N I J K) {M : ℕ} (T : Finset (Fin I × Fin K × Fin J)) (z : Fin I → Fin J → Fin M) (circuit : Circuit DeMorgan.signature N M) (hp : ∀ (G : Fin circuit.size), (circuit.program.lines G).op ≠ DeMorgan.Op.not) (computes : ∀ (a : Fin N → Bool) (i : Fin I) (j : Fin J), circuit.eval DeMorgan.interpretation a (z i j) = decide (∃ (k : Fin K), (i, k, j) ∈ T ∧ a (L.x i k) = true ∧ a (L.y k j) = true)) (t : ℕ) (i : Fin I) (j : Fin J) (c : Fin N → Bool) :
                                          L.sem circuit.program t (circuit.outputs (z i j)) c = L.product T (t - 1) i j c

                                          At index t, the outputs compute the product over the triples of type ≥ t - 1.

                                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.sem_of_lt {N I J K g : ℕ} (L : Layout N I J K) (p : Program DeMorgan.signature N g) (hp : ∀ (G : Fin g), (p.lines G).op ≠ DeMorgan.Op.not) {s s' : ℕ} (hlt : s < s') (w : Wire N g) (c : Fin N → Bool) (h : L.sem p (s + 1) w (L.fix s' c) = true) :
                                          L.sem p (s' + 1) w c = true

                                          A wire that is one at index s + 1 on the restriction fix s' c is one at the later index s' + 1 on c.

                                          theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.sem_good {N I J K g : ℕ} (L : Layout N I J K) (p : Program DeMorgan.signature N g) (s : ℕ) (w : Wire N g) :
                                          (∀ (c : Fin N → Bool), L.sem p (s + 1) w c = true) ∨ ¬L.Bad s (L.sem p (s + 1) w)

                                          At index s + 1 every wire is constant one or has at most one type-s implicant of length one.

                                          Creators #

                                          def Algebraic.Monotone.MatrixProduct.Internal.Layout.IsPrimePair {N I J K : ℕ} (L : Layout N I J K) (i : Fin I) (k : Fin K) (j : Fin J) (f : (Fin N → Bool) → Bool) :

                                          f accepts {x i k, y k j} but neither {x i k} nor {y k j}; for a monotone f this says that x i k ∧ y k j is a prime implicant.

                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For
                                            def Algebraic.Monotone.MatrixProduct.Internal.Layout.Creator {N I J K g : ℕ} (L : Layout N I J K) (p : Program DeMorgan.signature N g) (i : Fin I) (k : Fin K) (j : Fin J) (G : Fin g) :

                                            A gate whose function at index k + 1 has the prime implicant x i k ∧ y k j while none of its arguments has it.

                                            Equations
                                            • One or more equations did not get rendered due to their size.
                                            Instances For
                                              theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.not_isPrimePair_input {N I J K g : ℕ} (L : Layout N I J K) (p : Program DeMorgan.signature N g) (i : Fin I) (k : Fin K) (j : Fin J) (v : Fin N) :
                                              ¬L.IsPrimePair i k j (L.sem p (↑k + 1) (Wire.input v))
                                              theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.exists_creator {N I J K g : ℕ} (L : Layout N I J K) (p : Program DeMorgan.signature N g) (i : Fin I) (k : Fin K) (j : Fin J) (w : Wire N g) (hw : L.IsPrimePair i k j (L.sem p (↑k + 1) w)) :
                                              ∃ (G : Fin g), L.Creator p i k j G
                                              theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.isPrimePair_product {N I J K : ℕ} (L : Layout N I J K) (T : Finset (Fin I × Fin K × Fin J)) {i : Fin I} {k : Fin K} {j : Fin J} (hT : (i, k, j) ∈ T) :
                                              L.IsPrimePair i k j (L.product T (↑k) i j)
                                              theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.Creator.spec {N I J K g : ℕ} {L : Layout N I J K} {p : Program DeMorgan.signature N g} {i : Fin I} {k : Fin K} {j : Fin J} {G : Fin g} (hp : ∀ (G : Fin g), (p.lines G).op ≠ DeMorgan.Op.not) (hc : L.Creator p i k j G) :
                                              (p.lines G).op = DeMorgan.Op.and ∧ (∃ (a : Fin (DeMorgan.signature.Arity (p.lines G).op)) (b : Fin (DeMorgan.signature.Arity (p.lines G).op)), a ≠ b ∧ L.sem p (↑k + 1) ((p.lines G).wires a) (single (L.x i k)) = true ∧ L.sem p (↑k + 1) ((p.lines G).wires b) (single (L.y k j)) = true) ∧ ∀ (m : Fin (DeMorgan.signature.Arity (p.lines G).op)), ¬∀ (c : Fin N → Bool), L.sem p (↑k + 1) ((p.lines G).wires m) c = true

                                              A creator is an AND gate; one argument has the implicant x i k, another y k j, and no argument is constant one.

                                              theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.Creator.unique {N I J K g : ℕ} {L : Layout N I J K} {p : Program DeMorgan.signature N g} {i i' : Fin I} {k : Fin K} {j j' : Fin J} {G : Fin g} (hp : ∀ (G : Fin g), (p.lines G).op ≠ DeMorgan.Op.not) (h₁ : L.Creator p i k j G) (h₂ : L.Creator p i' k j' G) :
                                              i = i' ∧ j = j'

                                              Two triples of the same type have distinct creators.

                                              theorem Algebraic.Monotone.MatrixProduct.Internal.Layout.Creator.not_creator_of_lt {N I J K g : ℕ} {L : Layout N I J K} {p : Program DeMorgan.signature N g} {i i' : Fin I} {k k' : Fin K} {j j' : Fin J} {G : Fin g} (hp : ∀ (G : Fin g), (p.lines G).op ≠ DeMorgan.Op.not) (h₁ : L.Creator p i k j G) (hlt : ↑k < ↑k') :
                                              ¬L.Creator p i' k' j' G

                                              A creator at one stage is not a creator at any later stage.

                                              theorem Algebraic.Monotone.MatrixProduct.Internal.card_le_cost {N I J K g : ℕ} (p : Program DeMorgan.signature N g) (T : Finset (Fin I × Fin K × Fin J)) (creator : ↥T → Fin g) (hand : ∀ (t : ↥T), (p.lines (creator t)).op = DeMorgan.Op.and) (hinj : Function.Injective creator) :

                                              Distinct AND gates indexed by the triples of T bound the AND-gate count.

                                              theorem Algebraic.Monotone.MatrixProduct.Internal.card_le_andCost {N I J K : ℕ} (L : Layout N I J K) (T : Finset (Fin I × Fin K × Fin J)) {M : ℕ} (z : Fin I → Fin J → Fin M) (circuit : Circuit DeMorgan.signature N M) (monotone : circuit.cost DeMorgan.notCost = 0) (computes : ∀ (a : Fin N → Bool) (i : Fin I) (j : Fin J), circuit.eval DeMorgan.interpretation a (z i j) = decide (∃ (k : Fin K), (i, k, j) ∈ T ∧ a (L.x i k) = true ∧ a (L.y k j) = true)) :

                                              Every De Morgan circuit without NOT gates computing the partial Boolean product over the triples of T, laid out injectively among its inputs, has at least |T| AND gates.

                                              AND/OR circuits #

                                              The binary AND/OR basis as the negation-free binary part of the De Morgan basis: each operation becomes the single De Morgan gate of the same name.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For
                                                theorem Algebraic.Monotone.MatrixProduct.Internal.mul_mul_le_andCost {N I J K : ℕ} (L : Layout N I J K) {M : ℕ} (z : Fin I → Fin J → Fin M) (circuit : Circuit AndOr.signature N M) (computes : ∀ (a : Fin N → Bool) (i : Fin I) (j : Fin J), circuit.eval AndOr.boolInterpretation a (z i j) = decide (∃ (k : Fin K), a (L.x i k) = true ∧ a (L.y k j) = true)) :
                                                I * J * K ≤ circuit.cost AndOr.andCost

                                                Every AND/OR circuit computing the Boolean product of an I × K matrix and a K × J matrix, laid out injectively among its inputs, has at least I * J * K AND gates.