Documentation

Complexitylib.Algebraic.LowerBound.KarchmerWigderson.Composition

Composition of Boolean functions and the KRW conjecture #

The composition f ⋄ g of f on m bits with g on n bits applies f to the values of g on m disjoint blocks of n bits. Here depth and size are the minimum depth and leaf count of a De Morgan formula (formulaDepth, formulaSize). Substituting a formula for g into a formula for f gives, for all f and g, depth (f ⋄ g) ≤ depth f + depth g (formulaDepth_compose_le) and size (f ⋄ g) ≤ size f · size g (formulaSize_compose_le). Projections give depth g ≤ depth (f ⋄ g) when f is not constant and depth f ≤ depth (f ⋄ g) when g is not constant.

The Karchmer–Raz–Wigderson conjecture asserts that for non-constant f and g the upper bounds are tight up to lower-order terms. It is stated here in its strong form, with a constant slack. KRWDepthWith c says that depth f + depth g ≤ depth (f ⋄ g) + c for all m, n and all non-constant f and g (NonConstant), and KRWSizeWith c says that size f · size g ≤ c · size (f ⋄ g) for all such f and g. The conjectures KRWDepth and KRWSize say that some constant c works. They are open, and nothing here proves them; forms whose slack grows with m or n are not formalized.

Both non-constancy hypotheses are needed. If f or g is constant then f ⋄ g is constant, and dropping either hypothesis from KRWDepthWith c or KRWSizeWith c gives a false statement for every c (not_forall_depth_of_constant_inner, not_forall_depth_of_constant_outer, not_forall_size_of_constant_inner, not_forall_size_of_constant_outer).

Relabeling and substitution #

@[simp]
theorem Algebraic.KW.Formula.eval_mapIndex {n N : ℕ} (φ : Fin n → Fin N) (F : Formula n) (x : Fin N → Bool) :
(mapIndex φ F).eval x = F.eval (x ∘ φ)
@[simp]
theorem Algebraic.KW.Formula.depth_mapIndex {n N : ℕ} (φ : Fin n → Fin N) (F : Formula n) :
@[simp]
theorem Algebraic.KW.Formula.leaves_mapIndex {n N : ℕ} (φ : Fin n → Fin N) (F : Formula n) :
@[simp]
theorem Algebraic.KW.Formula.eval_subst {n N : ℕ} (σ : Fin N → Formula n) (F : Formula N) (x : Fin n → Bool) :
(subst σ F).eval x = F.eval fun (i : Fin N) => (σ i).eval x
theorem Algebraic.KW.Formula.depth_subst_le {n N : ℕ} (σ : Fin N → Formula n) {d : ℕ} (hσ : ∀ (i : Fin N), (σ i).depth ≤ d) (F : Formula N) :
(subst σ F).depth ≤ F.depth + d
theorem Algebraic.KW.Formula.leaves_subst_le {n N : ℕ} (σ : Fin N → Formula n) {L : ℕ} (hL : 1 ≤ L) (hσ : ∀ (i : Fin N), (σ i).leaves ≤ L) (F : Formula N) :
(subst σ F).leaves ≤ F.leaves * L

Every Boolean function has a De Morgan formula, by Shannon expansion.

theorem Algebraic.KW.exists_iInf_natCast_eq {ι : Type u_1} [Nonempty ι] (u : ι → ℕ) :
∃ (i : ι), ⨅ (j : ι), ↑(u j) = ↑(u i)

An infimum of natural numbers in ℕ∞ over a nonempty index type is attained.

Composition #

def Algebraic.KW.blockIndex {m n : ℕ} (j : Fin m) (i : Fin n) :
Fin (m * n)

The position of coordinate i of block j.

