Documentation

Complexitylib.Classes.PCP.Internal.CNFSegment

Cutting out one clause of an encoded formula #

Reading the j-th clause of an encoded formula is the same two-bit scan that counts the clauses, with two additions: a target index to compare against, and a buffer that collects tokens while the count matches.

The state is pair (pair target count) (pair collected unread).

Main definitions #

Main results #

def Complexity.segFrom (s0 s1 : Bool) (t c : ) :

The tokens of the segment with index t, having already passed c separators, where the separator is the token s0 s1.

Equations
Instances For
    @[simp]
    theorem Complexity.segFrom_nil (s0 s1 : Bool) (t c : ) :
    segFrom s0 s1 t c [] = []
    theorem Complexity.segFrom_cons₂ (s0 s1 : Bool) (t c : ) (b0 b1 : Bool) (r : List Bool) :
    segFrom s0 s1 t c (b0 :: b1 :: r) = if b0 = s0 b1 = s1 then segFrom s0 s1 t (c + 1) r else if c = t then b0 :: b1 :: segFrom s0 s1 t c r else segFrom s0 s1 t c r

    The target index carried by the state.

    Equations
    Instances For

      The number of separators already passed.

      Equations
      Instances For

        The tokens collected so far.

        Equations
        Instances For

          The unread suffix.

          Equations
          Instances For

            Does the string begin with the bit b, as a flag?

            Equations
            Instances For
              theorem Complexity.matchBit_mem_FP (b : Bool) {a : List BoolList Bool} (ha : a FP) :
              (fun (z : List Bool) => matchBit b (a z)) FP

              Are we inside the segment we want?

              Equations
              Instances For
                def Complexity.segStep (s0 s1 : Bool) (z : List Bool) :

                One two-bit step of the extraction.

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

                  What the scan collects #

                  @[simp]
                  theorem Complexity.segStep_nil (s0 s1 : Bool) (tgt cnt coll : List Bool) :
                  segStep s0 s1 (pair (pair tgt cnt) (pair coll [])) = pair (pair tgt cnt) (pair coll [])
                  theorem Complexity.segStep_cons₂ (s0 s1 : Bool) (tgt cnt coll : List Bool) (b0 b1 : Bool) (r : List Bool) :
                  segStep s0 s1 (pair (pair tgt cnt) (pair coll (b0 :: b1 :: r))) = if b0 = s0 b1 = s1 then pair (pair tgt (true :: cnt)) (pair coll r) else pair (pair tgt cnt) (pair (if cnt.length = tgt.length then coll ++ [b0, b1] else coll) r)
                  theorem Complexity.segStep_iterate (s0 s1 : Bool) (k : ) (tgt cnt coll s : List Bool) :
                  s.length 2 * kEven s.lengthsegColl ((segStep s0 s1)^[k] (pair (pair tgt cnt) (pair coll s))) = coll ++ segFrom s0 s1 tgt.length cnt.length s

                  The scan collects the segment.

                  theorem Complexity.even_length_segFrom (s0 s1 : Bool) (t n : ) (s : List Bool) (c : ) :
                  s.length nEven s.lengthEven (segFrom s0 s1 t c s).length

                  The scan as one function #

                  theorem Complexity.segStep_one (s0 s1 : Bool) (tgt cnt coll s : List Bool) :
                  ∃ (cnt' : List Bool) (coll' : List Bool) (s' : List Bool), segStep s0 s1 (pair (pair tgt cnt) (pair coll s)) = pair (pair tgt cnt') (pair coll' s') cnt'.length cnt.length + 1 coll'.length coll.length + 2 s'.length s.length
                  theorem Complexity.segStep_shape (s0 s1 : Bool) (k : ) (tgt cnt coll s : List Bool) :
                  ∃ (cnt' : List Bool) (coll' : List Bool) (s' : List Bool), (segStep s0 s1)^[k] (pair (pair tgt cnt) (pair coll s)) = pair (pair tgt cnt') (pair coll' s') cnt'.length cnt.length + k coll'.length coll.length + 2 * k s'.length s.length
                  noncomputable def Complexity.segAtFn (s0 s1 : Bool) (z : List Bool) :

                  The packaged extraction, on pair (unary index) encoding.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    theorem Complexity.segAtFn_eq (s0 s1 : Bool) {j : } {e : List Bool} (h : Even e.length) :
                    segAtFn s0 s1 (pair (List.replicate j true) e) = segFrom s0 s1 j 0 e

                    Down to a literal #

                    noncomputable def Complexity.litSegFn (z : List Bool) :

                    The p-th literal of the j-th clause, on pair (pair (unary j) (unary p)) encoding.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      noncomputable def Complexity.litVarFn (z : List Bool) :

                      The variable a literal names, in unary.

                      Equations
                      Instances For
                        noncomputable def Complexity.litSignFn (z : List Bool) :

                        The sign a literal carries, as a flag.

                        Equations
                        Instances For