This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Two-Dimensional Pattern Languagesthanks: This document is a full version (i. e., it contains all proofs) of the conference paper [3].

Henning Fernau Fachbereich 4 – Abteilung Informatikwissenschaften, Universität Trier, 54286 Trier, Germany, {fernau,mschmid}@uni-trier.de Markus L. Schmid Fachbereich 4 – Abteilung Informatikwissenschaften, Universität Trier, 54286 Trier, Germany, {fernau,mschmid}@uni-trier.de K. G. Subramanian School of Computer Sciences, Universiti Sains Malaysia, 11800 Penang, Malaysia, kgsmani1948@yahoo.com
Abstract

We introduce several classes of array languages obtained by generalising Angluin’s pattern languages to the two-dimensional case. These classes of two-dimensional pattern languages are compared with respect to their expressive power and their closure properties are investigated.

1 Introduction

Several methods of generation of two-dimensional languages (also called array languages or picture languages) have been proposed in the literature, extending the techniques and results of formal string language theory. A picture is considered as a rectangular array of terminal symbols in the two-dimensional plane. Models based on grammars or automata as well as those based on theoretical properties of the string languages are well-known and have been extensively investigated. We refer the interested readers to books and surveys like the ones by Rosenfeld [12], Wang [15], Rosenfeld and Siromoney [13], Giammarresi and Restivo [7], or Morita [11]. For example, regular string languages (also known as recognizable string languages) can be characterized in terms of local languages and projections. Based on a similar idea, the class REC of recognizable picture languages (see Giammarresi and Restivo [6]) was proposed as a two dimensional counterpart of regular string languages. In this work, we attempt to generalise a class of string languages to the two-dimensional case, which also provides several desirable features and has therefore attracted considerable interest over the last three decades in the formal language theory community as well as in the learning theory community: Angluin’s pattern languages (see [1]).

In this context, a pattern is a string over an alphabet {x1,x2,x3,}\{x_{1},x_{2},x_{3},\ldots\} of variables, e. g., α:=x1x1x2x2x1\alpha:=x_{1}\,x_{1}\,x_{2}\,x_{2}\,x_{1}. For some finite alphabet Σ\Sigma of terminal symbols, the pattern language described by α\alpha (with respect to Σ\Sigma) is the set of all words over Σ\Sigma that can be derived from α\alpha by uniformly substituting the variables in α\alpha by (non-empty) terminal words. For example, if Σ:={𝚊,𝚋,𝚌}\Sigma:=\{\mathtt{a},\mathtt{b},\mathtt{c}\}, then u:=𝚋𝚌𝚋𝚋𝚌𝚋𝚌𝚌𝚊𝚌𝚌𝚊𝚋𝚌𝚋u:=\mathtt{b}\mathtt{c}\mathtt{b}\mathtt{b}\mathtt{c}\mathtt{b}\mathtt{c}\mathtt{c}\mathtt{a}\mathtt{c}\mathtt{c}\mathtt{a}\mathtt{b}\mathtt{c}\mathtt{b} and v:=𝚊𝚋𝚊𝚋𝚊𝚋𝚊𝚊𝚋𝚊𝚊𝚋v:=\mathtt{a}\mathtt{b}\mathtt{a}\mathtt{b}\mathtt{a}\mathtt{b}\mathtt{a}\mathtt{a}\mathtt{b}\mathtt{a}\mathtt{a}\mathtt{b} are words of the pattern language given by α\alpha, since replacing x1x_{1} by 𝚋𝚌𝚋\mathtt{b}\mathtt{c}\mathtt{b} and x2x_{2} by 𝚌𝚌𝚊\mathtt{c}\mathtt{c}\mathtt{a} turns α\alpha into uu and replacing x1x_{1} by 𝚊𝚋\mathtt{a}\mathtt{b} and x2x_{2} by 𝚊𝚋𝚊\mathtt{a}\mathtt{b}\mathtt{a} turns α\alpha into vv. On the other hand, the word 𝚌𝚊𝚋𝚊𝚌𝚊𝚋𝚊𝚋𝚊𝚋𝚊\mathtt{c}\mathtt{a}\mathtt{b}\mathtt{a}\mathtt{c}\mathtt{a}\mathtt{b}\mathtt{a}\mathtt{b}\mathtt{a}\mathtt{b}\mathtt{a} is not a member of the pattern language of α\alpha.

One of the most notable features of pattern languages is that they have natural and compact human readable descriptors (or generators), namely the patterns. In particular, this advantage becomes evident when patterns are compared to other language descriptors as, e. g., grammars or automata, which are usually quite involved even though the language they describe is rather simple. Nevertheless, patterns can compete with common automata models and grammars in terms of expressive power and their practical relevance is demonstrated by the widespread use of so-called extended regular expressions with backreferences, which implicitly use the concept of patterns and are capable of defining all pattern languages.111In fact, these extended regular expressions with backreferences are nowadays a standard element of most text editors and programming languages (cf. Friedl [5]).

The main goal of this paper is to generalise the concept of patterns as language descriptors to the two-dimensional case, while preserving the desirable features of (one-dimensional) pattern languages, i. e., the simplicity and compactness of their descriptors. The work done so far on two-dimensional languages demonstrates that there are difficulties that seem to be symptomatic for the task of generalising a class of string languages to the two-dimensional case. Firstly, such a generalisation is usually accompanied with a substantial increase in complexity of the descriptors (e. g., when extending context-free or contextual grammars to the two-dimensional case (see Fernau et al. [2], Freund et al. [4])) and, secondly, there are often many competing and seemingly different ways to generalise a specific class of string languages, which all can be considered natural (e. g., it is still on debate what the appropriate two-dimensional counterpart of the class of regular languages might be (see Giammarresi et al. [8], Matz [10])). Our two-dimensional patterns, to be introduced in this work, are as simple and compact as their one-dimensional counterparts. Although there are several different possibilities of how these two-dimensional patterns can describe two-dimensional languages, one of these sticks out as the intuitively most natural one. Hence, the model of Angluin’s pattern languages seems to be comparatively two-dimensional friendly.

Besides the conceptional contribution of this paper, we present a comparison between the expressive power of different classes of two-dimensional pattern languages and an investigation of their closure properties. We conclude the paper by outlining further research questions and possible extensions to the model of two-dimensional pattern languages.

2 Preliminaries

In this section, we briefly recall the standard definitions and notations regarding one- and two-dimensional words and languages.

Let :={1,2,3,}\mathbb{N}:=\{1,2,3,\ldots\} and let 0:={0}\mathbb{N}_{0}:=\mathbb{N}\cup\{0\}. For a finite alphabet Σ\Sigma, a string or word (over Σ\Sigma) is a finite sequence of symbols from Σ\Sigma, and ε\varepsilon stands for the empty string. The notation Σ+\Sigma^{+} denotes the set of all nonempty strings over Σ\Sigma, and Σ:=Σ+{ε}\Sigma^{*}:=\Sigma^{+}\cup\{\varepsilon\}. For the concatenation of two strings w1,w2w_{1},w_{2} we write w1w2w_{1}\cdot w_{2} or simply w1w2w_{1}w_{2}. We say that a string vΣv\in\Sigma^{*} is a factor of a string wΣw\in\Sigma^{*} if there are u1,u2Σu_{1},u_{2}\in\Sigma^{*} such that w=u1vu2w=u_{1}\cdot v\cdot u_{2}. If u1u_{1} or u2u_{2} is the empty string, then vv is a prefix (or a suffix, respectively) of ww. The notation |w||w| stands for the length of a string ww.

A two-dimensional word (or array) over Σ\Sigma is a tuple

W:=((a1,1,a1,2,,a1,n),(a2,1,a2,2,,a2,n),,(am,1,am,2,,am,n)),W:=((a_{1,1},a_{1,2},\ldots,a_{1,n}),(a_{2,1},a_{2,2},\ldots,a_{2,n}),\ldots,(a_{m,1},a_{m,2},\ldots,a_{m,n}))\,,

where m,nm,n\in\mathbb{N} and, for every ii, 1im1\leq i\leq m, and jj, 1jn1\leq j\leq n, ai,jΣa_{i,j}\in\Sigma. We define the number of columns (or width) and number of rows (or height) of WW by |W|c:=n|W|_{c}:=n and |W|r:=m|W|_{r}:=m, respectively. The empty array is denoted by λ\lambda, i. e., |λ|c=|λ|r=0|\lambda|_{c}=|\lambda|_{r}=0. For the sake of convenience, we also denote WW by [ai,j]m,n[a_{i,j}]_{m,n} or by a matrix of one of the following forms:

a1,1a1,2a1,na2,1a2,2a2,nam,1am,2am,n,[a1,1a1,2a1,na2,1a2,2a2,nam,1am,2am,n].\begin{smallmatrix}a_{1,1}&a_{1,2}&\ldots&a_{1,n}\\ a_{2,1}&a_{2,2}&\ldots&a_{2,n}\\ \vdots&\vdots&\ddots&\vdots\\ a_{m,1}&a_{m,2}&\ldots&a_{m,n}\end{smallmatrix},\>\>\>\>\>\>\begin{bmatrix}a_{1,1}&a_{1,2}&\ldots&a_{1,n}\\ a_{2,1}&a_{2,2}&\ldots&a_{2,n}\\ \vdots&\vdots&\ddots&\vdots\\ a_{m,1}&a_{m,2}&\ldots&a_{m,n}\end{bmatrix}\,.

If we want to refer to the jthj^{\text{th}} symbol in row ii of the array WW, then we use W[i,j]=ai,jW[i,j]=a_{i,j}. By Σ++\Sigma^{++}, we denote the set of all nonempty arrays over Σ\Sigma, and Σ:=Σ++{λ}\Sigma^{**}:=\Sigma^{++}\cup\{\lambda\}. Every subset LΣL\subseteq\Sigma^{**} is an array language.

Let W:=[ai,j]m,nW:=[a_{i,j}]_{m,n} and W:=[ai,j]m,nW^{\prime}:=[a^{\prime}_{i,j}]_{m^{\prime},n^{\prime}} be two non-empty arrays over Σ\Sigma. The column concatenation of WW and WW^{\prime}, denoted by WWW\varobar W^{\prime}, is undefined if mmm\neq m^{\prime} and is the array

a1,1a1,2a1,nb1,1b1,2b1,na2,1a2,2a2,nb2,1b2,2b2,nam,1am,2am,nbm,1bm,2bm,n\begin{smallmatrix}a_{1,1}&a_{1,2}&\ldots&a_{1,n}&b_{1,1}&b_{1,2}&\ldots&b_{1,n^{\prime}}\\ a_{2,1}&a_{2,2}&\ldots&a_{2,n}&b_{2,1}&b_{2,2}&\ldots&b_{2,n^{\prime}}\\ \vdots&\vdots&\ddots&\vdots&\vdots&\vdots&\ddots&\vdots\\ a_{m,1}&a_{m,2}&\ldots&a_{m,n}&b_{m^{\prime},1}&b_{m^{\prime},2}&\ldots&b_{m^{\prime},n^{\prime}}\end{smallmatrix}

otherwise. The row concatenation of WW and WW^{\prime}, denoted by WWW\varominus W^{\prime}, is undefined if nnn\neq n^{\prime} and is the array

a1,1a1,2a1,na2,1a2,2a2,nam,1am,2am,nb1,1b1,2b1,nb2,1b2,2b2,nbm,1bm,2bm,n\begin{smallmatrix}a_{1,1}&a_{1,2}&\ldots&a_{1,n}\\ a_{2,1}&a_{2,2}&\ldots&a_{2,n}\\ \vdots&\vdots&\ddots&\vdots\\ a_{m,1}&a_{m,2}&\ldots&a_{m,n}\\ b_{1,1}&b_{1,2}&\ldots&b_{1,n^{\prime}}\\ b_{2,1}&b_{2,2}&\ldots&b_{2,n^{\prime}}\\ \vdots&\vdots&\ddots&\vdots\\ b_{m^{\prime},1}&b_{m^{\prime},2}&\ldots&b_{m^{\prime},n^{\prime}}\end{smallmatrix}

otherwise. Intuitively speaking, the vertical line and the horizontal line in the symbols \varobar and \varominus, respectively, indicate the edge where the arrays are concatenated. In order to denote that, e. g., UVU\varominus V is undefined, we also write UV=undefU\varominus V=\operatorname{\texttt{undef}}.

Furthermore, for every array UU, Uλ=λU=Uλ=λU=UU\varobar\lambda=\lambda\varobar U=U\varominus\lambda=\lambda\varominus U=U and Uundef=undefU=Uundef=undefU=undefU\varobar\operatorname{\texttt{undef}}=\operatorname{\texttt{undef}}\varobar U=U\varominus\operatorname{\texttt{undef}}=\operatorname{\texttt{undef}}\varominus U=\operatorname{\texttt{undef}}. Algebraically speaking, if Σundef:=Σ{undef}\Sigma^{**}_{\operatorname{\texttt{undef}}}:=\Sigma^{**}\cup\{\operatorname{\texttt{undef}}\}, then (Σundef,,λ)(\Sigma^{**}_{\operatorname{\texttt{undef}}},\varobar,\lambda) and (Σundef,,λ)(\Sigma^{**}_{\operatorname{\texttt{undef}}},\varominus,\lambda) both form monoids with undef\operatorname{\texttt{undef}} as an absorbing element.

Example 1.

Let

W1:=[𝚊𝚋𝚊𝚋𝚌𝚊𝚊𝚋𝚋],W2:=[𝚋𝚌𝚋𝚊𝚌𝚊],W3:=[𝚊𝚋𝚌𝚌𝚋𝚋] and W4:=[𝚊𝚊𝚊𝚋].W_{1}:=\begin{bmatrix}\mathtt{a}&\mathtt{b}&\mathtt{a}\\ \mathtt{b}&\mathtt{c}&\mathtt{a}\\ \mathtt{a}&\mathtt{b}&\mathtt{b}\\ \end{bmatrix},W_{2}:=\begin{bmatrix}\mathtt{b}&\mathtt{c}\\ \mathtt{b}&\mathtt{a}\\ \mathtt{c}&\mathtt{a}\end{bmatrix},W_{3}:=\begin{bmatrix}\mathtt{a}&\mathtt{b}&\mathtt{c}\\ \mathtt{c}&\mathtt{b}&\mathtt{b}\end{bmatrix}\text{ and }W_{4}:=\begin{bmatrix}\mathtt{a}&\mathtt{a}\\ \mathtt{a}&\mathtt{b}\end{bmatrix}\,.

Then W1W2W_{1}\varominus W_{2} and W1W3=undefW_{1}\varobar W_{3}=\operatorname{\texttt{undef}}, but

W1W2=[𝚊𝚋𝚊𝚋𝚌𝚋𝚌𝚊𝚋𝚊𝚊𝚋𝚋𝚌𝚊] and W1W3=[𝚊𝚋𝚊𝚋𝚌𝚊𝚊𝚋𝚋𝚊𝚋𝚌𝚌𝚋𝚋].W_{1}\varobar W_{2}=\begin{bmatrix}\mathtt{a}&\mathtt{b}&\mathtt{a}&\mathtt{b}&\mathtt{c}\\ \mathtt{b}&\mathtt{c}&\mathtt{a}&\mathtt{b}&\mathtt{a}\\ \mathtt{a}&\mathtt{b}&\mathtt{b}&\mathtt{c}&\mathtt{a}\end{bmatrix}\text{ and }W_{1}\varominus W_{3}=\begin{bmatrix}\mathtt{a}&\mathtt{b}&\mathtt{a}\\ \mathtt{b}&\mathtt{c}&\mathtt{a}\\ \mathtt{a}&\mathtt{b}&\mathtt{b}\\ \mathtt{a}&\mathtt{b}&\mathtt{c}\\ \mathtt{c}&\mathtt{b}&\mathtt{b}\end{bmatrix}\,.
Example 2.

Let W1,W2,W3W_{1},W_{2},W_{3} and W4W_{4} be defined as in Example 1.

