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

Similar documents
Nondeterministic Finite Automata

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

Sri vidya college of engineering and technology

Properties of Context-Free Languages. Closure Properties Decision Properties

Theory of Computation

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

CS 154. Finite Automata, Nondeterminism, Regular Expressions

DM17. Beregnelighed. Jacob Aae Mikkelsen

Fooling Sets and. Lecture 5

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

CS 455/555: Finite automata

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

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

COM364 Automata Theory Lecture Note 2 - Nondeterminism

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

NPDA, CFG equivalence

Theory of Computation (I) Yijia Chen Fudan University

CS 154, Lecture 3: DFA NFA, Regular Expressions

The Pumping Lemma and Closure Properties

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

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 9 : Myhill-Nerode Theorem and applications

CPSC 421: Tutorial #1

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

Ogden s Lemma for CFLs

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 5 : DFA minimization

What we have done so far

Lecture 3: Nondeterministic Finite Automata

3515ICT: Theory of Computation. Regular languages

1. Induction on Strings

Computational Models - Lecture 4

Closure under the Regular Operations

CSE 105 THEORY OF COMPUTATION

Miscellaneous. Closure Properties Decision Properties

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

Finite Automata Part Two

Languages. A language is a set of strings. String: A sequence of letters. Examples: cat, dog, house, Defined over an alphabet:

Obtaining the syntactic monoid via duality

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

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

Computational Models: Class 3

Computational Models - Lecture 5 1

Non-deterministic Finite Automata (NFAs)

Chapter Five: Nondeterministic Finite Automata

Unit 6. Non Regular Languages The Pumping Lemma. Reading: Sipser, chapter 1

CS 154 Introduction to Automata and Complexity Theory

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

Advanced Automata Theory 2 Finite Automata

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

UNIT-VIII COMPUTABILITY THEORY

Theory of Computation (IX) Yijia Chen Fudan University

CMSC 330: Organization of Programming Languages

CPS 220 Theory of Computation REGULAR LANGUAGES

Regular Expressions and Language Properties

Properties of Regular Languages (2015/10/15)

CSC236 Week 10. Larry Zhang

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,

Theory of computation: initial remarks (Chapter 11)

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

Deterministic Finite Automaton (DFA)

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

Name: Student ID: Instructions:

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

Finite Automata and Regular Languages

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

Computational Models #1

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

Finite Automata and Regular languages

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen

Equivalence of DFAs and NFAs

V Honors Theory of Computation

Closure under the Regular Operations

Nondeterministic Finite Automata and Regular Expressions

Finite-state Machines: Theory and Applications

Inf2A: Converting from NFAs to DFAs and Closure Properties

Theory of Languages and Automata

Computational Models - Lecture 1 1

Closure Properties of Context-Free Languages. Foundations of Computer Science Theory

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 10 : Context-Free Grammars

We define the multi-step transition function T : S Σ S as follows. 1. For any s S, T (s,λ) = s. 2. For any s S, x Σ and a Σ,

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

Theory of Computation (II) Yijia Chen Fudan University

COMP4141 Theory of Computation

Classes and conversions

Computational Models - Lecture 3

CSE 105 THEORY OF COMPUTATION

Intro to Theory of Computation

Finite Automata. BİL405 - Automata Theory and Formal Languages 1

Regular Languages. Problem Characterize those Languages recognized by Finite Automata.

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

Properties of Regular Languages. BBM Automata Theory and Formal Languages 1

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

Finite State Automata

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

Theory of computation: initial remarks (Chapter 11)

Theory of Computation 4 Non-Deterministic Finite Automata

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I

Computer Sciences Department

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

Transcription:

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

For the most part, all about strings! String induction (to some extent) Regular languages Regular expressions (regexps) Deterministic finite automata (DFAs) Nondeterministic finite automata (NFAs) Context-free languages Context-free grammars (CFGs)

Some definitions - regular languages One of the following (where A and B are both regular languages): w (a string) A* A B AB A B A - B A R [Inverse] homomorphisms of A

