C4.1 Closure Properties

Similar documents
C2.1 Regular Grammars

C2.1 Regular Grammars

C6.2 Push-Down Automata

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

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

Properties of Context-Free Languages. Closure Properties Decision Properties

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

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,

CSE 105 THEORY OF COMPUTATION

CS 154. Finite Automata, Nondeterminism, Regular Expressions

Theory of Computer Science

CS 455/555: Finite automata

Equivalence of DFAs and NFAs

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Intro to Theory of Computation

CSE 105 THEORY OF COMPUTATION

DM17. Beregnelighed. Jacob Aae Mikkelsen

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

Finite Universes. L is a fixed-length language if it has length n for some

Computational Models - Lecture 4

Computational Models - Lecture 5 1

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

CSE 105 THEORY OF COMPUTATION

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

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

Finite Automata Part Two

CS 275 Automata and Formal Language Theory

CMPSCI 250: Introduction to Computation. Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013

Finite Automata and Regular languages

CSE 105 THEORY OF COMPUTATION

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

3515ICT: Theory of Computation. Regular languages

Sri vidya college of engineering and technology

Foundations of Informatics: a Bridging Course

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

Theory of Computer Science

Final exam study sheet for CS3719 Turing machines and decidability.

Theory of Computer Science. Theory of Computer Science. D8.1 Other Halting Problem Variants. D8.2 Rice s Theorem

CSE 105 THEORY OF COMPUTATION

Closure Properties of Regular Languages

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

V Honors Theory of Computation

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

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

CS 301. Lecture 17 Church Turing thesis. Stephen Checkoway. March 19, 2018

Closure under the Regular Operations

C1.1 Introduction. Theory of Computer Science. Theory of Computer Science. C1.1 Introduction. C1.2 Alphabets and Formal Languages. C1.

Regular Expressions and Language Properties

CSE 105 THEORY OF COMPUTATION

CS 154, Lecture 3: DFA NFA, Regular Expressions

Inf2A: Converting from NFAs to DFAs and Closure Properties

Theory of Computer Science. Theory of Computer Science. D7.1 Introduction. D7.2 Turing Machines as Words. D7.3 Special Halting Problem

Theory of computation: initial remarks (Chapter 11)

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

CPSC 421: Tutorial #1

Let us first give some intuitive idea about a state of a system and state transitions before describing finite automata.

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

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

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

Miscellaneous. Closure Properties Decision Properties

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

Pushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen

Functions on languages:

1 Showing Recognizability

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

CS243, Logic and Computation Nondeterministic finite automata

Parsing Regular Expressions and Regular Grammars

CSE 105 THEORY OF COMPUTATION

Ogden s Lemma for CFLs

1 More finite deterministic automata

Lecture 3: Nondeterministic Finite Automata

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

Theory of computation: initial remarks (Chapter 11)

Nondeterministic Finite Automata. Nondeterminism Subset Construction

Nondeterministic Finite Automata

Before we show how languages can be proven not regular, first, how would we show a language is regular?

NPDA, CFG equivalence

COM364 Automata Theory Lecture Note 2 - Nondeterminism

Limits of Computability

Properties of Context-Free Languages

Regular expressions. Regular expressions. Regular expressions. Regular expressions. Remark (FAs with initial set recognize the regular languages)

Non-deterministic Finite Automata (NFAs)

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs

Computational Models: Class 5

Regular Expressions. Definitions Equivalence to Finite Automata

Context Free Languages. Automata Theory and Formal Grammars: Lecture 6. Languages That Are Not Regular. Non-Regular Languages

Theory of Computation (I) Yijia Chen Fudan University

acs-07: Decidability Decidability Andreas Karwath und Malte Helmert Informatik Theorie II (A) WS2009/10

INF Introduction and Regular Languages. Daniel Lupp. 18th January University of Oslo. Department of Informatics. Universitetet i Oslo

Lecture 1: Finite State Automaton

Context Free Language Properties

Computational Models - Lecture 3 1

Decidability (What, stuff is unsolvable?)

CHAPTER 1 Regular Languages. Contents

CS 154 Introduction to Automata and Complexity Theory