(W1W2)(W3W4)=(W1W3)(W2W4)=[𝚊𝚋𝚊𝚋𝚌𝚋𝚌𝚊𝚋𝚊𝚊𝚋𝚋𝚌𝚊𝚊𝚋𝚌𝚊𝚊𝚌𝚋𝚋𝚊𝚋],\displaystyle(W_{1}\varobar W_{2})\varominus(W_{3}\varobar W_{4})=(W_{1}\varominus W_{3})\varobar(W_{2}\varominus W_{4})=\begin{bmatrix}\mathtt{a}&\mathtt{b}&\mathtt{a}&\mathtt{b}&\mathtt{c}\\ \mathtt{b}&\mathtt{c}&\mathtt{a}&\mathtt{b}&\mathtt{a}\\ \mathtt{a}&\mathtt{b}&\mathtt{b}&\mathtt{c}&\mathtt{a}\\ \mathtt{a}&\mathtt{b}&\mathtt{c}&\mathtt{a}&\mathtt{a}\\ \mathtt{c}&\mathtt{b}&\mathtt{b}&\mathtt{a}&\mathtt{b}\end{bmatrix}\,,
(W1W2)(W4W3)=[𝚊𝚋𝚊𝚋𝚌𝚋𝚌𝚊𝚋𝚊𝚊𝚋𝚋𝚌𝚊𝚊𝚊𝚊𝚋𝚌𝚊𝚋𝚌𝚋𝚋],(W1W4)(W2W3)=undef.\displaystyle(W_{1}\varobar W_{2})\varominus(W_{4}\varobar W_{3})=\begin{bmatrix}\mathtt{a}&\mathtt{b}&\mathtt{a}&\mathtt{b}&\mathtt{c}\\ \mathtt{b}&\mathtt{c}&\mathtt{a}&\mathtt{b}&\mathtt{a}\\ \mathtt{a}&\mathtt{b}&\mathtt{b}&\mathtt{c}&\mathtt{a}\\ \mathtt{a}&\mathtt{a}&\mathtt{a}&\mathtt{b}&\mathtt{c}\\ \mathtt{a}&\mathtt{b}&\mathtt{c}&\mathtt{b}&\mathtt{b}\end{bmatrix}\,,\>\>(W_{1}\varominus W_{4})\varobar(W_{2}\varominus W_{3})=\operatorname{\texttt{undef}}\,.

Next, we define some operations for array languages. The row and column concatenation for array languages L1L_{1} and L2L_{2} is defined by L1L2:={UVUL1,VL2,UVundef}L_{1}\varominus L_{2}:=\{U\varominus V\mid U\in L_{1},V\in L_{2},U\varominus V\neq\operatorname{\texttt{undef}}\} and L1L2:={UVUL1,VL2,UVundef}L_{1}\varobar L_{2}:=\{U\varobar V\mid U\in L_{1},V\in L_{2},U\varobar V\neq\operatorname{\texttt{undef}}\}, respectively. For an array language LL and kk\in\mathbb{N}, LkL^{\varominus k} denotes the kk-fold row concatenation of LL, i. e., Lk:=L1L2LkL^{\varominus k}:=L_{1}\varominus L_{2}\varominus\ldots\varominus L_{k}, Li=LL_{i}=L, 1ik1\leq i\leq k. The kk-fold column concatenation, denoted by LkL^{\varobar k}, is defined analogously. The row and column concatenation closure of an array language LL is defined by L:=k=1LkL^{\varominus*}:=\bigcup_{k=1}^{\infty}L^{\varominus k} and L:=k=1LkL^{\varobar*}:=\bigcup_{k=1}^{\infty}L^{\varobar k}, respectively. Obviously, the row and column concatenation closure of an array language correspond to the Kleene closure of a string language.

Now, we turn our attention to some geometric operations for arrays. The transposition of an array UU, denoted by UT{U}^{\texttt{T}}, is obtained by reflecting UU along the main diagonal. The \varominus-reflection and \varobar-reflection of UU, denoted by URU^{\varominus\texttt{R}} and URU^{\varobar\texttt{R}}, respectively, are obtained by reflecting UU along the horizontal and vertical axis, respectively. The right turn and left turn of UU, denoted by UU^{\curvearrowright} and UU^{\curvearrowleft}, respectively, is obtained by turning UU through 9090 degrees to the right and to the left, respectively. For example, if U:=[𝚊𝚋𝚌𝚍𝚎𝚏𝚐𝚑]U:=\begin{bmatrix}\mathtt{a}&\mathtt{b}&\mathtt{c}&\mathtt{d}\\ \mathtt{e}&\mathtt{f}&\mathtt{g}&\mathtt{h}\end{bmatrix}, then

UT=[𝚊𝚎𝚋𝚏𝚌𝚐𝚍𝚑],UR=[𝚎𝚏𝚐𝚑𝚊𝚋𝚌𝚍],UR=[𝚍𝚌𝚋𝚊𝚑𝚐𝚏𝚎],U=[𝚎𝚊𝚏𝚋𝚐𝚌𝚑𝚍],U=[𝚍𝚑𝚌𝚐𝚋𝚏𝚊𝚎],(U)=[𝚑𝚐𝚏𝚎𝚍𝚌𝚋𝚊].\displaystyle{U}^{\texttt{T}}=\begin{bmatrix}\mathtt{a}&\mathtt{e}\\ \mathtt{b}&\mathtt{f}\\ \mathtt{c}&\mathtt{g}\\ \mathtt{d}&\mathtt{h}\\ \end{bmatrix}\,,U^{\varominus\texttt{R}}=\begin{bmatrix}\mathtt{e}&\mathtt{f}&\mathtt{g}&\mathtt{h}\\ \mathtt{a}&\mathtt{b}&\mathtt{c}&\mathtt{d}\\ \end{bmatrix}\,,U^{\varobar\texttt{R}}=\begin{bmatrix}\mathtt{d}&\mathtt{c}&\mathtt{b}&\mathtt{a}\\ \mathtt{h}&\mathtt{g}&\mathtt{f}&\mathtt{e}\\ \end{bmatrix}\,,U^{\curvearrowright}=\begin{bmatrix}\mathtt{e}&\mathtt{a}\\ \mathtt{f}&\mathtt{b}\\ \mathtt{g}&\mathtt{c}\\ \mathtt{h}&\mathtt{d}\\ \end{bmatrix}\,,U^{\curvearrowleft}=\begin{bmatrix}\mathtt{d}&\mathtt{h}\\ \mathtt{c}&\mathtt{g}\\ \mathtt{b}&\mathtt{f}\\ \mathtt{a}&\mathtt{e}\\ \end{bmatrix}\,,(U^{\curvearrowright})^{\curvearrowright}=\begin{bmatrix}\mathtt{h}&\mathtt{g}&\mathtt{f}&\mathtt{e}\\ \mathtt{d}&\mathtt{c}&\mathtt{b}&\mathtt{a}\end{bmatrix}\,.

We address left and right turn also as quarter-turns below. Moreover, the twofold right turn (displayed right-most in the example above) is also known as a half-turn.

A special operation considered in the context of arrays is the conjugation of an array UΣU\in\Sigma^{**} with |Σ|=2|\Sigma|=2, denoted by UCU^{\texttt{C}}, which means that the two symbols of Σ\Sigma are exchanged in UU, e. g., ([𝚊𝚋𝚊𝚊𝚋𝚊𝚊𝚋])C=[𝚋𝚊𝚋𝚋𝚊𝚋𝚋𝚊]\left(\begin{bmatrix}\mathtt{a}&\mathtt{b}&\mathtt{a}&\mathtt{a}\\ \mathtt{b}&\mathtt{a}&\mathtt{a}&\mathtt{b}\\ \end{bmatrix}\right)^{\texttt{C}}=\begin{bmatrix}\mathtt{b}&\mathtt{a}&\mathtt{b}&\mathtt{b}\\ \mathtt{a}&\mathtt{b}&\mathtt{b}&\mathtt{a}\\ \end{bmatrix}. This can be also viewed as a quite restricted form of a two-dimensional morphism defined in the next section.

All these operations for arrays are extended to array languages in the obvious way.

Next, we briefly summarise the concept of (one-dimensional) pattern languages as introduced in [1] by Angluin. Technically, the version of pattern languages used here are called nonerasing terminal-free pattern languages (for an overview of different versions of one-dimensional pattern languages, the reader is referred to [9] by Mateescu and Salomaa).

A (one-dimensional) pattern is a string over an alphabet X:={x1,x2,x3,}X:=\{x_{1},x_{2},x_{3},\ldots\} of variables, e. g., α:=x1x1x2x2x1\alpha:=x_{1}\,x_{1}\,x_{2}\,x_{2}\,x_{1}. In Section 1, we have seen an intuitive definition of the language described by a pattern α\alpha. This intuition can be formalised in an elegant way by using the concept of (word) morphisms, i. e., mappings h:Σ1+Σ2+h:\Sigma_{1}^{+}\rightarrow\Sigma_{2}^{+}, which satisfy h(uv)=h(u)h(v)h(u\,v)=h(u)\,h(v), for all u,vΣ1+u,v\in\Sigma_{1}^{+}. In this regard, for some finite alphabet Σ\Sigma, the (one-dimensional) pattern language of α\alpha (with respect to Σ\Sigma) is the set LΣ1D(α):={h(α)h:X+Σ+ is a morphism}L^{\operatorname{\texttt{1D}}}_{\Sigma}(\alpha):=\{h(\alpha)\mid h:X^{+}\rightarrow\Sigma^{+}\text{ is a morphism}\}. An alternative, yet equivalent, way to define pattern languages is by means of factorisations. To this end, let α:=y1y2yn\alpha:=y_{1}\,y_{2}\ldots y_{n}, yiXy_{i}\in X, 1in1\leq i\leq n. Then LΣ1D(α)L^{\operatorname{\texttt{1D}}}_{\Sigma}(\alpha) is the set of all words wΣ+w\in\Sigma^{+} that have a characteristic factorisation for α\alpha, i. e., a factorisation w=u1u2unw=u_{1}\,u_{2}\cdots u_{n}, such that, for every ii, 1ijn1\leq i\leq j\leq n, yi=yjy_{i}=y_{j} implies ui=uju_{i}=u_{j}. It can be easily seen, that these two definitions are equivalent. However, for the two-dimensional case, we shall see that a generalisation of these two approaches will lead to different versions of two-dimensional pattern languages. The class of all one-dimensional pattern languages over the alphabet Σ\Sigma is denoted by Σ1D\mathcal{L}^{\operatorname{\texttt{1D}}}_{\Sigma}. We recall the example pattern α=x1x1x2x2x1\alpha=x_{1}\,x_{1}\,x_{2}\,x_{2}\,x_{1} and the words u:=𝚋𝚌𝚋𝚋𝚌𝚋𝚌𝚌𝚊𝚌𝚌𝚊𝚋𝚌𝚋u:=\mathtt{b}\mathtt{c}\mathtt{b}\mathtt{b}\mathtt{c}\mathtt{b}\mathtt{c}\mathtt{c}\mathtt{a}\mathtt{c}\mathtt{c}\mathtt{a}\mathtt{b}\mathtt{c}\mathtt{b} and v:=𝚊𝚋𝚊𝚋𝚊𝚋𝚊𝚊𝚋𝚊𝚊𝚋v:=\mathtt{a}\mathtt{b}\mathtt{a}\mathtt{b}\mathtt{a}\mathtt{b}\mathtt{a}\mathtt{a}\mathtt{b}\mathtt{a}\mathtt{a}\mathtt{b} of Section 1 Since h(α)=uh(\alpha)=u and g(α)=vg(\alpha)=v, where hh and gg are the morphisms induced by h(x1):=𝚋𝚌𝚋h(x_{1}):=\mathtt{b}\mathtt{c}\mathtt{b}, h(x2):=𝚌𝚌𝚊h(x_{2}):=\mathtt{c}\mathtt{c}\mathtt{a} and g(x1):=𝚊𝚋g(x_{1}):=\mathtt{a}\mathtt{b}, g(x2):=𝚊𝚋𝚊g(x_{2}):=\mathtt{a}\mathtt{b}\mathtt{a}, we can conclude that u,vLΣ1D(α)u,v\in L^{\operatorname{\texttt{1D}}}_{\Sigma}(\alpha), where Σ:={𝚊,𝚋,𝚌}\Sigma:=\{\mathtt{a},\mathtt{b},\mathtt{c}\}.

3 Two-Dimensional Pattern Languages

As already mentioned, this work deals with the task of generalising pattern languages from the one-dimensional to the two-dimensional case. In order to motivate our approach to solve this task, we first spent some effort on illustrating the general difficulties and obstacles that arise.

Abstractly speaking, a pattern language for a given pattern α\alpha is the collection of all elements that satisfy α\alpha. Thus, a sound definition of how elements satisfy patterns directly entails a sound definition of a class of pattern languages. In the one-dimensional case, the situation that a word satisfies a pattern is intuitively clear and it can be defined in several equivalent ways, i. e., a word ww satisfies the pattern α\alpha if and only if

  • ww can be derived from α\alpha by uniformly substituting the variables in α\alpha,

  • ww is a morphic image of α\alpha,

  • ww has a characteristic factorisation for α\alpha.

We shall now demonstrate that for a two-dimensional pattern, i. e., a two-dimensional word over the set of variables XX, e. g., α:=[x1x2x3x1]\alpha:=\begin{bmatrix}x_{1}&x_{2}\\ x_{3}&x_{1}\end{bmatrix}, these concepts do not work anymore or they describe fundamentally different situations. For instance, the basic operation of substituting a single symbol in a word by another word cannot that easily be extended to the two-dimensional case. For example, the replacements x1[𝚊𝚊],x2[𝚌𝚌]x_{1}\mapsto\begin{bmatrix}\mathtt{a}&\mathtt{a}\end{bmatrix},x_{2}\mapsto\begin{bmatrix}\mathtt{c}\\ \mathtt{c}\end{bmatrix} and x3[𝚋]x_{3}\mapsto\begin{bmatrix}\mathtt{b}\end{bmatrix} may turn α\alpha into one of the following objects,

[𝚌𝚊𝚊𝚌𝚋𝚊𝚊],[𝚊𝚊𝚌𝚌𝚋𝚊𝚊],[𝚌𝚊𝚊𝚌𝚋𝚊𝚊],[𝚌𝚊𝚊𝚌𝚋𝚊𝚊],\begin{bmatrix}&&\mathtt{c}&\\ \mathtt{a}&\mathtt{a}&\mathtt{c}&\\ &\mathtt{b}&\mathtt{a}&\mathtt{a}\end{bmatrix},\begin{bmatrix}\mathtt{a}&\mathtt{a}&\mathtt{c}\\ &&\mathtt{c}\\ \mathtt{b}&\mathtt{a}&\mathtt{a}\end{bmatrix},\begin{bmatrix}&&\mathtt{c}\\ \mathtt{a}&\mathtt{a}&\mathtt{c}\\ \mathtt{b}&\mathtt{a}&\mathtt{a}\end{bmatrix},\begin{bmatrix}&&&\mathtt{c}\\ \mathtt{a}&\mathtt{a}&&\mathtt{c}\\ &\mathtt{b}&\mathtt{a}&\mathtt{a}\end{bmatrix},

which are not two-dimensional words, since they all contain holes or are not of rectangular shape and, most importantly, are not uniquely defined. On the other hand, it is straightforward to generalise the concept of a morphism to the two-dimensional case:

Definition 1.

A mapping h:Σ1++Σ2++h:\Sigma_{1}^{++}\rightarrow\Sigma_{2}^{++} is a two-dimensional morphism if it satisfies h(VW)=h(V)h(W)h(V\varobar W)=h(V)\varobar h(W) and h(VW)=h(V)h(W)h(V\varominus W)=h(V)\varominus h(W) for all V,WΣ1++V,W\in\Sigma_{1}^{++}.

Hence, we may say that a two-dimensional word WW satisfies a two-dimensional pattern α\alpha if and only if there exists a two-dimensional morphism which maps α\alpha to WW. Unfortunately, this definition seems to be too strong as demonstrated by the following example. From an intuitive point of view, the two-dimensional word W:=[𝚊𝚊𝚋𝚊𝚊𝚋𝚊𝚊𝚋𝚊𝚊𝚋𝚌𝚌𝚌𝚌𝚌𝚌]W:=\begin{bmatrix}\mathtt{a}&\mathtt{a}&\mathtt{b}&\mathtt{a}&\mathtt{a}&\mathtt{b}\\ \mathtt{a}&\mathtt{a}&\mathtt{b}&\mathtt{a}&\mathtt{a}&\mathtt{b}\\ \mathtt{c}&\mathtt{c}&\mathtt{c}&\mathtt{c}&\mathtt{c}&\mathtt{c}\end{bmatrix} should satisfy the two-dimensional pattern α:=[x1x1x2x2]\alpha:=\begin{bmatrix}x_{1}&x_{1}\\ x_{2}&x_{2}\end{bmatrix}, but there is no two-dimensional morphism mapping α\alpha to WW. This is due to the fact that, as pointed out by the following proposition (which has also been mentioned by Siromoney et al. in [14]), a two-dimensional morphism is a mapping with a surprisingly strong condition.