Some definitions - regular languages (cont.) String homomorphism: Given a mapping, f, from an alphabet to a language (mapping characters to strings), we create a string homomorphism, F, by mapping every character in a string through f Example: f(0) = abc, f(1) = 123, then F(101) = 123abc123 A string homomorphism acting on a regular (context-free) language results in a regular (context-free) language An inverse homomorphism acting on a regular (context-free) language results in a regular (context-free) language

Some definitions - DFA Formally defined by Σ (alphabet), Q (states), δ (transitions), s (start), A (acceptors) Σ must necessarily be a finite alphabet Q represented by circles δ : Q x Σ Q represented by arrows between circles s Q represented by source-less arrow entering exactly one state in DFA A Q represented by doubly-circled states anywhere in the diagram Accepts/recognizes language L iff it accepts all strings in L and rejects all strings not in L

Some definitions - NFA Formally defined by Σ (alphabet), Q (states), δ (transitions), s (start), A (acceptors) Σ must necessarily be a finite alphabet Q represented by circles δ : Q x Σ {ε} Q represented by arrows between circles s Q represented by source-less arrow entering exactly one state in NFA A Q represented by doubly-circled states anywhere in the diagram Accepts/recognizes language L iff it accepts all strings in L and rejects all strings not in L DFAs NFAs, DFAs regexps, regexps NFAs all possible How best to do these transformations?

A Useful Tool: Myhill-Nerode theorem and Fooling Sets We want to prove a language, L, is not regular. L is not regular iff there is no DFA which decides L. Approach: If we can show that any automaton which decides L has infinitely many states, then we have proven that L is not regular. Tool: Fooling set Let x, y be strings such that there exists a suffix z such that (xz L and yz L) OR (xz L and yz L) For any potential DFA which decides L, xz and yz terminate in different states (one accepting, one rejecting) Thus for any potential DFA which decides L, x and y must terminate in different states Thus there are at least two states in any potential DFA Now we must show that there exist infinitely many such prefixes, all of which have distinguishing suffixes for one another

Another Useful Tool: Arden s Theorem It is often easier to come up with a DFA for a regular language than an RE. We can use the following theorem to help us convert a DFA into an equivalent RE. If P and Q are two RE s over the same alphabet, and if L(P) does not contain the empty string, then the recursively defined equation R = Q + RP has the unique solution R = QP*

Some definitions - CFG <Whereas DFAs/NFAs decide certain languages, CFGs generate them> Formally defined by Σ (terminals), Γ (non-terminals), R (production rules), S (start) Closed under union? Closed under intersection? Closed under concatenation? Closed under set difference? Closed under Kleene star? Design techniques...

Prove that scramble(scramble(x)) = x strings x.

Convert this NFA to a DFA and a regexp:

Construct a CFG for the following language: L = {x {0,1}* such that x 2 and the symbol at position i is the same as that at i+2}

Construct CFGs for the following languages: L = {a n b m c m d 2n n 0, m>0} L = {0 i 1 j 2 k i j or j k}

Consider a language L {0,1}*. What s definitely true about this language? Is L non-empty? Is L infinite? Does L contain the empty string? Is it the case that L is regular if L is the union of two regular languages? Is it the case that L is context-free if L is the union of two regular languages? Is it the case that L is context-free if L is finite? Is it the case that L is accepted by a DFA iff L is accepted by a NFA? Is it the case that L is accepted by a 42-state DFA iff L is accepted by a 42-state NFA?

The language {0 w w L} is regular for every regular language L. The language {0 w w L} is non-regular for every non-regular language L.

For every language L {0,1}*, if L contains all but a finite number of strings in 0*, then L is regular.

If L is regular and L L is not regular, then L is not regular.

The specific language {w {0,1}* w represents an integer divisible by 374 in ternary} is regular.

For all regular languages L, each equivalence class of L is a regular language.

Let L = {0 i 1 j 0 k 2i = k or i = 2k} 1. Prove L is not regular 2. Describe a CFG for L