Introduction to Theoretical Computer Science. Motivation. Automata = abstract computing devices

Similar documents
Introduction to Automata

Finite Automata. Seungjin Choi

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

Introduction to Computers & Programming

Nondeterministic Finite Automata

Extended transition function of a DFA

Theory of computation: initial remarks (Chapter 11)

Finite Automata. Finite Automata

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES

CS:4330 Theory of Computation Spring Regular Languages. Finite Automata and Regular Expressions. Haniel Barbosa

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

Lecture 1: Finite State Automaton

Languages, regular languages, finite automata

Automata Theory and Formal Grammars: Lecture 1

Finite Automata and Languages

Decision, Computation and Language

Chapter 5. Finite Automata

Computer Sciences Department

COM364 Automata Theory Lecture Note 2 - Nondeterminism

Harvard CS 121 and CSCI E-207 Lecture 10: Ambiguity, Pushdown Automata

Automata and Grammars

1. (a) Explain the procedure to convert Context Free Grammar to Push Down Automata.

Final exam study sheet for CS3719 Turing machines and decidability.

How do regular expressions work? CMSC 330: Organization of Programming Languages

Part I: Definitions and Properties

Theory of Computation Lecture 1. Dr. Nahla Belal

Theory of Computation

Theory Bridge Exam Example Questions

Nondeterminism. September 7, Nondeterminism

Deterministic (DFA) There is a fixed number of states and we can only be in one state at a time

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS

CSE 105 THEORY OF COMPUTATION

Theory of Computation

Chapter Five: Nondeterministic Finite Automata

Computational Models #1

Inf2A: The Pumping Lemma

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Theoretical Computer Science

Automata and Computability

Critical CS Questions

Introduction to Formal Languages, Automata and Computability p.1/51

ECS 120 Lesson 15 Turing Machines, Pt. 1

DM17. Beregnelighed. Jacob Aae Mikkelsen

Automata Theory (2A) Young Won Lim 5/31/18

Announcements. Problem Set Four due Thursday at 7:00PM (right before the midterm).

1. Draw a parse tree for the following derivation: S C A C C A b b b b A b b b b B b b b b a A a a b b b b a b a a b b 2. Show on your parse tree u,

Foundations of Informatics: a Bridging Course

Uses of finite automata

Pushdown Automata: Introduction (2)

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

Theory of Computation

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

Lecture 17: Language Recognition

Peter Wood. Department of Computer Science and Information Systems Birkbeck, University of London Automata and Formal Languages

Computability and Complexity

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

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2017

Sri vidya college of engineering and technology

CISC4090: Theory of Computation

Computational Models - Lecture 1 1

Automata Theory, Computability and Complexity

Introduction to Languages and Computation

Formal Models in NLP

Finite-state machines (FSMs)

Introduction to Language Theory and Compilation: Exercises. Session 2: Regular expressions

CSE 211. Pushdown Automata. CSE 211 (Theory of Computation) Atif Hasan Rahman

NODIA AND COMPANY. GATE SOLVED PAPER Computer Science Engineering Theory of Computation. Copyright By NODIA & COMPANY

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism,

Theory of computation: initial remarks (Chapter 11)

Takeaway Notes: Finite State Automata

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

E.g. The set RE of regular expressions is given by the following rules:

Introduction to Theory of Computing

UNIT-I. Strings, Alphabets, Language and Operations

Automata and Formal Languages - CM0081 Non-Deterministic Finite Automata

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

Deterministic Finite Automaton (DFA)

PS2 - Comments. University of Virginia - cs3102: Theory of Computation Spring 2010

Automata and Computability. Solutions to Exercises

UNIT-III REGULAR LANGUAGES

St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

Deterministic Finite Automata. Non deterministic finite automata. Non-Deterministic Finite Automata (NFA) Non-Deterministic Finite Automata (NFA)

Finite Automata. BİL405 - Automata Theory and Formal Languages 1

10. Finite Automata and Turing Machines

Chapter 2: Finite Automata

How to Pop a Deep PDA Matters

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018


CS5371 Theory of Computation. Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression)

Topics COSC Administrivia. Topics Today. Administrivia (II) Acknowledgements. Slides presented May 9th and 16th,

Theory of Computation p.1/?? Theory of Computation p.2/?? Unknown: Implicitly a Boolean variable: true if a word is

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs

Pushdown Automata (Pre Lecture)

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont )

CPS 220 Theory of Computation Pushdown Automata (PDA)

