Homework 1 Due September 20 M1 M2

Similar documents
Closure under the Regular Operations

Nondeterministic Finite Automata

Lecture 3: Nondeterministic Finite Automata

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

September 11, Second Part of Regular Expressions Equivalence with Finite Aut

COM364 Automata Theory Lecture Note 2 - Nondeterminism

Sri vidya college of engineering and technology

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

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

Chapter Five: Nondeterministic Finite Automata

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

CSE 105 Theory of Computation Professor Jeanne Ferrante

Closure under the Regular Operations

CS 154 Formal Languages and Computability Assignment #2 Solutions

Constructions on Finite Automata

Constructions on Finite Automata

CSCC63 Worksheet Turing Machines

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

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

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism

HKN CS/ECE 374 Midterm 1 Review. Nathan Bleier and Mahir Morshed

CS 154. Finite Automata, Nondeterminism, Regular Expressions

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,

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

CSE 105 Homework 1 Due: Monday October 9, Instructions. should be on each page of the submission.

CSE 355 Homework One Sample Solutions

1 Showing Recognizability

Theory of Computation (I) Yijia Chen Fudan University

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

CMSC 330: Organization of Programming Languages

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

CSE 105 THEORY OF COMPUTATION

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

ACS2: Decidability Decidability

Deterministic Finite Automata (DFAs)

Deterministic Finite Automata (DFAs)

Languages. Non deterministic finite automata with ε transitions. First there was the DFA. Finite Automata. Non-Deterministic Finite Automata (NFA)

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

CS 121, Section 2. Week of September 16, 2013

CSE 105 THEORY OF COMPUTATION

Decidability (intro.)

CSE 105 THEORY OF COMPUTATION

Deterministic Finite Automaton (DFA)

CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1)

TURING MAHINES

Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM)

CPS 220 Theory of Computation REGULAR LANGUAGES

Automata and Formal Languages - CM0081 Non-Deterministic Finite Automata

CPSC 421: Tutorial #1

Extended transition function of a DFA

Finite Automata and Regular languages

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I

CSCI 2200 Foundations of Computer Science Spring 2018 Quiz 3 (May 2, 2018) SOLUTIONS

Outline. Nondetermistic Finite Automata. Transition diagrams. A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F)

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

Further discussion of Turing machines

Fooling Sets and. Lecture 5

Formal Definition of a Finite Automaton. August 26, 2013

CS 154, Lecture 3: DFA NFA, Regular Expressions

Examples of Regular Expressions. Finite Automata vs. Regular Expressions. Example of Using flex. Application

Theory of Computation

Lecture 1: Finite State Automaton

Chapter Two: Finite Automata

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

Theory of Computation Lecture 1. Dr. Nahla Belal

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

} Some languages are Turing-decidable A Turing Machine will halt on all inputs (either accepting or rejecting). No infinite loops.

Nondeterministic Finite Automata. Nondeterminism Subset Construction

September 7, Formal Definition of a Nondeterministic Finite Automaton

Lecture 4 Nondeterministic Finite Accepters

jflap demo Regular expressions Pumping lemma Turing Machines Sections 12.4 and 12.5 in the text

Deterministic Finite Automata (DFAs)

Finite Automata. Finite Automata

ECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam

CS 154. Finite Automata vs Regular Expressions, Non-Regular Languages

Chapter 6: NFA Applications

10. The GNFA method is used to show that

Decidability (What, stuff is unsolvable?)

Computational Models Lecture 2 1

Theory of Computation (II) Yijia Chen Fudan University

Equivalence of DFAs and NFAs

Chap. 1.2 NonDeterministic Finite Automata (NFA)

Theory of Computation (IX) Yijia Chen Fudan University

UNIT-VIII COMPUTABILITY THEORY

Decidable and undecidable languages

Computational Models Lecture 2 1

More Properties of Regular Languages

Great Theoretical Ideas in Computer Science. Lecture 4: Deterministic Finite Automaton (DFA), Part 2

Part I: Definitions and Properties

Deterministic finite Automata

Theory of Computation (IV) Yijia Chen Fudan University

Introduction to Turing Machines. Reading: Chapters 8 & 9

Computational Models #1

Computational Models - Lecture 1 1

Non-deterministic Finite Automata (NFAs)

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

Intro to Theory of Computation

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

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

False. They are the same language.

Transcription:

