Download presentation
Presentation is loading. Please wait.
Published byValerie Morrison Modified over 9 years ago
1
Conceptual Foundations © 2008 Pearson Education Australia Lecture slides for this course are based on teaching materials provided/referred by: (1) Statistics for Managers using Excel by Levine (2) Computer Algorithms: Introduction to Design & Analysis by Baase and Gelder (slides by Ben Choi to accompany the Sara Baase’s text). (3) Discrete Mathematics by Richard Johnsonbaugh 1 Conceptual Foundations (MATH21001) Lecture Week 8 Reading: Textbook, Chapter 9: Automata, Grammars and Languages
2
2 Learning Objectives In this lecture, you will learn: Finite-state machines Finite-state automata Languages and grammars Nondeterministic finite-state automata Relationships between languages and automata
3
3 Finite-state Machines A finite-state machine is an abstract model of a machine with a primitive internal memory. A finite-state machine M consists of (a) A finite set I of input symbols. (b) A finite set O of output symbols. (c) A finite set S of states. (d) A next-state function f from S x I into S. (e) An output function g from S x I into O (f) An initial state σ ε S. We write M = (I, O, S, f, g, σ)
4
4 Example Let I={a, b}, O={0, 1}and S={σ0, σ1}. Define the pair of functions f and g by the rules given in the table below. Table 1 fg S Ia b σ0σ1σ0σ1 σ0 σ1 σ1 0 1 1 0
5
5 Example Then M = (I, O, S, f, g, σ0) is a finite state machine. Table 1 is interpreted as follows: f(σ0, a) = σ0 g(σ0, a) = 0 f(σ0, b) = σ1 g(σ0, b) = 1 f(σ1, a) = σ1 g(σ1, a) = 1 f(σ1, b) = σ1 g(σ1, b) = 0 The next state and output functions can also be defined by a transition diagram.
6
6 What is a Transition Diagram? Let M = (I, O, S, f, g, σ) be a finite state machine. The transition diagram of M is a diagraph G whose vertices are the members of S. Transition diagram is a digraph. The vertices are the states. The initial state is indicated by an arrow. If we are in state σ and inputting i causes output o and moves us to state σ1, we draw a directed edge from vertex σ to vertex σ1 and level it i/o.
7
7 Example – Transition Diagram Transition diagram of example on slide 4 is shown below. Table 1 shows that if we are in state σ0 and we input a, then we will output 0 and will remain in state σ0. Thus we draw a directed loop on vertex σ0 and label it a/0. By considering all such possibilities we obtain the transition diagram as follows: σ0σ0σ1σ1 a/0 a/1 b/1 b/0
8
8 Finite-state Automata A finite state automaton is a special kind of finite state machine. A finite state automaton A = (I, O, S, f, g, σ) is a finite state machine in which the set of output symbols is {0,1} and where the current state determines the last output.
9
9 Example fg S Ia b σ0 σ 1 σ2 σ1 σ0 σ2 σ0 1 0 Draw the transition diagram of the finite state machine A defined by the table. The initial state is σ0. Show that A is a finite state automaton.
10
10 Example The transition diagram is shown below. If we are in state σ0, the last output was 0. If we are in either state σ1 or σ2, the last output was 1; thus A is a finite state automaton. Example – Transition Diagram σ0σ0σ1σ1 b/0 a/1 b/0 σ2σ2 a/1
11
Conceptual Foundations © 2008 Pearson Education Australia Lecture slides for this course are based on teaching materials provided/referred by: (1) Statistics for Managers using Excel by Levine (2) Computer Algorithms: Introduction to Design & Analysis by Baase and Gelder (slides by Ben Choi to accompany the Sara Baase’s text). (3) Discrete Mathematics by Richard Johnsonbaugh 11
12
12 Languages & Grammars Definition Let A be a finite set. A formal language L over A is a subset of A*, the set of all strings over A. One way to define a language is to give a list of rules that the language is assumed to obey.
13
13 Grammar A grammar G =(N, T, P, S) consists of A finite set N of non-terminal symbols A finite set T of terminal symbols A finite subset P A starting symbol S which is a non-terminal.
14
14 Example – A grammar for Integers The following grammar generates all integers. ::=0|1|2|3|4|5|6|7|8|9 ::= | ::=+ |- ::= |
15
15 Summary Introduced finite-state machines (FSM) and finite-state automata (FSA). Reviewed various examples of FSM and FSA. Discussed transition diagram. Introduced language and grammar. In this lecture, we have
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.