Theory of Computation Automata Theory Dr. Ayman Srour
TOPIC 2: REGULAR LANGUAGES OUTLINE 2.1 Introduction 2.2 Finite Automata 2.3 Nondeterminism 2.4 Regular Expressions 2.5 Generalized Nondeterministic Finite Automaton
2.1 Finite Automata
Finite automata are good models for computers with an extremely limited or finite amount of memory. So, it defined as the simplest model of computation. Finite State Machine (FSM) or Finite State Automata (FSA) What can a computer do with such a small memory?
2.1 Finite Automata Example of a finite automaton: There are states off and on, the automaton starts in off and tries to reach the “good state” on What sequences of f s lead to the good state? Answer: {f, fff, fffff, …} = {f n : n is odd } This is an example of a deterministic finite automaton over alphabet {f} off on f f
2.1 Finite Automata We will now take a closer look at finite automata from a mathematical perspective. In beginning to describe the mathematical theory of finite automata, we do so in the abstract, without reference to any particular application. The following figure depicts a finite automaton called M I.
2.1 Finite Automata The figure called the state diagram of M l It has three states, labeled q l, q 2, and q 3. The start/initial state, q l, is indicated by the arrow pointing at it from nowhere. The accept/final state, q 2, is the one with a double circle. The arrows going from one state to another are called transitions.
2.1 Finite Automata When this automaton receives an input string such as 1101, it processes that string and produces an output. The output is either accept or reject. The processing begins in M 1 's start state. The automaton receives the symbols from the input string one by one from left to right. After reading each symbol, M1 moves from one state to another along the transition that has that symbol as its label. When it reads the last symbol, M1 produces its output. The output is accept if M 1 is now in an accept state and reject if it is not.
2.1 Finite Automata Try this string Start in state q1. 2. Read 1, follow transition from q1 to q2. 3. Read 1, follow transition from q2 to q2. 4. Read 0, follow transition from q2 to q3. 5. Read 1, follow transition from q3 to q2. 6. Accept because M1 is in an accept state q2 at the end of the input.
2.1 Finite Automata try these strings 1, 01, 1 1, and and these 100, 0100, , and What about these strings 0, 10, ? What is the pattern? Can you describe the language consisting of all strings that Ml accepts?
2.1 Finite Automata Forma Definition of finite automaton a finite automat is a 5-tuple (Q, , , q 0, F) where Q is a finite set of states is an alphabet : Q × → Q is a transition function q 0 Q is the initial state F Q is a set of accepting states (or final states).
2.1 Finite Automata Example: q0q0 q1q1 q2q ,11 alphabet = {0, 1} state Q = {q 0, q 1, q 2 } initial state q 0 accepting states F = {q 0, q 1 } states inputs 0 1 q0q0 q1q1 q2q2 q0q0 q1q1 q2q2 q2q2 q2q2 q1q1 transition function
2.1 Finite Automata
2.1 Finite Automata\Examples Construct a machine that accepts the language L = {010, 1} ( = {0, 1} )
2.1 Finite Automata\Examples Construct a machine that accepts the language Answer L = {010, 1} ( = {0, 1} ) qq q0q0 q1q1 q 01 q 010 q die 0,
2.1 Finite Automata\Examples Construct a FSA over alphabet {0, 1} that accepts all strings with at most three 1 s
2.1 Finite Automata\Examples Construct a FSA over alphabet {0, 1} that accepts all strings with at most three 1 s Answer q0q0 q1q q2q2 0 q3q3 1 q 4+ 0,
2.1 Finite Automata We already have an informal idea of the way finite automaton computes, and we now formalize it mathematically.
2.1 Finite Automata A language is called a regular language if some finite automaton recognizes it. Here is the state diagram of finite automaton M.
2.1 Finite Automata A language is called a regular language if some finite automaton recognizes it. Here is the state diagram of finite automaton M. In the formal description M2 = ({q i,q 2 }, {0,1},∂,q 1, {q 2 }). The transition function a is