Regular expressions and Kleene s theorem

Context-Free Languages (Pre Lecture)

CS5371 Theory of Computation. Lecture 14: Computability V (Prove by Reduction)

Recitation 2 - Non Deterministic Finite Automata (NFA) and Regular OctoberExpressions

Computational Models: Class 3

Transcription:

Theory of Computer Science April 4, 2016 C4. Regular Languages: Closure Properties and Decidability Theory of Computer Science C4. Regular Languages: Closure Properties and Decidability C4.1 Closure Properties Malte Helmert University of Basel April 4, 2016 C4.2 Decidability C4.3 Summary M. Helmert (Univ. Basel) Theorie April 4, 2016 1 / 24 M. Helmert (Univ. Basel) Theorie April 4, 2016 2 / 24 Closure Properties C4.1 Closure Properties How can you combine regular languages in a way to get another regular language as a result? Picture courtesy of stockimages / FreeDigitalPhotos.net M. Helmert (Univ. Basel) Theorie April 4, 2016 3 / 24 M. Helmert (Univ. Basel) Theorie April 4, 2016 4 / 24

Closure Properties: Operations Closure Properties Let L and L be regular languages over Σ and Σ, respectively. We consider the following operations: union L L = {w w L or w L } over Σ Σ intersection L L = {w w L and w L } over Σ Σ complement L = {w Σ w / L} over Σ product LL = {uv u L and v L } over Σ Σ special case: L n = L n 1 L, where L 0 = {ε} star L = k 0 Lk over Σ German: Abschlusseigenschaften, Vereinigung, Schnitt, Komplement, Produkt, Stern Definition (Closure) Let K be a class of languages. Then K is closed...... under union if L, L K implies L L K... under intersection if L, L K implies L L K... under complement if L K implies L K... under product if L, L K implies LL K... under star if L K implies L K German: Abgeschlossenheit, K ist abgeschlossen unter Vereinigung (Schnitt, Komplement, Produkt, Stern) M. Helmert (Univ. Basel) Theorie April 4, 2016 5 / 24 M. Helmert (Univ. Basel) Theorie April 4, 2016 6 / 24 Clourse Properties of Regular Languages Closure Properties The regular languages are closed under: union intersection complement product star Closure under union, product, and star follows because for regular expressions α and β, the expressions (α β), (αβ) and (α ) describe the corresponding languages. Complement: Let M = Q, Σ, δ, q 0, E be a DFA with L(M) = L. Then M = Q, Σ, δ, q 0, Q \ E is a DFA with L(M ) = L. Intersection: Let M 1 = Q 1, Σ 1, δ 1, q 01, E 1 and M 2 = Q 2, Σ 2, δ 2, q 02, E 2 be DFAs. The product automaton M = Q 1 Q 2, Σ 1 Σ 2, δ, q 01, q 02, E 1 E 2 with δ( q 1, q 2, a) = δ 1 (q 1, a), δ 2 (q 2, a) accepts L(M) = L(M 1 ) L(M 2 ). German: Kreuzproduktautomat M. Helmert (Univ. Basel) Theorie April 4, 2016 7 / 24 M. Helmert (Univ. Basel) Theorie April 4, 2016 8 / 24

Decision Problems and Decidability (1) C4.2 Decidability Intuitive Definition: Decision Problem, Decidability A decision problem is an algorithmic problem where for a given an input an algorithm determines if the input has a given property and then produces the output yes or no accordingly. A decision problem is decidable if an algorithm for it (that always gives the correct answer) exists. German: Entscheidungsproblem, Eingabe, Eigenschaft, Ausgabe, entscheidbar Note: exists is known M. Helmert (Univ. Basel) Theorie April 4, 2016 9 / 24 M. Helmert (Univ. Basel) Theorie April 4, 2016 10 / 24 Decision Problems and Decidability (2) Decision Problems: Example Notes: not a formal definition: we did not formally define algorithm, input, output etc. (which is not trivial) lack of a formal definition makes it difficult to prove that something is not decidable studied thoroughly in the next part of the course For now we describe decision problems in a semi-formal given / question way: Example (Emptiness Problem for Regular Languages) The emptiness problem P for regular languages is the following problem: Given: regular grammar G Question: Is L(G) =? German: Leerheitsproblem M. Helmert (Univ. Basel) Theorie April 4, 2016 11 / 24 M. Helmert (Univ. Basel) Theorie April 4, 2016 12 / 24

