Subshifts as Models for MSO Logic

We study the Monadic Second Order (MSO) Hierarchy over colourings of the discrete plane, and draw links between classes of formula and classes of subshifts. We give a characterization of existential MSO in terms of projections of tilings, and of univ…

Authors: Emmanuel Je, el (LIF), Guillaume Theyssier (LAMA)

Subshifts as Models for MSO Logic ✩ Emmanu el Jeandel a , Guillaume Theyssier b a LORIA, UMR 7503 - Campus Scien tifique , BP 239 54 506 V ANDOEUVRE-L ` ES-N ANCY , FRANCE b LAMA (Univer sit ´ e de Savoie, CNRS) Campus Scien tifique , 73376 Le Bour get -du-lac cede x F RANCE Abstract W e study the Monadic Second Order (MSO) Hierarchy ov er colourings of the discrete plane, and draw links between classes o f formu la and classes o f subshifts. W e give a characteriz ation of existential MSO in term s of pr ojections of tilings, and of uni versal sentences in terms of combinations of “pattern counting ” su bshifts. Conversely , we character- ise logic fragments corresp onding to various classes of su bshifts (subshifts of finite type, s ofic subshifts, all subshifts). Finally , we sho w by a s eparation result how the situation here is di ff erent fro m the case of tiling pictures studied e arlier by Giammarresi et al. K e ywor ds: Symbolic Dynamics, Mode l Theory , T ilings 1. Introduction There is a clo se connection be tween words and m onadic second-or der (MSO) logic. B ¨ uchi and E lgot proved for finite words that MSO- formu las corr espond exactly to regular langua ges. Th is relationship was d ev eloped fo r other classes of labeled graphs; trees or infinite words enjoy a similar connection. See [ 1 , 2 ] for a surve y of existing results. Colorings of the e ntire plan e, i.e tilings, represent a natural gen eralization of biinfinite words to high er dimension s, and as such enjoy similar proper ties. W e plan to stud y in this p aper tilings for the point of view of mon adic second-o rder logic. From a co mputer science point of view , tilings and more generally subshifts are the un derlying objects of several computin g models inclu ding cellular au tomata [ 3 , 4 , 5 ], W ang tiles [ 6 , 7 ] and self-assembly tiling s [ 8 , 9 ]. F ollowing the r ecent trend to better understand such ’na tural comp uting mod els’, one of the m otiv ations of th e pr esent p aper is to extend to wards these models the fruitfu l links established between languages of finite w ords and MSO logic. T ilings and logic have a shared h istory . The introduction of tilings can be trace d b ack to Hao W ang [ 10 ], who introdu ced his celebrated tiles to study the (un )decidab ility of the ∀∃∀ fragment of first order logic. The undecidab ility of the domino prob lem b y his Ph D Stu dent Berger [ 11 ] lead then to the und ecidability of th is fragme nt [ 1 2 ]. Seese [ 13 , 1 4 ] used the d omino problem to prove that grap hs with a decid able MSO theo ry have a boun ded tree width . Makowsk y[ 15 , 16 ] used the construction by Robinson [ 17 ] to gi ve the first e xample of a finitely axiomatizable theory that is s uper-stable. More recently , Oger [ 18 ] g av e generalizations o f class ical results on tiling s to locally finite relational structures. See the survey [ 19 ] for more details. Previously , a finite variant of tiling s, called tiling pictu res, was studied [ 20 , 21 ]. T iling p ictures corresp ond to coloring s of a finite re gion of the p lane, this re gion bein g b ordered by special ‘ # ’ symbols. It is proven for this particular mo del that lang uage reco gnized by EMSO-fo rmulas corr espond exactly to so-ca lled finite tiling systems, i.e. projections of finite tilings. The equiv alent o f finite tiling systems for in finite pictures are so-called sofic subshifts [ 22 ]. A sofic su bshift repres- ents intuitiv ely local properties and ensures that e very point of the plane beha ves in the same way . A s a consequence, ✩ The authors are partial ly supported by ANR-09-BLAN-0164. Email addr esse s: emmanuel.j eandel@l oria.fr (Emmanuel Jeand el), guillaume.t heyssier @univ-savoie.fr (Guillaume Theyssier) Prep rint submitt ed to Elsevier 26th Septe mber 2018 there is no general w ay to en force th at some specific color, say A , app ears at least once. Hence, some simple first-order existential for mulas h av e no equiv alent as sofic subshift (an d even subshift). Th is is where the borde r of # for finite pictures play an important role: W ithout such a border, re sults on finite pictures would also stumble on this is sue. See [ 23 ] for similar results on finite pictures without borders. W e deal primarily in this article with subshifts. See [ 24 ] for other acceptance conditions (what we called subshifts of finite type correspon d to A-acceptan ce in this paper) . Finally , note th at all d ecision problems in o ur context are non- trivial : T o decide if a uni versal first-ord er fo rmula is satisfiable (the do mino pro blem, presented ear lier) is not recur si ve. W orse, it is Σ 1 1 -hard to d ecide if a tiling of th e p lane exists where some gi ven color appears infinitely often [ 25 , 24 ]. As a conseque nce, the satisfiability of MSO-formulas is at least Σ 1 1 -hard. In this paper, we will pr ove ho w various classes of fo rmula corre spond to well known classes of subshifts. Some of the results of this paper were already presented in [ 26 ]. 2. Symbolic Spaces and Logic 2.1. Config urations Consider the discrete lattice Z 2 . For any finite set Q , a Q -configur ation is a function from Z 2 to Q . Q may be s een as a set of colors or states . An element of Z 2 will be called a cell . A configu ration wi ll usually be denoted C , M or N . Fig. 1 sh ows an examp le of two d i ff erent co nfiguratio ns o f Z 2 over a set Q o f 5 color s. As a configu ration is infinite, only a finite fragment of the configurations is represented in t he fi gure. W e choose not to represent which cell of the picture is the origin (0 , 0). This will indeed be of no importance as we use only translation in variant properties. For any z ∈ Z 2 we denote by σ z the shift map of vector z , i.e. the functio n from Q - configur ations to Q - configur ations such that for all C ∈ Q Z 2 : ∀ z ′ ∈ Z 2 , σ z ( C ) ( z ′ ) = C ( z ′ − z ) . M N Figure 1: T wo configurati ons A pattern is a partial configur ation. A pattern P : X → Q where X ⊆ Z 2 occurs in C ∈ Q Z 2 at position z 0 if ∀ z ∈ X , C ( z 0 + z ) = P ( z ) . W e say that P occu rs in C if it occurs at some position in C . As an example the pa ttern P of Fig 2 o ccurs in the configur ation M b ut not in N ( or more accurately no t on th e fin ite fragm ent of N d epicted in the figur e). A finite pattern is a partial configur ation of finite doma in. All patterns in the fo llowing will be finite. The language L ( C ) o f a configur ation C is the set of finite patterns that occur in C . W e natur ally e xtend this notion to sets of configuratio ns. A subshift is a natural concept that captures both the notion of uniformity and loca lity : the only description “av ailable” from a con figuration C is the finite patter ns it contain s, that is L ( C ) . Given a set F o f pattern s, let X F be the set of all configuration s where no patterns of F occu rs. X F = { C |L ( C ) ∩ F = ∅} 2 Figure 2: A pattern P . P appe ars in M but pr esumably not in N Patterns: B C D E A Figure 3: A (finite) set of forbidde n patterns F and the tilings it generate s F is usually called the set of forb idden patterns or the forbidd en language . A set of the form X F is called a subshift . A subshift can be equ iv alentely de fined by topo logy consideratio ns. Endow the set of configu rations Q Z 2 with the product topology: A sequence ( C n ) n ∈ N of configuration s con verges to a configur ation C if the seque nce ultimately agree with C on every z ∈ Z 2 . T hen a subshift is a closed subset of Q Z 2 also closed by shift maps. Example 1. Consider the three for bidden pattern s of figur e 3 and denote by D the dark color an d L the light co lor . The first one says that we cannot find a D point at the left of a L po int. This ca n be interpreted as follows: every time we find a D poin t, then all the po ints at the right of it are also D . W ith the second for bidden patter n, we deduce that ev ery time we find a D point, then th e entire qu arter of pla ne on th e above right of it is also filled with D p oints. The third pattern ensur es u s that every co nfiguratio n contains at mo st one quarter o f plane of colo r D : if it contains two such quarters of plane, then there must be a bigger quarter of plane that contains both. Hence a typ ical co nfiguratio n look s like A . Other possible configur ations are B , C , D , E . They correspo nd to extremal situations where the corn er of the q uarter o f p lane is situated respectively at (0 , −∞ ), ( −∞ , 0), ( −∞ , −∞ ) et ( + ∞ , + ∞ ) Example 2. Consider the set of colors { D , W } and F to be the set of patter ns that contains tw o D points or more. Then X F contains co nfiguration s with at most one D poin t. Up to shift, X F contains then two configur ations: the all W -one, and one where only one point is D and all others are W . 3 A subshift o f finite type (o r tiling ) is a subshift that can be defined via a finite set F of forbidd en patterns: it is the set o f config urations C such that no p attern in F occu rs in C . If all p atterns of F fit in a n × n sq uare, this m eans that we only h av e to see a con figuration throu gh a window of size n × n to know if it is a tiling, hence th e lo cality . Example 1 is a subshif t of finite type. It can be proven that Exam ple 2 is not. Giv en two state sets Q 1 and Q 2 , a projection is a m ap π : Q 1 → Q 2 . W e n aturally exten d it to π : Q Z 2 1 → Q Z 2 2 by π ( C )( z ) = π ( C ( z )) . A sofic su bshift o f state set Q 2 is the imag e by some pr ojection π of some subshift of finite type of state set Q 1 . It is also a sub shift (clearly closed by shift maps, and to pologically closed because projectio ns are con tinuous map s on a compact space). A sofic subshift is a natural o bject in tiling theory , alth ough q uite ne ver mentioned explicitly . It re presents the conc ept of decoration : some of the tiles we assemble to obtain the tiling s may be decorated , but we forgot the decoration when we observe the ti ling. Example 3. Consider the following variant of Ex ample 1 : tilings are exactly th e same except that the corner of the quarter of plane in A is of a di ff erent color W . It is easy to see that this variant defines a subshift of finite type X (with a fe w more forbidd en patterns). Now consider the following map: π : L 7→ W D 7→ W W 7→ D Then B , C , D , E will becom e u nder π of co lor W , while A will beco me a configur ation with exactly one D , all other points being W . As a consequ ence, π ( X ) is exactly Example 2 . Example 2 is thus a sofic subshift. 2.2. Structures A configur ation will be seen in this article as an infinite structure. The signature τ contains four unary maps Nor th , South , East , W est and a predicate P c for each color c ∈ Q . A configu ration M will be seen as a structure M in the following w ay: • The elemen ts of M a re the points of Z 2 . • Nor th is interpreted by Nor th M (( x , y )) = ( x , y + 1), East is interpreted by East M (( x , y )) = ( x + 1 , y ). South M and W est M are interpreted similarly • P M c (( x , y )) is true if and only if the point at coordinate ( x , y ) is of color c , that is if M ( x , y ) = c . As an examp le, th e config uration M of Fig. 1 has three co nsecutive cells with the co lor A (seco nd row from th e top, colors are denoted A , B , C , D , E below). That is, the following formula is true: M | = ∃ z , P A ( z ) ∧ P A ( East ( z )) ∧ P A ( East ( East ( z ))) As another example, the following formu la states that the configuration has a vertical period of 2 (the colo r in the cell ( x , y ) is the same as the color in the cell ( x , y + 2) ). The formula is false in t he structure M and true in the structure N ( if the reader chose to color the cells of N n ot shown in the picture correctly) : ∀ z ,                    P A ( z ) = ⇒ P A ( Nor th ( Nor th ( z ))) P B ( z ) = ⇒ P B ( Nor th ( Nor th ( z ))) P C ( z ) = ⇒ P C ( Nor th ( Nor th ( z ))) P D ( z ) = ⇒ P D ( Nor th ( Nor th ( z ))) P E ( z ) = ⇒ P E ( Nor th ( Nor th ( z ))) Remark. The cho ice of unar y function (n orth, south, east, west) instead of binar y relations in th e signature above is important because it allows a simple characterization of impor tant classes of subshifts (see theorem 6 below). This particular theorem would fail with binary relations in the signature instead of unary functions. Other theorems would be still valid. 4 2.3. Monad ic Second-Order Logic This paper studies connectio n betwee n su bshifts (seen as structures as explained ab ove) and monad ic seco nd order sentences. First order variables ( x , y , z , ...) a re interpreted as points of Z 2 and (monad ic) second orde r variables ( X , Y , Z , ...) as subsets o f Z 2 . Monadic second order formulas ( φ , ψ , ...) are defined as follows: • a term is either a first-ord er v ariable or a function ( South , North , East , W est ) applied to a term ; • atomic formulas are of the form t 1 = t 2 or X ( t 1 ) where t 1 and t 2 are terms and X is either a second order v ariable or a color predicate ; • for mulas are build up fro m atomic for mulas b y means o f boolean con nectives and quan tifiers ∃ and ∀ (which can be applied either to first-orde r variables or second order v ariables). A formula is closed if no variable occurs f ree in it. A fo rmula is FO if no second -order quantifier occ urs in it. A formu la is EMSO if it is of the form ∃ X 1 , . . . , ∃ X n , φ ( X ) where φ is FO. Given a form ula φ ( X 1 , . . . , X n ) with no free first-o rder variable a nd having only X 1 , . . . , X n as free second-o rder variables, a configu ration M together with subsets E 1 , . . . , E n is a model of φ ( X 1 , . . . , X n ), denoted ( M , E 1 , . . . , E n ) | = φ ( X 1 , . . . , X n ) , if φ is satisfied (in the usual sense) when M is interpreted as M (see p revious section) and E i interprets X i . 2.4. Defina bility This paper stud ies the f ollowing prob lems: Given a formu la φ of some logic, what can be said o f th e configuration s that satisfy φ ? Con versely , giv en a subshift, what kind of formula can characterise it? Definition 1. A set S o f Q-co nfigurations is define d by φ if S = n M ∈ Q Z 2     M | = φ o T wo formulas φ and φ ′ ar e equivalent i ff th ey define the same set of configurations. A set S is C -defi nable if it is defined by a formula φ ∈ C . It is easy to see that Example 1 is defined by the formula φ :                          ∀ x , ¬ ( P D ( x ) ∧ P L ( East ( x )) ) ∀ x , ¬ ( P D ( x ) ∧ P L ( Nor th ( x )) ) ∀ x , ¬ ( P L ( x ) ∧ P D ( East ( x )) ∧ P L ( Nor th ( x )) ) or equiv alently by the form ula φ ′ : ∀ x , P D ( x ) ⇐ ⇒ ( P D ( East ( x ) ) ∧ P D ( Nor th ( x )) ) W e will see some v ariants of formula φ ′ appear in a few theorems belo w . Example 2 is defined by the formu la ψ : ∀ x , y , ( P D ( x ) ∧ P D ( y ) ) = ⇒ x = y Note that a definable set is always closed by shift (a shift b etween 2 configuratio ns induces an isomorph ism between correspo nding structures). It is not always closed: Th e set of { A , E } -configu rations defined by the form ula φ : ∃ z , P A ( z ) contains all configura tions except the all-white one, hence is not closed. 5 When we are dealing with MSO formu las, the following remark is u seful: second-or der quantifiers may be rep- resented as projection operations on sets of configura tions. W e f ormalize now this notion. If π : Q 1 7→ Q 2 is a projectio n and S is a set of Q 1 -configu rations, we define the two following operators: E ( π )( S ) = n M ∈ ( Q 2 ) Z 2     ∃ N ∈ ( Q 1 ) Z 2 , π ( N ) = M ∧ N ∈ S o A ( π )( S ) = n M ∈ ( Q 2 ) Z 2     ∀ N ∈ ( Q 1 ) Z 2 , π ( N ) = M = ⇒ N ∈ S o Note that A is a dual of E , that is A ( π )( S ) = c E ( π ) ( c S ) where c represents complemen tation. Proposition 1. • A set S of Q-config urations is EMSO-defina ble if and o nly if th er e exists a set S ′ of Q ′ config urations and a map π : Q ′ 7→ Q su ch that S = E ( π )( S ′ ) and S ′ is FO-defin able. • The class of MSO-defi nable s ets is the closure of the class of FO-defina ble sets by the operators E and A. P r oof ( S ketch ). Second item is a straightforward ref ormulation o f the p renex nor mal f orm of M SO using o perators E and A . W e prove here only the first item. • Let φ = ∃ X , ψ be a EMSO form ula th at defines a set S of Q -configu rations. Let Q ′ = Q × { 0 , 1 } and π b e the canonical projection from Q ′ to Q . Consider the formu la ψ ′ obtained from ψ by replacing X ( t ) by ∨ c ∈ Q P ( c , 1) ( t ) and P c ( t ) by P ( c , 0) ( t ) ∨ P ( c , 1) ( t ). Let S ′ be a set of Q ′ configur ations defined by ψ ′ . Then is it c lear that S = E ( π )( S ′ ). The generalization to more than one existential quantifier is straightforward. • Let S = E ( π )( S ′ ) be a set o f Q configur ations, a nd S ′ FO-definable by the fo rmula φ . Denote by c 1 . . . c n the elements of Q ′ . Consider the formu la φ ′ obtained from φ where each P c i is replaced by X i . L et ψ = ∃ X 1 , . . . , ∃ X n ,                ∀ z , ∨ i X i ( z ) ∀ z , ∧ i , j ( ¬ X i ( z ) ∨ ¬ X j ( z )) ∀ z , ∧ i  X i z = ⇒ P π ( c i ) ( z )  φ ′ Then ψ define s S . Note that the formula ψ constructed above is o f the form ∃ X 1 , . . . , ∃ X n ( ∀ z , ψ ′ ( z )) ∧ φ ′ . Th is will be importan t later .  Second-o rder quan tifications will then be regarded in this paper either as projections operator s or sets quantifier s. 3. Hanf Locality Lemma and EMSO The first-order logic has a property that makes it suitable to deal with tilings and configuratio ns: it is local. T his is illustrated by Hanf ’ s lemma [ 27 , 28 , 29 ]. A squ are pattern of radius n is a pattern of domain [ − n , n ] × [ n , n ]. Definition 2. T wo Q- config urations M a nd N ar e ( n , k ) -equiva lent if for each Q-squar e pattern P of radius n: • If P appears in M at most k times, then P appears the e xact same number of times in M an d in N • If P appears in M more than k times, then P ap pears in N mor e than k times This notio n is indeed an equiv alence r elation. Given n an d k , it is clear that there is only finitely many equiv alence classes for this relation. Contrary to definition 2 above, Hanf ’ s original formalism doesn’t use square shapes (balls for the k · k ∞ norm) but lozenges (balls for the k · k 1 norm) . It makes essentially no di ff erence and the Hanf ’ s local lemma can be refor mulated in our context as follo ws (proofs using formalism of definition 2 appear in [ 21 ]). 6 Theorem 2. F or every FO formula φ , ther e exists ( n , k ) such that if M a nd N a r e ( n , k ) equivalent, then M | = φ ⇐ ⇒ N | = φ Corollary 3. Every FO-definab le set is a (finite) union of some ( n , k ) -eq uivalence classes . This is theor em 3.3 in [ 21 ], stated for finite c onfigur ations. Lemma 3.5 in the sam e paper gives a proof of Hanf ’ s Local Lemma in our context. Giv en ( P , k ) we consider the set S = k ( P ) of all configu rations such that the pattern P occu rs e xactly k times ( k may be taken equal to 0). The set S ≥ k ( P ) is the set of all configur ations such that the pattern P occurs k times or mo re. W e may rephrase the preceding corollary as: Corollary 4. Every FO-defin able set is a positive comb ination (i.e. union s and intersections) of so me S = k ( P ) and some S ≥ k ( P ) Theorem 5. E very EMSO-defi nable s et can be define d by a formula φ of the form: ∃ X 1 , . . . , ∃ X n ,  ∀ z 1 , φ 1 ( z 1 , X 1 , . . . , X n )  ∧ ( ∃ z 1 , . . . , ∃ z p , φ 2 ( z 1 . . . z p , X 1 , . . . , X n )  , wher e φ 1 and φ 2 ar e quantifier-fr e e formulas. See [ 1 , Corollary 4.1] o r [ 3 0 , Corollary 4 .2] for a similar result. This result is an easy co nsequen ce of [ 3 1 , Theorem 3.2] (see also the corrigend um). W e include here a full proof. P r oof . Let C be the set of such form ulas. W e procee d in three steps: • Every EMSO-definab le set is the pro jection of a p ositiv e combination of some S = k ( P ) and S ≥ k ( P ) (using p rop. 1 and the preceding corollary) • Every S = ( P , k ) (resp. S ≥ ( P , k )) is C -definable • C -definab le sets are closed by (finite) un ion, intersection and projections. C -definab le sets are closed by projection using the equivalence of prop . 1 in the two directions, the note at the en d of the proof and some easy formula equiv alences. The same goes for intersection. Now we prove that C -definable sets are closed by union. Th e di ffi culty is to ensure that we use only one universal quantifier. Let φ and φ ′ be two C - formu las defining sets S 1 and S 2 . W e can suppose that φ and φ ′ use th e same number s of second-o rder quantifiers and of first-order existential quantifiers. Then the formu la ∃ X , ∃ X 1 , . . . , ∃ X n , ∀ z 1 ,                X ( z 1 ) ⇐ ⇒ X ( No r th ( z 1 )) X ( z 1 ) ⇐ ⇒ X ( E ast ( z 1 )) X ( z 1 ) = ⇒ φ 1 ( z 1 , X 1 . . . X n ) ¬ X ( z 1 ) = ⇒ φ ′ 1 ( z 1 , X 1 . . . X n ) ∧ ∃ z 1 , . . . , ∃ z p _ X ( z 1 ) ∧ φ 2 ( z 1 . . . z p , X 1 . . . X n ) ¬ X ( z 1 ) ∧ φ ′ 2 ( z 1 . . . z p , X 1 . . . X n ) defines S 1 ∪ S 2 (the disju nction is ob tained through variable X which is forced to rep resent either the empty set or the whole plane Z 2 ). It is now su ffi cient to pr ove that a S = k ( P ) set (r esp. a S ≥ k ( P ) set) is definable by a C -for mula. Let φ P ( z ) be the quantifier-free formula such that φ P ( z ) is true if and only if P appears at position z . 7 Then S = k ( P ) is definable by ∃ X 1 . . . ∃ X k ∃ A 1 , . . . , ∃ A k , ∀ x                ∧ i A i ( x ) ⇐ ⇒ [ A i ( Nor th ( x )) ∧ A i ( East ( x ) )] ∧ i X i ( x ) ⇐ ⇒ [ A i ( x ) ∧ ¬ A i ( South ( x )) ∧ ¬ A i ( W est ( x ))] ∧ i , j X i ( x ) = ⇒ ¬ X j ( x ) ( ∨ i X i ( x )) ⇐ ⇒ φ P ( x ) ∧ ∃ z 1 , . . . , ∃ z k , X 1 ( z 1 ) ∧ · · · ∧ X k ( z k ) The formula e nsures indee d that A i represents a qu arter of the plane, X i being a sing leton rep resenting the corner of that p lane. I f k = 0 this beco mes ∀ x , ¬ φ P ( x ). T o o btain a for mula for S ≥ k ( P ), chan ge the last ⇐ ⇒ to a = ⇒ in th e formu la.  4. Characteriza tion of S ubshifts of Finite T ype and Sofic Subshifts 4.1. Sub shifts of F inite T yp e W e start by a ch aracterization of subshifts of finite type (SFTs, i.e tilings). Th e problem with SFTs is that they are closed n either by pr ojection nor by union: the ’even shift’ is the pr ojection of a SFT but is not itself a SFT (see [ 32 ]) and if F 1 = { DE } an d F 2 = { ED } the n the union X F 1 ∪ X F 2 is not a SFT . As a consequen ce, the class of formu las correspo nding to SFTs is not very interesting: Theorem 6. A set of configuration s is a SFT if and only if it is defined by a formula of the form ∀ z , ψ ( z ) wher e ψ is qua ntifier-fr ee . Note that there is only one quantifier in this formula. Formulas with more than one uni versal quantifier do not alw ays correspo nd to SFT : This is due to SFTs not bein g closed by union. P r oof . Let P 1 . . . P n be patterns. T o eac h P i we associate the q uantifier-free formula φ P i ( z ) which is tru e if an d o nly if P i appears at the position z . T hen the subshifts that forbid s patterns P 1 . . . P n is defined by the formula: ∀ z , ¬ φ P 1 ( z ) ∧ · · · ∧ ¬ φ P n ( z ) Con versely , let ψ be a qu antifier-free formula. Each term t i in ψ is o f the form f i ( z ) where f i is some comb ination of the functio ns Nor th , South , East and Wes t , each f i thus r epresenting somehow some vector z i ( f i ( z ) = z + z i ). Let Z b e the collection of all vectors z i that appear in the for mula ψ . Now the fact that ψ is tru e a t the position z only depend s on the colors of the configuratio ns in points ( z + z 1 ) , . . . , ( z + z n ), i.e. on the pa ttern of d omain Z that occurs at position z . Let P be the set of patter ns of do main Z that makes ψ false. Then the set S define d by ψ is th e set of configur ations where no patterns in P occurs, hence a SFT .  4.2. Universal sentences Due to the way subshifts a re defined , un iv ersal quan tifiers play an imp ortant role. W e now ask the fo llowing question: what are the sets d efined by univ ersal form ulas? First the fo llowing lemma shows th at we can r estrict to first-order when considering univ ersal formulas. Lemma 7. Any universal MSO formula is equivalent to a first-or d er universal formula. P r oof . A universal formula is equiv alent (throug h permutation of uni versal quantifiers) to a formula of the form ∀ x 1 , . . . , x p , ∀ X 1 , . . . , X n , Φ ( X 1 , . . . , X n , x 1 , . . . , x p ) where Φ is quantifier-free. Consider the formu la ψ ( X 1 , . . . , X n − 1 , x 1 , . . . , x p ) ≡ ∀ X n , Φ ( X 1 , . . . , X n , x 1 , . . . , x p ) 8 Let { t 1 , . . . , t k } be the set of terms t such that X n ( t ) occurs in Φ . The idea is that the truth value of Φ ( X 1 , . . . , X n , x 1 , . . . , x p ) depend s on ly on the value of X n at positions rep resented by the ( t i ). Depen ding on interpr etations of the variables ( x i ), interpr etations of the ter ms ( t i ) may be equ al or n ot. W e say an a ssignment ρ : { 1 , . . . , k } → { 0 , 1 } is sou nd if t i = t j = ⇒ ρ ( i ) = ρ ( j ). Denote by φ ρ ( x 1 , . . . , x p ) the quantifier-free formu la e xpressing this condition: φ ρ ( x 1 , . . . , x p ) ≡ ^ { ( i , j ) : ρ ( i ) , ρ ( j ) } t j , t j . Let ψ ρ denote the formula Φ  X n ( t i ) ← ρ ( i )  obtained f rom Φ be replacing each occurr ence of X n ( t i ) by the truth value ρ ( i ) and this for each i ∈ { 1 , . . . , k } . F or any fixed x 1 , . . . , x p , the tru th value o f ∀ X n Φ ( X 1 , . . . , X n , x 1 , . . . , x p ) is the same a s the truth v alue of the co njunction of formulas ψ ρ for all sound ρ . Hence, we g et th at ψ ( X 1 , . . . , X n − 1 , x 1 , . . . , x p ) is equiv alent to the following quantifier -free formula: ^ ρ : { 1 ,..., k }→{ 0 , 1 } φ ρ = ⇒ ψ ρ . W e can elimin ate this way second order uni versal quantifier s one by one and the l emma follows.  For the rest of this section we fo cus o n first-order universal formu las. The r eal di ffi culty is to treat the equality predicate ( = ). W ithout the equality (more precisely if all p redicates and fu nctions are on ly unary ) any first-o rder universal formula is eq uiv alent to a conjonc tion of formu las with only on e q uantifier a nd theorem 6 a pplies. T he equality predicate intertwines the variables a nd makes th ing a bit harder to prove. The reader might for example try to understand what the following formu la e xactly means: ∀ x , y , ( P A ( x ) ∧ P C ( East ( y )) ) = ⇒ x = y T o un derstand it, we will prove an analog of Hanf ’ s Lemma for universal sentences. Definition 3. Let ( n , k ) be inte gers, and M , N two Q-configurations. W e say that M ≥ n , k N if for each Q-squ ar e pattern P o f radius less than n: • If P appears in M exactly p times and p ≤ k, the n P ap pears at most p times in N Note that M an d N are ( n , k ) equiv alent if and only if M ≥ n , k N and N ≥ n , k M . Theorem 8. F o r every universal formula φ ther e exists ( n , k ) such that if M ≥ n , k N , then M | = φ = ⇒ N | = φ Compare with definition 2 and th eorem 2 . Note th at Gaifman ’ s Theorem (a mor e refined version of Hanf ’ s lemma) was ge neralized in [ 33 ] to existential senten ces. W e may use this result to obtain ours. W e g iv e be low a comp lete direct proof. P r oof . W e will tran slate the usual p roof of Hanf ’ s L ocal Lemma into our specia l case. W e will try as mu ch as p ossible to use the same notations as [ 28 , sec. 2.4]. W e first change the vocab ulary and consider that East , W est , North , South are binary predicates rather than func- tions. Note that e very universal formu la will remain a universal formulas, albeit with more quantifiers. Let introd uce some notations. Let S ( r , a ) b e th e set of all poin ts at distance at most r of a . That is S ( r , a ) = { x : | x − a | ≤ r } whe re | · | is the Manhattan distance. Note that S ( r , a ) co ntains e r = 2 r 2 + 2 r + 1 p oints. Let S ( r , a 1 . . . a p ) = ∪ i S ( r , a i ). Let M an d N be two Q - configur ations. W e say that a 1 . . . a p ∈ ( Z 2 ) p and b 1 . . . b p ∈ ( Z 2 ) p are k -isom orphic if there exists a bijecti ve map f from S (3 k , a 1 . . . a p ) to S (3 k , b 1 . . . b p ) that preserves the relations, that is • x E ast y ⇐ ⇒ f ( x ) East f ( y ) • P c ( x ) ⇐ ⇒ P c ( f ( x )) • f ( a i ) = b i . 9 It is th en clear th at if a 1 . . . a p and b 1 . . . b p are 0-isomorphic, then we ha ve M | = ψ ( a 1 . . . a p ) ⇐ ⇒ N | = ψ ( b 1 . . . b p ) whenever ψ is quantifier-free. Now take a formula φ = ∀ x 1 . . . x n ψ ( x 1 . . . x n ) where ψ is quantifier-free. Let M and N such that M ≥ 3 n , ne 3 n + 1 N . W e now prove by induction that if a 1 . . . a p and b 1 . . . b p are ( n − p )-isomorp hic, then for all b p + 1 , there exists a p + 1 such that a 1 . . . a p + 1 and b 1 . . . b p + 1 are ( n − p − 1)-isomorp hic. • Case p = 0. Let b 1 ∈ Z 2 . Con sider the pattern of rad ius 3 n centered around b 1 in N . This pa ttern appears in N , hence must appear in M a t least one time. T ake a 1 to be the center of this pattern. • Case p 7→ p + 1. Let a 1 . . . a p and b 1 . . . b p be n − p isom orphic . Let b p + 1 ∈ Z 2 . – Case 1: | b p + 1 − b i | ≤ 2 × 3 n − p − 1 for some b i . In this case S (3 n − p − 1 , b p + 1 ) ⊆ S (3 n − p , b i ). Hence by takin g a p + 1 = f − 1 ( b p + 1 ) where f is the bijectiv e map in volved in the n − p isomorp hism, it is clear that a 1 . . . a p + 1 and b 1 . . . b p + 1 are n − p − 1 isomorph ic. – Case 2: ∀ i , | b p + 1 − b i | > 2 × 3 n − p − 1 . I n this case for ev ery i , S (3 n − p − 1 , b p + 1 ) ∩ B (3 n − p − 1 , b i ) = ∅ . Consider the pattern P of rad ius 3 n − p − 1 centered around b p + 1 . This pattern appears α ti mes inside S (2 × 3 n − p − 1 , b 1 . . . b p ) where α ≤ pe 2 × 3 n − p − 1 . P appears at least α + 1 times in N a nd α + 1 ≤ ne 3 n + 1 hence must appears at least α + 1 times in M . As it app ears th e same amoun t o f time in S ( 2 × 3 n − p − 1 , b 1 . . . b p ) and S (2 × 3 n − p − 1 , a 1 . . . a p ) (by n − p isomorphism) , it must appear somewhere else, say centered in a p + 1 . This a p + 1 is not inside S (3 n − p − 1 , a 1 . . . a p ) because otherwise it would be th e ce nter of an occurr ence of p attern P inside S (2 × 3 n − p − 1 , a 1 . . . a p ). As a conseq uence, a 1 . . . a p + 1 and b 1 . . . b p + 1 are n − p − 1 isomorph ic. Now suppose that M | = φ . T ake b 1 . . . b n ∈ Z 2 . There exists a 1 . . . a n such th at a 1 . . . a n and b 1 . . . b n are 0 - isomorph ic. As M | = φ the quan tifier-free formula ψ ( a 1 . . . a n ) is tr ue in M . As a consequ ence ψ ( b 1 . . . b n ) is tr ue in N . As th is is true for all b 1 . . . b n we obtain N | = φ .  Giv en ( P , k ) we conside r the set S ≤ k ( P ) of all configuratio ns such that the pattern P o ccurs at most k times ( k ma y be taken equal to 0) Corollary 9. A set is d efinab le by a universal formu la if a nd only if it is a positive co mbination ( i.e. unions a nd intersections) of some S ≤ k ( P ) . This corollary should be compared to corollary 4 . P r oof . Let C be the class o f all u niversal formulas. It is cle ar that the set of C -defined formu las is closed u nder intersection and unions. Now S ≤ k ( P ) is defined by ∀ x 1 . . . x k + 1 , φ P ( x 1 ) ∧ · · · ∧ φ P ( x k + 1 ) = ⇒ _ i , j x i = x j For k = 0, this becomes ∀ x , ¬ φ P ( x ). Hence , e very positi ve combination of some S ≤ k ( P ) is C -definable. Con versely , let φ be a un iv ersal formula and S the set it define s. Let ( n , k ) be as in the theorem. For each configuration M ∈ S and P a pattern of rad ius less than or equal to n , denote φ M ( P ) the num ber of times P appears in M with the con vention than φ M ( P ) = ∞ if P ap pears more than k times in M . Consider the set S M = \ P | φ M ( P ) , ∞ , radius( P ) ≤ n S ≤ φ M ( P ) ( P ) From the hy pothesis on ( n , k ), we have S M ⊆ S . It is then easy to see th at S = ∪ M S M where the union is actually finite (two configurations that are ( n , k )-equivalent g i ve the same S M ).  10 4.3. Sofi c subshifts Recall that sofic subshifts are p rojection s o f SFTs. Using the previous cor ollary , we are n ow ab le to gi ve a characterisation of sofic subshifts: Theorem 10. A set S is a sofic subshift if and only if it is definab le by a formula of the form ∃ X 1 , ∃ X 2 . . . , ∃ X n , ∀ z 1 , . . . , ∀ z p , ψ ( X 1 , . . . , X n , z 1 . . . z p ) wher e ψ is q uantifier-fr ee. Moreo ver , a ny such fo rmula is equ ivalent to a formula o f the same form but with a single universal quantifier ( p = 1 ). See [ 26 ] for a di ff erent proo f that eliminates equa lity predicates one by one. P r oof . Let C be the clas of all formula s of the form ∃ X 1 , . . . , ∃ X n , ∀ z ψ ( X 1 , . . . , X n , z ) where ψ is q uantifier-free. W ith the help o f theorem 6 and proposition 1 , is is quite clear that C - defined sets are exactly sofic subshifts. Let D be the class of all formu las of the form ∃ X 1 , . . . , ∃ X n , ∀ z 1 . . . z p ψ ( X 1 , . . . , X n , z 1 . . . z p ) where ψ is quantifier-free. The previous remark s tates that sofic subshifts are D -define d. Now we prove th at D -defined sets are sofic su bshifts. Using (the pr oof of) p roposition 1 , and the fact that sofic subshifts are closed und er projectio n, it is su ffi cient to prove that universal formulas de fine sofic subsh ifts. Using corollary 9 an d th e fact that sofic subshifts ar e closed und er unio n and projec tions, it is su ffi cient to prove that every S ≤ k ( P ) is sofic. Now S ≤ k ( P ) is defined by φ : ∃ S 1 . . . S k ( Ψ i ∀ x , ∨ i S i ( x ) ⇐ ⇒ φ P ( x ) where Ψ i expresses that S i has at most one element and is defined as follows: Ψ i de f = ∃ A , ∀ x ( A ( x ) ⇐ ⇒ A ( Nor th ( x )) ∧ A ( East ( x )) S i ( x ) ⇐ ⇒ A ( x ) ∧ ¬ A ( South ( x )) ∧ ¬ A ( Wes t ( x )) Now with some light rewriting we can transform φ in to a fo rmula o f th e class C , which p roves that S ≤ k ( P ) is C -definab le, hence sofic.  5. (E)MSO-definable subshifts 5.1. Sepa ration r esult Theorem s 5 an d 10 above suggest that EMSO-defin able subshif ts are no t necessarily so fic. W e will sh ow in this section that the set of EM SO-definable subshifts is ind eed strictly la rger than the set of sofic su bshifts. T he proof is based on the analysis of the computatio nal complexity of forbidde n languag es (the complemen t of the set of patterns occuring in the considered subshift). It is well-known that any sofic subshift X has a recursively enume rable fo rbidde n languag e: first, with a straightfo rward back tracking algo rithm, we can recursively enumerate all patterns that do not occur in a giv en SFT Y ; secon d, if X is the pr ojection of Y , we can recursively enumerate all p atterns P such that all patterns Q that projects onto P are forbidden in Y . The following th eorem shows that the forb idden languag e of an MSO-definable subshift can be arbitrarily high in the arithmetical hierarchy . This is not surprising since arbitrary T u ring c omputatio n can be defined via first order formulas (using tilesets) and second order quantifiers can be used to simulate quantification of the arithmetical hierarchy . Howe ver , some care must be taken to ensure that the set of configuration s obtained is a subshift. 11 Theorem 11. Let E be an arithmetical set. Then ther e is an MSO-definable subshift with forbidden language F su ch that E r educes to F (for many-on e r eduction). P r oof ( sketch ). Suppo se t hat the comp lement of E is defin ed as the set of integers m such that: ∃ x 1 , ∀ x 2 , . . . , ∃ / ∀ x n , R ( m , x 1 , . . . , x n ) where R is a recursive relation. W e first build a fo rmula φ defining the set of config urations representing a successful computatio n of R on some inp ut m , x 1 , . . . , x n . Consider 3 colors c l , c and c r and ad ditional second order variables X 1 , . . . , X n and S 1 , . . . , S n . The input ( m , x 1 , . . . , x n ) to the comp utation is encoded in unary on an horizo ntal se gment using colors c l and c r and variables S i as separato rs, precisely: first an occurr ence of c l then m oc currenc es of c , then an occu rrence of c r and, f or eac h successive 1 ≤ i ≤ n , x i positions in X i before a position of S i . Let φ 1 be the FO formu la expressing the following: 1. there is exactly 1 occurrenc e of c l and the same for c r and all S i are singletons; 2. starting from an occurr ence c l and going east until reaching S n , the only possible successions of states are those forming a valid input as explained above. Now , the comp utation of R on any input en coded as above can be simu lated via tiling constrain ts in the usua l way . Consider su ffi ciently ma ny new second order variables Y 1 , . . . , Y p to hand le the compu tation and le t φ 2 be the FO formu la expressing that: 1. a valid compu tation s tarts at the north of an occurr ence of c l ; 2. there is exactly one occurrence of the halting state (represented by some Y i ) in the whole configuratio n. W e de fine φ b y: ∃ X 1 , ∀ X 2 , . . . , ∃ / ∀ X n , ∃ S 1 , . . . , ∃ S n , ∃ Y 1 , . . . , ∃ Y p , φ 1 ∧ φ 2 . Finally l et ψ be the following FO formula: ( ∀ z , ¬ P c l ) ∨ ( ∀ z , ¬ P c r ). Let X be the set defined by φ ∨ ψ . By construction , a finite (unidim ensional) pattern of the form c l c m c r appears in s ome configur ation of X if and only if m < E . Therefor e E is many-o ne reduc ible to the forb idden language of X . T o conclud e the proof it is su ffi c ient to che ck that X is clo sed. T o see this, consider a seq uence ( C n ) n of configur- ations of X converging to some con figuration C . C has at most o ne occu rrence of c l and on e occur rence of c r . If one of these two states does not occur in C then C ∈ X since ψ is verified. If, conversely , both c l and c r occur (on ce each) then any pattern containing both occurrences also occurs in some configuratio n C n verifying φ . But φ is such that any modification outside the segment between c l and c r in C n does not chan ge the fact that φ is satisfied provided no new c l and c r colors are added. T herefor e φ is also satisfied by C and C ∈ X .  The theorem gives the claimed separation result for subshifts of EMSO. Corollary 12. Ther e ar e EMSO-defi nable subshifts which ar e not sofic. P r oof . In the previous theorem, choose E , to be the comp lement of the set of integers m for which there is x such that machine m halts o n empty input in less than x steps. E is no t recursively enumer able and , using the co nstruction of the proof above, it is reducib le to the forbid den languag e of an EMSO-definable s ubshift.  5.2. Sub shifts and pa tterns In the previous section we pr oved that there exists a MSO- definable subshift for which its forb idden langu age is not enumerable. This means in particular that t here exists no recursive set F of patterns that defines this subshift, and in particular no MSO-defi nable set of patterns that defines this subshift. W e will show in this section that this situation does not happen for the cla sses of subshifts we show before, that is ev ery subshift of theses classes can be defin ed by a set of forbidde n patterns of the same (logical) complexity . For this to work, we no w consider a purely relational signature, that is we consider now East , Nor th , South , W est as binary relations rather that function s. As we said before, the previous theorems with the exception of theore m 6 are still valid in this context. Howe ver with a relation al si gnature , it makes sense to ask whether a gi ven (finite) pattern P satisfy a formula φ : First-order quantifiers range ov er Dom P , the domain of P , and second-orde r m onadic quantifiers over all subsets of Dom P . 12 W e now prove Theorem 13. Let φ be a fo rmula of the form ∃ / ∀ X 1 , ∃ / ∀ X 2 . . . , ∃ / ∀ X n , ∀ z 1 , . . . , ∀ z p , ψ ( X 1 , . . . , X n , z 1 . . . z p ) Then a configu ration M satisfies φ if and only if all patterns P of M satisfy φ . P r oof . The basic idea is to use compac tness to bypa ss the e xistential (second-o rder) quantifiers. W e denote by E Dom P the restriction of E to Dom P . W e prove the follo wing statement by ind uction: For e very sub- sets E 1 . . . E k of Z d and any con figuration M , ( M , E 1 , . . . , E k ) | = φ ( X 1 . . . X k ) if and only if ( P , ( E 1 ) Dom P , . . . , ( E k ) Dom P ) | = φ ( X 1 . . . X k ) for ev ery pattern P of M . This is clear if φ has no second- order quantifiers. Now let φ be a formula of the pr evious form . No te that it is clea r that if ( M , E 1 , . . . , E k ) | = φ ( X 1 . . . X k ) then ( P , ( E 1 ) Dom P , . . . , ( E k ) Dom P ) | = φ ( X 1 . . . X k ), as the first order fragment of φ is un iv ersal. W e now p rove the converse. There are two cases: • First case, φ ( X 1 . . . X k ) = ∀ X ψ ( X 1 . . . X k , X ). Suppo se that ( P , ( E 1 ) Dom P , . . . , ( E k ) Dom P ) | = φ ( X 1 . . . X k ) fo r ev ery pattern P of M . L et E b e a subset of Z d . Now , ( P , ( E 1 ) Dom P , . . . , ( E k ) Dom P , E Dom P ) | = ψ ( X 1 . . . X k , X ) for all patterns P o f M by hypoth esis, so using the ind uction h ypothe sis, ( M , E 1 , . . . , E k , E ) | = ψ ( X 1 . . . X k , X ) , h ence the result ( M , E 1 . . . E k ) | = ∀ X φ ( X 1 . . . X k , X ). • Second case, φ ( X 1 . . . X k ) = ∃ X ψ ( X 1 . . . X k , X ). Suppose that ( P , ( E 1 ) Dom P , . . . , ( E k ) Dom P ) | = φ ( X 1 . . . X k ) f or ev ery pattern P o f M . In particula r , for every pattern P , th ere exists a set E P so th at ( P , ( E 1 ) Dom P , . . . , ( E k ) Dom P , E P ) satisfies ψ ( X 1 , . . . X k , X ) Let P i be the pa ttern of dom ain [ − i , i ] d of M , and E P i ⊆ [ − i , i ] the sub set giv en by the previous sentence. W e now see E P i as a point in { 0 , 1 } Z d , an d by compactness we kn ow that th e set { E P i , i ∈ N } has an accumulation point E . Th is set E has the following property: for every domain Z ⊆ Z d , ther e exists i so that [ − i , i ] d contains Z , and E P i and E coincid e on Z . Now we prove that ( M , E 1 , . . . E k , E ) satisfies ψ . L et P be a pattern of M . There exists i so that E P i and E coincide on Dom P . Now by definition of E P i , we have ( P i , ( E 1 ) Dom P i , . . . , ( E k ) Dom P i , E P i ) | = ψ ( X 1 . . . X k , X ). Howe ver , as P is a subp attern of P i , an d the fact that the first order fragmen t of ψ is un iv ersal, we hav e th at ( P , ( E 1 ) Dom P , . . . , ( E k ) Dom P , ( E P i ) Dom P ) | = ψ ( X 1 . . . X k , X ). Now E coincide with E P i on Dom P , so th at we ha ve ( P , ( E 1 ) Dom P , . . . , ( E k ) Dom P , E Dom P | = ψ ( X 1 . . . X k , X )). Using the ind uction hyp othesis, we have p roven that ( M , E 1 , . . . E k , E ) | = ψ ( X 1 . . . X k , X ), hence ( M , E 1 . . . E k | = ∃ X ψ ( X 1 . . . X k , X ).  Corollary 14. If S is a subshift define d by a fo rmula φ of the form of th e preceding theorem, then S = X F wher e F is the set of wor ds that do not satisfy φ . In particular, in dimen sion 1, if a subshif t is d efined by a EMSO formula (is sofic), th en it is defined by a EMSO- definable set of f orbidd en words, ie a regular set. Similarly , if a subshift is defined by a (universal) FO f ormula, it is defined by a (u niv ersal) FO-definable set of forbid den word s, he nce in particular by a stro ngly threshold locally testable language [ 34 ] (comp are with corollar y 9 ). The previous section shows that th e corollary does not work for arbitr ary formula φ . Indeed , f or any MSO-f ormula φ , the set o f words that do not satisfy φ is recursive, but there exists MSO-definable subshifts that cannot be given by a recursive set of forbidden w ords. 13 5.3. Defina bility of MSO-sub shifts As we saw b efore, sets defined by MSO-formu las are n ot always subshifts. W e will tr y in this section to find a fragmen t of MSO th at con tains only subshif ts and contain all of them . This fragment is so mewhat ad ho c. Finding a more reasonable fragmen t is an interesting open question. W e first b egin by a definition Definition 4. f in ( S ) : ∃ A , ∃ B                    ∀ x , A ( x ) ⇐ ⇒ A ( Nor th ( x )) ∧ A ( East ( x )) ∀ x , B ( x ) ⇐ ⇒ A ( South ( x )) ∧ A ( W est ( x )) ∃ x , A ( x ) ∧ ¬ A ( South ( x )) ∧ ¬ A ( W est ( x )) ∃ x , B ( x ) ∧ ¬ B ( Nor th ( x )) ∧ ¬ B ( East ( x )) ∀ x , S ( x ) = ⇒ A ( x ) ∧ B ( x ) It is easy to prove that f in ( S ) is true if and only if S is finite (there are finitely many x such that S ( x )). I ndeed A and B represent qua rter of p lanes, and S must b e co ntained in the square delimited by the two quarter of planes. Any othe r formu la true only if S is finite would work in the following Theorem 15. Let X b e a MSO-defina ble set. Then X is a subshift if and only if it is definable by a formula of the form ∀ S , f in ( S ) = ⇒ ∃ B 1 . . . B k , ψ ( S , B 1 . . . B k ) ∧ ∀ x 1 . . . x n S ( x 1 ) ∧ . . . S ( x p ) = ⇒ θ ( S , B 1 . . . B k , x 1 . . . x p ) wher e • ψ is any MSO-formula not conta ining the pr ed icates P c . • θ is q uantifie r -fr ee. Note that this formula can be written more concisely as ∀ f in S , ∃ B ψ ( S , B ) ∧ ∀ x ∈ S p , θ ( S , B , x ) P r oof . First we prove that such a formu la φ defin es a subshift X . For this, we prove that the set X is closed. Con sider a sequence M 1 . . . M n . . . of configur ations of X converging to som e configuratio n M . W e mu st prove that M ∈ X . Let S be a finite set. No w consider th e f ormula θ . As it is quantifier-free, it is local: th e value of θ ( S , B 1 . . . B k , x 1 . . . x n ) depend s only of what happens a round x 1 . . . x n . As each x 1 . . . x n must be in S , there exists a finite S ′ ⊃ S su ch th at the v alue of ∀ x 1 ∈ S . . . x n ∈ S , θ ( S , B 1 . . . B k , x 1 . . . x n ) depends only of the v alue of the predicates S , P c and B i on S ′ . Now M i conv erges to M . This means that ther e exists p such tha t M p and M coincides o n S ′ . For this M p , there exists some B 1 . . . B k such that we hav e M p | = ψ ( S , B 1 . . . B k ) ∧ ∀ x 1 ∈ S . . . ∀ x p ∈ S , θ ( S , B 1 . . . B k , x 1 . . . x n ). Then this formula is also true on M (Note indeed that ψ ( S , B 1 . . . B k ) does not depend on the configu ration). Hence we have found for e very S some B i that makes the formula true, that is we have proven M | = φ . Th erefore X is closed, hen ce a subshift. Now let X be a MSO-defin able su bshift. X is d efined by a formula φ . Change each P c in φ by a predicate B c to obtain ψ 1 . Define ψ ( B ) = ∀ x        _ c B c ( x )        ∧        ^ c , c ′ ¬ ( B c ( x ) ∧ B c ′ ( x ))        ∧ ψ 1 ( B ) Then X is defined by φ : ∀ f in S , ∃ B ψ ( B ) ∧ ∀ x ∈ S , ^ c ( B c ( x ) ⇐ ⇒ P c ( x ) ) Indeed M satisfies φ an d only if ev ery pattern of M is a pattern in some con figuration of X .  14 E Q 0 ( z ) , E Q 1 ( z ) N Q 0 ( z ) , N Q 1 ( z ) Q 0 Q 1 Figure 4: The recta ngular zone in dark gray defined by predicat e Z ( z ). 6. A Character ization of EM SO EMSO-definab le sets are projec tions of FO-definab le sets (proposition 1 ). Besides, sofic subshifts are projections of s ubshifts of finite type (or tilings). Previous results s how that the correspondenc e sofic ↔ EMSO fails. Howe ver , we will show in this section how EMSO can be characterized through projections of “locally checkable” configurations. Corollary 4 expresses that FO-d efinable sets are essentially cap tured by co unting occurr ences of patterns up to some value. The key idea in th e fo llowing is that this coun ting can be achieved by local checking s (equ iv alently , by tiling con straints), provided it is limited to a finite and explicitly delimited region. Th is ide a was successfully u sed in [ 21 ] in the context of picture languages: pictures are rectangular finite patterns with a border made explicit using a special state ( which occu rs all along the bor der and nowhere else). W e will proceed he re quite di ff ere ntly . Instead o f putting special states on borders of some rectangu lar zone, we will s imply require that tw o special subsets of states Q 0 and Q 1 are present in the configu ration: we call a ( Q 0 , Q 1 ) -marked configuration any configu ration that contains both a color q ∈ Q 0 and some colo r q ′ ∈ Q 1 somewhere. By extension, given a subshift Σ over Q and two sub sets Q 0 ⊆ Q and Q 1 ⊆ Q , the doubly-marked set Σ Q 0 , Q 1 is the set of ( Q 0 , Q 1 )-marked configura tions o f Σ . Finally , a doubly-ma rked set of finite type is a set Σ Q 0 , Q 1 for some SFT Σ and some Q 0 , Q 1 . Lemma 16. Consider any finite pa ttern P a nd any k ≥ 0 . Then S = k ( P ) is the pr ojection of some dou bly-marked set of finite type. The same r esult holds for S ≥ k ( P ) . Mor eover , an y positive combina tion (union and intersection) of pr ojections of do ubly-marked sets of finite type is also the pr o jection of some doubly- marked sets of finite type. P r oof ( sketch ). For the first part o f the theorem statement, we con sider some b ase alphab et Q , some pattern P and some k ≥ 0. W e will build a do ubly-ma rked set of finite type over alphabet Q ′ = Q × Q + and then pro ject back o nto Q . The set Q + is itself a prod uct of di ff erent layer s. The first layer can take values { 0 , 1 , 2 } and is devoted to th e definition of the marker subsets Q 0 and Q 1 : a state is in Q i for i ∈ { 0 , 1 } if and only if its value on the first layer is i . W e first show how to convert th e appearan ce in a co nfiguration of two marked p ositions, b y Q 0 and Q 1 , in to a locally iden tifiable rectang ular zone. T he zone is d efined by two opp osite corner s correspond ing to an o ccurrenc e of some state of Q 0 and Q 1 respectively . This can be done using only finite type constraints as follo ws. By adding a ne w layer of states, one can ensure that there is a unique occurrence of a state of Q 0 and maintain everywhere the following informa tion: 1. N Q 0 ( z ) ≡ the position z is at the north of the (uniqu e) occurr ence of a state from Q 0 , 2. E Q 0 ( z ) ≡ the position z is at the east of the occurrence of a state from Q 0 . The same can b e done fo r Q 1 . From that, the membe rship to the rectang ular zon e is defined at any p osition z b y the following predicate (see figure 12 ): Z ( z ) ≡ N Q 0 ( z ) , N Q 1 ( z ) ∧ E Q 0 ( z ) , E Q 1 ( z ) . 15 W e can also define locally the border of the zone: precisely , cells not in the zone but adjace nt to it. Now defin e P ( z ) to be tr ue if and only if z is the lower -left position in an occurren ce of the pattern P . W e add k n ew layers, each one storing (among other things) a predicate C i ( z ) verifying C i ( z ) ⇒ Z ( z ) ∧ P ( z ) ∧ ^ j , i ¬ C j ( z ) . Moreover , on each layer i , we enfor ce tha t exactly 1 position z verifies C i ( z ): this can be do ne b y maintaining north / so uth and east / west tags (as for Q 0 above) and requiring that the north ( resp. sou th) bord er of the rectangu lar zone sees only the north (resp. sou th) tag and the same for east / west. Finally , we add the constraint: P ( z ) ∧ Z ( z ) ⇒ _ i C i expressing that each occu rrence of P in the zone mut be “marked” by some C i . Hen ce, the o nly admissible ( Q 0 , Q 1 )- marked configu rations are those whose re ctangular zon e contain s exactly k occu rrences of p attern P . W e th us obtain exactly S ≥ k ( P ) after projection onto Q . T o obtain S = k ( P ), it su ffi ces to add the constraint: P ( z ) ⇒ Z ( z ) in order to forbid occurren ces of P outside the rectangular zone. T o co nclude the p roof we show that finite union s or intersection s of projection s of doubly- marked sets o f finite type ar e also pr ojections o f doubly-m arked sets of finite type. Consider two SFT X o ver Q and Y over Q ′ and two pairs o f marker subsets Q 0 , Q 1 ⊆ Q and Q ′ 0 , Q ′ 1 ⊆ Q ′ . Let π X : Q → A and π Y : Q ′ → A b e two pro jections. Denote by Σ X and Σ Y (resp.) the subsets of A Z 2 defined by π X  X Q 0 , Q 1  and π Y  Y Q ′ 0 , Q ′ 1  . W e want to show that both the u nion Σ x ∪ Σ Y and the intersection Σ X ∩ Σ Y are projection s of s ome doub ly marked sets of finite type. First, for the case of union, we can suppose (up to renamin g of states) that Q an d Q ′ are disjoin t and define the SFT Σ over alphabet Q ∪ Q ′ as follows: • 2 adjacent positions must be both in Q or both in Q ′ ; • any pattern forbidden in X or Y is forbidden in Σ . Clearly , π ( Σ Q 0 ∪ Q ′ 0 , Q 1 ∪ Q ′ 1 ) = π X ( X Q 0 , Q 1 ) ∪ π Y ( Y Q ′ 0 , Q ′ 1 ) where π ( q ) is π X ( q ) when q ∈ Q and π Y ( q ) else. Now , for intersections, consider the SFT Σ over the fiber product Q × = { ( q , q ′ ) ∈ Q × Q ′ | π X ( q ) = π Y ( q ′ ) } and defined as follows: a pattern is f orbidd en if its projectio n on the comp onent Q (resp. Q ′ ) is fo rbidden in X (resp. Y ); If we define π as π X applied to the Q -co mpone nt of states, and if E is the set of configuration of Σ su ch that states from Q 0 and Q 1 appear on the first componen t and states from Q ′ 0 and Q ′ 1 appear on the second one, then we have: π ( E ) = π X ( X Q 0 , Q 1 ) ∪ π Y ( Y Q ′ 0 , Q ′ 1 ) . T o co nclude the proof, it is su ffi cien t to obtain E as the projectio n of some doubly-ma rked set of finite type. This can be done starting from Σ and adding a ne w componen t of states whose behaviour is to define a zone from two markers (as in the first part of this proof) and check that the zone contains occurrence s of Q 0 , Q 1 , Q ′ 0 and Q ′ 1 in the appro priate compon ents.  Theorem 17. A set is EMSO-defina ble if and only if it is the pr o jection of a doubly- marked set of finite type. P r oof . First, a doubly-marked set of fi nite type is an FO-definab le set because SFT are FO-definable (theorem 6 ) and the restriction to do ubly-m arked configuration s can be expressed throug h a simple existential FO form ula. Thu s th e projection of a doubly -marked set of finite type is EMSO-definable. The oppo site direction follows immediately from proposition 1 and corollary 4 and the lemma above.  At this point, one could wonder whether con sidering simply -marked set of finite type is su ffi cient to captur e EMSO via projection s. In fact the presence of 2 m arkers is necessary in the above theorem: considering the set Σ Q 0 , Q 1 where Σ is the full shift Q Z 2 and Q 0 and Q 1 are distinct singleto n subsets of Q , a simple co mpactness argu ment allows to show t hat it is not the projection of any simply-marked set of finite type. 16 7. Open Problems • Is the second ord er alternation hierarchy strict for MSO (considering our model-theoretic equi valence)? • One can prove that theorem 6 also holds for formulas of the form: ∀ X 1 . . . ∀ X n , ∀ z , ψ ( z , X 1 . . . X n ) where ψ is quantifier-free. Hence, add ing universal secon d-ord er q uantifiers d oes not increase the expression power of form ulas of theorem 6 . More generally , let C be the class of formulas of the form ∀ X 1 , ∃ X 2 , . . . , ∀ / ∃ X n , ∀ z 1 , . . . , ∀ z p , φ ( X 1 , . . . , X n , z 1 , . . . , z p ) . One can check that any for mula in C defin es a subshift. Is the second- order qu antifiers alternation h ierarchy strict in C ? On the contrary , do all formulas in C rep resent sofic subshifts ? References [1] W . Thomas, Handbook of Formal Languag es, V ol. 3. Beyon d W ords, Spr inger , 1997, Ch. Language s, Automata, and Logic. [2] O. Matz, N. Schwe ikardt, Expressi ve po wer of monadic lo gics on word s, trees, pict ures, and graphs, in: E . G. J. Flum, T . W i lke (Eds.), Logic and Automata : History and Perspecti v es, T ext s in Logic and Games, Amsterdam Univ ersit y Press, 2007, pp. 531–552. [3] M. Delacourt , Rice’ s theorem for mu-limit sets of cell ular automata, in: ICALP , 2011, to appear . [4] L. Boyer , G. Theyssie r , On fac tor univ ersali ty in symbolic spaces, in: MFCS, 2010, pp. 209–220. [5] L. Boyer , G. Theyssie r , On local symmetries and uni versa lity in cellular automata, in: ST A CS, 2009, pp. 19 5–206. [6] G. Lafitte, M. W e iss, Uni ve rsal tilings, in: ST ACS, 200 7, pp. 367–380. [7] G. Lafitte, M. W e iss, Computab ility of tilings, in: IFIP TCS, 2008, pp. 187–201. [8] D. Doty , M. J. Patitz, D. Re ishus, R . T . Sc hweller , S. M. Summers, Stron g f ault -toler ance for self-assembl y with fuzz y te mperature , in: FOCS, 2010, pp. 417–426 . [9] D. Doty , J. H. Lutz, M. J. Patitz , S. M. Summers, D. W oods, Intrinsic univ ersal ity in self-assembly , in: ST A CS, 2010, pp. 275–28 6. [10] H. W ang, Proving theore ms by pattern recognition ii, Bell system technic al journal 40 (1961) 1–41. [11] R. Berge r , The undecida bility of the domino problem, Memoirs American Mathematical Society 66 (1966) 1966. [12] E. B ¨ or ger , E. Gr ¨ ade l, Y . Gurevic h, The classical decision problem, Springer-V erlag T elos, 1996. [13] D. Kuske , M. Lohrey , Logical aspects of Cayley-gra phs: the group case, Annals of Pure and Applied Logic 131 (1-3) (2005) 263–286. [14] D. Seese, The structure of the models of decida ble m onadic theories of graphs, Annals of pure and applied logic 53 (2) (1991) 169–195. [15] J. Mako wsk y , On some conj ecture s connected with complete sentences, Fund. Math. 81 (1974) 193–202. [16] B. Poizat, Une th ´ eorie finiement axiomatisabl e et supersta ble, Groupe d’ ´ etud e des th ´ eori es stables 3 (1) (1980-1982) 1–9. [17] R. M. Robinson, Undecida bilit y and Nonperiodic ity for Tilings of the Plan e, Inv ent iones Math. 12. [18] F . Oger , Algebraic and model-theore tic properties of tilings, T heoreti cal computer science 319 (2004) 103–126. [19] A. Ballie r , E . Jeandel , Tilings and model theory , First Symposium on Cellular Automata Journ ´ ee s Automates Cellulaire s. [20] D. Giammarresi, A. Resti v o, Handbook of Formal Language s, V ol. 3. Beyond W or ds, Springer , 1997, Ch. T wo-Di mensional Languages. [21] D. Giammarresi, A. Resti vo, S. Seibert, W . Thomas, Monadic Second-Order L ogic over Rectan gular Picture s and Recogniza bility by Tili ng Systems, Informati on and Computation 125 (1996) 32–45. [22] B. W eiss, Subshifts of finite type and sofic systems, Monatshefte f ¨ ur Mat hematik 77 (1973) 462–474. [23] M. Anselmo, N. Jonoska, M. Madonia, Framed V ersus Unframed T wo-Dimensional Languages, in: 35th Conference on Current Trends in Theory and Practic e of Computer Science, SOFSE M, 2009, pp. 79–92. [24] J.-H. Altenbe rnd, W . Thomas, S. W ohrle, T iling syste ms o ver infinite picture s and their accep tance conditi ons, in: De ve lopments in Language Theory , 2003. [25] D. Harel, Recurring Dominoes: Making the Highly Undecida ble Highly Understandab le, Annals of Discrete Mathematics 24 (1985) 51–72. [26] E. Jeandel, G. Theyssier , Subshifts, Languages and Logic, in: Dev elopment s in L anguage Theory (DL T), no. 5583 in LNCS, Sprin ger , 2009, pp. 288–299 . [27] W . Hanf, Model-theor etic methods in the study of elementary logic, in: Symposium in the Theory of Models, 1965, pp. 132–145. [28] H.-D. Ebbinghaus, J. Flum, Finite Model Theory , Sp ringer Monographs in Mathemat ics, Springer , Berlin, 1995. [29] L. Libkin, Elements of Finite Model Theory, T exts in Theoretica l Computer Science, an E A T CS Se ries, Springer V erlag, 2004. [30] W . Thomas, On logics, tiling s, and automata, in: S. Berlin (Ed.), Proceedings of the 18th ICALP , V ol. 510 of LNCS, 1991, pp. 441–454. [31] T . Schwentick, K. Bart helmann, Local Normal Fo rms for First-Order Logic with Applica tions to Games and Automat a, Discre te Mathe matics and Theoreti cal Computer Science 3 (1999) 109–124. [32] D. Lind, B. Marcus, An introduc tion to symbolic dynamics and coding, Cambridge Univ ersit y Press, 1995. [33] M. Grohe, S. W ¨ oh rle, An existe ntial locality theorem, Annals of Pure and Applied Logic 129 (1-3) (2004) 131–148. [34] D. Beauquie r , J. -E. Pin, Languages and scanne rs, T heoreti cal Computer Science 84 (1991) 3–21. 17

Original Paper

Loading high-quality paper...

Comments & Academic Discussion

Loading comments...

Leave a Comment