Documentation

Complexitylib.Classes.PCP.Internal.CNFCount

Counting the clauses of an encoded formula #

A formula's encoding is a stream of two-bit tokens, one of which marks the end of a clause. Counting those tokens counts the clauses, and an algorithm that has to loop over the clauses needs that count in unary.

The scan consumes two bits per step, so it is an iteration rather than a fold: the state is the count so far paired with the unread suffix.

Main definitions #

Main results #

How many clause markers — the token 10 — a bit string carries.

Equations
Instances For

    One step: read the next token, and count it if it marks a clause. The state is pair count unread.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      @[simp]
      theorem Complexity.ccStep_cons₂ (c : List Bool) (b0 b1 : Bool) (r : List Bool) :
      ccStep (pair c (b0 :: b1 :: r)) = pair (if b0 = true b1 = false then true :: c else c) r
      theorem Complexity.ccStep_iterate (k : ) (c s : List Bool) :

      The scan counts.

      The scan as one function #

      theorem Complexity.ccStep_one (c s : List Bool) :
      ∃ (X : List Bool) (Y : List Bool), ccStep (pair c s) = pair X Y X.length c.length + 1 Y.length s.length
      theorem Complexity.ccStep_shape (k : ) (c s : List Bool) :
      ∃ (c' : List Bool) (s' : List Bool), ccStep^[k] (pair c s) = pair c' s' c'.length c.length + k s'.length s.length
      noncomputable def Complexity.clauseCountFn (z : List Bool) :

      The clause count, in unary.

      Equations
      Instances For