Proposition 1.

Let Σ1:={a1,a2,,ak}\Sigma_{1}:=\{a_{1},a_{2},\ldots,a_{k}\} and Σ2\Sigma_{2} be alphabets. If a mapping h:Σ1++Σ2++h:\Sigma_{1}^{++}\rightarrow\Sigma_{2}^{++} is a two-dimensional morphism, then

|h([a1])|c=|h([a2])|c==|h([ak])|c and |h([a1])|r=|h([a2])|r==|h([ak])|r.|h(\begin{bmatrix}a_{1}\end{bmatrix})|_{c}=|h(\begin{bmatrix}a_{2}\end{bmatrix})|_{c}=\ldots=|h(\begin{bmatrix}a_{k}\end{bmatrix})|_{c}\text{ and }|h(\begin{bmatrix}a_{1}\end{bmatrix})|_{r}=|h(\begin{bmatrix}a_{2}\end{bmatrix})|_{r}=\ldots=|h(\begin{bmatrix}a_{k}\end{bmatrix})|_{r}\,.
Proof.

We prove the statement of the proposition by contraposition. To this end, we assume that, for some i,ji,j, 1i<jk1\leq i<j\leq k, |h([ai])|r|h([aj])|r|h(\begin{bmatrix}a_{i}\end{bmatrix})|_{r}\neq|h(\begin{bmatrix}a_{j}\end{bmatrix})|_{r}, which implies h([ai])h([aj])=undefh(\begin{bmatrix}a_{i}\end{bmatrix})\varobar h(\begin{bmatrix}a_{j}\end{bmatrix})=\operatorname{\texttt{undef}}. Hence, since h([ai][aj])=h([aiaj])Σ2++h(\begin{bmatrix}a_{i}\end{bmatrix}\varobar\begin{bmatrix}a_{j}\end{bmatrix})=h(\begin{bmatrix}a_{i}&a_{j}\end{bmatrix})\in\Sigma_{2}^{++}, we can conclude that h([ai][aj])h([ai])h([aj])h(\begin{bmatrix}a_{i}\end{bmatrix}\varobar\begin{bmatrix}a_{j}\end{bmatrix})\neq h(\begin{bmatrix}a_{i}\end{bmatrix})\varobar h(\begin{bmatrix}a_{j}\end{bmatrix}), which contradicts the morphism property. Similarly, if |h([ai])|c|h([aj])|c|h(\begin{bmatrix}a_{i}\end{bmatrix})|_{c}\neq|h(\begin{bmatrix}a_{j}\end{bmatrix})|_{c}, then h([ai][aj])h([ai])h([aj])h(\begin{bmatrix}a_{i}\end{bmatrix}\varominus\begin{bmatrix}a_{j}\end{bmatrix})\neq h(\begin{bmatrix}a_{i}\end{bmatrix})\varominus h(\begin{bmatrix}a_{j}\end{bmatrix}). ∎

Similarly as in the string case, homomorphisms h:Σ1++Σ2++h:\Sigma_{1}^{++}\rightarrow\Sigma_{2}^{++} are uniquely defined by giving the images h(Σ1)h(\Sigma_{1}). If in particular h(Σ1)Σ2h(\Sigma_{1})\subseteq\Sigma_{2}, we term the resulting morphism a letter-to-letter morphism, while in the even more restricted case when the restriction hΣ1h_{\Sigma_{1}} of hh to Σ1\Sigma_{1} yields a surjective mapping hΣ1:Σ1Σ2h_{\Sigma_{1}}:\Sigma_{1}\to\Sigma_{2}, hh is referred to as a projection. We can conclude that the existence of a two-dimensional morphism seems to be a reasonable sufficient criterion for the situation that a two-dimensional word satisfies a two-dimensional pattern, but not a necessary one.

In fact, it turns out that characteristic factorisations provide the most promising approach to formalise how a two-dimensional word satisfies a two-dimensional pattern. Recall the example pattern α=[x1x1x2x2]\alpha=\begin{bmatrix}x_{1}&x_{1}\\ x_{2}&x_{2}\end{bmatrix} from above. Since α=([x1][x1])([x2][x2])\alpha=(\begin{bmatrix}x_{1}\end{bmatrix}\varobar\begin{bmatrix}x_{1}\end{bmatrix})\varominus(\begin{bmatrix}x_{2}\end{bmatrix}\varobar\begin{bmatrix}x_{2}\end{bmatrix}), a characteristic factorisation of a two-dimensional word UU for α\alpha is a factorisation of the form U=(V1V1)(V2V2)U=(V_{1}\varobar V_{1})\varominus(V_{2}\varobar V_{2}). On the other hand, since α=([x1][x2])([x1][x2])\alpha=(\begin{bmatrix}x_{1}\end{bmatrix}\varominus\begin{bmatrix}x_{2}\end{bmatrix})\varobar(\begin{bmatrix}x_{1}\end{bmatrix}\varominus\begin{bmatrix}x_{2}\end{bmatrix}), we could as well regard a factorisation U=(V1V2)(V1V2)U=(V_{1}\varominus V_{2})\varobar(V_{1}\varominus V_{2}) as characteristic for α\alpha. For the sake of convenience, we say that the former factorisation is of column-row type and the latter one is of row-column type. Obviously, the two-dimensional word WW from above has a characteristic factorisation of column-row type and a characteristic factorisation of row-column type (with respect to α\alpha):

W=(V1V1)(V2V2)=([𝚊𝚊𝚋𝚊𝚊𝚋][𝚊𝚊𝚋𝚊𝚊𝚋])([𝚌𝚌𝚌][𝚌𝚌𝚌])=[𝚊𝚊𝚋𝚊𝚊𝚋𝚊𝚊𝚋𝚊𝚊𝚋𝚌𝚌𝚌𝚌𝚌𝚌],\displaystyle W=(V_{1}\varobar V_{1})\varominus(V_{2}\varobar V_{2})=(\begin{bmatrix}\mathtt{a}&\mathtt{a}&\mathtt{b}\\ \mathtt{a}&\mathtt{a}&\mathtt{b}\end{bmatrix}\varobar\begin{bmatrix}\mathtt{a}&\mathtt{a}&\mathtt{b}\\ \mathtt{a}&\mathtt{a}&\mathtt{b}\end{bmatrix})\varominus(\begin{bmatrix}\mathtt{c}&\mathtt{c}&\mathtt{c}\end{bmatrix}\varobar\begin{bmatrix}\mathtt{c}&\mathtt{c}&\mathtt{c}\end{bmatrix})=\begin{bmatrix}\mathtt{a}&\mathtt{a}&\mathtt{b}&\mathtt{a}&\mathtt{a}&\mathtt{b}\\ \mathtt{a}&\mathtt{a}&\mathtt{b}&\mathtt{a}&\mathtt{a}&\mathtt{b}\\ \mathtt{c}&\mathtt{c}&\mathtt{c}&\mathtt{c}&\mathtt{c}&\mathtt{c}\end{bmatrix}\,,
W=(V1V2)(V1V2)=([𝚊𝚊𝚋𝚊𝚊𝚋][𝚌𝚌𝚌])([𝚊𝚊𝚋𝚊𝚊𝚋][𝚌𝚌𝚌])=[𝚊𝚊𝚋𝚊𝚊𝚋𝚊𝚊𝚋𝚊𝚊𝚋𝚌𝚌𝚌𝚌𝚌𝚌].\displaystyle W=(V_{1}\varominus V_{2})\varobar(V_{1}\varominus V_{2})=(\begin{bmatrix}\mathtt{a}&\mathtt{a}&\mathtt{b}\\ \mathtt{a}&\mathtt{a}&\mathtt{b}\end{bmatrix}\varominus\begin{bmatrix}\mathtt{c}&\mathtt{c}&\mathtt{c}\end{bmatrix})\varobar(\begin{bmatrix}\mathtt{a}&\mathtt{a}&\mathtt{b}\\ \mathtt{a}&\mathtt{a}&\mathtt{b}\end{bmatrix}\varominus\begin{bmatrix}\mathtt{c}&\mathtt{c}&\mathtt{c}\end{bmatrix})=\begin{bmatrix}\mathtt{a}&\mathtt{a}&\mathtt{b}&\mathtt{a}&\mathtt{a}&\mathtt{b}\\ \mathtt{a}&\mathtt{a}&\mathtt{b}&\mathtt{a}&\mathtt{a}&\mathtt{b}\\ \mathtt{c}&\mathtt{c}&\mathtt{c}&\mathtt{c}&\mathtt{c}&\mathtt{c}\end{bmatrix}\,.

As a matter of fact, for every two-dimensional word UU there exists a characteristic factorisation for α=[x1x1x2x2]\alpha=\begin{bmatrix}x_{1}&x_{1}\\ x_{2}&x_{2}\end{bmatrix} of column-row type if and only if there exists a characteristic factorisation for α\alpha of row-column type. However, this is a particularity of α\alpha and, e. g., for α=[x1x2x3x2x3x1]\alpha^{\prime}=\begin{bmatrix}x_{1}&x_{2}&x_{3}\\ x_{2}&x_{3}&x_{1}\end{bmatrix} and W:=[𝚊𝚊𝚊𝚋𝚌𝚋𝚌𝚊𝚊𝚊]W^{\prime}:=\begin{bmatrix}\mathtt{a}&\mathtt{a}&\mathtt{a}&\mathtt{b}&\mathtt{c}\\ \mathtt{b}&\mathtt{c}&\mathtt{a}&\mathtt{a}&\mathtt{a}\\ \end{bmatrix}, there exists a characteristic factorisation of column-row type W=(V1V2V3)(V2V3V1)=([𝚊𝚊𝚊][𝚋][𝚌])([𝚋][𝚌][𝚊𝚊𝚊])W^{\prime}=(V_{1}\varobar V_{2}\varobar V_{3})\varominus(V_{2}\varobar V_{3}\varobar V_{1})=(\begin{bmatrix}\mathtt{a}&\mathtt{a}&\mathtt{a}\end{bmatrix}\varobar\begin{bmatrix}\mathtt{b}\end{bmatrix}\varobar\begin{bmatrix}\mathtt{c}\end{bmatrix})\varominus(\begin{bmatrix}\mathtt{b}\end{bmatrix}\varobar\begin{bmatrix}\mathtt{c}\end{bmatrix}\varobar\begin{bmatrix}\mathtt{a}&\mathtt{a}&\mathtt{a}\end{bmatrix}), but no characteristic factorisation of row-column type. Furthermore, the column-row factorisation of WW^{\prime} is somewhat at odds with our intuitive understanding of what it means that a two-dimensional word satisfies a two-dimensional pattern. This is due to the fact that factorising WW^{\prime} into ([𝚊𝚊𝚊][𝚋][𝚌])([𝚋][𝚌][𝚊𝚊𝚊])(\begin{bmatrix}\mathtt{a}&\mathtt{a}&\mathtt{a}\end{bmatrix}\varobar\begin{bmatrix}\mathtt{b}\end{bmatrix}\varobar\begin{bmatrix}\mathtt{c}\end{bmatrix})\varominus(\begin{bmatrix}\mathtt{b}\end{bmatrix}\varobar\begin{bmatrix}\mathtt{c}\end{bmatrix}\varobar\begin{bmatrix}\mathtt{a}&\mathtt{a}&\mathtt{a}\end{bmatrix}) means that we associate the two-dimensional factors [𝚊𝚊𝚊]\begin{bmatrix}\mathtt{a}&\mathtt{a}&\mathtt{a}\end{bmatrix}, [𝚋]\begin{bmatrix}\mathtt{b}\end{bmatrix} and [𝚌]\begin{bmatrix}\mathtt{c}\end{bmatrix} with the variables x1x_{1}, x2x_{2} and x3x_{3}, respectively, but in the pattern α\alpha^{\prime} the vertical neighbourship relation between the occurrence of x2x_{2} in the first row and the occurrence of x3x_{3} in the second row is not preserved in WW^{\prime} with respect to the corresponding two-dimensional factors [𝚋]\begin{bmatrix}\mathtt{b}\end{bmatrix} and [𝚌]\begin{bmatrix}\mathtt{c}\end{bmatrix}. More precisely, while a column-row factorisation preserves the horizontal neighbourship relation of the variables, it may violate their vertical neighbourship relation, where for row-column factorisations it is the other way around. Consequently, if we want both the vertical as well as the horizontal neighbourship relation to be preserved, we should require that the two-dimensional word UU can be disassembled into two-dimensional factors that induce both a column-row as well as a row-column factorisation. More precisely, we say that UU satisfies α=[x1x2x3x2x3x1]\alpha^{\prime}=\begin{bmatrix}x_{1}&x_{2}&x_{3}\\ x_{2}&x_{3}&x_{1}\end{bmatrix} if and only if there exist two-dimensional words V1,V2V_{1},V_{2} and V3V_{3}, such that U=(V1V2V3)(V2V3V1)=(V1V2)(V2V3)(V3V1)U=(V_{1}\varobar V_{2}\varobar V_{3})\varominus(V_{2}\varobar V_{3}\varobar V_{1})=(V_{1}\varominus V_{2})\varobar(V_{2}\varominus V_{3})\varobar(V_{3}\varominus V_{1}), which we call a proper characteristic factorisation of UU.

We are now ready to formalise the ideas developed so far and we can finally give a sound definition of two-dimensional pattern languages. Although we consider the class of two-dimensional pattern languages that results from the proper characteristic factorisations as the natural two-dimensional counterpart of the class of one-dimensional pattern languages, we shall also define the other classes of two-dimensional pattern languages which were sketched above.

For the definition of two-dimensional patterns, we use the same set of variables XX that has already been used in the definition of one-dimensional pattern languages. An array pattern is a non-empty two-dimensional word over XX and a terminal array is a non-empty two-dimensional word over a terminal alphabet Σ\Sigma. If it is clear from the context that we are concerned with array patterns and terminal arrays, then we simply say pattern and array, respectively. Any mapping h:XΣ++h:X\rightarrow\Sigma^{++} is called a substitution. For any substitution hh, by h,h_{\varobar,\varominus}, we denote the mapping X++Σ++X^{++}\rightarrow\Sigma^{++} defined in the following way. For any α:=[yi,j]m,nX++\alpha:=[y_{i,j}]_{m,n}\in X^{++}, we define

h,(α):=\displaystyle h_{\varobar,\varominus}(\alpha):=\> (h(y1,1)h(y1,2)h(y1,n))\displaystyle(h(y_{1,1})\varobar h(y_{1,2})\varobar\ldots\varobar h(y_{1,n}))\varominus
(h(y2,1)h(y2,2)h(y2,n))\displaystyle(h(y_{2,1})\varobar h(y_{2,2})\varobar\ldots\varobar h(y_{2,n}))\varominus\ldots\varominus
(h(ym,1)h(ym,2)h(ym,n)).\displaystyle(h(y_{m,1})\varobar h(y_{m,2})\varobar\ldots\varobar h(y_{m,n}))\,.

Similarly, h,:X++Σ++h_{\varominus,\varobar}:X^{++}\rightarrow\Sigma^{++} is defined by

h,(α):=\displaystyle h_{\varominus,\varobar}(\alpha):=\> (h(y1,1)h(y2,1)h(ym,1))\displaystyle(h(y_{1,1})\varominus h(y_{2,1})\varominus\ldots\varominus h(y_{m,1}))\varobar
(h(y1,2)h(y2,2)h(ym,2))\displaystyle(h(y_{1,2})\varominus h(y_{2,2})\varominus\ldots\varominus h(y_{m,2}))\varobar\ldots\varobar
(h(y1,n)h(y2,n)h(ym,n)).\displaystyle(h(y_{1,n})\varominus h(y_{2,n})\varominus\ldots\varominus h(y_{m,n}))\,.

Intuitively speaking, both mappings h,h_{\varobar,\varominus} and h,h_{\varobar,\varominus}, when applied to an array pattern α\alpha, first substitute every variable occurrence of α\alpha by a terminal array according to the substitution hh and then these m×nm\times n individual terminal arrays are assembled to one terminal array by either first column-concatenating all the nn terminal arrays in every individual row and then row-concatenating the resulting mm terminal arrays, or by first row-concatenating all the mm terminal arrays in every individual column and then column-concatenating the resulting nn terminal arrays.

Let αX++\alpha\in X^{++}, WΣ++W\in\Sigma^{++} and let h:XΣ++h:X\rightarrow\Sigma^{++}. The array WW is a (1) column-row image of α\alpha (with respect to hh), (2) a row-column image of α\alpha (with respect to hh) or (3) a proper image of α\alpha (with respect to hh) if and only if (1) h,(α)=Wh_{\varobar,\varominus}(\alpha)=W, (2) h,(α)=Wh_{\varominus,\varobar}(\alpha)=W or (3) h,(α)=h,(α)=Wh_{\varobar,\varominus}(\alpha)=h_{\varominus,\varobar}(\alpha)=W, respectively. The mapping hh is called a column-row substitution for α\alpha and WW, a row-column substitution for α\alpha and WW or a proper substitution for α\alpha and WW, respectively. We say that WW is a column-row, a row-column or a proper image of α\alpha if there exists a column-row, a row-column or a proper substitution, respectively, for α\alpha and WW.

A nice and intuitive way to interpret the different kinds of images of array patterns is to imagine a grid to be placed over the terminal array. The vertical lines of the grid represent a column concatenation and the horizontal lines of the grid represent a row concatenation of the corresponding factorisation. This means that every rectangular area of the grid corresponds to an occurrence of a variable xx in the array pattern or, more precisely, to the array h(x)h(x) substituted for xx. The fact that an array satisfies a pattern is then represented by the situation that each two rectangular areas of the grid that correspond to occurrences of the same variable must have identical content. In Figure 1, an example for each a morphic image, a proper image, a column-row image and a row-column image of a 5×45\times 4 pattern is represented in this illustrative way.

morphic imageproper imagecolumn-row imagerow-column image
Figure 1: Illustrating possible image partitions.

Alternatively, we can interpret the property that a terminal array WW is a certain type of image of an array pattern as a tiling of WW. More precisely, WW satisfies a given array pattern α\alpha with nn different variables if and only if nn tiles can be allocated to the nn variables of α\alpha such that combining the tiles as indicated by the structure of α\alpha yields WW. The grids depicted in Figure 1 then illustrate the structure of such a tiling. The definitions of the corresponding classes of pattern languages are now straightforward:

Definition 2.

Let αX++\alpha\in X^{++} be an array pattern. We define the following variants of two-dimensional pattern languages:

  • LΣ,h(α):={WΣW is a morphic image of α}L_{\Sigma,h}(\alpha):=\{W\in\Sigma^{**}\mid W\text{ is a morphic image of }\alpha\},

  • LΣ,p(α):={WΣW is a proper image of α}L_{\Sigma,p}(\alpha):=\{W\in\Sigma^{**}\mid W\text{ is a proper image of }\alpha\},

  • LΣ,r(α):={WΣW is a column-row image of α}L_{\Sigma,r}(\alpha):=\{W\in\Sigma^{**}\mid W\text{ is a column-row image of }\alpha\},

  • LΣ,c(α):={WΣW is a row-column image of α}L_{\Sigma,c}(\alpha):=\{W\in\Sigma^{**}\mid W\text{ is a row-column image of }\alpha\},

  • LΣ,rc(α):=LΣ,r(α)LΣ,c(α)L_{\Sigma,rc}(\alpha):=L_{\Sigma,r}(\alpha)\cup L_{\Sigma,c}(\alpha).

For a pattern α\alpha, we also denote the above languages by ZZ pattern language of α\alpha, where Z{h,p,r,c,rc}Z\in\{h,p,r,c,rc\}. For every x{r,c,rc,p,h}x\in\{r,c,rc,p,h\}, we define Σ,x:={LΣ,x(α)αX++}\mathcal{L}_{\Sigma,x}:=\{L_{\Sigma,x}(\alpha)\mid\alpha\in X^{++}\} and x:={Σ,xΣ is some alphabet}\mathcal{L}_{x}:=\{\mathcal{L}_{\Sigma,x}\mid\Sigma\text{ is some alphabet}\}.

Since, for a fixed array pattern α\alpha, every morphic image is a proper image and every proper image is a row-column image as well as a column-row image, the following subset relations between the different types of pattern languages hold (in the following diagram, an arrow denotes a subset relation):

LΣ,h(α)L_{\Sigma,h}(\alpha)LΣ,p(α)L_{\Sigma,p}(\alpha)LΣ,c(α)L_{\Sigma,c}(\alpha)LΣ,r(α)L_{\Sigma,r}(\alpha)LΣ,rc(α)L_{\Sigma,rc}(\alpha)
Remark 1.

As indicated in the introductory part of this section, we consider the class of pp pattern languages as the most natural class of two-dimensional pattern languages. Another observation that supports this claim is that the pp pattern languages are compatible, in a certain sense, to the one-dimensional pattern languages. More precisely, for a one-dimensional (i. e., 1×n1\times n) array pattern α\alpha the set LΣ,p(α){WΣ++|W|r=1}L_{\Sigma,p}(\alpha)\cap\{W\in\Sigma^{++}\mid|W|_{r}=1\} coincides with the one-dimensional pattern language of α\alpha. This does not hold for the hh pattern languages (since in the one-dimensional case the words variables are mapped to can differ in length), but holds for the rr, cc and rcrc pattern languages. However, as pointed out above, the rr, cc and rcrc pattern language of a given pattern α\alpha may contain arrays that, from an intuitive point of view, do not satisfy α\alpha.

4 General Observations

In this section, we state some general lemmas about two-dimensional morphisms and array pattern languages, which shall be important for proving the further results presented in this paper. First, we refine Proposition 1, by giving a convenient characterisation for the morphism property for mappings on arrays. To this end, we define a substitution hh to be (m,n)(m,n)-uniform if, for every xXx\in X, |h(x)|r=m|h(x)|_{r}=m and |h(x)|c=n|h(x)|_{c}=n and a substitution is uniform if it is (m,n)(m,n)-uniform, for some m,nm,n\in\mathbb{N}.

Lemma 1.

A mapping h:ΣΓh:\Sigma^{**}\to\Gamma^{**} is a two-dimensional morphism if and only if h=g,=g,h=g_{\varominus,\varobar}=g_{\varobar,\varominus}, where g:ΣΓg:\Sigma\to\Gamma^{**} is a uniform substitution.

Proof.

We first observe that if gg is uniform, then g,=g,g_{\varominus,\varobar}=g_{\varobar,\varominus} obviously holds (so it is sufficient to prove the statement of the lemma only for one of these two mappings). Furthermore, if gg is uniform, then, for every U,VΣU,V\in\Sigma^{**}, g,(UV)=g,(U)g,(V)g_{\varobar,\varominus}(U\varominus V)=g_{\varobar,\varominus}(U)\varominus g_{\varobar,\varominus}(V) and g,(UV)=g,(U)g,(V)g_{\varobar,\varominus}(U\varobar V)=g_{\varobar,\varominus}(U)\varobar g_{\varobar,\varominus}(V), which proves the if direction. In order to prove the only if direction, we assume that hh is a two-dimensional morphism and we define a substitution gg by g(b):=h(b)g(b):=h(b), bΣb\in\Sigma. Furthermore, let g^{g,,g,}\widehat{g}\in\{g_{\varominus,\varobar},g_{\varobar,\varominus}\}. We now show that hh equals g^\widehat{g} by induction. By definition, for every bΣb\in\Sigma, h(b)=g^(b)h(b)=\widehat{g}(b). Now let U,VΣU,V\in\Sigma^{**} with h(U)=g(U)h(U)=g^{\prime}(U) and h(V)=g(V)h(V)=g^{\prime}(V). Then h(UV)=h(U)h(V)=g(U)g(V)=g(UV)h(U\varominus V)=h(U)\varominus h(V)=g^{\prime}(U)\varominus g^{\prime}(V)=g^{\prime}(U\varominus V) and, analogously, h(UV)=h(U)h(V)=g(U)g(V)=g(UV)h(U\varobar V)=h(U)\varobar h(V)=g^{\prime}(U)\varobar g^{\prime}(V)=g^{\prime}(U\varobar V). By induction, it follows that h=g^h=\widehat{g}. Consequently, we can conclude that gg is uniform. ∎

The next lemma states that the composition of two two-dimensional morphisms is again a two-dimensional morphism.

Lemma 2.

Let h1:ΓΣh_{1}:\Gamma^{**}\to\Sigma^{**} and h2:ΣΔh_{2}:\Sigma^{**}\to\Delta^{**} be two-dimensional morphisms. Then, the composition h1,2:=h1h2:ΓΔh_{1,2}:=h_{1}\circ h_{2}:\Gamma^{**}\to\Delta^{**} is also a two-dimensional morphism.

Proof.

We first observe the following. If gg and ff are some uniform substitutions, then h:=gfh:=g\circ f is a uniform substitution as well. Furthermore, it can be easily verified that g,f,=h,g_{\varominus,\varobar}\circ f_{\varominus,\varobar}=h_{\varominus,\varobar}. With Lemma 1, this directly implies the statement of the lemma. ∎

It is intuitively clear that the structure of a pattern fully determines the corresponding pattern language and the actual names of the variables are irrelevant, e. g., the patterns [x1x2x1x2x3x3]\begin{bmatrix}x_{1}&x_{2}&x_{1}\\ x_{2}&x_{3}&x_{3}\end{bmatrix} and [x7x3x7x3x5x5]\begin{bmatrix}x_{7}&x_{3}&x_{7}\\ x_{3}&x_{5}&x_{5}\end{bmatrix} should be considered identical. In the following we formalise this intuition. Two array patterns α:=[yi,j]m,n\alpha:=[y_{i,j}]_{m,n} and β:=[zi,j]m,n\beta:=[z_{i,j}]_{m^{\prime},n^{\prime}} are equivalent up to a renaming, denoted by αβ\alpha\sim\beta, if and only if m=mm=m^{\prime}, n=nn=n^{\prime} and, for every i,j,i,ji,j,i^{\prime},j^{\prime}, 1i,im1\leq i,i^{\prime}\leq m, 1j,jn1\leq j,j^{\prime}\leq n, yi,j=yi,jy_{i,j}=y_{i^{\prime},j^{\prime}} if and only if zi,j=zi,jz_{i,j}=z_{i^{\prime},j^{\prime}}.

Lemma 3.

Let z,z{h,p,r,c,rc}z,z^{\prime}\in\{h,p,r,c,rc\}, let Σ\Sigma be an alphabet with |Σ|2|\Sigma|\geq 2 and let α,βX++\alpha,\beta\in X^{++}. If LΣ,z(α)=LΣ,z(β)L_{\Sigma,z}(\alpha)=L_{\Sigma,z^{\prime}}(\beta), then αβ\alpha\sim\beta.

Proof.

We assume that LΣ,z(α)=LΣ,z(β)L_{\Sigma,z}(\alpha)=L_{\Sigma,z^{\prime}}(\beta) and note that this implies that |α|c=|β|c=m|\alpha|_{c}=|\beta|_{c}=m and |α|r=|β|r=n|\alpha|_{r}=|\beta|_{r}=n. This is due to the fact that if |α|c<|β|c|\alpha|_{c}<|\beta|_{c} or |α|r<|β|r|\alpha|_{r}<|\beta|_{r}, then the array obtained from α\alpha by replacing every variable by a single symbol 𝚊Σ\mathtt{a}\in\Sigma is in LΣ,z(α)L_{\Sigma,z}(\alpha), but not in LΣ,z(β)L_{\Sigma,z^{\prime}}(\beta). We further assume that αβ\alpha\nsim\beta, which implies that there are i,j,i,ji,j,i^{\prime},j^{\prime} with 1i,im1\leq i,i^{\prime}\leq m and 1j,jn1\leq j,j^{\prime}\leq n, such that α[i,j]=α[i,j]\alpha[i,j]=\alpha[i^{\prime},j^{\prime}] and β[i,j]β[i,j]\beta[i,j]\neq\beta[i^{\prime},j^{\prime}] (or α[i,j]α[i,j]\alpha[i,j]\neq\alpha[i^{\prime},j^{\prime}] and β[i,j]=β[i,j]\beta[i,j]=\beta[i^{\prime},j^{\prime}], for which an analogous argument applies). We now define a substitution h:XΣh:X\rightarrow\Sigma in the following way. For every xXx\in X, if β[i,j]=x\beta[i,j]=x, then h(x):=𝚊h(x):=\mathtt{a} and if β[i,j]x\beta[i,j]\neq x, then h(x):=𝚋h(x):=\mathtt{b}. We observe that, since h,(β)h_{\varominus,\varobar}(\beta) is a morphic image, a proper image, a row-column image and a column-row image of β\beta, h,(β)LΣ,z(β)h_{\varominus,\varobar}(\beta)\in L_{\Sigma,z^{\prime}}(\beta). Furthermore, h,(β)[i,j]h,(β)[i,j]h_{\varominus,\varobar}(\beta)[i,j]\neq h_{\varominus,\varobar}(\beta)[i^{\prime},j^{\prime}]. On the other hand, for every WLΣ,z(α)W\in L_{\Sigma,z}(\alpha), with |W|c=|h,(β)|c|W|_{c}=|h_{\varominus,\varobar}(\beta)|_{c} and |W|r=|h,(β)|r|W|_{r}=|h_{\varominus,\varobar}(\beta)|_{r}, W[i,j]=W[i,j]W[i,j]=W[i^{\prime},j^{\prime}] is satisfied. Thus, h,(β)LΣ,z(α)h_{\varominus,\varobar}(\beta)\notin L_{\Sigma,z}(\alpha), which implies that LΣ,z(α)LΣ,z(β)L_{\Sigma,z}(\alpha)\neq L_{\Sigma,z^{\prime}}(\beta). ∎

For every z,z{h,p,r,c,rc}z,z^{\prime}\in\{h,p,r,c,rc\}, zzz\neq z^{\prime}, αβ\alpha\sim\beta does not necessarily imply LΣ,z(α)=LΣ,z(β)L_{\Sigma,z}(\alpha)=L_{\Sigma,z^{\prime}}(\beta), as pointed out by, e. g., LΣ,h([x1x2])LΣ,p([x1x2])L_{\Sigma,h}(\begin{bmatrix}x_{1}&x_{2}\end{bmatrix})\neq L_{\Sigma,p}(\begin{bmatrix}x_{1}&x_{2}\end{bmatrix}) or LΣ,p([x1x2x3x1])LΣ,c([x1x2x3x1])L_{\Sigma,p}(\begin{bmatrix}x_{1}&x_{2}\\ x_{3}&x_{1}\end{bmatrix})\neq L_{\Sigma,c}(\begin{bmatrix}x_{1}&x_{2}\\ x_{3}&x_{1}\end{bmatrix}). On the other hand, since, for every z,{h,p,r,c,rc}z,\in\{h,p,r,c,rc\}, αβ\alpha\sim\beta obviously implies LΣ,z(α)=LΣ,z(β)L_{\Sigma,z}(\alpha)=L_{\Sigma,z}(\beta), two zz pattern languages are equivalent if and only if they are described by two patterns that are equivalent up to a renaming.

In the remainder of this work, we do not distinguish anymore between patterns that are equivalent up to a renaming, i. e., from now on we say that α\alpha and β\beta are equivalent, denoted by α=β\alpha=\beta for simplicity, if they are actually the same arrays or if they are equivalent up to a renaming.

5 Comparison of Array Pattern Language Classes

