CS 139 // 2020-02-13
$\epsilon$
$q_0$
$s\in F$
A nondeterministic finite automaton (NFA) is a 5-tuple: $$M = (Q, \Sigma, \delta, q_0, F)$$
$$M = (Q, \Sigma, \delta, q_0, F)$$
$Q$
$\Sigma$
$q_0\in Q$
$F\subseteq Q$
$\delta:Q\times\Sigma_\epsilon\rightarrow\mathbb{P}(Q)$
$\Sigma_\epsilon = \Sigma \cup \{\epsilon\}$
$\mathbb{P}(Q)$
$L(M) = \{w\in\{0,1\}^\ast\mid\text{ the length of }w\text{ is 4} \}$
$L(M) = \{w\mid w\text{ starts with a 0 or ends with a 1}\}$
$L(M) = \{w\mid w\text{ contains the substring }\texttt{abba}\}$
$L$ is regular $\iff$ there is an NFA with $L(M) = L$
$L$
$\iff$
$L(M) = L$
$\implies$
$M$
$\Longleftarrow$
$M = (Q, \Sigma, \delta, q_0, F)$
$\widehat{M}$
// Java Example Pattern p = Pattern.compile("[abc]*[0-9]"); Matcher m = p.matcher("abbaccac9") boolean b = m.matches();
# grep example egrep '(abc|123)*' /home/username/Documents/my_file.txt
$R$ is a regular expression if it is in the form:
$R$
$a$
$a\in\Sigma$
$\emptyset$
$(R_1\cup R_2)$
$R_1$
$R_2$
$(R_1\circ R_2)$
$(R_1)^\ast$
Write the corresponding language that each of the following regular expressions express
$0\cup 1$
$01$
$01\cup\epsilon$
$\texttt{ab}\cup\emptyset$
$(0\cup 1)^\ast$
$0^\ast\cup 1$
$0(0\cup 1)^\ast \cup (0\cup 1)^\ast 1$
Let $\Sigma = \{\texttt{a}, \ldots, \texttt{z}\}\cup \{\texttt{/}, \texttt{N}, \texttt{*}\}$ be an alphabet
$\Sigma = \{\texttt{a}, \ldots, \texttt{z}\}\cup \{\texttt{/}, \texttt{N}, \texttt{*}\}$
$\texttt{//}\ldots \texttt{N}$
$\texttt{/*}\ldots \texttt{*/}$
$\texttt{/*abc*/def*/}$
$\texttt{*/}$
$L$ is regular $\iff$ there is a regex with $L(R) = L$
$L(R) = L$
$L(M) = L(R)$