Problem 1

I will refer to the first and second languages by and respectively.

Claim 24.1.

.

is regular, and hence recognizable.

Claim 24.2.

is not recognizable.

Proof.

\{ a^{n}\\ | \ n\geq 0 }a^{i}$a^{j}$b^{i}a^{i}$b^{i}\in L_{2}a^{j}$b^{i}\notin L_{2}$.


Problem 2

Consider the following state DFA, where a -transition denotes a transition for every letter of the alphabet:

This accepts all words of length between and ; in fact, it accepts all words of length . However, , since it does not accept any words of length less than .


Problem 3

I will use the abbreviation a=ict. The production rule for becomes

Consider the word aases. This has two distinct parse trees in :

Thus, is ambiguous.

Let be the language , with the productions given by

Every else must pair with the most recent unmatched if. The grammar enforces that only matched statements can appear between the if and else of an if-then-else clause. Any unmatched sub-statements are forced to appear after the else (for example, this makes the second parse tree above invalid in ). As a result, for any string in , there is only one valid parse tree, eliminating ambiguity. Since every word in can be derived using the productions in and vice versa, we have .