In this section, we provide a pairwise comparison of our different classes of array pattern languages and, furthermore, we compare them with the class of recognisable array languages, denoted by REC, which is one of the most prominent classes of array languages. For a detailed description of REC, the reader is referred to the survey [7] by Giammarresi and Restivo. Next, we show that, for every alphabet Σ\Sigma with |Σ|2|\Sigma|\geq 2, the language classes REC, Σ,h\mathcal{L}_{\Sigma,h}, Σ,p\mathcal{L}_{\Sigma,p}, Σ,r\mathcal{L}_{\Sigma,r}, Σ,c\mathcal{L}_{\Sigma,c} and Σ,rc\mathcal{L}_{\Sigma,rc} are pairwise incomparable. More precisely, for every 1,2{REC,Σ,h,Σ,p,Σ,r,Σ,c,Σ,rc}\mathcal{L}_{1},\mathcal{L}_{2}\in\{\text{REC},\mathcal{L}_{\Sigma,h},\mathcal{L}_{\Sigma,p},\mathcal{L}_{\Sigma,r},\mathcal{L}_{\Sigma,c},\mathcal{L}_{\Sigma,rc}\} with 12\mathcal{L}_{1}\neq\mathcal{L}_{2}, we show that 12\mathcal{L}_{1}\setminus\mathcal{L}_{2}\neq\emptyset, 21\mathcal{L}_{2}\setminus\mathcal{L}_{1}\neq\emptyset and 12\mathcal{L}_{1}\cap\mathcal{L}_{2}\neq\emptyset. The non-emptiness of the pairwise intersections of these language classes can be easily seen:

Proposition 2.

For every z{h,p,r,c,rc}z\in\{h,p,r,c,rc\}, Lz,Σ([x1])=Σ++L_{z,\Sigma}(\begin{bmatrix}x_{1}\end{bmatrix})=\Sigma^{++} and Σ++REC\Sigma^{++}\in\text{REC}.

It remains to find, for every 1,2{REC,Σ,h,Σ,p,Σ,r,Σ,c,Σ,rc}\mathcal{L}_{1},\mathcal{L}_{2}\in\{\text{REC},\mathcal{L}_{\Sigma,h},\mathcal{L}_{\Sigma,p},\mathcal{L}_{\Sigma,r},\mathcal{L}_{\Sigma,c},\mathcal{L}_{\Sigma,rc}\}, a separating language L112L_{1}\in\mathcal{L}_{1}\setminus\mathcal{L}_{2} and a separating language L221L_{2}\in\mathcal{L}_{2}\setminus\mathcal{L}_{1}. We first present all these separating languages in a table and then we formally prove their separating property. In rows 22 to 66 of the following table, if a pattern α\alpha is the entry that corresponds to the row labeled by class Σ,z\mathcal{L}_{\Sigma,z} and the column labeled by class Σ,z\mathcal{L}_{\Sigma,z^{\prime}}, where z,z{h,p,r,c,rc}z,z^{\prime}\in\{h,p,r,c,rc\}, zzz\neq z^{\prime}, then this means that LΣ,zΣ,zL\in\mathcal{L}_{\Sigma,z}\setminus\mathcal{L}_{\Sigma,z^{\prime}}. Row 11, on the other hand, contains recognisable array languages that are not array pattern languages.

    REC Σ,h\mathcal{L}_{\Sigma,h} Σ,p\mathcal{L}_{\Sigma,p} Σ,r\mathcal{L}_{\Sigma,r} Σ,c\mathcal{L}_{\Sigma,c} Σ,rc\mathcal{L}_{\Sigma,rc}
 
REC     {[𝚊]}\{\begin{bmatrix}\mathtt{a}\end{bmatrix}\} {[𝚊]}\{\begin{bmatrix}\mathtt{a}\end{bmatrix}\} {[𝚊]}\{\begin{bmatrix}\mathtt{a}\end{bmatrix}\} {[𝚊]}\{\begin{bmatrix}\mathtt{a}\end{bmatrix}\} {[𝚊]}\{\begin{bmatrix}\mathtt{a}\end{bmatrix}\}
Σ,h\mathcal{L}_{\Sigma,h}     [x1x1]\begin{bmatrix}x_{1}\\ x_{1}\end{bmatrix} [x1x2x3x4]\begin{bmatrix}x_{1}&x_{2}\\ x_{3}&x_{4}\\ \end{bmatrix} [x1x2x3x4]\begin{bmatrix}x_{1}&x_{2}\\ x_{3}&x_{4}\\ \end{bmatrix} [x1x2x3x4]\begin{bmatrix}x_{1}&x_{2}\\ x_{3}&x_{4}\\ \end{bmatrix} [x1x2x3x4]\begin{bmatrix}x_{1}&x_{2}\\ x_{3}&x_{4}\\ \end{bmatrix}
Σ,p\mathcal{L}_{\Sigma,p}     [x1x1]\begin{bmatrix}x_{1}\\ x_{1}\end{bmatrix} [x1x2x3x4]\begin{bmatrix}x_{1}&x_{2}\\ x_{3}&x_{4}\\ \end{bmatrix} [x1x2x2x1]\begin{bmatrix}x_{1}&x_{2}\\ x_{2}&x_{1}\end{bmatrix} [x1x2x2x1]\begin{bmatrix}x_{1}&x_{2}\\ x_{2}&x_{1}\end{bmatrix} [x1x2x2x1]\begin{bmatrix}x_{1}&x_{2}\\ x_{2}&x_{1}\end{bmatrix}
Σ,r\mathcal{L}_{\Sigma,r}     [x1x1]\begin{bmatrix}x_{1}\\ x_{1}\end{bmatrix} [x1x2x3x4]\begin{bmatrix}x_{1}&x_{2}\\ x_{3}&x_{4}\\ \end{bmatrix} [x1x2x2x1]\begin{bmatrix}x_{1}&x_{2}\\ x_{2}&x_{1}\end{bmatrix} [x1x2x2x1]\begin{bmatrix}x_{1}&x_{2}\\ x_{2}&x_{1}\end{bmatrix} [x1x2x2x1]\begin{bmatrix}x_{1}&x_{2}\\ x_{2}&x_{1}\end{bmatrix}
Σ,c\mathcal{L}_{\Sigma,c}     [x1x1]\begin{bmatrix}x_{1}\\ x_{1}\end{bmatrix} [x1x2x3x4]\begin{bmatrix}x_{1}&x_{2}\\ x_{3}&x_{4}\\ \end{bmatrix} [x1x2x2x1]\begin{bmatrix}x_{1}&x_{2}\\ x_{2}&x_{1}\end{bmatrix} [x1x2x2x1]\begin{bmatrix}x_{1}&x_{2}\\ x_{2}&x_{1}\end{bmatrix} [x1x2x2x1]\begin{bmatrix}x_{1}&x_{2}\\ x_{2}&x_{1}\end{bmatrix}
Σ,rc\mathcal{L}_{\Sigma,rc}     [x1x1]\begin{bmatrix}x_{1}\\ x_{1}\end{bmatrix} [x1x2x3x4]\begin{bmatrix}x_{1}&x_{2}\\ x_{3}&x_{4}\\ \end{bmatrix} [x1x2x2x1]\begin{bmatrix}x_{1}&x_{2}\\ x_{2}&x_{1}\end{bmatrix} [x1x2x2x1]\begin{bmatrix}x_{1}&x_{2}\\ x_{2}&x_{1}\end{bmatrix} [x1x2x2x1]\begin{bmatrix}x_{1}&x_{2}\\ x_{2}&x_{1}\end{bmatrix}
Lemma 4.

LΣ,h([x1x1])RECL_{\Sigma,h}(\begin{bmatrix}x_{1}\\ x_{1}\end{bmatrix})\notin\text{REC}.

Proof.

In this proof, we use the characterisation of REC by local array languages and projections (see Giammarresi and Restivo [7] and also the next section). Let α:=[x1x1]\alpha:=\begin{bmatrix}x_{1}\\ x_{1}\end{bmatrix} and L:=LΣ,h(α)={WWWΣ++}L:=L_{\Sigma,h}(\alpha)=\{W\varominus W\mid W\in\Sigma^{++}\}. Suppose LRECL\in REC. Then there is a local array language LL^{\prime} over an alphabet Γ\Gamma so that LL is a projection of LL^{\prime}. For the sake of convenience, we define r:=|Γ|r:=|\Gamma| and s:=|Σ|s:=|\Sigma|. For every m,nm,n\in\mathbb{N}, let

Lm,n:={WWWΣ++ and |W|r=m,|W|c=n}L.L_{m,n}:=\{W\varominus W\mid W\in\Sigma^{++}\text{ and }|W|_{r}=m,|W|_{c}=n\}\subseteq L\,.

Obviously, |Lm,n|=smn|L_{m,n}|=s^{mn}. Now let Lm,nL^{\prime}_{m,n} be the set of pictures in L,L^{\prime}, whose projections are in Lm,nL_{m,n}. In the arrays of Lm,n,L^{\prime}_{m,n}, there are at most r2nr^{2n} possibilities of how the mthm^{\text{th}} and (m+1)th(m+1)^{\text{th}} row can look like. For sufficiently large m,m, smn>r2n.s^{mn}>r^{2n}. Thus, there exist two arrays W1W1W_{1}\varominus W_{1} and W2W2,W_{2}\varominus W_{2}, W1W2W_{1}\neq W_{2} in Lm,nL_{m,n} such that the corresponding arrays W1W1W_{1}^{\prime}\varominus W_{1}^{\prime} and W2W2W_{2}^{\prime}\varominus W_{2}^{\prime} in Lm,nL^{\prime}_{m,n} have the same mthm^{\text{th}} row and the same (m+1)th(m+1)^{\text{th}} row. Hence, since LL^{\prime} is a local array language, W1W2,W2W1Lm,nW_{1}^{\prime}\varominus W_{2}^{\prime},W_{2}^{\prime}\varominus W_{1}^{\prime}\in L^{\prime}_{m,n} and therefore W1W2,W2W1Lm,nLW_{1}\varominus W_{2},W_{2}\varominus W_{1}\in L_{m,n}\subseteq L, which is a contradiction. ∎

It can be easily verified that, for every z{p,r,c,rc}z\in\{p,r,c,rc\}, LΣ,z(α)=LΣ,h(α)L_{\Sigma,z}(\alpha)=L_{\Sigma,h}(\alpha), where α:=[x1x1]\alpha:=\begin{bmatrix}x_{1}\\ x_{1}\end{bmatrix}. Hence, for every z{h,p,r,c,rc}z\in\{h,p,r,c,rc\}, LΣ,z(α)RECL_{\Sigma,z}(\alpha)\notin\text{REC}, which implies the first column of the table. Furthermore, for every z{h,p,r,c,rc}z\in\{h,p,r,c,rc\}, {[𝚊]}LΣ,z(α)\{\begin{bmatrix}\mathtt{a}\end{bmatrix}\}\notin L_{\Sigma,z}(\alpha), but {[𝚊]}REC\{\begin{bmatrix}\mathtt{a}\end{bmatrix}\}\in\text{REC}, which implies the first row of the table.

We point out that, by Lemma 3, for every z,z{h,p,r,c,rc}z,z^{\prime}\in\{h,p,r,c,rc\}, zzz\neq z^{\prime}, if there exists a pattern β\beta with LΣ,z(β)LΣ,z(β)L_{\Sigma,z}(\beta)\neq L_{\Sigma,z^{\prime}}(\beta), then LΣ,z(β)Σ,zΣ,zL_{\Sigma,z}(\beta)\in\mathcal{L}_{\Sigma,z}\setminus\mathcal{L}_{\Sigma,z^{\prime}} and LΣ,z(β)Σ,zΣ,zL_{\Sigma,z^{\prime}}(\beta)\in\mathcal{L}_{\Sigma,z^{\prime}}\setminus\mathcal{L}_{\Sigma,z}. Consequently, in order to prove the remaining entries of the table, it is sufficient to identify, for every z,z{h,p,r,c,rc}z,z^{\prime}\in\{h,p,r,c,rc\}, zzz\neq z^{\prime}, a pattern β\beta with LΣ,z(β)LΣ,z(β)L_{\Sigma,z}(\beta)\neq L_{\Sigma,z^{\prime}}(\beta), which is done by the following two lemmas.

Lemma 5.

For every z{p,c,r,cr}z\in\{p,c,r,cr\}, LΣ,h([x1x2x3x4])LΣ,z([x1x2x3x4])L_{\Sigma,h}(\begin{bmatrix}x_{1}&x_{2}\\ x_{3}&x_{4}\\ \end{bmatrix})\neq L_{\Sigma,z}(\begin{bmatrix}x_{1}&x_{2}\\ x_{3}&x_{4}\\ \end{bmatrix}).

Proof.

Let β:=[x1x2x3x4]\beta:=\begin{bmatrix}x_{1}&x_{2}\\ x_{3}&x_{4}\\ \end{bmatrix} and let W:=[𝚊𝚊𝚊𝚊𝚊𝚊𝚊𝚊𝚊]W:=\begin{bmatrix}\mathtt{a}&\mathtt{a}&\mathtt{a}\\ \mathtt{a}&\mathtt{a}&\mathtt{a}\\ \mathtt{a}&\mathtt{a}&\mathtt{a}\\ \end{bmatrix}. For every z{p,c,r,cr}z\in\{p,c,r,cr\}, WΣ,z(β)W\in\mathcal{L}_{\Sigma,z}(\beta), since g,(β)=g,(β)=Wg_{\varominus,\varobar}(\beta)=g_{\varobar,\varominus}(\beta)=W, where gg is defined by

g(x1):=[𝚊𝚊𝚊𝚊],g(x2):=[𝚊𝚊],g(x3):=[𝚊𝚊],g(x4):=[𝚊].g(x_{1}):=\begin{bmatrix}\mathtt{a}&\mathtt{a}\\ \mathtt{a}&\mathtt{a}\\ \end{bmatrix},\>\>\\ g(x_{2}):=\begin{bmatrix}\mathtt{a}\\ \mathtt{a}\\ \end{bmatrix},\>\>\\ g(x_{3}):=\begin{bmatrix}\mathtt{a}&\mathtt{a}\\ \end{bmatrix},\>\>\\ g(x_{4}):=\begin{bmatrix}\mathtt{a}\\ \end{bmatrix}\,.

By Lemma 1, it is obvious that there does not exist any morphism hh with h(β)=Wh(\beta)=W. Thus, WLΣ,h(β)W\notin L_{\Sigma,h}(\beta) and, for every z{p,c,r,cr}z\in\{p,c,r,cr\}, LΣ,h(β)LΣ,z(β)L_{\Sigma,h}(\beta)\neq L_{\Sigma,z}(\beta). ∎

Lemma 6.

For every z,z{p,c,r,cr}z,z^{\prime}\in\{p,c,r,cr\}, zzz\neq z^{\prime}, LΣ,z([x1x2x2x1])LΣ,z([x1x2x2x1])L_{\Sigma,z}(\begin{bmatrix}x_{1}&x_{2}\\ x_{2}&x_{1}\end{bmatrix})\neq L_{\Sigma,z^{\prime}}(\begin{bmatrix}x_{1}&x_{2}\\ x_{2}&x_{1}\\ \end{bmatrix}).

Proof.

Let γ:=[x1x2x2x1]\gamma:=\begin{bmatrix}x_{1}&x_{2}\\ x_{2}&x_{1}\end{bmatrix} and let W1:=[𝚊𝚊𝚊𝚊𝚊𝚊],W2:=[𝚊𝚊𝚊𝚊𝚊𝚊]W_{1}:=\begin{bmatrix}\mathtt{a}&\mathtt{a}\\ \mathtt{a}&\mathtt{a}\\ \mathtt{a}&\mathtt{a}\\ \end{bmatrix},W_{2}:=\begin{bmatrix}\mathtt{a}&\mathtt{a}&\mathtt{a}\\ \mathtt{a}&\mathtt{a}&\mathtt{a}\\ \end{bmatrix}. We observe that g,(γ)=W1g_{\varominus,\varobar}(\gamma)=W_{1}, g,(γ)=W2,g^{\prime}_{\varobar,\varominus}(\gamma)=W_{2}, where g,gg,g^{\prime} are defined by

g(x1):=[𝚊],g(x2):=[𝚊𝚊],g(x1):=[𝚊],g(x2):=[𝚊𝚊].g(x_{1}):=\begin{bmatrix}\mathtt{a}\\ \end{bmatrix},\,g(x_{2}):=\begin{bmatrix}\mathtt{a}\\ \mathtt{a}\\ \end{bmatrix},\,g^{\prime}(x_{1}):=\begin{bmatrix}\mathtt{a}\\ \end{bmatrix},\,g^{\prime}(x_{2}):=\begin{bmatrix}\mathtt{a}&\mathtt{a}\\ \end{bmatrix}\,.

