Grid diagrams and grid states #
A grid state of grid number n is a wrapper around a permutation of Fin n, sending each
column to the unique row occupied by the state in that column. A grid diagram is encoded by two
such permutation graphs, one for the O markings and one for the X markings, with the
condition that no square contains both markings.
A state coordinate (c, r) is the grid point where column line c meets row line r. A marking
coordinate (c, r) instead names the square whose lower-left corner is that grid point, bounded
by column lines c, c + 1 and row lines r, r + 1, with indices read cyclically.
The point-set API records the basic row, column, cardinality, and disjointness facts about the occupied grid points of a grid state.
TauCeti.GridState: a grid state with a permutation graph onFin n.TauCeti.GridState.subdiagonal: the grid state whose occupied row is one below its column.TauCeti.GridState.pointSet: the finite set of occupied grid points of a grid state.TauCeti.GridDiagram: ann × ngrid diagram withOandXmarkings.TauCeti.GridDiagram.OSet,TauCeti.GridDiagram.XSet: the marking-square sets.- Relabeling, swapping, transposition, and marking-swap operations for grid states and diagrams.
TauCeti.GridDiagram.cast: transport of a grid diagram along an equality of grid numbers.
References #
A grid state on an n × n toroidal grid.
The field toPerm sends each column to its occupied row. The named wrapper gives grid states
their own preferred point-set API below, while still allowing direct access to the underlying
permutation when needed.
- toPerm : Equiv.Perm (Fin n)
The permutation sending each column to the occupied row in that column.
Instances For
Grid states on an n × n grid are equivalent to permutations of Fin n, via the
column-to-row permutation.
Instances For
There are finitely many grid states of a fixed grid size.
Equality of grid states is decidable: a grid state is determined by its underlying permutation, whose equality is decidable. This makes finite sets of grid states computable.
The subdiagonal grid state of an n-column grid: its point in column c lies one row below
the diagonal point (c, c).
Instances For
The permutation underlying the subdiagonal state is the inverse cyclic shift.
The subdiagonal state reads off the inverse cyclic shift.
Moving the subdiagonal point of a column up one row reaches the diagonal.
The subdiagonal state sends each column to the preceding row.
The point set of the grid state obtained from σ is the graph {(c, σ c)}.
A product of column and row sets avoids a grid state's points exactly when every column in the first set has its occupied row outside the second set.
A row with one column removed avoids a grid state's points exactly when the point in that row lies in the removed column.
Relabel the rows of a grid state by a permutation of Fin n.
If ρ is the row permutation, the point in column c moves from row x c to row
ρ (x c).
Instances For
Relabel the columns of a grid state by a permutation of Fin n.
The point in the old column c appears in the new column κ c, so the row in a new column
c is read from the old column κ.symm c.
Instances For
Row relabeling evaluates by applying the row permutation to the old row.
Column relabeling evaluates by reading the old state at the inverse column.
Relabeling rows by the identity permutation does not change a grid state.
Relabeling columns by the identity permutation does not change a grid state.
Successive row relabelings compose.
Successive column relabelings compose.
Row and column relabeling commute on grid states.
Membership in the point set after a row relabeling.
Membership in the point set after a column relabeling.
Undoing a row relabeling transports the relabeled state's points to the original point set.
Undoing a column relabeling transports the relabeled state's points to the original point set.
A set of squares relabeled back avoids a state's points exactly when the set avoids the row-relabeled state's points.
A set of squares relabeled back avoids a state's points exactly when the set avoids the column-relabeled state's points.
Column swaps evaluate by reading the old state at the swapped column.
A column read off the row it occupies after a column swap.
Swapping columns is symmetric in the two chosen columns.
Swapping two columns of a grid state is the same as swapping the two rows they occupy: the
state is a bijection between columns and rows, so either operation exchanges the rows of the
points in columns a and b and leaves every other point in place.
Swapping the same pair of columns twice is the identity on grid states.
Conjugating the first transposition by the second reorders two column swaps.
When the pairs are disjoint this is commutation. When a ≠ b, c ≠ d, and the pairs share
exactly one column, the conjugated pair is the third pair among the three involved columns.
The grid states obtained from x by transposing a pair of distinct columns.
These are exactly the states a single grid rectangle can reach from x: the fully blocked
differential of the generator x is supported here.
Instances For
A state is a column-swap neighbour of x exactly when it is x with a pair of distinct
columns transposed.
If y is a column-swap neighbour of x, then x is a column-swap neighbour of y.
This is the elementary reversibility of a rectangle target: the same pair of side columns swaps back to the source state.
The finite set of column-swap neighbours is the image of the off-diagonal of the column set: an ordered pair of distinct columns gives the state obtained by swapping those columns.
If a nontrivial column swap of a grid state agrees with another column swap of it, then the two swap the same unordered pair of columns.
A grid state has exactly n.choose 2 column-swap neighbours.
A grid state is not a column-swap neighbour of itself: swapping two distinct columns moves the occupied row of either column, so the result differs from the original.
A grid point is shared by a grid state and a column relabeling exactly when it is a source-state grid point whose column is fixed by the relabeling permutation.
The point set of a grid state is the shared part with a column swap, together with the two source-state grid points in the swapped columns.
The point set after swapping columns a and b is the shared part with the source state,
together with the two target-state grid points in the swapped columns.
The diagonal reflection of a grid state.
Reflecting the occupied grid points across the main diagonal exchanges columns and rows, so the new permutation graph is the inverse of the old one.
Instances For
The diagonal reflection evaluates by the inverse permutation graph.
The diagonal reflection is injective on grid states.
Reflecting after a row relabeling is the same as column relabeling after reflecting.
Reflecting after a column relabeling is the same as row relabeling after reflecting.
Reflecting after a row swap is the same as the corresponding column swap after reflecting.
Reflecting after a column swap is the same as the corresponding row swap after reflecting.
The point set of the reflected state is the diagonal reflection of the original point set.
An n × n grid diagram, encoded by the O-marking and X-marking permutation graphs.
The permutation fields enforce one O and one X in each row and column. The disjoint
field says no square contains both markings. With this encoding GridDiagram 0, the empty
diagram, is inhabited, while GridDiagram 1 is empty: its only O and X permutations put
both markings in the single square.
- O : GridState n
The
Omarking in each column, encoded by its row. - X : GridState n
The
Xmarking in each column, encoded by its row.
Instances For
The finite set of O-marked squares of a grid diagram. A pair (c, r) names the square whose
lower-left grid point is (c, r).
Instances For
The finite set of X-marked squares of a grid diagram. A pair (c, r) names the square whose
lower-left grid point is (c, r).
Instances For
A grid diagram has exactly n O markings.
A grid diagram has exactly n X markings.
Relabel the rows of a grid diagram by relabeling both marking states.
Instances For
Relabel the columns of a grid diagram by relabeling both marking states.
Instances For
Row relabeling evaluates on the O marking by applying the row permutation.
Row relabeling evaluates on the X marking by applying the row permutation.
Column relabeling evaluates on the O marking at the inverse old column.
Column relabeling evaluates on the X marking at the inverse old column.
Row relabeling transports the O marking set by the row permutation.
Row relabeling transports the X marking set by the row permutation.
Column relabeling transports the O marking set by the column permutation.
Column relabeling transports the X marking set by the column permutation.
A set of squares with rows relabeled back avoids the original X-markings exactly when the set avoids the row-relabeled diagram's X-markings.
A set of squares relabeled back avoids the original X-markings exactly when the set avoids the relabeled diagram's X-markings.
Swapping two rows in a grid diagram.
Instances For
Swapping two columns in a grid diagram.
Instances For
The O marking state of a row-swapped grid diagram.
The X marking state of a row-swapped grid diagram.
The O marking state of a column-swapped grid diagram.
The X marking state of a column-swapped grid diagram.
Exchanging two rows and the same two columns conjugates the X-permutation by the
transposition.
Exchanging two rows and the same two columns conjugates the O-permutation by the
transposition.
Column swaps transport the O marking set by the column transposition.
Column swaps transport the X marking set by the column transposition.
A set of squares with rows swapped back avoids the original X-markings exactly when the set avoids the row-swapped diagram's X-markings.
A set of squares swapped back avoids the original X-markings exactly when the set avoids the swapped diagram's X-markings.
Swapping the same pair of rows twice is the identity on grid diagrams.
Swapping the same pair of columns twice is the identity on grid diagrams.
Relabeling rows by the identity permutation does not change a grid diagram.
Relabeling columns by the identity permutation does not change a grid diagram.
Successive row relabelings compose on grid diagrams.
Successive column relabelings compose on grid diagrams.
Row and column relabeling commute on grid diagrams.
The diagonal reflection is an involution on grid diagrams.
Reflecting after a row relabeling is the same as column relabeling after reflecting.
Reflecting after a column relabeling is the same as row relabeling after reflecting.
Reflecting after a row swap is the same as the corresponding column swap after reflecting.
Reflecting after a column swap is the same as the corresponding row swap after reflecting.
The O-marking set of the reflected diagram is the diagonal reflection of the original
O-marking set.
The X-marking set of the reflected diagram is the diagonal reflection of the original
X-marking set.
The O-marking set of the marking swap is the original X-marking set.
The X-marking set of the marking swap is the original O-marking set.
The marking swap is an involution.
Row relabeling commutes with exchanging the two marking states.
Column relabeling commutes with exchanging the two marking states.
Row swaps commute with exchanging the two marking states.
Column swaps commute with exchanging the two marking states.
The marking swap commutes with the diagonal reflection of a grid diagram.
Transport a grid diagram along an equality of grid numbers. Both marking states are
reindexed along Fin.cast, as computed by cast_O_apply and cast_X_apply.
Instances For
Transporting a grid diagram along the reflexive equality does nothing.