Skip to main content

Finite Automata

Basic definition:

  • An alphabet Σ\Sigma is a non-empty, finite, set of symbols.
  • A string w over an alphabet Σ\Sigma is a finite (0 or more) sequence of symbols from Σ\Sigma, an empty string denote by ϵ\epsilon
  • The set of all strings is denoted Σ\Sigma^*
  • A language is any subset of Σ\Sigma^*

Deterministic finite automaton (DFA): input wΣw \in \Sigma^*     \implies output

  • Same state and same read character     \implies same next state (Deterministic)
  • Finite number of states (finite)
  • no empty string && each character only appear once && arrow for each charter in Σ\Sigma

Steps:

  1. Predefined start state
  2. reads input (per char at a time). Depend on the character read and current state, deterministically moves to a new state
  3. Finish reading, check if accept states. If accept, then accept. Otherwise rejects. (double circle accept)

Let MM be a DFA, the language of a DFA denoted L(M)L(M) is the set of strings wΣw\in \Sigma^* such that MM accepts ww.

The template of defining a DFA:

  1. Fix the alphabet, Σ\Sigma of the DFA
  2. Define a finite set of states QQ
  3. A start state qstartQq_{start} \in Q
  4. Define a subset FQF\subseteq Q are accept states
  5. qQ\forall q\in Q , xΣ,\forall x\in \Sigma, define yQy\in Q , xq    yx\land q\implies y

Nondeterministic finite automaton(NFA):

  • Allow empty string ϵ\epsilon, character can appear more times or 0 times

  • Same state and same read character     \implies same next state (Deterministic)

  • Finite number of states (finite)

Steps:

  1. Predefined start state
  2. reads input (per char at a time). Depend on the character read and current state, deterministically moves to a new state
    1. no such input appear in some arrow, immediately reject
  3. Since same character can appear many times, we need to make choice. That's, NFA accepts the string if any sequence of choices leads to an accept state

Let NN be a NFA, the language of a NFA denoted L(N)L(N) is the set of strings wΣw\in \Sigma^* such that NN accepts ww.


Let A,BA, B be any language over Σ\Sigma^*.

  • There is a DFA MM such that A=L(M)    NA = L(M) \iff \exists N is a NFA such that A=L(N)    AA = L(N) \iff A is regular
  • AA is regular if there is a DFA MM such that L(M)=AL(M) = A.
  • The complement of AA denote A=Σ\A\overline A =\Sigma^*\backslash A
  • The concatenation of AA and BB denote AB={ab:aA,bB}AB = \{ab:a\in A, b\in B\} is the set of strings that your get by concatenating a string in AA and a string in BB
  • n1\forall n \ge 1, define An={a1a2an:aiA,i,1in}A^n = \{a_1a_2\cdots a_n:a_i\in A, \forall i, 1\le i \le n\}. Let A0={ϵ}A^0 = \{\epsilon\}.
  • A=iNAiA^* = \bigcup_{i \in \N} A^i, called Kleene star, or "A star"

Let A,BA, B be any language over Σ\Sigma. x,y,wΣ\forall x,y,w\in \Sigma^*, xwA XOR ywA    wxw\in A \text{ XOR } yw\in A\implies w is distinguisher for x,yx, y

Define a binary equivalence relationship \sim relative to language A over Σ\Sigma^* as A\sim_A, x,yΣ,xAy    ¬\forall x,y\in \Sigma^*, x\sim_A y\iff \lnot \exists a distinguisher for x,y    wΣ.(xwA    ywA)x,y \iff \forall w\in \Sigma^*. (xw\in A \iff yw \in A). In this situation, we say xx is indistinguishable from yy relative to AA.

Myhjill-Nerode Theorem: Let AA be language over Σ\Sigma^*. AA is regular     A\iff \sim_A has a finite number of equivalence classes.

  • To prove not regular, we can find an infinite set SS s.t. any two elements x,ySx,y \in S are distinguishable. In other words, Let AA be a language. A set SS is infinite x,yS,xyxAy    A\land \forall x,y\in S, x\ne y\land x\nsim_A y \implies A is not regular

Define δ:Q×ΣQ\delta: Q\times \Sigma^*\to Q. x,yΣ,δ(q0,x)=δ(q0,y)    xAy\forall x,y\in \Sigma^*, \delta(q_0,x) = \delta(q_0,y) \implies x\sim_A y