Lably
Skip to content

Alphabet (formal languages)

Base set of symbols with which a language is formed

  • 3 min read
  • 3 chapters

Related on Lably

Through Character (computing), Cardinality and String (computer science)

Strings, also known as "words" or "sentences", over an alphabet are defined as a sequence of the symbols from the alphabet set. For example, the alphabet of lowercase letters "a" through "z" can be used to form English words like "iceberg" while the alphabet of both upper and lower case letters can also be used to form proper names like "Wikipedia". A common alphabet is {0,1}, the binary alphabet, and "00101111" is an example of a binary string. Infinite sequences of symbols may be considered as well (see Omega language).

Strings are often written as the concatenation of their symbols, and when using this notational convention it is convenient for practical purposes to restrict the symbols in an alphabet so that this notation is unambiguous. For instance, if the two-member alphabet is {00,0}, a string written in concatenated form as "000" is ambiguous because it is unclear if it is a sequence of three "0" symbols, a "00" followed by a "0", or a "0" followed by a "00". However, this is a limitation on the notation for writing strings, not on their underlying definitions. Like any finite set, {00,0} can be used as an alphabet, whose strings can be written unambiguously in a different notational convention with commas separating their elements: 0,00 ≠ 0,0,0 ≠ 00,0.

Notation

By definition, the alphabet of a formal language L over Σ is the set Σ, which can be any non-empty set of symbols from which every string in L is built. For example, the set Σ={_,a,…,z,A,…,Z,0,1,…,9} can be the alphabet of the formal language L that means "all variable identifiers in the C programming language". It is not required to use every symbol in the alphabet of L for its strings.

Given an alphabet Σ, the set of all strings of length n over the alphabet Σ is indicated by Σn. The set ⋃i∈NΣi of all finite strings (regardless of their length) is indicated by the Kleene star operator as Σ∗, and is also called the Kleene closure of Σ. The notation Σω indicates the set of all infinite sequences over the alphabet Σ, and Σ∞ indicates the set Σ∗∪Σω of all finite or infinite sequences.

For example, using the binary alphabet {0,1}, the strings ε, 0, 1, 00, 01, 10, 11, 000, etc. are all in the Kleene closure of the alphabet (where ε represents the empty string).

Sign in to keep reading

2 more chapters are free with a Lably account.

More in Topics in mathematics