The scan agrees with the encoding #
The clause counter reads two bits at a time and counts the token 10. This
module checks that against the encoding it is meant to read: every token
occupies two bits, only the clause separator is 10, and a formula's encoding
carries one separator per clause.
Because tokens are two bits wide and the scan steps two bits at a time, a 10
pattern straddling two tokens is never seen.
Main results #
Complexity.sepCount_encodeTokens— the scan counts separatorsComplexity.sepCount_encode— a formula's encoding has one per clauseComplexity.segFrom_tokenJoin— the extraction returns one segmentComplexity.litSegFn_encode— the packaged extraction returns one literalComplexity.litVarFn_encode— and its variable index
The scan counts separators.
A formula's encoding has one separator per clause.
The extraction returns one clause #
Reading past a run of non-separator tokens collects them, or not, according to whether the count matches.
Token segments joined by a separator.
Equations
- Complexity.tokenJoin sep [] = []
- Complexity.tokenJoin sep (g :: gs) = g ++ [sep] ++ Complexity.tokenJoin sep gs
Instances For
Down to a literal of a real formula #
The extraction returns one clause of a real formula.
The extraction returns one literal of a real clause.
The packaged extraction returns one literal.
The extracted literal has the length its variable index dictates.
The extraction reads off the variable index.