Homework 1 Due September 20 1. Consider the state diagrams for two DFAs, M1 and M2 M1 M2 a. Give the formal descriptions of the two machines above specifically, specify the elements of the 5-tuple (Q, Σ, δ, q 0, F). For each machine Q =??, Σ =??, δ =??, q 0 =??, F =?? M1 Q={q1, q2, q3} Σ={x,y} q0: q1 F={q1} M2 Q={q1, q2} Σ={x,y} q0: q1 F={q2} q1 q2 q3 x q2 q1 q3 y q1 q3 q3 q1 q2 x q1 q1 y q2 q2 b. What sequence of states does the machine go through on input yyyx M1: q1, q1, q1, q1, q2 M2: q1, q2, q2, q2, q1 c. Are there an infinite number of strings accepted by the machine? M1: yes M2: yes d. Does the machine accept the string xxyyxx? M1: yes M2: no

2.The formal description of a DFA M3 is ({q 1, q 2, q 3, q 4, q 5 }, {0,1}, δ, q 2, {q 1, q 4 }) where δ is provided by the following table 0 1 Give the state diagram for this machine. q1 q3 q4 q2 q1 q5 q3 q2 q2 q4 q2 q5 q5 q1 q4 3. Not all context free grammars define regular languages. However, the following two DO define regular languages. For each grammar below, (a) describe the corresponding language (optimally in 10 words or fewer) and (b) draw the corresponding finite state machine. G1 -> A B A -> xa z B -> y w L={x n z, n>=0 or y or w}

G2 -> CD C -> nnc nn D -> pp L={(nn) k pp, k>0 } 3. Give state diagrams of DFAs recognizing the following languages. In all parts, Σ ={0,1}. a. The empty set b. {w the digits interpreted in binary are evaluated to 8 or higher} c. {w w has an even number of digits} d. {w the digits together sum to a number less than 3 }

4. a. Show that if M is a DFA that recognizes language B, swapping the accept and nonaccept states in M yields a new DFA recognizing the complement of B. Conclude that the class of regular languages is closed under complement. The complement of B (B ) is the language containing every string not in B. Each string not in B will bring you to a state in M that is NOT an accept state. In the machine M, each of these states ARE accept states. Furthermore, every string in B will bring you to an accept state in M; and will bring you to a NON-accept state in M. Thus, M recognizes B it accepts every string in B. Thus B is regular, since there exists a DFA that recognizes it. Therefore, regular languages are closed under complement. b. Show by giving an example that if M is an NFA that recognizes language C, swapping the accept and nonaccept states in M doesn t necessarily yield a new NFA that recognizes the complement of C. Is the class of languages recognized by NFAs closed under complement? Explain your answer. The string y is rejected by this NFA and bye the complement of this NFA The class of languages recognized by NFAs is closed under complement because every language recognized by an NFA is recognized by a DFA, so it is regular. The complement of each regular language is also regular, which means an NFA can be defined to recognize it. 5. Consider the alphabet Σ={0,1,2}. Given this alphabet, let Ak={w w is any sequence of numbers such that the number at the k th position is larger than the number at all previous positions}. For example, A3 includes 0010, 0011, 0012, 1120, 1022; A4 includes 01021, 11120, 00012, 110221. Show that for each k>1, the language Ak is regular. Proof by construction. For a given language Ak, we can define a DFA that recognizes this language. The DFA will contain 2k+3 states, q0,0, qreject, qaccept, qj,0 and qj,1. qj,0 represents that j characters have been entered already, and the largest character entered has been 0. qj,1

represents that j characters have been entered already and the largest character entered has been 1. The transition rules are: If 1<j<k: δ(q j 1,0, 0) = q j,0, δ(q j 1,0, 1) = q j,1, δ(q j 1,0, 2) = q reject δ(q j 1,1, 0) = q j,1, δ(q j 1,1, 1) = q j,1, δ(q j 1,1, 2) = q reject If j==k δ(q j 1,0, 0) = q reject, δ(q j 1,0, 1) = q accept, δ(q j 1,0, 2) = q accept δ(q j 1,1, 0) = q reject, δ(q j 1,1, 1) = q reject, δ(q j 1,1, 2) = q accept qreject transitions only to itself The start state is q0,0 This DFA will recognize language Ak. Because a DFA exists for each Ak, Ak must be regular. 6. Give state diagrams of NFAs with the specified number of states recognizing each of the following languages. In all parts, Σ={c,d} a. Accepts {w w has exactly 1 d s and an even number of c s} using four states. (Example accept strings: ccd, cdccc, d } b. Accepts {w w ends in cdc} using four states. (Example accept strings: cccdc, ddcdcc)

7. Use Theorem 1.45 in the text (also given in class) to provide an NFA state diagram for a machine that recognize the union of the languages L1 and L2 below. Note Σ = {0,1}. L1 = {w every even position in w has 1} L2 = {w w has 3 or more characters, and the second symbol is 1} 8. Use Theorem 1.47 in the text (also given in class) to provide an NFA state diagram for a machine that recognizes the concatenation of the languages in 3c and 3d. 9. Convert the following NFA to a DFA. You may wish to use the lecture/class method used to prove NFA-DFA equivalence.