The layout of encoded formulas #
A formula is encoded (Cslib.Complexity.encCNF) by three levels of framed lists: the clauses,
their literals, and the binary digits of each variable followed by the polarity. Unfolding the
frames gives a flat layout (Cslib.Complexity.TwoSAT.encCNF_eq_flatMap): each clause is the
bits of its literals followed by false, and a literal (v, b) is a group of eight bits for each
binary digit d of v, seven markers true followed by d, then the ten bits
[true, true, true, false, true, true, true, b, true, false]
(Cslib.Complexity.TwoSAT.literalBits). A machine reading the encoding by position can thus
tell a literal from the end of its clause by the first bit, a digit from the end of the
variable by the fourth bit of a group, and read the digit or the polarity from the eighth.
The positions are handled with Cslib.Complexity.TwoSAT.InfixAt w p u, which says that the word
u occurs in w at position p.
Main definitions #
Cslib.Complexity.TwoSAT.literalBits,Cslib.Complexity.TwoSAT.clauseBits: the flat layout.Cslib.Complexity.TwoSAT.InfixAt: a word occurring at a position.Cslib.Complexity.TwoSAT.clauseStart: the position of a clause.
Main results #
Cslib.Complexity.TwoSAT.encCNF_eq_flatMap: the flat layout of an encoded formula.Cslib.Complexity.TwoSAT.InfixAt.literal_digit,.literal_end,.clause_literal,.clause_end,Cslib.Complexity.TwoSAT.infixAt_clauseStart: reading the layout by position.
The bits of a clause in an encoded formula: its literals, then false.
Instances For
The frame of a clause is its bits.
The flat layout of an encoded formula.
Positions #
The end of a literal: after the groups of the digits, the fourth bit is false and the
eighth bit is the polarity; the literal ends ten bits after the digits.
A literal of a clause, at the offset of the literals before it.
The end of a clause: false after all its literals.
The position of the clause i in an encoded formula.
Instances For
The clauses of an encoded formula, at their positions.
The encoding ends after the last clause.
The clause i + 1 starts after the clause i.
The literals ls occur at the position p, followed by the end of their clause.
Instances For
A literal, then the rest of the clause.
A clause ends within the word.
The clauses cs occur at the position p, up to the end of the word.
Instances For
A clause, then the rest.
The clauses of an encoded formula occur from its start.