fall 2006costas busch - rpi1 regular expressions

Download Fall 2006Costas Busch - RPI1 Regular Expressions

Post on 19-Dec-2015

212 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

  • Slide 1
  • Fall 2006Costas Busch - RPI1 Regular Expressions
  • Slide 2
  • Fall 2006Costas Busch - RPI2 Regular Expressions Regular expressions describe regular languages Example: describes the language
  • Slide 3
  • Fall 2006Costas Busch - RPI3 Recursive Definition Are regular expressions Primitive regular expressions: Given regular expressions and
  • Slide 4
  • Fall 2006Costas Busch - RPI4 Examples A regular expression: Not a regular expression:
  • Slide 5
  • Fall 2006Costas Busch - RPI5 Languages of Regular Expressions : language of regular expression Example
  • Slide 6
  • Fall 2006Costas Busch - RPI6 Definition For primitive regular expressions:
  • Slide 7
  • Fall 2006Costas Busch - RPI7 Definition (continued) For regular expressions and
  • Slide 8
  • Fall 2006Costas Busch - RPI8 Example Regular expression:
  • Slide 9
  • Fall 2006Costas Busch - RPI9 Example Regular expression
  • Slide 10
  • Fall 2006Costas Busch - RPI10 Example Regular expression
  • Slide 11
  • Fall 2006Costas Busch - RPI11 Example Regular expression = { all strings containing substring 00 }
  • Slide 12
  • Fall 2006Costas Busch - RPI12 Example Regular expression = { all strings without substring 00 }
  • Slide 13
  • Fall 2006Costas Busch - RPI13 Equivalent Regular Expressions Definition: Regular expressions and are equivalent if
  • Slide 14
  • Fall 2006Costas Busch - RPI14 Example = { all strings without substring 00 } and are equivalent regular expressions
  • Slide 15
  • Fall 2006Costas Busch - RPI15 Regular Expressions and Regular Languages
  • Slide 16
  • Fall 2006Costas Busch - RPI16 Theorem Languages Generated by Regular Expressions Regular Languages
  • Slide 17
  • Fall 2006Costas Busch - RPI17 Languages Generated by Regular Expressions Regular Languages Generated by Regular Expressions Regular Languages Proof:
  • Slide 18
  • Fall 2006Costas Busch - RPI18 Proof - Part 1 For any regular expression the language is regular Languages Generated by Regular Expressions Regular Languages Proof by induction on the size of
  • Slide 19
  • Fall 2006Costas Busch - RPI19 Induction Basis Primitive Regular Expressions: Corresponding NFAs regular languages
  • Slide 20
  • Fall 2006Costas Busch - RPI20 Inductive Hypothesis Suppose that for regular expressions and, and are regular languages
  • Slide 21
  • Fall 2006Costas Busch - RPI21 Inductive Step We will prove: Are regular Languages
  • Slide 22
  • Fall 2006Costas Busch - RPI22 By definition of regular expressions:
  • Slide 23
  • Fall 2006Costas Busch - RPI23 By inductive hypothesis we know: and are regular languages Regular languages are closed under: Union Concatenation Star We also know:
  • Slide 24
  • Fall 2006Costas Busch - RPI24 Therefore: Are regular languages is trivially a regular language (by induction hypothesis) End of Proof-Part 1
  • Slide 25
  • Fall 2006Costas Busch - RPI25 Using the regular closure of these operations, we can construct recursively the NFA that accepts Example:
  • Slide 26
  • Fall 2006Costas Busch - RPI26 For any regular language there is a regular expression with Proof - Part 2 Languages Generated by Regular Expressions Regular Languages We will convert an NFA that accepts to a regular expression
  • Slide 27
  • Fall 2006Costas Busch - RPI27 Since is regular, there is a NFA that accepts it Take it with a single final state
  • Slide 28
  • Fall 2006Costas Busch - RPI28 From construct the equivalent Generalized Transition Graph in which transition labels are regular expressions Example: Corresponding Generalized transition graph
  • Slide 29
  • Fall 2006Costas Busch - RPI29 Another Example: Transition labels are regular expressions
  • Slide 30
  • Fall 2006Costas Busch - RPI30 Reducing the states: Transition labels are regular expressions
  • Slide 31
  • Fall 2006Costas Busch - RPI31 Resulting Regular Expression:
  • Slide 32
  • Fall 2006Costas Busch - RPI32 In General Removing a state:
  • Slide 33
  • Fall 2006Costas Busch - RPI33 The resulting regular expression: By repeating the process until two states are left, the resulting graph is Initial graphResulting graph End of Proof-Part 2
  • Slide 34
  • Fall 2006Costas Busch - RPI34 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions
  • Slide 35
  • Fall 2006Costas Busch - RPI35 When we say: We are given a Regular Language We mean:Language is in a standard representation (DFA, NFA, or Regular Expression)

Recommended

View more >