The Pumping Lemma. for all n 0, u 1 v n u 2 L (i.e. u 1 u 2 L, u 1 vu 2 L [but we knew that anyway], u 1 vvu 2 L, u 1 vvvu 2 L, etc.

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is,

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I

UNIT-II. NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: SIGNIFICANCE. Use of ε-transitions. s t a r t. ε r. e g u l a r

Transcription:

Introduction to Theoretical Computer Science Motivation Automata = abstract computing devices Turing studied Turing Machines (= computers) before there were any real computers We will also look at simpler devices than Turing machines (Finite State Automata, Pushdown Automata,... ), and specification means, such as grammars and regular expressions. NP-hardness = what cannot be efficiently computed. Undecidability = what cannot be computed at all. 1

Finite Automata Finite Automata are used as a model for Software for designing digital cicuits Lexical analyzer of a compiler Searching for keywords in a file or on the web. Software for verifying finite state systems, such as communication protocols. 2

Example: Finite Automaton modelling an on/off switch Push off on Push Example: Finite Automaton recognizing the string then t h e n t th the then 3

Structural Representations These are alternative ways of specifying a machine Grammars: A rule like E E + E specifies an arithmetic expression Lineup P erson.lineup Lineup P erson says that a lineup is a single person, or a person in front of a lineup. Regular Expressions: Denote structure of data, e.g. [A-Z][a-z]*[][A-Z][A-Z] matches Ithaca NY does not match Palo Alto CA Question: What expression would match Palo Alto CA 4

Central Concepts Alphabet: Finite, nonempty set of symbols Example: Σ = {0, 1} binary alphabet Example: Σ = {a, b, c,..., z} the set of all lower case letters Example: The set of all ASCII characters Strings: Finite sequence of symbols from an alphabet Σ, e.g. 0011001 Empty String: The string with zero occurrences of symbols from Σ The empty string is denoted ɛ 5

Length of String: Number of positions for symbols in the string. w denotes the length of string w 0110 = 4, ɛ = 0 Powers of an Alphabet: Σ k = the set of strings of length k with symbols from Σ Example: Σ = {0, 1} Σ 1 = {0, 1} Σ 2 = {00, 01, 10, 11} Σ 0 = {ɛ} Question: How many strings are there in Σ 3 6

The set of all strings over Σ is denoted Σ Σ = Σ 0 Σ 1 Σ 2 Also: Σ + = Σ 1 Σ 2 Σ 3 Σ = Σ + {ɛ} Concatenation: If x and y are strings, then xy is the string obtained by placing a copy of y immediately after a copy of x x = a 1 a 2... a i y = b 1 b 2... b j xy = a 1 a 2... a i b 1 b 2... b j Example: x = 01101, y = 110, xy = 01101110 Note: For any string x xɛ = ɛx = x 7

Languages: If Σ is an alphabet, and L Σ then L is a language Examples of languages: The set of legal English words The set of legal C programs The set of strings consisting of n 0 s followed by n 1 s {ɛ, 01, 0011, 000111,...} 8

The set of strings with equal number of 0 s and 1 s {ɛ, 01, 10, 0011, 0101, 1001,...} L P = the set of binary numbers whose value is prime {10, 11, 101, 111, 1011,...} The empty language The language {ɛ} consisting of the empty string Note: = {ɛ} Note2: The underlying alphabet Σ is always finite 9

Problem: Is a given string w a member of a language L? Example: Is a binary number prime = is it a meber in L P Is 11101 L P? What computational resources are needed to answer the question. Usually we think of problems not as a yes/no decision, but as something that transforms an input into an output. Example: Parse a C-program = check if the program is correct, and if it is, produce a parse tree. Let L X be the set of all valid programs in prog lang X. If we can show that determining membership in L X is hard, then parsing programs written in X cannot be easier. Question: Why? 10

Finite Automata Informally Protocol for e-commerce using e-money Allowed events: 1. The customer can pay the store (=send the money-file to the store) 2. The customer can cancel the money (like putting a stop on a check) 3. The store can ship the goods to the customer 4. The store can redeem the money (=cash the check) 5. The bank can transfer the money to the store 11

e-commerce The protocol for each participant: a pay b redeem d transfer f (a) Store c ship redeem e ship transfer g ship cancel pay cancel 2 1 3 4 redeem transfer (b) Customer (c) Bank 12

Completed protocols: cancel pay,cancel pay,cancel pay,cancel a b d f pay redeem transfer ship ship ship (a) Store redeem transfer c e g pay,cancel pay,cancel pay,cancel pay, ship ship. redeem, transfer, pay, cancel cancel 2 pay,redeem, cancel, ship pay,redeem, cancel, ship pay, ship 1 3 4 redeem transfer (b) Customer (c) Bank 13

The entire system as an Automaton: 1 2 3 4 a b c d e f g P P P P P P P S S S R C C C C C C C R P S S S P P P P P P R P,C P,C P S R S S C P,C P,C P,C T P R T S S S R P,C C P,C P,C P,C P,C P,C P,C 14

Deterministic Finite Automata A DFA is a quintuple A = (Q, Σ, δ, q 0, F ) Q is a finite set of states Σ is a finite alphabet (=input symbols) δ is a transition function (q, a) p q 0 Q is the start state F Q is a set of final states 15

Example: An automaton A that accepts L = {x01y : x, y {0, 1} } The automaton A = ({q 0, q 1, q 2 }, {0, 1}, δ, q 0, {q 1 }) as a transition table: δ 0 1 q 0 q 2 q 0 q 1 q 1 q 1 q 2 q 2 q 1 The automaton A as a transition diagram: 1 0 0 1 q 0 q 2 q 1 0, 1 16

An FA accepts a string w = a 1 a 2... a n if there is a path in the transition diagram that 1. Begins at a start state 2. Ends at an accepting state 3. Has sequence of labels a 1 a 2... a n Example: The FA 1 0 0 1 q 0 q 2 q 1 0, 1 accepts e.g. the string 1100101 17

The transition function δ can be extended to ˆδ that operates on states and strings (as opposed to states and symbols) Base: ˆδ(q, ɛ) = q Recursive step: ˆδ(q, xa) = δ(ˆδ(q, x), a) Now, formally, the language accepted by A is L(A) = {w : ˆδ(q 0, w) F } The languages accepted by FA:s are called regular languages 18

Example: DFA accepting all and only strings with an even number of 0 s and an even number of 1 s q q 0 1 0 1 1 0 0 q 1 q 2 3 1 0 Tabular representation of the Automaton δ 0 1 q 0 q 2 q 1 q 1 q 3 q 0 q 2 q 0 q 3 q 3 q 1 q 2 19