Documentation

AlgebraicCombinatorics.Details.DominoTilings

Domino Tilings of Height-3 Rectangles #

This file formalizes the classification of faultfree domino tilings of the rectangle R_{n,3} from Subsection sec.details.domino of the Algebraic Combinatorics notes.

A domino is a 1×2 or 2×1 rectangle. A domino tiling of a rectangle is a partition of the rectangle's cells into dominos. A fault in a tiling is a vertical line that passes through the entire rectangle without crossing any domino. A faultfree tiling has no such faults.

Main definitions #

Main results #

References #

Tags #

domino tiling, faultfree, rectangle, combinatorics

Basic Definitions #

@[reducible, inline]

A cell in a rectangle, represented as a pair (column, row) with 1-indexing. Column numbers go from 1 to n (left to right). Row numbers go from 1 to m (bottom to top).

Equations
Instances For

    The rectangle R_{n,m} is the set of cells {(x, y) : 1 ≤ x ≤ n, 1 ≤ y ≤ m}.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      theorem DominoTilings.card_Rectangle (n m : ) :
      (Rectangle n m).card = n * m

      The rectangle R_{n,m} has exactly n * m cells.

      theorem DominoTilings.mem_Rectangle {n m : } {c : Cell} :
      c Rectangle n m c.1 1 c.1 n c.2 1 c.2 m

      Membership characterization for Rectangle.

      A domino is a pair of adjacent cells, either horizontal or vertical.

      Instances For
        theorem DominoTilings.Domino.ext {x y : Domino} (cell1 : x.cell1 = y.cell1) (cell2 : x.cell2 = y.cell2) :
        x = y
        def DominoTilings.instDecidableEqDomino.decEq (x✝ x✝¹ : Domino) :
        Decidable (x✝ = x✝¹)
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          The set of cells covered by a domino.

          Equations
          Instances For
            @[simp]

            Each domino covers exactly 2 cells.

            A domino is horizontal if both cells are in the same row.

            Equations
            Instances For

              A domino is vertical if both cells are in the same column.

              Equations
              Instances For

                Every domino is either horizontal or vertical.

                A domino cannot be both horizontal and vertical.

                A domino is horizontal iff it's not vertical.

                A domino is vertical iff it's not horizontal.

                Every domino is either horizontal or vertical (exclusive or).

                The leftmost column touched by a domino.

                Equations
                Instances For

                  The rightmost column touched by a domino.

                  Equations
                  Instances For

                    Shifting operations for dominos #

                    These operations shift a domino horizontally by adding or subtracting from the column coordinate. They are essential for the Fibonacci recurrence bijection on 2×n tilings.

                    Shift a domino k columns to the right.

                    Equations
                    Instances For
                      def DominoTilings.Domino.shiftNeg (d : Domino) (k : ) (h1 : d.cell1.1 k + 1) (h2 : d.cell2.1 k + 1) :

                      Shift a domino k columns to the left. Requires that both cells have column ≥ k+1.

                      Equations
                      Instances For
                        @[simp]
                        @[simp]
                        @[simp]
                        theorem DominoTilings.Domino.shiftNeg_cell1 (d : Domino) (k : ) (h1 : d.cell1.1 k + 1) (h2 : d.cell2.1 k + 1) :
                        (d.shiftNeg k h1 h2).cell1 = (d.cell1.1 - k, d.cell1.2)
                        @[simp]
                        theorem DominoTilings.Domino.shiftNeg_cell2 (d : Domino) (k : ) (h1 : d.cell1.1 k + 1) (h2 : d.cell2.1 k + 1) :
                        (d.shiftNeg k h1 h2).cell2 = (d.cell2.1 - k, d.cell2.2)
                        theorem DominoTilings.Domino.shiftNeg_shiftNat (d : Domino) (k : ) (hc1 : d.cell1.1 1) (hc2 : d.cell2.1 1) :
                        (d.shiftNat k).shiftNeg k = d

                        Shifting right then left returns the original domino (when original has positive columns).

                        theorem DominoTilings.Domino.shiftNat_shiftNeg (d : Domino) (k : ) (h1 : d.cell1.1 k + 1) (h2 : d.cell2.1 k + 1) :
                        (d.shiftNeg k h1 h2).shiftNat k = d

                        Shifting left then right returns the original domino.

                        theorem DominoTilings.Domino.shiftNat_shiftNeg_cells (d : Domino) (k : ) (h1 : d.cell1.1 k + 1) (h2 : d.cell2.1 k + 1) :
                        ((d.shiftNeg k h1 h2).shiftNat k).cells = d.cells

                        Cells are preserved through shift-unshift: (d.shiftNeg k ...).shiftNat k has the same cells as d. This is a corollary of shiftNat_shiftNeg and is useful for proving TilingEquiv.

                        shiftNat is injective.

                        theorem DominoTilings.Domino.shiftNeg_injective {d1 d2 : Domino} {k : } (h1_1 : d1.cell1.1 k + 1) (h1_2 : d1.cell2.1 k + 1) (h2_1 : d2.cell1.1 k + 1) (h2_2 : d2.cell2.1 k + 1) (heq : d1.shiftNeg k h1_1 h1_2 = d2.shiftNeg k h2_1 h2_2) :
                        d1 = d2

                        shiftNeg is injective (when both dominos have sufficient column coordinates).

                        theorem DominoTilings.Domino.shiftNat_minCol_ge (d : Domino) (k : ) (hc1 : d.cell1.1 1) (hc2 : d.cell2.1 1) :
                        (d.shiftNat k).minCol k + 1

                        A shifted domino has minCol at least k+1 when original has positive columns.

                        Vertical dominos remain vertical after shifting.

                        Horizontal dominos remain horizontal after shifting.

                        Standard dominos for 2×n tilings #

                        These are the specific dominos used in the Fibonacci recurrence bijection for tilings of Rectangle n 2.

                        The vertical domino covering column 1 in a 2-row rectangle: cells (1,1) and (1,2).

                        Equations
                        Instances For

                          The horizontal domino covering row 1, columns 1-2: cells (1,1) and (2,1).

                          Equations
                          Instances For

                            The horizontal domino covering row 2, columns 1-2: cells (1,2) and (2,2).

                            Equations
                            Instances For

                              The vertical domino is not equal to horizontal_1_1.

                              The vertical domino is not equal to horizontal_1_2.

                              horizontal_1_1 is not equal to horizontal_1_2.

                              The "flipped" vertical domino with cell1 and cell2 swapped.

                              Equations
                              Instances For

                                If a domino has the same cells as vertical_1_1, it is either vertical_1_1 or vertical_1_1_flip.

                                theorem DominoTilings.vertical_1_1_not_in_shiftNat1_image (S : Finset Domino) (hS : dS, d.cell1.1 1 d.cell2.1 1) :
                                vertical_1_1Finset.image (fun (d : Domino) => d.shiftNat 1) S

                                vertical_1_1 is not in the image of shiftNat by 1 for dominos with positive columns.

                                theorem DominoTilings.horizontal_1_1_not_in_shiftNat2_image (S : Finset Domino) (hS : dS, d.cell1.1 1 d.cell2.1 1) :
                                horizontal_1_1Finset.image (fun (d : Domino) => d.shiftNat 2) S

                                horizontal_1_1 is not in the image of shiftNat by 2 for dominos with positive columns.

                                theorem DominoTilings.horizontal_1_2_not_in_shiftNat2_image (S : Finset Domino) (hS : dS, d.cell1.1 1 d.cell2.1 1) :
                                horizontal_1_2Finset.image (fun (d : Domino) => d.shiftNat 2) S

                                horizontal_1_2 is not in the image of shiftNat by 2 for dominos with positive columns.

                                theorem DominoTilings.vertical_1_1_not_in_shiftNat2_image (S : Finset Domino) (hS : dS, d.cell1.1 1 d.cell2.1 1) :
                                vertical_1_1Finset.image (fun (d : Domino) => d.shiftNat 2) S

                                vertical_1_1 is not in the image of shiftNat by 2 for dominos with positive columns.

                                Domino Tilings #

                                A domino tiling of a rectangle is a finite set of dominos such that:

                                1. Each domino's cells are within the rectangle
                                2. The dominos partition the rectangle (cover all cells exactly once)
                                Instances For

                                  Dominos in a tiling have cells with positive column coordinates.

                                  Dominos in a tiling have cells with positive row coordinates.

                                  In a 2-row tiling with horizontal_1_1 and horizontal_1_2, all other dominos have cells with column ≥ 3. This is because horizontal_1_1 and horizontal_1_2 cover all cells in columns 1 and 2.

                                  A tiling has a fault at column k if there is a vertical line between columns k and k+1 that does not cross any domino. Equivalently, no domino spans columns k and k+1.

                                  Equations
                                  Instances For

                                    A tiling is faultfree if it has no faults at any column in range [1, n-1].

                                    Equations
                                    Instances For

                                      Whether a tiling contains a vertical domino in the top two squares of column c.

                                      Equations
                                      Instances For

                                        Whether a tiling contains a vertical domino in the bottom two squares of column c.

                                        Equations
                                        Instances For

                                          Whether a tiling contains any vertical domino in column c.

                                          Equations
                                          Instances For

                                            The cardinality of the rectangle equals twice the number of dominos in any tiling.

                                            theorem DominoTilings.DominoTiling.cell_covered {n m : } (T : DominoTiling n m) (c : Cell) (hc : c Rectangle n m) :
                                            dT.dominos, c d.cells

                                            Every cell in the rectangle is covered by some domino in the tiling.

                                            theorem DominoTilings.DominoTiling.cell_covered_unique {n m : } (T : DominoTiling n m) (c : Cell) (d₁ d₂ : Domino) (hd₁ : d₁ T.dominos) (hd₂ : d₂ T.dominos) (hc₁ : c d₁.cells) (hc₂ : c d₂.cells) :
                                            d₁ = d₂

                                            If a cell is covered by two dominos in a tiling, they must be the same domino. This follows from the pairwise disjointness of dominos in a tiling.

                                            Two tilings are equivalent if they cover the same cells with the same domino cell sets.

                                            This is the appropriate notion of equality for tilings, since the Domino structure distinguishes between {cell1 := a, cell2 := b} and {cell1 := b, cell2 := a} even though they cover the same cells.

                                            Note: This is a weaker notion than structural equality (T₁ = T₂), but is the mathematically correct notion for classification theorems.

                                            Equations
                                            Instances For

                                              TilingEquiv is reflexive.

                                              theorem DominoTilings.DominoTiling.tilingEquiv_symm {n m : } {T₁ T₂ : DominoTiling n m} (h : T₁.TilingEquiv T₂) :
                                              T₂.TilingEquiv T₁

                                              TilingEquiv is symmetric.

                                              theorem DominoTilings.DominoTiling.tilingEquiv_trans {n m : } {T₁ T₂ T₃ : DominoTiling n m} (h₁ : T₁.TilingEquiv T₂) (h₂ : T₂.TilingEquiv T₃) :
                                              T₁.TilingEquiv T₃

                                              TilingEquiv is transitive.

                                              theorem DominoTilings.DominoTiling.image_erase_insert_eq {α : Type u_1} {β : Type u_2} [DecidableEq α] [DecidableEq β] (S : Finset α) (v w : α) (f : αβ) (hv : v S) (hf : f v = f w) :

                                              Helper lemma: replacing an element v with w in a finset preserves the image when f(v) = f(w). This is the key lemma for proving TilingEquiv is preserved when replacing a domino with another domino covering the same cells.

                                              Prepend operations for the Fibonacci recurrence bijection #

                                              These operations construct tilings of Rectangle (n+1) 2 or Rectangle (n+2) 2 from tilings of smaller rectangles by prepending dominos at the left edge and shifting existing dominos to the right. They form the inverse maps in the bijection: Tiling (Rectangle (n+2) 2) ≃ Tiling (Rectangle n 2) ⊕ Tiling (Rectangle (n+1) 2)

                                              Prepend a vertical domino at (1,1)-(1,2) to a tiling of Rectangle n 2, creating a tiling of Rectangle (n+1) 2.

                                              This is one of the inverse maps in the Fibonacci recurrence bijection. The vertical domino covers the entire first column, creating a fault at x=1.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For

                                                Prepend two horizontal dominos at (1,1)-(2,1) and (1,2)-(2,2) to a tiling of Rectangle n 2, creating a tiling of Rectangle (n+2) 2.

                                                This is one of the inverse maps in the Fibonacci recurrence bijection. The two horizontal dominos cover the first two columns, creating a fault at x=2.

                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For

                                                  Restriction operations for the Fibonacci recurrence bijection #

                                                  These operations extract the "rest" of a tiling after removing the dominos covering the first column(s). They form the forward maps in the bijection: Tiling (Rectangle (n+2) 2) ≃ Tiling (Rectangle n 2) ⊕ Tiling (Rectangle (n+1) 2)

                                                  The idea:

                                                  Together with prependVertical and prependHorizontalPair, these establish the Fibonacci recurrence: |Tiling(n+2, 2)| = |Tiling(n, 2)| + |Tiling(n+1, 2)|

                                                  theorem DominoTilings.DominoTiling.domino_col_ge_two_of_disjoint_from_first_col {n : } (T : DominoTiling (n + 1) 2) (v : Domino) (hv : v T.dominos) (hv_cells : v.cells = vertical_1_1.cells) (d : Domino) (hd : d T.dominos) (hne : d v) :
                                                  d.cell1.1 2 d.cell2.1 2

                                                  If a domino d in a tiling is disjoint from a domino covering {(1,1), (1,2)}, then d's cells have column ≥ 2. This is the generalized version that works with any domino covering the first column, not just vertical_1_1.

                                                  If a domino d in a tiling containing vertical_1_1 is not vertical_1_1, then d's cells have column ≥ 2.

                                                  Extract the tiling of Rectangle n 2 from a tiling of Rectangle (n+1) 2 that has vertical_1_1 as its first domino.

                                                  This removes vertical_1_1 and shifts all remaining dominos one column left. It is the left inverse of prependVertical.

                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For

                                                    Extract the tiling of Rectangle n 2 from a tiling of Rectangle (n+2) 2 that has horizontal_1_1 and horizontal_1_2 as its first dominos.

                                                    This removes the two horizontal dominos and shifts remaining dominos two columns left. It is the left inverse of prependHorizontalPair.

                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    Instances For

                                                      Bijection lemmas for the Fibonacci recurrence #

                                                      These lemmas establish that prependVertical/prependHorizontalPair and restrictAfterVertical/restrictAfterHorizontalPair are inverse operations.

                                                      prependVertical followed by restrictAfterVertical is the identity.

                                                      restrictAfterVertical followed by prependVertical is the identity (when the tiling starts with vertical_1_1).

                                                      prependHorizontalPair followed by restrictAfterHorizontalPair is the identity.

                                                      restrictAfterHorizontalPair followed by prependHorizontalPair is the identity (when the tiling starts with horizontal_1_1 and horizontal_1_2).

                                                      Dichotomy lemmas for the Fibonacci recurrence #

                                                      These lemmas establish that every 2×(n+2) tiling either:

                                                      This is the key dichotomy needed for the bijection.

                                                      In a 2×(n+1) tiling, cell (1,1) is covered by some domino.

                                                      theorem DominoTilings.DominoTiling.domino_covering_11_cells {n : } (T : DominoTiling (n + 2) 2) (d : Domino) (hd : d T.dominos) (hcov : (1, 1) d.cells) :
                                                      d.cells = {(1, 1), (1, 2)} d.cells = {(1, 1), (2, 1)}

                                                      Any domino covering cell (1,1) in a 2×(n+2) tiling has cells = {(1,1), (1,2)} or {(1,1), (2,1)}.

                                                      theorem DominoTilings.DominoTiling.exists_domino_covering_12_of_horizontal {n : } (T : DominoTiling (n + 2) 2) (d : Domino) (hd : d T.dominos) (hcells : d.cells = {(1, 1), (2, 1)}) :
                                                      d'T.dominos, d' d (1, 2) d'.cells

                                                      If a domino in a 2×(n+2) tiling covers (1,1) with a horizontal domino (cells = {(1,1), (2,1)}), then there must be another domino covering (1,2).

                                                      theorem DominoTilings.DominoTiling.domino_covering_12_cells {n : } (T : DominoTiling (n + 2) 2) (d d' : Domino) (hd : d T.dominos) (hd' : d' T.dominos) (hne : d' d) (hd_cells : d.cells = {(1, 1), (2, 1)}) (hd'_cov : (1, 2) d'.cells) :
                                                      d'.cells = {(1, 2), (2, 2)}

                                                      The second domino covering (1,2) when the first covers {(1,1), (2,1)} must cover {(1,2), (2,2)}.

                                                      Generalized restrict functions #

                                                      These functions generalize restrictAfterVertical and restrictAfterHorizontalPair to work with any domino having the appropriate cells, not just the specific canonical dominos. This is needed for the Equiv construction since tilings may use flipped versions of dominos.

                                                      Generalized version of restrictAfterVertical that works with any domino v having cells = {(1,1), (1,2)}.

                                                      Equations
                                                      • One or more equations did not get rendered due to their size.
                                                      Instances For

                                                        restrictAfterVerticalGen with vertical_1_1 equals restrictAfterVertical.

                                                        theorem DominoTilings.DominoTiling.other_dominos_col_ge_3_gen {n : } (T : DominoTiling (n + 2) 2) (d1 d2 : Domino) (hd1 : d1 T.dominos) (hd2 : d2 T.dominos) (hd1_cells : d1.cells = {(1, 1), (2, 1)}) (hd2_cells : d2.cells = {(1, 2), (2, 2)}) (d : Domino) (hd : d T.dominos) (hne1 : d d1) (hne2 : d d2) :
                                                        d.cell1.1 3 d.cell2.1 3

                                                        Lemma: other dominos have column ≥ 3 when two dominos cover the first two columns.

                                                        def DominoTilings.DominoTiling.restrictAfterHorizontalPairGen {n : } (T : DominoTiling (n + 2) 2) (d1 d2 : Domino) (hd1 : d1 T.dominos) (hd2 : d2 T.dominos) (hd1_cells : d1.cells = {(1, 1), (2, 1)}) (hd2_cells : d2.cells = {(1, 2), (2, 2)}) :

                                                        Generalized version of restrictAfterHorizontalPair that works with any dominos d1, d2 having the appropriate cells.

                                                        Equations
                                                        • One or more equations did not get rendered due to their size.
                                                        Instances For

                                                          Predicate for vertical first column #

                                                          A tiling has a "vertical first column" if some domino covers cells (1,1) and (1,2). This is the key predicate for the Fibonacci recurrence bijection.

                                                          A tiling has a vertical first column if some domino covers cells (1,1) and (1,2).

                                                          Equations
                                                          Instances For

                                                            The dichotomy: every 2×(n+2) tiling either has a vertical first column or a horizontal pair.

                                                            theorem DominoTilings.DominoTiling.horizontalPair_of_not_hasVerticalFirstColumn {n : } (T : DominoTiling (n + 2) 2) (hnotvert : ¬T.hasVerticalFirstColumn) :
                                                            (∃ d₁T.dominos, d₁.cells = {(1, 1), (2, 1)}) d₂T.dominos, d₂.cells = {(1, 2), (2, 2)}

                                                            If a tiling doesn't have a vertical first column, then it has a horizontal pair.

                                                            If a tiling has a vertical first column, then either vertical_1_1 or vertical_1_1_flip is in the tiling's dominos.

                                                            If vertical_1_1 is in a tiling, then vertical_1_1_flip is not (by disjointness).

                                                            If vertical_1_1 is in a tiling with a vertical first column, then Classical.choose picks vertical_1_1 (since it's the unique witness).

                                                            The Fibonacci recurrence Equiv #

                                                            The equivalence DominoTiling (n + 2) 2 ≃ DominoTiling n 2 ⊕ DominoTiling (n + 1) 2 establishes the Fibonacci recurrence for counting 2×n domino tilings.

                                                            Important note on canonical forms: The Domino structure distinguishes between dominos with swapped cell1/cell2. For example, vertical_1_1 (with cell1=(1,1), cell2=(1,2)) is different from vertical_1_1_flip (with cell1=(1,2), cell2=(1,1)), even though they cover the same cells.

                                                            The Equiv is constructed such that:

                                                            This means backward ∘ forward acts as a "canonicalization" function: it preserves the cell coverage but may change which specific domino representatives are used. The Equiv is still valid because the maps are inverses when restricted to canonical tilings, and canonical tilings are in bijection with all tilings via canonicalization.

                                                            In prependVertical T, the only domino with cells {(1,1), (1,2)} is vertical_1_1.

                                                            noncomputable def DominoTilings.DominoTiling.tiling_2_to_sum {n : } (T : DominoTiling (n + 2) 2) :

                                                            Forward map for the Fibonacci recurrence bijection. Maps a 2×(n+2) tiling to either:

                                                            • inl T' where T' is a 2×n tiling (horizontal case)
                                                            • inr T' where T' is a 2×(n+1) tiling (vertical case)
                                                            Equations
                                                            • One or more equations did not get rendered due to their size.
                                                            Instances For

                                                              Backward map for the Fibonacci recurrence bijection. Maps a sum to a 2×(n+2) tiling by prepending dominos.

                                                              Equations
                                                              Instances For

                                                                The roundtrip tiling_2_to_sum (tiling_2_from_sum x) = x. This is the key property establishing that tiling_2_from_sum is a right inverse of tiling_2_to_sum, which proves surjectivity of tiling_2_to_sum and injectivity of tiling_2_from_sum.

                                                                Helper lemmas for the TilingEquiv proof #

                                                                The roundtrip tiling_2_from_sum (tiling_2_to_sum T) produces a tiling that is TilingEquiv to T (same cell coverage).

                                                                This establishes that the bijection preserves cell coverage, even though structural equality may fail due to the Domino representation issue (cell1/cell2 ordering).

                                                                Combined with right_inv, this proves that tiling_2_to_sum and tiling_2_from_sum form a bijection at the level of cell coverage, establishing the Fibonacci recurrence for counting 2×n domino tilings.

                                                                Proof status: FULLY PROVED

                                                                • Vertical case: PROVED (uses helper lemmas image_preserved_under_double_roundtrip' and insert_erase_image_eq')
                                                                • Horizontal case: PROVED (uses helper lemma insert_insert_erase_erase_image_eq)

                                                                The backward map tiling_2_from_sum is surjective up to TilingEquiv. For any tiling T : DominoTiling (n+2) 2, there exists x such that tiling_2_from_sum x is TilingEquiv to T.

                                                                This follows from tiling_2_roundtrip_TilingEquiv: taking x = tiling_2_to_sum T, we have TilingEquiv (tiling_2_from_sum x) T.

                                                                Combined with tiling_2_from_sum_injective, this establishes that tiling_2_from_sum is a bijection between DominoTiling n 2 ⊕ DominoTiling (n+1) 2 and the TilingEquiv equivalence classes of DominoTiling (n+2) 2. This proves the Fibonacci recurrence for counting 2×n domino tilings at the level of cell coverage.

                                                                Note: Structural equality (=) fails for the left_inv direction because tilings may use "flipped" dominos (e.g., vertical_1_1_flip instead of vertical_1_1). However, the mathematical content is correct: the roundtrip preserves cell coverage (TilingEquiv), and the bijection at the cell level is established.

                                                                Helper to construct a horizontal domino at position (x, y) extending right. The domino covers cells (x, y) and (x+1, y).

                                                                Equations
                                                                Instances For

                                                                  Helper to construct a vertical domino at position (x, y) extending up. The domino covers cells (x, y) and (x, y+1).

                                                                  Equations
                                                                  Instances For

                                                                    Simp lemmas for mkHorizontalDomino and mkVerticalDomino #

                                                                    Definition of Tiling A_n (def.gf.weighted-set.domino.Rn3.ABC (a)) #

                                                                    For even positive n, A_n consists of:

                                                                    The basement dominos for tiling A_n: horizontal dominos filling the bottom row.

                                                                    Equations
                                                                    • One or more equations did not get rendered due to their size.
                                                                    Instances For

                                                                      The left wall for tiling A_n: vertical domino in column 1, rows 2-3.

                                                                      Equations
                                                                      Instances For

                                                                        The right wall for tiling A_n: vertical domino in column n, rows 2-3.

                                                                        Equations
                                                                        Instances For

                                                                          The middle dominos for tiling A_n: horizontal dominos in row 2 (except first/last columns).

                                                                          Equations
                                                                          • One or more equations did not get rendered due to their size.
                                                                          Instances For

                                                                            The top dominos for tiling A_n: horizontal dominos in row 3 (except first/last columns).

                                                                            Equations
                                                                            • One or more equations did not get rendered due to their size.
                                                                            Instances For
                                                                              def DominoTilings.TilingA (n : ) (hn : Even n) (hn_ge : n 2) :

                                                                              Tiling A_n for even positive n ≥ 2.

                                                                              This is the faultfree tiling of R_{n,3} with:

                                                                              • A vertical domino (left wall) in the top two squares of column 1
                                                                              • Horizontal basement dominos filling the bottom row
                                                                              • Horizontal middle and top dominos filling the interior
                                                                              • A vertical domino (right wall) in the top two squares of column n

                                                                              (def.gf.weighted-set.domino.Rn3.ABC (a))

                                                                              Equations
                                                                              • One or more equations did not get rendered due to their size.
                                                                              Instances For

                                                                                Definition of Tiling B_n (def.gf.weighted-set.domino.Rn3.ABC (b)) #

                                                                                B_n is the reflection of A_n across the horizontal axis of symmetry of R_{n,3}. This swaps row 1 with row 3, keeping row 2 fixed.

                                                                                For B_n, we have:

                                                                                The "basement" dominos for tiling B_n: horizontal dominos filling row 3 (the top row). Named "basement" by analogy with A_n, though in B_n these are at the top due to reflection.

                                                                                Equations
                                                                                • One or more equations did not get rendered due to their size.
                                                                                Instances For

                                                                                  The left wall for tiling B_n: vertical domino in column 1, rows 1-2. Note: cell ordering matches reflectDomino3 applied to leftWall.

                                                                                  Equations
                                                                                  Instances For

                                                                                    The right wall for tiling B_n: vertical domino in column n, rows 1-2. Note: cell ordering matches reflectDomino3 applied to rightWall.

                                                                                    Equations
                                                                                    Instances For

                                                                                      The bottom dominos for tiling B_n: horizontal dominos in row 1 (except first/last columns).

                                                                                      Equations
                                                                                      • One or more equations did not get rendered due to their size.
                                                                                      Instances For
                                                                                        def DominoTilings.TilingB (n : ) (hn : Even n) (hn_ge : n 2) :

                                                                                        Tiling B_n for even positive n ≥ 2.

                                                                                        This is the reflection of A_n across the horizontal axis. It has a vertical domino in the bottom two squares of column 1.

                                                                                        (def.gf.weighted-set.domino.Rn3.ABC (b))

                                                                                        Equations
                                                                                        • One or more equations did not get rendered due to their size.
                                                                                        Instances For

                                                                                          Definition of Tiling C (def.gf.weighted-set.domino.Rn3.ABC (c)) #

                                                                                          C is the unique faultfree tiling of R_{2,3} consisting of three horizontal dominos.

                                                                                          Tiling C: three horizontal dominos covering R_{2,3}.

                                                                                          The dominos are:

                                                                                          • {(1, 1), (2, 1)} (bottom row)
                                                                                          • {(1, 2), (2, 2)} (middle row)
                                                                                          • {(1, 3), (2, 3)} (top row)

                                                                                          (def.gf.weighted-set.domino.Rn3.ABC (c))

                                                                                          Equations
                                                                                          • One or more equations did not get rendered due to their size.
                                                                                          Instances For

                                                                                            Horizontal Reflection for Height-3 Tilings #

                                                                                            We define reflection across the horizontal axis of R_{n,3}, which swaps rows 1 and 3 while keeping row 2 fixed. This is used to relate TilingA and TilingB.

                                                                                            Reflect a cell across the horizontal midline of a height-3 rectangle. Maps (x, 1) ↔ (x, 3) and fixes (x, 2).

                                                                                            Equations
                                                                                            Instances For
                                                                                              theorem DominoTilings.reflectCell3_involutive (c : Cell) (h1 : c.2 1) (h2 : c.2 3) :

                                                                                              reflectCell3 is an involution on cells with row in {1, 2, 3}.

                                                                                              noncomputable def DominoTilings.reflectTiling3 {n : } (T : DominoTiling n 3) :

                                                                                              Reflect a tiling of R_{n,3} across the horizontal axis. This operation is well-defined and produces a valid tiling.

                                                                                              Equations
                                                                                              • One or more equations did not get rendered due to their size.
                                                                                              Instances For

                                                                                                Key property: For each domino in T, there's a corresponding reflected domino in reflectTiling3 T with the same minCol and maxCol. This captures the essential fact that horizontal reflection only changes row coordinates, not column coordinates.

                                                                                                Reflection preserves faultfreeness.

                                                                                                The proof uses the key observation that horizontal reflection only changes row coordinates, not column coordinates. Therefore, minCol and maxCol of each domino are preserved. Since faults are determined solely by whether dominos span column boundaries (i.e., whether minCol ≤ k < maxCol for some k), reflection preserves faultfreeness.

                                                                                                Reflection is an involution.

                                                                                                reflectTiling3 preserves TilingEquiv: if T₁ ≃ T₂ (same cell images), then reflectTiling3 T₁ ≃ reflectTiling3 T₂.

                                                                                                theorem DominoTilings.TilingB_eq_reflectTiling3_TilingA (n : ) (hn : Even n) (hn_ge : n 2) :
                                                                                                TilingB n hn hn_ge = reflectTiling3 (TilingA n hn hn_ge)

                                                                                                TilingB is the reflection of TilingA.

                                                                                                Main Classification Theorem #

                                                                                                Proposition prop.gf.weighted-set.domino.Rn3.ABC states that the faultfree domino tilings of height-3 rectangles are precisely:

                                                                                                theorem DominoTilings.TilingA_isFaultfree (n : ) (hn : Even n) (hn_ge : n 2) :
                                                                                                (TilingA n hn hn_ge).isFaultfree

                                                                                                The tilings A_n are faultfree.

                                                                                                The basement dominos prevent faults between columns 2i-1 and 2i, while the top dominos prevent faults between columns 2i and 2i+1.

                                                                                                theorem DominoTilings.TilingB_isFaultfree (n : ) (hn : Even n) (hn_ge : n 2) :
                                                                                                (TilingB n hn hn_ge).isFaultfree

                                                                                                The tilings B_n are faultfree (by reflection symmetry with A_n).

                                                                                                theorem DominoTilings.TilingA_hasTopVertical (n : ) (hn : Even n) (hn_ge : n 2) :

                                                                                                Tiling A_n has a vertical domino in the top two squares of column 1.

                                                                                                theorem DominoTilings.TilingB_hasBottomVertical (n : ) (hn : Even n) (hn_ge : n 2) :

                                                                                                Tiling B_n has a vertical domino in the bottom two squares of column 1.

                                                                                                Tiling C has no vertical domino in column 1.

                                                                                                Auxiliary Lemmas for the Proof #

                                                                                                These lemmas capture the key steps in the inductive proof of the classification. They are placed before the main classification theorems since the proofs depend on them.

                                                                                                A tiling with a vertical domino in the top of column c has n ≥ c. This follows because the domino must be within the rectangle.

                                                                                                A rectangle R_{n,3} can only be tiled by dominos if n is even or n = 0.

                                                                                                This follows from the parity argument: 3n squares must be covered by dominos (each covering 2 squares), so 3n must be even, hence n must be even.

                                                                                                theorem DominoTilings.base_case_basement (n : ) (T : DominoTiling n 3) (htop : T.hasTopVerticalInCol 1) (hn : n 2) :
                                                                                                dT.dominos, d.cells = {(1, 1), (2, 1)}

                                                                                                Helper lemma for the base case: If T has a top vertical domino in column 1, then the cell (1,1) must be covered by a horizontal domino going right. This gives us the basement domino {(1,1), (2,1)} for i=1.

                                                                                                theorem DominoTilings.claim1_basement_middle_top (n : ) (T : DominoTiling n 3) (hfree : T.isFaultfree) (htop : T.hasTopVerticalInCol 1) (i : ) (hi_pos : i 1) (hi_lt : i < n / 2) :
                                                                                                (∃ dT.dominos, d.cells = {(2 * i - 1, 1), (2 * i, 1)}) (∃ dT.dominos, d.cells = {(2 * i, 2), (2 * i + 1, 2)}) dT.dominos, d.cells = {(2 * i, 3), (2 * i + 1, 3)}

                                                                                                Claim 1 from the proof: For each positive integer i < n/2, a faultfree tiling T with a vertical domino in the top of column 1 must contain specific dominos.

                                                                                                Note: We use d.cells (the set of cells covered by the domino) instead of specifying cell orderings, since the Domino structure allows either cell to be cell1 or cell2. This makes the theorem provable for arbitrary tilings.

                                                                                                This is proved by induction on i.

                                                                                                theorem DominoTilings.claim2_n_even (n : ) (T : DominoTiling n 3) (_hfree : T.isFaultfree) (_htop : T.hasTopVerticalInCol 1) :

                                                                                                Claim 2 from the proof: The width n must be even.

                                                                                                Alternative proof: Since T tiles R_{n,3} with dominos, the total number of squares (which is 3n) must be even. Hence n must be even.

                                                                                                A faultfree tiling with a vertical domino in the top of column 1 has n ≥ 2. This follows because n is even (from claim2_n_even) and n ≥ 1.

                                                                                                Classification Results (prop.gf.weighted-set.domino.Rn3.ABC) #

                                                                                                (prop.gf.weighted-set.domino.Rn3.ABC (c)) The only faultfree domino tiling of a height-3 rectangle with no vertical domino in the first column is equivalent to C.

                                                                                                Proof sketch: If the first column has no vertical domino, it must be filled with three horizontal dominos extending into column 2. This forces n = 2, and the tiling must be equivalent to C.

                                                                                                Note: We use TilingEquiv instead of = because the Domino structure distinguishes between {cell1 := (1, y), cell2 := (2, y)} and {cell1 := (2, y), cell2 := (1, y)} as different dominos, even though they cover the same cells. The mathematical theorem is about tilings covering the same cells, not about specific domino representations.

                                                                                                Implementation note: The faultfree hypothesis _hfree is not used in this proof. In the source material, faultfree is used to argue there can't be a third column, but since this theorem is specifically for 2×3 rectangles (n = 2), this is automatic from the type signature.

                                                                                                theorem DominoTilings.faultfree_top_vertical_classification (n : ) (T : DominoTiling n 3) (hfree : T.isFaultfree) (htop : T.hasTopVerticalInCol 1) :
                                                                                                Even n ∃ (hn : Even n) (hn_ge : n 2), T.TilingEquiv (TilingA n hn hn_ge)

                                                                                                (prop.gf.weighted-set.domino.Rn3.ABC (a)) The faultfree domino tilings of a height-3 rectangle with a vertical domino in the top two squares of column 1 are precisely A_2, A_4, A_6, ...

                                                                                                Proof sketch: By induction, the structure of the tiling is forced:

                                                                                                • Claim 1 (claim1_basement_middle_top): The tiling must contain specific basement, middle, and top dominos
                                                                                                • Claim 2 (claim2_n_even): n must be even (by parity or by showing odd n leads to contradiction)
                                                                                                • The remaining squares can only be tiled one way, giving T ≃ A_n

                                                                                                Note: We use TilingEquiv instead of = because the Domino structure distinguishes between {cell1 := (1, 2), cell2 := (1, 3)} and {cell1 := (1, 3), cell2 := (1, 2)} as different dominos, even though they cover the same cells.

                                                                                                theorem DominoTilings.faultfree_bottom_vertical_classification (n : ) (T : DominoTiling n 3) (hfree : T.isFaultfree) (hbot : T.hasBottomVerticalInCol 1) :
                                                                                                Even n ∃ (hn : Even n) (hn_ge : n 2), T.TilingEquiv (TilingB n hn hn_ge)

                                                                                                (prop.gf.weighted-set.domino.Rn3.ABC (b)) The faultfree domino tilings of a height-3 rectangle with a vertical domino in the bottom two squares of column 1 are precisely B_2, B_4, B_6, ...

                                                                                                This follows from part (a) by reflection across the horizontal axis.

                                                                                                Note: We use TilingEquiv instead of = because the Domino structure distinguishes between different cell orderings.

                                                                                                For height 3, a vertical domino in column 1 must be either in the top two squares (rows 2-3) or the bottom two squares (rows 1-2). There's no other option since a vertical domino covers 2 adjacent rows and we only have 3 rows.

                                                                                                theorem DominoTilings.no_vertical_implies_n_eq_2 (n : ) (T : DominoTiling n 3) (hfree : T.isFaultfree) (hno_vert : ¬T.hasVerticalInCol 1) (hn : n 1) :
                                                                                                n = 2

                                                                                                If a faultfree tiling has no vertical domino in column 1, then n = 2.

                                                                                                Proof sketch: If the first column has no vertical domino, it must be filled with three horizontal dominos extending into column 2. This covers all of column 2, so if n > 2, there would be a fault between columns 2 and 3.

                                                                                                Note: requires n ≥ 1 (for n = 0, the empty tiling is a counterexample).

                                                                                                theorem DominoTilings.faultfree_classification (n : ) (T : DominoTiling n 3) (hfree : T.isFaultfree) (hn : n 1) :
                                                                                                (∃ (hn : Even n) (hn_ge : n 2), T.TilingEquiv (TilingA n hn hn_ge)) (∃ (hn : Even n) (hn_ge : n 2), T.TilingEquiv (TilingB n hn hn_ge)) n = 2 ¬T.hasVerticalInCol 1 ∃ (h : n = 2), (h T).TilingEquiv TilingC

                                                                                                The complete classification of faultfree domino tilings of height-3 rectangles.

                                                                                                Every faultfree tiling of R_{n,3} is one of:

                                                                                                • Equivalent to A_n for some even n ≥ 2 (vertical domino in top of column 1)
                                                                                                • Equivalent to B_n for some even n ≥ 2 (vertical domino in bottom of column 1)
                                                                                                • Equivalent to C (n = 2, no vertical domino in column 1)

                                                                                                Note: We use TilingEquiv instead of = because the Domino structure distinguishes between different cell orderings.

                                                                                                Note: requires n ≥ 1 (for n = 0, the empty tiling is a counterexample).

                                                                                                (prop.gf.weighted-set.domino.Rn3.ABC)