Thus, W1LΣ,c(γ)W_{1}\in L_{\Sigma,c}(\gamma), W2LΣ,r(γ)W_{2}\in L_{\Sigma,r}(\gamma) and W1,W2LΣ,rc(γ)W_{1},W_{2}\in L_{\Sigma,rc}(\gamma). On the other hand, W1,W2LΣ,p(γ)W_{1},W_{2}\notin L_{\Sigma,p}(\gamma), since every proper image of γ\gamma must have an even number of columns and an even number of rows. Consequently, for every z{r,c,rc}z\in\{r,c,rc\}, LΣ,p(γ)LΣ,z(γ)L_{\Sigma,p}(\gamma)\neq L_{\Sigma,z}(\gamma). Similarly, W1LΣ,rW_{1}\notin L_{\Sigma,r} and W2LΣ,cW_{2}\notin L_{\Sigma,c}, since every column-row image of γ\gamma must have an even number of rows and every row-column image of γ\gamma must have an even number of columns. This implies that, for every z,z{c,r,cr}z,z^{\prime}\in\{c,r,cr\}, zzz\neq z^{\prime}, LΣ,z(γ)LΣ,z(γ)L_{\Sigma,z}(\gamma)\neq L_{\Sigma,z^{\prime}}(\gamma), which concludes the proof. ∎

6 Closure Properties of Array Pattern Languages

The research of closure properties of classes of formal languages is a classical topic in this area. However, the number of natural properties is richer in the case of arrays compared to the more conventional string case. Thus, in this section, we classify the operations that shall be investigated in this regard according to whether or not they correspond to string language operations.

First, in Section 6.1, we investigate operations that correspond to string language operations. These are the Boolean operations of union, intersection and complementation, and also two special cases of (inverse) morphisms: letter-to-letter morphisms, and more special surjective letter-to-letter morphisms, known as projections in the terminology of array languages, and, more generally, the two-dimensional morphisms as defined in Section 3

Next, in Section 6.2, we take a closer look at operations similar to string language operations. More precisely, we investigate closure under concatenation and concatenation closure (or Kleene star), which constitute classical operations for string languages, but, with respect to the array case, we encounter an important difference, namely, there are two different types of concatenations: row and column concatenation. In particular, the concatenation of two arrays could be undefined (just because the dimensions do not match), but the concatenation of the two corresponding languages need not be empty.

Finally, in Section 6.3, we investigate operations special to arrays, that are usually not considered or even defined for string languages. These are mainly geometric operations like quarter turn, half turn, reflection or transposition of an array.

6.1 String Language Operations

We first point out that, due to Lemma 7 below, whenever a non-closure result is known for terminal-free non-erasing string pattern languages, this would straightforwardly transfer to the array case. We will therefore focus on finding proofs for the string case for non-closure properties, and conversely, we will try to give proofs for the array case for closure properties. Interestingly enough, (non-)closure properties have not been studied for the (classical) terminal-free non-erasing string pattern languages, all published proofs that we are aware of for this topic use terminals or erasing. So, our study also contributes to the theory of string pattern languages. Conversely, if we do not manage to find proofs or examples as required for the mentioned approach, this implicitly always raises an open classical string language question. For any mode z{h,p,r,c,rc}z\in\{h,p,r,c,rc\} and any pattern π\pi, let LΣ,z1D(π)L_{\Sigma,z}^{\operatorname{\texttt{1D}}}(\pi) denote those arrays from LΣ,z(π)L_{\Sigma,z}(\pi) that have just one row, i. e., LΣ,z1D(π):={WLΣ,z(π)|W|r=1}L_{\Sigma,z}^{\operatorname{\texttt{1D}}}(\pi):=\{W\in L_{\Sigma,z}(\pi)\mid|W|_{r}=1\}. Clearly, such arrays can be interpreted as strings and vice versa. In this sense, LΣ,z1D(π)L_{\Sigma,z}^{\operatorname{\texttt{1D}}}(\pi) and the string language LΣ1D(π)L^{\operatorname{\texttt{1D}}}_{\Sigma}(\pi) generated by the pattern π\pi coincide, as long as zhz\neq h. For z=hz=h, we encounter the special case that all inserted words have to be of the same length. Let us formulate this more formally:

Lemma 7.

Let π\pi be an array pattern of height one. Then, π\pi is, at the same time, a string pattern. Moreover, for any z{p,r,c,rc}z\in\{p,r,c,rc\}, LΣ,z1D(π)=LΣ1D(π)L_{\Sigma,z}^{\operatorname{\texttt{1D}}}(\pi)=L^{\operatorname{\texttt{1D}}}_{\Sigma}(\pi), while LΣ,h1D(π)LΣ1D(π)L_{\Sigma,h}^{\operatorname{\texttt{1D}}}(\pi)\subseteq L^{\operatorname{\texttt{1D}}}_{\Sigma}(\pi).

We shall now prove non-closure properties for LΣ1D(π)L^{\operatorname{\texttt{1D}}}_{\Sigma}(\pi), which directly carry over to the classes LΣ,z(π)L_{\Sigma,z}(\pi), z{h,p,r,c,rc}z\in\{h,p,r,c,rc\} (for some operations, however, the class LΣ,h(π)L_{\Sigma,h}(\pi) constitutes a special case, which is treated separately). To this end, we will mostly focus on two patterns: α=xyx\alpha=xyx and β=xxy\beta=xxy. The next lemma states an immediate observation for these patterns.

Lemma 8.

Over the terminal alphabet Σ={𝚊,𝚋}\Sigma=\{\mathtt{a},\mathtt{b}\}, let Ls(α)L_{s}(\alpha) (Ls(β)L_{s}(\beta)) denote the shortest words that can be described by α\alpha and β\beta, respectively, disallowing erasing. Then,

Ls(α)\displaystyle L_{s}(\alpha) =\displaystyle= {𝚊𝚊𝚊,𝚊𝚋𝚊,𝚋𝚊𝚋,𝚋𝚋𝚋},\displaystyle\{\mathtt{a}\mathtt{a}\mathtt{a},\mathtt{a}\mathtt{b}\mathtt{a},\mathtt{b}\mathtt{a}\mathtt{b},\mathtt{b}\mathtt{b}\mathtt{b}\}\,,
Ls(β)\displaystyle L_{s}(\beta) =\displaystyle= {𝚊𝚊𝚊,𝚊𝚊𝚋,𝚋𝚋𝚊,𝚋𝚋𝚋}.\displaystyle\{\mathtt{a}\mathtt{a}\mathtt{a},\mathtt{a}\mathtt{a}\mathtt{b},\mathtt{b}\mathtt{b}\mathtt{a},\mathtt{b}\mathtt{b}\mathtt{b}\}\,.
Proposition 3.

For any non-unary alphabet Σ\Sigma, Σ1D\mathcal{L}^{\operatorname{\texttt{1D}}}_{\Sigma} is not closed under union.

Proof.

Without loss of generality, {𝚊,𝚋}Σ\{\mathtt{a},\mathtt{b}\}\subseteq\Sigma. In the following argument, we actually focus on Σ={𝚊,𝚋}\Sigma=\{\mathtt{a},\mathtt{b}\}, but this can be easily extended to the more general case. Assume that there was a pattern γ\gamma with Σ1D(γ)=Σ1D(α)Σ1D(β)\mathcal{L}^{\operatorname{\texttt{1D}}}_{\Sigma}(\gamma)=\mathcal{L}^{\operatorname{\texttt{1D}}}_{\Sigma}(\alpha)\cup\mathcal{L}^{\operatorname{\texttt{1D}}}_{\Sigma}(\beta). Then,

Ls(γ)=Ls(α)Ls(β)={𝚊𝚊𝚊,𝚊𝚊𝚋,𝚊𝚋𝚊,𝚋𝚊𝚋,𝚋𝚋𝚊,𝚋𝚋𝚋}.L_{s}(\gamma)=L_{s}(\alpha)\cup L_{s}(\beta)=\{\mathtt{a}\mathtt{a}\mathtt{a},\mathtt{a}\mathtt{a}\mathtt{b},\mathtt{a}\mathtt{b}\mathtt{a},\mathtt{b}\mathtt{a}\mathtt{b},\mathtt{b}\mathtt{b}\mathtt{a},\mathtt{b}\mathtt{b}\mathtt{b}\}.

This means that γ\gamma contains exactly three variable occurrences (with more, these words cannot be generated, with less, shorter words could be generated), i.e., γ=y1y2y3\gamma=y_{1}\,y_{2}\,y_{3}, yiXy_{i}\in X, 1i31\leq i\leq 3. As Ls(γ){𝚊,𝚋}3L_{s}(\gamma)\neq\{\mathtt{a},\mathtt{b}\}^{3}, some of these variables must coincide, which leads to a contradiction. More precisely, if y1=y2y_{1}=y_{2} or y2=y3y_{2}=y_{3}, then 𝚊𝚋𝚊\mathtt{a}\mathtt{b}\mathtt{a} cannot be generated and if y1=y3y_{1}=y_{3}, then 𝚊𝚊𝚋\mathtt{a}\mathtt{a}\mathtt{b} cannot be generated. Hence, γ\gamma with Ls(γ)=Ls(α)Ls(β)L_{s}(\gamma)=L_{s}(\alpha)\cup L_{s}(\beta) cannot exist. ∎

Now if there was a pattern γ\gamma such that LΣ,z(γ)=LΣ,z(α)LΣ,z(β)L_{\Sigma,z}(\gamma)=L_{\Sigma,z}(\alpha)\cup L_{\Sigma,z}(\beta), z{p,r,c,rc}z\in\{p,r,c,rc\}, then, by Lemma 7, this would imply LΣ1D(γ)=LΣ1D(α)LΣ1D(β)L_{\Sigma}^{\operatorname{\texttt{1D}}}(\gamma)=L_{\Sigma}^{\operatorname{\texttt{1D}}}(\alpha)\cup L_{\Sigma}^{\operatorname{\texttt{1D}}}(\beta), contradicting Proposition 3. We point out that in the proof of Proposition 3, we do not use any replacements by words of different lengths to obtain our contradiction. Hence, this argument is also valid in the case when z=hz=h.

Corollary 1.

None of the array pattern language classes under consideration (over some non-unary alphabet) is closed under union.

We proceed with the intersection operation.

Proposition 4.

For any non-unary alphabet Σ\Sigma, Σ1D\mathcal{L}^{\operatorname{\texttt{1D}}}_{\Sigma} is not closed under intersection.

Proof.

The argument resembles the previous proof. Assume that γ\gamma describes LΣ1D(α)LΣ1D(β)L^{\operatorname{\texttt{1D}}}_{\Sigma}(\alpha)\cap L^{\operatorname{\texttt{1D}}}_{\Sigma}(\beta). Notice that Ls(γ)={𝚊𝚊𝚊,𝚋𝚋𝚋}L_{s}(\gamma)=\{\mathtt{a}\mathtt{a}\mathtt{a},\mathtt{b}\mathtt{b}\mathtt{b}\}, which clearly implies that γ=xxx\gamma=xxx. However, 𝚊𝚊𝚋𝚊𝚊(LΣ1D(α)LΣ1D(β))LΣ1D(γ)\mathtt{a}\mathtt{a}\mathtt{b}\mathtt{a}\mathtt{a}\in(L^{\operatorname{\texttt{1D}}}_{\Sigma}(\alpha)\cap L^{\operatorname{\texttt{1D}}}_{\Sigma}(\beta))\setminus L^{\operatorname{\texttt{1D}}}_{\Sigma}(\gamma). ∎

Notice that the replacement words we used for deriving a contradiction are of different lengths, meaning that 𝚊𝚊𝚋𝚊𝚊LΣ(α)\mathtt{a}\mathtt{a}\mathtt{b}\mathtt{a}\mathtt{a}\in L_{\Sigma}(\alpha) because of the replacement x𝚊𝚊x\mapsto\mathtt{a}\mathtt{a} and y𝚋y\mapsto\mathtt{b}, but 𝚊𝚊𝚋𝚊𝚊LΣ(β)\mathtt{a}\mathtt{a}\mathtt{b}\mathtt{a}\mathtt{a}\in L_{\Sigma}(\beta) because of x𝚊x\mapsto\mathtt{a} and y𝚋𝚊𝚊y\mapsto\mathtt{b}\mathtt{a}\mathtt{a}. Hence, we cannot conclude non-closure for the hh-mode in the following corollary:

Corollary 2.

None of the array pattern language classes under consideration (over some non-unary alphabet and apart from the hh-case) is closed under intersection.

Indeed, the hh-mode plays a special rôle, as can be seen by the following result.

Proposition 5.

Let Σ\Sigma be some alphabet. Then, Σ,h\mathcal{L}_{\Sigma,h} is closed under intersection.

Proof.

Assume that aΣa\in\Sigma. Let α,β\alpha,\beta be two array patterns. Let mαm_{\alpha} be the height (number of rows) of α\alpha and nαn_{\alpha} be the width (number of columns) of α\alpha. Likewise, mβm_{\beta} and nβn_{\beta} are understood. Then, the width of the smallest arrays in LΣ,h(α)LΣ,h(β)L_{\Sigma,h}(\alpha)\cap L_{\Sigma,h}(\beta) equals n=lcm(nα,nβ)n=\operatorname{lcm}(n_{\alpha},n_{\beta}), and their height equals m=lcm(mα,mβ)m=\operatorname{lcm}(m_{\alpha},m_{\beta}). This can be easily seen by substituting each variable in α\alpha by the unique array of width nα=lcm(nα,nβ)nαn^{\prime}_{\alpha}=\frac{\operatorname{lcm}(n_{\alpha},n_{\beta})}{n_{\alpha}} and height mα=lcm(mα,mβ)mαm^{\prime}_{\alpha}=\frac{\operatorname{lcm}(m_{\alpha},m_{\beta})}{m_{\alpha}} over the alphabet {a}\{a\} into the pattern α\alpha, as n=nα×nαn=n_{\alpha}\times n^{\prime}_{\alpha}, m=mα×mαm=m_{\alpha}\times m^{\prime}_{\alpha}, and a similar substitution within β\beta.

For each variable xx that occurs in α\alpha, take mα×nαm^{\prime}_{\alpha}\times n^{\prime}_{\alpha} new variables xi,jx_{i,j} with 1imα1\leq i\leq m^{\prime}_{\alpha} and 1jnα1\leq j\leq n^{\prime}_{\alpha}. Define a morphism hαh_{\alpha} by replacing the variable xx by the following array of height nαn^{\prime}_{\alpha} and width mαm^{\prime}_{\alpha}, consisting of the previously introduced variables:

x11x12x1nαx21x22x2nαxmα1xmα2xmαnα\begin{smallmatrix}x_{11}&x_{12}&\cdots&x_{1n^{\prime}_{\alpha}}\\ x_{21}&x_{22}&\cdots&x_{2n^{\prime}_{\alpha}}\\ \vdots&\vdots&\vdots&\vdots\\ x_{m^{\prime}_{\alpha}1}&x_{m^{\prime}_{\alpha}2}&\cdots&x_{m^{\prime}_{\alpha}n^{\prime}_{\alpha}}\end{smallmatrix}

Hence, hα(α)h_{\alpha}(\alpha) is some array of height mm and of width nn. Accordingly, one can define a morphism hβh_{\beta} such that hβ(β)h_{\beta}(\beta) is again some array of height mm and of width nn. Due to Lemma 2, LΣ,h(hα(α))LΣ,h(α)L_{\Sigma,h}(h_{\alpha}(\alpha))\subseteq L_{\Sigma,h}(\alpha) and LΣ,h(hβ(β))LΣ,h(β)L_{\Sigma,h}(h_{\beta}(\beta))\subseteq L_{\Sigma,h}(\beta) (*). Namely, if ULΣ,h(hα(α))U\in L_{\Sigma,h}(h_{\alpha}(\alpha)), then there exists some two-dimensional morphism gg such that U=g(hα(α))U=g(h_{\alpha}(\alpha)), i.e., there also exists some two-dimensional morphism f:=hαgf:=h_{\alpha}\circ g with U=f(α)U=f(\alpha), so that ULΣ,h(α)U\in L_{\Sigma,h}(\alpha). Now, define an array pattern γ\gamma of height mm and of width nn, consisting exclusively of variable entries, as follows: The variables occurring at positions (i,j)(i,j) and (i,j)(i^{\prime},j^{\prime}) in γ\gamma (where 1i,im1\leq i,i^{\prime}\leq m and 1j,jn1\leq j,j^{\prime}\leq n) are identical if and only if the corresponding variables in at least one of the arrays hα(α)h_{\alpha}(\alpha) or hβ(β)h_{\beta}(\beta) are identical.

We claim that LΣ,h(γ)=LΣ,h(α)LΣ,h(β)L_{\Sigma,h}(\gamma)=L_{\Sigma,h}(\alpha)\cap L_{\Sigma,h}(\beta).

As γ\gamma is obtained from hα(α)h_{\alpha}(\alpha) by identifying certain variables, due to (*) we find that:

LΣ,h(γ)LΣ,h(hα(α))LΣ,h(α),L_{\Sigma,h}(\gamma)\subseteq L_{\Sigma,h}(h_{\alpha}(\alpha))\subseteq L_{\Sigma,h}(\alpha),

and likewise for β\beta, so that LΣ,h(γ)LΣ,h(α)LΣ,h(β)L_{\Sigma,h}(\gamma)\subseteq L_{\Sigma,h}(\alpha)\cap L_{\Sigma,h}(\beta).

Conversely, we have already argued that the smallest arrays in LΣ,h(α)LΣ,h(β)L_{\Sigma,h}(\alpha)\cap L_{\Sigma,h}(\beta) have height mm and width nn. More generally, any array ULΣ,h(α)LΣ,h(β)U\in L_{\Sigma,h}(\alpha)\cap L_{\Sigma,h}(\beta) has height kmk\cdot m and width lnl\cdot n. As ULΣ,h(α)U\in L_{\Sigma,h}(\alpha), there is some two-dimensional morphism hU,αh_{U,\alpha} such that U=hU,α(α)U=h_{U,\alpha}(\alpha). Moreover, for each variable xx in α\alpha, |hU,α(x)|r=kα=kmmα|h_{U,\alpha}(x)|_{r}=k_{\alpha}=\frac{k\cdot m}{m_{\alpha}} and |hU,α(x)|c=lα=lnnα|h_{U,\alpha}(x)|_{c}=l_{\alpha}=\frac{l\cdot n}{n_{\alpha}}. We can make an analogous reasoning with β\beta, introducing the constants kβ=kmmβk_{\beta}=\frac{k\cdot m}{m_{\beta}} and lβ=lnnβl_{\beta}=\frac{l\cdot n}{n_{\beta}} for the morphism hU,βh_{U,\beta}. As U=hU,α(α)=hU,β(β)U=h_{U,\alpha}(\alpha)=h_{U,\beta}(\beta), entries in UU must coincide both according to α\alpha and to β\beta. This is exactly reflected in the construction of γ\gamma provided above, so that hU,α=hαhh_{U,\alpha}=h_{\alpha}\circ h^{\prime} and hU,β=hβhh_{U,\beta}=h_{\beta}\circ h^{\prime} for some two-dimensional morphism hh^{\prime} with h(γ)=Uh^{\prime}(\gamma)=U. Hence, ULΣ,h(γ)U\in L_{\Sigma,h}(\gamma). ∎

Arguments as in Propositions 3 and 4 can be given for any non-trivial binary set operation, for instance, symmetric difference or set difference. This also gives the according result for complementation, but there is also an easier argument in that case. Notice that, as non-erasing pattern languages or array patterns cannot reasonably cope with the empty word or the empty array, we disregard this in the complement operation.

Proposition 6.

For any alphabet Σ\Sigma, Σ1D\mathcal{L}^{\operatorname{\texttt{1D}}}_{\Sigma} is not closed under complementation.

Proof.

Let Σ\Sigma be some alphabet with aΣa\in\Sigma. Consider the pattern α=xy\alpha=xy. The complement (disregarding the empty word) contains as shortest words a word of the form aa. This implies that a pattern β\beta describing the complement must have length one, i.e., β=x\beta=x. Hence, L(β)=Σ+L(\beta)=\Sigma^{+}, which is not the complement of L(α)L(\alpha). ∎

Corollary 3.

None of the array pattern language classes under consideration (over any alphabet) is closed under complementation.

Notice that in the other cases (but complementation), we cannot cope with unary alphabets. This might need some different arguments.

We shall now turn to operations that are described by different kinds of morphisms. For the array case, codings (or projections) is a common such operation.

Theorem 1.

Any of our array pattern language classes (over arbitrary alphabets) is closed under projections.

Proof.

The following proof works for every z{h,p,r,c,rc}z\in\{h,p,r,c,rc\}. Let α\alpha be some array pattern and let π:ΣΓ\pi:\Sigma\to\Gamma be a surjective mapping that describes some projection. We shall now show that π(LΣ,z(α))=LΓ,z(α)\pi(L_{\Sigma,z}(\alpha))=L_{\Gamma,z}(\alpha).

Namely, consider some array ULΣ,z(α)U\in L_{\Sigma,z}(\alpha). UU is obtained from α\alpha by replacing any variable xx occurring in α\alpha by some array h(x)h(x). If we replace xx by π(h(x))\pi(h(x)) instead (which has the same dimensions as h(x)h(x)), we can see that π(U)LΓ,z(α)\pi(U)\in L_{\Gamma,z}(\alpha).

Conversely, fix some letter from π1(𝚊)\pi^{-1}(\mathtt{a}) for each 𝚊Γ\mathtt{a}\in\Gamma for now and denote it by κ(𝚊)\kappa(\mathtt{a}). This is possible, as π\pi is a surjective mapping. As π(κ(𝚊))=𝚊\pi(\kappa(\mathtt{a}))=\mathtt{a} for each 𝚊Γ\mathtt{a}\in\Gamma by construction, for any ULΓ,z(α)U\in L_{\Gamma,z}(\alpha) we can describe some VLΣ,x(α)V\in L_{\Sigma,x}(\alpha) such that π(V)=U\pi(V)=U, just by taking V=κ(U)V=\kappa(U). ∎

The result does not generalize to (string) morphisms where each image is of the same length.

Proposition 7.

For any non-unary alphabet Σ\Sigma, Σ1D\mathcal{L}^{\operatorname{\texttt{1D}}}_{\Sigma} is not closed under morphisms that map every letter to a word of length two.

Proof.

Consider the pattern xx on the alphabet Σ={𝚊,𝚋}\Sigma=\{\mathtt{a},\mathtt{b}\}, describing the universal language Σ+\Sigma^{+}, and the morphism hh with h(𝚊)=𝚊𝚋h(\mathtt{a})=\mathtt{a}\mathtt{b} and h(𝚋)=𝚊𝚋h(\mathtt{b})=\mathtt{a}\mathtt{b}. Then, h(Σ+)={𝚊𝚋}+h(\Sigma^{+})=\{\mathtt{a}\mathtt{b}\}^{+}, which is not a pattern language, as an easy analysis shows. ∎

Corollary 4.

None of the array pattern language classes under consideration (over some non-unary alphabet) is closed under two-dimensional morphisms.

This is also true for the more general operation of substitution, with the same examples.

Let us also remark that Proposition 7 did not rely on the fact that we restricted our attention to one specific non-unary alphabet Σ\Sigma. However, if we have a specific alphabet, then we can even state:

Proposition 8.

Any of our array pattern language classes (over some fixed alphabet Σ\Sigma) is closed under some projection π:ΣΣ\pi:\Sigma\to\Sigma if and only if π\pi is a bijection.

Proof.

If π\pi is some bijection, then the argument given in the proof of Theorem 1 applies. Recall now that for finite sets as Σ\Sigma, π\pi is a bijection if and only if π\pi is a surjection. If π\pi is not a bijection, then π\pi is not a surjection; hence, there is some bΣπ(Σ)b\in\Sigma\setminus\pi(\Sigma), Consider the pattern α=x\alpha=x. Clearly, π(LΣ,z(x))=(π(Σ))\pi(L_{\Sigma,z}(x))=(\pi(\Sigma))^{**}, z{h,p,r,c,rc}z\in\{h,p,r,c,rc\}, but any array pattern language over Σ\Sigma will also contain patterns with the letter bb. ∎

This immediately implies the following two results:

Corollary 5.

Any of our array pattern language classes (over binary alphabets) is closed under conjugation.

Corollary 6.

None of our array pattern language classes (over some fixed alphabet Σ\Sigma) is closed under all letter-to-letter morphisms.

Alternatively, we could also look at inverse morphisms. Here, we already get negative results for inverse codings.

Proposition 9.

For any alphabet Σ\Sigma with at least four letters, Σ1D\mathcal{L}^{\operatorname{\texttt{1D}}}_{\Sigma} is not closed under inverse letter-to-letter morphisms.

Proof.

Consider the coding h:𝚊1,𝚋1,𝚌2,𝚍3h:\mathtt{a}\mapsto 1,\mathtt{b}\mapsto 1,\mathtt{c}\mapsto 2,\mathtt{d}\mapsto 3. The pattern xxxx generates (over the alphabet {1,2,3}\{1,2,3\}) the language L={www{1,2,3}+}L=\{ww\mid w\in\{1,2,3\}^{+}\}. However, L=h1(L)L^{\prime}=h^{-1}(L) is not a pattern language. The shortest words in LL^{\prime} are of length two, so that a hypothetical pattern for LL^{\prime} must be of the form yzyz or yyyy. In the first case, 𝚌𝚍L\mathtt{c}\mathtt{d}\notin L^{\prime} is produced, while in the second case, 𝚊𝚋L\mathtt{a}\mathtt{b}\in L^{\prime} cannot be produced. ∎

Corollary 7.

None of the array pattern language classes under consideration (over some sufficiently large alphabet) is closed under inverse (two-dimensional) morphisms.

6.2 Operations Similar to String Language Operations

Let us first turn to the concatenation operation. As a warm-up, we first consider the string case.

Lemma 9.

For any alphabet Σ\Sigma, Σ1D\mathcal{L}^{\operatorname{\texttt{1D}}}_{\Sigma} is closed under concatenation.

Proof.

Consider two patterns α\alpha and β\beta. After renaming, we can assume that α\alpha and β\beta do not contain any identical variables. Then, LΣ1D(αβ)=LΣ1D(α)LΣ1D(β)L^{\operatorname{\texttt{1D}}}_{\Sigma}(\alpha\beta)=L^{\operatorname{\texttt{1D}}}_{\Sigma}(\alpha)L^{\operatorname{\texttt{1D}}}_{\Sigma}(\beta). ∎

The first thing one should note is that the concatenation of two arrays could be undefined (i. e., if their dimensions do not match), even though the concatenation of the two according languages need not be empty. However, we can prove:

Theorem 2.

Fix some alphabet Σ\Sigma.

  • Σ,r\mathcal{L}_{\Sigma,r} is closed under row concatenation \varominus;

  • Σ,c\mathcal{L}_{\Sigma,c} is closed under column concatenation \varobar;

  • Σ,p\mathcal{L}_{\Sigma,p} and Σ,h\mathcal{L}_{\Sigma,h} are closed both under row and under column concatenation.

Proof.

We only prove the first item. The others follow similarly. Observe that in the case of Σ,h\mathcal{L}_{\Sigma,h}, we need Lemmas 1 and 2 to finish the argument. Let α\alpha and β\beta be two array patterns. We can assume that the variable alphabets of α\alpha and β\beta are disjoint. We want to construct an array pattern γ\gamma such that

LΣ,r(γ)=LΣ,r(α)LΣ,r(β).()L_{\Sigma,r}(\gamma)=L_{\Sigma,r}(\alpha)\varominus L_{\Sigma,r}(\beta).\qquad(*)

Let mαm_{\alpha} be the number of rows of α\alpha and nαn_{\alpha} be the number of columns of α\alpha. Accordingly, mβm_{\beta} is the number of rows of β\beta and nβn_{\beta} is the number of columns of β\beta. If nα=nβn_{\alpha}=n_{\beta}, then we can set γ=αβ\gamma=\alpha\varominus\beta to satisfy ()(*) as in the string case of Lemma 9. More generally, set n=lcm(nα,nβ)n=\operatorname{lcm}(n_{\alpha},n_{\beta}). nn is the width of the smallest arrays in LΣ,r(α)LΣ,r(β)L_{\Sigma,r}(\alpha)\varominus L_{\Sigma,r}(\beta). More generally speaking, any array in LΣ,r(α)LΣ,r(β)L_{\Sigma,r}(\alpha)\varominus L_{\Sigma,r}(\beta) has some width that is a multiple of nn. We are going to exploit this property by constructing two array patterns α\alpha^{\prime} and β\beta^{\prime} of width nn such that

LΣ,r(α)LΣ,r(β)=LΣ,r(α)LΣ,r(β),L_{\Sigma,r}(\alpha)\varominus L_{\Sigma,r}(\beta)=L_{\Sigma,r}(\alpha^{\prime})\varominus L_{\Sigma,r}(\beta^{\prime}),

so that we can apply our previous reasoning, defining now γ=αβ\gamma=\alpha^{\prime}\varominus\beta^{\prime}. Consider the two-dimensional morphism hαh_{\alpha} that maps every variable xx of α\alpha on an array of height one and width nα=lcm(nα,nβ)nαn^{\prime}_{\alpha}=\frac{\operatorname{lcm}(n_{\alpha},n_{\beta})}{n_{\alpha}}, more precisely, onto x1x2xnαx_{1}x_{2}\cdots x_{n^{\prime}_{\alpha}}. Here, x1,,xnαx_{1},\dots,x_{n^{\prime}_{\alpha}} are “new variables.” Then, hα(α)h_{\alpha}(\alpha) is an array pattern of width n=nαnαn=n_{\alpha}\cdot n^{\prime}_{\alpha}. Similarly, we define a morphism hβh_{\beta}, yielding an array pattern hβ(β)h_{\beta}(\beta) of width n=nβnβn=n_{\beta}\cdot n^{\prime}_{\beta}. Now, any array UU in LΣ,r(α)L_{\Sigma,r}(\alpha^{\prime}) has a width that is a multiple of nn and also belongs to LΣ,r(α)L_{\Sigma,r}(\alpha), and conversely any ULΣ,r(α)U\in L_{\Sigma,r}(\alpha) that has a width that is a multiple of nn belongs to LΣ,r(α)L_{\Sigma,r}(\alpha^{\prime}). Together with similar statements for the pattern β\beta, the claim follows. ∎

It is not a coincidence that for Σ,r\mathcal{L}_{\Sigma,r} and Σ,c\mathcal{L}_{\Sigma,c}, we had to focus on the “correct” concatenation operation in the preceding theorem. More precisely, we can show:

Theorem 3.

Fix some non-unary alphabet Σ\Sigma.

  • Σ,r\mathcal{L}_{\Sigma,r} is not closed under column concatenation \varobar;

  • Σ,c\mathcal{L}_{\Sigma,c} is not closed under row concatenation \varominus;

  • Σ,rc\mathcal{L}_{\Sigma,rc} is neither closed under row nor under column concatenation.

Proof.

Again, we only prove the first item; the others can be seen in a similar fashion.

