Provide a regular expression for the following expressions - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

Provide a regular expression for the following expressions

Description:

... i in such a way that the pumped string is not in L. We win if ... We have to show the pumped string does not belong to the original language, not the chosen s. ... – PowerPoint PPT presentation

Number of Views:22
Avg rating:3.0/5.0
Slides: 20
Provided by: ccGa
Category:

less

Transcript and Presenter's Notes

Title: Provide a regular expression for the following expressions


1
3240
2
Provide a regular expression for the following
expressions
  • All strings on a, b, c which contain no run of
    as of length greater than two
  • Tip
  • Come up with all sequences of a, b, c that have
    at most 2 as
  • Then produce all permutations

It should end thought with a or aa
Produce all permutations
3
Provide a regular expression for the following
expressions
  • W is any string in 0,1 except 11 and 111
  • Tip Enumerate any string up to length 3 and
    produce all strings of length greater than 3

What is the DFA?
4
Provide a regular expression for the following
expressions
All strings of lowercase letters that begin and
end with a
a alone start end ends with a ?
5
Regular expressions tips
  • Common mistakes
  • Do not write a regular expression for perl, sed
    They do not follow the formalities of typical
    regular expressions
  • Symbols allowed , , ?, range
  • Tips
  • Expressions like 11,111 are wrong, which is
    the alphabet?

6
Regural expressions to NFAs
  • Produce an NFA for the following regular
    expression 0(001)1

NFA that accepts 0
NFA that accepts (001)
Final NFA
7
NFA to DFA
8
NFA to DFA
9
DFA-minimization
  • Group states into accepting and nonaccepting
  • If a transition from a group G goes to more than
    one groups, then split G
  • Repeat until no further splitting occurs

Accepting group 2,3
No-Accepting group 1
(d(1,a), d(2,a))(2,e) (d(1,b), d(2,b))(3,3)
(d(1,a), d(3,a))(2,e) (d(1,b), d(3,b))(3,3)
(d(2,a), d(3,a))(e,e) (d(2,b), d(3,b))(3,3)
10
Advices for common mistakes
  • Dont miss empty string (e)
  • Dont miss two epsilon transitions to denote in
    DFA
  • Dont use reg.exp. In transition edges.
  • Dont miss final states (double-circle)
  • Please write clearlyneatly!!

11
Funny game
  • We cannot claim that we have reached a
    contradiction just because the pumping lemma is
    violated for some specific values of p or xyz
  • The pumping lemma is violated even for one w or i.

12
Funny game
  • The opponent picks p
  • Given p, we pick a string w in L.
  • Length gt p
  • The opponent chooses the decomposition xyz,
    subject to xyltp, ygt1.
  • We have to assume that the opponent makes the
    choice that will make it hardest for us to win
    the game
  • We try to pick i in such a way that the pumped
    string is not in L.
  • We win if we can do.

13
HW3-1.29b
  • Lwww. Assume that L is regular, so that the
    pumping lemma must hold.
  • Opponent choose p
  • We Whatever it is, we can choose s to be
    apbapbapb where wap.
  • Opponent choose xyz decomposition
  • We Whatever it is, y should consist of only as
    since xyp. The lemma says any pumped strings
    should belong to the language. However, with i0,
    the string ap-ybapbapb doesnt belong to L
    clearly. This is contradiction. Thus L is
    non-regular.

14
Funny game
  • We dont choose xyz decomposition, but the
    opponent does.
  • Condition 3 is our friend. We dont want to
    violate it. We want to use it.
  • We have to show the pumped string does not belong
    to the original language, not the chosen s.

15
HW3-1.46a
  • L0n1m0n m,n 0
  • Assume that L is regular. Let the string s
    0p10p. Then y should consist of only 0s. With
    i0, the string 0p-y10p doesnt belong to L
    clearly. This is contradiction.
  • Alternatively, let A010. Then AnB 0n10n
    C. If we assume A and B to be regular, then C
    must be regular. Proving that C is not regular
    will in turn prove that A is not regular because
    B is regular.

16
Alternative ways
  • Closure under simple operations
  • Yes. Union, complement, so on.
  • Subset relation?
  • No
  • Too few states for DNA?
  • Not for proof

17
HW3-1.46c
  • Lnot palindrome
  • Assume that L is regular, then its complement, L
    w w?0,1 is a palindrome, should be
    regular. Let the string s 0p10p xyz with
    xyp and y1. Then y should consist of only
    0s. With i0, the string 0p-y10p is not a
    palindrome. This is contradiction. Therefore, L
    is nonregular.
  • Since L is nonregular, L is nonregular

18
HW3-1.46d
  • Lwtw
  • Assume that L is regular. Let the string s
    0p100p1, where w0p1, t0. Since xyp, y must
    consist of only 0s. Let y be 0k where k1. Then
    the string 0p-kki100p1 for any i should belong
    to L.
  • Does this belong to L?
  • In this case, w should end with 1 since the whole
    string ends with 1. Therefore w must be
    0p-kki1. This is not true for i2.

19
HW3-1.49b
  • L0ky, y has at most k 0s
  • Let the string s 1p0p1p. This makes y consist
    of only 1s. For i0, the number of 1s before 0
    becomes fewer than that of 1s after 0. This
    doesnt belong to the original language, thus we
    have contradiction.
Write a Comment
User Comments (0)
About PowerShow.com