ebook img

A unifying approach to picture grammars PDF

0.26 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview A unifying approach to picture grammars

⋆ A unifying approach to picture grammars MatteoPradella1,AlessandraCherubini2,andStefanoCrespiReghizzi2 1 CNRIEIIT-MI 2 PolitecnicodiMilano P.zzaL.daVinci,32,20133Milano,Italy 1 {alessandra.cherubini, stefano.crespireghizzi, 1 matteo.pradella}@polimi.it 0 2 n Abstract. Severaloldandrecentclassesofpicturegrammars,thatvariouslyex- a J tend context-free string grammars in two dimensions, are based on rules that rewritearraysofpixels.Suchgrammarscanbeunifiedandextendedusingatiling 8 basedapproach,wherebytherightpartofaruleisformalizedbymeansofafinite ] setofpermittedtiles.Wefocusonasimpletypeoftiling,namedregional,andde- L finethecorrespondingregionaltilegrammars.TheyincludebothSiromoney’s(or F Matz’s)KolamgrammarsandtheirgeneralizationbyPru˚sˇa,aswellasDrewes’s . gridgrammars.Regionallydefinedpicturescanberecognizedwithpolynomial- s c time complexity by an algorithm extending the CKY one for strings. Regional [ tilegrammarsandlanguagesarestrictlyincludedintoourprevioustilegrammars and languages, and are incomparable with Giammarresi-Restivo tiling systems 3 (orWangsystems). v 9 2 Keywords: picture language, tiling, picture grammar, 2D language, CKY al- 8 gorithm,syntacticpatternrecognition. 2 . 0 1 Introduction 1 9 0 Since the early days of formallanguagetheory,considerableresearch efforthas been : v spent towardsthe objectiveof extendinggrammarbased approachesfrom one to two i dimensions(2D),i.e.,fromstring languagesto picturelanguages.Severalapproaches X havebeenproposed(andsometimesre-proposed)in thecourseofthe years,whichin r a different ways take inspiration from regular expressions and from Chomsky’s string grammars,but,tothebestofourknowledge,nogeneralclassificationordetailedcom- parisonofpicturegrammarshasbeenattempted.Itisfairtosaythattheimmensesuc- cessofgrammar-basedapproachesforstrings,e.g.incompilationandnaturallanguage processing, is far from being matched by picture grammars. Several causes for this may exist. First, the lack of broadly accepted reference models has caused a disper- sion of research efforts. Second, the algorithmic complexity of parsing algorithm for 2Dlanguageshasrarelybeenconsidered,andveryfewefficientalgorithms,andfewer ⋆Apreliminaryversionis[2].WorkpartiallysupportedbyPRINProject“Mathematicalaspects and emerging applications of automata and formal languages”, ESF Programme Automata: from Mathematics toApplications (AutoMathA), and CNR RSTLProject 760 Grammatiche 2Dperladescrizionediimmagini. implementations,exist.Last,butnotleast,mostgrammartypeshavebeeninventedby theoreticiansandtheirapplicabilityinpictureorimageprocessingremainstobeseen. Wetrytoremove,oratleasttopartiallyoffset,thefirsttwocauses,thushopingtoset inthiswaythegroundforappliedresearchonpicturegrammars.First,weofferanew simpleunifyingapproachencompassingmostexistinggrammarmodels,basedonthe notionofpicturetiling.Then,weintroduceanewtypeofgrammar,calledregionalthat is moreexpressivethanseveralexistingtypes,yetit offersa polynomial-timeparsing algorithm. Weoutlinehowseveralclassicalmodelsofpicturegrammarsbasedonarrayrewrit- ingrulescanbeunifiedbyatilingbasedapproach.Atypicalrewritingrulereplacesa pixelarray,occurringin somepositionin thepicture,bya rightpart,whichisa pixel arrayofequalsize.Eachgrammartypeconsidersdifferentformsofrewritingrules,that we showhowcanbeformalizedusingmoreorlessgeneralsets oftiles. Inparticular, wefocusonasimpletypeoftilesets,thoseofregionaltilegrammars.Thisnewclass generalizessomeclassicalmodels,yetitisprovedtopermitefficient,polynomial-time recognitionofpicturesbyanapproachextendingtheclassicalCocke-Kasami-Younger (CKY)algorithm[23]ofcontext-free(CF)stringlanguages. From the standpoint of more powerful grammar models, regional tile grammars correspondto a naturalrestriction of our previoustile (rewriting)grammars (TG) [4, 3]. For such grammars, a rule replaces a rectangular area filled with a nonterminal symbolwithapicturebelongingtothelanguagedefinedbyaspecifiedsetoftilesover terminalornonterminalsymbols.ItisknownthattheTGfamilydominatesthefamily oflanguagesdefinedbythetilingsystems(TS)ofGiammarresiandRestivo[10](which areequivalenttoWangsystems[1][6]),andthatthelatterareNP-completewithrespect topicturerecognitiontimecomplexity.Thenewmodelenforcestheconstraintthatthe local language used to specify the right part of a rule is made by assembling a finite number of homogeneousrectangularpictures. Such tiling is related to Simplot’s [20] interestingclosureoperationonpictures. Regionaltilegrammarsarethenshowntodominateothergrammartypes.Thefirst istheclassicalKolamgrammartypeofSiromoney[22](which,initscontext-freeform, isequivalenttothegrammarsofMatz[15]);itislessgeneralbecausetherightpartsof grammarrulesmustbetiledinwaysdecomposableasverticalandhorizontalconcate- nations.Threeothergrammarfamiliesarethenshowntobelessgeneral:Pru˚sˇa’stype [18],grid grammars[8],andcontext-freematrix grammars[21].Thelanguageinclu- sionpropertiesforalltheabovefamiliesarethusclarified. The presentationcontinuesin Section 2 with preliminarydefinitions, then in Sec- tions 3 and 4 with the definitionof tile grammars,their regionalvariant, and relevant examples.InSection4.1wepresenttheparsingalgorithmandproveitscorrectnessand complexity.InSection5wecompareregionaltilegrammarsandlanguageswithother picturelanguagefamilies.Thepaperconcludesbysummarizingthemainresults. 2 Basicdefinitions Thefollowingnotationanddefinitionsaremostlyfrom[11]and[4]. 2 Definition1. LetΣ beafinitealphabet.Atwo-dimensionalarrayofelementsofΣ is apictureoverΣ.ThesetofallpicturesoverΣ isΣ++.Apicturelanguageisasubset ofΣ++. Forh,k ≥1,Σ(h,k) denotesthesetofpicturesofsize(h,k)(wewillusethenota- tion|p| = (h,k),|p| = h,|p| = k).#∈/ Σ isusedwhenneededasaboundary row col symbol;pˆreferstotheborderedversionofpicturep.Thatis,forp∈Σ(h,k),itis # # ... # # p(1,1)... p(1,k) # p(1,1) ... p(1,k) # p= ... ... ... pˆ= ... ... ... ... ... p(h,1)...p(h,k) #p(h,1)...p(h,k)# # # ... # # A pixel is an element p(i,j) of p. If all pixels are identical to C ∈ Σ the picture is calledC-homogeneousorC-picture. Row and column concatenationsare denoted ⊖ and , respectively. p⊖q is de- finediffpandq havethesamenumberofcolumns;theresultingpictureisthevertical ȅ juxtapositionofpoverq.pk⊖ istheverticaljuxtapositionofk copiesofp;p+⊖ isthe correspondingclosure. ,kȅ,+ȅ arethecolumnanalogous. ȅ Definition2. LetpbeapictureoverΣ.Thedomainofapicturepisthesetdom(p)= {1,2,...,|p| }×{1,2,...,|p| }. A subdomainof dom(p) is a set d of the form row col {x,x+1,...,x′}×{y,y+1,...,y′}where1≤x≤x′ ≤|p| , 1≤y ≤y′ ≤|p| . row col Wewilloftendenoteasubdomainbyusingitstop-leftandbottom-rightcoordinates,in thepreviouscasethequadruple(x,y;x′,y′). ThesetofsubdomainsofpisdenotedD(p).Letd = {x,...,x′}×{y,...,y′} ∈ D(p),thesubpicturespic(p,d)associatedtodisthepictureofsize(x′−x+1, y′−y+ 1)suchthat∀i∈{1,...,x′−x+1}and∀j ∈{1,...,y′−y+1},spic(p,d)(i,j)= p(x+i−1,y+j−1). AsubdomainiscalledC-homogeneous(orhomogeneous)whenitsassociatedsub- pictureisaC-picture.C iscalledthelabelofthesubdomain. Twosubdomainsd =(i ,j ;k ,l )andd =(i ,j ;k ,l )arehorizontallyadja- a a a a a b b b b b cent(resp.verticallyadjacent)iffj =l +1,andk ≥i ,k ≥i (resp.i =k +1, b a b a a b b a andl ≥j ,l ≥j ).Wewillcalltwosubdomainsadjacent,iftheyareeithervertically b a a b orhorizontallyadjacent. Thetranslationofasubdomaind=(x,y;x′,y′)bydisplacement(a,b)∈Z2 isthe subdomaind′ =(x+a,y+b;x′+a,y′+b).Wewillwrited′ =d⊕(a,b). Definition3. Ahomogeneouspartitionofapicturepisanypartitionπ ={d ,d ,...,d } 1 2 n ofdom(p)intohomogeneoussubdomainsd ,d ,...,d . 1 2 n The unit partition of p, written unit(p), is the homogeneous partition of dom(p) definedbysinglepixels. An homogeneous partition is called strong if adjacent subdomains have different labels. We observe that if a picture p admits a strong homogeneouspartition of dom(p) intosubdomains,thenthepartitionisuniqueandwillbedenotedbyΠ(p). 3 To illustrate,allthepicturesin Figure2butthelasttwo admita stronghomogeneous partition, which is depicted by outlining the borders of the subdomains. The marked partitionsofthelasttwopicturesarehomogeneousbutnotstrong,becausesomeadja- centsubdomainsholdthesameletter. Wenowintroducethecentralconceptsoftile,andlocallanguage. Definition4. Wecalltileasquarepictureofsize(2,2).Wedenoteby p thesetofall tilescontainedinapicturep. J K Let Σ be a finite alphabet.A (two-dimensional)languageL ⊆ Σ++ is local if there existsafinitesetθoftilesoverthealphabetΣ∪{#}suchthatL={p∈Σ++ | pˆ ⊆ θ}.WewillrefertosuchlanguageasLOC(θ). J K Locally testable languages (LT) are analogous to local languages, but are defined throughsquare tiles with side size possibly bigger than2. In the rest of the paperwe willcallthesevariantoftilesk-tiles,toavoidconfusionwithstandard2×2tiles.For instance,3-tilesaresquarepicturesofsize(3,3). Last, we define tiling systems (TS). Tiling systems define the closure w.r.t. alpha- beticprojectionoflocallanguages,andarepresentedandstudiedextensivelyin[11]. Definition5. A tiling system (TS) is a 4-tupleT = (Σ,Γ,θ,π), where Σ andΓ are twofinitealphabets,θisafinitesetoftilesoverthealphabetΓ∪{#},andπ :Γ →Σ isaprojection. ThelanguagedefinedbythetilingsystemT (intherestdenotedbyL(T))isthesetof pictures{π(p)|pˆ∈LOC(θ)}. 3 Tile grammars Wearegoingtointroduceandstudyaverygeneralgrammartypespecifiedbyasetof rewritingrules(orproductions).Atypicalrulehasaleftandarightpart,bothpictures of unspecified but equal (isometric) size. The left part is an A-homogeneouspicture, whereA is a nonterminalsymbol.The rightpartis a pictureofa locallanguageover nonterminalsymbols.Thusa ruleis a schemedefininga possiblyunboundednumber ofisometricpairs:leftpicture,rightpicture.Inadditiontherearesimplerruleswhose rightpartisasingleterminal. The derivation process of a picture starts from a S(axiom)-homogeneouspicture. At each step, an A-homogeneoussubpicture is replaced with an isometric picture of thelocallanguage,definedbytherightpartofaruleA → ....Theprocessterminates whenallnonterminalshavebeeneliminatedfromthecurrentpicture. For simplicity, this presentation focuses on nonterminal rules, thus excluding for instance that both terminal and nonterminal symbols are in the same right part. This normalizationhasacostintermsofgrammardimensionandreadability,butdoesnot losegenerality.Indeed,moregeneralkindsofrules(e.g.likethoseusedin[4]),canbe easilysimplifiedbyintroducingsomeauxiliarynonterminalsandrules.Wewillpresent and use analogous transformations when comparing with other grammar devices in Section5,wherewewilltalkaboutnonterminalnormalforms. 4 Definition6. A tile grammar (TG) is a tuple (Σ,N,S,R), where Σ is the terminal alphabet,N isasetofnonterminalsymbols,S ∈N isthestartingsymbol,Risasetof rules. LetA∈N.Therearetwokindsofrules: Fixedsize: A→t, wheret∈Σ; (1) Variablesize: A→ω, ωisasetofnon-concavetilesoverN ∪{#}. (2) B B Concave tiles are like or a rotation thereof, where B 6= # (so we use concave C B tilesonlyforborders).ItiseasytoseethatallpicturesinLOC(ω),whereωisasetof non-concavetiles,admitastronghomogeneouspartition. Picturederivationisnextdefinedasarelationbetweenpartitionedpictures. Definition7. ConsideratilegrammarG=(Σ,N,S,R),letp,p′ ∈(Σ∪N)(h,k) be picturesofidenticalsize.Letπ ={d ,...,d }beahomogeneouspartitionofdom(p). 1 n Wesaythat(p′,π′)derivesinonestepfrom(p,π),written (p,π)⇒ (p′,π′) G iff,forsomeA∈N,thereexistinπanA-homogeneoussubdomaind =(x,y;x′,y′), i called applicationarea, and a rule A → α ∈ R such that p′ is obtainedsubstituting spic(p,d )inpwith: i – α∈Σ,ifA→αisoftype(1);3 – s∈LOC(α),ifA→αisoftype(2). Moreover,π′ =(π\{d })∪(Π(s)⊕(x−1,y−1)). i Wesaythat(p′,π′)derivesfrom(p,π)innsteps,written(p,π)⇒n (p′,π′),iffp=p′ G andπ = π′, whenn = 0, orthere are a picture p′′ and a homogeneouspartitionπ′′ such that (p,π) =n−⇒1 (p′′,π′′) and (p′′,π′′) ⇒ (p′,π′). We use the abbreviation G G (p,π)⇒∗ (p′,π′)foraderivationwithafinitenumberofsteps. G Roughlyspeaking,ateachstep ofthederivationanA-homogeneoussubpictureis replacedwithanisometricpictureofthelocallanguage,definedbytherightpartofa ruleA→α,thatadmitsastronghomogeneouspartition.Theprocessterminateswhen allnonterminalshavebeeneliminatedfromthecurrentpicture. Intherestofthepaper,andwhenconsideringalsoothergrammaticaldevices,we willdroptheGsymbolwhenitisclearfromthecontext,writinge.g.(p,π)⇒∗ (p′,π′). Definition8. ThepicturelanguagedefinedbyagrammarG(written L(G))istheset ofp∈Σ++suchthat S|p|,{dom(p)} ⇒∗ (p,unit(p)) G (cid:16) (cid:17) ∗ ForshortwealsowriteS ⇒ p. G 3Inthiscase,x=x′andy=y′. 5 Weemphasizethat,togenerateapictureofacertaindimension,onemuststartfrom apictureofthesamedimension. We also willusethe notationL(X)todenotetheclassoflanguagesgeneratedby someformaldeviceX,e.g.L(TG)willdenotetheclassoflanguagesgeneratedbytile grammars. Thefollowingexampleswillbeusedlaterforcomparinglanguagefamilies. Example1. Onerowandonecolumnofb’s. The set ofpictureshavingonerow andone column(bothnotatthe border)thathold b’s,andtheremainderofthepicturefilledwitha’sisdefinedbythetilegrammarG in 1 Figure 1, where the nonterminals are {A ,A ,A ,A ,V ,V ,H ,H ,X,A,B}. We 1 2 3 4 1 2 1 2 # # # # # # # u } # A A V A A # 1 1 1 2 2 ww# A1 A1 V1 A2 A2 #(cid:127)(cid:127) G1 : S →ww#H1 H1 V1 H2 H2 #(cid:127)(cid:127) ww# A3 A3 V2 A4 A4 #(cid:127)(cid:127) w# A A V A A #(cid:127) w 3 3 2 4 4 (cid:127) v# # # # # # #~ # # # # u } # X X # # # # # u } Ai→w#Ai Ai #(cid:127)| #X X # , for1≤i≤4 w (cid:127) ww#Ai Ai #(cid:127)(cid:127) v# # # #~ v# # # #~ ## # # # ## # # # u } u } X → # A X X # |a; Hi → # B Hi Hi # |b, for1≤i≤2 v## # # #~ v## # # #~ # # # u } # B # A→a; B→b; Vi→w#Vi #(cid:127)|b, for1≤i≤2. w (cid:127) w#Vi #(cid:127) w (cid:127) v# # #~ aabaa b b b b b p = 1 aabaa aabaa Fig.1.TilegrammarG (top)andapicturep (bottom)ofExample1. 1 1 recallthat denotesthesetoftilescontainedintheargumentpicture.Thisnotationis preferabletothelistingofalltiles,shownnext: JK # # # # A V V A A A A # S → , ,..., 1 1, 1 2,..., 4 4, 4 . (cid:26)#A1 A1 A1 H1 V1 V1 H2 # # # #(cid:27) 6 AnexampleofderivationisshowninFigure2,wherepartitionsareoutlinedforread- ability. SSSSS A A V A A 1 1 1 2 2 SSSSS H H V H H ⇒ 1 1 1 2 2 ⇒ SSSSS A A V A A 3 3 2 4 4 SSSSS A A V A A 3 3 2 4 4 A A V A A A A V A A 1 1 1 2 2 1 1 1 2 2 H H V H H H H V H H ⇒ 1 1 1 2 2 ⇒ 1 1 1 2 2 ⇒ X X V A A A X V A A 2 4 4 2 4 4 A A V A A A A V A A 3 3 2 4 4 3 3 2 4 4 A A V A A A A V A A aabaa 1 1 1 2 2 1 1 1 2 2 H H V H H H H V H H b b b b b ⇒ 1 1 1 2 2 ⇒ 1 1 1 2 2 ⇒+ A a V A A a a V A A aabaa 2 4 4 2 4 4 A A V A A A A V A A aabaa 3 3 2 4 4 3 3 2 4 4 Fig.2.DerivationusinggrammarG ofExample1,Figure1,withoutlinedpartitions. 1 Example2. Pictureswithpalindromicrows.Eachrowisanevenpalindromeover{a,b}. ThegrammarG isshowninFigure3. 2 # # # # u } # R R # #### u } G2 : SP →ww#SP SP #(cid:127)(cid:127)| # R R # ww#SP SP #(cid:127)(cid:127) v####~ v# # # #~ #### # # #### # # R→u# A R R A′ #}|u# B R R B′ #} v#### # #~ v#### # #~ ## # # ## # # R→u# A A′ #}|u# B B′ #} v## # #~ v## # #~ A→a; B→b; A′→a; B′ →b. a b b a p = b aa b 2 aaaa Fig.3.TilegrammarG (top)andapicturep (bottom)ofExample2. 2 2 7 3.1 Propertiesoftilegrammars First,westatealanguagefamilyinclusionbetweentilingsystems(Definition5)andtile grammars,provedin[4].We willillustrateitwithanexample,bothtogivethereader anintuitiveideaoftheresult,andtolaterre-usetheexample. Proposition1. L(TS)⊂L(TG). Considera TS T = (Σ,Γ,θ,π), where Σ is the terminalalphabet,θ is a tile-set, Γ isthe tile-setalphabet,andπ : Γ → Σ isan alphabeticprojection.Itisquiteeasy to definea TG T′ such thatL(T′) = L(T).Informally,the ideais to takethe tile-set θ andaddtwomarkers,e.g.{b,w}ina“chessboard-like”fashiontobuildupatile-set suitableforthe rightpartofthe variablesize startingrule;otherstraightforwardfixed sizerulesareusedtoencodetheprojectionπ. WenotehowbothL(TS)andL(TG)areclosedunderintersectionwiththeclassof allheight-1pictures:theclassesresultinginthatintersectionarethewell-knownclasses recognizable and context-free, respectively, string languages. The inclusion is hence proper:anycontext-free,non-recognizablestringlanguageisalso(whenconsideredas apicturelanguage)inL(TG),butnotinL(TS). ThenextexampleillustratesthereductionfromaTStoaTG. Example3. Squarepicturesofa’s. The TS T is based on a local language over {0,1} such that all pixels of the main 3 diagonalare1andtheremainingonesare0,andontheprojectionπ(0) = π(1) = a. T andtheequivalentTGG areshowninFigure4. 3 3 The“chessboard-like”constructionisusedtoensurethattheonlystronghomoge- neous partition obtained in applying a rule is the one in which partitions correspond to single pixels. This allows the application of terminal rules encoding projection π. Note that in the first rule of grammarG we used tiles arising from the two possible 3 chessboardstructures,i.e.theonewitha“black”intop-leftposition,andtheonewith a“white”inthesameplace.Indeed,tofillareasaboveandbelowthediagonalwith0’s weneedbothtiles 0 0 0 0 b w and w b . 0 0 0 0 w b b w ThefollowingcomplexitypropertywillbeusedtoseparatetheTGlanguagefamily fromseveralsubfamiliestobeintroduced. Inthispaperas“parsingproblem”weconsidertheproblemofdecidingifagiven inputpictureisinL(G),forafixedgrammarG(i.e.thealsocallednon-uniformmem- bershipproblem).Thecomplexityofparsingalgorithmsisthusexpressedintermofthe sizeoftheinputstring,inthiscasethepicturesize. Proposition2. TheparsingproblemforL(TG)isNP-complete. Proof From Proposition 1 and the fact that the parsing problem for L(TS) is NP- complete(see[14]wheretilingsystemsarecalledhomomorphismsoflocallatticelan- guages,or[13])itfollowsthatparsingL(TG)isNP-hard. 8 ###### u } # 1 0 0 0 # w# 0 1 0 0 #(cid:127) T3 : θ=ww# 0 0 1 0 #(cid:127)(cid:127), π(0)=a, π(1)=a. w (cid:127) w# 0 0 0 1 #(cid:127) w (cid:127) v######~ # # # # # # # # # # # # u } u } # 1b 0w 0b 0w # #1w 0b 0w 0b # G3 : S →wwww##00wb 01wb 01wb 00wb ##(cid:127)(cid:127)(cid:127)(cid:127)∪wwww##00wb 10wb 10wb 00wb ##(cid:127)(cid:127)(cid:127)(cid:127) ww#0w 0b 0w 1b #(cid:127)(cid:127) ww# 0b 0w 0b 1w #(cid:127)(cid:127) v# # # # # #~ v# # # # # #~ 1w →a, 1b →a, 0w →a, 0b →a. Fig.4.ForExample3theTSdefining{a(n,n) | n > 1}(top),andtheequivalentTGgrammar (bottom). ForNP-completeness,weshowthatparsingL(TG)isinNP.First,weassumewithout lossofgeneralitythataTGGdoesnotcontainanychainrule,i.e.aruleoftheform #### u } #B B # A→ , B ∈N w#B B #(cid:127) w (cid:127) v####~ thatcorrespondstoarenamingruleofastringgrammar. Ifthisisnotthecase,itispossibletodiscardchainrulesbydirectlyusingthewell- known(e.g.[12])approachforcontext-freestringgrammars. Wesupposetohaveacandidatederivation S(h,k),dom(p) ⇒ (p ,π )⇒ (p ,π )⇒ ···⇒ (p ,π )⇒ (p,unit(p)) G 1 1 G 2 2 G G n−1 n−1 G (cid:16) (cid:17) andwe are goingto provethatcheckingits correctnesstakespolynomialtime in h,k (sizeofthepicture),byconsideringthedominantparametersoftimecomplexity. First, the length n of this derivation, since there are no chain rules, is at most h·k. Infact,westartfromapartitionwithonlyoneelementcoincidingwithdom(p),andat eachstepatleastoneelementisadded,arrivingatstepn,wherethenumberofelements ish·k,eachcorrespondingtoapixel. For each step, we must find the application area in (p ,π ), and the corresponding i i rewrittennonterminalA,bycomparing(p ,π )with(p ,π ).Thenumberofcom- i i i+1 i+1 parisonstobeperformedisatmosth·k. Then,wehavetofindaruleA → ω inRwhichiscompatiblewiththerewrittensub- pictureofp correspondingtotheapplicationarea.So,atmostwemustcheckevery i+1 ruleinR,andeverytileofitsrightpart,onasubpicture,givenbytheapplicationarea, 9 whichisatmosth·k.Hence,wehavetoconsiderforthisstepanumberofchecksthat isatmost h·k·|R|· max |ω| A→ω∈R Each of these considered steps can be done in polynomial time in every reasonable machinemodel,hencetheresultingtimecomplexityisstillpolynomial. ⊓⊔ From [4] it is known that the family of TG languages is closed w.r.t. union, col- umn/rowconcatenation,column/rowclosureoperations,rotation,andalphabeticmap- ping. We mention that all the families presented in this work, that exactly define the context-freestring languagesif restricted to one dimension (i.e. all buttiling systems and grid grammars, presented in Section 5.3), are not closed w.r.t. intersection and complement.This is provedas for string context-freelanguages:it is straightforward to see that they are all closed w.r.t. union. But it is well known that the language {anbncn | n > 0} is not context-free, and can be expressed as intersection of two contextfreelanguages,e.g.{anbmcn | m,n > 0}and{anbncm | m,n > 0}.Hence, theyarenotclosedw.r.t.intersection,butthisalsomeansthattheyarenotclosedw.r.t. complement. 4 Regional tilegrammars We nowintroducethecentralconceptofregionallanguage,andacorrespondingspe- cialization of tile grammars. The adjective “regional” is a metaphor of geographical political maps, where different regions are filled with different colors; of course, re- gionsarerectangles. Regionaltilegrammarsarecentraltothiswork,becausetheyarethemostgeneral amongthepolynomial-timeparsablegrammarmodelsconsideredinthispaper.Wewill seethatitiseasytodefinetheotherkindsof2Dgrammarsbyrestrictingthetilesused inregionaltilegrammars. Definition9. A homogeneous partition is regional (HR) iff distinct (not necessarily adjacent) subdomains have distinct labels. A picture p is regional if it admits a HR partition.Alanguageisregionalifallitspicturesareso. Forexample,considerFigure5:thepartitionsinsubdomainsofthepictureonthe leftishomogeneousandstrong,butnotregional,sincefourdifferentsubdomainsbear the same symbol A. On right, a variant of the same picture with regional partitions outlinedisdepicted. Another(negative)exampleisinFigure4:“chessboard-like”picturesadmitunique homogeneouspartitions, i.e. those in which every subdomaincorrespondsto a single pixel.Notethatingeneralthesepartitionsarestrong(adjacentsubdomainshavediffer- entsymbols,likeinachessboard),butarenotregional(e.g.inthevariablesizeruleof grammarG therearemultiple0 symbols). 3 b Definition10. Aregionaltilegrammar(RTG)isatilegrammar(seeDefinition6),in whicheveryvariablesizeruleA→ωissuchthatLOC(ω)isaregionallanguage. 10

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.