|This article relies largely or entirely upon a single source. (April 2015)|
In the theory of formal languages of computer science, mathematics, and linguistics, the Dyck language is the language consisting of balanced strings of parentheses [ and ]. It is important in the parsing of expressions that must have a correctly nested sequence of parentheses, such as arithmetic or algebraic expressions. It is named after the mathematician Walther von Dyck.
- is with "" inserted into the th position
- is with "" deleted from the th position
with the understanding that is undefined for and is undefined if . We define an equivalence relation on as follows: for elements we have if and only if there exists a finite sequence of applications of the and functions starting with and ending with , where the empty sequence is allowed. That the empty sequence is allowed accounts for the reflexivity of . Symmetry follows from the observation that any finite sequence of applications of to a string can be undone with a finite sequence of applications of . Transitivity is clear from the definition.
The equivalence relation partitions the language into equivalence classes. If we take to denote the empty string, then the language corresponding to the equivalence class is called the Dyck language.
An alternative definition of the Dyck language can be formulated when we introduce the function.
- for any .
where and are respectively the number of [ and ] in . I.e. counts the imbalance of [ over ]. If is positive then has more [ than ].
Now, the Dyck language can be defined as the language
- The Dyck language is closed under the operation of concatenation.
- By treating as an algebraic monoid under concatenation we see that the monoid structure transfers onto the quotient , resulting in the syntactic monoid of the Dyck language. The class will be denoted .
- The syntactic monoid of the Dyck language is not commutative: if and then .
- With the notation above, but neither nor are invertible in .
- The syntactic monoid of the Dyck language is isomorphic to the bicyclic semigroup by virtue of the properties of and 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 homomorphic preimage of the Dyck language on two parentheses.
- The Dyck language with two distinct types of parentheses can be recognized in the complexity class .
For Example : As you move from left to right , insert a '(' for every times it goes up and a ')'for every times go down you end up with a string such as (()(())). Two diagrams are connected if swapping one set of two adjacent parentheses produces the other. i.e. in the top, (((()))) is connected to ((()())) and vice versa by swapping the middle two. It's major uses are in combinatorics.