Consider the array patterns α=[x1x2x2x3]\alpha=\begin{bmatrix}x_{1}&x_{2}\\ x_{2}&x_{3}\end{bmatrix} and β=[y1y2y2y3]\beta=\begin{bmatrix}y_{1}&y_{2}\\ y_{2}&y_{3}\end{bmatrix}. Notice that LΣ,r(α)=LΣ,r(β)L_{\Sigma,r}(\alpha)=L_{\Sigma,r}(\beta), There are arrays of width four and height two in L:=LΣ,r(α)LΣ,r(β)L:=L_{\Sigma,r}(\alpha)\varobar L_{\Sigma,r}(\beta), and these are the smallest arrays in LL. Hence, any array pattern γ\gamma with L=LΣ,r(γ)L=L_{\Sigma,r}(\gamma) has width four and height two. Let γ=[z1z2z3z4z5z6z7z8]\gamma=\begin{bmatrix}z_{1}&z_{2}&z_{3}&z_{4}\\ z_{5}&z_{6}&z_{7}&z_{8}\end{bmatrix}, with possibly some of the variables being the same. As [𝚊𝚋𝚊𝚋𝚋𝚊𝚋𝚊]L\begin{bmatrix}\mathtt{a}&\mathtt{b}&\mathtt{a}&\mathtt{b}\\ \mathtt{b}&\mathtt{a}&\mathtt{b}&\mathtt{a}\\ \end{bmatrix}\in L, but [𝚊𝚋𝚊𝚊𝚋𝚊𝚋𝚊]L\begin{bmatrix}\mathtt{a}&\mathtt{b}&\mathtt{a}&\mathtt{a}\\ \mathtt{b}&\mathtt{a}&\mathtt{b}&\mathtt{a}\\ \end{bmatrix}\notin L and also [𝚊𝚊𝚊𝚋𝚋𝚊𝚋𝚊]L\begin{bmatrix}\mathtt{a}&\mathtt{a}&\mathtt{a}&\mathtt{b}\\ \mathtt{b}&\mathtt{a}&\mathtt{b}&\mathtt{a}\\ \end{bmatrix}\notin L, z2=z5z_{2}=z_{5} and z4=z7z_{4}=z_{7}. More generally, it can be verified that the array pattern ζ=[z1z2z3z4z2z6z4z8]\zeta=\begin{bmatrix}z_{1}&z_{2}&z_{3}&z_{4}\\ z_{2}&z_{6}&z_{4}&z_{8}\end{bmatrix} describes those and only those arrays of width four and height two that belong to LL. However, U=[𝚊𝚊𝚋𝚊𝚋𝚋𝚋𝚊𝚋𝚋𝚊𝚋]U=\begin{bmatrix}\mathtt{a}&\mathtt{a}&\mathtt{b}&\mathtt{a}&\mathtt{b}&\mathtt{b}\\ \mathtt{b}&\mathtt{a}&\mathtt{b}&\mathtt{b}&\mathtt{a}&\mathtt{b}\end{bmatrix} is an array from LΣ,r(ζ)L_{\Sigma,r}(\zeta) (namely, consider z1=𝚊𝚊z_{1}=\mathtt{a}\mathtt{a}, z2=𝚋𝚊z_{2}=\mathtt{b}\mathtt{a}, z3=z4=z6=𝚋z_{3}=z_{4}=z_{6}=\mathtt{b} and z8=𝚊𝚋z_{8}=\mathtt{a}\mathtt{b}) that does not belong to LL, as this would mean that U=U1U2U=U_{1}\varobar U_{2} for some array U1U_{1} or U2U_{2} of width two and height two from LΣ,r(α)=LΣ,r(β)L_{\Sigma,r}(\alpha)=L_{\Sigma,r}(\beta). However, neither U1=[𝚊𝚊𝚋𝚊]U_{1}=\begin{bmatrix}\mathtt{a}&\mathtt{a}\\ \mathtt{b}&\mathtt{a}\end{bmatrix} nor U2=[𝚋𝚋𝚊𝚋]U_{2}=\begin{bmatrix}\mathtt{b}&\mathtt{b}\\ \mathtt{a}&\mathtt{b}\end{bmatrix} belongs to LΣ,r(α)=LΣ,r(β)L_{\Sigma,r}(\alpha)=L_{\Sigma,r}(\beta). ∎

Notice that the proofs of negative closure properties necessitate a non-unary alphabet to work.

We now turn to the Kleene closure. Here, we can again first show a non-closure result for the string case that then readily transfers to the array cases.

Lemma 10.

Let Σ\Sigma be a non-unary alphabet. Consider α=xx\alpha=xx. Then, (LΣ1D(α))+Σ1D(L^{\operatorname{\texttt{1D}}}_{\Sigma}(\alpha))^{+}\notin\mathcal{L}^{\operatorname{\texttt{1D}}}_{\Sigma}.

Proof.

The shortest words in L:=(LΣ1D(α))+L:=(L^{\operatorname{\texttt{1D}}}_{\Sigma}(\alpha))^{+} are of length two. Hence, there are only two different possibilities for any pattern β\beta with LΣ1D(β)=LL^{\operatorname{\texttt{1D}}}_{\Sigma}(\beta)=L: If β=α=xx\beta=\alpha=xx, then 𝚊𝚊𝚋𝚋LLΣ1D(β)\mathtt{a}\mathtt{a}\mathtt{b}\mathtt{b}\in L\setminus L^{\operatorname{\texttt{1D}}}_{\Sigma}(\beta), while if β=xy\beta=xy, then 𝚊𝚋LΣ1D(β)L\mathtt{a}\mathtt{b}\in L^{\operatorname{\texttt{1D}}}_{\Sigma}(\beta)\setminus L. ∎

Proposition 10.

Let Σ\Sigma be a non-unary alphabet. Then, none of the array language families Σ,x\mathcal{L}_{\Sigma,x} with x{r,c,rc,p,h}x\in\{r,c,rc,p,h\} is closed under column concatenation closure nor under row concatenation closure.

Proof.

Consider Σ,r\mathcal{L}_{\Sigma,r}. Due to Lemmas 7 and 10, this class is not closed under row concatenation closure. For the case of column contentation closure, reconsider the proof of Theorem 3. There, we have presented a language LΣ,rL\in\mathcal{L}_{\Sigma,r} such that LLΣ,rL\varobar L\notin\mathcal{L}_{\Sigma,r}. But that argument also shows that the column contentation closure of LL does not belong to Σ,r\mathcal{L}_{\Sigma,r}.

The other cases are simillarly seen. For the case of morphisms, observe that the contradiction in Lemma 10 was derived by substituting the variables by words of the same length. ∎

6.3 Operations Special to Arrays

Recall that the transposition operation is first defined for arrays (or patterns) and can then be lifted to languages and even to language classes. Nearly by definition, we find:

Lemma 11.

Let Σ\Sigma be some alphabet. Let α\alpha be a pattern. Then, LΣ,r(α)T=LΣ,c(αT){L_{\Sigma,r}(\alpha)}^{\texttt{T}}=L_{\Sigma,c}({\alpha}^{\texttt{T}}) and LΣ,c(α)T=LΣ,r(αT){L_{\Sigma,c}(\alpha)}^{\texttt{T}}=L_{\Sigma,r}({\alpha}^{\texttt{T}}).

Corollary 8.

Let Σ\Sigma be some alphabet. Then, Σ,rT=Σ,c{\mathcal{L}_{\Sigma,r}}^{\texttt{T}}=\mathcal{L}_{\Sigma,c} and Σ,cT=Σ,r{\mathcal{L}_{\Sigma,c}}^{\texttt{T}}=\mathcal{L}_{\Sigma,r}.

Since α:=[x1x2x2x1]\alpha:=\begin{bmatrix}x_{1}&x_{2}\\ x_{2}&x_{1}\\ \end{bmatrix} is identical to its transposition and, as shown in the proof of Lemma 6, describes an rr pattern language (a cc pattern language), which is not a cc pattern language (not an rr pattern language, respectively), we can conclude the following:

Proposition 11.

Let Σ\Sigma be an alphabet. Neither Σ,c\mathcal{L}_{\Sigma,c} nor Σ,r\mathcal{L}_{\Sigma,r} are closed under transposition.

Proof.

Consider the pattern α:=[x1x2x2x1]\alpha:=\begin{bmatrix}x_{1}&x_{2}\\ x_{2}&x_{1}\\ \end{bmatrix}. As α=αT\alpha={\alpha}^{\texttt{T}},

LΣ,r(α)T=LΣ,c(αT)=LΣ,c(α)Σ,r,{L_{\Sigma,r}(\alpha)}^{\texttt{T}}=L_{\Sigma,c}({\alpha}^{\texttt{T}})=L_{\Sigma,c}(\alpha)\notin\mathcal{L}_{\Sigma,r},

as we have shown in Lemma 6. Symmetrically, the other claim follows. ∎

Proposition 12.

For any alphabet Σ\Sigma and x{h,p,rc}x\in\{h,p,rc\}, Σ,x\mathcal{L}_{\Sigma,x} is closed under transposition.

Proof.

For hh and pp, this claim is immediate from the fact that we have proper factorizations. For the case x=rcx=rc, we use Lemma 11. Let α\alpha be some pattern. Then,

LΣ,rc(α)T\displaystyle{L_{\Sigma,rc}(\alpha)}^{\texttt{T}} =\displaystyle= (LΣ,r(α)LΣ,c(α))T\displaystyle{({L_{\Sigma,r}(\alpha)}\cup{L_{\Sigma,c}(\alpha)})}^{\texttt{T}}
=\displaystyle= LΣ,c(αT)LΣ,r(αT)\displaystyle L_{\Sigma,c}({\alpha}^{\texttt{T}})\cup L_{\Sigma,r}({\alpha}^{\texttt{T}})
=\displaystyle= LΣ,rc(αT)\displaystyle L_{\Sigma,rc}({\alpha}^{\texttt{T}})

This immediately implies the claim. ∎

With respect to purely geometric operations as turns and reflections, we find the following:

Proposition 13.

Let Σ\Sigma be some alphabet.

  • Σ,rc\mathcal{L}_{\Sigma,rc}, Σ,p\mathcal{L}_{\Sigma,p} and Σ,h\mathcal{L}_{\Sigma,h} are closed under quarter-turn.

  • For every x{r,c,rc,p,h}x\in\{r,c,rc,p,h\}, Σ,x\mathcal{L}_{\Sigma,x} is closed under half-turn and reflections.

  • Σ,r\mathcal{L}_{\Sigma,r} and Σ,c\mathcal{L}_{\Sigma,c} are closed neither under left nor under right turn.

Proof.

For the positive closure results, simply observe that the language described by the quarter-turn, by the half-turn or by a reflection of the array pattern α\alpha is just the quarter-turn, the half-turn or the reflection of the language described by α\alpha.

For the non-closure properties, by symmetry it suffices to show that there is a language in Σ,r\mathcal{L}_{\Sigma,r} whose quarter-turn is not in Σ,r\mathcal{L}_{\Sigma,r}. To this end, consider L:=LΣ,r([xyyx])L:=L_{\Sigma,r}\left(\begin{bmatrix}x&y\\ y&x\end{bmatrix}\right). Observe that the quarter-turn of LL is the same as LΣ,c([xyyx])L_{\Sigma,c}\left(\begin{bmatrix}x&y\\ y&x\end{bmatrix}\right), which was proven not to be in Σ,r\mathcal{L}_{\Sigma,r} in Lemma 6. ∎

The positive closure properties can be easily observed by applying the geometric operation directly on the array pattern. In order to show non-closure of Σ,r\mathcal{L}_{\Sigma,r} and Σ,c\mathcal{L}_{\Sigma,c} with respect to left and right turn, it is again sufficient to observe that the pattern α\alpha from above is identical to its left or right turn and then apply a similar argument as in the proof of Lemma 6.

Due to symmetry, it does not matter if we consider horizontal or vertical reflections. Notice that both half-turns and reflections coincide in the string case in any meaningful, non-trivial interpretation; in that case, the operation is also known as mirror image.

7 Future Research Directions

A thorough investigation of the typical decision problems for two-dimensional pattern languages like the membership, inclusion and equivalence problem is left for future research. It can be easily seen that the NP-completeness of the membership problem for string pattern languages carries over to Σ,x\mathcal{L}_{\Sigma,x}, x{p,r,c,rc}x\in\{p,r,c,rc\}. On the other hand, for a given array pattern α\alpha and a terminal array WW, the question whether or not WLΣ,h(α)W\in L_{\Sigma,h}(\alpha) can be decided in polynomial time by checking whether WW is a morphic image of α\alpha with respect to a (|W|r|α|r,|W|c|α|c)(\frac{|W|_{r}}{|\alpha|_{r}},\frac{|W|_{c}}{|\alpha|_{c}})-uniform substitution. As shown by Lemma 3, the equivalence problem for all the classes Σ,x\mathcal{L}_{\Sigma,x} with x{h,p,r,c,rc}x\in\{h,p,r,c,rc\} and |Σ|2|\Sigma|\geq 2 can be easily solved by simply comparing the patterns. However, for every z,z{h,p,r,c,rc}z,z^{\prime}\in\{h,p,r,c,rc\}, zzz\neq z^{\prime}, the problem to decide for given patterns α\alpha and β\beta whether or not LΣ,z(α)=LΣ,z(β)L_{\Sigma,z}(\alpha)=L_{\Sigma,z^{\prime}}(\beta) might be worth investigating. The inclusion problem for terminal-free nonerasing string pattern languages is still open. Hence, with respect to the inclusion problem, a positive decidability result for two-dimensional pattern languages implies a positive decidability result for terminal-free nonerasing string pattern languages.

For string pattern languages it is common to use terminal symbols in the patterns as well as to consider the erasing case, i. e., variables can be replaced by the empty word. The pp pattern languages can be adapted to the erasing case by allowing variables to be substituted by the empty array. Furthermore, the situation of having a terminal symbol at position (i,j)(i,j) of an array pattern simply forces all the variables in the ithi^{\text{th}} row to be substituted by arrays of height 11 and all the variables in the jthj^{\text{th}} column to be substituted by arrays of width 11. As in the string case, it is likely that in the two-dimensional case the difference between erasing and nonerasing substitutions and patterns with and without terminal symbols lead to different language classes with different decidability properties, too.

Finally, we wish to point out that it is straightforward to generalise our different classes of two-dimensional pattern languages to the three-dimensional or even nn-dimensional case.

References

  • [1] D. Angluin. Finding patterns common to a set of strings. Journal of Computer and System Sciences, 21:46–62, 1980.
  • [2] H. Fernau, R. Freund, and M. Holzer. The generative power of dd-dimensional #-context-free array grammars. In M. Margenstern, editor, Proceedings of MCU’98, Volume 2, pages 43–56. University of Metz, 1998.
  • [3] H. Fernau, M. L. Schmid, and K. G. Subramanian. Two-dimensional pattern languages. In S. Bensch, F. Drewes, R. Freund, and F. Otto, editors, Fifth Workshop on Non-Classical Models for Automata and Applications, NCMA, volume 294 of books@ocg.at, pages 117–132. Österreichische Computer Gesellschaft, 2013.
  • [4] R. Freund, G. Păun, and G. Rozenberg. Chapter 8: Contextual array grammars. In C. Martín-Vide, V. Mitrana, and G. Păun, editors, Series in Machine Perception and Artificial Intelligence: Volume 66 - Formal Models, Languages and Applications, pages 112–136. World Scientific, 2007.
  • [5] J. E. F. Friedl. Mastering Regular Expressions. O’Reilly, Sebastopol, CA, third edition, 2006.
  • [6] D. Giammarresi and A. Restivo. Recognizable picture languages. International Journal of Pattern Recognition and Artificial Intelligence, 6:31–46, 1992.
  • [7] D. Giammarresi and A. Restivo. Two-dimensional languages. In G. Rozenberg and A. Salomaa, editors, Handbook of Formal Languages, volume 3, chapter 4, pages 215–267. Springer, 1997.
  • [8] D. Giammarresi, A. Restivo, S. Seibert, and W. Thomas. Monadic second-order logic over rectangular pictures and recognizability by tiling systems. Information and Computation (formerly Information and Control), 125:32–45, 1996.
  • [9] A. Mateescu and A. Salomaa. Patterns. In G. Rozenberg and A. Salomaa, editors, Handbook of Formal Languages, volume 1, pages 230–242. Springer, 1997.
  • [10] O. Matz. Recognizable vs. regular picture languages. In Proc. 2nd International Conference on Algebraic Informatics, CAI 2007, volume 4728 of Lecture Notes in Computer Science, pages 75–86, 2007.
  • [11] K. Morita. Two-dimensional languages. In C. Martín-Vide, V. Mitrana, and G. Păun, editors, Studies in Fuzziness and Soft Computing - Formal Languages and Applications, pages 427–437. Springer, 2004.
  • [12] A. Rosenfeld. Picture Languages: Formal Models for Picture Recognition. Academic Press, Inc., Orlando, 1979.
  • [13] A. Rosenfeld and R. Siromoney. Picture languages – a survey. Languages of Design, 1:229–245, 1993.
  • [14] G. Siromoney, R. Siromoney, and K. Krithivasan. Picture languages with array rewriting rules. Information and Control, 22:447–470, 1973.
  • [15] P. S. P. Wang. Array Grammars, Patterns and Recognizers. World Scientific Publishing Co., Inc., NJ, USA, 1989.