Introduction to Computers & Programming

Similar documents
Theory of Computation. Theory of Computation

Part I: Definitions and Properties

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

Finite-state machines (FSMs)

Formal Definition of a Finite Automaton. August 26, 2013

Formal Definition of Computation. August 28, 2013


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

CPS 220 Theory of Computation Pushdown Automata (PDA)

Computability and Complexity

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

Chapter Two: Finite Automata

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

CISC 4090 Theory of Computation

ECS 120 Lesson 15 Turing Machines, Pt. 1

Turing Machines A Turing Machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite

Introduction to Automata

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

Theory of Languages and Automata

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

St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

Automata and Languages

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

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

Finite Automata. Finite Automata

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,

Pushdown Automata (Pre Lecture)

Automata Theory for Presburger Arithmetic Logic

Theory of computation: initial remarks (Chapter 11)

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

Automata Theory, Computability and Complexity

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

Final exam study sheet for CS3719 Turing machines and decidability.

Nondeterministic Finite Automata

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

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama

Automata and Languages

Deterministic Finite Automaton (DFA)

CSE 105 THEORY OF COMPUTATION

Introduction to Turing Machines

Introduction to the Theory of Computing

DM17. Beregnelighed. Jacob Aae Mikkelsen

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

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

CS21 Decidability and Tractability

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

EECS 144/244: Fundamental Algorithms for System Modeling, Analysis, and Optimization

Pushdown Automata. Chapter 12

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

Finite Automata. Seungjin Choi

Discrete Mathematics. CS204: Spring, Jong C. Park Computer Science Department KAIST

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

Pushdown Automata: Introduction (2)

CS Lecture 29 P, NP, and NP-Completeness. k ) for all k. Fall The class P. The class NP

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Theory of Finite Automata

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

Finite-State Machines (Automata) lecture 12

Computer Sciences Department

CHAPTER 1 Regular Languages. Contents

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

CISC4090: Theory of Computation

Theory of Computation

COMPARATIVE ANALYSIS ON TURING MACHINE AND QUANTUM TURING MACHINE

Computation Histories

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

CSE 105 THEORY OF COMPUTATION

Variants of Turing Machine (intro)

6.045J/18.400J: Automata, Computability and Complexity. Quiz 2. March 30, Please write your name in the upper corner of each page.

Chapter 5. Finite Automata

CSCE 551: Chin-Tser Huang. University of South Carolina

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

Computational Models #1

Methods for the specification and verification of business processes MPB (6 cfu, 295AA)

Finite State Machine (1A) Young Won Lim 6/9/18

Nondeterminism. September 7, Nondeterminism

Theory Bridge Exam Example Questions

Foundations of Informatics: a Bridging Course

Finite State Machines 2

Business Processes Modelling MPB (6 cfu, 295AA)

CS Lecture 28 P, NP, and NP-Completeness. Fall 2008

Automata and Computability

FINITE STATE MACHINES (AUTOMATA)

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

Critical CS Questions

Theory of Computation (I) Yijia Chen Fudan University

Lecture 10: Synchronous Sequential Circuits Design

Computational Models - Lecture 1 1

Chapter Five: Nondeterministic Finite Automata

Decision, Computation and Language

There are two main techniques for showing that problems are undecidable: diagonalization and reduction

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

The purpose here is to classify computational problems according to their complexity. For that purpose we need first to agree on a computational

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Where does it come from?

Theory of Computation (II) Yijia Chen Fudan University

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I

Student#: CISC-462 Exam, December XY, 2017 Page 1 of 12

Music as a Formal Language

Transcription:

16.070 Introduction to Computers & Programming Theory of computation: What is a computer? FSM, Automata Prof. Kristina Lundqvist Dept. of Aero/Astro, MIT

Models of Computation What is a computer? If you can t measure it it has no value Quantitative (numerical) Qualitative Can we model a computer as we know it today?

Models of Computation Uncomputable Turing Machines Phrase Structure Linear bounded automata Context-sensitive Pushdown automata Context-free Finite state automata Regular Machines Grammars/Languages Complex Crude

Finite Machines Think of a black box which takes inputs from the environment and produces some kind of observable response. Examples are e.g., vending machine, dish washer, automatic door opener A finite machine has a finite memory. It can only distinguish between a finite number of input histories. Each class of equivalent histories corresponds to a state of the machine. A Finite State Automata (FSA) is an abstract finite machine

One entry found for automaton. Finite Automata (Merriam-Webster) Main Entry: au tom a ton Pronunciation: o-'tä-m&-t&n, -m&-"tän Function: noun Inflected Form(s): plural -atons or au tom a ta /-m&-t&, -m&-"tä/ Etymology: Latin, from Greek, neuter of automatos Date: 1645 1 : a mechanism that is relatively self-operating; especially : ROBOT 2 : a machine or control mechanism designed to follow automatically a predetermined sequence of operations or respond to encoded instructions 3 : an individual who acts in a mechanical fashion

