620 likes | 790 Views
Applied Computer Science II Chapter 1 : Regular Languages. Prof. Dr. Luc De Raedt Institut für Informatik Albert-Ludwigs Universität Freiburg Germany. Overview. Deterministic finite automata Regular languages Nondeterministic finite automata Closure operations Regular expressions
E N D
Applied Computer Science IIChapter 1 : Regular Languages Prof. Dr. Luc De Raedt Institut für Informatik Albert-Ludwigs Universität Freiburg Germany
Overview • Deterministic finite automata • Regular languages • Nondeterministic finite automata • Closure operations • Regular expressions • Nonregular languages • The pumping lemma
Finite Automata • An intuitive example : supermarket door controller • Figures 1,2,3 • Probabilistic counterparts exist • Markov chains, bayesian nets, etc. • Not in this course
Figure 1.4 Formally A finite automaton
7,8,9 Other examples
Designing finite automata • Design automaton for language consisting of binary strings with an odd number of 1s • Design first states • Then transitions • Accept and reject states • Fig. 12
Another example • Design an automaton to recognize the language of binary strings containing the string 001 as substring • Fig 13
Non deterministic finite automata • Deterministic • One successor state • transitions not allowed • Non deterministic • Several successor states possible • transitions possible • Figure 14
Deterministic versus non deterministic computation • Figure 15
Every NFA has an equivalent DFA • Figures 17-18
Example • Example 18
Proof idea • INSERT FIG 1.24
Applications • Design of compilers • awk, grep, vi … in unix (search for strings) • Perl programming language • Bioinformatics • So called motifs (patterns occurring in sequences, e.g. proteins)
Two steps • DFA into GNFA (generalized nondeterministic finite automaton) • GNFA into regular expression
Two states q and r are connected in both directions Exception : Start state Accept state One direction only Labels are regular expressions GNFAs