Regular Expressions (Pre Lecture)
|
|
- Magdalen Porter
- 6 years ago
- Views:
Transcription
1 Regular Expressions (Pre Lecture) Dr. Neil T. Dantam CSCI-561, Colorado School of Mines Fall 2017 Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
2 Regular Expressions Outline Regular Expressions Regular Expressions to NFA NFA to Regular Expressions Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
3 Regular Expressions Regular Operator The regular set is closed under such an operator input One or more regular language(s), R... output A regular language, R op : R R... R Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
4 Regular Expressions Regular Language Basis empty set: defines the language {}, containing no members L ( ) = = {} empty string: defines the language {}, containing the empty string L () = {} = {()} single symbol: Any single symbol a Σ defines the language {a}, containing the string (a) L (a) = {a} Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
5 Regular Expressions Basis: Expression vs. Language Regular Expression Language L ( ) {} L () {()} a L (a) {a} Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
6 Regular Expressions Basic Regular Operators concatenation(α, β): αβ denotes L (α) followed by L (β) L (αβ) = {xy x L (α) y L (β)} union(α, β): α β denotes all members of L (α) or L (β) L (α β) = L (α) L (β) = {x x L (α) x L (β)} Kleene-closure(α): α denotes zero or more repetitions of L (α) L (α ) = {x 0... x n (n 0) (x i L (α))} Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
7 Regular Expressions Operators: Expression vs. Language Regular Expression Language αβ concatenate(α, β) L (αβ) {xy x L (α) y L (β)} α β union(α, β) L (α β) L (α) L (β) α kleene-closure(α, β) L (α ) {x 0... x n (n 0) (x i L (α))} Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
8 Regular Expressions Regex Precedence Convention 3: Kleene-Closure (highest/tightest) 2: Concatenation 1: Union (lowest/last) Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
9 Regular Expressions Example: Regex Precedence (01) (10) 01 0(1 ) (1 ) (0(0 )) (1(1 )) Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
10 Regular Expressions Example: Simple Regexes L (01) = {01} L (01 0) = {01, 0} L (0(1 0)) = {01, 00} L (0 ) = {, 0, 00, 000,...} Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
11 Regular Expressions Algebraic Properties Regex concatenation union not commutative L (αβ) L (βα) associative L ((αβ)γ) = L (α(βγ)) commutative L (α β) = L (β α) associative L ((α β) γ) = L (α (β γ)) distributive L (α(β γ)) = L (αβ αγ) Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
12 Regular Expressions Example: Regex Algebra Simplify: L (α ) = L (α) Simplify: L (α) = L (α) Simplify: L (α ) = L (α ) Simplify: L ((0 ) ) = L (0 ) Factor: L ( ) = L ((00 11) 10) Expand: L ((a b)(b c)) = L (a(b c) b(b c)) = L (ab ac bb bc) Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
13 Regular Expressions Historical Interlude Who s this Kleene guy? Alonzo Church Alan Turing Stephen Cole Kleene Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
14 Regular Expressions to NFA Outline Regular Expressions Regular Expressions to NFA NFA to Regular Expressions Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
15 Regular Expressions to NFA Regex to NFA Basis L (a) L () L ( ) a Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
16 Regular Expressions to NFA Concatenation concatenate N 1. N, 2. N 1. N 2. Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
17 Regular Expressions to NFA Concatenation (continued) concatenate N 1. N, 2. N 1 N 2.. Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
18 Regular Expressions to NFA Union union N 1., N 2. N 1 N 2.. Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
19 Regular Expressions to NFA Union (continued) union N 1., N 2. N 1 N 2.. Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
20 Regular Expressions to NFA Kleene-Closure kleene-closure N 1. N 1. Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
21 Regular Expressions to NFA Kleene-Closure (continued) kleene-closure N 1. N 1. Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
22 Regular Expressions to NFA Example: L (01) to NFA L (0) L (1) 0 1 Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
23 Regular Expressions to NFA Example: L (01) to NFA (continued) 0 1 Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
24 Regular Expressions to NFA Example: L (01 0) to NFA L (01) 0 1 L (0) 0 Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
25 Regular Expressions to NFA Example: L (01 0) to NFA (continued) Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
26 Regular Expressions to NFA Example: L (0 ) to NFA L (0) 0 Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
27 Regular Expressions to NFA Example: L (0 ) to NFA (continued) 0 Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
28 Regular Expressions to NFA Example: L (01 0 ) to NFA Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
29 Regular Expressions to NFA Regular Expressions as Trees τ 1 τ 2... τ n CONCATENATION τ 1 τ 2... τ n UNION τ KLEENE-CLOSURE τ 1 τ 2... τ n τ 1 τ 2... τ n τ (:concatenation tau-1... tau-n) (:union tau-1... tau-n) (:kleene-closure tau) Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
30 Regular Expressions to NFA Example: Regex Trees (1 0) 0 CONCATENATION UNION CONCATENATION KLEENE-CLOSURE 0 1 CONCATENATION 0 0 UNION (:concatenation 0 1) (:union (:concatenation 0 1) 0) (:concatenation 0 (:union 0 1)) (:kleene-closure 0) Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
31 Regular Expressions to NFA McNaughton-Yamada-Thompson Algorithm Algorithm 1: Recursive McNaughton-Yamada-Thompson Algorithm Input: (Q, E, s), T ; // NFA states, edges, state, regex tree Output: (Q, E, a) ; // NFA states, edges, end state 1 if root(t) = CONCATENATION then 2 (Q, E, a) fold-left(myt, (Q, E, s), children(t )) ; 3 else if root(t) = UNION then 4 a newstate() ; // New state for accept 5 E E; 6 forall T children(t ) do 7 (Q, E, ã) MYT((Q, E, s), T ) ; // recurse on child { } 8 E E ã a ; // edge from child accept ã to current accept state a 9 else if root(t) = KLEENE-CLOSURE then 10 s newstate() ; // New state for of repetition 11 (Q, E, a) MYT((Q, E, s ), child(t )) ; // Recurse on child 12 E E (s s ) (s a) (a s ) ; 13 else // Base Case 14 a newstate(); 15 E E (s T a) ; Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
32 NFA to Regular Expressions Outline Regular Expressions Regular Expressions to NFA NFA to Regular Expressions Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
33 NFA to Regular Expressions Generalized NFA Intuition: an NFA with regular expressions as edge labels Ñ = (Q, Σ, δ, q, q accept ) Q is the finite set of states Σ is the input alphabet δ : (Q \ {qaccept }) (Q \ {q }) REGEX q Q is the state q Q is the accept state Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
34 NFA to Regular Expressions NFA to Regex: Convert-Rip rip E( q, q) E(q i, q) E( q, q j ) q i q q j E(q i, q j ) q i E(q i, q) (E( q, q)) E( q, q j ) E(q i, q j ) q j Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
35 NFA to Regular Expressions NFA to Regex Algorithm 2: NFA to Regex Input: N = (Q, Σ, E, q 0, F ) ; // NFA states, alphabet, edges,, accept Output: R ; // Regex /* Construct the initial GNFA */ 1 Q Q {q, q accept} ; // add new, accept states 2 E q0 q }{{ } } {q q accept ; edge to new q F }{{} edges to new accept // Merge multiple edges between nodes into union edges 3 forall q i Q do 4 forall q j Q do } 5 e {a σ b E a = q i b = q j ; // set of edges from qi to qj 6 if e = 1 then 7 E E e; 8 else if e > 1 then ( ) 9 l {σ} a b e σ 10 r regex (l 0... l } n); 11 E E r {q i qj ; ; // set of edge labels from qi to qj /* Call Convert() subroutine on the GNFA */ 12 R Convert(Q, E ); Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
36 NFA to Regular Expressions NFA to Regex: Convert Function Convert(Q,E) 1 if Q = 2 then 2 R E(q, q accept ) ; // Extract label of edge from GNFA to accept 3 return R; 4 else 5 q any state in (Q \ {q, q accept }); 6 Q Q \ { q}; 7 E E \ { q q}; 8 forall q i where E(q i, q) do // predecessors of q 9 forall q j where E( q, q j ) do // successors of q 10 r regex (E(q i, q) (E( q, q)) E( q, q j ) E(q i, q j )) ; 11 E E \ {(q i q), ( q q j ), (q i q j ), }; } 12 E E r {q i qj ; 13 return Convert(Q, E ); Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
37 NFA to Regular Expressions Example: NFA to Regex 0. Initial DFA b 1 2 a a,b Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
38 NFA to Regular Expressions Syntactic Sugar α + αα α? α [α 0 α 1... α n ] α 0 α 1... α n. {σ} σ Σ What about a complement operator? Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
39 NFA to Regular Expressions Conversions subset construction NFA DFA McNaughton Yamada Thompson every DFA is an NFA GNFA conversion Regex also possible Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall / 39
Context-Free Languages (Pre Lecture)
Context-Free Languages (Pre Lecture) Dr. Neil T. Dantam CSCI-561, Colorado School of Mines Fall 2017 Dantam (Mines CSCI-561) Context-Free Languages (Pre Lecture) Fall 2017 1 / 34 Outline Pumping Lemma
More informationFinite Automata. Dr. Neil T. Dantam. Fall CSCI-561, Colorado School of Mines. Dantam (Mines CSCI-561) Finite Automata Fall / 43
Finite Automata Dr. Neil T. Dantam CSCI-561, Colorado School of Mines Fall 2018 Dantam (Mines CSCI-561) Finite Automata Fall 2018 1 / 43 Outline Languages Review Traffic Light Example Deterministic Finite
More informationFinite Automata. Dr. Neil T. Dantam. Fall CSCI-561, Colorado School of Mines. Dantam (Mines CSCI-561) Finite Automata Fall / 35
Finite Automata Dr. Neil T. Dantam CSCI-561, Colorado School of Mines Fall 2017 Dantam (Mines CSCI-561) Finite Automata Fall 2017 1 / 35 Outline Dantam (Mines CSCI-561) Finite Automata Fall 2017 2 / 35
More informationRegular Expressions. Definitions Equivalence to Finite Automata
Regular Expressions Definitions Equivalence to Finite Automata 1 RE s: Introduction Regular expressions are an algebraic way to describe languages. They describe exactly the regular languages. If E is
More informationRegular languages, regular expressions, & finite automata (intro) CS 350 Fall 2018 gilray.org/classes/fall2018/cs350/
Regular languages, regular expressions, & finite automata (intro) CS 350 Fall 2018 gilray.org/classes/fall2018/cs350/ 1 L = {hello, bonjour, konnichiwa, } Σ = {a, b, c,, y, z}!2 Σ = {a, b, c,, y, z} Σ*
More informationTDDD65 Introduction to the Theory of Computation
TDDD65 Introduction to the Theory of Computation Lecture 2 Gustav Nordh, IDA gustav.nordh@liu.se 2012-08-31 Outline - Lecture 2 Closure properties of regular languages Regular expressions Equivalence of
More informationCS 154, Lecture 3: DFA NFA, Regular Expressions
CS 154, Lecture 3: DFA NFA, Regular Expressions Homework 1 is coming out Deterministic Finite Automata Computation with finite memory Non-Deterministic Finite Automata Computation with finite memory and
More informationDeterministic Finite Automaton (DFA)
1 Lecture Overview Deterministic Finite Automata (DFA) o accepting a string o defining a language Nondeterministic Finite Automata (NFA) o converting to DFA (subset construction) o constructed from a regular
More informationClosure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism
Closure Properties of Regular Languages Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism Closure Properties Recall a closure property is a statement
More informationRegular expressions and Kleene s theorem
and Kleene s theorem Informatics 2A: Lecture 5 John Longley School of Informatics University of Edinburgh jrl@inf.ed.ac.uk 29 September 2016 1 / 21 1 More closure properties of regular languages Operations
More informationCS21 Decidability and Tractability
CS21 Decidability and Tractability Lecture 3 January 9, 2017 January 9, 2017 CS21 Lecture 3 1 Outline NFA, FA equivalence Regular Expressions FA and Regular Expressions January 9, 2017 CS21 Lecture 3 2
More informationRegular expressions and Kleene s theorem
and Informatics 2A: Lecture 5 Alex Simpson School of Informatics University of Edinburgh als@inf.ed.ac.uk 25 September, 2014 1 / 26 1 More closure properties of regular languages Operations on languages
More informationSeptember 11, Second Part of Regular Expressions Equivalence with Finite Aut
Second Part of Regular Expressions Equivalence with Finite Automata September 11, 2013 Lemma 1.60 If a language is regular then it is specified by a regular expression Proof idea: For a given regular language
More informationPushdown Automata (Pre Lecture)
Pushdown Automata (Pre Lecture) Dr. Neil T. Dantam CSCI-561, Colorado School of Mines Fall 2017 Dantam (Mines CSCI-561) Pushdown Automata (Pre Lecture) Fall 2017 1 / 41 Outline Pushdown Automata Pushdown
More informationClosure under the Regular Operations
September 7, 2013 Application of NFA Now we use the NFA to show that collection of regular languages is closed under regular operations union, concatenation, and star Earlier we have shown this closure
More informationT (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,
Recall A deterministic finite automaton is a five-tuple where S is a finite set of states, M = (S, Σ, T, s 0, F ) Σ is an alphabet the input alphabet, T : S Σ S is the transition function, s 0 S is the
More informationCS 154. Finite Automata vs Regular Expressions, Non-Regular Languages
CS 154 Finite Automata vs Regular Expressions, Non-Regular Languages Deterministic Finite Automata Computation with finite memory Non-Deterministic Finite Automata Computation with finite memory and guessing
More informationTheory of Computation (II) Yijia Chen Fudan University
Theory of Computation (II) Yijia Chen Fudan University Review A language L is a subset of strings over an alphabet Σ. Our goal is to identify those languages that can be recognized by one of the simplest
More informationCS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1)
CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1) Definition 1 (Alphabet) A alphabet is a finite set of objects called symbols. Definition 2 (String)
More informationCOM364 Automata Theory Lecture Note 2 - Nondeterminism
COM364 Automata Theory Lecture Note 2 - Nondeterminism Kurtuluş Küllü March 2018 The FA we saw until now were deterministic FA (DFA) in the sense that for each state and input symbol there was exactly
More informationThis Lecture will Cover...
Last Lecture Covered... DFAs, NFAs, -NFAs and the equivalence of the language classes they accept Last Lecture Covered... This Lecture will Cover... Introduction to regular expressions and regular languages
More informationClosure Properties of Regular Languages
Closure Properties of Regular Languages Lecture 13 Section 4.1 Robb T. Koether Hampden-Sydney College Wed, Sep 21, 2016 Robb T. Koether (Hampden-Sydney College) Closure Properties of Regular Languages
More informationNondeterministic Finite Automata
Nondeterministic Finite Automata Not A DFA Does not have exactly one transition from every state on every symbol: Two transitions from q 0 on a No transition from q 1 (on either a or b) Though not a DFA,
More informationFORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY THE PUMPING LEMMA FOR REGULAR LANGUAGES and REGULAR EXPRESSIONS TUESDAY Jan 21 WHICH OF THESE ARE REGULAR? B = {0 n 1 n n 0} C = { w w has equal number
More informationSri vidya college of engineering and technology
Unit I FINITE AUTOMATA 1. Define hypothesis. The formal proof can be using deductive proof and inductive proof. The deductive proof consists of sequence of statements given with logical reasoning in order
More informationClosure Properties of Regular Languages
of Regulr Lnguges Dr. Neil T. Dntm CSCI-561, Colordo School of Mines Fll 2018 Dntm (Mines CSCI-561) Closure Properties of Regulr Lnguges Fll 2018 1 / 50 Outline Introduction Closure Properties Stte Minimiztion
More informationFormal Languages, Automata and Models of Computation
CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2011 1 Content - More Properties of Regular Languages (RL)
More informationLecture 3: Nondeterministic Finite Automata
Lecture 3: Nondeterministic Finite Automata September 5, 206 CS 00 Theory of Computation As a recap of last lecture, recall that a deterministic finite automaton (DFA) consists of (Q, Σ, δ, q 0, F ) where
More informationComputability Theory
CS:4330 Theory of Computation Spring 2018 Computability Theory Decidable Problems of CFLs and beyond Haniel Barbosa Readings for this lecture Chapter 4 of [Sipser 1996], 3rd edition. Section 4.1. Decidable
More informationIntro to Theory of Computation
Intro to Theory of Computation 1/19/2016 LECTURE 3 Last time: DFAs and NFAs Operations on languages Today: Nondeterminism Equivalence of NFAs and DFAs Closure properties of regular languages Sofya Raskhodnikova
More informationComputational Models Lecture 2 1
Computational Models Lecture 2 1 Handout Mode Iftach Haitner. Tel Aviv University. October 30, 2017 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice Herlihy, Brown University.
More informationCS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism,
CS 54, Lecture 2: Finite Automata, Closure Properties Nondeterminism, Why so Many Models? Streaming Algorithms 0 42 Deterministic Finite Automata Anatomy of Deterministic Finite Automata transition: for
More informationCOMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 14 : Turing Machines
COMP-330 Theory of Computation Fall 2012 -- Prof. Claude Crépeau Lec. 14 : Turing Machines 1 COMP 330 Fall 2012: Lectures Schedule 1. Introduction 1.5. Some basic mathematics 2. Deterministic finite automata
More informationRegular Expressions and Language Properties
Regular Expressions and Language Properties Mridul Aanjaneya Stanford University July 3, 2012 Mridul Aanjaneya Automata Theory 1/ 47 Tentative Schedule HW #1: Out (07/03), Due (07/11) HW #2: Out (07/10),
More informationComputational Models Lecture 2 1
Computational Models Lecture 2 1 Handout Mode Ronitt Rubinfeld and Iftach Haitner. Tel Aviv University. March 16/18, 2015 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice
More informationComputational Theory
Computational Theory Finite Automata and Regular Languages Curtis Larsen Dixie State University Computing and Design Fall 2018 Adapted from notes by Russ Ross Adapted from notes by Harry Lewis Curtis Larsen
More informationCS 455/555: Finite automata
CS 455/555: Finite automata Stefan D. Bruda Winter 2019 AUTOMATA (FINITE OR NOT) Generally any automaton Has a finite-state control Scans the input one symbol at a time Takes an action based on the currently
More informationThe Pumping Lemma and Closure Properties
The Pumping Lemma and Closure Properties Mridul Aanjaneya Stanford University July 5, 2012 Mridul Aanjaneya Automata Theory 1/ 27 Tentative Schedule HW #1: Out (07/03), Due (07/11) HW #2: Out (07/10),
More informationTheory of Computation (IX) Yijia Chen Fudan University
Theory of Computation (IX) Yijia Chen Fudan University Review The Definition of Algorithm Polynomials and their roots A polynomial is a sum of terms, where each term is a product of certain variables and
More informationFinite Automata and Regular languages
Finite Automata and Regular languages Huan Long Shanghai Jiao Tong University Acknowledgements Part of the slides comes from a similar course in Fudan University given by Prof. Yijia Chen. http://basics.sjtu.edu.cn/
More informationHarvard CS 121 and CSCI E-207 Lecture 6: Regular Languages and Countability
Harvard CS 121 and CSCI E-207 Lecture 6: Regular Languages and Countability Salil Vadhan September 20, 2012 Reading: Sipser, 1.3 and The Diagonalization Method, pages 174 178 (from just before Definition
More informationCSE 105 THEORY OF COMPUTATION
CSE 105 THEORY OF COMPUTATION Spring 2018 http://cseweb.ucsd.edu/classes/sp18/cse105-ab/ Today's learning goals Sipser Ch 4.1 Explain what it means for a problem to be decidable. Justify the use of encoding.
More informationCSE 105 THEORY OF COMPUTATION
CSE 105 THEORY OF COMPUTATION "Winter" 2018 http://cseweb.ucsd.edu/classes/wi18/cse105-ab/ Today's learning goals Sipser Ch 4.1 Explain what it means for a problem to be decidable. Justify the use of encoding.
More informationThis lecture covers Chapter 7 of HMU: Properties of CFLs
This lecture covers Chapter 7 of HMU: Properties of CFLs Chomsky Normal Form Pumping Lemma for CFs Closure Properties of CFLs Decision Properties of CFLs Additional Reading: Chapter 7 of HMU. Chomsky Normal
More informationLanguages, regular languages, finite automata
Notes on Computer Theory Last updated: January, 2018 Languages, regular languages, finite automata Content largely taken from Richards [1] and Sipser [2] 1 Languages An alphabet is a finite set of characters,
More informationLecture 7 Properties of regular languages
Lecture 7 Properties of regular languages COT 4420 Theory of Computation Section 4.1 Closure properties of regular languages If L 1 and L 2 are regular languages, then we prove that: Union: L 1 L 2 Concatenation:
More informationChapter 6. Properties of Regular Languages
Chapter 6 Properties of Regular Languages Regular Sets and Languages Claim(1). The family of languages accepted by FSAs consists of precisely the regular sets over a given alphabet. Every regular set is
More informationTHEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET
THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET Regular Languages and FA A language is a set of strings over a finite alphabet Σ. All languages are finite or countably infinite. The set of all languages
More informationLexical Analysis. DFA Minimization & Equivalence to Regular Expressions
Lexical Analysis DFA Minimization & Equivalence to Regular Expressions Copyright 26, Pedro C. Diniz, all rights reserved. Students enrolled in the Compilers class at the University of Southern California
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Theory of Regular Expressions DFAs and NFAs Reminders Project 1 due Sep. 24 Homework 1 posted Exam 1 on Sep. 25 Exam topics list posted Practice homework
More informationNFA and regex. the Boolean algebra of languages. regular expressions. Informatics 1 School of Informatics, University of Edinburgh
NFA and regex cl the Boolean algebra of languages regular expressions Informatics The intersection of two regular languages is regular L = even numbers L = odd numbers L = mod L = mod Informatics The intersection
More information1 Alphabets and Languages
1 Alphabets and Languages Look at handout 1 (inference rules for sets) and use the rules on some examples like {a} {{a}} {a} {a, b}, {a} {{a}}, {a} {{a}}, {a} {a, b}, a {{a}}, a {a, b}, a {{a}}, a {a,
More informationDecidability. Human-aware Robotics. 2017/10/31 Chapter 4.1 in Sipser Ø Announcement:
Decidability 2017/10/31 Chapter 4.1 in Sipser Ø Announcement: q q q Slides for this lecture are here: http://www.public.asu.edu/~yzhan442/teaching/cse355/lectures/decidability.pdf Happy Hollaween! Delayed
More informationCSE 105 THEORY OF COMPUTATION
CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 3.3, 4.1 State and use the Church-Turing thesis. Give examples of decidable problems.
More informationIntroduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.
Introduction to the Theory of Computation Automata 1VO + 1PS Lecturer: Dr. Ana Sokolova http://cs.uni-salzburg.at/~anas/ Setup and Dates Lectures and Instructions 23.10. 3.11. 17.11. 24.11. 1.12. 11.12.
More informationConcatenation. The concatenation of two languages L 1 and L 2
Regular Expressions Problem Problem Set Set Four Four is is due due using using a late late period period in in the the box box up up front. front. Concatenation The concatenation of two languages L 1
More informationEquivalence of DFAs and NFAs
CS 172: Computability and Complexity Equivalence of DFAs and NFAs It s a tie! DFA NFA Sanjit A. Seshia EECS, UC Berkeley Acknowledgments: L.von Ahn, L. Blum, M. Blum What we ll do today Prove that DFAs
More informationCMSC 330: Organization of Programming Languages. Theory of Regular Expressions Finite Automata
: Organization of Programming Languages Theory of Regular Expressions Finite Automata Previous Course Review {s s defined} means the set of string s such that s is chosen or defined as given s A means
More informationCOMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 16 : Turing Machines
COMP-330 Theory of Computation Fall 2017 -- Prof. Claude Crépeau Lec. 16 : Turing Machines COMP 330 Fall 2017: Lectures Schedule 1-2. Introduction 1.5. Some basic mathematics 2-3. Deterministic finite
More informationIntroduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.
Introduction to the Theory of Computation Automata 1VO + 1PS Lecturer: Dr. Ana Sokolova http://cs.uni-salzburg.at/~anas/ Setup and Dates Lectures Tuesday 10:45 pm - 12:15 pm Instructions Tuesday 12:30
More informationFORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY REVIEW for MIDTERM 1 THURSDAY Feb 6 Midterm 1 will cover everything we have seen so far The PROBLEMS will be from Sipser, Chapters 1, 2, 3 It will be
More informationUNIT-III REGULAR LANGUAGES
Syllabus R9 Regulation REGULAR EXPRESSIONS UNIT-III REGULAR LANGUAGES Regular expressions are useful for representing certain sets of strings in an algebraic fashion. In arithmetic we can use the operations
More informationInf2A: Converting from NFAs to DFAs and Closure Properties
1/43 Inf2A: Converting from NFAs to DFAs and Stuart Anderson School of Informatics University of Edinburgh October 13, 2009 Starter Questions 2/43 1 Can you devise a way of testing for any FSM M whether
More informationTheory of Computation p.1/?? Theory of Computation p.2/?? Unknown: Implicitly a Boolean variable: true if a word is
Abstraction of Problems Data: abstracted as a word in a given alphabet. Σ: alphabet, a finite, non-empty set of symbols. Σ : all the words of finite length built up using Σ: Conditions: abstracted as a
More informationOutline. Nondetermistic Finite Automata. Transition diagrams. A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F)
Outline Nondeterminism Regular expressions Elementary reductions http://www.cs.caltech.edu/~cs20/a October 8, 2002 1 Determistic Finite Automata A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F) Q is a finite
More informationChapter Five: Nondeterministic Finite Automata
Chapter Five: Nondeterministic Finite Automata From DFA to NFA A DFA has exactly one transition from every state on every symbol in the alphabet. By relaxing this requirement we get a related but more
More informationLecture 4 Nondeterministic Finite Accepters
Lecture 4 Nondeterministic Finite Accepters COT 4420 Theory of Computation Section 2.2, 2.3 Nondeterminism A nondeterministic finite automaton can go to several states at once. Transitions from one state
More informationFinite Automata and Languages
CS62, IIT BOMBAY Finite Automata and Languages Ashutosh Trivedi Department of Computer Science and Engineering, IIT Bombay CS62: New Trends in IT: Modeling and Verification of Cyber-Physical Systems (2
More informationName: Student ID: Instructions:
Instructions: Name: CSE 322 Autumn 2001: Midterm Exam (closed book, closed notes except for 1-page summary) Total: 100 points, 5 questions, 20 points each. Time: 50 minutes 1. Write your name and student
More information컴파일러입문 제 3 장 정규언어
컴파일러입문 제 3 장 정규언어 목차 3.1 정규문법과정규언어 3.2 정규표현 3.3 유한오토마타 3.4 정규언어의속성 Regular Language Page 2 정규문법과정규언어 A study of the theory of regular languages is often justified by the fact that they model the lexical
More informationFoundations of
91.304 Foundations of (Theoretical) Computer Science Chapter 1 Lecture Notes (Section 1.3: Regular Expressions) David Martin dm@cs.uml.edu d with some modifications by Prof. Karen Daniels, Spring 2012
More informationLecture 2: Connecting the Three Models
IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Advanced Course on Computational Complexity Lecture 2: Connecting the Three Models David Mix Barrington and Alexis Maciel July 18, 2000
More informationFunctions on languages:
MA/CSSE 474 Final Exam Notation and Formulas page Name (turn this in with your exam) Unless specified otherwise, r,s,t,u,v,w,x,y,z are strings over alphabet Σ; while a, b, c, d are individual alphabet
More informationHomework 1 Due September 20 M1 M2
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,
More informationCS21 Decidability and Tractability
CS21 Decidability and Tractability Lecture 2 January 5, 2018 January 5, 2018 CS21 Lecture 2 1 Outline Finite Automata Nondeterministic Finite Automata Closure under regular operations NFA, FA equivalence
More informationComplexity (Pre Lecture)
Complexity (Pre Lecture) Dr. Neil T. Dantam CSCI-561, Colorado School of Mines Fall 2018 Dantam (Mines CSCI-561) Complexity (Pre Lecture) Fall 2018 1 / 70 Why? What can we always compute efficiently? What
More informationRecap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT.
Recap DFA,NFA, DTM Slides by Prof. Debasis Mitra, FIT. 1 Formal Language Finite set of alphabets Σ: e.g., {0, 1}, {a, b, c}, { {, } } Language L is a subset of strings on Σ, e.g., {00, 110, 01} a finite
More informationProperties of Context-Free Languages
Properties of Context-Free Languages Seungjin Choi Department of Computer Science and Engineering Pohang University of Science and Technology 77 Cheongam-ro, Nam-gu, Pohang 37673, Korea seungjin@postech.ac.kr
More informationGEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I
GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I Internal Examination 2017-18 B.Tech III Year VI Semester Sub: Theory of Computation (6CS3A) Time: 1 Hour 30 min. Max Marks: 40 Note: Attempt all three
More informationFORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
5-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY NON-DETERMINISM and REGULAR OPERATIONS THURSDAY JAN 6 UNION THEOREM The union of two regular languages is also a regular language Regular Languages Are
More informationUNIT II REGULAR LANGUAGES
1 UNIT II REGULAR LANGUAGES Introduction: A regular expression is a way of describing a regular language. The various operations are closure, union and concatenation. We can also find the equivalent regular
More informationHarvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs
Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs Harry Lewis October 8, 2013 Reading: Sipser, pp. 119-128. Pushdown Automata (review) Pushdown Automata = Finite automaton
More informationFinite Universes. L is a fixed-length language if it has length n for some
Finite Universes Finite Universes When the universe is finite (e.g., the interval 0, 2 1 ), all objects can be encoded by words of the same length. A language L has length n 0 if L =, or every word of
More informationText Search and Closure Properties
Text Search and Closure Properties CSCI 330 Formal Languages and Automata Theory Siu On CHAN Fall 208 Chinese University of Hong Kong /28 Text Search grep program grep -E regex file.txt Searches for an
More informationHarvard CS 121 and CSCI E-207 Lecture 4: NFAs vs. DFAs, Closure Properties
Harvard CS 121 and CSCI E-207 Lecture 4: NFAs vs. DFAs, Closure Properties Salil Vadhan September 13, 2012 Reading: Sipser, 1.2. How to simulate NFAs? NFA accepts w if there is at least one accepting computational
More informationOutline. Theorem 1. For every regular expression E, there exists an ε-nfa A such that L(E)=L(A).
Outline We have two results to prove: Theorem 1. For every regular expression E, there exists an ε-nfa A such that L(E)=L(A). Theorem 2. For every DFA A, there exists a regular expression E such that L(A)=L(E).
More informationacs-04: Regular Languages Regular Languages Andreas Karwath & Malte Helmert Informatik Theorie II (A) WS2009/10
Regular Languages Andreas Karwath & Malte Helmert 1 Overview Deterministic finite automata Regular languages Nondeterministic finite automata Closure operations Regular expressions Nonregular languages
More informationCS 154 Formal Languages and Computability Assignment #2 Solutions
CS 154 Formal Languages and Computability Assignment #2 Solutions Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak www.cs.sjsu.edu/~mak Assignment #2: Question 1
More informationNon-deterministic Finite Automata (NFAs)
Algorithms & Models of Computation CS/ECE 374, Fall 27 Non-deterministic Finite Automata (NFAs) Part I NFA Introduction Lecture 4 Thursday, September 7, 27 Sariel Har-Peled (UIUC) CS374 Fall 27 / 39 Sariel
More informationRegular Expression Unit 1 chapter 3. Unit 1: Chapter 3
Unit 1: Chapter 3 (Regular Expression (RE) and Language) In previous lectures, we have described the languages in terms of machine like description-finite automata (DFA or NFA). Now we switch our attention
More information} Some languages are Turing-decidable A Turing Machine will halt on all inputs (either accepting or rejecting). No infinite loops.
and their languages } Some languages are Turing-decidable A Turing Machine will halt on all inputs (either accepting or rejecting). No infinite loops. } Some languages are Turing-recognizable, but not
More informationProperties of Regular Languages (2015/10/15)
Chapter 4 Properties of Regular Languages (25//5) Pasbag, Turkey Outline 4. Proving Languages Not to e Regular 4.2 Closure Properties of Regular Languages 4.3 Decision Properties of Regular Languages 4.4
More informationRegular Languages. Problem Characterize those Languages recognized by Finite Automata.
Regular Expressions Regular Languages Fundamental Question -- Cardinality Alphabet = Σ is finite Strings = Σ is countable Languages = P(Σ ) is uncountable # Finite Automata is countable -- Q Σ +1 transition
More informationRecap from Last Time
Regular Expressions Recap from Last Time Regular Languages A language L is a regular language if there is a DFA D such that L( D) = L. Theorem: The following are equivalent: L is a regular language. There
More informationGreat Theoretical Ideas in Computer Science. Lecture 4: Deterministic Finite Automaton (DFA), Part 2
5-25 Great Theoretical Ideas in Computer Science Lecture 4: Deterministic Finite Automaton (DFA), Part 2 January 26th, 27 Formal definition: DFA A deterministic finite automaton (DFA) M =(Q,,,q,F) M is
More informationCSE 355 Homework One Sample Solutions
CSE 355 Homework One Sample Solutions Question Give a transition diagram and the transition table, for a DFA to recognize. Part (a) {w {, } : w contains an even number of s and an odd number of s} Solution:
More informationCS375 Midterm Exam Solution Set (Fall 2017)
CS375 Midterm Exam Solution Set (Fall 2017) Closed book & closed notes October 17, 2017 Name sample 1. (10 points) (a) Put in the following blank the number of strings of length 5 over A={a, b, c} that
More informationFoundations of Informatics: a Bridging Course
Foundations of Informatics: a Bridging Course Week 3: Formal Languages and Semantics Thomas Noll Lehrstuhl für Informatik 2 RWTH Aachen University noll@cs.rwth-aachen.de http://www.b-it-center.de/wob/en/view/class211_id948.html
More informationTheory of computation: initial remarks (Chapter 11)
Theory of computation: initial remarks (Chapter 11) For many purposes, computation is elegantly modeled with simple mathematical objects: Turing machines, finite automata, pushdown automata, and such.
More informationChapter 5. Finite Automata
Chapter 5 Finite Automata 5.1 Finite State Automata Capable of recognizing numerous symbol patterns, the class of regular languages Suitable for pattern-recognition type applications, such as the lexical
More information