Honors Class (Foundations of) Informatics. Tom Verhoeff. Department of Mathematics & Computer Science Software Engineering & Technology



Similar documents
Pushdown Automata. place the input head on the leftmost input symbol. while symbol read = b and pile contains discs advance head remove disc from pile

Pushdown automata. Informatics 2A: Lecture 9. Alex Simpson. 3 October, School of Informatics University of Edinburgh als@inf.ed.ac.

The Halting Problem is Undecidable

Automata and Computability. Solutions to Exercises

Turing Machines: An Introduction

Pushdown Automata. International PhD School in Formal Languages and Applications Rovira i Virgili University Tarragona, Spain

Fast nondeterministic recognition of context-free languages using two queues

3515ICT Theory of Computation Turing Machines

Overview of E0222: Automata and Computability

Implementation of Recursively Enumerable Languages using Universal Turing Machine in JFLAP

Introduction to Automata Theory. Reading: Chapter 1

FINITE STATE AND TURING MACHINES

(IALC, Chapters 8 and 9) Introduction to Turing s life, Turing machines, universal machines, unsolvable problems.

Models of Sequential Computation

CS154. Turing Machines. Turing Machine. Turing Machines versus DFAs FINITE STATE CONTROL AI N P U T INFINITE TAPE. read write move.

Regular Languages and Finite State Machines

Model 2.4 Faculty member + student

On String Languages Generated by Spiking Neural P Systems

Formal Grammars and Languages

SRM UNIVERSITY FACULTY OF ENGINEERING & TECHNOLOGY SCHOOL OF COMPUTING DEPARTMENT OF SOFTWARE ENGINEERING COURSE PLAN

Informatique Fondamentale IMA S8

CAs and Turing Machines. The Basis for Universal Computation

Finite Automata. Reading: Chapter 2

Compiler Construction

How To Compare A Markov Algorithm To A Turing Machine

Chapter 7 Uncomputability

Automata Theory. Şubat 2006 Tuğrul Yılmaz Ankara Üniversitesi

24 Uses of Turing Machines

Finite Automata. Reading: Chapter 2

FIRST and FOLLOW sets a necessary preliminary to constructing the LL(1) parsing table

MACM 101 Discrete Mathematics I

DATA STRUCTURES USING C

Two-dimensional Languages

Automata and Formal Languages

Computational Models Lecture 8, Spring 2009

CS 301 Course Information

Scanner. tokens scanner parser IR. source code. errors

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 4 Nancy Lynch

CSE 135: Introduction to Theory of Computation Decidability and Recognizability

CS5236 Advanced Automata Theory

CS103B Handout 17 Winter 2007 February 26, 2007 Languages and Regular Expressions

Turing Machines, Part I

Theory of Computation Chapter 2: Turing Machines

Theory of Computation Class Notes 1

Reading 13 : Finite State Automata and Regular Expressions

Genetic programming with regular expressions

Finite Automata and Formal Languages

Regular Languages and Finite Automata

Computer Architecture Syllabus of Qualifying Examination

Increasing Interaction and Support in the Formal Languages and Automata Theory Course

C H A P T E R Regular Expressions regular expression

Algorithms and Data Structures

Increasing Interaction and Support in the Formal Languages and Automata Theory Course

Intrusion Detection via Static Analysis

THEORY of COMPUTATION

Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

Course Manual Automata & Complexity 2015

Computability Theory

Introduction to Finite Automata

Lexical Analysis and Scanning. Honors Compilers Feb 5 th 2001 Robert Dewar

Universal Turing Machine: A Model for all Computational Problems

CS 341: Foundations of Computer Science II elearning Section Syllabus, Spring 2015

Philadelphia University Faculty of Information Technology Department of Computer Science First Semester, 2007/2008.

CMPSCI 250: Introduction to Computation. Lecture #19: Regular Expressions and Their Languages David Mix Barrington 11 April 2013

CSC4510 AUTOMATA 2.1 Finite Automata: Examples and D efinitions Definitions

Regular Expressions and Automata using Haskell

Diagonalization. Ahto Buldas. Lecture 3 of Complexity Theory October 8, Slides based on S.Aurora, B.Barak. Complexity Theory: A Modern Approach.

Compiler Design July 2004

Syntaktická analýza. Ján Šturc. Zima 208

Compiler I: Syntax Analysis Human Thought

Algorithmic Software Verification

Grammars with Regulated Rewriting

ÖVNINGSUPPGIFTER I SAMMANHANGSFRIA SPRÅK. 15 april Master Edition

