Documentation

PlanarRooks.Diagrams

Planar Rook Diagrams #

A rook diagram on a $n \times m$ board is a collection of mutually non-attacking rooks. It is planar if no rook is "North-East" or "South-West" of any other.

Diagramatically, we can assign each rook to two numbers indicating its row and column. Due to the non-attacking condition, these numbers are unique to each rook. We can then draw this as two columns of vertices (one of $n$ points and one of $m$) with lines connecting a vertex on the left and on the right if they label the row and column of the same rook. The planarity condition is then equivalent to the condition that these lines do not cross.

structure PlanarRook.Diagram (n m : ) :

A planar rook diagram with n left vertices and m right vertices is given by specifying which left and right vertices are "defects" (connected to eachother)

Instances For
    theorem PlanarRook.Diagram.ext {n m : } {x y : Diagram n m} (left_defects : x.left_defects = y.left_defects) (right_defects : x.right_defects = y.right_defects) :
    x = y
    def PlanarRook.instDecidableEqDiagram.decEq {n✝ m✝ : } (x✝ x✝¹ : Diagram n✝ m✝) :
    Decidable (x✝ = x✝¹)
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      def PlanarRook.Diagram.pi_iso {n m : } :
      Diagram n m (k : ) × { S : Finset (Fin n) // S.card = k } × { S : Finset (Fin m) // S.card = k }
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        def PlanarRook.Diagram.pi_iso' {n m : } :
        (k : ) × { S : Finset (Fin n) // S.card = k } × { S : Finset (Fin m) // S.card = k } (k : Fin (n + 1)) × { S : Finset (Fin n) // S.card = k } × { S : Finset (Fin m) // S.card = k }
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          Examples #

          The empty diagram has no defects

          Equations
          Instances For

            The identity diagram has all vertices as defects

            Equations
            Instances For

              This is the diagram

              ──────╮    ╾─
              ────╮ │    ╾─
              ─╼  │ ╰-─────
              ─╼  ╰-───────
                         ╾─
              
              Equations
              Instances For
                Equations
                Instances For

                  Through indices #

                  A diagram has a "through-index": the number of defects on each side Diagrammatically, this is the number of lines connecting left and right vertices, or equivalently the number of rooks.

                  The through index of a diagram is the size of its left (or right) defects.

                  Equations
                  Instances For
                    def PlanarRook.Diagram.through_index_of_iso {n m : } (k : ) (s₁ : { S : Finset (Fin n) // S.card = k }) (s₂ : { S : Finset (Fin m) // S.card = k }) :
                    Equations
                    • =
                    Instances For

                      Through indices are bounded by the size of the left defects.

                      Through indices are bounded by the size of the right defects.

                      Diagrams as partial bijections #

                      A diagram defines a bijection between left and right defects

                      Equations
                      Instances For
                        @[simp]
                        Equations
                        • =
                        Instances For
                          def PlanarRook.Diagram.of_bijection {n m : } (left_defects : Finset (Fin n)) (right_defects : Finset (Fin m)) (bijection : left_defects ≃o right_defects) :
                          Equations
                          Instances For
                            def PlanarRook.Diagram.bijection_of_of_bijection {n m : } (left_defects : Finset (Fin n)) (right_defects : Finset (Fin m)) (bijection : left_defects ≃o right_defects) :
                            (of_bijection left_defects right_defects bijection).bijection = bijection
                            Equations
                            • =
                            Instances For
                              def PlanarRook.Diagram.bijections_are_diagrams {n m : } :
                              Diagram n m (left_defects : Finset (Fin n)) × (right_defects : Finset (Fin m)) × (left_defects ≃o right_defects)
                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                def PlanarRook.Diagram.act {n m : } (d : Diagram n m) (i : Fin n) :
                                Equations
                                Instances For
                                  def PlanarRook.Diagram.act_of_id {n : } (i : Fin n) :
                                  (id n).act i = some i
                                  Equations
                                  • =
                                  Instances For
                                    def PlanarRook.Diagram.act_of_empty {n m : } (i : Fin n) :
                                    (empty n m).act i = none
                                    Equations
                                    • =
                                    Instances For

                                      Multiplication of diagrams #

                                      def PlanarRook.Diagram.mul {n m k : } (d₁ : Diagram n m) (d₂ : Diagram m k) :
                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For
                                        @[simp]
                                        def PlanarRook.Diagram.hmul_left_defects {n m k : } (d₁ : Diagram n m) (d₂ : Diagram m k) :
                                        (d₁ * d₂).left_defects = {x : Fin n | ∃ (h : x d₁.left_defects), (d₁.bijection x, h) d₂.left_defects}
                                        Equations
                                        • =
                                        Instances For
                                          @[simp]
                                          def PlanarRook.Diagram.hmul_right_defects {n m k : } (d₁ : Diagram n m) (d₂ : Diagram m k) :
                                          (d₁ * d₂).right_defects = {y : Fin k | ∃ (h : y d₂.right_defects), (d₂.bijection.symm y, h) d₁.right_defects}
                                          Equations
                                          • =
                                          Instances For
                                            @[simp]
                                            def PlanarRook.Diagram.mul_id {n m : } (d : Diagram n m) :
                                            d * id m = d
                                            Equations
                                            • =
                                            Instances For
                                              @[simp]
                                              def PlanarRook.Diagram.id_mul {n m : } (d : Diagram n m) :
                                              id n * d = d
                                              Equations
                                              • =
                                              Instances For

                                                Simple results about multiplication #

                                                def PlanarRook.Diagram.mul_left_of_right_arbitrary {n m k : } {d₁ : Diagram n m} (d₂ d₃ : Diagram m k) (h : d₂.left_defects = d₃.left_defects) :
                                                (d₁ * d₂).left_defects = (d₁ * d₃).left_defects

                                                The left defects of a product do not change if you only change the right defects of the right factor.

                                                Equations
                                                • =
                                                Instances For
                                                  def PlanarRook.Diagram.mul_right_subset {n m k : } (d₁ : Diagram n m) (d₂ : Diagram m k) :
                                                  (d₁ * d₂).right_defects d₂.right_defects
                                                  Equations
                                                  • =
                                                  Instances For
                                                    def PlanarRook.Diagram.mul_left_subset {n m k : } (d₁ : Diagram n m) (d₂ : Diagram m k) :
                                                    (d₁ * d₂).left_defects d₁.left_defects
                                                    Equations
                                                    • =
                                                    Instances For

                                                      Through degree of multiplication #

                                                      theorem PlanarRook.Diagram.through_degree_of_mul {n m k : } (d₁ : Diagram n m) (d₂ : Diagram m k) :
                                                      theorem PlanarRook.Diagram.mul_not_increase_through_degree {n m k : } (d₁ : Diagram n m) (d₂ : Diagram m k) :

                                                      Multiplication does not increase the through degree of either diagram.

                                                      def PlanarRook.Diagram.through_index_of_mul_independent_of_right {n m k : } (d₁ : Diagram n m) (d₂ d₃ : Diagram m k) (h : d₂.left_defects = d₃.left_defects) :
                                                      (d₁ * d₂).through_index = (d₁ * d₃).through_index
                                                      Equations
                                                      • =
                                                      Instances For

                                                        Lemmata for proving associativity of multiplication #

                                                        def PlanarRook.Diagram.restate_mul₃ {n m k : } (d₁ : Diagram n m) (d₂ : Diagram m k) (x : d₁.left_defects) (hxx : (d₁.bijection x) d₂.left_defects) :
                                                        ((d₁ * d₂).bijection x, ) = (d₂.bijection (d₁.bijection x), hxx)
                                                        Equations
                                                        • =
                                                        Instances For
                                                          def PlanarRook.Diagram.restate_mul₅ {n m k : } (d₁ : Diagram n m) (d₂ : Diagram m k) (x : d₂.right_defects) (hx : (d₂.bijection.symm x) d₁.right_defects) :
                                                          (d₁ * d₂).bijection.symm x, = (d₁.bijection.symm (d₂.bijection.symm x), hx),
                                                          Equations
                                                          • =
                                                          Instances For

                                                            Associativity of multiplication #

                                                            def PlanarRook.Diagram.mul_assoc {n m k l : } (d₁ : Diagram n m) (d₂ : Diagram m k) (d₃ : Diagram k l) :
                                                            d₁ * d₂ * d₃ = d₁ * (d₂ * d₃)
                                                            Equations
                                                            • =
                                                            Instances For

                                                              The monoid of planar rook diagrams #

                                                              We can now show that the planar rook diagrams with n vertices on each side form a monoid under multiplication.

                                                              Equations

                                                              The twist factor in the monoid #

                                                              There is a natural number that arises when multiplying two diagrams, PlanarRook.Monoid.mul_exponent, which counts the number of disconnected components in the resulting diagram. This can be used when defining PlanarRook.Algebra to determine the "twist": the power of δ that appears. Here we collate some results about this number.

                                                              def PlanarRook.Monoid.mul_exponent {n m k : } (d₁ : Diagram n m) (d₂ : Diagram m k) :
                                                              Equations
                                                              Instances For
                                                                theorem PlanarRook.Monoid.mul_exponent' {n m k : } (d₁ : Diagram n m) (d₂ : Diagram m k) :
                                                                (mul_exponent d₁ d₂) = m - d₁.through_index - d₂.through_index + (d₁ * d₂).through_index

                                                                The identity diagram invokes zero twist when multiplied on the right.

                                                                Equations
                                                                • =
                                                                Instances For

                                                                  The identity diagram invokes zero twist when multiplied on the left.

                                                                  Equations
                                                                  • =
                                                                  Instances For
                                                                    def PlanarRook.Monoid.mul_exponent_assoc' {n m k l : } (d₁ : Diagram n m) (d₂ : Diagram m k) (d₃ : Diagram k l) :
                                                                    (mul_exponent d₁ d₂) + (mul_exponent (d₁ * d₂) d₃) = (mul_exponent d₁ (d₂ * d₃)) + (mul_exponent d₂ d₃)

                                                                    The twist is additive over associated multipliation as an integer.

                                                                    Equations
                                                                    • =
                                                                    Instances For
                                                                      def PlanarRook.Monoid.mul_exponent_ge_zero {n m k : } (d₁ : Diagram n m) (d₂ : Diagram m k) :
                                                                      0 mul_exponent d₁ d₂

                                                                      The twist is non-negative.

                                                                      Equations
                                                                      • =
                                                                      Instances For
                                                                        def PlanarRook.Monoid.mul_exponent_assoc {n m k l : } (d₁ : Diagram n m) (d₂ : Diagram m k) (d₃ : Diagram k l) :
                                                                        mul_exponent d₁ d₂ + mul_exponent (d₁ * d₂) d₃ = mul_exponent d₁ (d₂ * d₃) + mul_exponent d₂ d₃

                                                                        The twist is additive over associated multiplication as a natural number.

                                                                        Equations
                                                                        • =
                                                                        Instances For
                                                                          def PlanarRook.Monoid.mul_exponent_of_right_arbitrary {n m k : } (d₁ : Diagram n m) (d₂ d₃ : Diagram m k) (h₁ : d₂.left_defects = d₃.left_defects) :
                                                                          mul_exponent d₁ d₂ = mul_exponent d₁ d₃
                                                                          Equations
                                                                          • =
                                                                          Instances For

                                                                            The monoid involution #

                                                                            There is a natural involution on diagrams, given by reflecting them across the vertical axis. This sends left defects to right defects and vice versa, and reverses the order of multiplication.

                                                                            def PlanarRook.Diagram.ι {n m : } :
                                                                            Diagram n mDiagram m n
                                                                            Equations
                                                                            Instances For
                                                                              def PlanarRook.Diagram.ι_involutive {n m : } (d : Diagram n m) :
                                                                              d.ι.ι = d
                                                                              Equations
                                                                              • =
                                                                              Instances For
                                                                                Equations
                                                                                • =
                                                                                Instances For
                                                                                  Equations
                                                                                  • =
                                                                                  Instances For
                                                                                    def PlanarRook.Diagram.ι_mul {n m k : } (d₁ : Diagram n m) (d₂ : Diagram m k) :
                                                                                    (d₁ * d₂).ι = d₂.ι * d₁.ι

                                                                                    The involution reverses the order of multiplication.

                                                                                    Equations
                                                                                    • =
                                                                                    Instances For

                                                                                      The involution preserves the through index.

                                                                                      @[simp]
                                                                                      theorem PlanarRook.Monoid.mul_exponent_of_ι {n m k : } (d₁ : Diagram n m) (d₂ : Diagram m k) :
                                                                                      mul_exponent d₂.ι d₁.ι = mul_exponent d₁ d₂

                                                                                      The involution preserves the multiplication exponent.

                                                                                      def PlanarRook.Diagram.ι_of_iso {n m : } (k : ) (s₁ : { S : Finset (Fin n) // S.card = k }) (s₂ : { S : Finset (Fin m) // S.card = k }) :
                                                                                      (pi_iso.symm k, (s₁, s₂)).ι = pi_iso.symm k, (s₂, s₁)
                                                                                      Equations
                                                                                      • =
                                                                                      Instances For
                                                                                        def PlanarRook.Diagram.ι_of_iso₂ {n : } (k : Fin (n + 1)) (s₁ s₂ : { S : Finset (Fin n) // S.card = k }) :
                                                                                        (pi_iso.symm k, (s₁, s₂)).ι = pi_iso₂.symm k, (s₂, s₁)
                                                                                        Equations
                                                                                        • =
                                                                                        Instances For