Lecture 002

Memoryless Machine

Computational Model: allowed rules for information processing.

Interesting Algorithm:

Algorithms: contains

Run(w): a run on the input word w of m characters, is an alternating sequence (directed, labeled path in digraph) of states and letters (p_0, a_1, p_1, a_2, ... p_{m-1}, a_m, p_m) for m \geq 0, where every transitions are valid.

Nondeterministic Transitions: allow both p \xrightarrow{a} q and p \xrightarrow{a} q' (branching)

Valid Transition: p_{i-1} \xrightarrow{a_i} q_i is valid if p_{i-1} can reach q_i by reading alphabet a

Finite State Machine

Finite State Machine (decides | accepts | computes) a language.

Finite State Machine (FSM): \mathcal{A} = \langle{\mathcal{T}(Q, \Sigma, \delta), \text{acc}(q_0, F)}\rangle

Initial State: indicated by arrow pointing to the state from nowhere

Deterministic Finite Automata (DFA): \mathcal{M} = \langle{\mathcal{T}(Q, \Sigma, \delta), \text{acc}(q_0, F)}\rangle where \mathcal{T} is deterministic and complete

DFA Definition: \mathcal{M} = \langle{\mathcal{T}(Q, \Sigma, \delta), \text{acc}(q_0, F)}\rangle

// EXERCISE: prove \delta^*(p, xy) = \delta(\delta(p, x), y) for all x, y \in \Sigma^*

Regular (Recognizable) Language: a language L \in \Sigma^* is regular (\exists \text{DFA }\mathcal{M}) \mathcal{L} = L

DFA Example

Check Even Number of a and b

Check Even Number of a and b

Check Even Number of a and b (Standard Picture)

Check Even Number of a and b (Standard Picture)

Check if a is in 3rd position

Check if a is in 3rd position

Trap: a state p in DFA such that (\forall a \in \Sigma) \delta(p, a) = p Sink: a trap that is not final (removing a sink break completeness)

Partial (Incomplete) DFAs (PDFAs): DFAs but with sink removal, therefore not complete.

Application DFA

Membership of regular language: grep, emacs, regexp Non-Empty Acceptance Language: model checking

Searching String

Incomplete Machine Search 3 Text

Incomplete Machine Search 3 Text

Back Transition

Back Transition

Back Transitions: for a word s_0s_1s_2s_3... if the next symbol s_n does not step forward, instead of creating hard branch, jump to the node reached by a word s_1s_2s_3... and read s_n again.

DFA Decision Problems

DFA Membership: Does DFA \mathcal{M} accept input x \in \Sigma^*? (Lemma: DFA Membership solvable in linear time)

Emptiness: Does DFA \mathcal{M} accept no input? (no path from q_0 to any q \in F, tested by DFS or BFS) Finiteness: Does DFA \mathcal{M} accept finitely many input? Universality: Does DFA \mathcal{M} accept all input? State Complexity: Find the state complexity of language. (Because language is an infinite set, usually the input is an arbitrary DFA accepting the language) Solve by constructing the minimal DFA.

(Lemma: DFA Emptiness, Finiteness, Universality solvable in linear time)

// EXERCISE: show how to deal with Finiteness, Universality

// EXERCISE: prove certain DFA only accept even number of a and b

Equivalent DFA: \mathcal{M_1}, \mathcal{M_2} over \Sigma are equivalent if \mathcal{L(\mathcal{M_1})}, \mathcal{L(\mathcal{M_2})} (There exists multiple DFA to recognize the same language)

State Complexity of DFA (\text{stc}(\mathcal{A})): cardinality of states in \mathcal{A} State Complexity of Regular Language L (\text{stc}(L)): size of smallest DFA accepting L

Potential Problem: // QUESTION: why so?

Theorem: For every regular language there is exactly one minimal DFA, unique up to isomorphism.

accessible part of an automata: all states p such that there exists a run from q_0 to p. (non-accessible does not exist in DFA) co-accessible part of an automata: all states p such that there exists a run from p to a final (accepting) state. (non-co-accessible can all be replaced by a single rejecting sink state) trim: if all states are accessible and co-accessible. (cut down not accessible or not co-accessible parts by graph search)

// EXERCISE: try to construct another minimum DFA for even/even. Is it possible? Which states in the larger DFAs correspond to states of minimal one?

NDFA solving k position problem

NDFA solving k position problem
Problem: determine if the string has an a at k position

// EXERCISE: come up with an upper bound for complexity of L_{a, k} for k \leq 0

Divisibility Problem: Is input number a divisible by k?

But checking number n with base B=n is different:

Number Problem unsolvable by DFA

Number Problem unsolvable by DFA

Proving Existence of DFA

DFA Proof Example

DFA Proof Example
Idea: use the fact that two different string end up in the same state can never end up in a different state after reading same stream of symbols

Good Papers

S. Kleene
Representation of Events in Nerve Nets and Finite Automata
RAND Corporation, RM 704 (1951).

M. O. Rabin and D. Scott
Finite automata and their decision problems
IBM J. Research and Development, 3 (1959), 114–125.

Nondeterministic Finite Automata

\mathcal{A}=\langle{Q, \Sigma, \delta, I, F}\rangle: An NFA accepts an input x if and only if there exists a run on \delta with trace x, a source q\in I, and a target q' \in F

// TODO: Exercise (NFAs allow for language reversal) // WARNING: you must look at this

nondeterministic finite automata with \epsilon-moves (NFAE): NFA with allow transition without reading any character

// TODO: Exercise (NFAEs allow for concatenation) // WARNING: you must look at this

Table of Content