Grammar
A derivation is a sequence of substitions to obtain a string. If there is more than one derivation for any string, the grammer is ambiguous. In a leftmost derivation, the leftmost remaining variable is always removed.
The ambiguous grammar
Could 1×2+3 be 5?
See pages 105 to 108, particularly 107.
Determinate vs Nondeterminate
A determinate machine has exactly one next action. A nondeterminate machine can have zero or more next actions, and magically do them all. That’s because it moves through sets of possible states.
Any nondeterminate finite automaton can be converted to a determinate finate automation. The is not the case for the pushdown autotomaton.
The ε transistion
From page 48 of the textbook regarding finite state machines:
If a state with a ε symbol on an exiting arrow is encountered, … [w]ithout reading any input, the machine splits into multiple copies, one following each of the exiting ε-labeled arrow and one staying at the current state.
From page 113 of the textbook regarding pushdown automaton:
… the current state, next input symbol read, and top symbol on the stack determine the next move of the pushdown automaton. Either symbol can be ε, causing the machine to move without reading a symbol from the input or without reading a symbol from the stack.
Remember that both finite state machines and pushdown automaton can be nondeterminate (having more than one “next” action). However nondeterminism only increases the “power” of the pushdown automaton.
By the way, for finite state automata ε-closure can be used to eliminate the ε transistion. This does not work for pushdown automata.
Pumping lemmas
Regular languages
if L is a regular language
there exists p > 0 such that
for every s ∈ L
there exists x, y, and z such that
s = xyz
|xy| ≤ p
|y| > 0
for every i ≥ 0
xyiz ∈ A
Context free languages
if L is a context free language
there exists p > 0 such that
for every s ∈ L
there exists u, v, x, y, and z such that
s = uvxyz
|vxy| ≤ p
|v| > 0 or |y| > 0
for every i ≥ 0
uvixyiz ∈ A
Regular languages
Showing a language is regular
- Create regular expression: usually easy
- Create regular grammer: not hard and reveals structure
- Show finite state machine: harder and may require much explaining
- Use the pigeonhole principle with care.
- May be able to ease the task using closure properties
Showing a language is not regular
- Demonstrate impossibility of regular expression or finite state automaton: hard
- Use the pumping lemma: may not work — See Problem 1.54
- Use the Myhill-Nerode theorem: harder than the pumping lemma — See Problem 1.52
- May be able to ease the task using closure properties
Context free languages
Showing a language is context free
- Create context free grammar: not so hard and pretty easy to explain
- Create push down automata: very hard and requires much explaining
Showing a language is not context free
- Demonstrate impossibility of context free grammar or push down automata: painfully hard
- Use the pumping lemma: may not work — See StackExchange or Wise’s strong pumping lemma
- May be able to ease the task using closure properties