Logic on a grid

Ctrl+Enter adds the formula; click it in the list to edit it
Grid
Size × Time points
Mode

Edit the grid as when drawing (below it): each formula shows whether it holds on this grid, and why.

Notation

Internally, the logic grid is defined by cell/5, a predicate with 5 arguments: (column id, row id, time point, value, colour). This predicate is not exposed to you. Instead, you describe the grid using a limited set of built-in-predicates and definitions.

Some predicates and syntactic sugar are provided for convenience (such as the uniqueness quantification: \exists^{=3}), others to expand the expressiveness of the possible formulae (such as the modulo relation: Mod(i, j, k)). Finally, there are also an extensive set of definitions. These exist purely for convenience and are defined as regular formulae.

Built in are only these relations:

Location(x, i, j)cell x is in column i, row j
Colour(x, c, t)cell x has colour c at time point t. c can be red, green, blue or none
Value(x, n, t)cell x holds the value n. The domain are the natural numbers ranging from 1 to K, where K is max(width, height)
Succ(i, j), Plus(i, j, k), Times(i, j, k),Div(i, j, k), Mod(i, j, k)Basic mathematical relations
=, \neq, <, >, \leq, \geqComparison relations
\neg \land \lor \rightarrow \leftrightarrowLogical operators. Also aliases \lnot \wedge \vee \to \implies \iff
\forall x, \exists xQuantifiers, also alternative notation\forall x, y
\exists^{=n} y, \exists^{\geq n} y, \exists^{\leq n} y, \exists! nSyntactic sugar for exactly n, at least n, at most n, exactly one n for some arbitrary natural number n
Note that a cell can be denoted using a tuple (x,y). That is, (2,3) denotes the cell at column 2, row 3. Colour/3 and Value/3 also have a binary version where the time argument is omitted. The assumption then is that their statements only apply to time point 1.

Everything else is defined under Definitions, in ordinary first-order logic. You can edit those definitions by expanding the Definitions dropdown. It defines Red, Green, Blue, Empty, SameColour, SameValue, Less, LeftOf, RightOf, Above, Below, SameRow, SameCol, Adjacent, Neighbour, SameBox (3×3), SameBox2 (2×2), Next, Before, First, Last,Minus, andAbsDiff(i, j, k)

A formula may contain LaTeX comments: a % line above it is shown as its heading.

“Squares may stay empty” is ticked automatically when a formula employs the Empty predicate. You can manually modify this behavior by clicking the checkbox. Additionally, a formula that never mentions colours assigns 'none' as square color, and similarly, not mentioning values assigns all squares with value 'none' as well.

    % point at a square