Chapter 6 Languages: finite state machines

Slides:



Advertisements
Similar presentations
You have been given a mission and a code. Use the code to complete the mission and you will save the world from obliteration…
Advertisements

Mathematical Preliminaries
&& Department of nskinfo-i educationwww.nsksofttch.com CS2303-THEORY OF COMPUTATION uChapter: Closure.
Properties of Regular Languages
Chapter 1 The Study of Body Function Image PowerPoint
1 Copyright © 2010, Elsevier Inc. All rights Reserved Fig 2.1 Chapter 2.
Properties Use, share, or modify this drill on mathematic properties. There is too much material for a single class, so you’ll have to select for your.
Math Vocabulary Review Part 1.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
Properties of Real Numbers CommutativeAssociativeDistributive Identity + × Inverse + ×
ALGEBRAIC EXPRESSIONS
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
MULTIPLYING MONOMIALS TIMES POLYNOMIALS (DISTRIBUTIVE PROPERTY)
FACTORING Think Distributive property backwards Work down, Show all steps ax + ay = a(x + y)
Addition Facts
Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Languages: Finite State Machines Chapter 6 problemsstrings (languages) machines answers.
Turing Machines.
ABC Technology Project
Columbus State Community College
Chapter 2 Section 3.
Factor P 16 8(8-5ab) 4(d² + 4) 3rs(2r – s) 15cd(1 + 2cd) 8(4a² + 3b²)
Squares and Square Root WALK. Solve each problem REVIEW:
Kleene's Theorem We have defined the regular languages, using regular expressions, which are convenient to write down and use. We have also defined the.
Chapter 5 Test Review Sections 5-1 through 5-4.
GG Consulting, LLC I-SUITE. Source: TEA SHARS Frequently asked questions 2.
What You Should Learn • Represent and classify real numbers.
Addition 1’s to 20.
25 seconds left…...
Copyright © Cengage Learning. All rights reserved.
Introduction to Computability Theory
Finite-state Recognizers
Week 1.
Formal Language, chapter 10, slide 1Copyright © 2007 by Adam Webber Chapter Ten: Grammars.
We will resume in: 25 Minutes.
Chapter Eleven: Non-Regular Languages
Introduction to Computability Theory
Chapter 4 Systems of Linear Equations; Matrices
Finite-State Machines with No Output Ying Lu
Language and Automata Theory
Finite State Machines Finite state machines with output
Chapter 5 Relations and Functions
Equivalence Relations
Discrete Structures Chapter 6: Set Theory
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
Deterministic Finite Automata (DFA)
YES-NO machines Finite State Automata as language recognizers.
Chapter 7 Relations : the second time around
1 Languages and Finite Automata or how to talk to machines...
Topics Automata Theory Grammars and Languages Complexities
Lecture 1 String and Language. String string is a finite sequence of symbols. For example, string ( s, t, r, i, n, g) CS4384 ( C, S, 4, 3, 8) (1,
Relations Chapter 9.
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
Chapter 2 Languages.
CSC312 Automata Theory Lecture # 2 Languages.
Theory of Computation, Feodor F. Dragan, Kent State University 1 Regular expressions: definition An algebraic equivalent to finite automata. We can build.
1 Chapter 1 Introduction to the Theory of Computation.
CHAPTER 1 Regular Languages
Strings and Languages CS 130: Theory of Computation HMU textbook, Chapter 1 (Sec 1.5)
Chapter 4 Pumping Lemma Properties of Regular Languages Decidable questions on Regular Languages.
Chapter 3 Regular Expressions, Nondeterminism, and Kleene’s Theorem Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
Finite State Machines 1.Finite state machines with output 2.Finite state machines with no output 3.DFA 4.NDFA.
Modeling Computation: Finite State Machines without Output
UNIT - I Formal Language and Regular Expressions: Languages Definition regular expressions Regular sets identity rules. Finite Automata: DFA NFA NFA with.
Strings and Languages Denning, Section 2.7. Alphabet An alphabet V is a finite nonempty set of symbols. Each symbol is a non- divisible or atomic object.
1 Languages: Finite State Machines Chapter 6 problemsstrings (languages) machines answers.
Deterministic Finite-State Machine (or Deterministic Finite Automaton) A DFA is a 5-tuple, (S, Σ, T, s, A), consisting of: S: a finite set of states Σ:
Jaya Krishna, M.Tech, Assistant Professor
Presentation transcript:

Chapter 6 Languages: finite state machines Yen-Liang Chen Dept of Information Management National Central University

6.1 Language: the set theory of strings We use  to denote a nonempty finite set of symbols, collectively called an alphabet. Definition 6.1. If  is an alphabet and nZ+, we define the power of  as follows: (1) 1=; and (2) n+1={xy x, yn}, where xy denotes the juxtaposition of x and y. Ex 6.1

Empty string and sentences Definition 6.2. 0={}, where  denotes the empty string. (1)Although , ; (2) {} since ; (3) {} because {}=1. We refer to the elements of + or * as strings, words, sentences Ex 6.2

Equal and concatenation Definition 6.4. Two strings w1=x1x2 …xn+ and w2=y1y2…ym+ are equal, written as w1=w2, if n=m and xi=yi for 1in. Definition 6.5. Let w=x1x2 …xn +. The length of w, denoted as w, is n. Definition 6.6. Let x=x1x2 …xn+ and y=y1y2…ym+ The concatenation of x and y, xy, is x1x2…xny1y2…ym. The concatenation of x and  is x=x. The concatenation of  and x is x=x. Finally, the concatenation of  and  is . Since x=x=x, the element  is the identity for the operation of concatenation.

Power, prefix and postfix Definition 6.7. The power of x is defined as: x0=, x1=x, and xn+1=x xn. Ex 6.3 Definition 6.8. If x, y* and w=xy, then x is a prefix of w, and if y, then x is a proper prefix of w. Similarly, y is a suffix of w; it is a proper suffix when x.

Examples Ex 6.4: Consider the string w=abbcc. What are the prefixes, proper prefixes, suffixes and proper suffixes of w? Ex 6.6, If w=w1w2=w3w4, then (1) w1 is a prefix of w3, or w3 is a prefix of w1; and (2) w2 is a suffix of w4, or w4 is a suffix of w2. Let w=(abb)(cc)=(a)(bbcc)

Substring and language Definition 6.9. If x, y, z* and w=xyz, then y is called as a substring of w. When at least one of x and z is different from , we call y a proper substring. Ex 6.7 Definition 6.10. For a given , any subset of * is called a language over . This includes , the empty language. Ex 6.8, Ex 6.9.

the concatenation of languages Definition 6.11. For languages A , B in * , the concatenation of A and B, denoted AB, is {abaA, bB}. Note that ABBA and ABBA. Ex 6.10 Theorem 6.1. For A, B, C *, we have (a) A{}={}A=A; (b) (AB)C=A(BC); (c) A(BC)=ABAC; (d) (BC)A=BCCA; (e) A(BC)ABAC; (f) (BC)A BACA. x, xy in A; yz in B; z in C xyz in ABAC But xyz not in A(BC)

Closure Ex 6.11. A={x}, then (1) A0={}; (2) An={xn}; (3) A+={xn n1}; (4)A*={xn n0} Ex 6.13. A={, x, x3, x4,…} and B={xn n0}. Then A2=B2 but AB.

Examples Ex 6.12 A={xx, xy, yx, yy}. A* is the language of all strings w in * where the length of w is even. A={xx, xy, yx, yy} and B={x, y}. What is BA*? What is {x}{x, y}*? What is {x}{x, y}+? What is {x, y}*{yy}? What is {x}*{y}*? Why {x}*{y}* {x, y}*?

Properties Lemma 6.1. Let A, B*. If AB, then for all nZ+, AnBn. Theorem 6.2. For A, B *, we have (a) AAB*, (b) AB*A; (c) AB  A*B*, (d) AB  A+B+, (e) AA*=A*A=A+, (f) A*A*=A*=(A*)*=(A*)+=(A+)*; (g) (AB)*=(A*B*)*=(A*B*)*.

Examples Ex 6.14. Let ={0, 1} and A*, where each word in A contains exactly one occurrence of the symbol 0. Then the language can be defined as: (a) 0A, (b) 1x and x1 is in A, if x is in A. Ex 6.15. Let ={(, )} and A*, where A contains those nonempty strings of parentheses that are grammatically correct for algebraic expressions. Then the language can be defined as: (a) ( ) is in A; (b) For all x, y in A, we have (1) xyA, and (2) (x)A.

The reverse of string Ex 6.16 The reverse of x= x1x2 …xn is xR= xn xn-1…x1. We can define it recursively: (a) R=; and (2) if x=zyn+1, where z in  and y in n, then xR=(zy)R=(yR)z. Based on this definition, we can show that for x1, x2*, we have (x1x2)R=x2Rx1R.

6.2 Finite state machine: a first course The machine can be in only one of finitely many sates at a given time. The machine will accept as input only a finite number of symbols, referred to as the input alphabet. An output and a next state are determined by each combination of inputs and internal states. The machine operates in a deterministic manner.

Finite state machine A finite state machine is a five-tuple M=(S, IA, OA, v, w), where S = the set of internal states fro M; IA is the input alphabet for M; OA is the output alphabet; v: SIAS; w: SIA OA

Ex 6. 17

Ex 6.18

Ex 6.19

6.3 Finite state machine: a second encounter Ex 6.20. We want to construct a machine that recognizes each occurrence of the sequence 111 as it is encountered in an input string x*. This machine is a recognizer of the language A= {0, 1}*{111}. For example, if x=1110101111, then the output is 0010000011.

Ex 6.21. We want to recognize the occurrence of 111 that ends in a position that is a multiple of 3.

Ex 6.22. We want to recognize the occurrence of 0101 in an input string. Figure 6.12(a). We want to recognize the occurrence of 0101 in an input string but its start position is a multiple of four. Figure 6.12(b).

Ex 6.23. It is impossible to have a finite state machine to represent A={0i1iiZ+}. Suppose we can and let S=n1. Table 6.8 shows the state transition for string 0n+11n+1. Since S=n, there must have two states si and sj , where i< j, such that si=sj. Removing the loop from si+1 to sj, we have the table shown in Figure 6.10. This new sequence means the machine can accept the string x=0(n+1)-(j-i)1n+1. This is a contradiction.

Ex 6.24 One-unit delay machine. If x= x1x2…xn-1xn, then the output will be 0 x1x2…xn-1.

Ex 6.25. Two-unit delay machine. If x= x1x2…xn-1xn, then the output will be 0 0x1x2…xn-2.

Definition 6.14. For si, sjS, sj is reachable from si if si=sj or if there is an input string x such v(si, x)=sj. A state s is transient if v(s, x)=s for xIA* implies x=. Once leaving, never go back to itself. A state s is sink if v(s, x)=s for xIA*. A submachine of M. Let S1S and IA1IA. If v1=vS1IA1:S1IA1S has its range within S1. A machine is strongly connected if for any states si, sjS, sj is reachable from si.

Transfer sequence For a machine M, let si, sjS. An input string x is called a transfer sequence from si to sj if (a) v(si, x)=sj, (b) for any y with v(si, y)=sjyx.