Theory of Computation 1. Finite state automata: deterministic and nondeterministic state machines, regular expressions and languages. Techniques for identifying and describing regular languages; techniques for showing that a language is not regular. Properties of such languages. 2. Context-free languages: Context-free grammars, parse trees, derivations and ambiguity. Relation to pushdown automata. Properties of such languages and techniques for showing that a language is not context-free.

Theory of Computation 3. Turing Machines: Basic definitions and relation to the notion of an algorithm or program. Power of Turing Machines. 4. Undecidability: Recursive and recursively enumerable languages. Universal Turing Machines. Power of Turing Machines. 5. Computational Complexity: Decidable problems for which no sufficient algorithms are known. Polynomial time computability. The notion of NP-completeness and problem reductions. Example of hard problems.

Finite Automata A simple finite automaton; an on/off-switch push start Off On push Initially the switch is Off. When the switch encounters a Push it changes state into the On state. When another Push is encountered we switch into the Off state and so on. Circles represent states. In this case named On and Off. Edges (arcs) represent transitions or input to the system. Start arrow indicates which state we start in

Finite Automata Software to design and verify circuit behavior Lexical analyzer of a typical compiler Parser for natural language processing An efficient scanner for patterns in large bodies of text (e.g. text search on the web) Verification of protocols (e.g. communications, security).

Moore and Mealy Machines Two types of machines: Moore and Mealy. The difference lies in the outputs. Mealy Machines The output is a function of the present state and all the inputs Input change causes an immediate output change Moore Machines The output is a function of the present state only Outputs change synchronously with state changes

Finite Automata any non-tag start <ol>, <ul> 0 1 <li> 2 <li> 3 4 L a <ul> <ul> <li>lab <li>lab 1 </li> </li> <li>lab <li>lab 2 </li> </li> </ul> </ul> Lab Lab 1 Lab Lab 2 b 5 space 8 <ol>, <ul> 7 </li> 6 any non-tag

Finite State Automata abba! Accept Reject b aba! abba! abbba! ab+a! q 0 a b a! q 1 q 2 q 3 q 4 A finite automaton called M 1 The figure is called the state diagram of M 1 It has 5 states labeled q 0, q 1, q 2, q 3, q 4, The start state is labeled q 0 The accept state q 2, is the one with double circles The arrows going from one state to another are called transitions

Formal Definition of a Finite Automaton An FSA is a 5-tuple (Q, Σ, δ, q 0, F) 1. Q is a finite set called the states 2. Σ is a finite set called the alphabet 3. δ: Q x Σ Q is the transition function 4. q 0 Q is the start state 5. F Q is the set of accept states (final states) 0 1 0 1 q 1 q 2 q 3 0,1 Q = {q 1, q 2, q 3 } Σ = {0, 1} δ is described as q1 is the start state F = {q 2 } 0 1 q 1 q 1 q 2 q 2 q 3 q 2 q 3 q 2 q 2

Formal Definition of a Finite Automaton If A is the set of all strings that machine M accepts, we say that A is the language of machine M and write L(M)=A We say that M recognizes A (or that M accepts A.) A machine may accept several strings, but it only recognizes one language.

Finite Automaton M 2 State diagram of finite automaton M 2 0 1 1 M 2 = ({q 1, q 2 }, {0, 1}, δ, q 1,{q 2 }) 0 1 q 1 q 2 q 1 q 1 q 2 q 2 q 1 q 2 0 What strings does M 2 accept?

Finite Automaton M 3 State diagram of finite automaton M 3 0 1 1 q 1 q 2 0 L(M 3 ) =(ω ω is the empty string or ends in a 0}.

Finite Automaton M 4 Alphabet = {a, b} What does M 4 accept? a s b b a q 1 r 1 All strings that start and end with a, or that start and end with b. In other words, M4 accepts strings that start and end with the same symbol. b b q 2 a a r 2 b a

Finite Automaton M 5 Alphabet = {<reset>, 0, 1, 2} What does M 5 accept? 0 M 5 keeps a running count of the sum of the numerical input symbols it reads, modulo 3. Every time it receives the <reset> symbol it resets the count to 0. 0, <reset> 2, <reset> 1 q 1 2 1 2 q 0 q 2 1, <reset? 0

Finite Automaton M 6 Is it possible to describe all finite automata by a state diagram? No: if diagram is to large to draw No: if description depends on some unspecified parameter B i = (Q i, Σ, δ i, q 0, {q 0 })

Formal Definition of Computation Let M = (Q, Σ, δ i, q 0, F) be a finite automaton Let w = w 1 w 2 w n be a string over the alphabet Σ Then M accepts w if a sequence of states r 0, r 1,, r n exists in Q with the following three conditions: 1. r 0 = q 0 2. δ(r i, w i+1 ) = r i+1 for i = 0,, n-1 3. r n F M recognizes language A if A = {w M accepts w}

Regular Language A language is called a regular language if some finite automaton recognizes it.