1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2010.

Slides:



Advertisements
Similar presentations
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
Advertisements

1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 2 School of Innovation, Design and Engineering Mälardalen University 2011.
YES-NO machines Finite State Automata as language recognizers.
1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.
1 CSCI-2400 Models of Computation. 2 Computation CPU memory.
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
Regular Languages Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 3 Comments, additions and modifications.
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.
Fall 2004COMP 3351 Single Final State for NFA. Fall 2004COMP 3352 Any NFA can be converted to an equivalent NFA with a single final state.
1 Languages and Finite Automata or how to talk to machines...
1 Single Final State for NFAs and DFAs. 2 Observation Any Finite Automaton (NFA or DFA) can be converted to an equivalent NFA with a single final state.
Costas Busch - RPI1 Mathematical Preliminaries. Costas Busch - RPI2 Mathematical Preliminaries Sets Functions Relations Graphs Proof Techniques.
Courtesy Costas Busch - RPI1 Mathematical Preliminaries.
Theoretical Computer Science COMP 335 Fall 2004
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 A Single Final State for Finite Accepters. 2 Observation Any Finite Accepter (NFA or DFA) can be converted to an equivalent NFA with a single final.
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.
Finite-State Machines with No Output
Theory Of Automata By Dr. MM Alam
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,
1 Chapter 1 Automata: the Methods & the Madness Angkor Wat, Cambodia.
Formal Methods in SE Theory of Automata Qasiar Javaid Assistant Professor Lecture # 06.
Mathematical Preliminaries Strings and Languages Preliminaries 1.
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.
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
1 Chapter 1 Introduction to the Theory of Computation.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2006.
Module 2 How to design Computer Language Huma Ayub Software Construction Lecture 8.
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:
L ECTURE 3 Chapter 4 Regular Expressions. I MPORTANT T ERMS Regular Expressions Regular Languages Finite Representations.
Recursive Definitions & Regular Expressions (RE)
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
Regular Expressions and Languages A regular expression is a notation to represent languages, i.e. a set of strings, where the set is either finite or contains.
Strings and Languages CS 130: Theory of Computation HMU textbook, Chapter 1 (Sec 1.5)
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.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 2 School of Innovation, Design and Engineering Mälardalen University 2012.
CSC312 Automata Theory Lecture # 3 Languages-II. Formal Language A formal language is a set of words—that is, strings of symbols drawn from a common alphabet.
CS 203: Introduction to Formal Languages and Automata
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.
Theory of computation Introduction theory of computation: It comprises the fundamental mathematical properties of computer hardware, software,
Lecture # 4.
Transparency No. 2-1 Formal Language and Automata Theory Homework 2.
Finite Automata Great Theoretical Ideas In Computer Science Victor Adamchik Danny Sleator CS Spring 2010 Lecture 20Mar 30, 2010Carnegie Mellon.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
 2004 SDU Lecture4 Regular Expressions.  2004 SDU 2 Regular expressions A third way to view regular languages. Say that R is a regular expression if.
Finite Automata A simple model of computation. 2 Finite Automata2 Outline Deterministic finite automata (DFA) –How a DFA works.
Week 13 - Wednesday.  What did we talk about last time?  Exam 3  Before review:  Graphing functions  Rules for manipulating asymptotic bounds  Computing.
Set, Alphabets, Strings, and Languages. The regular languages. Clouser properties of regular sets. Finite State Automata. Types of Finite State Automata.
Lecture 03: Theory of Automata:2014 Asif Nawaz Theory of Automata.
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.
Theory of Computation Lecture #
Languages.
Languages Prof. Busch - LSU.
Languages Costas Busch - LSU.
REGULAR LANGUAGES AND REGULAR GRAMMARS
Introduction Reading: Sections 1.5 – 1.7.
Chapter 1 Introduction to the Theory of Computation
CSC312 Automata Theory Lecture # 2 Languages.
Languages Fall 2018.
CSCE 355 Foundations of Computation
Presentation transcript:

1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2010

2 Content Languages, Alphabets and Strings Strings & String Operations Languages & Language Operations Regular Expressions Finite Automata, FA Deterministic Finite Automata, DFA

3 Languages, Alphabets and Strings

4 defined over an alphabet: Languages A language is a set of strings A String is a sequence of letters An alphabet is a set of symbols

5 Alphabets and Strings We will use small alphabets: Strings

6 Operations on Strings

