Minimising FSAs Regular Expressions - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

Minimising FSAs Regular Expressions

Description:

the set Q from remove edge choices is: { {4,5}, {2,4,5}, {2,3,4,5}, {1,2,3,4,5} ... Can we come up with a simpler method of specifying languages, in a style that we ... – PowerPoint PPT presentation

Number of Views:20
Avg rating:3.0/5.0
Slides: 11
Provided by: kenb97
Category:

less

Transcript and Presenter's Notes

Title: Minimising FSAs Regular Expressions


1
Minimising FSAs /Regular Expressions
size of FSAs minimal FSAs Definition of regular
expressions
2
How small can a FSA be?
  • two strings x and y are distinguishable with
    respect to (w.r.t.) a machine A if there is a
    string z such that (s.t.) exactly one of xz and
    yz are in L(A)
  • Let L be a language, L? T
  • if there are n elements of T s.t. any two are
    distinguishable w.r.t. a machine A, then any
    machine that recognises L must have at least n
    states
  • Thus for any language, there is a minimum size
    for FSAs

3
Unique minimal FSAs
Theorem minimal FSAs For any language defined by
a FSA, there exists a unique FSA of minimum size,
and an algorithm to produce it
  • Informal Algorithm
  • Input A (Q,I,F,T,E)
  • 1. reverse A to get A'
  • 2. run remove edge choices on A' to get
    (Q',I',F',T,E')
  • 3. merge all states in A that always appear
    together in Q'

4
Example minimisation
a
2
b
4
a
b
1
a
b
a
b
b
a
5
3
5
Example Minimisation
a
a
2
b
4
2
b
4
a
a
b
b
1
b
1
a
a
b
a
a
b
b
b
b
a
a
5
3
5
3
reversed
the set Q from remove edge choices is 4,5,
2,4,5, 2,3,4,5, 1,2,3,4,5 4 5 always
appear together
2
a,b
a
1
a,b
4,5
a
b
b
3
6
Specifying Languages
  • Our aim is to be able to specify languages for
    use in the computer
  • the FSA sketch is easy for us to understand, but
    difficult to input to a computer
  • the FSA formal description is unpleasant, and
    difficult to write
  • Can we come up with a simpler method of
    specifying languages, in a style that we can
    write down in text?

7
Regular Expressions
  • A regular expression over an alphabet T defines a
    language
  • ? denotes ?, ? denotes , and t denotes t
    for t ? T
  • if r and s a re regular expressions denoting R
    and S, then
  • r s denotes R ?S
  • rs denotes RS
  • r denotes R
  • nothing else is a regular expression over T
  • interpret st as s(t)
  • interpret st as s (t)
  • interpret r st as r (st)

8
Regular Languages
  • A language over T is regular if there is a
    regular expression denoting it.
  • If A and B are regular languages, so are A?B, AB
    and A
  • If A and B are regular languages, so are A?B and
    A'
  • Any finite language is regular.

9
Example regular expressions
  • All binary numbers with no leading 0s
  • All strings over a,b with a substring of aa or
    bb
  • All strings over 0,1 not containing two
    adjacent 0s
  • All strings over 0,1 with exactly one 00
    substring

10
Next lecture
Comparing Regular Expressions and Finite State
Automata...
Write a Comment
User Comments (0)
About PowerShow.com