Computation Theory Finite Automata

Similar documents
Proofs, Strings, and Finite Automata. CS154 Chris Pollett Feb 5, 2007.


Part I: Definitions and Properties

Deterministic Finite Automata (DFAs)

Deterministic Finite Automata (DFAs)

Finite-State Machines (Automata) lecture 12

Deterministic Finite Automata (DFAs)

Deterministic Finite Automaton (DFA)

CS 525 Proof of Theorems 3.13 and 3.15

Lexical Analysis. Reinhard Wilhelm, Sebastian Hack, Mooly Sagiv Saarland University, Tel Aviv University.

Turing Machines Part II

Deterministic Finite Automata (DFAs)

Griffith University 3130CIT Theory of Computation (Based on slides by Harald Søndergaard of The University of Melbourne) Turing Machines 9-0

Chapter 0 Introduction. Fourth Academic Year/ Elective Course Electrical Engineering Department College of Engineering University of Salahaddin

ECS 120 Lesson 15 Turing Machines, Pt. 1

Announcements. Problem Set 6 due next Monday, February 25, at 12:50PM. Midterm graded, will be returned at end of lecture.

CS4026 Formal Models of Computation

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Automata and Computability. Solutions to Exercises

Theory of Computation

arxiv: v1 [cs.cc] 3 Feb 2019

UNIT-I. Strings, Alphabets, Language and Operations

Automata and Computability. Solutions to Exercises

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata

MTAT Complexity Theory October 13th-14th, Lecture 6

CSCC63 Worksheet Turing Machines

Advanced topic: Space complexity

CprE 281: Digital Logic

Theory of Computation

where Q is a finite set of states

Complexity. Complexity Theory Lecture 3. Decidability and Complexity. Complexity Classes

CSE 311: Foundations of Computing. Lecture 23: Finite State Machine Minimization & NFAs

MACHINE COMPUTING. the limitations

Languages, regular languages, finite automata

Theory of Computation

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

2.6 Variations on Turing Machines

Let us first give some intuitive idea about a state of a system and state transitions before describing finite automata.

The Design Procedure. Output Equation Determination - Derive output equations from the state table

Clarifications from last time. This Lecture. Last Lecture. CMSC 330: Organization of Programming Languages. Finite Automata.

Equivalence of TMs and Multitape TMs. Theorem 3.13 and Corollary 3.15 By: Joseph Lauman

Outline. CS21 Decidability and Tractability. Machine view of FA. Machine view of FA. Machine view of FA. Machine view of FA.

Computational Models: Class 1

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT.

CSE 311 Lecture 23: Finite State Machines. Emina Torlak and Kevin Zatloukal

Finite Automata. Finite Automata

Formal Definition of Computation. August 28, 2013

Finite-state machines (FSMs)

Finite State Machines 2

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen

COMPUTER SCIENCE TRIPOS

Different encodings generate different circuits

Section 1 (closed-book) Total points 30

Lecture 10: Synchronous Sequential Circuits Design

M. Smith. 6 September 2016 / GSAC

CISC 4090 Theory of Computation

Theory of Computation

of Digital Electronics

SE 3310b Theoretical Foundations of Software Engineering. Turing Machines. Aleksander Essex

Q = Set of states, IE661: Scheduling Theory (Fall 2003) Primer to Complexity Theory Satyaki Ghosh Dastidar

CMP 309: Automata Theory, Computability and Formal Languages. Adapted from the work of Andrej Bogdanov

UNIT-III REGULAR LANGUAGES

CS21 Decidability and Tractability

Lecture notes on Turing machines

CS6901: review of Theory of Computation and Algorithms

EECS Components and Design Techniques for Digital Systems. FSMs 9/11/2007

CHAPTER 1 Regular Languages. Contents

Definition: A binary relation R from a set A to a set B is a subset R A B. Example:

Theory of computation: initial remarks (Chapter 11)

Boolean circuits. Lecture Definitions

IV. Turing Machine. Yuxi Fu. BASICS, Shanghai Jiao Tong University

(Refer Slide Time: 0:21)

Let s now begin to formalize our analysis of sequential machines Powerful methods for designing machines for System control Pattern recognition Etc.