Chapter 2 Introduction to SPSS

ALLIED PAPER : DISCRETE MATHEMATICS (for B.Sc. Computer Technology & B.Sc. Multimedia and Web Technology)

The Classes P and NP. mohamed@elwakil.net

The Optimum One-Pass Strategy for Juliet

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

Algebraic Computation Models. Algebraic Computation Models

Learning Automata and Grammars

University of Toronto Department of Electrical and Computer Engineering. Midterm Examination. CSC467 Compilers and Interpreters Fall Semester, 2005

Lecture 36: Turing Machines [Fa 14]

Finite Automata and Regular Languages

Computer Science Theory. From the course description:

Regular Languages and Finite Automata

Implementation of DNA Pattern Recognition in Turing Machines

A Programming Language for Mechanical Translation Victor H. Yngve, Massachusetts Institute of Technology, Cambridge, Massachusetts

Magic Word. Possible Answers: LOOSER WINNER LOTTOS TICKET. What is the magic word?

Creating A Grade Sheet With Microsoft Excel

Lexical analysis FORMAL LANGUAGES AND COMPILERS. Floriano Scioscia. Formal Languages and Compilers A.Y. 2015/2016

Notes on Complexity Theory Last updated: August, Lecture 1

Complexity Classes P and NP

CELLULAR AUTOMATA AND APPLICATIONS. 1. Introduction. This paper is a study of cellular automata as computational programs

Transcription:

Honors Class (Foundations of) Informatics Tom Verhoeff Department of Mathematics & Computer Science Software Engineering & Technology www.win.tue.nl/~wstomv/edu/hci c 2011, T. Verhoeff @ TUE.NL 1/20 Information

Automata and Grammars? c 2011, T. Verhoeff @ TUE.NL 2/20 Information

Finite State Machine (FSM) Takes a sequence of symbols from some alphabet as input. Produces a sequence of symbols from some alphabet as output. Has a finite set of (computational) states, with one start state. Has a set of state transitions (computational steps): Current state & input symbol determine output symbol & next state. Can be given as a table, with a row per state and a column per input symbol, where each entry gives output and next state; a labeled directed graph, with a node per state, and an arrow between nodes labeled by input and output per transition. Also known as Deterministic Finite Automaton (DFA). c 2011, T. Verhoeff @ TUE.NL 3/20 Information

