CS 461 - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

CS 461

Description:

Title: PowerPoint Presentation Created Date: 1/1/1601 12:00:00 AM Document presentation format: On-screen Show (4:3) Other titles: Arial Wingdings Default Design CS ... – PowerPoint PPT presentation

Number of Views:26
Avg rating:3.0/5.0
Slides: 12
Provided by: fur104
Learn more at: http://cs.furman.edu
Category:
Tags: about | powerpoint

less

Transcript and Presenter's Notes

Title: CS 461


1
CS 461 Sept. 2
  • Review NFA ? DFA
  • Combining FAs to create new languages
  • union, intersection, concatenation, star
  • We can basically understand how these work by
    drawing a picture.
  • Section 1.3 Regular expressions
  • A compact way to define a regular set, rather
    than drawing an FA or writing transition table.

2
Example 2
  • NFA transition table given to the right.
  • DFA start state is A.
  • DFA accept state would be anything containing D.

inputs inputs inputs
State 0 1 e
?A A A,C -
B D - C
C - B -
D ? B D -
3
continued
  • Lets begin.
  • d(A, 0) A
  • d(A, 1) AC
  • We need new state AC.
  • d(AC, 0) A
  • d(AC, 1) ABC
  • Continue from ABC

inputs inputs inputs
State 0 1 e
?A A A,C -
B D - C
C - B -
D ? B D -
4
answer
  • NFA
  • DFA

inputs inputs inputs
State 0 1 e
?A A A,C -
B D - C
C - B -
D ? B D -
inputs inputs
State 0 1
?A A AC
AC A ABC
ABC AD ABC
AD ? ABC ACD
ACD ? ABC ABCD
ABCD ? ABCD ABCD
5
Moral
  • NFAs and DFAs have same computational power.
  • NFAs often have fewer states than corresponding
    DFA.
  • Typically, we want to design a DFA, but NFAs are
    good for combining 2 DFAs.
  • After doing NFA ? DFA construction, we may see
    that some states can be combined.
  • Later in chapter, well see how to simplify FAs.

6
U and n
  • Suppose M1 and M2 are DFAs. We want to combine
    their languages.
  • Union We create new start state. v
  • Do you understand formalism p. 60 ?
  • How can we also do intersection?
  • Hint A n B (A U B)

7
Concatenation
  • Concat For each happy state in M1, turn it into
    a reject state and add e-trans to M2s start.
  • Example
  • L1 does not contain 00
  • L2 has even of 1s
  • Lets draw NFA for L1L2.
  • Lets decipher formal definition of d on p. 61.

8
Star
  • We want to concat the language with itself 0
    times.
  • Create new start state, and make it happy.
  • Add e-transitions from other happy states to the
    start state.
  • Example
  • L begins with 1 and ends with 0
  • Lets draw NFA for L.
  • Formal definition of d on p. 63.

9
Regular expression
  • A concise way to describe a language
  • Text representation, straightforward to input
    into computer programs.
  • Use alphabet symbols along with operators
  • means or
  • means repetition
  • Concatenation
  • There is no and or complement.

10
Examples
  • What do you think these regular expressions mean?
  • 0 1
  • 01
  • 0011 (a shorthand would be 01 )
  • (0 1)
  • Whats the difference between 101 and 1(01)1 ?
    Does this mean anything with 1 at beginning and
    end?

11
Practice
  • Words with 2 or more 0s. Whats wrong with this
    answer 10101 ?
  • Words containing substring 110.
  • Every even numbered symbol is 0.
  • Whats wrong with ((0 1)0) ?
  • Words of even length.
  • The last 2 symbols are the same.
  • What is the shortest word not in 1(01)0 ?
  • True or false (111) (11 111)
Write a Comment
User Comments (0)
About PowerShow.com