automata and formal languages
play

Automata and Formal Languages Grammars Regular Expressions - PowerPoint PPT Presentation

Automata and Formal Languages Peter Wood Motivation and Background Automata Automata and Formal Languages Grammars Regular Expressions Example of Peter Wood Research Conclusion Department of Computer Science and Information Systems


  1. Automata and Formal Languages Peter Wood Motivation and Background Automata Automata and Formal Languages Grammars Regular Expressions Example of Peter Wood Research Conclusion Department of Computer Science and Information Systems Birkbeck, University of London ptw@dcs.bbk.ac.uk

  2. Automata and Outline Formal Languages Peter Wood Motivation and Motivation and Background Background Automata Grammars Automata Regular Expressions Example of Grammars Research Conclusion Regular Expressions Example of Research Conclusion

  3. Automata and Doing Research Formal Languages Peter Wood Motivation and Background Automata ◮ analysing problems/languages Grammars ◮ computability/solvability/decidability Regular Expressions — is there an algorithm? Example of ◮ computational complexity Research Conclusion — is it practical? ◮ expressive power — are there things that cannot be expressed? ◮ formal languages provide well-studied models

  4. Automata and Formal Languages Formal Languages Peter Wood Motivation and Background ◮ finite alphabet of symbols Σ Automata — e.g., Σ = { 0 , 1 } Grammars ◮ all finite strings over Σ denoted by Σ ∗ Regular Expressions — e.g., Σ ∗ = { ǫ, 0 , 1 , 00 , 01 , 10 , 11 , . . . } Example of Research ◮ language L over Σ is just subset of Σ ∗ Conclusion — e.g., L 1 : strings with an even number of 1’s — e.g., L 2 : strings representing valid Java programs ◮ are there finite representations for infinite languages?

  5. Automata and Formal Languages Formal Languages Peter Wood Motivation and Background ◮ finite alphabet of symbols Σ Automata — e.g., Σ = { 0 , 1 } Grammars ◮ all finite strings over Σ denoted by Σ ∗ Regular Expressions — e.g., Σ ∗ = { ǫ, 0 , 1 , 00 , 01 , 10 , 11 , . . . } Example of Research ◮ language L over Σ is just subset of Σ ∗ Conclusion — e.g., L 1 : strings with an even number of 1’s — e.g., L 2 : strings representing valid Java programs ◮ are there finite representations for infinite languages? ◮ yes, grammars (generative) and automata (recognition)

  6. Automata and Automata Formal Languages Peter Wood Motivation and Background ◮ device (machine) for recognising (accepting) a Automata language Grammars ◮ provide models of computation Regular Expressions ◮ automaton comprises states and transitions between Example of Research states Conclusion ◮ automaton is given a string as input ◮ automaton M accepts a string w by halting in an accept state, when given w as input ◮ language L ( M ) accepted by automaton M is set of strings which M accepts

  7. Automata and Types of Automata Formal Languages Peter Wood Motivation and Background Automata Grammars ◮ finite state automaton Regular ◮ deterministic Expressions ◮ nondeterministic Example of Research ◮ pushdown automaton Conclusion ◮ linear-bounded automaton ◮ Turing machine

  8. Automata and Example of a Finite State Automaton Formal Languages Peter Wood ◮ L 1 (strings with an even number of 1’s) can be Motivation and Background recognised by the following FSA Automata ◮ 2 states s even and s odd Grammars ◮ 4 transitions Regular ◮ s even is both the initial and final state Expressions Example of Research 0 0 Conclusion 1 s even s odd 1

  9. Automata and Grammars Formal Languages Peter Wood Motivation and ◮ grammars generate languages using: Background ◮ symbols from alphabet Σ (called terminals ) Automata ◮ set N of nonterminals (one designated as starting ) Grammars ◮ set P of productions , each of the form Regular Expressions Example of U → V Research Conclusion where U and V are (loosely) strings over Σ ∪ N ◮ a string (sequence of terminals) w is generated by G if there is a derivation of w using G , starting from the starting nonterminal of G ◮ language generated by grammar G , denoted L ( G ) , is the set of strings which can be derived using G

  10. Automata and Grammar Example Formal Languages Peter Wood ◮ L 1 (strings with an even number of 1’s) can be Motivation and generated by grammar with productions Background Automata S → ǫ Grammars S → 0 S Regular Expressions S → 1 T Example of Research T → 0 T Conclusion T → 1 S where S is the starting nonterminal

  11. Automata and Grammar Example Formal Languages Peter Wood ◮ L 1 (strings with an even number of 1’s) can be Motivation and generated by grammar with productions Background Automata S → ǫ Grammars S → 0 S Regular Expressions S → 1 T Example of Research T → 0 T Conclusion T → 1 S where S is the starting nonterminal ◮ a derivation of 01010 is given by S ⇒ 0 S ⇒ 01 T ⇒ 010 T ⇒ 0101 S ⇒ 01010 S ⇒ 01010

  12. Automata and Uses of Grammars Formal Languages Peter Wood Motivation and Background Automata Grammars ◮ to specify syntax of programming languages Regular ◮ in natural language understanding Expressions Example of ◮ in pattern recognition Research Conclusion ◮ to specify schemas (types) for tree-structured data, e.g., XML ◮ . . .

  13. Automata and Hierarchy of Grammars and Languages Formal Languages Peter Wood Motivation and Background ◮ restrictions on productions give different types of Automata grammars Grammars ◮ regular (type 3) Regular ◮ context-free (type 2) Expressions ◮ context-sensitive (type 1) Example of Research ◮ phrase-structure (type 0) Conclusion ◮ for context-free, e.g., left side must be single nonterminal ◮ no restrictions for phrase-structure ◮ language is of type i iff there is a grammar of type i which generates it

  14. Automata and Examples of Language Hierarchy Formal Languages Peter Wood Motivation and Background ◮ varying expressive power Automata ◮ regular ⊂ context-free ⊂ context-sensitive ⊂ Grammars phrase-structure Regular Expressions Example of Research Conclusion

  15. Automata and Examples of Language Hierarchy Formal Languages Peter Wood Motivation and Background ◮ varying expressive power Automata ◮ regular ⊂ context-free ⊂ context-sensitive ⊂ Grammars phrase-structure Regular Expressions ◮ L 1 (strings over { 0 , 1 } with an even number of 1’s) is Example of Research regular Conclusion

  16. Automata and Examples of Language Hierarchy Formal Languages Peter Wood Motivation and Background ◮ varying expressive power Automata ◮ regular ⊂ context-free ⊂ context-sensitive ⊂ Grammars phrase-structure Regular Expressions ◮ L 1 (strings over { 0 , 1 } with an even number of 1’s) is Example of Research regular Conclusion ◮ L 2 = { 0 n 1 n | n ≥ 0 } is context-free, but not regular

  17. Automata and Examples of Language Hierarchy Formal Languages Peter Wood Motivation and Background ◮ varying expressive power Automata ◮ regular ⊂ context-free ⊂ context-sensitive ⊂ Grammars phrase-structure Regular Expressions ◮ L 1 (strings over { 0 , 1 } with an even number of 1’s) is Example of Research regular Conclusion ◮ L 2 = { 0 n 1 n | n ≥ 0 } is context-free, but not regular ◮ L 3 = { ww | w ∈ { 0 , 1 } ∗ } is context-sensitive, but not context-free

  18. Automata and Examples of Language Hierarchy Formal Languages Peter Wood Motivation and Background ◮ varying expressive power Automata ◮ regular ⊂ context-free ⊂ context-sensitive ⊂ Grammars phrase-structure Regular Expressions ◮ L 1 (strings over { 0 , 1 } with an even number of 1’s) is Example of Research regular Conclusion ◮ L 2 = { 0 n 1 n | n ≥ 0 } is context-free, but not regular ◮ L 3 = { ww | w ∈ { 0 , 1 } ∗ } is context-sensitive, but not context-free ◮ there exists a phrase-structure (recursive) language which is not context-sensitive

  19. Automata and Complexity of Grammar Problems Formal Languages Peter Wood Problem Type Motivation and Background 3 2 1 0 Automata Is w ∈ L ( G ) ? P P PSPACE U Grammars Is L ( G ) empty? P P U U Regular Expressions Is L ( G 1 ) ≡ L ( G 2 ) ? PSPACE U U U Example of Research ◮ P: decidable in polynomial time Conclusion ◮ PSPACE: decidable in polynomial space (and complete for PSPACE: at least as hard as NP-complete) ◮ U: undecidable ◮ so type of grammar has significant effect on complexity

  20. Automata and Relationships between Languages and Formal Languages Automata Peter Wood Motivation and Background Automata Grammars Regular Expressions Example of A language is Research Conclusion   regular finite-state iff     context-free pushdown   accepted context-sensitive linear-bounded by     phrase-structure Turing machine  

  21. Automata and Regular Expressions Formal Languages Peter Wood Motivation and Background Automata ◮ algebraic notation for denoting regular languages Grammars ◮ use ◦ (concatenation), ∪ (union) and ∗ (closure) Regular Expressions operators Example of ◮ L 1 denoted by RE 0 ∗ ∪ ( 0 ∗ ◦ 1 ◦ 0 ∗ ◦ 1 ◦ 0 ∗ ) ∗ Research Conclusion ◮ given RE R , the set of strings it denotes is L ( R ) ◮ pattern matching in text ◮ query languages for XML or RDF

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