Word Problem Decidability: Word Problem Definition (Word Problem for Regular Languages) The word problem P for regular languages is: Given: regular grammar G with alphabet Σ and word w Σ Question: Is w L(G)? German: Wortproblem (für reguläre Sprachen) The word problem for regular languages is decidable. Construct a DFA M with L(M) = L(G). (The proofs in Chapter C2 describe a possible method.) Simulate M on input w. The simulation ends after w steps. The DFA M is an end state after this iff w L(G). Print yes or no accordingly. M. Helmert (Univ. Basel) Theorie April 4, 2016 13 / 24 M. Helmert (Univ. Basel) Theorie April 4, 2016 14 / 24 Emptiness Problem Decidability: Emptiness Problem Definition (Emptiness Problem for Regular Languages) The emptiness problem P for regular languages is: Given: regular grammar G Question: Is L(G) =? German: Leerheitsproblem The emptiness problem for regular languages is decidable. Construct a DFA M with L(M) = L(G). We have L(G) = iff in the transition diagram of M there is no path from the start state to any end state. This can be checked with standard graph algorithms (e.g., breadth-first search). M. Helmert (Univ. Basel) Theorie April 4, 2016 15 / 24 M. Helmert (Univ. Basel) Theorie April 4, 2016 16 / 24

Finiteness Problem Decidability: Finiteness Problem Definition (Finiteness Problem for Regular Languages) The finiteness problem P for regular languages is: Given: regular grammar G Question: Is L(G) <? German: Endlichkeitsproblem The finiteness problem for regular languages is decidable. Construct a DFA M with L(M) = L(G). We have L(G) = iff in the transition diagram of M there is a cycle that is reachable from the start state and from which an end state can be reached. This can be checked with standard graph algorithms. M. Helmert (Univ. Basel) Theorie April 4, 2016 17 / 24 M. Helmert (Univ. Basel) Theorie April 4, 2016 18 / 24 Intersection Problem Decidability: Intersection Problem Definition (Intersection Problem for Regular Languages) The intersection problem P for regular languages is: Given: regular grammars G and G Question: Is L(G) L(G ) =? German: Schnittproblem The intersection problem for regular languages is decidable. Using the closure of regular languages under intersection, we can construct (e.g., by converting to DFAs, constructing the product automaton, then converting back to a grammar) a grammar G with L(G ) = L(G) L(G ) and use the algorithm for the emptiness problem P. M. Helmert (Univ. Basel) Theorie April 4, 2016 19 / 24 M. Helmert (Univ. Basel) Theorie April 4, 2016 20 / 24

Equivalence Problem Decidability: Equivalence Problem The equivalence problem for regular languages is decidable. Definition (Equivalence Problem for Regular Languages) The equivalence problem P = for regular languages is: Given: regular grammars G and G Question: Is L(G) = L(G )? German: Äquivalenzproblem In general for languages L and L, we have L = L iff (L L ) ( L L ) =. The regular languages are closed under intersection, union and complement, and we know algorithms for these operations. We can therefore construct a grammar for (L L ) ( L L ) and use the algorithm for the emptiness problem P. M. Helmert (Univ. Basel) Theorie April 4, 2016 21 / 24 M. Helmert (Univ. Basel) Theorie April 4, 2016 22 / 24 C4. Regular Languages: Closure Properties and Decidability Summary C4. Regular Languages: Closure Properties and Decidability Summary Summary C4.3 Summary The regular languages are closed under all usual operations (union, intersection, complement, product, star). All usual decision problems (word problem, emptiness, finiteness, intersection, equivalence) are decidable for regular languages. M. Helmert (Univ. Basel) Theorie April 4, 2016 23 / 24 M. Helmert (Univ. Basel) Theorie April 4, 2016 24 / 24