Johns Hopkins Math Tournament Proof Round: Automata

CMPT 710/407 - Complexity Theory Lecture 4: Complexity Classes, Completeness, Linear Speedup, and Hierarchy Theorems

Equivalence of Regular Expressions and FSMs

Section Summary. Relations and Functions Properties of Relations. Combining Relations

Algorithms: COMP3121/3821/9101/9801

Chapter Five: Nondeterministic Finite Automata

Final Exam Comments. UVa - cs302: Theory of Computation Spring < Total

Discrete mathematics is the study of techniques, ideas and modes of

Logarithmic space. Evgenij Thorstensen V18. Evgenij Thorstensen Logarithmic space V18 1 / 18

(a) Definition of TMs. First Problem of URMs

CS3719 Theory of Computation and Algorithms

Advanced Automata Theory 7 Automatic Functions

With Question/Answer Animations

Theory of Computation. Theory of Computation

1 Definition of a Turing machine

Sequential Logic. Handouts: Lecture Slides Spring /27/01. L06 Sequential Logic 1

Introduction to Languages and Computation

Finite Automata and Languages

Advanced Automata Theory 2 Finite Automata

HW8. Due: November 1, 2018

Uses of finite automata

CMSC 330: Organization of Programming Languages. Theory of Regular Expressions Finite Automata

Multimedia. Multimedia Data Compression (Lossless Compression Algorithms)

Theoretical Computer Science

Notes on Finite Automata

Theory of Computation

Transcription:

Computation Theory Dept. of Computing ITT Dublin October 14, 2010 Computation Theory

I 1 We would like a model that captures the general nature of computation Consider two simple problems: 2 Design a program that, for any given word, outputs 1 if the word is of length 4n, n 0, 0 otherwise. 3 Design a program that sorts and outputs the result of any input sequence of numbers 4 You can easily design several different programs to solve these problems. Consider their complexity in terms of memory requirements: Computation Theory

II 5 Program 1 should only need to store the numbers 0, 1, 2, 3 in its memory, regardless of the input length 6 Program 2 will need to memorise the entire input list 7 We will examine the power and limitations of programs like the first one, which use a constant amount of memory, regardless of the input length. And since memory usage is constant, this can be moved to the CPU. 8 To do this we use a model called a Finite State Machine Consider the characteristics of a simplified version of a digital computer: 9 Information is stored in binary form Computation Theory

III 10 At any instant, the internal storage is set to certain patterns of bits... The state of the computer 11 Since the computer contains a finite amount of storage, there is a finite number of possible states 12 Actions are synchronised by an internal clock. On a pulse, input can be read, which can change some of the storage locations, thus changing the state of the machine to a new state 13 What that new state is will depend on what the input was, as well as the previous state 14 If these two factors are known, the change is predictable and non-random Computation Theory

IV 15 Because the contents of storage cells are available as output, the state of the machine determines its output 16 In this way, the machine produces a sequence of outputs in response to a sequence of inputs Computation Theory

FSM Definition The Finite State Machine is a model that captures the characteristics of the computer Definition (Finite State Machine) M = [S, I, O, f s, f o ] is a finite state machine if: 1 S is a finite set of states, 2 I is a finite set of input symbols (the input alphabet), 3 O is a finite set of output symbols (the output alphabet), 4 and f s and f o are functions where f s : S I S and f o : S O. 5 The machine is always initialised to begin in a fixed starting state s o. Computation Theory

FSM Example I We need to define the three sets and two functions involved: S = s 0, s 1, s 2 I = 0, 1 O = 0, 1 Because f s and f o act on finite domains, they can be defined by a state table (next slide) What would the effect be of an input sequence 01101? The FSM can also be defined by a state graph: Each state of the FSM and its output are shown as the label of a node Computation Theory

FSM Example II The next state function is given by directed arcs of the graph, each arc showing the input symbol required to produce the particular state change Present State Next State Output on Input 0,1 s 0 s 1, s 0 0 s 1 s 2, s 1 1 s 2 s 2, s 0 1 Computation Theory

Exercise 1 A FSM M1 is given by the following state graph (Fig. 1). Give the state table for M1 Figure: Finite State Machine, graph form Computation Theory

