Dyck language
In the theory of formal languages of computer science, mathematics, and linguistics, a Dyck word is a balanced string of brackets. The set of Dyck words forms a Dyck language. The simplest, Dyck-1, uses just two matching brackets, e.g. ( and ). Dyck words and language are named after the mathematician Walther von Dyck. They have applications in the parsing of expressions that must have a correctly nested sequence of brackets, such as arithmetic or algebraic expressions. Source: e01 Encyclopedia. Licence: CC BY-SA 4.0.
In the theory of formal languages of computer science, mathematics, and linguistics, a Dyck word is a balanced string of brackets. The set of Dyck words forms a Dyck language. The simplest, Dyck-1, uses just two matching brackets, e.g. ( and ). Dyck words and language are named after the mathematician Walther von Dyck. They have applications in the parsing of expressions that must have a correctly nested sequence of brackets, such as arithmetic or algebraic expressions. ==Formal definition== Let \Sigma = \{ [, ] \} be the alphabet consisting of the symbols [ and ]. Let \Sigma^{*} denote its Kleene closure. The Dyck language is defined as: \{ u \in \Sigma^* \vert \text{ all prefixes of } u \text{ contain no more ]'s than ['s} \text{ and the number of ['s in } u \text{ equals the number of ]'s}\}. ==Properties== The Dyck language is closed under the operation of concatenation. By treating \Sigma^{*} as an algebraic monoid under concatenation we see that the monoid structure transfers onto the quotient \Sigma^{*} / R , resulting in the syntactic monoid of the Dyck language. The class \operatorname{Cl}(\epsilon) will be denoted 1 . The syntactic monoid of the Dyck language is not commutative: if u = \operatorname{Cl}([) and v = \operatorname{Cl}(]) then uv = \operatorname{Cl}([]) = 1 \ne \operatorname{Cl}(][) = vu . With the notation above, uv = 1 but neither u nor v are invertible in \Sigma^{*} / R . The syntactic monoid of the Dyck language is isomorphic to the bicyclic semigroup by virtue of the properties of \operatorname{Cl}([) and \operatorname{Cl}(]) described above. By the Chomsky–Schützenberger representation theorem, any context-free language is a homomorphic image of the intersection of some regular language with a Dyck language on one or more kinds of bracket pairs. The Dyck language with two distinct types of brackets can be recognized in the complexity class TC^{0} . The number of distinct Dyck words with exactly pairs of parentheses and innermost pairs (viz. the substring [\ ] ) is the Narayana number \operatorname{N}(n, k) . Dyck words are isomorphic to Dyck paths, a subset of staircase walk symbols The number of distinct Dyck words with exactly pairs of parentheses is the -th Catalan number C_n . Notice that the Dyck language of words with parentheses pairs is equal to the union, over all possible , of the Dyck languages of words of parentheses pairs with innermost pairs, as defined in the previous point. Since can range from 0 to , we obtain the following equality, which indeed holds: C_n = \sum_{k=1}^n \operatorname{N}(n, k) ==Examples== [[File:Dyck lattice D4.svg|thumb|Lattice of the 14 Dyck words of length 8 - [ and ] interpreted as up and down]] We can define an equivalence relation L on the Dyck language \mathcal{D} . For u,v\in\mathcal{D} we have (u,v)\in L if and only if |u| = |v| , i.e. u and v have the same length. This relation partitions the Dyck language: \mathcal{D} / L = \{\mathcal{D}_0,\mathcal{D}_1,\ldots\} . We have \mathcal{D} = \mathcal{D}_{0} \cup \mathcal{D}_{2} \cup \mathcal{D}_{4} \cup \ldots = \bigcup_{n=0}^{\infty} \mathcal{D}_{n} where \mathcal{D}_{n} = \{ u\in\mathcal{D} \mid |u| = n\} . Note that \mathcal{D}_{n} is empty for odd n . Having introduced the Dyck words of length n , we can introduce a relationship on them. For every n \in \mathbb{N} we define a relation S_{n} on \mathcal{D}_{n} ; for u,v\in\mathcal{D}_{n} we have (u,v)\in S_{n} if and only if v can be reached from u by a series of proper swaps. A proper swap in a word u\in\mathcal{D}_{n} swaps an occurrence of '][' with '[]'. For each n\in\mathbb{N} the relation S_{n} makes \mathcal{D}_{n} into a partially ordered set. The relation S_{n} is reflexive because an empty sequence of proper swaps takes u to u . Transitivity follows because we can extend a sequence of proper swaps that takes u to v by concatenating it with a sequence of proper swaps that takes v to w forming a sequence that takes u into w . To see that S_{n} is also antisymmetric we introduce an auxiliary function \sigma_{n}:\mathcal{D}_{n}\rightarrow\mathbb{N} defined as a sum over all prefixes v of u : \sigma_n(u) = \sum_{vw=u} \Big( (\text{count of ['s in } v) - (\text{count of ]'s in } v) \Big) The following table illustrates that \sigma_{n} is strictly monotonic with respect to proper swaps. Hence \sigma_{n}(u') - \sigma_{n}(u) = 2 > 0 so \sigma_{n}(u) when there is a proper swap that takes u into u' . Now if we assume that both (u,v), (v,u)\in S_{n} and u\ne v , then there are non-empty sequences of proper swaps such u is taken into v and vice versa. But then \sigma_{n}(u) which is nonsensical. Therefore, whenever both (u,v) and (v,u) are in S_{n} , we have u = v , hence S_{n} is antisymmetric. The partial ordered set D_{8} is shown in the illustration accompanying the introduction if we interpret a [ as going up and ] as going down. ==See also== Dyck congruence Lattice word ==Notes== ==References== A proof of the Chomsky Schützenberger theorem An AMS blog entry on Dyck words
Cite this
"Dyck language". 1779349970. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1355347799 JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy