A DNF formula is an OR of AND terms, such as (V1 AND NOT V2) OR (NOT V1 AND V2) to represent V1 XOR V2.
The puzzles are generated by randomly sampling a DNF formula from formulae with a set number of variables N, terms T, and term size K.
For example, with the setting N = 4, T = 2, K = 3, here is a formula that fits these settings:
The variables are V1, V2, V3, and V4.
The terms are:
The literals are:
Here is how the sampling works.
To visualize the formula, the truth table generated by the boolean formulae is displayed as a 2D grid.
The logic variables are split into two groups, and each group’s binary values are converted into integers to form the coordinates.
For instance, with four variables we have two groups for the X and Y coordinates. I.e. X = {V1, V2} and Y = {V3, V4}. If we assign the variables as: V1 = 0, V2 = 1, V3 = 1, V4 = 0, we see that X and Y groups can represent binary numbers. I.e. X = {0, 1} and Y = {1, 0}. These binary numbers are then converted to integers, X = 2 and Y = 1.
Each point in the boolean space described by the four variables has an assignment of 0 or 1 from the boolean formula. Converting the variabls to 2D coordinates, and using the formula truth value to fill in the grid where false is 0 and true is 1, turns the truth table into an grid.
As an example, use the formula V2 OR V3. The logic table and coordinates are the following.
| V1 | V2 | X coord. | V3 | V4 | Y coord. | V2 OR V3 |
| 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 | 0 | 0 | 0 |
| 0 | 1 | 2 | 0 | 0 | 0 | 1 |
| 1 | 1 | 3 | 0 | 0 | 0 | 1 |
| 0 | 0 | 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 1 | 1 | 0 | 1 | 1 |
| 0 | 1 | 2 | 1 | 0 | 1 | 1 |
| 1 | 1 | 3 | 1 | 0 | 1 | 1 |
| 0 | 0 | 0 | 0 | 1 | 2 | 0 |
| 1 | 0 | 1 | 0 | 1 | 2 | 0 |
| 0 | 1 | 2 | 0 | 1 | 2 | 1 |
| 1 | 1 | 3 | 0 | 1 | 2 | 1 |
| 0 | 0 | 0 | 1 | 1 | 3 | 1 |
| 1 | 0 | 1 | 1 | 1 | 3 | 1 |
| 0 | 1 | 2 | 1 | 1 | 3 | 1 |
| 1 | 1 | 3 | 1 | 1 | 3 | 1 |
From the logic table, we can take the X and Y coordinates and create a 2D grid.
| Y (down) X (right) | 0 | 1 | 2 | 3 |
| 0 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 1 |
| 2 | 0 | 0 | 1 | 1 |
| 3 | 1 | 1 | 1 | 1 |
Two ways the grid can be converted into a puzzle is by either adding incorrect grid cell assignments, i.e. flipping 0 to 1 or 1 to 0, or by removing a cell assignment.
Then the puzzle solver’s task is to correct the flipped cells and fill in the missing cells.
Taking the previous grid, we can flip cell {0, 0} and erase cell {1, 1}, and generate the following puzzle.
| Y (down) X (right) | 0 | 1 | 2 | 3 |
| 0 | 1 | 0 | 1 | 1 |
| 1 | 1 | _ | 1 | 1 |
| 2 | 0 | 0 | 1 | 1 |
| 3 | 1 | 1 | 1 | 1 |