This is PolyominoIdeals.info, produced by Macaulay2, version 1.25.11

PolyominoIdeals -- a package to work with collections of cells, polyominoes and associated binomial ideals
***********************************************************************************************************

Description
===========

PolyominoIdeals is a package for making several computations with collections
of cells, polyominoes and binomial ideals attached to them.

Collections of cells, and in particular polyominoes, are plane figures formed
by joining unit squares edge to edge. The systematic study of polyominoes was
initiated by Solomon W. Golomb in 1953 and further developed in his seminal
monograph [G1994]. Beyond their combinatorial interest in problems such as
tiling the plane, polyominoes also connect to several other fields, including
theoretical computer science, statistical physics, and discrete geometry.

More recently, since 2012, polyominoes and, more generally, collections of
cells have been investigated from an algebraic–combinatorial perspective. In
[AAQ2012], Ayesha Asloob Qureshi established a link between combinatorial
commutative algebra and collections of cells by associating to each collection
the binomial ideal generated by its inner $2$-minors.

 Consider the natural partial order on $\NN^2$ and let $a,b \in \N^2$ with
$a\leq b$. The set $[a, b] = \{c \in \NN^2 : a \leq c \leq b\}$ is called an
interval of $\NN^2$; moreover, if $b=a+(1,1)$, then $[a,b]$ is called a cell of
$\NN^2$. An interval $C=[a, b]$, where $a = (i, j)$ and $b = (k, l)$, is said
to be a proper interval if $i < k$ and $j < l$. The elements $a, b$ are said
the diagonal corners of $C$ and  $c = (k, j)$ and $d = (i, l)$ the
anti-diagonal ones. If $C$ is a cell, then $V(C)=\{a,a+(1,1),a+(0,1),a+(1,0)\}$
is the set of the corners of $C$.
To a collection of cells $\mathcal{P}$ we associate the ideal $I_{\mathcal{P}}$
as follows. Let $K$ be a field and set $S = K[x_a : a\in V(\mathcal{P})]$,
where $V(\mathcal{P})$ is the union of the vertex sets of the cells in
$\mathcal{P}$. A proper interval $[a,b]$ is called an inner interval of
$\mathcal{P}$ if every cell contained in $[a,b]$ belongs to $\mathcal{P}$. If
$c$ and $d$ are the anti-diagonal corners of an inner interval $[a,b]$, then
the binomial $f = x_a x_b - x_c x_d$ is called an inner $2$-minor of
$\mathcal{P}$. If we restrict the generators to those corresponding only to the
cells, we obtain the so-called adjacent $2$-minor ideals, introduced in
[HH2012].
A collection $\mathcal{P}$ is a polyomino if for every two cells
$A,B\in\mathcal{P}$ there exists a sequence $A=C_1,\dots,C_m=B$ of cells in
$\mathcal{P}$ such that $C_i$ and $C_{i+1}$ share a common edge for all $i$. In
this case $I_{\mathcal{P}}$ is called the polyomino ideal of $\mathcal{P}$.

The aim of this package is to provide several tools to help mathematicians in
the study of collections of cells, polyominoes and the related binomial ideals.
Every contribution is very welcome.

Literature
  * [G1994] Polyominoes, Puzzles, Patterns, Problems, and Packagings(S.W.
    Golomb, 1994, Second edition, Princeton University Press).
  * [HH2012] Ideals generated by adjacent 2-minors(J. Herzog, T. Hibi, 2012, J.
    Commut. Algebra).
  * [AAQ2012] Ideals generated by 2-minors, collections of cells and stack
    polyominoes (A. A. Qureshi, 2012,  J. Algebra).

