Documentation

TauCeti.KnotTheory.Grid.Diagram.Basic

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.

References #

structure TauCeti.GridState (n : ℕ) :

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
      @[instance_reducible]

      There are finitely many grid states of a fixed grid size.

      @[instance_reducible]

      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.

      @[instance_reducible]
      instance TauCeti.GridState.instCoeFunForallFin {n : ℕ} :
      CoeFun (GridState n) fun (x : GridState n) => Fin n → Fin n

      Apply a grid state to a column to get its occupied row.

      theorem TauCeti.GridState.ext {n : ℕ} {x y : GridState n} (h : ∀ (c : Fin n), x.toPerm c = y.toPerm c) :
      x = y

      Grid states are extensional in their column-to-row functions.

      theorem TauCeti.GridState.ext_iff {n : ℕ} {x y : GridState n} :
      x = y ↔ ∀ (c : Fin n), x.toPerm c = y.toPerm c

      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.

        @[simp]

        The subdiagonal state sends each column to the preceding row.

        The finite set of occupied grid points of a grid state. The first coordinate is the column and the second coordinate is the row.

        Instances For

          The point set of the grid state obtained from σ is the graph {(c, σ c)}.

          @[simp]
          theorem TauCeti.GridState.mem_pointSet {n : ℕ} (x : GridState n) (p : Fin n × Fin n) :
          p ∈ x.pointSet ↔ x.toPerm p.1 = p.2

          Membership in the point set of a grid state is the graph condition for its permutation.

          theorem TauCeti.GridState.mk_mem_pointSet {n : ℕ} (x : GridState n) (c r : Fin n) :
          (c, r) ∈ x.pointSet ↔ x.toPerm c = r

          The grid point (c, r) lies in a grid state's point set exactly when x c = r.

          @[simp]

          The point set of a grid state has exactly n occupied grid points.

          theorem TauCeti.GridState.sum_pointSet {n : ℕ} {M : Type u_1} [AddCommMonoid M] (x : GridState n) (f : Fin n × Fin n → M) :
          ∑ p ∈ x.pointSet, f p = ∑ c : Fin n, f (c, x.toPerm c)

          A sum over the occupied grid points of a grid state is a sum over the columns.

          theorem TauCeti.GridState.sum_ite_mem_columns {n : ℕ} {R : Type u_1} [AddCommMonoidWithOne R] (x : GridState n) (C : Finset (Fin n)) :
          (∑ p ∈ x.pointSet, if p.1 ∈ C then 1 else 0) = ↑C.card

          A grid state meets a set of columns in as many occupied grid points as there are columns.

          theorem TauCeti.GridState.sum_ite_mem_rows {n : ℕ} {R : Type u_1} [AddCommMonoidWithOne R] (x : GridState n) (D : Finset (Fin n)) :
          (∑ p ∈ x.pointSet, if p.2 ∈ D then 1 else 0) = ↑D.card

          A grid state meets a set of rows in as many occupied grid points as there are rows.

          theorem TauCeti.GridState.disjoint_product_pointSet_iff {n : ℕ} (M : GridState n) (s t : Finset (Fin n)) :
          Disjoint (s ×ˢ t) M.pointSet ↔ ∀ c ∈ s, M.toPerm c ∉ t

          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 grid state occupies a grid point in every column, so its point set meets s ×ˢ univ for every nonempty set s of columns.

          A grid state occupies a grid point in every row, so its point set meets univ ×ˢ t for every nonempty set t of rows.

          A row with one column removed avoids a grid state's points exactly when the point in that row lies in the removed column.

          @[simp]

          Point sets of grid states are equal exactly when the underlying permutations are equal.

          Two grid states have disjoint point sets exactly when they disagree in every 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
              @[simp]
              theorem TauCeti.GridState.relabelRows_apply {n : ℕ} (ρ : Equiv.Perm (Fin n)) (x : GridState n) (c : Fin n) :
              (relabelRows ρ x).toPerm c = ρ (x.toPerm c)

              Row relabeling evaluates by applying the row permutation to the old row.

              @[simp]
              theorem TauCeti.GridState.relabelColumns_apply {n : ℕ} (κ : Equiv.Perm (Fin n)) (x : GridState n) (c : Fin n) :

              Column relabeling evaluates by reading the old state at the inverse column.

              @[simp]

              Relabeling rows by the identity permutation does not change a grid state.

              @[simp]

              Relabeling columns by the identity permutation does not change a grid state.

              @[simp]

              Successive row relabelings compose.

              @[simp]

              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.

              def TauCeti.GridState.swapRows {n : ℕ} (a b : Fin n) (x : GridState n) :

              Swapping two rows in a grid state.

              Instances For

                Swapping two columns in a grid state.

                Instances For
                  @[simp]
                  theorem TauCeti.GridState.swapRows_apply {n : ℕ} (a b : Fin n) (x : GridState n) (c : Fin n) :
                  (swapRows a b x).toPerm c = (Equiv.swap a b) (x.toPerm c)

                  Row swaps evaluate by swapping the row selected by the old state.

                  @[simp]
                  theorem TauCeti.GridState.swapColumns_apply {n : ℕ} (a b : Fin n) (x : GridState n) (c : Fin n) :
                  (swapColumns a b x).toPerm c = x.toPerm ((Equiv.swap a b) c)

                  Column swaps evaluate by reading the old state at the swapped column.

                  theorem TauCeti.GridState.eq_swap_of_swapColumns_apply_eq {n : ℕ} {x : GridState n} {a b c d : Fin n} (h : (swapColumns a b x).toPerm c = x.toPerm d) :
                  c = (Equiv.swap a b) d

                  A column read off the row it occupies after a column swap.

                  theorem TauCeti.GridState.swapColumns_comm {n : ℕ} (a b : Fin n) (x : GridState n) :

                  Swapping columns is symmetric in the two chosen columns.

                  theorem TauCeti.GridState.swapColumns_eq_swapRows {n : ℕ} (a b : Fin n) (x : GridState n) :
                  swapColumns a b x = swapRows (x.toPerm a) (x.toPerm b) x

                  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.

                  @[simp]
                  theorem TauCeti.GridState.swapColumns_swapColumns {n : ℕ} (a b : Fin n) (x : GridState n) :
                  swapColumns a b (swapColumns a b x) = x

                  Swapping the same pair of columns twice is the identity on grid states.

                  theorem TauCeti.GridState.swapColumns_swapColumns_conj {n : ℕ} (x : GridState n) (a b c d : Fin n) :
                  swapColumns c d (swapColumns a b x) = swapColumns ((Equiv.swap c d) a) ((Equiv.swap c d) b) (swapColumns c d x)

                  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
                    @[simp]
                    theorem TauCeti.GridState.mem_columnSwapNeighbors {n : ℕ} {x y : GridState n} :
                    y ∈ x.columnSwapNeighbors ↔ ∃ (c : Fin n) (d : Fin n), c ≠ d ∧ y = swapColumns c d x

                    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.

                    theorem TauCeti.GridState.sym2_mk_eq_of_swapColumns_eq {n : ℕ} {x : GridState n} {a b c d : Fin n} (hab : a ≠ b) (h : swapColumns a b x = swapColumns c d x) :
                    s(a, b) = s(c, d)

                    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.

                    @[simp]

                    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.

                    theorem TauCeti.GridState.mem_pointSet_swapRows {n : ℕ} (a b : Fin n) (x : GridState n) (p : Fin n × Fin n) :
                    p ∈ (swapRows a b x).pointSet ↔ (p.1, (Equiv.swap a b) p.2) ∈ x.pointSet

                    Row swaps transport the point set by the row transposition.

                    theorem TauCeti.GridState.mem_pointSet_swapColumns {n : ℕ} (a b : Fin n) (x : GridState n) (p : Fin n × Fin n) :

                    Column swaps transport the point set by the column transposition.

                    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.

                    @[simp]
                    theorem TauCeti.GridState.swapRows_swapRows {n : ℕ} (a b : Fin n) (x : GridState n) :
                    swapRows a b (swapRows a b x) = x

                    Swapping the same pair of rows twice is the identity on grid states.

                    theorem TauCeti.GridState.mem_pointSet_inter_swapColumns_iff {n : ℕ} (x : GridState n) {a b : Fin n} (h : a ≠ b) (p : Fin n × Fin n) :
                    p ∈ x.pointSet ∩ (swapColumns a b x).pointSet ↔ p ∈ x.pointSet ∧ p.1 ≠ a ∧ p.1 ≠ b

                    A grid point is shared by a grid state and the state with columns a and b swapped exactly when it is a source-state grid point away from the two swapped columns.

                    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.

                    theorem TauCeti.GridState.card_pointSet_inter_swapColumns {n : ℕ} (x : GridState n) {a b : Fin n} (h : a ≠ b) :
                    (x.pointSet ∩ (swapColumns a b x).pointSet).card = n - 2

                    A grid state and a swap of two distinct columns share exactly n - 2 grid points.

                    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
                      @[simp]

                      The diagonal reflection evaluates by the inverse permutation graph.

                      The point of x in row r lies in column x.transpose r.

                      The point of x in column c lies in row x c, so x.transpose sends that row back to c.

                      @[simp]

                      The diagonal reflection is an involution on grid states.

                      The diagonal reflection is injective on grid states.

                      @[simp]

                      Two grid states have equal diagonal reflections exactly when they are equal.

                      @[simp]

                      Reflecting after a row relabeling is the same as column relabeling after reflecting.

                      @[simp]

                      Reflecting after a column relabeling is the same as row relabeling after reflecting.

                      @[simp]

                      Reflecting after a row swap is the same as the corresponding column swap after reflecting.

                      @[simp]

                      Reflecting after a column swap is the same as the corresponding row swap after reflecting.

                      A grid point lies in the reflected state exactly when its diagonal reflection lies in the original state.

                      The point set of the reflected state is the diagonal reflection of the original point set.

                      structure TauCeti.GridDiagram (n : ℕ) :

                      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 O marking in each column, encoded by its row.

                      • X : GridState n

                        The X marking in each column, encoded by its row.

                      • disjoint (c : Fin n) : self.O.toPerm c ≠ self.X.toPerm c

                        No square contains both an O marking and an X marking.

                      Instances For
                        theorem TauCeti.GridDiagram.ext_iff {n : ℕ} {x y : GridDiagram n} :
                        x = y ↔ x.O = y.O ∧ x.X = y.X
                        theorem TauCeti.GridDiagram.ext {n : ℕ} {x y : GridDiagram n} (O : x.O = y.O) (X : x.X = y.X) :
                        x = y

                        There is no grid diagram of size 1: the unique O and X markings would have to occupy the same square.

                        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

                            The O-marking set is the grid-point set of the O permutation.

                            The X-marking set is the grid-point set of the X permutation.

                            @[simp]
                            theorem TauCeti.GridDiagram.mem_OSet {n : ℕ} (G : GridDiagram n) (p : Fin n × Fin n) :
                            p ∈ G.OSet ↔ G.O.toPerm p.1 = p.2

                            Membership in the O-marking set is the graph condition for the O permutation.

                            @[simp]
                            theorem TauCeti.GridDiagram.mem_XSet {n : ℕ} (G : GridDiagram n) (p : Fin n × Fin n) :
                            p ∈ G.XSet ↔ G.X.toPerm p.1 = p.2

                            Membership in the X-marking set is the graph condition for the X permutation.

                            theorem TauCeti.GridDiagram.mk_mem_OSet {n : ℕ} (G : GridDiagram n) (c r : Fin n) :
                            (c, r) ∈ G.OSet ↔ G.O.toPerm c = r

                            The square (c, r) contains an O marking exactly when G.O c = r.

                            theorem TauCeti.GridDiagram.mk_mem_XSet {n : ℕ} (G : GridDiagram n) (c r : Fin n) :
                            (c, r) ∈ G.XSet ↔ G.X.toPerm c = r

                            The square (c, r) contains an X marking exactly when G.X c = r.

                            @[simp]

                            A grid diagram has exactly n O markings.

                            @[simp]

                            A grid diagram has exactly n X markings.

                            The O and X marking sets of a grid diagram are disjoint.

                            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
                                @[simp]
                                theorem TauCeti.GridDiagram.relabelRows_O_apply {n : ℕ} (G : GridDiagram n) (ρ : Equiv.Perm (Fin n)) (c : Fin n) :
                                (relabelRows ρ G).O.toPerm c = ρ (G.O.toPerm c)

                                Row relabeling evaluates on the O marking by applying the row permutation.

                                @[simp]
                                theorem TauCeti.GridDiagram.relabelRows_X_apply {n : ℕ} (G : GridDiagram n) (ρ : Equiv.Perm (Fin n)) (c : Fin n) :
                                (relabelRows ρ G).X.toPerm c = ρ (G.X.toPerm c)

                                Row relabeling evaluates on the X marking by applying the row permutation.

                                @[simp]
                                theorem TauCeti.GridDiagram.relabelColumns_O_apply {n : ℕ} (G : GridDiagram n) (κ : Equiv.Perm (Fin n)) (c : Fin n) :
                                (relabelColumns κ G).O.toPerm c = G.O.toPerm ((Equiv.symm κ) c)

                                Column relabeling evaluates on the O marking at the inverse old column.

                                @[simp]
                                theorem TauCeti.GridDiagram.relabelColumns_X_apply {n : ℕ} (G : GridDiagram n) (κ : Equiv.Perm (Fin n)) (c : Fin n) :
                                (relabelColumns κ G).X.toPerm c = G.X.toPerm ((Equiv.symm κ) c)

                                Column relabeling evaluates on the X marking at the inverse old column.

                                theorem TauCeti.GridDiagram.mem_OSet_relabelRows {n : ℕ} (G : GridDiagram n) (ρ : Equiv.Perm (Fin n)) (p : Fin n × Fin n) :
                                p ∈ (relabelRows ρ G).OSet ↔ (p.1, (Equiv.symm ρ) p.2) ∈ G.OSet

                                Row relabeling transports the O marking set by the row permutation.

                                theorem TauCeti.GridDiagram.mem_XSet_relabelRows {n : ℕ} (G : GridDiagram n) (ρ : Equiv.Perm (Fin n)) (p : Fin n × Fin n) :
                                p ∈ (relabelRows ρ G).XSet ↔ (p.1, (Equiv.symm ρ) p.2) ∈ G.XSet

                                Row relabeling transports the X marking set by the row permutation.

                                theorem TauCeti.GridDiagram.mem_OSet_relabelColumns {n : ℕ} (G : GridDiagram n) (κ : Equiv.Perm (Fin n)) (p : Fin n × Fin n) :
                                p ∈ (relabelColumns κ G).OSet ↔ ((Equiv.symm κ) p.1, p.2) ∈ G.OSet

                                Column relabeling transports the O marking set by the column permutation.

                                theorem TauCeti.GridDiagram.mem_XSet_relabelColumns {n : ℕ} (G : GridDiagram n) (κ : Equiv.Perm (Fin n)) (p : Fin n × Fin n) :
                                p ∈ (relabelColumns κ G).XSet ↔ ((Equiv.symm κ) p.1, p.2) ∈ G.XSet

                                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
                                    @[simp]
                                    theorem TauCeti.GridDiagram.swapRows_O {n : ℕ} (G : GridDiagram n) (a b : Fin n) :

                                    The O marking state of a row-swapped grid diagram.

                                    @[simp]
                                    theorem TauCeti.GridDiagram.swapRows_X {n : ℕ} (G : GridDiagram n) (a b : Fin n) :

                                    The X marking state of a row-swapped grid diagram.

                                    @[simp]

                                    The O marking state of a column-swapped grid diagram.

                                    @[simp]

                                    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.

                                    theorem TauCeti.GridDiagram.mem_OSet_swapRows {n : ℕ} (G : GridDiagram n) (a b : Fin n) (p : Fin n × Fin n) :
                                    p ∈ (swapRows a b G).OSet ↔ (p.1, (Equiv.swap a b) p.2) ∈ G.OSet

                                    Row swaps transport the O marking set by the row transposition.

                                    theorem TauCeti.GridDiagram.mem_XSet_swapRows {n : ℕ} (G : GridDiagram n) (a b : Fin n) (p : Fin n × Fin n) :
                                    p ∈ (swapRows a b G).XSet ↔ (p.1, (Equiv.swap a b) p.2) ∈ G.XSet

                                    Row swaps transport the X marking set by the row transposition.

                                    theorem TauCeti.GridDiagram.mem_OSet_swapColumns {n : ℕ} (G : GridDiagram n) (a b : Fin n) (p : Fin n × Fin n) :
                                    p ∈ (swapColumns a b G).OSet ↔ ((Equiv.swap a b) p.1, p.2) ∈ G.OSet

                                    Column swaps transport the O marking set by the column transposition.

                                    theorem TauCeti.GridDiagram.mem_XSet_swapColumns {n : ℕ} (G : GridDiagram n) (a b : Fin n) (p : Fin n × Fin n) :
                                    p ∈ (swapColumns a b G).XSet ↔ ((Equiv.swap a b) p.1, p.2) ∈ G.XSet

                                    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.

                                    @[simp]
                                    theorem TauCeti.GridDiagram.swapRows_swapRows {n : ℕ} (G : GridDiagram n) (a b : Fin n) :
                                    swapRows a b (swapRows a b G) = G

                                    Swapping the same pair of rows twice is the identity on grid diagrams.

                                    @[simp]

                                    Swapping the same pair of columns twice is the identity on grid diagrams.

                                    @[simp]

                                    Relabeling rows by the identity permutation does not change a grid diagram.

                                    @[simp]

                                    Relabeling columns by the identity permutation does not change a grid diagram.

                                    @[simp]

                                    Successive row relabelings compose on grid diagrams.

                                    @[simp]

                                    Successive column relabelings compose on grid diagrams.

                                    Row and column relabeling commute on grid diagrams.

                                    The diagonal reflection of a grid diagram, reflecting both the O and X marking states.

                                    Reflection across the main diagonal is a bijection of squares, so it preserves the condition that no square carries both markings.

                                    Instances For
                                      @[simp]

                                      The diagonal reflection is an involution on grid diagrams.

                                      @[simp]

                                      Reflecting after a row relabeling is the same as column relabeling after reflecting.

                                      @[simp]

                                      Reflecting after a column relabeling is the same as row relabeling after reflecting.

                                      @[simp]

                                      Reflecting after a row swap is the same as the corresponding column swap after reflecting.

                                      @[simp]

                                      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 marking swap of a grid diagram, obtained by exchanging the O- and X-marking states.

                                      The defining no-double-marking condition is symmetric in the two marking states, so the swap is again a grid diagram.

                                      Instances For
                                        @[simp]

                                        The O-marking set of the marking swap is the original X-marking set.

                                        @[simp]

                                        The X-marking set of the marking swap is the original O-marking set.

                                        @[simp]

                                        The marking swap is an involution.

                                        @[simp]

                                        Row relabeling commutes with exchanging the two marking states.

                                        @[simp]

                                        Column relabeling commutes with exchanging the two marking states.

                                        @[simp]

                                        Row swaps commute with exchanging the two marking states.

                                        @[simp]

                                        Column swaps commute with exchanging the two marking states.

                                        @[simp]

                                        The marking swap commutes with the diagonal reflection of a grid diagram.

                                        def TauCeti.GridDiagram.cast {n m : ℕ} (h : n = m) (G : GridDiagram n) :

                                        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
                                          @[simp]
                                          theorem TauCeti.GridDiagram.cast_rfl {n : ℕ} (G : GridDiagram n) :
                                          cast ⋯ G = G

                                          Transporting a grid diagram along the reflexive equality does nothing.

                                          @[simp]
                                          theorem TauCeti.GridDiagram.cast_O_apply {n : ℕ} (G : GridDiagram n) {m : ℕ} (h : n = m) (c : Fin m) :
                                          (cast h G).O.toPerm c = Fin.cast h (G.O.toPerm (Fin.cast ⋯ c))

                                          The O marking of a transported grid diagram in a column is the transported O marking of the transported column.

                                          @[simp]
                                          theorem TauCeti.GridDiagram.cast_X_apply {n : ℕ} (G : GridDiagram n) {m : ℕ} (h : n = m) (c : Fin m) :
                                          (cast h G).X.toPerm c = Fin.cast h (G.X.toPerm (Fin.cast ⋯ c))

                                          The X marking of a transported grid diagram in a column is the transported X marking of the transported column.