1 String v is a prefix of w if w= v y for some string y. String v is a suffix of w if w= x v for some string x. String v is a substring of w if there are.

Slides:



Advertisements
Similar presentations
CS2303-THEORY OF COMPUTATION Closure Properties of Regular Languages
Advertisements

Properties of Regular Languages
COMP-421 Compiler Design Presented by Dr Ioanna Dionysiou.
1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.
Regular Languages Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 3 Comments, additions and modifications.
Strings and Languages Operations
CS 310 – Fall 2006 Pacific University CS310 Strings, String Operators, and Languages Sections: August 30, 2006.
Regular Languages Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 3 Comments, additions and modifications.
1 Languages and Finite Automata or how to talk to machines...
79 Regular Expression Regular expressions over an alphabet  are defined recursively as follows. (1) Ø, which denotes the empty set, is a regular expression.
Costas Busch - RPI1 Mathematical Preliminaries. Costas Busch - RPI2 Mathematical Preliminaries Sets Functions Relations Graphs Proof Techniques.
Courtesy Costas Busch - RPI1 Mathematical Preliminaries.
Fall 2006Costas Busch - RPI1 Languages. Fall 2006Costas Busch - RPI2 Language: a set of strings String: a sequence of symbols from some alphabet Example:
Fall 2004COMP 3351 Languages. Fall 2004COMP 3352 A language is a set of strings String: A sequence of letters/symbols Examples: “cat”, “dog”, “house”,
1 Regular Expressions/Languages Regular languages –Inductive definitions –Regular expressions syntax semantics Not covered in lecture.
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,
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
Dept. of Computer Science & IT, FUUAST Automata Theory 2 Automata Theory III Languages And Regular Expressions Construction of FA’s for given languages.
Chapter 2 Languages.
1 Proof of the Day: Let P= {(b, acbb), (aac, a), (b, ca)}. 1.Prove that P has a match. 2. Find Q which is P encoded in binary. 3.What match of Q corresponds.
CSC312 Automata Theory Lecture # 2 Languages.
CSC312 Automata Theory Lecture # 2 Languages.
Costas Busch - LSU1 Languages. Costas Busch - LSU2 Language: a set of strings String: a sequence of symbols from some alphabet Example: Strings: cat,
Formal Methods in SE Theory of Automata Qasiar Javaid Assistant Professor Lecture # 06.
Lecture Two: Formal Languages Formal Languages, Lecture 2, slide 1 Amjad Ali.
1 Strings and Languages. 2 Review Sets and sequences Functions and relations Graphs Boolean logic:      Proof techniques: – Construction, Contradiction,
CMSC 330: Organization of Programming Languages Theory of Regular Expressions.
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
1 Let L= { w= u v : u  {a, b}*, v  {c, d}* and |u|= |v|} 1.Design a context-free grammar that generates L. 2.Use your grammar and the construction from.
Automata, Computability, & Complexity by Elaine Rich ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Slides provided by author Slides edited for.
1 Chapter 1 Introduction to the Theory of Computation.
Mathematical Preliminaries (Hein 1.1 and 1.2) Sets are collections in which order of elements and duplication of elements do not matter. – {1,a,1,1} =
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2006.
Mathematical Preliminaries. Sets Functions Relations Graphs Proof Techniques.
1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet:
1 State SymbolRead- Q E(Q) a b a b a b Convert to a DFA: Start state: Final States:
L ECTURE 3 Chapter 4 Regular Expressions. I MPORTANT T ERMS Regular Expressions Regular Languages Finite Representations.
1 Problem of the Day: Factor (ab) k as xyz in all ways such that y ≠ ε.
1 Exercise: Prove that the set S = { π : π is a permutation of {1, 2, 3, …, n} for some integer n ≥ 1 } is countable.
1 Assignment #1 is due on Friday. Any questions?.
1 Module 14 Regular languages –Inductive definitions –Regular expressions syntax semantics.
MA/CSSE 474 Theory of Computation Regular Expressions Intro.
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.
1 A well-parenthesized string is a string with the same number of (‘s as )’s which has the property that every prefix of the string has at least as many.
1 Problem of the Day: Describe using set descriptor notation the complements of (a) { , a, aa, aaa} over ∑ = {a} (b) { , a, aa, aaa} over ∑ = {a,b} (c)
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2010.
Recursive Definations Regular Expressions Ch # 4 by Cohen
Lecture 2 Overview Topics What I forgot from last lecture Proof techniques continued Alphabets, strings, languages Automata June 2, 2015 CSCE 355 Foundations.
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 A well-parenthesized string is a string with the same number of (‘s as )’s which has the property that every prefix of the string has at least as many.
P Symbol Q E(Q) a b a b a b Convert to a DFA: Start state: Final States:
1 Let S = { π : π is a permutation of {1, 2, 3, …, n} for some integer n ≥ 1 }. (a) List the elements of S for n= 1, 2, and 3. (b) Prove that the set S.
Languages and Strings Chapter 2. (1) Lexical analysis: Scan the program and break it up into variable names, numbers, etc. (2) Parsing: Create a tree.
1 Use the pumping theorem for context-free languages to prove that L= { a n b a n b a p : n, p ≥ 0, p ≥ n } is not context-free. Hint: For the pumping.
MA/CSSE 474 Theory of Computation Regular Expressions Intro.
Page 1. 1)Let B n = { a k | where k is a multiple of n}. I.e. B 1 = { a k | where k is a multiple of 1} = { a k | k Є {0,1,2,3,…}} = {‘’, a, aa, aaa, aaaa,
Regular Languages, Regular Operations, Closure
Languages.
Languages Prof. Busch - LSU.
Languages Costas Busch - LSU.
Formal Language & Automata Theory
Assume that p, q, and r are in
Closure Properties of Regular Languages
Convert to a DFA: Start state: Final States: State Symbol Read- Q E(Q)
Convert to a DFA: Start state: Final States: P Symbol Q E(Q) a b.
Chapter 1 Introduction to the Theory of Computation
CSC312 Automata Theory Lecture # 2 Languages.
Languages Fall 2018.
Presentation transcript:

1 String v is a prefix of w if w= v y for some string y. String v is a suffix of w if w= x v for some string x. String v is a substring of w if there are strings x and y such that w= x v y. The reversal of string w, denoted w R, is w “spelled backwards”. Problem of the Day: For w= abaa, what are its (a)prefixes, (b)suffixes, (c)substrings, and (d)what is w R ?

2 Announcements Assignment #1 is due at the beginning of class this Fri. May 25. Hand it in on paper (not electronically). Make sure you sign the class attendance sheet each class. If you are late, please sign it when you enter the room. If you want more time for our proof of the day, the notes are usually posted some time the night before or come to class early. Monday is a holiday (Victoria Day).

3 Assignment #1 is due next Friday. Any questions?

4 Operations on Languages: 1. Complement of L defined over Σ = = { w  Σ * : w is not in L } 2. Concatenation of Languages L 1 ۰ L 2 = L 1 L 2 = {w= x ۰ y for some x  L 1 and y  L 2 } 3. Kleene star of L, L * = { w= w 1 w 2 w 3 … w k for some k ≥ 0 and w 1, w 2, w 3, …,w k are all in L} 4. L + = L ۰ L * (Concatenate together one or more strings from L.)

= = Matrix multiplication: Concatenation: ab ۰ bb = abbb bb ۰ ab = bbab

6 Σ * = set of all strings over alphabet Σ Language over Σ – any subset of Σ * Examples: Σ = {0, 1} L 1 = { w  Σ * : w has an even number of 0’s} L 2 = { w  Σ * : w is the binary representation of a prime number with no leading zeroes} L 3 = Σ * L 4 = { } = Φ L 5 = { ε }

7 L 2 = {w  {0,1}* : w is the binary representation of a prime with no leading zeroes} The complement is: {w  {0,1}* : w is the binary representation of a number which is not prime which has no leading 0’s or w starts with 0} Note: 1 is not prime or composite. The string 1 is in the complement since it is not in L.

8 L 1 = {a, ab} L 2 = {ab, b, bb} What are (a) L 1 ⋃ L 2 ? (b) L 1 ⋂ L 2 ? (c) L 1 ⋅ L 2 ? (d) L 1 - L 2 ? (e) L 1 * ? (f) Φ ⋅ L 2 ? (g) { ε} ⋅ L 2 ?

9 Describe using set descriptor notation, describe the complements of these languages: (a) L a = { , a, aa, aaa} over ∑ = {a} (b) L b = { , a, aa, aaa} over ∑ = {a,b} (c) L c = {0,1}* {0010} {0,1}* over ∑={0,1} (d) L d = {001} {0,1}* over ∑={0,1} (e) L e = {0,1}* {1101} over ∑={0,1}

10 Regular Languages over Alphabet Σ: [Basis] 1. Φ and {σ} for each σ  Σ are regular languages. [Inductive step] If L 1 and L 2 are regular languages, then so are: 2. L 1 ۰ L 2, 3. L 1 ⋃ L 2, and 4. L 1 *.

11 Regular expressions over Σ: [Basis] 1. Φ and σ for each σ  Σ are regular expressions. [Inductive step] If α and β are regular expressions, then so are: 2. ( αβ) 3. (α ⋃ β) and 4. α * Note: Regular expressions are strings over Σ ⋃ { (, ), Φ, ⋃, * } for some alphabet Σ.

12 Precedence of Operators Exponents Multiplication Addition Kleene star Concatenation Union highest ⇩ lowest

13 Prove the following languages over Σ={0,1} are regular by giving regular expressions for them: 1. {w: w has odd length} 2. {w: w contains 0011} 3. {w: w does not contain 01} 4. {w: w starts and ends with the same symbol (|w| ≥ 1)}

14 TUTORIAL: L = { w an element of {a,b}* : w has both baa and aaba as a substring }. (a|b)*baa(a|b)*aaba(a|b)*|(a|b)*aaba(a|b)*baa(a|b)* MISSING: aabaa, baaba, … See home page for link to regular expression tutorial