Authors
=======

  * Carmelo Cisto <ccisto@unime.it>
  * Francesco Navarra (see https://sites.google.com/sabanciuniv.edu/francesco-
    navarra/ ) <francesco.navarra@sabanciuniv.edu>
  * Rizwan Jahangir (see https://rizwan.phd )
    <(rizwan@sabanciuniv.edu,rizwan.jahangir@nbs.nust.edu.pk)>

Version
=======

This documentation describes version 2.0 of PolyominoIdeals, released November,
2025.

Citation
========

If you have used this package in your research, please cite it as follows:

+-----------------------------------------------------------------------------+
|@misc{PolyominoIdealsSource,                                                 |
|  title = {{PolyominoIdeals: Collections of cells and binomial ideals. Versio|
|  author = {Carmelo Cisto and Francesco Navarra and Rizwan Jahangir},        |
|  howpublished = {A \emph{Macaulay2} package available at                    |
|    \url{https://github.com/Macaulay2/M2/tree/stable/M2/Macaulay2/packages}} |
|}                                                                            |
|-----------------------------------------------------------------------------|
|n~2.0}},                                                                     |
+-----------------------------------------------------------------------------+

Exports
=======

  * Types
      * CollectionOfCells -- Type representing a
        collection of cells
  * Functions and commands
      * adjacent2MinorIdeal -- Ideal generated by
        adjacent 2-minors
      * allNonAttackingRookConfigurations
        -- All non-attacking rook
        configurations in Q
      * cellCollection -- Create a collection of cells
      * cellGraph -- Graph associated with a collection of
        cells
      * collectionIsConnected -- Check if a
        collection of cells is connected
      * collectionIsSimple -- Simplicity of a
        collection of cells
      * connectedComponentsCells -- Connected
        components of a collection of cells
      * equivalenceClassesSwitchingRook,
        -- Equivalence classes of rook configurations under switching
      * innerInterval -- Inner interval of a collection
        of cells
      * isColumnConvex -- Column convexity of a
        collection of cells
      * isConvex -- Convexity of a collection of cells
      * isNonAttackingRooks -- Check if a rook
        configuration is non-attacking
      * isPalindromic -- Check if a polynomial is
        palindromic
      * isRowConvex -- Row convexity of a collection of
        cells
      * polyoIdeal -- Ideal of inner 2-minors of a
        collection of cells
      * polyoLattice -- Lattice associated with a
        collection of cells
      * polyoMatrix -- Matrix attached to a collection of
        cells
      * polyoMatrixReduced -- Reduced form of the
        polyomino matrix
      * polyoToric -- Toric ideal of a polyomino
      * polyoVertices -- Vertices of a collection of
        cells
      * randomCollectionOfCells -- Random
        collection of cells up to a given size
      * randomCollectionWithFixedRank, --
        Random collection of cells with fixed rank
      * randomPolyomino -- Random polyomino with random
        size up to a given bound
      * randomPolyominoWithFixedRank, --
        Random polyomino with fixed rank
      * rankCollection -- Rank of a collection of cells
      * rookNumber -- Rook number of a collection of cells
      * rookPolynomial -- Rook polynomial of a
        collection of cells
      * standardNonAttackingRookConfigurations
        -- Standard non-attacking rook
        configurations
      * standardRookNumber -- Standard rook number
        of a collection of cells
      * standardRookPolynomial -- Standard rook
        polynomial of a collection of cells
      * switchingRookPolynomial -- Switching
        rook polynomial of a collection of cells
  * Methods
      * "adjacent2MinorIdeal(CollectionOfCells)" -- see
        adjacent2MinorIdeal, -- Ideal generated by
        adjacent 2-minors
      * "allNonAttackingRookConfigurations(CollectionOfCells)" -- see
        allNonAttackingRookConfigurations,
        -- All non-attacking rook configurations in Q
      * "cellCollection(List)" -- see cellCollection, --
        Create a collection of cells
      * "cellGraph(CollectionOfCells)" -- see cellGraph, --
        Graph associated with a collection of cells
      * "collectionIsConnected(CollectionOfCells)" -- see
        collectionIsConnected, -- Check if a collection
        of cells is connected
      * "collectionIsSimple(CollectionOfCells)" -- see
        collectionIsSimple, -- Simplicity of a collection
        of cells
      * "connectedComponentsCells(CollectionOfCells)" -- see
        connectedComponentsCells, -- Connected
        components of a collection of cells
      * "equivalenceClassesSwitchingRook(CollectionOfCells)" -- see
        equivalenceClassesSwitchingRook, --
        Equivalence classes of rook configurations under switching
      * "innerInterval(List,List,CollectionOfCells)" -- see
        innerInterval, -- Inner interval of a collection of
        cells
      * "isColumnConvex(CollectionOfCells)" -- see isColumnConvex,
        -- Column convexity of a collection of cells
      * "isConvex(CollectionOfCells)" -- see isConvex, --
        Convexity of a collection of cells
      * "isNonAttackingRooks(List,List,CollectionOfCells)" -- see
        isNonAttackingRooks, -- Check if a rook
        configuration is non-attacking
      * "isPalindromic(RingElement)" -- see isPalindromic,
        -- Check if a polynomial is palindromic
      * "isRowConvex(CollectionOfCells)" -- see isRowConvex,
        -- Row convexity of a collection of cells
      * "polyoIdeal(CollectionOfCells)" -- see polyoIdeal, --
        Ideal of inner 2-minors of a collection of cells
      * "polyoLattice(CollectionOfCells)" -- see polyoLattice,
        -- Lattice associated with a collection of cells
      * "polyoMatrix(CollectionOfCells)" -- see polyoMatrix,
        -- Matrix attached to a collection of cells
      * "polyoMatrixReduced(CollectionOfCells)" -- see
        polyoMatrixReduced, -- Reduced form of the
        polyomino matrix
      * "polyoToric(CollectionOfCells,List)" -- see polyoToric,
        -- Toric ideal of a polyomino
      * "polyoVertices(CollectionOfCells)" -- see polyoVertices,
        -- Vertices of a collection of cells
      * "randomCollectionOfCells(ZZ)" -- see randomCollectionOfCells,
        -- Random collection of cells up to a given
        size
      * "randomCollectionWithFixedRank(ZZ)" -- see
        randomCollectionWithFixedRank, -- Random
        collection of cells with fixed rank
      * "randomPolyomino(ZZ)" -- see randomPolyomino, --
        Random polyomino with random size up to a given bound
      * "randomPolyominoWithFixedRank(ZZ)" -- see
        randomPolyominoWithFixedRank, -- Random
        polyomino with fixed rank
      * "rankCollection(CollectionOfCells)" -- see rankCollection,
        -- Rank of a collection of cells
      * "rookNumber(CollectionOfCells)" -- see rookNumber, --
        Rook number of a collection of cells
      * "rookPolynomial(CollectionOfCells)" -- see rookPolynomial,
        -- Rook polynomial of a collection of cells
      * "standardNonAttackingRookConfigurations(CollectionOfCells)" -- see
        standardNonAttackingRookConfigurations,
        -- Standard non-attacking rook
        configurations
      * "standardRookNumber(CollectionOfCells)" -- see
        standardRookNumber, -- Standard rook number of a
        collection of cells
      * "standardRookPolynomial(CollectionOfCells)" -- see
        standardRookPolynomial, -- Standard rook
        polynomial of a collection of cells
      * "switchingRookPolynomial(CollectionOfCells)" -- see
        switchingRookPolynomial, -- Switching rook
        polynomial of a collection of cells
  * Symbols
      * Field -- optional argument for polyoIdeal and
        adjacent2MinorIdeal
      * RingChoice -- optional argument for polyoIdeal
      * TermOrder -- optional argument for polyoIdeal and
        adjacent2MinorIdeal

For the programmer
==================

The object PolyominoIdeals, is a package (Macaulay2Doc),
defined in PolyominoIdeals.m2.

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1002:0.

CollectionOfCells -- Type representing a collection of cells
************************************************************

Description
===========

Represents the type of a collection of cells, which is used as an input and
output type for several functions in this package.

Methods that use a collection of cells:
=======================================

  * "adjacent2MinorIdeal(CollectionOfCells)" -- see adjacent2MinorIdeal,
    -- Ideal generated by adjacent 2-minors
  * "allNonAttackingRookConfigurations(CollectionOfCells)" -- see
    allNonAttackingRookConfigurations, --
    All non-attacking rook configurations in Q
  * "cellGraph(CollectionOfCells)" -- see cellGraph, -- Graph
    associated with a collection of cells
  * "collectionIsConnected(CollectionOfCells)" -- see
    collectionIsConnected, -- Check if a collection of
    cells is connected
  * "collectionIsSimple(CollectionOfCells)" -- see collectionIsSimple,
    -- Simplicity of a collection of cells
  * "connectedComponentsCells(CollectionOfCells)" -- see
    connectedComponentsCells, -- Connected components
    of a collection of cells
  * "equivalenceClassesSwitchingRook(CollectionOfCells)" -- see
    equivalenceClassesSwitchingRook, --
    Equivalence classes of rook configurations under switching
  * "innerInterval(List,List,CollectionOfCells)" -- see innerInterval,
    -- Inner interval of a collection of cells
  * "isColumnConvex(CollectionOfCells)" -- see isColumnConvex,
    -- Column convexity of a collection of cells
  * "isConvex(CollectionOfCells)" -- see isConvex, -- Convexity
    of a collection of cells
  * "isNonAttackingRooks(List,List,CollectionOfCells)" -- see
    isNonAttackingRooks, -- Check if a rook configuration
    is non-attacking
  * "isRowConvex(CollectionOfCells)" -- see isRowConvex, --
    Row convexity of a collection of cells
  * "polyoIdeal(CollectionOfCells)" -- see polyoIdeal, --
    Ideal of inner 2-minors of a collection of cells
  * "polyoLattice(CollectionOfCells)" -- see polyoLattice,
    -- Lattice associated with a collection of cells
  * "polyoMatrix(CollectionOfCells)" -- see polyoMatrix, --
    Matrix attached to a collection of cells
  * "polyoMatrixReduced(CollectionOfCells)" -- see polyoMatrixReduced,
    -- Reduced form of the polyomino matrix
  * "polyoToric(CollectionOfCells,List)" -- see polyoToric,
    -- Toric ideal of a polyomino
  * "polyoVertices(CollectionOfCells)" -- see polyoVertices,
    -- Vertices of a collection of cells
  * "rankCollection(CollectionOfCells)" -- see rankCollection,
    -- Rank of a collection of cells
  * "rookNumber(CollectionOfCells)" -- see rookNumber, --
    Rook number of a collection of cells
  * "rookPolynomial(CollectionOfCells)" -- see rookPolynomial,
    -- Rook polynomial of a collection of cells
  * "standardNonAttackingRookConfigurations(CollectionOfCells)" -- see
    standardNonAttackingRookConfigurations,
    -- Standard non-attacking rook
    configurations
  * "standardRookNumber(CollectionOfCells)" -- see standardRookNumber,
    -- Standard rook number of a collection of cells
  * "standardRookPolynomial(CollectionOfCells)" -- see
    standardRookPolynomial, -- Standard rook polynomial
    of a collection of cells
  * "switchingRookPolynomial(CollectionOfCells)" -- see
    switchingRookPolynomial, -- Switching rook
    polynomial of a collection of cells

For the programmer
==================

The object CollectionOfCells, is a type (Macaulay2Doc),
with ancestor classes List (Macaulay2Doc), <
VisibleList (Macaulay2Doc) < BasicList (Macaulay2Doc)
< Thing (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1014:0.

cellCollection -- Create a collection of cells
**********************************************

  * Usage:
        cellCollection L
  * Inputs:
      * L, a list of lists of two integers, each representing the lower-left
        corner of a cell
  * Outputs:
      * the collection of cells represented by L

Description
===========

In the plane, a cell can be represented by the coordinates of its lower-left
corner. This function constructs a collection of cells from a given list of
such coordinates.

+------------------------------+
|i1 : L = {{1,1}, {2,1}, {2,2}}|
|                              |
|o1 = {{1, 1}, {2, 1}, {2, 2}} |
|                              |
|o1 : List                     |
+------------------------------+
|i2 : Q = cellCollection L     |
|                              |
|o2 = {{1, 1}, {2, 1}, {2, 2}} |
|                              |
|o2 : CollectionOfCells        |
+------------------------------+

Ways to use cellCollection:
===========================

  * "cellCollection(List)"

For the programmer
==================

The object cellCollection, is a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1036:0.

polyoVertices -- Vertices of a collection of cells
**************************************************

  * Usage:
        polyoVertices Q
  * Inputs:
      * Q, a collection of cells
  * Outputs:
      * the list of all vertices of the collection of cells encoded by Q

Description
===========

Let $\mathcal{P}$ be a collection of cells. The set of vertices of
$\mathcal{P}$ is the union of the vertices of all its cells. This function
returns the list of all vertices of $\mathcal{P}$.

+-----------------------------------------------------------------------------+
|i1 : Q = cellCollection {{1,1}, {2,1}, {2,2}, {3,3}}                         |
|                                                                             |
|o1 = {{1, 1}, {2, 1}, {2, 2}, {3, 3}}                                        |
|                                                                             |
|o1 : CollectionOfCells                                                       |
+-----------------------------------------------------------------------------+
|i2 : V = polyoVertices Q                                                     |
|                                                                             |
|o2 = {(4, 4), (1, 1), (1, 2), (3, 1), (3, 2), (3, 3), (3, 4), (2, 1), (2, 2),|
|     ------------------------------------------------------------------------|
|     (2, 3), (4, 3)}                                                         |
|                                                                             |
|o2 : List                                                                    |
+-----------------------------------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells

Ways to use polyoVertices:
==========================

  * "polyoVertices(CollectionOfCells)"

For the programmer
==================

The object polyoVertices, is a method function (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1059:0.

polyoMatrix -- Matrix attached to a collection of cells
*******************************************************

  * Usage:
        polyoMatrix Q
  * Inputs:
      * Q, a collection of cells
  * Outputs:
      * the matrix attached to the collection of cells encoded by Q.

Description
===========

Let $\mathcal{P}$ be a collection of cells and $[(a,b),(c,d)]$ be the smallest
interval of $\ZZ^2$ containing $\mathcal{P}$. The matrix $M(\mathcal{P})$ is a
matrix having $d-b+1$ rows and $c-a+1$ columns with
$M(\mathcal{P})_{i,j}=x_{(i,j)}$ if $(i,j)$ is a vertex of $\mathcal{P}$,
otherwise it is zero.
This routine returns the matrix of the collection of cells encoded by Q. In the
following example we assume for simplicity that the smallest interval
containing $\mathcal{P}$ is $[(1,1),(c,d)]$, with $c,d>1$.

+-----------------------------------------------------------------------------+
|i1 : Q = cellCollection {{1,1}, {2,1}, {2,2}}                                |
|                                                                             |
|o1 = {{1, 1}, {2, 1}, {2, 2}}                                                |
|                                                                             |
|o1 : CollectionOfCells                                                       |
+-----------------------------------------------------------------------------+
|i2 : M = polyoMatrix Q                                                       |
|                                                                             |
|o2 = | 0       x_(2,3) x_(3,3) |                                             |
|     | x_(1,2) x_(2,2) x_(3,2) |                                             |
|     | x_(1,1) x_(2,1) x_(3,1) |                                             |
|                                                                             |
|                                                                3            |
|o2 : Matrix (QQ[x   , x   , x   , x   , x   , x   , x   , x   ])  <--        |
|                 3,3   3,2   3,1   2,3   2,2   2,1   1,2   1,1               |
|-----------------------------------------------------------------------------|
|                                                    3                        |
|(QQ[x   , x   , x   , x   , x   , x   , x   , x   ])                         |
|     3,3   3,2   3,1   2,3   2,2   2,1   1,2   1,1                           |
+-----------------------------------------------------------------------------+

+-----------------------------------------------------------------------------+
|i3 : Q = cellCollection {{1, 3}, {2, 2}, {3, 1}, {2, 4}, {3, 5}, {4, 4}, {5, |
|-----------------------------------------------------------------------------|
|3}, {4, 2}, {6, 4}, {5, 1}, {7, 5}, {7, 1}, {4, 6}, {5, 7}, {6, 6}};         |
+-----------------------------------------------------------------------------+
|i4 : M = polyoMatrix Q                                                       |
|                                                                             |
|o4 = | 0       0       0       0       x_(5,8) x_(6,8) 0       0       |     |
|     | 0       0       0       x_(4,7) x_(5,7) x_(6,7) x_(7,7) 0       |     |
|     | 0       0       x_(3,6) x_(4,6) x_(5,6) x_(6,6) x_(7,6) x_(8,6) |     |
|     | 0       x_(2,5) x_(3,5) x_(4,5) x_(5,5) x_(6,5) x_(7,5) x_(8,5) |     |
|     | x_(1,4) x_(2,4) x_(3,4) x_(4,4) x_(5,4) x_(6,4) x_(7,4) 0       |     |
|     | x_(1,3) x_(2,3) x_(3,3) x_(4,3) x_(5,3) x_(6,3) 0       0       |     |
|     | 0       x_(2,2) x_(3,2) x_(4,2) x_(5,2) x_(6,2) x_(7,2) x_(8,2) |     |
|     | 0       0       x_(3,1) x_(4,1) x_(5,1) x_(6,1) x_(7,1) x_(8,1) |     |
|                                                                             |
|                                                                             |
|o4 : Matrix (QQ[x   , x   , x   , x   , x   , x   , x   , x   , x   , x   ,  |
|                 8,6   8,5   8,2   8,1   7,7   7,6   7,5   7,4   7,2   7,1   |
|-----------------------------------------------------------------------------|
|                                                                             |
|x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   ,|
| 6,8   6,7   6,6   6,5   6,4   6,3   6,2   6,1   5,8   5,7   5,6   5,5   5,4 |
|-----------------------------------------------------------------------------|
|                                                                             |
|x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   ,|
| 5,3   5,2   5,1   4,7   4,6   4,5   4,4   4,3   4,2   4,1   3,6   3,5   3,4 |
|-----------------------------------------------------------------------------|
|                                                      8                      |
|x   , x   , x   , x   , x   , x   , x   , x   , x   ])  <-- (QQ[x   , x   ,  |
| 3,3   3,2   3,1   2,5   2,4   2,3   2,2   1,4   1,3             8,6   8,5   |
|-----------------------------------------------------------------------------|
|                                                                             |
|x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   ,|
| 8,2   8,1   7,7   7,6   7,5   7,4   7,2   7,1   6,8   6,7   6,6   6,5   6,4 |
|-----------------------------------------------------------------------------|
|                                                                             |
|x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   ,|
| 6,3   6,2   6,1   5,8   5,7   5,6   5,5   5,4   5,3   5,2   5,1   4,7   4,6 |
|-----------------------------------------------------------------------------|
|                                                                             |
|x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   ,|
| 4,5   4,4   4,3   4,2   4,1   3,6   3,5   3,4   3,3   3,2   3,1   2,5   2,4 |
|-----------------------------------------------------------------------------|
|                        8                                                    |
|x   , x   , x   , x   ])                                                     |
| 2,3   2,2   1,4   1,3                                                       |
+-----------------------------------------------------------------------------+

+-----------------------------------------------------------------------------+
|i5 : Q = cellCollection {{1, 1}, {2, 2}, {3, 3}, {4, 3}};                    |
+-----------------------------------------------------------------------------+
|i6 : M = polyoMatrix Q                                                       |
|                                                                             |
|o6 = | 0       0       x_(3,4) x_(4,4) x_(5,4) |                             |
|     | 0       x_(2,3) x_(3,3) x_(4,3) x_(5,3) |                             |
|     | x_(1,2) x_(2,2) x_(3,2) 0       0       |                             |
|     | x_(1,1) x_(2,1) 0       0       0       |                             |
|                                                                             |
|                                                                             |
|o6 : Matrix (QQ[x   , x   , x   , x   , x   , x   , x   , x   , x   , x   ,  |
|                 5,4   5,3   4,4   4,3   3,4   3,3   3,2   2,3   2,2   2,1   |
|-----------------------------------------------------------------------------|
|            4                                                                |
|x   , x   ])  <-- (QQ[x   , x   , x   , x   , x   , x   , x   , x   , x   ,  |
| 1,2   1,1             5,4   5,3   4,4   4,3   3,4   3,3   3,2   2,3   2,2   |
|-----------------------------------------------------------------------------|
|                  5                                                          |
|x   , x   , x   ])                                                           |
| 2,1   1,2   1,1                                                             |
+-----------------------------------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells

Ways to use polyoMatrix:
========================

  * "polyoMatrix(CollectionOfCells)"

For the programmer
==================

The object polyoMatrix, is a method function (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1138:0.

polyoMatrixReduced -- Reduced form of the polyomino matrix
**********************************************************

  * Usage:
        polyoMatrixReduced Q
  * Inputs:
      * Q, a collection of cells
  * Outputs:
      * the reduced form of the polyomino matrix obtained by switching rows and
        columns as described in [HH1999]

Description
===========

It returns the reduced form of the polyomino matrix by appropriately switching
rows and columns, as explained in the reference below:
  * [HH1999] Koszul bipartite graphs, H. Ohsugi and T. Hibi, Adv. Appl. Math.
    22 (1999), 25–28.

+-----------------------------------------------------------------------------+
|i1 : Q = cellCollection {{1,1},{2,2}};                                       |
+-----------------------------------------------------------------------------+
|i2 : M = polyoMatrix Q                                                       |
|                                                                             |
|o2 = | 0       x_(2,3) x_(3,3) |                                             |
|     | x_(1,2) x_(2,2) x_(3,2) |                                             |
|     | x_(1,1) x_(2,1) 0       |                                             |
|                                                                             |
|                                                          3                  |
|o2 : Matrix (QQ[x   , x   , x   , x   , x   , x   , x   ])  <-- (QQ[x   ,    |
|                 3,3   3,2   2,3   2,2   2,1   1,2   1,1             3,3     |
|-----------------------------------------------------------------------------|
|                                    3                                        |
|x   , x   , x   , x   , x   , x   ])                                         |
| 3,2   2,3   2,2   2,1   1,2   1,1                                           |
+-----------------------------------------------------------------------------+
|i3 : N = polyoMatrixReduced Q                                                |
|                                                                             |
|o3 = | x_(1,1) 0       x_(2,1) |                                             |
|     | 0       x_(3,3) x_(2,3) |                                             |
|     | x_(1,2) x_(3,2) x_(2,2) |                                             |
|                                                                             |
|                                                          3                  |
|o3 : Matrix (QQ[x   , x   , x   , x   , x   , x   , x   ])  <-- (QQ[x   ,    |
|                 3,3   3,2   2,3   2,2   2,1   1,2   1,1             3,3     |
|-----------------------------------------------------------------------------|
|                                    3                                        |
|x   , x   , x   , x   , x   , x   ])                                         |
| 3,2   2,3   2,2   2,1   1,2   1,1                                           |
+-----------------------------------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells
  * polyoMatrix -- Matrix attached to a collection of cells

Ways to use polyoMatrixReduced:
===============================

  * "polyoMatrixReduced(CollectionOfCells)"

For the programmer
==================

The object polyoMatrixReduced, is a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1169:0.

innerInterval -- Inner interval of a collection of cells
********************************************************

  * Usage:
        innerInterval(a, b, Q)
  * Inputs:
      * a, a list of two integers representing a point in $\mathbb{Z}^2$
      * b, a list of two integers representing a point in $\mathbb{Z}^2$
      * Q, a collection of cells
  * Outputs:
      * true if $[a,b]$ is an inner interval of Q, and false otherwise

Description
===========

Let $\mathcal{P}$ be a collection of cells. An interval $[a,b] \subseteq
\mathbb{Z}^2$ is called an inner interval of $\mathcal{P}$ if every cell
contained in $[a,b]$ also belongs to $\mathcal{P}$. This function returns true
if $[a,b]$ is an inner interval of $\mathcal{P}$, and false otherwise.

+-----------------------------------------------------+
|i1 : Q = cellCollection {{1,1}, {1,2}, {2,1}, {2,3}};|
+-----------------------------------------------------+
|i2 : innerInterval({1,1}, {3,3}, Q)                  |
|                                                     |
|o2 = false                                           |
+-----------------------------------------------------+
|i3 : innerInterval({1,1}, {3,2}, Q)                  |
|                                                     |
|o3 = true                                            |
+-----------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells

Ways to use innerInterval:
==========================

  * "innerInterval(List,List,CollectionOfCells)"

For the programmer
==================

The object innerInterval, is a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1087:0.

polyoIdeal -- Ideal of inner 2-minors of a collection of cells
**************************************************************

  * Usage:
        polyoIdeal Q
  * Inputs:
      * Q, a collection of cells
  * Optional inputs (Macaulay2Doc),:
      * Field, => ..., default value QQ, optional argument for
        polyoIdeal and adjacent2MinorIdeal
      * RingChoice, => ..., default value 1, optional
        argument for polyoIdeal
      * TermOrder, => ..., default value Lex, optional
        argument for polyoIdeal and adjacent2MinorIdeal
  * Outputs:
      * the inner 2-minors ideal of the collection of cells encoded by Q

Description
===========

Let $\mathcal{P}$ be a collection of cells. This routine returns the ideal
$I_{\mathcal{P}}$ of the inner 2-minors of $\mathcal{P}$.
Moreover, if $\mathcal{P}$ is a polyomino, then it returns the polyomino ideal
of $\mathcal{P}$.

+-----------------------------------------------------------------------------+
|i1 : Q = cellCollection {{1,1}, {2,1}, {2,2}}                                |
|                                                                             |
|o1 = {{1, 1}, {2, 1}, {2, 2}}                                                |
|                                                                             |
|o1 : CollectionOfCells                                                       |
+-----------------------------------------------------------------------------+
|i2 : I = polyoIdeal Q                                                        |
|                                                                             |
|o2 = ideal (x   x    - x   x   , x   x    - x   x   , x   x    - x   x   ,   |
|             3,3 2,1    3,1 2,3   3,2 2,1    3,1 2,2   2,2 1,1    2,1 1,2    |
|     ------------------------------------------------------------------------|
|     x   x    - x   x   , x   x    - x   x   )                               |
|      3,3 2,2    3,2 2,3   3,2 1,1    3,1 1,2                                |
|                                                                             |
|o2 : Ideal of QQ[x   , x   , x   , x   , x   , x   , x   , x   ]             |
|                  3,3   3,2   3,1   2,3   2,2   2,1   1,2   1,1              |
+-----------------------------------------------------------------------------+

+-----------------------------------------------------------------------------+
|i3 : Q= cellCollection {{1, 1}, {2, 1}, {3, 1}, {3, 2}, {3, 3}, {2, 3}, {1,  |
|-----------------------------------------------------------------------------|
|3}, {1, 2}};                                                                 |
+-----------------------------------------------------------------------------+
|i4 : I = polyoIdeal Q                                                        |
|                                                                             |
|o4 = ideal (x   x    - x   x   , x   x    - x   x   , x   x    - x   x   ,   |
|             2,3 1,2    2,2 1,3   2,4 1,1    2,1 1,4   4,4 3,1    4,1 3,4    |
|     ------------------------------------------------------------------------|
|     x   x    - x   x   , x   x    - x   x   , x   x    - x   x   , x   x    |
|      4,3 3,2    4,2 3,3   3,4 1,3    3,3 1,4   3,2 2,1    3,1 2,2   4,2 1,1 |
|     ------------------------------------------------------------------------|
|     - x   x   , x   x    - x   x   , x   x    - x   x   , x   x    -        |
|        4,1 1,2   2,4 1,2    2,2 1,4   4,4 3,2    4,2 3,4   2,4 1,3          |
|     ------------------------------------------------------------------------|
|     x   x   , x   x    - x   x   , x   x    - x   x   , x   x    - x   x   ,|
|      2,3 1,4   4,4 3,3    4,3 3,4   3,2 1,1    3,1 1,2   4,4 2,3    4,3 2,4 |
|     ------------------------------------------------------------------------|
|     x   x    - x   x   , x   x    - x   x   , x   x    - x   x   , x   x    |
|      2,2 1,1    2,1 1,2   4,2 3,1    4,1 3,2   2,3 1,1    2,1 1,3   4,3 3,1 |
|     ------------------------------------------------------------------------|
|     - x   x   , x   x    - x   x   , x   x    - x   x   , x   x    -        |
|        4,1 3,3   4,4 1,3    4,3 1,4   3,4 2,3    3,3 2,4   4,2 2,1          |
|     ------------------------------------------------------------------------|
|     x   x   )                                                               |
|      4,1 2,2                                                                |
|                                                                             |
|o4 : Ideal of QQ[x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , |
|                  4,4   4,3   4,2   4,1   3,4   3,3   3,2   3,1   2,4   2,3  |
|-----------------------------------------------------------------------------|
|x   , x   , x   , x   , x   , x   ]                                          |
| 2,2   2,1   1,4   1,3   1,2   1,1                                           |
+-----------------------------------------------------------------------------+

Ways to use polyoIdeal:
=======================

  * "polyoIdeal(CollectionOfCells)"

For the programmer
==================

The object polyoIdeal, is a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1111:0.

polyoToric -- Toric ideal of a polyomino
****************************************

  * Usage:
        polyoToric(Q,H)
  * Inputs:
      * Q, a collection of cells
      * H, a list of the lower left corners of the holes
  * Outputs:
      * a toric ideal attached to Q.

Description
===========

Let $\mathcal{P}$ be a polyomino. A finite collection $\mathcal{H}$ of cells
not in $\mathcal{P}$ is called a hole of $\mathcal{P}$, if any two cells in
$\mathcal{H}$ are connected by a path of cells in $\mathcal{H}$ and
$\mathcal{H}$ is maximal with respect to the set inclusion. Consider the
following total order on $V(\mathcal{P})$: $a=(i,j)>b=(k, l)$, if $i > k$, or
$i = k$ and $j > l$. If $\mathcal{H}$ is a hole of $\mathcal{P}$, then we call
lower left corner $e$ of $\mathcal{H}$ the minimum, with respect to <, of the
vertices of $\mathcal{H}$. Let $\mathcal{H}_1,\dots, \mathcal{H}_r$ be the
holes of $\mathcal{P}$ and $e_k = (i_k, j_k)$ be the lower left corner of
$\mathcal{H}_k$. For $k \in K =[r]$, we define the following subset $F_k =
\{(i, j) \in V (\mathcal{P}) : i \leq i_k, j \leq j_k\}$. Denote by
$\{V_i\}_{i\in I}$ the set of all the maximal vertical edge intervals of
$\mathcal{P}$, and by $\{H_j \}_{j\in J}$ the set of all the maximal horizontal
edge intervals of $\mathcal{P}$. Let $\{v_i\}_{i\in I}$, $\{H_j\}_{j\in J}$ ,
and $\{w_k\}_{k\in K}$ be three sets of variables. We consider the map $$\alpha
: V (\mathcal{P}) \rightarrow K[{h_i, v_j , w_k } : i \in I, j \in J, k \in
K]$$ $$a \rightarrow \prod_{a\in H_i \cap V_j} h_iv_j \prod_{a\in F_k} w_k$$
The toric ring $T_{\mathcal{P}}$ associated to $\mathcal{P}$ is defined as
$T_{\mathcal{P}} = K[\alpha(a):a \in V (\mathcal{P})]$. The homomorphism $\psi
: S \rightarrow T_{\mathcal{P}}$ with $x_a \rightarrow \alpha(a)$ is surjective
and the toric ideal $J_{\mathcal{P}}$ is the kernel of $\psi$.
Note that the homomorphism $\psi$ defined before is a natural generalization of
the one given in [QSS2017] for simple polyominoes.

Given the polyomino encoded by Q and the list H of the lower left corners of
each hole of the polyomino, the function polyoToric returns the toric ideal
$J_{\mathcal{P}}$ defined before.

Literature
  * [QSS2017] Simple polyominoes are prime (A.A. Qureshi, T. Shibuta, A.
    Shikama, 2017, J. Commut. Algebra 9(3), 413-422).
  * [MRR2020] Primality of multiply connected polyominoes (C. Mascia, G.
    Rinaldo, F. Romeo, 2020, Illinois J. Math. 64(3), 291-304).
  * [CNU2022] Primality of weakly connected collections of cells and weakly
    closed path polyominoes (C. Cisto, F. Navarra, R. Utano, 2022, Illinois J.
    Math. 66(4), 545-563).

Examples

+-----------------------------------------------------------------------------+
|i1 : Q= cellCollection {{1, 1}, {2, 1}, {3, 1}, {3, 2}, {3, 3}, {2, 3}, {1,  |
|-----------------------------------------------------------------------------|
|3}, {1, 2}};                                                                 |
+-----------------------------------------------------------------------------+
|i2 : J=polyoToric(Q,{{2,2}})                                                 |
|                                                                             |
|o2 = ideal (- x   x    + x   x   , - x   x    + x   x   , - x   x    +       |
|               2,2 1,1    2,1 1,2     3,2 1,1    3,1 1,2     4,2 1,1         |
|     ------------------------------------------------------------------------|
|     x   x   , - x   x    + x   x   , - x   x    + x   x   , - x   x    +    |
|      4,1 1,2     2,3 1,1    2,1 1,3     2,3 1,2    2,2 1,3     2,4 1,1      |
|     ------------------------------------------------------------------------|
|     x   x   , - x   x    + x   x   , - x   x    + x   x   , - x   x    +    |
|      2,1 1,4     2,4 1,2    2,2 1,4     2,4 1,3    2,3 1,4     3,4 1,3      |
|     ------------------------------------------------------------------------|
|     x   x   , - x   x    + x   x   , - x   x    + x   x   , - x   x    +    |
|      3,3 1,4     4,4 1,3    4,3 1,4     3,2 2,1    3,1 2,2     4,2 2,1      |
|     ------------------------------------------------------------------------|
|     x   x   , - x   x    + x   x   , - x   x    + x   x   , - x   x    +    |
|      4,1 2,2     3,4 2,3    3,3 2,4     4,4 2,3    4,3 2,4     4,2 3,1      |
|     ------------------------------------------------------------------------|
|     x   x   , - x   x    + x   x   , - x   x    + x   x   , - x   x    +    |
|      4,1 3,2     4,3 3,1    4,1 3,3     4,3 3,2    4,2 3,3     4,4 3,1      |
|     ------------------------------------------------------------------------|
|     x   x   , - x   x    + x   x   , - x   x    + x   x   )                 |
|      4,1 3,4     4,4 3,2    4,2 3,4     4,4 3,3    4,3 3,4                  |
|                                                                             |
|o2 : Ideal of QQ[x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , |
|                  4,4   4,3   4,2   4,1   3,4   3,3   3,2   3,1   2,4   2,3  |
|-----------------------------------------------------------------------------|
|x   , x   , x   , x   , x   , x   ]                                          |
| 2,2   2,1   1,4   1,3   1,2   1,1                                           |
+-----------------------------------------------------------------------------+

+-----------------------------------------------------------------------------+
|i3 : Q= cellCollection {{3, 1}, {4, 1}, {5, 1}, {5, 2}, {5, 3}, {5, 4}, {5,  |
|-----------------------------------------------------------------------------|
|5}, {4, 5}, {3, 2}, {3, 3}, {2, 3}, {1, 3}, {1, 4}, {1, 5}, {2, 5}, {3, 5}}; |
+-----------------------------------------------------------------------------+
|i4 : I=polyoIdeal(Q);                                                        |
|                                                                             |
|o4 : Ideal of QQ[x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , |
|                  6,6   6,5   6,4   6,3   6,2   6,1   5,6   5,5   5,4   5,3  |
|-----------------------------------------------------------------------------|
|x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   ,|
| 5,2   5,1   4,6   4,5   4,4   4,3   4,2   4,1   3,6   3,5   3,4   3,3   3,2 |
|-----------------------------------------------------------------------------|
|x   , x   , x   , x   , x   , x   , x   , x   , x   ]                        |
| 3,1   2,6   2,5   2,4   2,3   1,6   1,5   1,4   1,3                         |
+-----------------------------------------------------------------------------+
|i5 : J=polyoToric(Q,{{2,4}});                                                |
|                                                                             |
|o5 : Ideal of QQ[x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , |
|                  6,6   6,5   6,4   6,3   6,2   6,1   5,6   5,5   5,4   5,3  |
|-----------------------------------------------------------------------------|
|x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   ,|
| 5,2   5,1   4,6   4,5   4,4   4,3   4,2   4,1   3,6   3,5   3,4   3,3   3,2 |
|-----------------------------------------------------------------------------|
|x   , x   , x   , x   , x   , x   , x   , x   , x   ]                        |
| 3,1   2,6   2,5   2,4   2,3   1,6   1,5   1,4   1,3                         |
+-----------------------------------------------------------------------------+
|i6 : R=ring I                                                                |
|                                                                             |
|o6 = R                                                                       |
|                                                                             |
|o6 : PolynomialRing                                                          |
+-----------------------------------------------------------------------------+
|i7 : J=substitute(J,R);                                                      |
|                                                                             |
|o7 : Ideal of R                                                              |
+-----------------------------------------------------------------------------+
|i8 : J==I                                                                    |
|                                                                             |
|o8 = true                                                                    |
+-----------------------------------------------------------------------------+

Morevover, if $\mathcal{P}$ is a simple polyomino, that is, it has not any
hole, then the function polyoToric works by setting H={} and it returns the
polyomino ideal of $\mathcal{P}$ in according to [QSS2017].

+-----------------------------------------------------------------------------+
|i9 : Q= cellCollection {{2, 1}, {3, 1}, {2, 2}, {1, 2}, {3, 2}, {2, 3}};     |
+-----------------------------------------------------------------------------+
|i10 : I=polyoIdeal(Q);                                                       |
|                                                                             |
|o10 : Ideal of QQ[x   , x   , x   , x   , x   , x   , x   , x   , x   , x   ,|
|                   4,3   4,2   4,1   3,4   3,3   3,2   3,1   2,4   2,3   2,2 |
|-----------------------------------------------------------------------------|
|x   , x   , x   ]                                                            |
| 2,1   1,3   1,2                                                             |
+-----------------------------------------------------------------------------+
|i11 : J=polyoToric(Q,{});                                                    |
|                                                                             |
|o11 : Ideal of QQ[x   , x   , x   , x   , x   , x   , x   , x   , x   , x   ,|
|                   4,3   4,2   4,1   3,4   3,3   3,2   3,1   2,4   2,3   2,2 |
|-----------------------------------------------------------------------------|
|x   , x   , x   ]                                                            |
| 2,1   1,3   1,2                                                             |
+-----------------------------------------------------------------------------+
|i12 : R=ring I                                                               |
|                                                                             |
|o12 = R                                                                      |
|                                                                             |
|o12 : PolynomialRing                                                         |
+-----------------------------------------------------------------------------+
|i13 : J=substitute(J,R);                                                     |
|                                                                             |
|o13 : Ideal of R                                                             |
+-----------------------------------------------------------------------------+
|i14 : J==I                                                                   |
|                                                                             |
|o14 = true                                                                   |
+-----------------------------------------------------------------------------+

In general, the function polyoToric works also for weakly connected collection
of cells. If $\mathcal{P}$ is the non-simple collections of cells in Figure (A)
of the Remark 3.4 in [CNU2022], we know that the inner 2-minor ideal of
$\mathcal{P}$ is not prime.

+-----------------------------------------------------------------------------+
|i15 : Q= cellCollection {{2, 1}, {3, 2}, {1, 2}, {2, 3}};                    |
+-----------------------------------------------------------------------------+
|i16 : I=polyoIdeal(Q);                                                       |
|                                                                             |
|o16 : Ideal of QQ[x   , x   , x   , x   , x   , x   , x   , x   , x   , x   ,|
|                   4,3   4,2   3,4   3,3   3,2   3,1   2,4   2,3   2,2   2,1 |
|-----------------------------------------------------------------------------|
|x   , x   ]                                                                  |
| 1,3   1,2                                                                   |
+-----------------------------------------------------------------------------+
|i17 : J=polyoToric(Q,{{2,2}});                                               |
|                                                                             |
|o17 : Ideal of QQ[x   , x   , x   , x   , x   , x   , x   , x   , x   , x   ,|
|                   4,3   4,2   3,4   3,3   3,2   3,1   2,4   2,3   2,2   2,1 |
|-----------------------------------------------------------------------------|
|x   , x   ]                                                                  |
| 1,3   1,2                                                                   |
+-----------------------------------------------------------------------------+
|i18 : R=ring I                                                               |
|                                                                             |
|o18 = R                                                                      |
|                                                                             |
|o18 : PolynomialRing                                                         |
+-----------------------------------------------------------------------------+
|i19 : J=substitute(J,R);                                                     |
|                                                                             |
|o19 : Ideal of R                                                             |
+-----------------------------------------------------------------------------+
|i20 : J==I                                                                   |
|                                                                             |
|o20 = false                                                                  |
+-----------------------------------------------------------------------------+
|i21 : select(first entries gens J,f->first degree f>=3)                      |
|                                                                             |
|o21 = {x   x   x    - x   x   x   , x   x   x    - x   x   x   , -           |
|        3,2 2,1 1,3    3,1 2,3 1,2   4,3 3,2 2,4    4,2 3,4 2,3              |
|      -----------------------------------------------------------------------|
|      x   x   x   x    + x   x   x   x   }                                   |
|       4,3 3,1 2,4 1,2    4,2 3,4 2,1 1,3                                    |
|                                                                             |
|o21 : List                                                                   |
+-----------------------------------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells

Ways to use polyoToric:
=======================

  * "polyoToric(CollectionOfCells,List)"

For the programmer
==================

The object polyoToric, is a method function (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1241:0.

polyoLattice -- Lattice associated with a collection of cells
*************************************************************

  * Usage:
        polyoLattice Q
  * Inputs:
      * Q, a collection of cells
  * Outputs:
      * the lattice ideal associated with Q

Description
===========

Given a collection of cells $\mathcal{P}$, this function returns the lattice
ideal associated with $\mathcal{P}$.

Let $\mathcal{P}$ be a collection of cells. For each $a \in V(\mathcal{P})$,
denote by $\mathbf{v}_a$ the vector in $\mathbb{Z}^{|V(\mathcal{C})|}$ having a
$1$ in the coordinate indexed by $a$ and a $0$ elsewhere.If $C = [a,b] \in
\mathcal{P}$ is a cell with diagonal corners $a,b$ and anti-diagonal corners
$c,d$, we set $$\mathbf{v}_{[a,b]} = \mathbf{v}_a + \mathbf{v}_b - \mathbf{v}_c
- \mathbf{v}_d \in \mathbb{Z}^{|V(\mathcal{C})|}.$$ We define
$\Lambda_{\mathcal{P}}$ as the sublattice of $\mathbb{Z}^{|V(\mathcal{P})|}$
generated by the vectors $\mathbf{v}_C$ for all $C \in \mathcal{P}$. Observe
that the rank of $\Lambda_{\mathcal{P}}$ equals $|\mathcal{P}|$.
Let $n = |V(\mathcal{P})|$. For $\mathbf{v} \in \mathbb{N}^n$, denote by
$x^{\mathbf{v}}$ the monomial in $S$ having $\mathbf{v}$ as its exponent
vector. For $\mathbf{e} \in \mathbb{Z}^n$, let $\mathbf{e}^+$ be the vector
obtained from $\mathbf{e}$ by replacing all negative components with zero, and
set $\mathbf{e}^- = - (\mathbf{e} - \mathbf{e}^+)$ for its non-positive part.
The lattice ideal $L_{\mathcal{P}}$ of $\Lambda_{\mathcal{P}}$ is then the
binomial ideal in $S$ defined as$$L_{\mathcal{P}} = (\,x^{\mathbf{e}^+} -
x^{\mathbf{e}^-} \mid \mathbf{e} \in \Lambda_{\mathcal{P}}\,).$$

+-----------------------------------------------------------------------------+
|i1 : Q = cellCollection {{1,1},{2,1},{3,1},{3,2},{1,2},{1,3},{2,3}};         |
+-----------------------------------------------------------------------------+
|i2 : L = polyoLattice Q                                                      |
|                                                                             |
|o2 = ideal (- x   x    + x   x   , - x   x    + x   x   , - x   x    +       |
|               1,1 4,2    1,2 4,1     2,1 4,2    2,2 4,1     3,1 4,2         |
|     ------------------------------------------------------------------------|
|     x   x   , - x   x    + x   x   , - x   x    + x   x   , - x   x    +    |
|      3,2 4,1     2,3 1,4    2,4 1,3     3,3 1,4    3,4 1,3     2,2 1,4      |
|     ------------------------------------------------------------------------|
|     x   x   , - x   x    + x   x   , - x   x    + x   x   , - x   x    +    |
|      2,4 1,2     2,2 1,3    2,3 1,2     2,1 1,4    2,4 1,1     2,1 1,3      |
|     ------------------------------------------------------------------------|
|     x   x   , - x   x    + x   x   , - x   x    + x   x   , - x   x    +    |
|      2,3 1,1     2,1 1,2    2,2 1,1     3,1 1,2    3,2 1,1     3,3 2,4      |
|     ------------------------------------------------------------------------|
|     x   x   , - x   x    + x   x   , x   x    - x   x   , x   x    -        |
|      3,4 2,3     3,1 2,2    3,2 2,1   3,2 4,3    3,3 4,2   3,1 4,3          |
|     ------------------------------------------------------------------------|
|     x   x   )                                                               |
|      3,3 4,1                                                                |
|                                                                             |
|o2 : Ideal of QQ[x   ..x   , x   ..x   , x   ..x   , x   ..x   ]             |
|                  3,1   3,4   2,1   2,4   1,1   1,4   4,1   4,3              |
+-----------------------------------------------------------------------------+

Ways to use polyoLattice:
=========================

  * "polyoLattice(CollectionOfCells)"

For the programmer
==================

The object polyoLattice, is a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1271:0.

adjacent2MinorIdeal -- Ideal generated by adjacent 2-minors
***********************************************************

  * Usage:
        adjacent2MinorIdeal Q
  * Inputs:
      * Q, a collection of cells
  * Optional inputs (Macaulay2Doc),:
      * Field, => ..., default value QQ, optional argument for
        polyoIdeal and adjacent2MinorIdeal
      * TermOrder, => ..., default value Lex, optional
        argument for polyoIdeal and adjacent2MinorIdeal
  * Outputs:
      * the ideal generated by the adjacent $2$-minors of Q

Description
===========

This function constructs the ideal generated by all adjacent $2$-minors of Q,
as defined in [HH2012].

  * [HH2012] Ideals generated by adjacent 2-minors(J. Herzog, T. Hibi, 2012, J.
    Commut. Algebra).

+-----------------------------------------------------------------------------+
|i1 : Q = cellCollection {{1,1},{1,2},{2,1},{2,2}};                           |
+-----------------------------------------------------------------------------+
|i2 : I = adjacent2MinorIdeal Q                                               |
|                                                                             |
|o2 = ideal (x   x    - x   x   , x   x    - x   x   , x   x    - x   x   ,   |
|             2,2 1,1    2,1 1,2   2,3 1,2    2,2 1,3   3,2 2,1    3,1 2,2    |
|     ------------------------------------------------------------------------|
|     x   x    - x   x   )                                                    |
|      3,3 2,2    3,2 2,3                                                     |
|                                                                             |
|o2 : Ideal of QQ[x   , x   , x   , x   , x   , x   , x   , x   , x   ]       |
|                  3,3   3,2   3,1   2,3   2,2   2,1   1,3   1,2   1,1        |
+-----------------------------------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells

Ways to use adjacent2MinorIdeal:
================================

  * "adjacent2MinorIdeal(CollectionOfCells)"

For the programmer
==================

The object adjacent2MinorIdeal, is a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1296:0.

isNonAttackingRooks -- Check if a rook configuration is non-attacking
*********************************************************************

  * Usage:
        isNonAttackingRooks(A,B,Q)
  * Inputs:
      * A, the lower left corner of the cell where the rook is placed
      * B, the lower left corner of the cell where the rook is placed
      * Q, a collection of cells
  * Outputs:
      * true if no two rooks attack each other, otherwise false

Description
===========

Given a collection of cells $\mathcal{P}$, this function checks whether a
configuration of two rooks placed on the cells of $\mathcal{P}$ is
non-attacking, that is, whether no two rooks share the same row or column or,
if they are on the same row (resp. column), they are not connected by a
horizontal (resp. vertical) path of cells of $\mathcal{P}$.

+--------------------------------------------------+
|i1 : Q = cellCollection {{1,1},{1,2},{2,1},{2,2}};|
+--------------------------------------------------+
|i2 : isNonAttackingRooks({1,1}, {2,2}, Q)         |
|                                                  |
|o2 = true                                         |
+--------------------------------------------------+
|i3 : isNonAttackingRooks({1,1}, {1,2}, Q)         |
|                                                  |
|o3 = false                                        |
+--------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells

Ways to use isNonAttackingRooks:
================================

  * "isNonAttackingRooks(List,List,CollectionOfCells)"

For the programmer
==================

The object isNonAttackingRooks, is a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1321:0.

allNonAttackingRookConfigurations -- All non-attacking rook configurations in Q
*******************************************************************************

  * Usage:
        allNonAttackingRookConfigurations(Q)
  * Inputs:
      * Q, a collection of cells
  * Outputs:
      * the list of all configurations of non-attacking rooks on $\mathcal{P}$

Description
===========

For a collection of cells $\mathcal{P}$, this function returns the list of all
configurations of non-attacking rooks on $\mathcal{P}$.

+-----------------------------------------------------------------------------+
|i1 : Q = cellCollection {{1,1},{1,2},{2,1},{3,1},{3,2}};                     |
+-----------------------------------------------------------------------------+
|i2 : netList allNonAttackingRookConfigurations Q                             |
|                                                                             |
|     +------------------------+----------------+----------------+------------|
|o2 = |{{1, 1}}                |{{1, 2}}        |{{2, 1}}        |{{3, 1}}    |
|     +------------------------+----------------+----------------+------------|
|     |{{2, 1}, {3, 2}}        |{{1, 2}, {3, 2}}|{{1, 2}, {2, 1}}|{{1, 1}, {3,|
|     +------------------------+----------------+----------------+------------|
|     |{{1, 2}, {2, 1}, {3, 2}}|                |                |            |
|     +------------------------+----------------+----------------+------------|
|-----------------------------------------------------------------------------|
|----+----------------+                                                       |
|    |{{3, 2}}        |                                                       |
|----+----------------+                                                       |
| 2}}|{{1, 2}, {3, 1}}|                                                       |
|----+----------------+                                                       |
|    |                |                                                       |
|----+----------------+                                                       |
+-----------------------------------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells
  * isNonAttackingRooks -- Check if a rook
    configuration is non-attacking

Ways to use allNonAttackingRookConfigurations:
==============================================

  * "allNonAttackingRookConfigurations(CollectionOfCells)"

For the programmer
==================

The object allNonAttackingRookConfigurations,
is a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1343:0.

rookPolynomial -- Rook polynomial of a collection of cells
**********************************************************

  * Usage:
        rookPolynomial Q
  * Inputs:
      * Q, a collection of cells
  * Outputs:
      * the rook polynomial of Q

Description
===========

The rook polynomial of a collection of cells $\mathcal{P}$ is defined as
$r_\mathcal{P}(t) = \sum_{k \ge 0} r_k(\mathcal{P}) t^k,$ where
$r_k(\mathcal{P})$ denotes the number of non-attacking configurations of $k$
rooks on $\mathcal{P}$. This function computes and returns the polynomial
$r_\mathcal{P}(t)$.

The importance of this rook polynomial is underlined by the fact that it
appears to describe the Hilbert series of the coordinate ring of collections of
cells that do not contain the square tetromino, also known as thin (see
[RR2021]).
  * [RR2021] Hilbert series of simple thin polyominoes(R. Rinaldo, F. Romeo,
    2021, J. Algebr. Comb.).

+--------------------------------------------------+
|i1 : Q = cellCollection {{1,1},{1,2},{2,1},{2,2}};|
+--------------------------------------------------+
|i2 : rookPolynomial Q                             |
|                                                  |
|       2                                          |
|o2 = 2t  + 4t + 1                                 |
|                                                  |
|o2 : ZZ[t]                                        |
+--------------------------------------------------+

+--------------------------------------------------------+
|i3 : Q = cellCollection {{1,1},{1,2},{2,1},{3,1},{3,2}};|
+--------------------------------------------------------+
|i4 : rookPolynomial Q                                   |
|                                                        |
|      3     2                                           |
|o4 = t  + 5t  + 5t + 1                                  |
|                                                        |
|o4 : ZZ[t]                                              |
+--------------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells
  * isNonAttackingRooks -- Check if a rook
    configuration is non-attacking
  * allNonAttackingRookConfigurations,
    -- All non-attacking rook configurations in Q
  * rookNumber -- Rook number of a collection of cells

Ways to use rookPolynomial:
===========================

  * "rookPolynomial(CollectionOfCells)"

For the programmer
==================

The object rookPolynomial, is a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1400:0.

rookNumber -- Rook number of a collection of cells
**************************************************

  * Usage:
        rookNumber(Q)
  * Inputs:
      * Q, a collection of cells
  * Outputs:
      * the maximum number of rooks that can be placed on Q in non-attacking
        positions.

Description
===========

Given a collection of cells $\mathcal{P}$, this routine computes the maximum
number of rooks that can be placed on $\mathcal{P}$ in non-attacking position.

+--------------------------------------------------+
|i1 : Q = cellCollection {{1,1},{1,2},{2,1},{2,2}};|
+--------------------------------------------------+
|i2 : rookNumber Q                                 |
|                                                  |
|o2 = 2                                            |
+--------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells
  * isNonAttackingRooks -- Check if a rook
    configuration is non-attacking
  * allNonAttackingRookConfigurations,
    -- All non-attacking rook configurations in Q

Ways to use rookNumber:
=======================

  * "rookNumber(CollectionOfCells)"

For the programmer
==================

The object rookNumber, is a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1365:0.

equivalenceClassesSwitchingRook -- Equivalence classes of rook configurations under switching
*********************************************************************************************

  * Usage:
        equivalenceClassesSwitchingRook Q
  * Inputs:
      * Q, a collection of cells
  * Outputs:
      * the list of equivalence classes of rook configurations under the
        switching equivalence

Description
===========

This function computes the equivalence classes of non-attacking rook
configurations under the switching operation.

Let $\mathcal{P}$ be a collection of cells. Two rooks are non-attacking if they
do not share the same row or column or, if they are on the same row (resp.
column), they are not connected by a horizontal (resp. vertical) path of cells
of $\mathcal{P}$ A $j$-rook configuration in $\mathcal{P}$ is a set of $j$
non-attacking rooks placed within $\mathcal{P}$, where $j \ge 0$; by
convention, the $0$-rook configuration is the empty set $\emptyset$. We denote
by $\mathcal{R}_j(\mathcal{P})$ the set of all $j$-rook configurations of
$\mathcal{P}$ for $j \in \{0, \dots, r(\mathcal{P})\}$, adopting the convention
that $\mathcal{R}_0(\mathcal{P}) = \{\emptyset\}$ (so
$|\mathcal{R}_0(\mathcal{P})| = 1$).
The collection $\bigcup_{j=0}^{r(\mathcal{P})} \mathcal{R}_j(\mathcal{P})$
forms a simplicial complex, called the chessboard complex of $\mathcal{P}$.

Two non-attacking rooks in $\mathcal{P}$ are said to be in switching position
if they occupy the diagonal (respectively, anti-diagonal) corner cells of an
inner interval $I$ of $\mathcal{P}$. In that case, we say the rooks are in a
diagonal (respectively, anti-diagonal) position.
Fix $j \in \{0, \dots, r(\mathcal{P})\}$ and let $F \in
\mathcal{R}_j(\mathcal{P})$.
Suppose that two rooks $R_1, R_2 \in F$ are in switching position in $I$, for
some inner interval $I$. Let $R_1', R_2'$ denote the rooks in the opposite
diagonal (or anti-diagonal) cells of $I$. Then the configuration $(F \setminus
\{R_1, R_2\}) \cup \{R_1', R_2'\}$ also belongs to
$\mathcal{R}_j(\mathcal{P})$. This operation of replacing $R_1, R_2$ with
$R_1', R_2'$ is called a switch of $R_1$ and $R_2$.
It defines an equivalence relation $\sim$ on $\mathcal{R}_j(\mathcal{P})$,
where $F_1 \sim F_2$ if and only if $F_2$ can be obtained from $F_1$ by a
finite sequence of switches.

+----------------------------------------------------------------------------+
|i1 : Q = cellCollection {{1,1},{1,2},{2,1},{2,2}};                          |
+----------------------------------------------------------------------------+
|i2 : netList equivalenceClassesSwitchingRook Q                              |
|                                                                            |
|     +------------------------------------+----------+----------+----------+|
|o2 = |{{{1, 1}}}                          |{{{1, 2}}}|{{{2, 1}}}|{{{2, 2}}}||
|     +------------------------------------+----------+----------+----------+|
|     |{{{1, 2}, {2, 1}}, {{1, 1}, {2, 2}}}|          |          |          ||
|     +------------------------------------+----------+----------+----------+|
+----------------------------------------------------------------------------+

+-----------------------------------------------------------------------------+
|i3 : Q = cellCollection {{1,1},{1,2},{2,1},{2,2},{1,3},{2,3},{3,1}};         |
+-----------------------------------------------------------------------------+
|i4 : netList equivalenceClassesSwitchingRook Q                               |
|                                                                             |
|     +----------------------------------------------------+------------------|
|o4 = |{{{1, 1}}}                                          |{{{1, 2}}}        |
|     +----------------------------------------------------+------------------|
|     |{{{1, 3}, {3, 1}}}                                  |{{{1, 2}, {2, 3}},|
|     +----------------------------------------------------+------------------|
|     |{{{1, 2}, {2, 3}, {3, 1}}, {{1, 3}, {2, 2}, {3, 1}}}|                  |
|     +----------------------------------------------------+------------------|
|-----------------------------------------------------------------------------|
|------------------+------------------+------------------------------------+--|
|                  |{{{1, 3}}}        |{{{2, 1}}}                          |{{|
|------------------+------------------+------------------------------------+--|
| {{1, 3}, {2, 2}}}|{{{2, 3}, {3, 1}}}|{{{1, 1}, {2, 2}}, {{1, 2}, {2, 1}}}|{{|
|------------------+------------------+------------------------------------+--|
|                  |                  |                                    |  |
|------------------+------------------+------------------------------------+--|
|-----------------------------------------------------------------------------|
|----------------------------------+------------------+------------------+    |
|{2, 2}}}                          |{{{2, 3}}}        |{{{3, 1}}}        |    |
|----------------------------------+------------------+------------------+    |
|{1, 1}, {2, 3}}, {{1, 3}, {2, 1}}}|{{{1, 2}, {3, 1}}}|{{{2, 2}, {3, 1}}}|    |
|----------------------------------+------------------+------------------+    |
|                                  |                  |                  |    |
|----------------------------------+------------------+------------------+    |
+-----------------------------------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells
  * isNonAttackingRooks -- Check if a rook
    configuration is non-attacking
  * rookNumber -- Rook number of a collection of cells

Ways to use equivalenceClassesSwitchingRook:
============================================

  * "equivalenceClassesSwitchingRook(CollectionOfCells)"

For the programmer
==================

The object equivalenceClassesSwitchingRook,
is a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1443:0.

switchingRookPolynomial -- Switching rook polynomial of a collection of cells
*****************************************************************************

  * Usage:
        switchingRookPolynomial Q
  * Inputs:
      * Q, a collection of cells
  * Outputs:
      * the switching rook polynomial of Q

Description
===========

The switching rook polynomial encodes the number of switching equivalence
classes of rook configurations on a collection of cells $\mathcal{P}$. Each
coefficient corresponds to the number of distinct equivalence classes of the
chessboard complex modulo the switching rook equivalence relation. Switching
rook polynomial appears to describe the Hilbert series of the coordinate ring
of collections of cells (see [JN2024], [QRR2022]). Note that when a collection
of cells does not contain a square tetromino, then the switching rook
polynomial coincides with the rook polynomial.
  * [JN2024] Shellable simplicial complex and switching rook polynomial of
    frame polyominoes(R. Jahangir, F. Navarra, 2024, J. Pure Appl. Algebra).
  * [QRR2022] Hilbert series of parallelogram polyominoes(A.A. Qureshi, R.
    Rinaldo, F. Romeo, 2022, Res. Math. Sci.).

+--------------------------------------------------+
|i1 : Q = cellCollection {{1,1},{1,2},{2,1},{2,2}};|
+--------------------------------------------------+
|i2 : switchingRookPolynomial Q                    |
|                                                  |
|      2                                           |
|o2 = t  + 4t + 1                                  |
|                                                  |
|o2 : ZZ[t]                                        |
+--------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells
  * isNonAttackingRooks -- Check if a rook
    configuration is non-attacking
  * allNonAttackingRookConfigurations,
    -- All non-attacking rook configurations in Q
  * rookNumber -- Rook number of a collection of cells
  * equivalenceClassesSwitchingRook, --
    Equivalence classes of rook configurations under switching

Ways to use switchingRookPolynomial:
====================================

  * "switchingRookPolynomial(CollectionOfCells)"

For the programmer
==================

The object switchingRookPolynomial, is a
method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1476:0.

standardRookNumber -- Standard rook number of a collection of cells
*******************************************************************

  * Usage:
        standardRookNumber Q
  * Inputs:
      * Q, a collection of cells
  * Outputs:
      * the standard rook number of Q

Description
===========

The standard rook number is the maximum number of rooks that can be place on a
collection of cells in (standard) non-attacking positions. Two rooks are in
(standard) non-attacking position if they do not share the same row or column.

+--------------------------------------------------------+
|i1 : Q = cellCollection {{1,1},{1,2},{2,1},{3,1},{3,2}};|
+--------------------------------------------------------+
|i2 : standardRookNumber Q                               |
|                                                        |
|o2 = 2                                                  |
+--------------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells
  * standardNonAttackingRookConfigurations
    -- Standard non-attacking rook
    configurations

Ways to use standardRookNumber:
===============================

  * "standardRookNumber(CollectionOfCells)"

For the programmer
==================

The object standardRookNumber, is a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1520:0.

standardNonAttackingRookConfigurations -- Standard non-attacking rook configurations
************************************************************************************

  * Usage:
        standardNonAttackingRookConfigurations Q
  * Inputs:
      * Q, a collection of cells
  * Outputs:
      * the list of all standard non-attacking rook configurations on Q

Description
===========

This function generates all standard non-attacking rook configurations on a
collection of cells. Two rooks are in non-attacking position if they do not
share the same row or column.

+-----------------------------------------------------------------------------+
|i1 : Q = cellCollection {{1,1},{1,2},{2,1},{3,1},{3,2}};                     |
+-----------------------------------------------------------------------------+
|i2 : netList standardNonAttackingRookConfigurations Q                        |
|                                                                             |
|     +----------------+----------------+----------------+----------------+---|
|o2 = |{{1, 1}}        |{{1, 2}}        |{{2, 1}}        |{{3, 1}}        |{{3|
|     +----------------+----------------+----------------+----------------+---|
|     |{{2, 1}, {3, 2}}|{{1, 2}, {2, 1}}|{{1, 1}, {3, 2}}|{{1, 2}, {3, 1}}|   |
|     +----------------+----------------+----------------+----------------+---|
|-----------------------------------------------------------------------------|
|-----+                                                                       |
|, 2}}|                                                                       |
|-----+                                                                       |
|     |                                                                       |
|-----+                                                                       |
+-----------------------------------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells

Ways to use standardNonAttackingRookConfigurations:
===================================================

  * "standardNonAttackingRookConfigurations(CollectionOfCells)"

For the programmer
==================

The object standardNonAttackingRookConfigurations,
is a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1498:0.

standardRookPolynomial -- Standard rook polynomial of a collection of cells
***************************************************************************

  * Usage:
        standardRookPolynomial Q
  * Inputs:
      * Q, a collection of cells
  * Outputs:
      * the standard rook polynomial of Q

Description
===========

This function computes the standard rook polynomial of a collection of cells
$\mathcal{P}$. The polynomial encodes the number of standard non-attacking rook
configurations of each size.

+--------------------------------------------------------+
|i1 : Q = cellCollection {{1,1},{1,2},{2,1},{3,1},{3,2}};|
+--------------------------------------------------------+
|i2 : standardRookPolynomial Q                           |
|                                                        |
|       2                                                |
|o2 = 4t  + 5t + 1                                       |
|                                                        |
|o2 : ZZ[t]                                              |
+--------------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells
  * standardNonAttackingRookConfigurations
    -- Standard non-attacking rook
    configurations
  * standardRookNumber -- Standard rook number of a
    collection of cells

Ways to use standardRookPolynomial:
===================================

  * "standardRookPolynomial(CollectionOfCells)"

For the programmer
==================

The object standardRookPolynomial, is a
method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1543:0.

isPalindromic -- Check if a polynomial is palindromic
*****************************************************

  * Usage:
        isPalindromic f
  * Inputs:
      * f, a polynomial in one variable with nonzero coefficients
  * Outputs:
      * true if $f$ is palindromic, otherwise false

Description
===========

Let $f = a_0 + a_1 x + \cdots + a_d x^d$. The polynomial $f$ is palindromic if
and only if $a_i = a_{d-i}$ for all $i = 0, \ldots, d$. This routine checks
whether $f$ satisfies this condition.

+-------------------------------------------------+
|i1 : R = QQ[x];                                  |
+-------------------------------------------------+
|i2 : isPalindromic(x^4 + 2*x^3 + 3*x^2 + 2*x + 1)|
|                                                 |
|o2 = true                                        |
+-------------------------------------------------+

Ways to use isPalindromic:
==========================

  * "isPalindromic(RingElement)"

For the programmer
==================

The object isPalindromic, is a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1569:0.

randomCollectionWithFixedRank -- Random collection of cells with fixed rank
***************************************************************************

  * Usage:
        randomCollectionWithFixedRank n
  * Inputs:
      * n, an integer specifying the number of cells
  * Outputs:
      * a randomly generated collection of $n$ cells

Description
===========

Generates a random collection of $n$ cells.

+-----------------------------------------------+
|i1 : Q = randomCollectionWithFixedRank 5       |
|                                               |
|o1 = {{1, 1}, {0, 1}, {2, 2}, {-1, 2}, {-2, 3}}|
|                                               |
|o1 : CollectionOfCells                         |
+-----------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells
  * randomCollectionOfCells -- Random
    collection of cells up to a given size

Ways to use randomCollectionWithFixedRank:
==========================================

  * "randomCollectionWithFixedRank(ZZ)"

For the programmer
==================

The object randomCollectionWithFixedRank,
is a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1591:0.

randomCollectionOfCells -- Random collection of cells up to a given size
************************************************************************

  * Usage:
        randomCollectionOfCells m
  * Inputs:
      * m, a positive integer bound on the number of cells
  * Outputs:
      * a randomly generated collection of cells of size at most m

Description
===========

Produces a random collection of cells with a randomly chosen number of cells
between $1$ and the given bound $m$.

+-------------------------------------+
|i1 : Q = randomCollectionOfCells 8   |
|                                     |
|o1 = {{1, 1}, {1, 0}, {1, 2}, {0, 0}}|
|                                     |
|o1 : CollectionOfCells               |
+-------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells
  * randomCollectionWithFixedRank, --
    Random collection of cells with fixed rank

Ways to use randomCollectionOfCells:
====================================

  * "randomCollectionOfCells(ZZ)"

For the programmer
==================

The object randomCollectionOfCells, is a
method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1613:0.

randomPolyominoWithFixedRank -- Random polyomino with fixed rank
****************************************************************

  * Usage:
        randomPolyominoWithFixedRank n
  * Inputs:
      * n, an integer specifying the number of cells
  * Outputs:
      * a random polyomino composed of $n$ connected cells

Description
===========

Generates a random connected polyomino consisting of $n$ cells.

+--------------------------------------------------------+
|i1 : P = randomPolyominoWithFixedRank 6                 |
|                                                        |
|o1 = {{1, 1}, {0, 1}, {2, 2}, {-1, 2}, {-2, 3}, {-2, 4}}|
|                                                        |
|o1 : CollectionOfCells                                  |
+--------------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells
  * randomPolyomino -- Random polyomino with random
    size up to a given bound

Ways to use randomPolyominoWithFixedRank:
=========================================

  * "randomPolyominoWithFixedRank(ZZ)"

For the programmer
==================

The object randomPolyominoWithFixedRank, is
a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1634:0.

randomPolyomino -- Random polyomino with random size up to a given bound
************************************************************************

  * Usage:
        randomPolyomino m
  * Inputs:
      * m, a positive integer bound on the number of cells
  * Outputs:
      * a randomly generated polyomino with at most $m$ cells

Description
===========

Produces a random polyomino whose number of cells is randomly chosen between
$1$ and the given bound $m$.

+-----------------------------------------------------------------------------+
|i1 : P = randomPolyomino 10                                                  |
|                                                                             |
|o1 = {{1, 1}, {1, 2}, {0, 1}, {2, 1}, {1, 0}, {1, 3}, {2, 3}, {0, 2}, {2,    |
|     ------------------------------------------------------------------------|
|     -1}}                                                                    |
|                                                                             |
|o1 : CollectionOfCells                                                       |
+-----------------------------------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells
  * randomPolyominoWithFixedRank -- Random
    polyomino with fixed rank

Ways to use randomPolyomino:
============================

  * "randomPolyomino(ZZ)"

For the programmer
==================

The object randomPolyomino, is a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1655:0.

cellGraph -- Graph associated with a collection of cells
********************************************************

  * Usage:
        cellGraph Q
  * Inputs:
      * Q, a collection of cells
  * Outputs:
      * the graph whose vertices correspond to cells and edges to adjacency
        relations

Description
===========

Constructs the adjacency graph $G$ of a collection of cells, where the vertices
of $G$ are the cells and two vertices of $G$ are connected by an edge in $G$ if
the corresponding two cells share a common side.

+--------------------------------------------------+
|i1 : Q = cellCollection {{1,1},{1,2},{2,1},{2,2}};|
+--------------------------------------------------+
|i2 : G = cellGraph Q                              |
|                                                  |
|o2 = Graph{0 => {1, 2}}                           |
|           1 => {0, 3}                            |
|           2 => {0, 3}                            |
|           3 => {1, 2}                            |
|                                                  |
|o2 : Graph                                        |
+--------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells
  * collectionIsConnected -- Check if a
    collection of cells is connected
  * connectedComponentsCells -- Connected
    components of a collection of cells
  * isRowConvex -- Row convexity of a collection of cells
  * isColumnConvex -- Column convexity of a collection
    of cells
  * isConvex -- Convexity of a collection of cells
  * collectionIsSimple -- Simplicity of a collection
    of cells

Ways to use cellGraph:
======================

  * "cellGraph(CollectionOfCells)"

For the programmer
==================

The object cellGraph, is a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1677:0.

collectionIsConnected -- Check if a collection of cells is connected
********************************************************************

  * Usage:
        collectionIsConnected Q
  * Inputs:
      * Q, a collection of cells
  * Outputs:
      * a sequence. The first component is a Boolean value: true if Q is
        connected, otherwise false. The second component gives the number of
        connected components of the collection of cells.

Description
===========

A collection of cells $\mathcal{P}$ is connected if for every pair of cells $A$
and $B$ of $\mathcal{P}$ there exists a path of cells $A=C_1,...,C_t=B$ of
$\mathcal{P}$, such that $C_i\cap C_{i+1}$ is an edge, for all $i=1,..,t-1$.
This function determines whether the collection of cells $\mathcal{P}$ is
connected and the number of the connected components.

+--------------------------------------------+
|i1 : Q = cellCollection {{1,1},{2,1},{3,2}};|
+--------------------------------------------+
|i2 : collectionIsConnected Q                |
|                                            |
|o2 = (false, 2)                             |
|                                            |
|o2 : Sequence                               |
+--------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells
  * connectedComponentsCells -- Connected
    components of a collection of cells
  * isRowConvex -- Row convexity of a collection of cells
  * isColumnConvex -- Column convexity of a collection
    of cells
  * isConvex -- Convexity of a collection of cells
  * collectionIsSimple -- Simplicity of a collection
    of cells

Ways to use collectionIsConnected:
==================================

  * "collectionIsConnected(CollectionOfCells)"

For the programmer
==================

The object collectionIsConnected, is a
method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1700:0.

connectedComponentsCells -- Connected components of a collection of cells
*************************************************************************

  * Usage:
        connectedComponentsCells Q
  * Inputs:
      * Q, a collection of cells
  * Outputs:
      * the list of connected components of Q

Description
===========

Computes and returns the connected components of a collection of cells.

+--------------------------------------------------------+
|i1 : Q = cellCollection {{1,1},{2,1},{3,3},{4,3},{4,4}};|
+--------------------------------------------------------+
|i2 : netList connectedComponentsCells Q                 |
|                                                        |
|     +------+------+------+                             |
|o2 = |{1, 1}|{2, 1}|      |                             |
|     +------+------+------+                             |
|     |{3, 3}|{4, 3}|{4, 4}|                             |
|     +------+------+------+                             |
+--------------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells
  * collectionIsConnected -- Check if a
    collection of cells is connected

Ways to use connectedComponentsCells:
=====================================

  * "connectedComponentsCells(CollectionOfCells)"

For the programmer
==================

The object connectedComponentsCells, is a
method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1722:0.

isRowConvex -- Row convexity of a collection of cells
*****************************************************

  * Usage:
        isRowConvex Q
  * Inputs:
      * Q, a collection of cells
  * Outputs:
      * true if Q is row-convex, otherwise false

Description
===========

Checks whether a collection of cells $\mathcal{P}$ is row-convex, i.e., every
pair of cells in the same row determines an inner interval fully contained in
$\mathcal{P}$.

+--------------------------------------------------------+
|i1 : Q = cellCollection {{1,1},{2,1},{3,1},{1,2},{3,2}};|
+--------------------------------------------------------+
|i2 : isRowConvex Q                                      |
|                                                        |
|o2 = false                                              |
+--------------------------------------------------------+

+--------------------------------------------------------+
|i3 : Q = cellCollection {{1,1},{1,2},{1,3},{2,3},{2,1}};|
+--------------------------------------------------------+
|i4 : isRowConvex Q                                      |
|                                                        |
|o4 = true                                               |
+--------------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells
  * collectionIsConnected -- Check if a
    collection of cells is connected
  * connectedComponentsCells -- Connected
    components of a collection of cells
  * isRowConvex -- Row convexity of a collection of cells
  * isColumnConvex -- Column convexity of a collection
    of cells
  * isConvex -- Convexity of a collection of cells
  * collectionIsSimple -- Simplicity of a collection
    of cells

Ways to use isRowConvex:
========================

  * "isRowConvex(CollectionOfCells)"

For the programmer
==================

The object isRowConvex, is a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1750:0.

isColumnConvex -- Column convexity of a collection of cells
***********************************************************

  * Usage:
        isColumnConvex Q
  * Inputs:
      * Q, a collection of cells
  * Outputs:
      * true if Q is column-convex, otherwise false

Description
===========

Checks whether a collection of cells $\mathcal{P}$ is column-convex, i.e.,
every pair of cells in the same column determines an inner interval fully
contained in $\mathcal{P}$.

+--------------------------------------------------------+
|i1 : Q = cellCollection {{1,1},{2,1},{3,1},{1,2},{3,2}};|
+--------------------------------------------------------+
|i2 : isColumnConvex Q                                   |
|                                                        |
|o2 = true                                               |
+--------------------------------------------------------+

+--------------------------------------------------------+
|i3 : Q = cellCollection {{1,1},{1,2},{1,3},{2,3},{2,1}};|
+--------------------------------------------------------+
|i4 : isColumnConvex Q                                   |
|                                                        |
|o4 = false                                              |
+--------------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells
  * collectionIsConnected -- Check if a
    collection of cells is connected
  * connectedComponentsCells -- Connected
    components of a collection of cells
  * isRowConvex -- Row convexity of a collection of cells
  * isConvex -- Convexity of a collection of cells
  * collectionIsSimple -- Simplicity of a collection
    of cells

Ways to use isColumnConvex:
===========================

  * "isColumnConvex(CollectionOfCells)"

For the programmer
==================

The object isColumnConvex, is a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1777:0.

isConvex -- Convexity of a collection of cells
**********************************************

  * Usage:
        isConvex Q
  * Inputs:
      * Q, a collection of cells
  * Outputs:
      * true if Q is convex (both row- and column-convex), otherwise false

Description
===========

Checks whether a collection of cells is convex, that is, both row- and
column-convex.

+--------------------------------------------------+
|i1 : Q = cellCollection {{1,1},{1,2},{2,1},{2,2}};|
+--------------------------------------------------+
|i2 : isConvex Q                                   |
|                                                  |
|o2 = true                                         |
+--------------------------------------------------+

+--------------------------------------------------------+
|i3 : Q = cellCollection {{1,1},{2,1},{3,1},{1,2},{3,2}};|
+--------------------------------------------------------+
|i4 : isConvex Q                                         |
|                                                        |
|o4 = false                                              |
+--------------------------------------------------------+

+--------------------------------------------------------+
|i5 : Q = cellCollection {{1,1},{1,2},{1,3},{2,3},{2,1}};|
+--------------------------------------------------------+
|i6 : isConvex Q                                         |
|                                                        |
|o6 = false                                              |
+--------------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells
  * collectionIsConnected -- Check if a
    collection of cells is connected
  * connectedComponentsCells -- Connected
    components of a collection of cells
  * isRowConvex -- Row convexity of a collection of cells
  * isColumnConvex -- Column convexity of a collection
    of cells
  * collectionIsSimple -- Simplicity of a collection
    of cells

Ways to use isConvex:
=====================

  * "isConvex(CollectionOfCells)"

For the programmer
==================

The object isConvex, is a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1809:0.

collectionIsSimple -- Simplicity of a collection of cells
*********************************************************

  * Usage:
        collectionIsSimple Q
  * Inputs:
      * Q, a collection of cells
  * Outputs:
      * true if Q is simple, otherwise false

Description
===========

This function checks if a collection of cells is simple, that is, it has no
holes.

+--------------------------------------------------+
|i1 : Q = cellCollection {{1,1},{2,1},{1,2},{2,2}};|
+--------------------------------------------------+
|i2 : collectionIsSimple Q                         |
|                                                  |
|o2 = true                                         |
+--------------------------------------------------+

+--------------------------------------------------------+
|i3 : Q = cellCollection {{1,1},{2,1},{3,1},{1,2},{3,2}};|
+--------------------------------------------------------+
|i4 : collectionIsSimple Q                               |
|                                                        |
|o4 = true                                               |
+--------------------------------------------------------+

+--------------------------------------------------------------------+
|i5 : Q = cellCollection {{1,1},{2,1},{3,1},{3,2},{1,2},{1,3},{2,3}};|
+--------------------------------------------------------------------+
|i6 : collectionIsSimple Q                                           |
|                                                                    |
|o6 = false                                                          |
+--------------------------------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells
  * collectionIsConnected -- Check if a
    collection of cells is connected
  * connectedComponentsCells -- Connected
    components of a collection of cells
  * isRowConvex -- Row convexity of a collection of cells
  * isColumnConvex -- Column convexity of a collection
    of cells
  * isConvex -- Convexity of a collection of cells

Ways to use collectionIsSimple:
===============================

  * "collectionIsSimple(CollectionOfCells)"

For the programmer
==================

The object collectionIsSimple, is a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1840:0.

rankCollection -- Rank of a collection of cells
***********************************************

  * Usage:
        rankCollection Q
  * Inputs:
      * Q, a collection of cells
  * Outputs:
      * the number of cells in the collection

Description
===========

Returns the number of cells (i.e., the rank).

+--------------------------------------------+
|i1 : Q = cellCollection {{1,1},{2,1},{2,2}};|
+--------------------------------------------+
|i2 : rankCollection Q                       |
|                                            |
|o2 = 3                                      |
+--------------------------------------------+

See also
========

  * cellCollection -- Create a collection of cells
  * collectionIsConnected -- Check if a
    collection of cells is connected
  * connectedComponentsCells -- Connected
    components of a collection of cells
  * isRowConvex -- Row convexity of a collection of cells
  * isColumnConvex -- Column convexity of a collection
    of cells
  * isConvex -- Convexity of a collection of cells
  * collectionIsSimple -- Simplicity of a collection
    of cells

Ways to use rankCollection:
===========================

  * "rankCollection(CollectionOfCells)"

For the programmer
==================

The object rankCollection, is a method function with options (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1862:0.

Field -- optional argument for polyoIdeal and adjacent2MinorIdeal
*****************************************************************

Description
===========

Specifies the coefficient field of the ambient ring used to define the ideal.
If not provided, the default field is the one associated with the current
polynomial ring.

+-----------------------------------------------------------------------------+
|i1 : F = GF(9, Variable => a)                                                |
|                                                                             |
|o1 = F                                                                       |
|                                                                             |
|o1 : GaloisField                                                             |
+-----------------------------------------------------------------------------+
|i2 : Q = cellCollection {{1,1}, {1,2}, {2,1}, {2,2}};                        |
+-----------------------------------------------------------------------------+
|i3 : I = adjacent2MinorIdeal(Q, Field => F, TermOrder => Lex)                |
|                                                                             |
|o3 = ideal (x   x    - x   x   , x   x    - x   x   , x   x    - x   x   ,   |
|             2,2 1,1    2,1 1,2   2,3 1,2    2,2 1,3   3,2 2,1    3,1 2,2    |
|     ------------------------------------------------------------------------|
|     x   x    - x   x   )                                                    |
|      3,3 2,2    3,2 2,3                                                     |
|                                                                             |
|o3 : Ideal of F[x   , x   , x   , x   , x   , x   , x   , x   , x   ]        |
|                 3,3   3,2   3,1   2,3   2,2   2,1   1,3   1,2   1,1         |
+-----------------------------------------------------------------------------+

+-----------------------------------------------------------------------------+
|i4 : F = GF(81,Variable=>a)                                                  |
|                                                                             |
|o4 = F                                                                       |
|                                                                             |
|o4 : GaloisField                                                             |
+-----------------------------------------------------------------------------+
|i5 : Q= cellCollection {{1,1},{2,1},{2,2}};                                  |
+-----------------------------------------------------------------------------+
|i6 : I = polyoIdeal(Q,Field=> F,RingChoice=>1,TermOrder=> GRevLex)           |
|                                                                             |
|o6 = ideal (- x   x    + x   x   , - x   x    + x   x   , - x   x    +       |
|               3,2 2,3    3,3 2,2     3,1 2,2    3,2 2,1     3,1 2,3         |
|     ------------------------------------------------------------------------|
|     x   x   , - x   x    + x   x   , - x   x    + x   x   )                 |
|      3,3 2,1     2,1 1,2    2,2 1,1     3,1 1,2    3,2 1,1                  |
|                                                                             |
|o6 : Ideal of F[x   , x   , x   , x   , x   , x   , x   , x   ]              |
|                 3,3   3,2   3,1   2,3   2,2   2,1   1,2   1,1               |
+-----------------------------------------------------------------------------+

See also
========

  * polyoIdeal -- Ideal of inner 2-minors of a collection of
    cells
  * adjacent2MinorIdeal -- Ideal generated by
    adjacent 2-minors

Functions with optional argument named Field:
=============================================

  * "adjacent2MinorIdeal(...,Field=>...)"
  * "polyoIdeal(...,Field=>...)"

For the programmer
==================

The object Field, is a symbol (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1963:0.

TermOrder -- optional argument for polyoIdeal and adjacent2MinorIdeal
*********************************************************************

Description
===========

Sets the term order for the polynomial ring where the ideal is defined. Typical
options include Lex, GRevLex, or other standard monomial orders.

+-----------------------------------------------------------------------------+
|i1 : Q = cellCollection {{1,1}, {2,1}, {2,2}};                               |
+-----------------------------------------------------------------------------+
|i2 : I = adjacent2MinorIdeal(Q, TermOrder => GRevLex)                        |
|                                                                             |
|o2 = ideal (- x   x    + x   x   , - x   x    + x   x   , - x   x    +       |
|               2,1 1,2    2,2 1,1     3,1 2,2    3,2 2,1     3,2 2,3         |
|     ------------------------------------------------------------------------|
|     x   x   )                                                               |
|      3,3 2,2                                                                |
|                                                                             |
|o2 : Ideal of QQ[x   , x   , x   , x   , x   , x   , x   , x   ]             |
|                  3,3   3,2   3,1   2,3   2,2   2,1   1,2   1,1              |
+-----------------------------------------------------------------------------+
For polyoIdeal, this option can be used just when RingChoice => 1.

+-----------------------------------------------------------------------------+
|i3 : Q= cellCollection {{1,1},{2,2},{3,3}};                                  |
+-----------------------------------------------------------------------------+
|i4 : I = polyoIdeal(Q,RingChoice=>1,TermOrder=> GRevLex);                    |
|                                                                             |
|o4 : Ideal of QQ[x   , x   , x   , x   , x   , x   , x   , x   , x   , x   ] |
|                  4,4   4,3   3,4   3,3   3,2   2,3   2,2   2,1   1,2   1,1  |
+-----------------------------------------------------------------------------+
|i5 : R=ring I;                                                               |
+-----------------------------------------------------------------------------+
|i6 : describe R                                                              |
|                                                                             |
|o6 = QQ[x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , Degrees  |
|         4,4   4,3   3,4   3,3   3,2   2,3   2,2   2,1   1,2   1,1           |
|-----------------------------------------------------------------------------|
|=> {10:1}, Heft => {1}]                                                      |
+-----------------------------------------------------------------------------+

See also
========

  * polyoIdeal -- Ideal of inner 2-minors of a collection of
    cells
  * adjacent2MinorIdeal -- Ideal generated by
    adjacent 2-minors
  * RingChoice -- optional argument for polyoIdeal

Functions with optional argument named TermOrder:
=================================================

  * "adjacent2MinorIdeal(...,TermOrder=>...)"
  * "polyoIdeal(...,TermOrder=>...)"

For the programmer
==================

The object TermOrder, is a symbol (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1984:0.

RingChoice -- optional argument for polyoIdeal
**********************************************

Description
===========

Let $\mathcal{P}$ be a collection of cells and $[(1,1),(m,n)]$ be the smallest
interval of $\NN^2$ containing $\mathcal{P}$. Then we attach to $\mathcal{P}$
the following polynomial ring $S_{\mathcal{P}}=K[x_a:a\in V(\mathcal{P})$,
where $K$ is a field.
Whether it is 1 or by default it returns the ideal computed by polyoIdeal in
the ambient ring given by polyoRingDefault. With a value different by 1 it
returns the ideal in the ambient ring given by polyoRingConvex.

Here we describe the using of the two options polyoRingDefault and
polyoRingConvex.

PolyoRingDefault

This option gives the ideal $I_{\mathcal{P}}$ in the polynomial ring
$S_{\mathcal{P}}$ where the monomial order is defined by Term order induced by
the following order of the variables: $x_a > x_b$ with $a=(i,j)$ and $b=(k,
l)$, if $i > k$, or $i = k$ and $j > l$.

Examples

+-----------------------------------------------------------------------------+
|i1 : Q = cellCollection {{1,1},{2,1},{2,2}};                                 |
+-----------------------------------------------------------------------------+
|i2 : I = polyoIdeal(Q);                                                      |
|                                                                             |
|o2 : Ideal of QQ[x   , x   , x   , x   , x   , x   , x   , x   ]             |
|                  3,3   3,2   3,1   2,3   2,2   2,1   1,2   1,1              |
+-----------------------------------------------------------------------------+
|i3 : R=ring I;                                                               |
+-----------------------------------------------------------------------------+
|i4 : describe R                                                              |
|                                                                             |
|o4 = QQ[x   , x   , x   , x   , x   , x   , x   , x   , Degrees => {8:1},    |
|         3,3   3,2   3,1   2,3   2,2   2,1   1,2   1,1                       |
|                                                                             |
|-----------------------------------------------------------------------------|
|Heft => {1}, MonomialOrder => {MonomialSize => 32}]                          |
|                              {Lex => 8          }                           |
|                              {Position => Up    }                           |
+-----------------------------------------------------------------------------+

+-----------------------------------------------------------------------------+
|i5 : Q = cellCollection {{1,1},{2,1},{2,2}};                                 |
+-----------------------------------------------------------------------------+
|i6 : I = polyoIdeal(Q,RingChoice=>1);                                        |
|                                                                             |
|o6 : Ideal of QQ[x   , x   , x   , x   , x   , x   , x   , x   ]             |
|                  3,3   3,2   3,1   2,3   2,2   2,1   1,2   1,1              |
+-----------------------------------------------------------------------------+
|i7 : R=ring I;                                                               |
+-----------------------------------------------------------------------------+
|i8 : describe R                                                              |
|                                                                             |
|o8 = QQ[x   , x   , x   , x   , x   , x   , x   , x   , Degrees => {8:1},    |
|         3,3   3,2   3,1   2,3   2,2   2,1   1,2   1,1                       |
|                                                                             |
|-----------------------------------------------------------------------------|
|Heft => {1}, MonomialOrder => {MonomialSize => 32}]                          |
|                              {Lex => 8          }                           |
|                              {Position => Up    }                           |
+-----------------------------------------------------------------------------+

+-----------------------------------------------------------------------------+
|i9 : Q = cellCollection {{1,1},{2,1},{2,2}};                                 |
+-----------------------------------------------------------------------------+
|i10 : I = polyoIdeal(Q,RingChoice=>1,TermOrder=> GRevLex);                   |
|                                                                             |
|o10 : Ideal of QQ[x   , x   , x   , x   , x   , x   , x   , x   ]            |
|                   3,3   3,2   3,1   2,3   2,2   2,1   1,2   1,1             |
+-----------------------------------------------------------------------------+
|i11 : R=ring I;                                                              |
+-----------------------------------------------------------------------------+
|i12 : describe R                                                             |
|                                                                             |
|o12 = QQ[x   , x   , x   , x   , x   , x   , x   , x   , Degrees => {8:1},   |
|          3,3   3,2   3,1   2,3   2,2   2,1   1,2   1,1                      |
|-----------------------------------------------------------------------------|
|Heft => {1}]                                                                 |
+-----------------------------------------------------------------------------+

PolyoRingConvex

A very interesting class of collections of cells which are studied from a
combinatorial point of view is given by the weakly connected and convex ones.
Let $\mathcal{P}$ be a collection of cells. We say that $\mathcal{P}$ is weakly
connected if for any two cells $C$ and $D$ of $\mathcal{P}$, there exist a
sequence of cells of $\mathcal{P}$ as $C = C_1,\dots, C_m = D$ such that $C_i
\cap C_{i+1} \neq \emptyset$, for $i = 1,\dots, m − 1$. Observe trivially that
every polyomino is a weakly connected collection of cells. We say that a weakly
connected collection $\mathcal{P}$ of cells is row convex, if the horizontal
cell interval $[A, B]$ is contained in $\mathcal{P}$ for any two cells $A$ and
$B$ of $\mathcal{P}$ whose lower left corners are in horizontal position.
Similarly one defines column convex. Hence $\mathcal{P}$ is called convex if it
is row and column convex.
Assume that the smallest interval containing $\mathcal{P}$ is $[(1,1),(m,n)]$.
Consider the edge ring $R = K[s_it_j: (i, j) \in V (\mathcal{P})]$ associated
to the bipartite graph $G$ with vertex set $\{s_1,\dots, s_m\} \cup\{t_1,\dots,
t_n\}$ to $\mathcal{P}$ such that each vertex $(i, j) \in V (\mathcal{P})$
determines the edge $\{s_i,t_j \}$ in $G$. Let $S=K[x_a:a\in V(\mathcal{P})$
and $\phi : S \rightarrow R$ be the $K$-algebra homomorphism defined by
$\phi(x_{ij} ) = s_it_j$, for all $(i, j) \in V (\mathcal{P})$ and set
$J_\mathcal{P} = ker(\phi)$. From Theorem 2.1 of [AAQ2012], we know that
$I_{\mathcal{P}}=J_{\mathcal{P}}$, if $\mathcal{P}$ is a weakly connected and
convex collection of cells. In such a case, from [OH1999] we get that the
generators of $I_{\mathcal{P}}$ forms the reduced Groebner basis with respect
to a suitable order <, and in particular the initial ideal
$\mathrm{in}_<(I_{\mathcal{P}})$ is squarefree and generated in degree two.
Following the proof in [OH1999], this routine implements an algorithm which
gives the polynomial ring where the monomial order is <.

If $\mathcal{P}$ is a weakly connected and convex collection of cells (or in
particular a convex polyomino), then the function polyoRingConvex returns the
polynomial ring attached to $\mathcal{P}$ whose monomial order $<$ is such that
$\mathrm{in}_<(I_{\mathcal{P}})$ is squarefree and generated in degree two.

Literature
  * [AAQ2012] Ideals generated by 2-minors, collections of cells and stack
    polyominoes (A. A. Qureshi, 2012,  J. Algebra).
  * [OH1999] Koszul bipartite graphs (H. Ohsugi and T. Hibi, 1999, Adv. Appl.
    Math. 22,  25-28).

Examples

+-----------------------------------------------------------------------------+
|i13 : Q = cellCollection {{1, 2}, {2, 2}, {1, 3}, {2, 3}, {2, 4}, {3, 2}, {3,|
|-----------------------------------------------------------------------------|
|1}};                                                                         |
+-----------------------------------------------------------------------------+
|i14 : I = polyoIdeal(Q,RingChoice=>2);                                       |
|                                                                             |
|o14 : Ideal of QQ[x   , x   , x   , x   , x   , x   , x   , x   , x   , x   ,|
|                   2,5   3,5   1,4   2,4   3,4   4,1   3,1   1,2   2,2   4,2 |
|-----------------------------------------------------------------------------|
|x   , x   , x   , x   , x   ]                                                |
| 3,2   1,3   2,3   4,3   3,3                                                 |
+-----------------------------------------------------------------------------+
|i15 : R=ring I;                                                              |
+-----------------------------------------------------------------------------+
|i16 : describe R                                                             |
|                                                                             |
|o16 = QQ[x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   ,   |
|          2,5   3,5   1,4   2,4   3,4   4,1   3,1   1,2   2,2   4,2   3,2    |
|                                                                             |
|-----------------------------------------------------------------------------|
|x   , x   , x   , x   , Degrees => {15:1}, Heft => {1}, MonomialOrder =>     |
| 1,3   2,3   4,3   3,3                                                       |
|                                                                             |
|-----------------------------------------------------------------------------|
|{MonomialSize => 32}, Global => false]                                       |
|{RevLex => 15      }                                                         |
|{Position => Up    }                                                         |
+-----------------------------------------------------------------------------+

+-----------------------------------------------------------------------------+
|i17 : Q = cellCollection {{1, 3}, {2, 2}, {2, 3}, {2, 4}, {3, 4}, {3, 3}, {3,|
|-----------------------------------------------------------------------------|
|2}, {3, 1}, {3, 5}, {4, 4}, {4, 3}, {5, 4}};                                 |
+-----------------------------------------------------------------------------+
|i18 : I = polyoIdeal(Q,RingChoice=>2);                                       |
|                                                                             |
|o18 : Ideal of QQ[x   , x   , x   , x   , x   , x   , x   , x   , x   , x   ,|
|                   3,6   4,6   3,1   4,1   2,2   3,2   4,2   1,3   5,3   2,3 |
|-----------------------------------------------------------------------------|
|x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   ]|
| 3,3   4,3   6,5   5,5   2,5   3,5   4,5   1,4   6,4   5,4   2,4   3,4   4,4 |
+-----------------------------------------------------------------------------+
|i19 : In = monomialIdeal(leadTerm(I))                                        |
|                                                                             |
|o19 = monomialIdeal (x   x   , x   x   , x   x   , x   x   , x   x   ,       |
|                      4,6 3,1   4,6 3,2   4,1 3,2   3,2 2,3   4,2 2,3        |
|      -----------------------------------------------------------------------|
|      x   x   , x   x   , x   x   , x   x   , x   x   , x   x   , x   x   ,  |
|       4,6 3,3   4,1 3,3   4,2 3,3   2,3 5,5   3,3 5,5   4,3 5,5   3,2 2,5   |
|      -----------------------------------------------------------------------|
|      x   x   , x   x   , x   x   , x   x   , x   x   , x   x   , x   x   ,  |
|       4,2 2,5   3,3 2,5   4,3 2,5   4,6 3,5   4,1 3,5   4,2 3,5   4,3 3,5   |
|      -----------------------------------------------------------------------|
|      x   x   , x   x   , x   x   , x   x   , x   x   , x   x   , x   x   ,  |
|       5,3 1,4   2,3 1,4   3,3 1,4   4,3 1,4   5,5 6,4   2,5 6,4   3,5 6,4   |
|      -----------------------------------------------------------------------|
|      x   x   , x   x   , x   x   , x   x   , x   x   , x   x   , x   x   ,  |
|       4,5 6,4   2,3 5,4   3,3 5,4   4,3 5,4   2,5 5,4   3,5 5,4   4,5 5,4   |
|      -----------------------------------------------------------------------|
|      x   x   , x   x   , x   x   , x   x   , x   x   , x   x   , x   x   ,  |
|       3,2 2,4   4,2 2,4   3,3 2,4   4,3 2,4   3,5 2,4   4,5 2,4   4,6 3,4   |
|      -----------------------------------------------------------------------|
|      x   x   , x   x   , x   x   , x   x   )                                |
|       4,1 3,4   4,2 3,4   4,3 3,4   4,5 3,4                                 |
|                                                                             |
|o19 : MonomialIdeal of QQ[x   , x   , x   , x   , x   , x   , x   , x   , x  |
|                           3,6   4,6   3,1   4,1   2,2   3,2   4,2   1,3   5,|
|-----------------------------------------------------------------------------|
| , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   , x   ,   |
|3   2,3   3,3   4,3   6,5   5,5   2,5   3,5   4,5   1,4   6,4   5,4   2,4    |
|-----------------------------------------------------------------------------|
|x   , x   ]                                                                  |
| 3,4   4,4                                                                   |
+-----------------------------------------------------------------------------+

See also
========

  * polyoIdeal -- Ideal of inner 2-minors of a collection of
    cells

Functions with optional argument named RingChoice:
==================================================

  * "polyoIdeal(...,RingChoice=>...)"

For the programmer
==================

The object RingChoice, is a symbol (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in PolyominoIdeals.m2:1942:0.