formal languages
play

Formal Languages Philippe de Groote 2018-2019 Philippe de Groote - PowerPoint PPT Presentation

Formal Languages Philippe de Groote 2018-2019 Philippe de Groote Formal Languages 2018-2019 1 / 28 Outline Regular expressions and regular languages 3 Definition Some algebraic properties From regular expressions to FSA From FSA to


  1. Formal Languages Philippe de Groote 2018-2019 Philippe de Groote Formal Languages 2018-2019 1 / 28

  2. Outline Regular expressions and regular languages 3 Definition Some algebraic properties From regular expressions to FSA From FSA to type-3 grammars From type-3 grammars to regular expressions Philippe de Groote Formal Languages 2018-2019 2 / 28

  3. Regular expressions and regular languages Definition Definition The set of regular epressions over an alphabet Σ is inductively defined as follows: 0 is a regular expression; 1 is a regular expression; every symbol a ∈ Σ is a regular expression; if α is a regular expression so is α ∗ ; if α and β are regular expressions so is ( α · β ) ; if α and β are regular expressions so is ( α + β ) ; Philippe de Groote Formal Languages 2018-2019 3 / 28

  4. Regular expressions and regular languages Definition Definition The set of regular epressions over an alphabet Σ is inductively defined as follows: 0 is a regular expression; 1 is a regular expression; every symbol a ∈ Σ is a regular expression; if α is a regular expression so is α ∗ ; if α and β are regular expressions so is ( α · β ) ; if α and β are regular expressions so is ( α + β ) ; We write rexp(Σ) for the set of regular epressions over Σ . Philippe de Groote Formal Languages 2018-2019 3 / 28

  5. Regular expressions and regular languages Definition Definition Language defined by a regular epressions: L (0) = ∅ ; L (1) = { ǫ } ; L ( a ) = { a } for every a ∈ Σ ; L ( α ∗ ) = L ( α ) ∗ ; L ( α · β ) = L ( α ) · L ( β ) ; L ( α + β ) = L ( α ) ∪ L ( β ) . Philippe de Groote Formal Languages 2018-2019 4 / 28

  6. Regular expressions and regular languages Some algebraic properties Some algebraic properties ( α + β ) + γ = α + ( β + γ ) α + 0 = α 0 + α = α α + β = β + α α + α = α ( α · β ) · γ = α · ( β · γ ) α · 1 = α 1 · α = α α · 0 = 0 0 · α = 0 α · ( β + γ ) = α · β + α · γ ( α + β ) · γ = α · γ + β · γ Philippe de Groote Formal Languages 2018-2019 5 / 28

  7. Regular expressions and regular languages Some algebraic properties Some algebraic properties 0 ∗ = 1 1 ∗ = 1 ( α ∗ ) ∗ = α ∗ 1 + α · ( α ∗ ) = α ∗ 1 + α ∗ · α = α ∗ Philippe de Groote Formal Languages 2018-2019 6 / 28

  8. Regular expressions and regular languages From regular expressions to FSA From regular expressions to FSA Automaton accepting L (0) Philippe de Groote Formal Languages 2018-2019 7 / 28

  9. Regular expressions and regular languages From regular expressions to FSA From regular expressions to FSA Automaton accepting L (0) Automaton accepting L (1) : ǫ Philippe de Groote Formal Languages 2018-2019 7 / 28

  10. Regular expressions and regular languages From regular expressions to FSA From regular expressions to FSA Automaton accepting L (0) Automaton accepting L (1) : ǫ Automaton accepting L ( a ) : a Philippe de Groote Formal Languages 2018-2019 7 / 28

  11. Regular expressions and regular languages From regular expressions to FSA From regular expressions to FSA Assuming we have an automaton accepting L ( α ) : α Philippe de Groote Formal Languages 2018-2019 8 / 28

  12. Regular expressions and regular languages From regular expressions to FSA From regular expressions to FSA Assuming we have an automaton accepting L ( α ) : α Automaton accepting L ( α ∗ ) : ǫ α ǫ ǫ ǫ Philippe de Groote Formal Languages 2018-2019 8 / 28

  13. Regular expressions and regular languages From regular expressions to FSA From regular expressions to FSA Assuming we have automata accepting L ( α ) and L ( β ) : α β Philippe de Groote Formal Languages 2018-2019 9 / 28

  14. Regular expressions and regular languages From regular expressions to FSA From regular expressions to FSA Assuming we have automata accepting L ( α ) and L ( β ) : α β Automaton accepting L ( α · β ) : α ǫ β Philippe de Groote Formal Languages 2018-2019 9 / 28

  15. Regular expressions and regular languages From regular expressions to FSA From regular expressions to FSA Assuming we have automata accepting L ( α ) and L ( β ) : α β Philippe de Groote Formal Languages 2018-2019 10 / 28

  16. Regular expressions and regular languages From regular expressions to FSA From regular expressions to FSA Assuming we have automata accepting L ( α ) and L ( β ) : α β Automaton accepting L ( α + β ) : α ǫ ǫ ǫ ǫ β Philippe de Groote Formal Languages 2018-2019 10 / 28

  17. Regular expressions and regular languages From FSA to type-3 grammars From FSA to type-3 grammars Let A = � Q, Σ , δ, q 0 , F � be an DFSA. Define a type-3 grammar G = � N, Σ G , P, S � as follows: N = Q Σ G = Σ P = { A → aB : δ ( A, a ) = B } ∪ { A → ǫ : A ∈ F } S = q 0 Philippe de Groote Formal Languages 2018-2019 11 / 28

  18. Regular expressions and regular languages From FSA to type-3 grammars From FSA to type-3 grammars Let A = � Q, Σ , δ, q 0 , F � be an DFSA. Define a type-3 grammar G = � N, Σ G , P, S � as follows: N = Q Σ G = Σ P = { A → aB : δ ( A, a ) = B } ∪ { A → ǫ : A ∈ F } S = q 0 Proposition L ( A ) = L ( G ) . Philippe de Groote Formal Languages 2018-2019 11 / 28

  19. Regular expressions and regular languages From FSA to type-3 grammars From FSA to type-3 grammars PROOF: Philippe de Groote Formal Languages 2018-2019 12 / 28

  20. Regular expressions and regular languages From FSA to type-3 grammars From FSA to type-3 grammars PROOF: We prove by induction on the length of α that A ⇒ ∗ α if and only if ˆ δ ( A, α ) ∈ F . Philippe de Groote Formal Languages 2018-2019 12 / 28

  21. Regular expressions and regular languages From FSA to type-3 grammars From FSA to type-3 grammars PROOF: We prove by induction on the length of α that A ⇒ ∗ α if and only if ˆ δ ( A, α ) ∈ F . Basis : Philippe de Groote Formal Languages 2018-2019 12 / 28

  22. Regular expressions and regular languages From FSA to type-3 grammars From FSA to type-3 grammars PROOF: We prove by induction on the length of α that A ⇒ ∗ α if and only if ˆ δ ( A, α ) ∈ F . Basis : A ⇒ ∗ ǫ iff A ⇒ ǫ Philippe de Groote Formal Languages 2018-2019 12 / 28

  23. Regular expressions and regular languages From FSA to type-3 grammars From FSA to type-3 grammars PROOF: We prove by induction on the length of α that A ⇒ ∗ α if and only if ˆ δ ( A, α ) ∈ F . Basis : A ⇒ ∗ ǫ iff A ⇒ ǫ iff ( A → ǫ ) ∈ P Philippe de Groote Formal Languages 2018-2019 12 / 28

  24. Regular expressions and regular languages From FSA to type-3 grammars From FSA to type-3 grammars PROOF: We prove by induction on the length of α that A ⇒ ∗ α if and only if ˆ δ ( A, α ) ∈ F . Basis : A ⇒ ∗ ǫ iff A ⇒ ǫ iff ( A → ǫ ) ∈ P iff A ∈ F Philippe de Groote Formal Languages 2018-2019 12 / 28

  25. Regular expressions and regular languages From FSA to type-3 grammars From FSA to type-3 grammars PROOF: We prove by induction on the length of α that A ⇒ ∗ α if and only if ˆ δ ( A, α ) ∈ F . Basis : A ⇒ ∗ ǫ iff A ⇒ ǫ iff ( A → ǫ ) ∈ P iff A ∈ F iff ˆ δ ( A, ǫ ) ∈ F Philippe de Groote Formal Languages 2018-2019 12 / 28

  26. Regular expressions and regular languages From FSA to type-3 grammars From FSA to type-3 grammars Induction : Philippe de Groote Formal Languages 2018-2019 13 / 28

  27. Regular expressions and regular languages From FSA to type-3 grammars From FSA to type-3 grammars Induction : A ⇒ ∗ aα ′ iff A ⇒ aB ⇒ ∗ aα ′ , for some ( A → aB ) ∈ P Philippe de Groote Formal Languages 2018-2019 13 / 28

  28. Regular expressions and regular languages From FSA to type-3 grammars From FSA to type-3 grammars Induction : A ⇒ ∗ aα ′ iff A ⇒ aB ⇒ ∗ aα ′ , for some ( A → aB ) ∈ P iff ( A → aB ) ∈ P and B ⇒ ∗ α ′ Philippe de Groote Formal Languages 2018-2019 13 / 28

  29. Regular expressions and regular languages From FSA to type-3 grammars From FSA to type-3 grammars Induction : A ⇒ ∗ aα ′ iff A ⇒ aB ⇒ ∗ aα ′ , for some ( A → aB ) ∈ P iff ( A → aB ) ∈ P and B ⇒ ∗ α ′ iff δ ( A, a ) = B and B ⇒ ∗ α ′ Philippe de Groote Formal Languages 2018-2019 13 / 28

  30. Regular expressions and regular languages From FSA to type-3 grammars From FSA to type-3 grammars Induction : A ⇒ ∗ aα ′ iff A ⇒ aB ⇒ ∗ aα ′ , for some ( A → aB ) ∈ P iff ( A → aB ) ∈ P and B ⇒ ∗ α ′ iff δ ( A, a ) = B and B ⇒ ∗ α ′ iff δ ( A, a ) = B and ˆ δ ( B, α ′ ) ∈ F by induction hypothesis Philippe de Groote Formal Languages 2018-2019 13 / 28

  31. Regular expressions and regular languages From FSA to type-3 grammars From FSA to type-3 grammars Induction : A ⇒ ∗ aα ′ iff A ⇒ aB ⇒ ∗ aα ′ , for some ( A → aB ) ∈ P iff ( A → aB ) ∈ P and B ⇒ ∗ α ′ iff δ ( A, a ) = B and B ⇒ ∗ α ′ iff δ ( A, a ) = B and ˆ δ ( B, α ′ ) ∈ F by induction hypothesis iff ˆ δ ( δ ( A, a ) , α ′ ) ∈ F Philippe de Groote Formal Languages 2018-2019 13 / 28

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend