Basic Definitions

Formal language theory is the study of formal languages. Before we can work with formal languages, it is important to define some vocabulary.

Basic Objects

Symbol

Symbols are the smallest units in formal language theory. They are difficult to define on their own, and are best understood by their relationship to the subsequent definitions.

Alphabet

An alphabet is a non-empty collection of symbols.

Examples of alphabets include:

Conventionally, the symbol 'Σ' (uppercase sigma) denotes alphabets, though any symbol can so long as it does not conflict with other symbols.

Word

A word (also called a string or a sentence) is a finite sequence of symbols.

Three examples of words include:

Conventionally, the symbol 'w' denotes a word, though any symbol can so long as it does not conflict with other symbols.
The symbol 'ε' denotes the null word (also called the empty word).

Language

A language is a potentially infinite set of words with respect to some alphabet (That is, they can be finite or infinite). These are the key objects studied by formal language theory.

Three examples of languages include:

Conventionally, the symbol 'L' denotes a language, though any symbol can so long as it does not conflict with other symbols.
The empty set symbol '∅' denotes an empty language. This is not to be confused with { ε }, the language containing the null word.


Basic Operations

Concatenation

Concatenation is defined for words and languages.

For any two words a and b, their concatenation a ⋅ b is a word formed by taking the sequence of all symbols in a followed by all symbols in b.

Some basic properties of concatenation of words include:

For any two languages L0 and L1, their concatenation L0 ⋅ L1 is the language formed by concatenating each word in L0 each word in L1. This is similar to a Cartesian product.

The concatenation of languages exhibits similar properties to the concatenation of words:

Exponentiation

Exponentiation is defined for words, alphabets and languages. It can be thought of as repeated concatenation, in the same way exponentiation over real numbers can be thought of as repeated multiplication.

For any word a, its exponentiation an is the concatenation of a exactly n times.

The exponentiation of words shares some properties with the exponentiation of real numbers:

For any alphabet Σ, its exponentiation Σn is the language of all words created by concatenating n symbols from Σ. More simply, Σn is the language of all words in Σ of exactly length n.

For any language L, its exponentiation Ln is the language of all concatenations of n words in L.

Kleene Star

Kleene star (also called Kleene closure) is defined for words, alphabets, and languages. It can be thought of as the limit of exponentiation as n approaches infinity, or the set of zero or more exponentiations.

For any word a, its Kleene closure a* is the language of all concatenations of zero or more counts of a.

For any alphabet Σ, its Kleene closure Σ* is the language of all words with respect to Σ of length zero or more.

For any language L, its Kleene closure L* is the language of all concatenations of zero or more words in L.

Kleene Plus

Kleene plus is defined for words, alphabets, and languages. It can be thought of as Kleene closure minus ε, or the set of one or more exponentiations.

For any word a, its Kleene plus a+ is the language of all concatenations of one or more counts of a.

For any alphabet Σ, its Kleene plus Σ+ is the language of all words with respect to Σ of length one or more.

For any language L, its Kleene plus L+ is the language of all concatenations of one or more words in L.


Notational Sugar

Often times we may wish to do something like append a single symbol to every word in a language. Because concatenation is not defined between a symbol and a language, we must define the language of the single word of the single symbol to perform this operation. This is unwieldy, so we avoid it by abusing notation.

When necessary, a symbol can behave like the word containing only that symbol. This allows symbols to be used in operations with words. Similarly, a word can behave like the language containing only that word. This allows words to be used in operations with languages. By combining the two extensions, symbols can even be used in operations with languages.