FSM to increment a binary number by one Input alphabet = output alphabet = { 0, 1, # } The number is input with its least significant bit first. Output, Next State Input State 0 1 # A (Carry 1) 1, B 0, A #, C B (Carry 0) 0, B 1, B 1#, C C (Done), C, C, C 19 = 10011 2 20 = 10100 2 0 / 0 0 / 1 1 / 1 Carry 1 Carry 0 1 / 1 # / 1# # / # Done How to increment a decimal number by one? Multiply by 3? How to check divisibility by 7? How to add two numbers? Start state c 2011, T. Verhoeff @ TUE.NL 4/20 Information

FSM has limited computational power There exists no FSM 1. to increment an (arbitrary sized) number by one, when the number is offered with its most significant digit first; 2. to reverse the order of a sequence of symbols; 3. to multiply two (arbitrary sized) numbers; 4. to recognize a sequence of properly nested parentheses. Reason: a FSM has finite storage. c 2011, T. Verhoeff @ TUE.NL 5/20 Information

Pushdown Automaton (PDA) Like a FSM, but it also has an unbounded stack. The stack stores a sequence of symbols from the stack s alphabet. Besides the input symbol and current state, also the symbol at the top of the stack determines which transition the PDA takes. Top 1 1 0 0 1 Besides producing output and going to the next state, the action with a transition can also push a symbol onto the top of the stack, or pop the top symbol off the stack. c 2011, T. Verhoeff @ TUE.NL 6/20 Information

PDA has limited computational power A PDA can do everything that a FSM can do, and even more: reverse a sequence of symbols recognize a sequence of properly nested parentheses There exists no PDA to multiply two numbers etc. Reason: a PDA has infinite storage with very limited access c 2011, T. Verhoeff @ TUE.NL 7/20 Information

Turing Machine (TM) Like a FSM, but it also has a two-way infinite read-write tape. The tape is divided into cells that each hold one symbol.... # 1 0 0 1 1... It has a read/write head that is positioned at a specific tape cell. The current state and tape symbol under the R/W head determines the next state. As action, it also can write a symbol at the head position and move the head one cell left/right. c 2011, T. Verhoeff @ TUE.NL 8/20 Information

Turing Machine that finds a 1 among 0s Transition X / Y Z means when reading X, overwrite by Y and move the R/W head in direction Z (R = right; L = left). 0 / # R # / # L look left look right # / # R 1 / 1 0 / # L Done 1 / 1 c 2011, T. Verhoeff @ TUE.NL 9/20 Information

Formal Grammar to Generate a Formal Language Set of terminal symbols Set of non-terminal symbols One non-terminal symbol is designated as start symbol. Set of production rules, each of the form sequence of symbols sequence of symbols Grammar generates a set of sequences of symbols (formal language): 1. Start with the sequence consisting of just the start symbol. 2. Repeatedly replace subsequence t by u for production rule t u. 3. Terminate when the sequence contains terminal symbols only. c 2011, T. Verhoeff @ TUE.NL 10/20 Information

Formal Grammar: Example 1 Terminals: { a, b }. Non-terminals: { S, T }, start symbol S Production rules: 1. S at 2. T b 3. T bs Production example: S 1 at 3 abs 1 abat 3 ababs 1 ababat 2 ababab Generated language = { (ab) n n 1 } c 2011, T. Verhoeff @ TUE.NL 11/20 Information

Formal Grammar: Example 2 Terminals: { a, b }. Non-terminals: { S }, start symbol S Production rules: 1. S ab 2. S asb Production example: S 2 asb 2 aasbb 1 aaabbb Generated language = { a n b n n 1 } c 2011, T. Verhoeff @ TUE.NL 12/20 Information

Formal Grammar: Example 3 Terminals: { a, b, c }. Non-terminals: { S, T }, start symbol S Production rules: 1. S at Sc 2. S abc 3. T a at 4. T b bb Production example: S 1 at Sc 2 at abcc 3 aat bcc 4 aabbcc Generated language = { a n b n c n n 1 } c 2011, T. Verhoeff @ TUE.NL 13/20 Information

Chomsky Hierarchy of Grammars Unrestricted Grammar (Type 0): no restrictions Context-Free Grammar (Type 2): left-hand side of each production rule consist of a single non-terminal symbol Regular Grammar (Type 3): like context-free grammar, but also right-hand side of each production rule is restricted: either empty, or single terminal symbol, or single terminal symbol followed by single non-terminal symbol c 2011, T. Verhoeff @ TUE.NL 14/20 Information

Classification of Example Grammars Grammar 1 is regular Grammar 2 is context-free, and not regular Grammar 3 is unrestricted, and not context-free c 2011, T. Verhoeff @ TUE.NL 15/20 Information

Classification of Languages A language is called... if it can be generated by a... Regular Regular Grammar Context-Free Context-Free Grammar Recursively Enumerable Unrestricted Grammar Note: Different grammars can define the same language. Regular Context-Free Recursively Enumerable Context-free, non-regular grammar can generate regular language Unrestiected non-context-free grammar can generate context-free language c 2011, T. Verhoeff @ TUE.NL 16/20 Information

Classification of Example Languages { (ab) n n 1 } is regular { a n b n n 1 } is context-free, but not regular { a n b n c n n 1 } is recursively enumerable, but not context-free c 2011, T. Verhoeff @ TUE.NL 17/20 Information

Automata as Language Recognizers By marking some states as turned into a recognizer: accepting states an automaton can be An automaton is said to accept a sequence when it terminates in an accepting state after processing that sequence as input. An automaton is said to recognizes a language, if it accepts exactly the sequences of that language (no more, and no less). Finite State Machines recognize Regular Languages. Pushdown Automata recognize Context-Free Languages. Turing Machines recognize Recursively Enumerable Languages. c 2011, T. Verhoeff @ TUE.NL 18/20 Information

Summary There are many different computational mechanisms, such as Finite State Machine (FSM) Pushdown Automaton, with a single stack (PDA) Turing Machine, with a two-way infinite read/write tape (TM) These also differ in computational power. A formal language is a set of sequences of symbols. A formal grammar defines (generates) a formal language: Regular Grammar (recognizable by FSM) Context-Free Grammar (recognizable by PDA) Unrestricted Grammar (recognizable by TM) c 2011, T. Verhoeff @ TUE.NL 19/20 Information

References http://en.wikipedia.org/wiki/finite-state_machine http://en.wikipedia.org/wiki/pushdown_automaton http://en.wikipedia.org/wiki/turing_machine http://en.wikipedia.org/wiki/computability http://en.wikipedia.org/wiki/formal_language http://en.wikipedia.org/wiki/formal_grammar c 2011, T. Verhoeff @ TUE.NL 20/20 Information