CS355 - Theory of Computation - PowerPoint PPT Presentation

About This Presentation
Title:

CS355 - Theory of Computation

Description:

Finite automaton are powerful machines but they do have limitations. There are some languages that can not be recognised by any finite automaton. ... – PowerPoint PPT presentation

Number of Views:12
Avg rating:3.0/5.0
Slides: 15
Provided by: scienc
Category:

less

Transcript and Presenter's Notes

Title: CS355 - Theory of Computation


1
CS355 - Theory of Computation
  • Regular Expressions

2
Regular Expressions
  • In maths one can use operations and to build
    up expressions like (12 5) 2 ( 34)
  • Similarly, can build regular operations to build
    expressions describing languages.
  • An example is (0 1)1 a language!!
  • In this case it is the language consisting of all
    strings starting with a 0 or 1 followed by zero
    or more 1s (1 ).

3
Regular Expressions
  • We let R represent RR
  • In other words, R has all strings that are one
    or more concatenation of strings from R i.e. RR
  • (01) w every 0 in w is followed by at
    least one 1

4
Regular Expressions
  • Which of these are value languages for the
    regular expression (00)1(0 1)?
  • 0, 1, 010, 0010, 000011, 0011010, 0000101010
  • 0 No - must be at least one 1
  • 1 Yes
  • 010 No must be two 0s
  • 0010 Yes
  • 000011 Yes
  • 0011010 Yes
  • 0000101010 Yes

5
Regular Expressions
  • In regular expression shorthand is used and
    concatenation symbol ( )is not used
  • (0 1)0 is shorthand for (0 1) 0
  • The precedence order in regular expressions is
    star operation, concatenation and then union,
    unless parentheses are used to change the order.

6
Regular Expressions
  • The expression (0 1) is the language
    consisting of all possible strings of 0s and
    1s.
  • If the alphabet S 0,1, we can write S as
    shorthand for (0 1) .
  • If S is any alphabet, the regular expression S
    describes the language of all strings of length
    1.
  • S is the language of all strings over the
    alphabet.
  • S0 is the language that contains all strings
    ending in a 0.
  • The language (0S) (S1) consists of all
    strings that either start with a 0 or end with a
    1.

7
Regular Expression
  • A language is regular if some regular expression
    describes it.

8
Nonregular Languages
  • Finite automaton are powerful machines but they
    do have limitations.
  • There are some languages that can not be
    recognised by any finite automaton.
  • At first glance some languages may seem regular
    but are in fact nonregular and vice versa!!!

9
Pumping Lemma
  • Pumping Lemma is a technique used to show that if
    a language does not have a special property then
    it is not regular.
  • The property states that all strings in the
    language can be pumped and still belong to that
    class
  • A language can be pumped if any sufficiently long
    string, having length at least the pumping
    length, in the language can be broken into pieces
    that can be repeated to produce an even longer
    string in the language.

10
Pumping Lemma
  • Thus, if there is a pumping lemma for a given
    language class, any language in the class will
    contain an infinite set of finite strings all
    produced by a simple rule given by the lemma.

11
Pumping Lemma - Theorem
  • If A is a regular language, then there is a
    number p (the pumping length) where, if s is any
    string in A of length at least p, then s may be
    divided into three pieces, s xyz, satisfying
    the following conditions
  • For each i 0, xyiz A,
  • y gt 0, and
  • xy p.
  • x or z may be e, but condition 2 does not allow
    y to be e.

12
Pumping Lemma to prove a language is not regular
  • Assume language B is regular in order to obtain a
    contradiction.
  • Use pumping lemma to guarantee existence of a
    pumping length p such that all strings of length
    p or greater in B can be pumped.
  • Find a string in B that has length p or greater
    but that cannot be pumped.
  • Finally, demonstrate that s cant be pumped by
    considering all ways of dividing s into x, y and
    z and for each such division, finding a value i
    where xyiz B.
  • Let us look at examples of this.

13
Limitations of the Pumping Lemma
  • The Pumping Lemma can be used to prove that a
    language is not regular, however, it cant be
    used to prove that a language is regular.
  • Just because you cant think up the right string
    does not mean that someone else cant.

14
Examples
  • Examples.
  • Think about
  • Is L 0ix i 0, x 0,1 and x i
    regular?
  • Is L 0i i is prime regular?
Write a Comment
User Comments (0)
About PowerShow.com