Documentation

LeanPool.BooleanMultiplication.ANF

Boolean algebraic normal forms #

A squarefree monomial is a finite set of input variables. Multiplication is set union, so the resulting monoid algebra over ZMod 2 is exactly the Boolean ANF quotient in canonical normal form.

@[reducible, inline]

The two-element field of Boolean coefficients.

Equations
Instances For

    A squarefree monomial in m Boolean variables.

    • vars : Finset (Fin m)

      Variables occurring in this squarefree monomial.

    Instances For
      theorem UnrestrictedBooleanMul.Monomial.ext {m : ℕ} {x y : Monomial m} (vars : x.vars = y.vars) :
      x = y
      def UnrestrictedBooleanMul.instDecidableEqMonomial.decEq {m✝ : ℕ} (x✝ x✝¹ : Monomial m✝) :
      Decidable (x✝ = x✝¹)
      Equations
      Instances For

        Identify a squarefree monomial with its finite set of variables.

        Equations
        Instances For
          @[instance_reducible]
          Equations
          • One or more equations did not get rendered due to their size.
          @[simp]
          @[simp]
          theorem UnrestrictedBooleanMul.Monomial.singleton_mul_singleton {m : ℕ} (i j : Fin m) :
          { vars := {i} } * { vars := {j} } = { vars := {i, j} }
          @[reducible, inline]

          Canonical Boolean algebraic normal forms in m variables.

          Equations
          Instances For
            noncomputable def UnrestrictedBooleanMul.monomial {m : ℕ} (s : Finset (Fin m)) :
            ANF m

            The ANF consisting of one squarefree monomial.

            Equations
            Instances For
              @[simp]
              theorem UnrestrictedBooleanMul.coeff_monomial {m : ℕ} (s t : Finset (Fin m)) :
              (monomial s).coeff { vars := t } = if s = t then 1 else 0
              theorem UnrestrictedBooleanMul.coeff_sum_smul_mul_sum_smul {m : ℕ} {ι : Type u_1} {κ : Type u_2} [Fintype ι] [Fintype κ] (p : ι → ANF m) (q : κ → ANF m) (a : ι → F₂) (b : κ → F₂) (s : Monomial m) :
              ((∑ i : ι, a i • p i) * ∑ j : κ, b j • q j).coeff s = ∑ i : ι, ∑ j : κ, a i * b j * (p i * q j).coeff s

              Extract a product coefficient bilinearly, before expanding either ANF.

              noncomputable def UnrestrictedBooleanMul.X {m : ℕ} (i : Fin m) :
              ANF m

              The ith input variable.

              Equations
              Instances For
                theorem UnrestrictedBooleanMul.X_mul_self {m : ℕ} (i : Fin m) :
                X i * X i = X i
                @[simp]
                theorem UnrestrictedBooleanMul.anf_add_self {m : ℕ} (p : ANF m) :
                p + p = 0
                def UnrestrictedBooleanMul.eval {m : ℕ} (p : ANF m) (x : Fin m → F₂) :

                Evaluation of a canonical ANF on a Boolean input.

                Equations
                Instances For
                  @[simp]
                  theorem UnrestrictedBooleanMul.eval_monomial {m : ℕ} (s : Finset (Fin m)) (x : Fin m → F₂) :
                  eval (monomial s) x = ∏ i ∈ s, x i
                  @[simp]
                  theorem UnrestrictedBooleanMul.eval_X {m : ℕ} (i : Fin m) (x : Fin m → F₂) :
                  eval (X i) x = x i
                  theorem UnrestrictedBooleanMul.prod_union_f2 {m : ℕ} (x : Fin m → F₂) (s t : Finset (Fin m)) :
                  ∏ i ∈ s ∪ t, x i = (∏ i ∈ s, x i) * ∏ i ∈ t, x i

                  Evaluation of a squarefree monomial as a monoid homomorphism.

                  Equations
                  Instances For
                    theorem UnrestrictedBooleanMul.eval_eq_evalHom {m : ℕ} (p : ANF m) (x : Fin m → F₂) :
                    eval p x = (evalHom x) p
                    @[simp]
                    theorem UnrestrictedBooleanMul.eval_zero' {m : ℕ} (x : Fin m → F₂) :
                    eval 0 x = 0
                    @[simp]
                    theorem UnrestrictedBooleanMul.eval_one' {m : ℕ} (x : Fin m → F₂) :
                    eval 1 x = 1
                    @[simp]
                    theorem UnrestrictedBooleanMul.eval_add' {m : ℕ} (p q : ANF m) (x : Fin m → F₂) :
                    eval (p + q) x = eval p x + eval q x
                    @[simp]
                    theorem UnrestrictedBooleanMul.eval_mul' {m : ℕ} (p q : ANF m) (x : Fin m → F₂) :
                    eval (p * q) x = eval p x * eval q x
                    @[simp]
                    theorem UnrestrictedBooleanMul.eval_smul' {m : ℕ} (c : F₂) (p : ANF m) (x : Fin m → F₂) :
                    eval (c • p) x = c * eval p x
                    noncomputable def UnrestrictedBooleanMul.evalLinearMap (m : ℕ) :
                    ANF m →ₗ[F₂] (Fin m → F₂) → F₂

                    Simultaneous evaluation at all Boolean inputs, as a linear map.

                    Equations
                    Instances For
                      noncomputable def UnrestrictedBooleanMul.pointIndicator {m : ℕ} (x : Fin m → F₂) :
                      ANF m

                      The Boolean polynomial which is one at x and zero at every other input.

                      Equations
                      Instances For
                        @[simp]

                        Canonical Boolean ANFs are determined by their values on Boolean inputs.

                        noncomputable def UnrestrictedBooleanMul.evalLinearEquiv (m : ℕ) :
                        ANF m ≃ₗ[F₂] (Fin m → F₂) → F₂

                        Canonical Boolean ANFs are linearly equivalent to all Boolean functions.

                        Equations
                        Instances For
                          noncomputable def UnrestrictedBooleanMul.affine (m : ℕ) :

                          The subspace of constants and input-linear functions.

                          Equations
                          Instances For