Exercise 2 A FSM M2 is given by the following state table. 1 Give the state graph for M2 2 What output corresponds to an input sequence of 2110? Present State Next State Output on Input 0,1,2 s 0 s 0, s 1, s 1 0 s 1 s 1, s 0, s 0 1 Computation Theory

A machine can be built which recognises when its input matches a certain description. What function does the following FSM perform? Figure: Computation Theory

1 To design a machine having an output of 1 exactly when the input string received to that point ends in 101. 2 Case 1: to handle an input sequence consisting of just 101... Figure: 3 Case 2: to extend the machine to handle any input sequence ending in 101 The machine states represent the ability to remember past inputs. Computation Theory

To avoid writing down outputs, we designate states of a FSM with an output of 1 as final states. They are denoted with a double circle Definition (FSM Recognition) A finite state machine M with input alphabet I recognises a subset S of I if M, beginning in state s 0 and processing an input string α, ends in a final state if and only if α S I is the set of all strings over I, the input alphabet. Computation Theory

Set Recogonition What are the Sets Recognised by the following FSMs? Figure: Computation Theory

I We need a compact way to describe the sets we have just seen We describe these using Regular Expressions, each describing a particular set Regular expressions over the input alphabet I are: the symbol (a symbol representing the empty set) and the symbol λ (a symbol which represents the set {λ} containing the empty string) the symbol i for any i I the expressions (AB), A B, and (A) if A and B are regular expressions Computation Theory

II Any set represented by a regular expression is a regular set: represents the empty set λ represents the set containing only the empty string i represents the set {i} containing any one symbol from the input alphabet if A and B are regular expressions, the following are regular sets: (A) represents the set of all concatenations of members of A AB the set of all elements of the form αβ where α is any member of A, and β is any member of B A B, the set of all elements of A and B. Computation Theory

I Informally: An element in AB is an item from A followed by an item from B An element in A B is a single item from either AorB An element in (A) is zero or more repetitions of elements from A λ is a member of the set represented by A, for any A Some examples: 0 10: Any number (including none) of zeros, or the string 10 Computation Theory

II 1 0(01) : Any number (including none) of ones, followed by a single zero, followed by any number (including none) of 01 pairs 0 1 : A single zero, or any number (including none) of ones (0 1) : Any string of zeros or ones (including l) 11(10) 11) (00 ): A nonempty string of pairs of ones interspersed with any number (including none) of 10 pairs, followed by at least one zero. Computation Theory

Equivalent Regular Expressions A regular set may be recognised by more than one regular expression: The set of all strings of 0 and 1 can be described by (0 1), but also by the regular expression ((0 1 ) (01) ) It is difficult to decide in general whether two regular expressions represent the same set. Computation Theory

Definition () Any set recognised by a FSM is regular, and ny regular set can be recognised by some FSM outlines the limitations and capabilities of FSMs: Regular sets are exactly the sets FSMs are capable of recognising It follows that if a set is not regular, there is no FSM which can recognise it Ex: The set S = {0 n 1 n n 0}, where 0 n is the string containing n 0 s. So this is the set of strings which have a specific number of 0 s followed by the same number of 1 s. Computation Theory

I Give a regular expression for each of the following: The set of all strings of 0s and 1s beginning with 0 and ending with 1 The set of all strings of 0 s and 1 s having an odd number of 0 s The set of all strings of a s and b s where each a is followed by two b s Does the given string belong to the given regular set? 01110111 (1 01) (11 0 ) 011100101 01 10 (11 0) Computation Theory

II A paragraph of English text is to be scanned and the number of words beginning with the word con counted. Design a FSM that will output a 1 each time such a word is encountered. The input alphabet I is equal to the keys on a keyboard, and O is {0, 1}. To represent blank, use the character β, and to simplify your FSM, you can use the input symbol I {m} to represent any character not equal to m. Construct a FSM to describe the behaviour of a VCR: Whenever a tape is inserted into the VCR, the machine automatically turns on and plays the tape. At the end of the tape, the machine turns off. To program the VCR, you must manually turn it on and select the menu function; when you are finished you turn the machine off, but its timer is set. At Computation Theory

III the appropriate time, the machine records, then at the appropriate time, the machine turns itself off. Computation Theory