Documentation

Complexitylib.SAT.Tseitin.Machine.Defs

Machine building blocks for the CNF-to-3CNF reduction #

This file starts the concrete deterministic-machine implementation of ThreeSAT.reduction. The first pass is a finite-state syntax validator for the concrete two-bit SAT encoding. No output from the transformation is emitted before that pass succeeds. The machine then rewinds the input and can enter a valid-input streaming emitter; malformed inputs take a fixed branch that emits ThreeSAT.fallbackEncoding.

The six work tapes have fixed roles. The fresh-variable register is initialized to |z| + 1, and four further registers hold the current literal and the three pending literals used by the streaming Tseitin algorithm. This file also gives the concrete register-copy and emission machines for committing a literal, emitting a wide-clause link, and closing a clause. Machine.Controller supplies the finite-state controller that reads validated tokens and schedules these machines.

Main definitions #

Finite-state validation #

Token-parser information retained by the regular syntax validator.

between hasLiteral means that no literal is currently open; hasLiteral records whether the current clause already contains a completed literal. literal hasLiteral means that a sign bit has been read and every subsequent raw bit seen so far was true.

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

      Bit-level state: either waiting for the first or the second bit of a two-bit token. Ending in second rejects odd-length inputs.

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

            Consume one concrete input bit.

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

              Scan the input from its current left boundary, returning 1 exactly when the bit-pair syntax is a complete CNF encoding. The start-marker case lets the same machine run both from an initial configuration and after seedFreshTM, where the input is already parked at cell one. Work tapes are preserved.

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

                Fixed work-tape layout #

                @[reducible, inline]

                Number of work tapes used by the streaming reduction.

                Equations
                Instances For

                  Signs of the at most three source literals buffered in finite control. Their variable indices live in bufferAReg, bufferBReg, and bufferCReg.

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

                        Buffer and emission phases #

                        Emit one encoded clause with exactly three buffered literals.

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

                          Emit the first link of a wide clause: (a ∨ b ∨ fresh).

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

                            Emit the exact-3 gadget for the pending clause. The empty-clause case emits the contradictory positive/negative pair but does not yet increment the fresh register.

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

                              Clear the current-literal register and all three pending buffers.

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

                                Rotate the register buffers after emitting a wide-clause link.

                                Before the phase, the registers represent pending literals a,b,c, the current register contains d, and freshReg contains z. Afterwards the pending registers represent ¬z,c,d, the fresh register contains z+1, and the current register is zero.

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

                                  Commit the decoded literal in currentReg.

                                  The first three literals are copied into the pending buffers. Every later literal first emits (a ∨ b ∨ fresh), then rotates the buffers to (¬fresh,c,current) and increments freshReg.

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

                                    Emit and clear the current clause. Empty clauses consume one fresh variable; nonempty pending clauses consume no additional fresh variable.

                                    Equations
                                    Instances For

                                      Validation-first assembly #

                                      Initialize all tape heads, compute the source bit length in freshReg, and increment it. The resulting fresh counter is exactly |z| + 1.

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

                                        Run the fresh-counter initialization followed by the syntax validator. This is an executable front end for the reduction machine.

                                        Equations
                                        Instances For

                                          Blank the validator verdict at output cell one while preserving the input and every work register. The output head remains parked at cell one, ready for the append-only streaming emitter.

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

                                            Assemble the validation-first total reduction around a valid-input streaming emitter. The validator runs before either branch emits transformed data, and both branches clear its verdict before producing output. A valid input is rewound to cell one and handed to validEmitter; an invalid input emits the fixed no-instance fallbackEncoding. Machine.Controller supplies the concrete valid emitter used by the final reduction machine.

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