Definition
A formal language (or just language) over alphabet Σ is any subset L⊆Σ∗.
Intuition
A language is specified by giving the “words in the dictionary” - the strings that belong to it.
Examples
| Language | Alphabet | Description |
|---|
| ∅ | any | Empty language (no strings) |
| {ε} | any | Language containing only the empty string |
| Σ∗ | Σ | All strings over Σ |
| {anbn:n≥0} | {a,b} | Equal numbers of a‘s and b‘s |
| ${w : | w | \text{ even}}$ |
Operations on Languages
Union
L1∪L2={w:w∈L1∨w∈L2}
Intersection
L1∩L2={w:w∈L1∧w∈L2}
Complement
Lc=Σ∗∖L={w∈Σ∗:w∈/L}
Concatenation of Languages
Definition
L1⋅L2={uv:u∈L1∧v∈L2}
Properties
- Identity: L⋅{ε}=L={ε}⋅L
- Associativity: (L1⋅L2)⋅L3=L1⋅(L2⋅L3)
- Distributive over union: L1⋅(L2∪L3)=(L1⋅L2)∪(L1⋅L3)
Special Cases
- L⋅∅=∅=∅⋅L
- {ε}⋅L=L
Kleene Star
Definition
The Kleene star of language L is:
L∗=⋃n≥0Ln={ε}∪L∪L2∪L3∪⋯
where Ln=n timesL⋅L⋅…⋅L.
Alternative Definition
L∗ is the smallest language containing {ε} and L, closed under concatenation.
Examples
- {a}∗={ε,a,aa,aaa,…}
- {a,b}∗=Σ∗ if Σ={a,b}
- ∅∗={ε} (only the empty string)
- {ε}∗={ε}
Kleene Plus
L+=L⋅L∗=L∗∖{ε}=⋃n≥1Ln
Language Properties
Finite vs Infinite Languages
A language is finite if ∣L∣<∞, otherwise infinite.
Examples:
- {a,aa,aaa}: finite (3 elements)
- {an:n≥0}: infinite
Decidable Languages
A language L is decidable if there is an algorithm that determines whether any w∈Σ∗ belongs to L.
Closure Properties
Languages are closed under:
| Operation | Result |
|---|
| Union | L1∪L2 |
| Intersection | L1∩L2 |
| Complement | Lc |
| Concatenation | L1⋅L2 |
| Kleene star | L∗ |
Special Languages
The Empty Language
L=∅: contains no strings.
Note: ∅={ε}.
The Universal Language
L=Σ∗: contains all strings.
Singleton Languages
L={w}: contains exactly one string.
Summary
- A formal language is any subset L⊆Σ∗
- Operations: union, intersection, complement, concatenation, Kleene star
- L∗=⋃n≥0Ln is the Kleene closure
- Languages form a Boolean algebra under ∪, ∩, complement