Computabilty Computability Finite State Machine. Regular Languages. Homework: Finish Craps. Next Week: On your own: videos +

Slides:



Advertisements
Similar presentations
Recognising Languages We will tackle the problem of defining languages by considering how we could recognise them. Problem: Is there a method of recognising.
Advertisements

Finite-State Machines with No Output Ying Lu
Lecture 6 Nondeterministic Finite Automata (NFA)
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2005.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
YES-NO machines Finite State Automata as language recognizers.
Chapter Two: Finite Automata
1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.
Finite Automata Great Theoretical Ideas In Computer Science Anupam Gupta Danny Sleator CS Fall 2010 Lecture 20Oct 28, 2010Carnegie Mellon University.
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
CS5371 Theory of Computation
Fall 2006Costas Busch - RPI1 Deterministic Finite Automata And Regular Languages.
1 Finite Automata. 2 Finite Automaton Input “Accept” or “Reject” String Finite Automaton Output.
1 Languages and Finite Automata or how to talk to machines...
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 1 Regular Languages Contents Finite Automata (FA or DFA) definitions, examples,
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Nondeterminism.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
Theory of Computing Lecture 22 MAS 714 Hartmut Klauck.
Finite Automata Costas Busch - RPI.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
Finite State Machines Data Structures and Algorithms for Information Processing 1.
CSE 311: Foundations of Computing Fall 2014 Lecture 23: State Minimization, NFAs.
CPSC 388 – Compiler Design and Construction Scanners – Finite State Automata.
Finite-State Machines with No Output Longin Jan Latecki Temple University Based on Slides by Elsa L Gunter, NJIT, and by Costas Busch Costas Busch.
Finite-State Machines with No Output
Lecture 23: Finite State Machines with no Outputs Acceptors & Recognizers.
REGULAR LANGUAGES.
1 Unit 1: Automata Theory and Formal Languages Readings 1, 2.2, 2.3.
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
1 111 Computability, etc. Midterm review. Turing machines. Finite state machines. Push down automata. Homework: FSA, PDA, TM problems (can work in teams)
Automating Construction of Lexers. Example in javacc TOKEN: { ( | | "_")* > | ( )* > | } SKIP: { " " | "\n" | "\t" } --> get automatically generated code.
Lecture 1 Computation and Languages CS311 Fall 2012.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2006.
1 Course Overview PART I: overview material 1Introduction 2Language processors (tombstone diagrams, bootstrapping) 3Architecture of a compiler PART II:
Decidable Questions About Regular languages 1)Membership problem: “Given a specification of known type and a string w, is w in the language specified?”
Computability Review homework. Regular Operations. Nondeterministic machines. NFSM = FSM Homework: By hand, build FSM version of specific NFSM. Try to.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
Kleene’s Theorem Group No. 3 Presented To Mam Amina Presented By Roll No Roll No Roll No Roll No Group No. 3 Presented To Mam.
Overview of Previous Lesson(s) Over View  Symbol tables are data structures that are used by compilers to hold information about source-program constructs.
Formal Definition of Computation Let M = (Q, ∑, δ, q 0, F) be a finite automaton and let w = w 1 w w n be a string where each wi is a member of the.
CMSC 330: Organization of Programming Languages Theory of Regular Expressions Finite Automata.
SM2220 – Class 06 Finite Automata. SM2220 – Class 06 Topic in theoretical computing. A subset of computation machines. Closely related to formal language.
Finite State Machines 1.Finite state machines with output 2.Finite state machines with no output 3.DFA 4.NDFA.
UNIT - I Formal Language and Regular Expressions: Languages Definition regular expressions Regular sets identity rules. Finite Automata: DFA NFA NFA with.
Computability Review homework. Video. Variations. Definitions. Enumerators. Hilbert's Problem. Algorithms. Summary Homework: Give formal definition of.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2007.
Overview of Previous Lesson(s) Over View  A token is a pair consisting of a token name and an optional attribute value.  A pattern is a description.
CS 404Ahmed Ezzat 1 CS 404 Introduction to Compiler Design Lecture 1 Ahmed Ezzat.
LECTURE 5 Scanning. SYNTAX ANALYSIS We know from our previous lectures that the process of verifying the syntax of the program is performed in two stages:
Lecture 2 Compiler Design Lexical Analysis By lecturer Noor Dhia
Lecture #2 Advanced Theory of Computation. Languages & Grammar Before discussing languages & grammar let us deal with some related issues. Alphabet: is.
Costas Busch - LSU1 Deterministic Finite Automata And Regular Languages.
Theory of Computation Automata Theory Dr. Ayman Srour.
Fall 2004COMP 3351 Finite Automata. Fall 2004COMP 3352 Finite Automaton Input String Output String Finite Automaton.
WELCOME TO A JOURNEY TO CS419 Dr. Hussien Sharaf Dr. Mohammad Nassef Department of Computer Science, Faculty of Computers and Information, Cairo University.
Finite automate.
Languages.
CIS Automata and Formal Languages – Pei Wang
Chapter 2 FINITE AUTOMATA.
Some slides by Elsa L Gunter, NJIT, and by Costas Busch
Deterministic Finite Automata And Regular Languages Prof. Busch - LSU.
COSC 3340: Introduction to Theory of Computation
Finite Automata.
4b Lexical analysis Finite Automata
Computability Catch up last lecture. Turing machines. Variations
Lecture 5 Scanning.
LECTURE # 07.
What is it? The term "Automata" is derived from the Greek word "αὐτόματα" which means "self-acting". An automaton (Automata in plural) is an abstract self-propelled.
Presentation transcript:

Computabilty Computability Finite State Machine. Regular Languages. Homework: Finish Craps. Next Week: On your own: videos + classwork/homework on FSMs

Computabilty Overview Define different types of machines. –abstract machines Machines are fed (my term) strings in a specified alphabet. Machines scan the strings and say yes or no (accept or reject) Each machine accepts strings in a certain pattern. We call the set of strings in that pattern a language.

Computabilty Overview Repeat: a language is a set of strings. This set may be finite or infinite.

Computabilty Example The [written, formal] English language is an infinite set of sentences made up of valid words, spaces and punctuation. Why infinite?

Computabilty Example The set of all legal (acceptable, no syntax errors) Processing programs is a language. It also is infinite.

Computabilty Overview, cont. Each machine  a language Each type of machine  set of languages Presumably, more powerful machines (machines with more capability) could accept a larger set of languages. It will turn out that some changes are less powerful than you would think…

Computabilty Aside When we get to Turing Machines, we also will talk about machines computing functions: –get input, produce output: an answer. For now, the input is a string of symbols in a fixed alphabet. The output is yes or no –or some other indication of yes, this is a string in the language; or no it is not.

Computabilty Alphabets 2 symbols 0 and 1 or abcdefghijklmnopqrstuvwxyz or subset of the alphabet, say {a, b, c} or all symbols used in languages such as JavaScript, Processing, etc. It will turn out that alphabets can be represented by strings of 0 and 1…

Computabilty Finite State Machine also called finite state automaton. Plural is automata. A FSM has a finite number of states! –express by writing out s0, s1, s2, etc. or drawing circles. –One state is specified as the initial state. –One or MORE states are specified as Final or Accepting states.

Computabilty FSM, cont. For each state, there is a state transition table: for each symbol in the alphabet, there is a switch to another state or to stay in the same state. Draw this by a graph: representing the states by nodes and the edges by the state transition table.

Computabilty Exercise Draw the graph –Initial state s0: 0 go to s1, 1 go to s2 –s1: 0 go to s1, 1 go to s3 –s2: 0 go to s3, 1 go to s2 –s3: 0 go to s3, 1 go to s3 –s1 and s2 are accepting states. What strings does it accept?

Computabilty Problem Let's design a FSM that will accept strings over {0,1} of length 3 and nothing else.

Computabilty Approach Take problem and think about different conditions that could arise and you need to keep track of… These will be the different states, or at least a first guess at the different states. For the "length 3" problem –start –length 1 –length 2 –length 3 –more than length 3

Computabilty Problem Alphabet {a, b, c, d}. Language is all strings with at least one instance inside the string of abc. What are possible states?

Computabilty Start of approach for abc States start a ab abc a and then something not a b. But maybe that can put us back at the start. ab and then something not a c. But maybe that can put us back at the start abc and anything else. But that can just keep us at the abc stage.

Computabilty Finish the problem For the language containing all strings that have at least one abc inside. States: –start –a –ab –abc What are the accepting state(s)? What are the edges?

Computabilty Your turn Each student draw a FSM over {0,1} Find a partner and try each other's FSM on sample strings.

Computabilty Tricky but important The empty string is a string! Some languages may contain it, some may not. Design a FSM that accepts the empty string and only the empty string.

Computabilty Approach What are the states? starting state state after any symbol scanned. What are edges? What is the accepting state?

Computabilty Looking ahead The empty string, sometimes written kind of like the Euro € Extra credit opportunity for anyone who finds a better symbol… Some languages include the empty string and some don't. For the empty string to be in the language the starting state must be an accepting state!

Computabilty Caution Empty set is not the empty string. The set consisting of one string, the empty string, is NOT empty. The set with no members, that is, consists of no strings, is a regular language. What is a FSM for this language?

Computabilty Definition A language is called a regular language if there is a finite state automaton that accepts it. –feed in a string in the language L and the FSM ends in an accepting state. –feed in a string that is NOT in the language and the FSM ends in a non-accepting state. You will need to check both things.

Computabilty Preview We will develop an alternative definition of regular languages and show they are equivalent. – Any language defined by regular expressions (to be defined later) is a regular language (can be accepted by a FSM). We will show a way of proving that certain languages are not regular. We will prove that no FSM exists that would accept that language. –It is possible (sometimes) to prove a negative…

Computabilty Preview: Regular operations Suppose we have 2 languages A and B –remember these are sets. Consider the following languages –A union B: all strings in either A or B –A concatenate B: all strings made up of a string in A followed by a string in B. Note: may include all of A and/or all of B depending on whether or not the empty string is in A or in B –A star: finite strings in A, concatenated together

Computabilty Preview We can (and will) prove that if A and B are regular languages, then so are A union B, AB, and A* From the machine M that accepts A and N that accepts B, build/design/specify machines for those 3 languages.

Computabilty Game of crap Some of you remember from Programming Games The dice game (craps) had 2 states. –first turn –follow-up turn You start the game in the state of being a first turn. If you roll, –7, 11, you win and you stay in 'first turn'. –2, 3, 12, you lose and you stay in 'first turn' –Otherwise, you go to follow-up (remembering the value of your roll as 'the point'. Followup: –point: you win. (Go back to first turn.) –7: you lose. (Go back to first turn.)

Computabilty Exercise Construct a FSM-like machine for the craps game. –Finishing states labeled win –Finishing states labeled lose

Computabilty Next class Monday is Labor Day Thursday, I will be away for Rosh Hashanah. I have identified a video lecture series with 4 ten- minute segments and created questions. You should come to class and view and do as a group if you are not observing the holiday. –input using moodle Q&A forums. People observing the holiday should do on their own over BEFORE the next class on Monday, 9/13.