Download presentation

Presentation is loading. Please wait.

Published byHailey West Modified over 3 years ago

1
Automata Theory Part 1: Introduction & NFA November 2002

2
**Introduction an abstract machine**

a specification with many possible implementations issues of functionality (power) and efficiency hierarchy of automata corresponds to hierarchy of grammars languages generated by grammars are accepted by automata the computational tasks performed by an automaton are very closely related to the structures & meanings modelled by the corresponding grammar.

3
**Computing power of automata:**

the simplest automata are only capable of adding numbers and recognising simple expressions more complex automata can evaluate arbitrary expressions and compile computer programs the most powerful automata can perform any computable task - significantly, there are tasks which cannot be computed. automata theory also reveals limitations on what can be made efficient.

4
**Deterministic Finite Automaton - DFA**

The simplest automata - main features: finite number of states state changes in response to an input symbol no choice of move DFA = (Q,T,F,g) where Q = set of states, including initial state T = set of input symbols F = set of final states, F Q g = transition function, Q T Q mapping

5
**DFA Transition or move defined by, g(q,a) = q’ where q,q’ Q, a T q**

6
DFA Operation can be represented as a state diagram in which: - nodes represent states, - arcs represent transitions or moves, - the initial state is arrowed, - and the final states are represented as squares. q q’ a1 f f F a2 Initial state intermediate state final state

7
DFA State of a DFA changes predictably in response to an input symbol - so at any time the entire future behaviour of a DFA is fully determined by 1. the current state, q 2. the remaining input symbols, x Combine these into a pair (q, x) giving a complete description of current situation.

8
**Teletext remote control example**

Pressing the text button followed by three digits causes the appropriate page to be loaded and displayed. Pressing the tv button causes a return to the normal image.

9
DFA - State Transition A move can be defined either in terms of the transition function: g(q,a) = q’ or, equivalently in terms of how the complete description evolves: (q,ax) (q’,x) Note the state change to q’ and the fact that the input symbol a is read and then dropped. A sequence of moves between these complete descriptions is denoted by * An input string w T* is accepted by the automaton if there is a finite sequence of moves such that (q0,w) * (q’,) for some q’ F , i.e. the automaton is in a final state when the input string is exhausted (). The language L(A) defined by an automaton A is the set of strings accepted by it, (a similar concept to the language generated by a grammar).

10
Parity tester example Q = {q0,q1}, F={q1}, T={0,1} where q0, q1 represent odd and even parity states respectively (binary input). Transition function is defined as follows: g(q0,0) = q0 g(q0,1) = q1 g(q1,0) = q1 g(q1,1) = q0 The machine accepts strings (in the final state q1 ) with odd parity.

11
**Binary adder DFA example**

Note that a DFA halts when its input string is exhausted (or when no move is possible for a given (state, input) pair), and not just because it has entered a final state. Some machines can also generate an output for every move. Let the output vocabulary be T*. The state diagram shows the output to the right of each arrow.

12
Binary Multiply by 3 In general, a DFA to multiply by n will require n states. No DFA can multiply an arbitrary pair of numbers.

13
**Non-deterministic Finite Automaton - NFA**

Finite automaton with a choice of moves: there may be more than one possible move for a given (state,input) pair. The transition function is many-valued: g(q,a) Q for q Q, q T The machine “chooses” a move from the set of possibilities, either at random or else by some mysterious unexplained process. Non-deterministic automata are not really practical machines, but they have great theoretical importance, and lead to some useful general ideas and procedures.

14
NFA Does this non-determinism increase the computing power of the machine? The answer for a finite automaton is no: Given any NFA it is always possible to construct an equivalent DFA. Equivalent here means that the machines accept the same strings, and generate the same output (if any).

15
NFA If the set of states of the NFA is Q, then the states of the DFA are subsets of Q, with initial state {q0}. Extend the transition function to subsets of Q by defining, G(R,a) = g(q,a) for R Q, a T qR Thus, make transition unique by forming the union of all the possibilities in order to construct a new set (state) to go to in response to an input symbol.

16
NFA to DFA conversion The non-determinism in the arcs in the original machine is embedded within the states of the new machine. We construct the states of the DFA recursively. First define states Ra = G({q0},a) = g(q0,a) for all a, then more new states Rab = G(Ra,b) for all a,b, and so on until no new states are generated. The final states of the DFA are those states R for which R F

17
NFA to DFA conversion Example:

Similar presentations

OK

Automata Theory December 2001 NPDAPart 3:. 2 NPDA example Example: a calculator for Reverse Polish expressions Infix expressions like: a + log((b + c)/d)

Automata Theory December 2001 NPDAPart 3:. 2 NPDA example Example: a calculator for Reverse Polish expressions Infix expressions like: a + log((b + c)/d)

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google