# Lecture 003

### Regular Language

Regular Language

• closed under complement: if $L \subseteq \Sigma^*$ is regular, then so is $\overline{L} = \Sigma^* - L$
\langle{Q, \Sigma, \delta, q_0, F}\rangle \rightarrow \langle{Q, \Sigma, \delta, q_0, Q-F}\rangle
• closed under union: if $L_1 \subseteq \Sigma^*$ and $L_2 \subseteq \Sigma^*$ are regular, then so is $L_1 \cup L_2$
\langle{Q_1, \Sigma, \delta_1, q_{0a}, F_1}\rangle \times \langle{Q_2, \Sigma, \delta_2, q_{0b}, F_2}\rangle \rightarrow \\ \langle{Q_1 \times Q_2, \Sigma, \delta((q_1, q_2), \sigma) = (\delta_1(q_1, \sigma), \delta_2(q_2, \sigma)), (q_{0a}, q_{0b}), \{(q_0, q_1) | q_0 \in F_1 \lor q_1 \in F_2\}}\rangle
• closed under intersection: same, replace OR with AND (or $L_1 \cap L_2 = \overline{\overline{L_1} \cup \overline{L_2}}$)

• closed under difference:

\langle{Q_1, \Sigma, \delta_1, q_{0a}, F_1}\rangle \times \langle{Q_2, \Sigma, \delta_2, q_{0b}, F_2}\rangle \rightarrow \\ \langle{Q_1 \times Q_2, \Sigma, \delta((q_1, q_2), \sigma) = (\delta_1(q_1, \sigma), \delta_2(q_2, \sigma)), (q_{0a}, q_{0b}), \{(q_0, q_1) | q_0 \in F_1 \land q_1 \in Q - F_2\}}\rangle
• closed under concatenation: if $L_1 \subseteq \Sigma^*$ and $L_2 \subseteq \Sigma^*$ are regular, then so is $L_1L_2$
\langle{Q_1, \Sigma, \delta_1, q_{0a}, F_1}\rangle \times \langle{Q_2, \Sigma, \delta_2, q_{0b}, F_2}\rangle \rightarrow \\ \langle{Q_1 \times \mathcal{P}(Q_2), \Sigma, \delta((q, \{q_1, ..., q_n\}), \sigma) = \begin{cases} (\delta_1(q, \sigma), \{\delta_2(q_1, \sigma), ..., \delta_2(q_n, \sigma)\}) \text{ if } \delta(q, \sigma)\notin F\\ (\delta_1(q, \sigma), \{\delta_2(q_1, \sigma), ..., \delta_2(q_n, \sigma)\} \cup \{q_{0b}\}) \text{ if } \delta(q, \sigma)\in F\\ \end{cases}, \begin{cases} (q_{0a}, \emptyset) \text{ if } q_{0a} \notin F\\ (q_{0a}, \{q_{0b}\}) \text{ if } q_{0a} \in F\\ \end{cases}, \{(q \in Q_1, S \subseteq Q_2) | (\exists q'\in S) q' \in F_2\}}\rangle
• closed under star: if $L \subseteq \Sigma^*$ is regular, then so is $L^*$. Show $L^* = \bigcup_{n\in\mathbb{N}^{+}}L^n \cup \{\epsilon\}$ by construct DFA.
\langle{Q, \Sigma, \delta, q_0, F}\rangle \rightarrow \langle{\mathcal{P}(Q), \Sigma, \delta'(S, \sigma)\begin{cases} \{\delta(s, \sigma) | s \in S\} \cup \{q_0\} \text{ if } (\exists s \in S) \delta(s, \sigma) \in F\\ \{\delta(s, \sigma) | s \in S\} \text{ otherwise } \end{cases}, {q_0}, \{S \subseteq Q | S \cap F \neq \emptyset\}}\rangle

// WARNING: This cannot be proven by induction $L^* = \bigcup_{n\in\mathbb{N}}L^n$ because regular language are not closed under infinite unions. They are closed under finite unions.

Recursive Definition:

• $\emptyset$ is regular

• $(\forall a \in \Sigma) \{a\}$ is regular

• $L_1$, $L_2$ regular $\implies L_1 \cup L_2$ regular

• $L_1$, $L_2$ regular $\implies L_1L_2$ regular

• $L$ regular $\implies L^*$ regular

Other propertiesn

• While $\forall k \in \mathbb{N} \bigcup_{i=0}^k L_i$ is regular, $\bigcup_{i \geq 0}L_i$ is not regular.

• While $L_n = \{0^n1^n\}$ is regular $\bigcup_{n \geq 0}L_n = \{0^n1^n | n \in \mathbb{N}\}$ is not regular.

• Union of two irregular language can be regular.

DFA Construction Example:

\begin{align} Q &= \mathbb{P}(Q')\\ \Sigma &= \Sigma'\\ \delta(S_{\text{set of states}}, a) &= \{\delta'(s, a) | s \in S_{\text{set of states}}\}\\ q_0 &= Q'\\ F &= \{q \in Q | (\exists p \in q)(p \in F') \}\\ \end{align}

If $M$ accepts, that means there exists $x \in \Sigma^*$, $w$ is the input, such that $M'$ accepts $xw \in \Sigma^*$. We also know if $M'$ accepts $xw \in \Sigma^*$, then $w = x$ only if they are the same length.

\begin{align} Q &= \mathbb{P}(Q') \times \mathbb{P}(Q')\\ \Sigma &= \Sigma'\\ \delta(S_{\text{set of states}}, T_{\text{set of states}}, a) &= \{\delta'((s, t), a) | s \in S_{\text{set of states}}\}\\ q_0 &= \{q_0'\}\\ F &= \{q \in Q | (\exists p \in q)(p \in F') \}\\ \end{align}

## Sutner's Lecture

### Regular Languages

Tally Language: $L \subseteq \Sigma = \{a\}$ for all $a$ is a tally language. Since we can interpret $a^n$ as a natural number $n$ over $\Sigma$, then a tally language is a subset of $\mathbb{N}$

• Tally Language always produce DFA like this:

Linear: a set $A \in \mathbb{N}$ is linear if $A = \{c + \sum_{i=1}^d c_ic_x | x_i \geq 0\}$ were $c$ is constant and $c_i$ is periods.

• Example: $\{5 + 1x + 2y + 4z\}$ (number of variables is finite, but the set is infinite)

Semilinear: finite union of linear sets (every finite set is semilinear by allowing $d=0$ in linear set. $A = A_0 \cup \{b + (b_i + xp) | x \geq 0, i \in [k]\}$ where $A_0$ is finite) // TODO: understand this

• closed under union, intersection, complement

• $A \subseteq \mathbb{N} \text{ is semilinear } \iff A \text{ is a regular language}$ (proof by every DFA over $\{a\}$ is a "lasso": a transient followed by a loop, produces periodic set.)

Primitive Recursive: closed under Boolean operations (union, intersection, complement) Regular Language: closed under

• Boolean operations (union, intersection, complement)

• concatenation, Kleene star

• reversal

• homomorphisms, inverse homomorphisms

### DFA Accessibility

Cartesian Product Automation: $A = A_1 \times A_2 = \langle{Q_1 \times Q_2, \Sigma, \delta_1, \delta_2; (q_{01}, q_{02}), F_1 \times F_2}\rangle$

• $\mathcal{L}(A_1 \times A_2) = L_1 \cap L_2$

• union: if $F = F_1 \times Q_2 \cup Q_1 \times F_2$

• intersection if: $F = F_1 \times F_2$

• difference if: $F = F_1 \times (Q_2 - F_2)$

Accessible state: state $p$ in finite automation is accessible if there is a run from initial state to $p$.

Accessible automation: if all states are accessible.

• Accessible part of $A$ is equivalent to $A$ (cutting down useless states)

Co-accessibility of state: state $p$ in finite automation is co-accessible if there is a run from $p$ to final state.

Co-accessibility automation: if all states are co-accessible.

• Co-accessible part of DFA may not be a DFA.

Trim automation: both accessible and co-accessible.

• can be constructed by graph algorithms

### State Complexity

$\text{stc}(L_1 \cap L_2) \leq \text{stc}(L_1) \times \text{stc}(L_2)$ (size of the product machine $A = \prod A_i$ may be exponential, PSPACE-hard)

• state complexity bound of concat language in DFA: $|A_1|2^{|A_2|}$

Lemma: $A_1 \equiv A_2 \iff \mathcal{L}(A_1) - \mathcal{L}(A_2) = \emptyset \land \mathcal{L}(A_2) - \mathcal{L}(A_1) = \emptyset$

NFA State Complexity: state complexity bound of concat language in NFA: $|A_1|+|A_2|$ (NFA accepts if there is a run from $I$ to $F$)

NFA Reversal: $A^{op} = \langle{Q, \Sigma, \tau^{op}; F, I}\rangle$ where $(p, a, q) \in \tau^{op} \iff (q, a, p) \in \tau$

NFAE: with autonomous transition (epsilon moves)

• transition function $\tau \subseteq Q \times (\Sigma \cup \{\epsilon\}) \times Q$

Hierarchy: $DFA \subseteq PDFA \subseteq NFA \subseteq NFAE$

• but full power automation of NFA $A$ is $pow_f(A)$ has state complexity $2^n$

Rabin-Scott construction:

• but some DFA can be smaller than it's NFA

Table of Content