Documentation

CslibFrontier.Computability.Circuit.Arithmetic.Separation.Tape.WordCode

The one-hot code of a word, and clauses that allow only codes #

The code of a word u on N places sets the bit (p, y) when the letter at place p of u followed by an end mark is y (Tape.wordCode). A family of bits is a code (Tape.IsWordCode) if every place has at most one letter, and every place has a letter unless the end mark came before; below the code of u only that code is one (Tape.eq_wordCode), and a code has at most N set bits (Tape.card_ones_le). Clauses on the input bits (Tape.CodeRule) allow only codes (Tape.prod_codeLits), so adding them to a clause sum restricts it to codes (Tape.domainClauseSum_codeLits).

Main definitions #

Main results #

References #

The one-hot code of a word with an end mark: bit (p, y) is set when the letter at place p of u followed by the end mark none is y.

At most one letter at each place, and at each place a letter or an end mark before.

Instances For
    theorem Cslib.Circuits.Arithmetic.Separation.Tape.isWordCode_iff {Γ : Type} {N : ℕ} (x : Fin N × Option Γ → Bool) :
    IsWordCode x ↔ (∀ (p : Fin N) (y y' : Option Γ), x (p, y) = true → x (p, y') = true → y = y') ∧ ∀ (p : Fin N), (∃ (y : Option Γ), x (p, y) = true) ∨ ∃ p' < p, x (p', none) = true
    theorem Cslib.Circuits.Arithmetic.Separation.Tape.eq_wordCode {Γ : Type} {N : ℕ} [DecidableEq Γ] {x : Fin N × Option Γ → Bool} (hx : IsWordCode x) {u : List Γ} (hle : ∀ (b : Fin N × Option Γ), x b = true → wordCode N u b = true) :
    x = wordCode N u

    Below the code of a word only this code is a code.

    theorem Cslib.Circuits.Arithmetic.Separation.Tape.card_ones_le {Γ : Type} {N : ℕ} [Fintype Γ] {x : Fin N × Option Γ → Bool} (hx : IsWordCode x) :
    {b : Fin N × Option Γ | x b = true}.card ≤ N

    A code has at most one set bit per place.

    theorem Cslib.Circuits.Arithmetic.Separation.Tape.card_ones_wordCode {Γ : Type} {N : ℕ} [DecidableEq Γ] [Fintype Γ] (u : List Γ) (hu : u.length + 1 ≤ N) :
    {b : Fin N × Option Γ | wordCode N u b = true}.card = u.length + 1

    The clauses on the input bits.

    Instances For
      @[instance_reducible]
      def Cslib.Circuits.Arithmetic.Separation.Tape.instDecidableEqCodeRule.decEq {Γ✝ : Type} {N✝ : ℕ} [DecidableEq Γ✝] (x✝ x✝¹ : CodeRule Γ✝ N✝) :
      Decidable (x✝ = x✝¹)
      @[instance_reducible]
      noncomputable def Cslib.Circuits.Arithmetic.Separation.Tape.codeLits {Γ S Q : Type} [Fintype Γ] {n t M N : ℕ} :
      CodeRule Γ N → List (RunBit Γ S Q n t M N × Bool)

      Their literals.

      Their weights: 0, except for two equal letters.

      theorem Cslib.Circuits.Arithmetic.Separation.Tape.prod_codeLits {F : Type u_1} [CommSemiring F] {Γ S Q : Type} [Fintype Γ] [DecidableEq Γ] [DecidableEq S] [DecidableEq Q] {n t M N : ℕ} (x : Fin N × Option Γ → Bool) (g : RunAssignment Γ S Q n t M) :
      (∏ r : CodeRule Γ N, if ∀ l ∈ codeLits r, Sum.elim x (Pi.oneHot g) l.1 = l.2 then codeWeights r else 1) = if IsWordCode x then 1 else 0

      The clauses on the input bits allow only codes.

      theorem Cslib.Circuits.Arithmetic.Separation.Tape.domainClauseSum_codeLits {F : Type u_1} [CommSemiring F] {Γ S Q : Type} [Fintype Γ] [DecidableEq Γ] [DecidableEq S] [DecidableEq Q] {n t M N : ℕ} [Fintype S] [Fintype Q] {Θ : Type} [Fintype Θ] (lits : Θ → List (RunBit Γ S Q n t M N × Bool)) (w : Θ → F) (x : Fin N × Option Γ → Bool) :

      Adding the clauses on the input bits restricts a clause sum to codes.