7 String Operations m n bbbv aaaw     y  bbbaaa x  abba Concatenation (sammanfogning) xy  abbabbbaaa

8 Reverse (reversering) Example: Longest odd length palindrome in a natural language: saippuakauppias (Finnish: soap salesman)

9 String Length Length: Examples:

10 Recursive Definition of Length For any letter: For any string : Example:

11 Length of Concatenation   vuuv aababaabuv 5, 3,   vabaabv uaabu Example:

12 Proof of Concatenation Length Claim: Proof: By induction on the length Induction basis: From definition of length:

13 Inductive hypothesis: Inductive step: we will prove for

14 Inductive Step Write, where From definition of length: From inductive hypothesis: Thus: END OF PROOF

15 Empty String A string with no letters: (Also denoted as  ) Observations:

16 Substring (delsträng) Substring of a string: a subsequence of consecutive characters String Substring

17 Prefix and Suffix Suffixes prefix suffix Prefixes

18 Repetition Example: Definition: n n  } (String repeated n times)

19 The (Kleene* star) Operation the set of all possible strings from alphabet [* Kleene is pronounced "clay-knee“]

20 The + (Kleene plus) Operation : the set of all possible strings from the alphabet except ,ba  ,,,,,,,,,*aabaaabbbaabaaba  

21 Example    *, oj, fy, usch, ojoj, fyfy,uschusch, ojfy, ojusch     *  ,fyoj , usch    oj, fy, usch, ojoj, fyfy,uschusch, ojfy, ojusch   

22 Operations on Languages

23 Language A language is any subset of Example: Languages:   ,,,,,,,,*, aaabbbaabaaba ba     },,,,,{,, aaaaaaabaababaabba aabaaa

24 Example An infinite language

25 Operations on Languages The usual set operations  ,,,,,,,,,*aabaaabbbaabaaba  Complement:

26 Reverse Examples: Definition:

27 Concatenation Definition: Example

28 Repeat Definition: Special case:

29 Example

30 Star-Closure (Kleene *) Definition: Example:

31 Positive Closure Definition   *L    2 1 L LL 

32 Regular Expressions

33 Regular Expressions: Recursive Definition are Regular Expressions Primitive regular expressions: Given regular expressions and

34 Examples A regular expression: Not a regular expression:

35 Zero or more. a* means "zero or more a's." To say "zero or more ab's," that is, {, ab, abab, ababab,...}, you need to say (ab)*. ab* denotes {a, ab, abb, abbb, abbbb,...}. Building Regular Expressions

36 One or more. Since a* means "zero or more a's", you can use aa* (or equivalently, a*a) to mean "one or more a's.“ Similarly, to describe "one or more ab's," that is, {ab, abab, ababab,...}, you can use ab(ab)*. Building Regular Expressions

37 Any string at all. To describe any string at all (with = {a, b, c}), you can use (a+b+c)*. Any nonempty string. This can be written as any character from followed by any string at all: (a+b+c)(a+b+c)*. Building Regular Expressions

38 Any string not containing.... To describe any string at all that doesn't contain an a (with = {a, b, c}), you can use (b+c)*. Any string containing exactly one... To describe any string that contains exactly one a, put "any string not containing an a," on either side of the a, like this: (b+c)*a(b+c)*. Building Regular Expressions

39 Languages of Regular Expressions Example language of regular expression

40 Definition For primitive regular expressions:

41 Definition (continued) For regular expressions and

42 Example Regular expression:

43 Example Regular expression

44 Example Regular expression

45 Example Regular expression  { all strings with at least two consecutive 0 }

46 Example Regular expression (consists of repeating 1’s and 01’s). = { all strings without two consecutive 0 }

47 Example = { all strings without two consecutive 0 } (In order not to get 00 in a string, after each 0 there must be an 1, which means that strings of the form are repeated. That is the first parenthesis. To take into account strings that end with 0, and those consisting of 1’s solely, the rest of the expression is added.) Equivalent solution:

48 Equivalent Regular Expressions Regular expressions and are equivalent if Definition:

49 Example = { all strings without two consecutive 0 } and are equivalent regular expressions.

Additional Sources Lennart Salling Introduktion movie.mov.mov Program, strings, integers and integer functions.mov.mov Different infinities and integer functions that can not be calculated by a program.mov.mov Strings and languages.mov Regular languages and regular expressions.mov.mov 50