Chain code images ( Chain Code Pictures ) are images using formal grammars are generated. A word generated by such a grammar is interpreted as exactly one image in that the individual symbols are interpreted as directions and a drawing is thus described in a coordinate system.
Basics
The integer coordinate system and its neighboring points for each point are given
![{\ mathbb {Z}} \ times {\ mathbb {Z}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/463bb631669181cf8a8950ac822ada5eb0542ca2)
![{\ displaystyle z = (m, n) \ in \ mathbb {Z} \ times \ mathbb {Z}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/330c28a2ee669f0e14c6eb033403e0400620b986)
, , , ,
![{\ displaystyle d (z) = (m, n-1)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/98b404d72a5cad993fe67593e2b8b535d10fc47a)
![{\ displaystyle r (z) = (m + 1, n)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/be0d9728320329cc49d43c729d37d8b0bb058451)
![{\ displaystyle l (z) = (m-1, n)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/722f846ec0988b6d5a586f9f638ed75c92e78c56)
wherein , , or intuitive to the upper ( u p), lower ( d own), Right ( r ight) or left ( l eft) are adjacent point.
![u](https://wikimedia.org/api/rest_v1/media/math/render/svg/c3e6bb763d22c20916ed4f0bb6bd49d7470cffd8)
![d](https://wikimedia.org/api/rest_v1/media/math/render/svg/e85ff03cbe0c7341af6b982e47e9f90d235c66ab)
![r](https://wikimedia.org/api/rest_v1/media/math/render/svg/0d1ecb613aa2984f0576f70f86650b7c2a132538)
![l](https://wikimedia.org/api/rest_v1/media/math/render/svg/829091f745070b9eb97a80244129025440a1cfac)
Let the set of directions be defined with .
![\pi](https://wikimedia.org/api/rest_v1/media/math/render/svg/9be4ba0bb8df3af72e90a0535fabcc17431e540a)
![{\ displaystyle \ pi = \ {u, d, r, l \}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/0a547cc6532c79485541c7fae62193015ac6d41a)
Furthermore, a unit route is understood to be the route that is connected by two neighboring points. That means, for every point and every direction there is a line between and (diagonal lines are excluded). A unit distance is represented by the pair of points , where and are geometrically the same.
![{\ displaystyle z = (m, n) \ in \ mathbb {Z} \ times \ mathbb {Z}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/330c28a2ee669f0e14c6eb033403e0400620b986)
![{\ displaystyle b \ in \ pi}](https://wikimedia.org/api/rest_v1/media/math/render/svg/f8ba048c1b7212415999bd44aa013e873eefdc84)
![z](https://wikimedia.org/api/rest_v1/media/math/render/svg/bf368e72c009decd9b6686ee84a375632e11de98)
![b (z)](https://wikimedia.org/api/rest_v1/media/math/render/svg/9c57d208e0d0ffb3ea83815339b1aad2860911df)
![{\ displaystyle (z, b (z))}](https://wikimedia.org/api/rest_v1/media/math/render/svg/1d4f3da919d0d473b0324615b98b372f6ed52d75)
![{\ displaystyle (z, b (z))}](https://wikimedia.org/api/rest_v1/media/math/render/svg/1d4f3da919d0d473b0324615b98b372f6ed52d75)
![{\ displaystyle (b (z), z)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/1d7719c38d61ab760d73a07a58919904db78b7d8)
A ( simple ) image is a finite set of unit segments and the set of all points of .
![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
![{\ displaystyle V (p) = \ {z \ vert (z, z ^ {'}) \ in p \ vee (z ^ {'}, z) \ in p \}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a04c4bd87eee379d1d8aae5bc3f54edc3f3bb535)
![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
This is called a triple , where is a simple picture and the start and end point are called the drawn picture .
![{\ displaystyle (z, p, z ^ {'})}](https://wikimedia.org/api/rest_v1/media/math/render/svg/26123b994826efc52f34455344d4e328a7b67185)
![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
![{\ displaystyle z, z ^ {'} \ in V (p)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/d2b58c5a4500aac7da57bcfc76ca36c50d23ca22)
Two simple images and are equivalent - one writes - if and only if two numbers exist, such that if and only if . Analog hot two drawn images and if and equivalent - to write - if two numbers exist, so if and only if , and , . So, intuitively, images are the same except for a shift in the coordinate system. As one can easily show, are and equivalence relations of all simple or drawn images through the crowd.
![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
![{\ displaystyle p ^ {'}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/5f2b83c76d3c1973a37c6291bdb78bb8eb812e52)
![{\ displaystyle p \ equiv _ {b} p ^ {'}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/e0f2f81f30d8e042bad3fa6bd8d8453cf06237b3)
![{\ displaystyle m, n \ in \ mathbb {Z}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/f932c786e686277b8f060aae74134ce9fc3e3348)
![{\ displaystyle (z, z ^ {'}) \ in p}](https://wikimedia.org/api/rest_v1/media/math/render/svg/03c4a559a9374e9e10665aa80841c1038fb04ac6)
![{\ displaystyle (z + (m, n), z ^ {'} + (m, n)) \ in p ^ {'}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/bf79faf5b194abc87b053fe5e8dc66c540345365)
![{\ displaystyle q = (z_ {1}, p, z_ {2})}](https://wikimedia.org/api/rest_v1/media/math/render/svg/21728fc78b8cb9ad1182e070c0850144b33e9f42)
![{\ displaystyle q ^ {'} = (z_ {1} ^ {'}, p ^ {'}, z_ {2} ^ {'})}](https://wikimedia.org/api/rest_v1/media/math/render/svg/2483e7ecbf40f846d1d49bd1e02982e18e0c3abb)
![{\ displaystyle q \ equiv _ {d} q ^ {'}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/7a5f221dec2a2d6ab9fe0023d7b10c8e80f64526)
![{\ displaystyle m, n \ in \ mathbb {Z}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/f932c786e686277b8f060aae74134ce9fc3e3348)
![{\ displaystyle (z, z ^ {'}) \ in p}](https://wikimedia.org/api/rest_v1/media/math/render/svg/03c4a559a9374e9e10665aa80841c1038fb04ac6)
![{\ displaystyle (z + (m, n), z ^ {'} + (m, n)) \ in p ^ {'}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/bf79faf5b194abc87b053fe5e8dc66c540345365)
![{\ displaystyle z_ {1} ^ {'} = z_ {1} + (m, n)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/bec0c527c79e559e99cad4e6be10c4eb0c2186ca)
![{\ displaystyle z_ {2} ^ {'} = z_ {2} + (m, n)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/ecebc02ed44025f3791847b0fb7785cda59584fc)
![{\ displaystyle \ equiv _ {b}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/3a5a8173b64e8ba329fe425ffe71b04db96c67c7)
![{\ displaystyle \ equiv _ {d}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/96c12e37fe19151e6d1707023aa0dec256876cb0)
A simple picture is called a ( simple ) sub- picture of the simple picture if a simple picture with and exists.
![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
![q](https://wikimedia.org/api/rest_v1/media/math/render/svg/06809d64fa7c817ffc7e323f85997f783dbdf71d)
![{\ displaystyle p ^ {'}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/5f2b83c76d3c1973a37c6291bdb78bb8eb812e52)
![{\ displaystyle p ^ {'} \ subseteq q}](https://wikimedia.org/api/rest_v1/media/math/render/svg/56253ed326cb46e7b4639086dcb9d1359f545077)
![{\ displaystyle p \ equiv _ {b} p ^ {'}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/e0f2f81f30d8e042bad3fa6bd8d8453cf06237b3)
A picture is a ( simple ) chain code image when a finite sequence of unit distances with and , , there is so true. Consequently, a chain-code picture is always connected.
![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
![{\ displaystyle (z_ {0}, z_ {1}), (z_ {1}, z_ {2}), \ ldots, (z_ {n-2}, z_ {n-1}), (z_ {n -1}, z_ {n})}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a0c2899481edf54b0fbf2a476efb8619349d4406)
![n \ in \ mathbb {N}](https://wikimedia.org/api/rest_v1/media/math/render/svg/d059936e77a2d707e9ee0a1d9575a1d693ce5d0b)
![{\ displaystyle z_ {i} = b_ {i} (z_ {i-1})}](https://wikimedia.org/api/rest_v1/media/math/render/svg/6f21fca52390ed7b6c2c4839265608c2c66e7e87)
![{\ displaystyle b_ {i} \ in \ pi}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a84098be0a6d580aef5d7ee7da3ce254c0675d8c)
![1 \ leq i \ leq n](https://wikimedia.org/api/rest_v1/media/math/render/svg/abbe58b9b83f8b6ec0da570e2249323a8930ef1e)
![{\ displaystyle p = \ bigcup _ {k = 1} ^ {n} \ {(z_ {k-1}, z_ {k}) \}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/94d2065a9d96fb00728a6ede436f389429b44739)
Generation through formal grammars
Chain code pictures and words
Due to the definition of chain code pictures that with words (can chain codes or chain codes ) via associated by a chain-code image with the result and , , the word is assigned.
![\pi](https://wikimedia.org/api/rest_v1/media/math/render/svg/9be4ba0bb8df3af72e90a0535fabcc17431e540a)
![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
![{\ displaystyle (z_ {0}, z_ {1}), (z_ {1}, z_ {2}), \ ldots, (z_ {n-2}, z_ {n-1}), (z_ {n -1}, z_ {n})}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a0c2899481edf54b0fbf2a476efb8619349d4406)
![{\ displaystyle z_ {i} = b_ {i} (z_ {i-1})}](https://wikimedia.org/api/rest_v1/media/math/render/svg/6f21fca52390ed7b6c2c4839265608c2c66e7e87)
![{\ displaystyle b_ {i} \ in \ pi}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a84098be0a6d580aef5d7ee7da3ce254c0675d8c)
![1 \ leq i \ leq n](https://wikimedia.org/api/rest_v1/media/math/render/svg/abbe58b9b83f8b6ec0da570e2249323a8930ef1e)
![{\ displaystyle b_ {1} b_ {2} \ cdots b_ {n} \ in \ pi ^ {*}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/b5ca93c379d3586f9c6a1e71abacd0905f6767a4)
On the other hand, it gives each word a signed chain code image ( drawn chain code picture ) inductively as follows:
![{\ displaystyle w \ in \ pi ^ {*}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/ba86fa64619b82cfad98bc4430f8e1f53de7b90e)
![{\ displaystyle dccp (w)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/69e9b789bab89053aac71fb8835b86c75a3706eb)
- if so then
![{\ displaystyle w = \ epsilon}](https://wikimedia.org/api/rest_v1/media/math/render/svg/c58d01023cd93bae575d8556ecec83c864595bc8)
- If , , and , then
![{\ displaystyle w = w ^ {'} b}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a2ba4a3214535bc358ccf00c2f923b2e39e9a2cd)
![{\ displaystyle w ^ {'} \ in \ pi ^ {*}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/85fe142ae0b4dc835f444371757458284dd70294)
![{\ displaystyle b \ in \ pi}](https://wikimedia.org/api/rest_v1/media/math/render/svg/f8ba048c1b7212415999bd44aa013e873eefdc84)
![{\ displaystyle dccp (w ^ {'}) = ((0,0), p, z)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/48b13ed7cf11cf90f522786cd106f9588b41194d)
With is the basic chain code picture from .
![{\ displaystyle dccp (w) = ((0,0), p, z)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/6350752e8af65e485018ac0f956b887a373738c4)
![{\ displaystyle bccp (w) = p}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a72d956525f4d9040d04c21fe2dcc8909229ee15)
![w](https://wikimedia.org/api/rest_v1/media/math/render/svg/88b1e0c8e1be5ebe69d18a8010676fa42d7961e6)
Words can now be generated with a formal grammar and interpreted as chain code images. Let the set of all images generated by be or , where is the language generated by (see Language generated by G ) - it is also called chain-code-image language .
![{\ displaystyle G = (N, \ pi, P, S)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/9eb82c845b88daa0a15c528ecd5f4fa150052035)
![G](https://wikimedia.org/api/rest_v1/media/math/render/svg/f5f3c8921a3b352de45446a6789b104458c9f90b)
![{\ displaystyle dccp (L (G)) = \ {dccp (w) \ vert w \ in L (G) \}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/afbdc69a89188af24681c2a458abb808986127f1)
![{\ displaystyle bccp (L (G)) = \ {bccp (w) \ vert w \ in L (G) \}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/e0d3e553a0f07fb513747a95ebd83155df4cba88)
![L (G)](https://wikimedia.org/api/rest_v1/media/math/render/svg/8b080e7cb1370a47e04efa3395a2212940fba797)
![G](https://wikimedia.org/api/rest_v1/media/math/render/svg/f5f3c8921a3b352de45446a6789b104458c9f90b)
example
Let be a given formal grammar. The language generated by is
![{\ displaystyle G_ {1} = (\ {S \}, \ pi, \ {S \ to urdluS, S \ to urdlu \}, S)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/8b1b73f22196d1363d6bde40488f9f10ba341181)
![G_ {1}](https://wikimedia.org/api/rest_v1/media/math/render/svg/e6ea4f4668b8334c8a7d3d284b0fd22131ef5f52)
.
The amount of images created by is shown in the figure below:
![{\ displaystyle dccp (L (G_ {1}))}](https://wikimedia.org/api/rest_v1/media/math/render/svg/ae6575331bc9afaf0f0e5c66b0c0ced6fe338541)
![G_ {1}](https://wikimedia.org/api/rest_v1/media/math/render/svg/e6ea4f4668b8334c8a7d3d284b0fd22131ef5f52)
So you get a countable number of stacks of arbitrary but fixed height, which consist of squares the length of the edge .
![1](https://wikimedia.org/api/rest_v1/media/math/render/svg/92d98b82a3778f043108d4e20960a9193df57cbf)
Chain-Code-Image-Language Hierarchy
Analogous to formal languages , a chain-code-image language is called regular or context-free or monotonic (or context-sensitive) or recursively enumerable if there is a regular or context-free or monotonic (or context-sensitive) or recursively enumerable formal grammar so that applies (see Chomsky hierarchy ). With , , and referred to the quantities (families) of all regular, context-free, monotonous and recursively enumerable chain code picture languages.
![B.](https://wikimedia.org/api/rest_v1/media/math/render/svg/47136aad860d145f75f3eed3022df827cee94d7a)
![G](https://wikimedia.org/api/rest_v1/media/math/render/svg/f5f3c8921a3b352de45446a6789b104458c9f90b)
![{\ displaystyle B = bccp (L (G))}](https://wikimedia.org/api/rest_v1/media/math/render/svg/9804a647d276ce4f146f4745648ce1d996559d5e)
![{\ displaystyle {\ mathcal {CCP}} (REG)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/5151c2b8719f892e9687616cd5a657358283015b)
![{\ displaystyle {\ mathcal {CCP}} (CF)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/4cf855b564fe666ab25bd42cf59bb4771ead550f)
![{\ displaystyle {\ mathcal {CCP}} (CS)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/dd496bcc3f2886dfcddbc5759a81a13a0eb71e73)
![{\ displaystyle {\ mathcal {CCP}} (RE)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/6f12e42b5e5fc5e439427580d7907f82be23a840)
An important finding is the validity of the inclusions or equality . Thus, in fact, only three real families are considered.
![{\ displaystyle {\ mathcal {CCP}} (REG) \ subset {\ mathcal {CCP}} (CF) \ subset {\ mathcal {CCP}} (CS) = {\ mathcal {CCP}} (RE)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/cb8a1b1e7d547f81799a25ef3cc73f46f96eb120)
Decision problems for chain-code-image languages
Classic decision problems
As for formal languages, important decision problems can be formulated in the same way for chain-code-image languages :
Image problem (also member problem )
- A formal grammar and a chain code image are given .
![{\ displaystyle G = (N, \ pi, P, S)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/9eb82c845b88daa0a15c528ecd5f4fa150052035)
![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
- Is there a word that makes it true?
![{\ displaystyle p \ in bccp (L (G))}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a86669c3f61faaa70365862e7a748585358201f5)
![{\ displaystyle w \ in L (G)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/9df3b3d119839ce9cf81cb976748d4e4b994fa19)
![{\ displaystyle p = bccp (w)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/363ccaf34096dbf98d021a7aa35da384d91f94dd)
The image problem is decidable for context-free formal grammars and undecidable for context-sensitive formal grammars . This problem is NP-complete for regular formal grammars .
![G](https://wikimedia.org/api/rest_v1/media/math/render/svg/f5f3c8921a3b352de45446a6789b104458c9f90b)
1. special image problem
- A formal grammar and a chain code image are given .
![{\ displaystyle G = (N, \ pi, P, S)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/9eb82c845b88daa0a15c528ecd5f4fa150052035)
![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
- Is the amount finite?
![{\ displaystyle \ {w \ vert w \ in L (G) \ wedge bccp (w) = p \}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/ecfb55c8b2de93835e6e577384aaa0e70f7254b5)
So one asks whether there are finitely or infinitely many words that generate the chain-code image . Like the image problem, this problem is decidable for context-free formal grammars and undecidable for context-sensitive formal grammars .
![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
![G](https://wikimedia.org/api/rest_v1/media/math/render/svg/f5f3c8921a3b352de45446a6789b104458c9f90b)
![G](https://wikimedia.org/api/rest_v1/media/math/render/svg/f5f3c8921a3b352de45446a6789b104458c9f90b)
2. special image problem
- A formal grammar and a chain code image are given .
![{\ displaystyle G = (N, \ pi, P, S)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/9eb82c845b88daa0a15c528ecd5f4fa150052035)
![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
- Does the set have exactly one element?
![{\ displaystyle \ {w \ vert w \ in L (G) \ wedge bccp (w) = p \}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/ecfb55c8b2de93835e6e577384aaa0e70f7254b5)
Thus, asked whether the chain code picture of exactly one word out is generated. This problem is again decidable for context-free formal grammars and undecidable for context-sensitive formal grammars .
![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
![w](https://wikimedia.org/api/rest_v1/media/math/render/svg/88b1e0c8e1be5ebe69d18a8010676fa42d7961e6)
![L (G)](https://wikimedia.org/api/rest_v1/media/math/render/svg/8b080e7cb1370a47e04efa3395a2212940fba797)
![G](https://wikimedia.org/api/rest_v1/media/math/render/svg/f5f3c8921a3b352de45446a6789b104458c9f90b)
![G](https://wikimedia.org/api/rest_v1/media/math/render/svg/f5f3c8921a3b352de45446a6789b104458c9f90b)
Underpicture problem
- A formal grammar and a chain code image are given .
![{\ displaystyle G = (N, \ pi, P, S)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/9eb82c845b88daa0a15c528ecd5f4fa150052035)
![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
- Is there a chain code image such that is a subimage of ?
![{\ displaystyle p ^ {'} \ in bccp (L (G))}](https://wikimedia.org/api/rest_v1/media/math/render/svg/ed5a74649cc1e03c909c2bfe17958629e9cb4313)
![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
![{\ displaystyle p ^ {'}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/5f2b83c76d3c1973a37c6291bdb78bb8eb812e52)
The sub-picture problem is decidable for context-free formal grammars and undecidable for context-sensitive formal grammars .
![G](https://wikimedia.org/api/rest_v1/media/math/render/svg/f5f3c8921a3b352de45446a6789b104458c9f90b)
![G](https://wikimedia.org/api/rest_v1/media/math/render/svg/f5f3c8921a3b352de45446a6789b104458c9f90b)
Universal underpicture problem
- A formal grammar and a chain code image are given .
![{\ displaystyle G = (N, \ pi, P, S)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/9eb82c845b88daa0a15c528ecd5f4fa150052035)
![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
- Is a sub-picture of every chain code picture ?
![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
![{\ displaystyle p ^ {'} \ in bccp (L (G))}](https://wikimedia.org/api/rest_v1/media/math/render/svg/ed5a74649cc1e03c909c2bfe17958629e9cb4313)
For regular formal grammars the universal sub-picture problem is decidable.
![G](https://wikimedia.org/api/rest_v1/media/math/render/svg/f5f3c8921a3b352de45446a6789b104458c9f90b)
Emptiness problem
- A formal grammar is given .
![{\ displaystyle G = (N, \ pi, P, S)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/9eb82c845b88daa0a15c528ecd5f4fa150052035)
- Is the crowd empty?
![{\ displaystyle bccp (L (G))}](https://wikimedia.org/api/rest_v1/media/math/render/svg/c656c07224f62aeb5c64963d34c3ff3e9a181a2e)
The emptiness problem is decidable for context-free formal grammars and undecidable for context-sensitive formal grammars .
![G](https://wikimedia.org/api/rest_v1/media/math/render/svg/f5f3c8921a3b352de45446a6789b104458c9f90b)
![G](https://wikimedia.org/api/rest_v1/media/math/render/svg/f5f3c8921a3b352de45446a6789b104458c9f90b)
Finiteness problem
- A formal grammar is given .
![{\ displaystyle G = (N, \ pi, P, S)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/9eb82c845b88daa0a15c528ecd5f4fa150052035)
- Is the amount finite?
![{\ displaystyle bccp (L (G))}](https://wikimedia.org/api/rest_v1/media/math/render/svg/c656c07224f62aeb5c64963d34c3ff3e9a181a2e)
The finiteness problem is decidable for context-free formal grammars and undecidable for context-sensitive formal grammars .
![G](https://wikimedia.org/api/rest_v1/media/math/render/svg/f5f3c8921a3b352de45446a6789b104458c9f90b)
![G](https://wikimedia.org/api/rest_v1/media/math/render/svg/f5f3c8921a3b352de45446a6789b104458c9f90b)
Equivalence problem
- There are two formal grammars and .
![{\ displaystyle G_ {1} = (N_ {1}, \ pi, P_ {1}, S_ {1})}](https://wikimedia.org/api/rest_v1/media/math/render/svg/74cd8d748d608a8b02c5635608bae72a2aec0c5d)
![{\ displaystyle G_ {2} = (N_ {2}, \ pi, P_ {2}, S_ {2})}](https://wikimedia.org/api/rest_v1/media/math/render/svg/f63c403fa10c41ae0f844287d7d15d7566f50ecf)
- Does that mean that both grammars generate the same chain-code images via their words?
![{\ displaystyle bccp (L (G_ {1})) = bccp (L (G_ {2}))}](https://wikimedia.org/api/rest_v1/media/math/render/svg/58cdcd376c82a6d77e39e20788aac9e108a9c637)
The equivalence problem is already for regular formal grammars and undecidable.
![G_ {1}](https://wikimedia.org/api/rest_v1/media/math/render/svg/e6ea4f4668b8334c8a7d3d284b0fd22131ef5f52)
![G_ {2}](https://wikimedia.org/api/rest_v1/media/math/render/svg/645011b0c6933a02f5f7d84624f78220d747427e)
Note that due to the inclusions established in the section Hierarchy of Chain-Code-Image-Languages , the following applies to each of the named problems with formal grammar and :
![P](https://wikimedia.org/api/rest_v1/media/math/render/svg/b4dc73bf40314945ff376bd363916a738548d40a)
![G](https://wikimedia.org/api/rest_v1/media/math/render/svg/f5f3c8921a3b352de45446a6789b104458c9f90b)
![{\ displaystyle X = \ {REG, CF, CS \}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/b0cc82cf78319b157a1ea36c5ee5c6d73c0bc33b)
- if for with is decidable, for a formal grammar with , and is also decidable.
![P](https://wikimedia.org/api/rest_v1/media/math/render/svg/b4dc73bf40314945ff376bd363916a738548d40a)
![{\ displaystyle bccp (L (G)) \ in {\ mathcal {CCP}} (x)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/dc68a30aaf16e14c29a7eb5b52a136069e584ed7)
![x \ in X](https://wikimedia.org/api/rest_v1/media/math/render/svg/3e580967f68f36743e894aa7944f032dda6ea01d)
![P](https://wikimedia.org/api/rest_v1/media/math/render/svg/b4dc73bf40314945ff376bd363916a738548d40a)
![{\ displaystyle G ^ {'}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/4156dd27560bd2a4b7fb3b90440ea98705ba87eb)
![{\ displaystyle bccp (L (G ^ {'})) \ in {\ mathcal {CCP}} (x ^ {'})}](https://wikimedia.org/api/rest_v1/media/math/render/svg/db8d69a6d6d4a836aac6bdbc183aa5cd4cb4cda3)
![{\ displaystyle x ^ {'} \ in X}](https://wikimedia.org/api/rest_v1/media/math/render/svg/9055a65df7923990cc827856063f0f556ea855ac)
![{\ displaystyle {\ mathcal {CCP}} (x ^ {'}) \ subset {\ mathcal {CCP}} (x)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a4fd82f157d45698dc099bf4d62f5be16a3ef4eb)
- if for with is undecidable, for a formal grammar with , and is also undecidable.
![P](https://wikimedia.org/api/rest_v1/media/math/render/svg/b4dc73bf40314945ff376bd363916a738548d40a)
![{\ displaystyle bccp (L (G)) \ in {\ mathcal {CCP}} (x)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/dc68a30aaf16e14c29a7eb5b52a136069e584ed7)
![x \ in X](https://wikimedia.org/api/rest_v1/media/math/render/svg/3e580967f68f36743e894aa7944f032dda6ea01d)
![P](https://wikimedia.org/api/rest_v1/media/math/render/svg/b4dc73bf40314945ff376bd363916a738548d40a)
![{\ displaystyle G ^ {'}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/4156dd27560bd2a4b7fb3b90440ea98705ba87eb)
![{\ displaystyle bccp (L (G ^ {'})) \ in {\ mathcal {CCP}} (x ^ {'})}](https://wikimedia.org/api/rest_v1/media/math/render/svg/db8d69a6d6d4a836aac6bdbc183aa5cd4cb4cda3)
![{\ displaystyle x ^ {'} \ in X}](https://wikimedia.org/api/rest_v1/media/math/render/svg/9055a65df7923990cc827856063f0f556ea855ac)
![{\ displaystyle {\ mathcal {CCP}} (x ^ {'}) \ supset {\ mathcal {CCP}} (x)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/80fb840ef03b5ed286ae2b56f57a808462c35aa6)
Geometric decision problems
First some geometric properties of a chain code image are defined below:
![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
-
is a simple curve if all nodes have degree 2 or less.![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
-
is called a closed simple curve if all nodes have exactly degree 2.![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
-
is called regular if all nodes have the same degree.![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
-
is called a tree if it does not contain a closed simple curve as a partial image.
-
is Eulerian when all nodes are of a degree.![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
-
is called Hamiltonian when a simple curve has as a partial image that contains all the nodes of .![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
![p](https://wikimedia.org/api/rest_v1/media/math/render/svg/81eac1e205430d1f40810df36a0edffdc367af36)
Studies have shown that even for regular formal grammars it is undecidable whether![{\ displaystyle G = (N, \ pi, P, S)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/9eb82c845b88daa0a15c528ecd5f4fa150052035)
- a simple curve,
- a closed simple curve,
- a regular picture,
- a tree,
- an Euler's picture,
- a Hamiltonian picture
includes.
For regular formal grammars , however, it can be decided whether
![{\ displaystyle G = (N, \ pi, P, S)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/9eb82c845b88daa0a15c528ecd5f4fa150052035)
- all pictures are of closed simple curve,
![{\ displaystyle bccp (L (G))}](https://wikimedia.org/api/rest_v1/media/math/render/svg/c656c07224f62aeb5c64963d34c3ff3e9a181a2e)
- all pictures are of rectangles ,
-
contains a rectangle,
-
contains a convex image.
Furthermore, for context-free formal grammars it can be decided whether all images are of trees.
![{\ displaystyle G = (N, \ pi, P, S)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/9eb82c845b88daa0a15c528ecd5f4fa150052035)
![{\ displaystyle bccp (L (G))}](https://wikimedia.org/api/rest_v1/media/math/render/svg/c656c07224f62aeb5c64963d34c3ff3e9a181a2e)
Generalizations
In the following some (informal) comments are made about extensions and generalizations of chain code images in order to get better images in a certain way.
Adding new directions
A certainly intuitive approach to expanding chain-code images is to add new directions to the four already known: up, down, right, and left. So can for example for all the neighboring points
![{\ displaystyle z = (m, n) \ in \ mathbb {Z} \ times \ mathbb {Z}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/330c28a2ee669f0e14c6eb033403e0400620b986)
, , , ,
![{\ displaystyle ul (z) = (m-1, n + 1)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/f662d2d7b00b1292001250fce41c30c2dd2e2548)
![{\ displaystyle dl (z) = (m-1, n-1)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/51c458544140f8b4171164ec3a30f8f4951ffc26)
![{\ displaystyle dr (z) = (m + 1, n-1)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/026fa577d03f18b90d5affe184d98de3ae319827)
can be added. Accordingly, one obtains the additional upper right directions ( u p r ight), top left ( u p l eft), lower right ( d own r ight) and lower left ( d own l eft), and thus the new alphabet .
![{\ displaystyle \ pi _ {F} = \ {u, d, r, l, ur, ul, dl, dr \}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/6b6d0a1a0a79c248e2dc303821e7ecff955167a4)
The above undecidable problems regarding the alphabet also remain undecidable under the alphabet . The situation is similar for the decidable problems.
![\pi](https://wikimedia.org/api/rest_v1/media/math/render/svg/9be4ba0bb8df3af72e90a0535fabcc17431e540a)
![{\ displaystyle \ pi _ {F}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/6248ed3c81d19298a8b269eb919ad3c4f3aa7e55)
Colored chain code pictures
If you want to get colored chain code images, the alphabet can be changed as follows. Instead of just using letters for directions, they are assigned colors. Let be a finite set of colors. Then we get the new alphabet with , i.e. the letters are pairs of the form for and .
![\pi](https://wikimedia.org/api/rest_v1/media/math/render/svg/9be4ba0bb8df3af72e90a0535fabcc17431e540a)
![C.](https://wikimedia.org/api/rest_v1/media/math/render/svg/4fc55753007cd3c18576f7933f6f089196732029)
![{\ displaystyle \ pi _ {C}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/3209bfb68dba041a4daa8333e73d32cad5fdf5a5)
![{\ displaystyle \ pi _ {C} = \ pi \ times C}](https://wikimedia.org/api/rest_v1/media/math/render/svg/c895320becb423f06f5daa59832b92136d712ac6)
![(b, c)](https://wikimedia.org/api/rest_v1/media/math/render/svg/f05051750d2a528c99f12dc06dc047c251e30043)
![{\ displaystyle b \ in \ pi}](https://wikimedia.org/api/rest_v1/media/math/render/svg/f8ba048c1b7212415999bd44aa013e873eefdc84)
![c \ in C](https://wikimedia.org/api/rest_v1/media/math/render/svg/447d3982c94c23d6b6d01c90da81a6125aa26567)
Here, too, one obtains similar results for the indecisability and decidability of the above problems.
Non-contiguous chain code images
Chain code images are always connected. If you want to allow non-connected chain-code images, you can add two letters to the alphabet , which in a sense mean putting a pencil on and off. The new alphabet is then. Intuitive stands for putting the pen down and putting it on . For a better understanding, consider the example modified from above below.
![\pi](https://wikimedia.org/api/rest_v1/media/math/render/svg/9be4ba0bb8df3af72e90a0535fabcc17431e540a)
![{\ displaystyle \ pi _ {\ updownarrow} = \ {u, d, r, l, \ uparrow, \ downarrow \}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/b364221fda280e6bf02f02e5836e87b020be6d50)
![\ uparrow](https://wikimedia.org/api/rest_v1/media/math/render/svg/ddb20b28c74cdaa09e1f101d426441da1996072f)
![\ downarrow](https://wikimedia.org/api/rest_v1/media/math/render/svg/4618f22b0f780805eb94bb407578d9bc9487947a)
Be
a given formal grammar. The language generated by is
![G_ {2}](https://wikimedia.org/api/rest_v1/media/math/render/svg/645011b0c6933a02f5f7d84624f78220d747427e)
.
The generated images look similar to those in the example above, only there are no horizontal stretches, because this is where the pen was always put down and was put back on with the vertical ones:
Analogous to chain code images, the family can also be set up and maintained
here with the types of the Chomsky hierarchy![{\ displaystyle {\ mathcal {CCP}} _ {\ updownarrow} (X)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/75d16854713b2e5a0df125d354f76d1b18168cda)
![{\ displaystyle X = \ {REG, CF, CS, RE \}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/75f0e2b7583ad3ef8386fdf1f92067453bbc470e)
and
.
With regard to the above decision problems, the situation here is significantly worse due to the non-correlation of the images.
Generation by other grammars
Another way of creating chain-code-image languages is to use other grammars. For example, Lindenmayer systems , turtle grammars , matrix grammars and collage grammars can be used to generate chain code images.
Depending on the type of grammar used, it is possible that certain images cannot be generated from any grammar of one type, but from a grammar of another type. In particular, it can be shown that there are chain code images that are produced by formal grammars but not by collage grammars.
literature