Definition

Context-free Language

Let be a language. Then:

Inherently Ambiguous Language

A context-free language is inherently ambiguous if every CFG that generates it is ambiguous.

Theorems

T1: Every regular language is context-free

Let be a language.

Example

Note

#todo https://williamumboh.com/comp30026-2025/cfg/#regular-languages-are-context-free

In fact, we can restrict CF languages’ production rules to ensure they have no recursion to get them to degenerate to regular languages.

T:3 Every CF language can be recognised by a PDA

Let be a context-free language. Then there exists a pushdown automata that can accept all the words in the language:

T2: Context-free Languages are closed under union ^t2

Let be two context-free languages. Then, the union (with respect to languages), is also context-free:

T4: Context-free languages are closed under concatenation ^t4

Let be two regular languages. Then, the operation of concatenation preserves regularity:

T5: Context-free languages are closed under Kleene star ^t5

Let be a regular language. Then, the Kleene star operation preserves regularity:

#todo https://williamumboh.com/comp30026-2025/cfg/#closure-properties

make proofs

T6: More context-free-preserving operations #TODO ^t6

The following operations all preserve regularity:

  • Reversal