Equations
Instances For

    The composition f ⋄ g: f applied to g on m disjoint blocks of n bits.

    Equations
    Instances For
      def Algebraic.KW.Formula.compose {m n : ℕ} (F : Formula m) (G : Formula n) :
      Formula (m * n)

      Substitute a formula for g into a formula for f, block by block.

      Equations
      Instances For
        theorem Algebraic.KW.Formula.eval_compose {m n : ℕ} (F : Formula m) (G : Formula n) (z : Fin (m * n) → Bool) :
        (F.compose G).eval z = F.eval fun (j : Fin m) => G.eval fun (i : Fin n) => z (blockIndex j i)

        Every function has finite formula depth.

        Composition multiplies at most the sizes.

        Lower bounds by projection #

        theorem Algebraic.KW.exists_sensitive_of_ne {m : ℕ} {f : Cslib.BooleanFunction m} {a₀ a₁ : Fin m → Bool} (h : f a₀ ≠ f a₁) :
        ∃ (j : Fin m) (a : Fin m → Bool), f (Function.update a j true) ≠ f (Function.update a j false)

        A non-constant function is sensitive at some point in some coordinate.

        theorem Algebraic.KW.formulaDepth_inner_le_compose {m n : ℕ} {f : Cslib.BooleanFunction m} {g : Cslib.BooleanFunction n} {j : Fin m} {a : Fin m → Bool} (hf : f (Function.update a j true) ≠ f (Function.update a j false)) {x₀ x₁ : Fin n → Bool} (h₀ : g x₀ = false) (h₁ : g x₁ = true) :

        The depth of the inner function is at most the depth of the composition, when the outer function is sensitive at some point.

        theorem Algebraic.KW.formulaDepth_outer_le_compose {m n : ℕ} {f : Cslib.BooleanFunction m} {g : Cslib.BooleanFunction n} {x₀ x₁ : Fin n → Bool} (h₀ : g x₀ = false) (h₁ : g x₁ = true) :

        The depth of the outer function is at most the depth of the composition, when the inner function is not constant.

        Non-constant functions #

        A Boolean function is non-constant when it takes two different values.

        Equations
        Instances For

          A non-constant function takes the value false somewhere and true somewhere.

          A function that is not non-constant takes a single value.

          A constant function has formula depth 0.

          Every formula has a leaf, so every formula size is at least 1.

          A constant function has formula size 1.

          For non-constant g, the depth of f is at most the depth of f ⋄ g.

          For non-constant f, the depth of g is at most the depth of f ⋄ g.

          The conjecture #

          The Karchmer–Raz–Wigderson conjecture, depth form, with additive slack c: for all non-constant f on m bits and g on n bits, formulaDepth f + formulaDepth g ≤ formulaDepth (f ⋄ g) + c. The slack c is a single number, independent of m, n, f and g. The converse inequality formulaDepth (f ⋄ g) ≤ formulaDepth f + formulaDepth g holds for all f and g (formulaDepth_compose_le).

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

            The Karchmer–Raz–Wigderson conjecture, size form, with multiplicative slack c: for all non-constant f on m bits and g on n bits, formulaSize f * formulaSize g ≤ c * formulaSize (f ⋄ g). The slack c is a single number, independent of m, n, f and g. The converse inequality formulaSize (f ⋄ g) ≤ formulaSize f * formulaSize g holds for all f and g (formulaSize_compose_le).

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

              The KRW conjecture, depth form (open): some constant additive slack works, ∃ c, KRWDepthWith c.

              Equations
              Instances For

                The KRW conjecture, size form (open): some constant multiplicative slack works, ∃ c, KRWSizeWith c.

                Equations
                Instances For
                  theorem Algebraic.KW.KRWDepthWith.mono {c c' : ℕ} (h : KRWDepthWith c) (hc : c ≤ c') :

                  A larger additive slack gives a weaker statement.

                  theorem Algebraic.KW.KRWSizeWith.mono {c c' : ℕ} (h : KRWSizeWith c) (hc : c ≤ c') :

                  A larger multiplicative slack gives a weaker statement.

                  Both non-constancy hypotheses are needed #

                  If f or g is constant then f ⋄ g is constant, of depth 0 and size 1, while the other function can have depth or size above any fixed slack. So dropping either hypothesis from KRWDepthWith c or KRWSizeWith c gives a false statement, whatever c is. The witness of large depth and size is the conjunction of all k bits, whose formulas read every bit and so have at least k leaves and depth at least log₂ k.

                  The coordinates read by some literal of a formula.

                  Equations
                  Instances For
                    theorem Algebraic.KW.Formula.eval_update_of_notMem_vars {n : ℕ} {i : Fin n} (b : Bool) (x : Fin n → Bool) (F : Formula n) :
                    i ∉ F.vars → F.eval (Function.update x i b) = F.eval x

                    Changing a coordinate that a formula does not read leaves its value unchanged.

                    theorem Algebraic.KW.Formula.mem_vars_of_computes {n : ℕ} {F : Formula n} {f : Cslib.BooleanFunction n} (hF : F.Computes f) {i : Fin n} {a : Fin n → Bool} (h : f (Function.update a i true) ≠ f (Function.update a i false)) :
                    i ∈ F.vars

                    A formula reads every coordinate its function is sensitive to.

                    Without non-constancy of g, the depth form fails for every slack c.

                    Without non-constancy of f, the depth form fails for every slack c.

                    Without non-constancy of g, the size form fails for every slack c.

                    Without non-constancy of f, the size form fails for every slack c.