Automata Theory Fundamentele Informatica 2 Rudy van Vliet Bachelor Informatica Universiteit Leiden Fall 2020
Praktische Informatie • hoorcollege: dinsdag, 13.00–14.45 (weblecture) werkcollege: dinsdag, 15.00–15.45 (weblecture) vraag/antwoord: dinsdag, 16.00–16.45 (Kaltura) van 1 september – 7 december 2020 • college gebaseerd op boek: John C. Martin, Introduction to Languages and the Theory of Computation, 4th edition (verkrijgbaar?) • hoofdstuk 1–6 (deels) Automata Theory 2 / 86
Praktische Informatie • tentamens: maandagochtend 11 januari 2021 dinsdagochtend 23 maart 2021? • Vier/vijf huiswerkopgaven (individueel) (assistent Femke Slangen) Niet verplicht, maar . . . eindcijfer = 70% * tentamencijfer + 30% * cijferhuiswerkopgave als tentamencijfer � 5.5, dan eindcijfer � 5.5 als tentamencijfer < 5.5, dan eindcijfer = tentamencijfer Automata Theory 3 / 86
Praktische Informatie Website http://www.liacs.leidenuniv.nl/~vlietrvan1/automata/ • slides (dank HJH) • overzicht van behandelde stof • antwoorden van bepaalde opgaven • huiswerkopgaven • errata Brightspace Automata Theory 4 / 86
Context Foundations of Computer Science / Fundamentele Informatica 1 Computability / Fundamentele Informatica 3 (Compiler Construction) Automata Theory 5 / 86
Contents Languages 1 (Deterministic) Finite Automata 2 edit 2020-09-10 Automata Theory 6 / 86
Section 1 Languages Automata Theory Languages 7 / 86
Chapter Languages 1 Origins Letter, alphabet, string, language Chomsky hierarchy Automata Theory Languages 8 / 86
Computer Possibilities / limitations of computer / algorithms Model Computer receives input, performs ‘computation’, gives output Given instance of Nim. Who wins? Given sequence of numbers. Sort Given edge-weighted graph. Give shortest route from A to B Automata Theory Languages 9 / 86
Languages Dealing with languages / sets of instances 1 Abstract machines to accept or to recognize languages 2 Grammars to generate languages 3 Expressions to describe languages Automata Theory Languages 10 / 86
Formal Languages: Origins 1 Logic and recursive-function theory Logica 2 Switching circuit theory and logical design DiTe 3 Modeling of biological systems, particularly developmental systems and brain activity 4 Mathematical and computational linguistics 5 Computer programming and the design of ALGOL and other problem-oriented languages S.A. Greibach. Formal Languages: Origins and Directions. Annals of the History of Computing (1981) doi:10.1109/MAHC.1981.10006 Automata Theory Languages Origins 11 / 86
Mealy Machine 0 / 0 1 / 0 00 01 0 / 1 0 / 1 1 / 0 0 / 1 10 11 1 / 0 1 / 0 Digital Technique by Todor Stefanov, Leiden University Automata Theory Languages Origins 12 / 86
Specifying languages n 1 ′ s 1 ′ S WHNP VP SELECT FROM WHERE WP • AUX NP NP PP restaurant general info AND are what IN NP par par DT JJ NNS NNP • • in some good rating > 2.50 city = VARcity restaurants Leiden A. Giordani and A. Moschitti. Corpora for Automatically Learning to Map Natural Language Questions into SQL Queries (LREC 2010) Automata Theory Languages Origins 13 / 86
Inductive definition ⇒ grammar inductive definition (of set of strings over { ( , ) } ) Example – Λ ∈ Balanced basis – for every x , y ∈ Balanced , also xy ∈ Balanced induction:1 – for every x ∈ Balanced , also ( x ) ∈ Balanced :2 – no other strings in Balanced closure strings basis Λ ind:2 ( Λ ) = () ind:1 ()() ind:2 (()) ind:1 ()()() , ()(()) , (())() , ind:2 (()()) , ((())) grammar rules: S → Λ | SS | ( S ) rewriting: S ⇒ SS ⇒ S ( S ) ⇒ ( S )( S ) ⇒ ()( S ) ⇒ ()(( S )) ⇒ ()(()) [M] E 1.19 see Dyck language, Catalan numbers Automata Theory Languages Origins 14 / 86
Chomsky hierarchy grammar automaton TYPE regular 3 right-linear finite state a p q A → aB context-free 2 A → α pushdown (+lifo stack) context-sensitive 1 ( β ℓ , A , β r ) → α linear bounded α → β | β | � | α | monotone recursively enumerable 0 turing machine α → β [M] Table 8.21 Automata Theory Languages Origins 15 / 86
Languages letter , symbol σ 0, 1 a , b , c alphabet Σ { a , b , c } (finite, nonempty) string , word w finite w = a 1 a 2 . . . a n , a i ∈ Σ abbabb empty string λ , Λ , ε length | x | | Λ | = 0 | xy | = | x | + | y | concatenation a 1 . . . a m · b 1 . . . b n ab · babb w Λ = Λ w = w ( xy ) z = x ( yz ) string w ∈ Σ ∗ Σ ∗ = { Λ , a , b , aa , ab , ba , bb , aaa , aab , . . . } canonical order infinite set of finite strings language L ⊆ Σ ∗ Automata Theory Languages Letter, alphabet, string, language 16 / 86
Languages are sets Example – { a , b } ∗ all strings over { a , b } Λ , baa , aaaaa – all strings of even length Λ , babbba – all strings with last letter b bbb , aabb – AnBn = { a n b n | n ∈ N } Λ , aaabbb ( N = { 0, 1, 2, 3, . . . } ) { a , b } ∗ last b a even bb bbb AnBn ba Λ ab aa b Automata Theory Languages Letter, alphabet, string, language 17 / 86
Confusion Λ vs. { Λ } vs. ∅ Automata Theory Languages Letter, alphabet, string, language 18 / 86
∪ , ∩ , c Boolean algebra commutativity A ∪ B = B ∪ A . . . associativity ( A ∪ B ) ∪ C = A ∪ ( B ∪ C ) distributivity A ∩ ( B ∪ C ) = ( A ∩ B ) ∪ ( A ∩ C ) idempotency A ∪ A = A A ∩ A = A ( A ∪ B ) c = A c ∩ B c De Morgan unit A ∪ ∅ = A A ∩ U = A A ∩ ∅ = ∅ A ∪ U = U ( A c ) c = A involution A ∩ A c = ∅ complement duality brackets c before ∪ , ∩ priority K ∩ L ∪ M ?? [M] page 4 DiTe, FI1 Automata Theory Languages Letter, alphabet, string, language 19 / 86
Concatenation, power, star Definition K · L = KL = { xy | x ∈ K , y ∈ L } { a , ab }{ a , ba } = { aa , aba , abba } one { Λ } L = L { Λ } = L zero ∅ L = L ∅ = ∅ associative ( KL ) M = K ( LM ) L 0 = { Λ } , L 1 = L , L 2 = LL , . . . L n + 1 = L n L . Definition L ∗ = � n � 0 L n Automata Theory Languages Letter, alphabet, string, language 20 / 86
L n = L · L · . . . · L � �� � n times L n = { w 1 w 2 . . . w n | w 1 , w 2 , . . . , w n ∈ L } fixed n L ∗ = { w 1 w 2 . . . w n | w 1 , w 2 , . . . , w n ∈ L , n ∈ N } Example { a } ∗ · { b } = { Λ , a , aa , aaa , . . . } · { b } = { b , ab , aab , aaab , . . . } ( { a } ∗ · { b } ) ∗ = { b , ab , aab , aaab , . . . } ∗ = { Λ , b , ab , bb , aab , abb , bab , bbb , aaab , . . . } ( { a } ∗ · { b } ) ∗ = { a , b } ∗ { b } ∪ { Λ } Automata Theory Languages Letter, alphabet, string, language 21 / 86
Families of languages family all languages that can be defined by – type of automata (deterministic) finite aut. FA , NFA , pushdown aut. PDA – type of grammar context-free grammar CFG , right linear – certain operations regular REG ∪ , ∩ , c Boolean operations: Regular operations: ∪ , · , ∗ family F closed under operation ∇ : if K , L ∈ F , then K ∇ L ∈ F . Automata Theory Languages Letter, alphabet, string, language 22 / 86
Specifying languages RECOGNIZING , algorithm L 2 = { x ∈ { a , b } ∗ | n a ( x ) > n b ( x ) } count a and b deterministic [finite] automaton GENERATING , description regular expression L 1 = ( { ab , bab } ∗ { b } ) ∗ { ab } ∪ { b }{ ba } ∗ { ab } ∗ recursive definition → well-formed formulas ֒ grammar Automata Theory Languages Letter, alphabet, string, language 23 / 86
Chomsky hierarchy grammar automaton TYPE regular 3 right-linear finite state a p q A → aB context-free 2 A → α pushdown (+lifo stack) context-sensitive 1 ( β ℓ , A , β r ) → α linear bounded α → β | β | � | α | monotone recursively enumerable 0 turing machine α → β [M] Table 8.21 Automata Theory Languages Chomsky hierarchy 24 / 86
Proofs – clever idea, intuition – formal construction, specification – show it works, e.g., induction once the idea is understood, the other parts might be boring but essential to test intuition examples help to get the message Automata Theory Languages Chomsky hierarchy 25 / 86
Quiz 1 L 1 , L 2 , L 3 are languages over some alphabet Σ . For each pair of languages below, what is their relationship? Are they always equal? If not, is one always a subset of the other? 1 L 1 ( L 2 ∩ L 3 ) vs. L 1 L 2 ∩ L 1 L 3 2 L ∗ 1 ∩ L ∗ vs. ( L 1 ∩ L 2 ) ∗ 2 3 L ∗ 1 L ∗ vs. ( L 1 L 2 ) ∗ 2 [M] Exercise 1.37 1 A quiz is a brief assessment used in education to measure growth in knowledge, abilities, and/or skills. Wikipedia Automata Theory Languages Chomsky hierarchy 26 / 86
Overview Ch.2 & 3 minimal by definition by definition FA NFA NFA- Λ subset construction remove Λ Brzozowski et McC. Thompson REG Automata Theory Languages Chomsky hierarchy 27 / 86
Section 2 (Deterministic) Finite Automata Automata Theory (Deterministic) Finite Automata 28 / 86
Chapter (Deterministic) Finite Automata 2 Examples FA definition Boolean operations Decision problems Distinguishing strings Minimization Automata Theory (Deterministic) Finite Automata 29 / 86
Ingredients a q 0 q 1 q 2 q 3 Example L 1 = { x ∈ { a , b } ∗ | x ends with aa } . . . [M] E. 2.1 Automata Theory (Deterministic) Finite Automata Examples 30 / 86
Recommend
More recommend