FLAC Context-Free Grammars

Size: px
Start display at page:

Download "FLAC Context-Free Grammars"

Transcription

1 FLAC Context-Free Grammars Klaus Sutner Carnegie Mellon Universality Fall 2017

2 1 Generating Languages Properties of CFLs

3 Generation vs. Recognition 3 Turing machines can be used to check membership in decidable sets. They can also be used to enumerate semidecidable sets, whence the classical notion of recursively enumerable sets. For languages L Σ there is a similar notion of generation. The idea is to set up a system of simple rules that can be used to derive all words in a particular formal language. These systems are typically highly nondeterministic and it is not clear how to find (efficient) recognition algorithms for the corresponding languages.

4 Noam Chomsky 4 Historically, these ideas go back to work by Chomsky in the 1950s. Chomsky was mostly interested natural languages: the goal is to develop grammars that differentiate between grammatical and and ungrammatical sentences. 1 The cat sat on the mat. 2 The mat on the sat cat. Alas, this turns out to be inordinately difficult, syntax and semantics of natural languages are closely connected and very complicated. But for artificial languages such as programming languages, Chomsky s approach turned out be perfectly suited.

5 Cat-Mat Example 5 Sentence Noun Phrase Verb Phrase Punctuation Determiner Noun Verb Prepositional Phrase. The cat sat Preposition Noun Phrase on Determiner Noun the mat

6 Mat-Cat Example 6 Noun Phrase Noun Phrase Prepositional Phrase Punctuation Determiner Noun Preposition Noun Phrase. The mat on Determiner Adjective Noun the sat cat

7 Killer App: Programming Languages 7 Many programming languages have a block structure like so: begin end begin end begin begin end begin end end Clearly, this is not a regular language and cannot be checked by a finite state machine. We need more compute power.

8 Generalizing 8 We have two rather different ways of describing regular languages: finite state machine acceptors regular expressions We could try to generalize either one of these. Let s start with the algebra angle and handle the machine model later.

9 Grammars 9 Definition A (formal) grammar is a quadruple G = V, Σ, P, S where V and Σ are disjoint alphabets, S V, and P is a finite set of productions or rules. the symbols of V are (syntactic) variables, the symbols of Σ are terminals, S is called the start symbol (or axiom). We often write Γ = V Σ for the complete alphabet of G.

10 Context Free Grammars 10 Definition (CFG) A context free grammar is a grammar where the productions have the form P V Γ It is convenient to write productions in the form where A V and α Γ. π : A α The idea is that we may replace A by α.

11 Naming Conventions 11 A, B, C... represent elements of V, S V is the start symbol, a, b, c... represent elements of Σ, X, Y, Z... represent elements of Γ, w, x, y... represent elements of Σ, α, β, γ... represent elements of Γ.

12 Derivations 12 Given a CFG G define a one-step relation αaβ 1 = αγβ if A γ P 1 = Γ Γ as follows: As usual, by induction define α = k+1 β if γ (α = k γ γ = 1 β) and α = β if k α = k β in which case one says that α derives or yields β. α is a sentential form if it can be derived from the start symbol S. To keep notation simple we ll often just write α = β.

13 Context Free Languages 13 Definition The language of a context free grammar G is defined to be L(G) = { x Σ S = x } Thus L(G) is the set of all sentential forms in Σ. We also say that G generates L(G). A language is context free (CFL) if there exists a context free grammar that generates it. Note that in a CFG one can replace a single syntactic variable A by strings over Γ independently of were A occurs; whence the name context free. Later on we will generalize to replacement rules that operate on a whole block of symbols (context sensitive grammars).

14 Example: Regular 14 Let G = {S, A, B}, {a, b}, P, S where the set P of productions is defined by: S aa ab A aa ab B bb b. A typical derivation is: It is not hard to see that S aa aaa aaab aaabb aaabb L(G) = a + b + Not too interesting, we already know how to deal with regular languages. Can you see the finite state machine hiding in the grammar? Is it minimal?

15 Derivation Graph 15 Derivations of length at most 6 in this grammar.

16 Labeled 16 S aa ab aaa aab ab abb aaaa aaab aab aabb abb abbb aaaaa aaaab aaab aaabb aabb aabbb abbb abbbb aaaaaa aaaaab aaaab aaaabb aaabb aaabbb aabbb aabbbb abbbb abbbbb

17 Example: Mystery 17 Let G = {A, B}, {a, b}, P, A where the set P of productions is defined by: A typical derivation is: A AA AB a B AA BB b. A AA AAB AABB AABAA aabaa In this case it is not obvious what the language of G is (assuming it has some easy description, it does). More next time when we talk about parsing.

18 Derivation Graph 18 Derivations of length at most 3 in this grammar. Three terminal strings appear at this point.

19 Depth 4 19

20 Example: Counting 20 Let G = {S}, {a, b}, P, S where the set P of productions is defined by: S asb ε A typical derivation is: S asb aasbb aaasbbb aaabbb Clearly, this grammar generates the language { a i b i i 0 } It is easy to see that this language is not regular.

21 Derivation Graph 21

22 Example: Palindromes 22 Let G = {S}, {a, b}, P, S where the set P of productions is defined by: S asa bsb a b ε A typical derivation is: S asa aasaa aabsbaa aababaa This grammar generates the language of palindromes. Exercise Give a careful proof of this claim.

23 Derivation Graph 23

24 Example: Parens 24 Let G = {S}, {(, )}, P, S where the set P of productions is defined by: S SS (S) ε A typical derivation is: S SS (S)S (S)(S) (S)((S)) ()(()) This grammar generates the language of well-formed parenthesized expressions. Exercise Give a careful proof of this claim.

25 Derivation Graph 25

26 Example: Expressions of Arithmetic 26 Let G = {E}, {+,, (, ), v}, P, E where the set P of productions is defined by: E E + E E E (E) v A typical derivation is: E E E E (E) E (E + E) v (v + v) This grammar generates a language of arithmetical expressions with plus and times. Alas, there are problems: the following derivation is slightly awkward. E E + E E + (E) E + (E E) v + (v v) Our grammar is symmetric in + and, it knows nothing about precedence.

27 Derivation Graph 27

28 Ambiguity 28 We may not worry about awkward, but the following problem is fatal: E E + E E + E E v + v v E E E E + E E v + v v There are two derivations for the same word v + v v. Since derivations determine the semantics of a string this is really bad news: a compiler could interpret v + v v in two different ways, producing different results.

29 Parse Trees 29 Derivation chains are hard to read, a better representation is a tree. Let G = V, Σ, P, S be a context free grammar. A parse tree of G (aka grammatical tree) is an ordered tree on nodes N, together with a labeling λ : N V Σ such that For all interior nodes x: λ(x) V, If x 1,..., x k are the children, in left-to-right order, of interior node x then λ(x) λ(x 1)... λ(x k ) is a production of G, λ(x) = ε implies x is an only child.

30 Derivation Trees 30 Here are the parse trees of the expressions grammar from above. E E E + E E E E E E + E Note that the trees provide a method to evaluate arithmetic expressions, so the existence of two trees becomes a nightmare.

31 Information Hiding 31 A parse tree typically represents several derivations: E E E v E + E v v represents for example θ 1 : E E E E E + E v E + E v v + E v v + v θ 2 : E E E E E + E E E + v E v + v v v + v θ 3 : E E E v E v E + E v v + E v v + v but not θ 4 : E E + E E E + E v E + E v v + E v v + v

32 Leftmost Derivations 32 Let G be a grammar and assume α 1 = β. We call this derivation step leftmost if α = xaα β = xγα x Σ A whole derivation is leftmost if it only uses leftmost steps. Thus, each replacement is made in the first possible position. Proposition Parse trees correspond exactly to leftmost derivations.

33 Ambiguity 33 Definition A CFG G is ambiguous if there is a word in the language of G that has two different parse trees. Alternatively, there are two different leftmost derivations. As the arithmetic example demonstrates, trees are connected to semantics, so ambiguity is a serious problem in a programming language.

34 Unambiguous Arithmetic 34 For a reasonable context free language it is usually possible to remove ambiguity by rewriting the grammar. For example, here is an unambiguous grammar for our arithmetic expressions. E E + T T T T F F F (E) v In this grammar, v + v v has only one parse tree. Here {E, T, F } are syntactic variables that correspond to expressions, terms and factors. Note that it is far from clear how to come up with these syntactic categories.

35 Inherently Ambiguous Languages 35 Alas, there are CFLs where this trick will not work: every CFG for the language is already ambiguous. Here is a well-known example: L = { a i b j c k i = j j = k; i, j, k 1 } L consists of two parts and each part is easily unambiguous. But strings of the form a i b i c i belong to both parts and introduce a kind of ambiguity that cannot be removed. BTW, { a i b i c i i 0 } is not context free. Exercise Show that L really is inherently ambiguous.

36 Generating Languages 2 Properties of CFLs

37 Regular Implies Context Free 37 Lemma Every regular language is context free. Proof. Suppose M = Q, Σ, δ; q 0, F is a DFA for L. Consider a CFG with V = Q and productions Let q 0 be the start symbol. p a q if δ(p, a) = q p ε if p F

38 Substitutions 38 Definition A substitution is a map σ : Σ P(Γ ). The idea is that for any word x Σ we can define its image under σ to be language σ(x 1) σ(x 2)... σ(x n) Likewise, σ(l) = x L σ(x). If σ(a) = {w} then we have essentially a homomorphism.

39 The Substitution Lemma 39 Lemma Let L Σ be a CFL and suppose σ : Σ P(Γ ) is a substitution such that σ(a) is context free for every a Σ. Then the language σ(l) is also context free. Proof. Let G = V, Σ, P, S and G a = V a, Γ, P a, S a be CFGs for the languages L and L a = σ(a) respectively. We may safely assume that the corresponding sets of syntactic variables are pairwise disjoint. Define G as follows. Replace all terminals a on the right hand side of a production in G by the corresponding variable S a. It is obvious that f(l(g )) = L where f is the homomorphism defined by f(s a) = a.

40 Proof, cont d 40 Now define a new grammar H as follows. The variables of H are V a Σ Va, the terminals are Σ, the start symbol is S and the productions are given by P a Σ P a Then the language generated by H is σ(l). It is clear that H derives every word in σ(l). For the opposite direction consider the parse trees in H.

41 Closure Properties 41 Corollary Suppose L, L 1, L 2 Σ are CFLs. Then the following languages are also context free: L 1 L 2, L 1 L 2 and L : context free languages are closed under union, concatenation and Kleene star. Proof. This follows immediately from the substitution lemma and the fact that the languages {a, b}, {ab} and {a} are trivially context free.

42 Non Closure 42 Proposition CFLs are not closed under intersection and complement. Consider L 1 = { a i b i c j i, j 0 } L 2 = { a i b j c j i, j 0 } We will see in a moment that L 1 L 2 = { a i b i c i i 0 } fails to be context free.

43 More Closure 43 Lemma Suppose L is a CFL and R is regular. Then L R is also context free. Proof. This will be easy once we have a machine model for CFLs (push-down automata), more later.

44 Dyck Languages 44 One can generalize strings of balanced parentheses to strings involving multiple types of parens. To this end one uses special alphabets with paired symbols: Γ = Σ { a a Σ } The Dyck language D k is generated by the grammar S SS a S a ε A typical derivation looks like so: S SS asas aasa as aasa aasa aaa aaa Exercise Find an alternative definition of a Dyck language.

45 A Characterization 45 Let us write D k for the Dyck language with k = Σ kinds of parens. For D 1 there is a nice characterization via a simple counting function. Define # ax to be the number of letters a in word x. f a(x) = # ax # ax Lemma A string x belongs to the Dyck language D 1 {a, a} iff f a(x) = 0 and for any prefix z of x: f a(z) 0.

46 A Paren Mountain Note that one can read off a proof for the correctness of the grammar S SS a S a ε from the picture.

47 k-parens 47 For D k we can still count but this time we need values in N k f(x) = (f a1 (x), f a2 (x),..., f ak (x)) Then we need f(x) = 0 and f(z) 0 for all prefixes z of x, just like for D 1. Alas, this is not enough: we also have make sure that proper nesting occurs between different types of parens. The critical problem is that we do not want abab.

48 Matching Pairs 48 Let x = x 1x 2... x n. Note that if x D k and x i = a then there is a unique minimal j > i such that f a(x[i]) = f a(x[j]) (why?). Intuitively, x j = a is the matching right paren for a = x i. Hence we obtain an interval [i, j] associated with the a in position i. Call the collection of all such intervals I a, a Σ. The critical additional condition for a balanced string is that none of the intervals in I a overlap, they are all nested or disjoint. Exercise Show that these conditions really describe the language D k.

49 Dyck vs. CF 49 In a strong sense, Dyck languages are the most general context free languages: all context free languages are built around the notion of matching parens, though this may not at all be obvious from their definitions (and, actually, not even from their grammars). Theorem (Chomsky-Schützenberger 1963) Every context free language L Σ has the form L = h(d R) where D is a Dyck language, R is regular and h is a homomorphism. The proof also relies on a machine model, more later.

50 Parikh Vectors 50 Suppose Σ = {a 1, a 2,..., a k }. For x Σ, the Parikh vector of x is defined by Lift to languages via #x = (# a1 x, # a2 x,..., # ak x) N k #L = { #x x L } N k In a sense, the Parikh vector gives the commutative version of a word: we just count all the letters, but ignore order entirely. For example, for the Dyck language D 1 over {a, a} we have #D 1 = { (i, i) i 0 }.

51 Semi-Linear Sets 51 A set A N k is semi-linear if it is the finite union of sets of the form { a 0 + i a ix i x i 0 } and a i N k fixed. In the special case k = 1, semi-linear sets are often called ultimately periodic: A = A t + (a + mn + A p) where A t {0,..., a 1} and A p {0,..., m 1} are the transient and periodic part, respectively. Observe that for any language L {a} : L is regular iff #L N is semi-linear.

52 Parikh s Theorem 52 Theorem For any context free language L, the Parikh set #L is semi-linear. Instead of a proof, consider the example of the Dyck language D 1 S SS asa ε Let A = #D 1, then A is the least set X N 2 such that S SS: X is closed under addition S asa: X is closed under x x + (1, 1) S ε: X contains (0, 0) Clearly, A = { (i, i) i 0 }.

53 Application Parikh 53 It follows immediately that every context free language over Σ = {a} is already regular. As a consequence, { a p p prime } is not context free. This type of argument also works for a slightly messier language like L = { a k b l k > l (k l k prime) } Note that in this case L and #L are essentially the same, so it all comes down to the set of primes not being semi-linear.

54 Markings 54 Another powerful method to show that a language fails to be context free is a generalization of the infamous pumping lemma for regular languages. Alas, this time we need to build up a bit of machinery. Definition Let w Σ, say, n = w. A position in w is a number p, 1 p n. A set K [n] of positions is called a marking of w. A 5-factorization of w consists of 5 words x 1, x 2, x 3, x 4, x 5 such that x 1x 2x 3x 4x 5 = w. Given a factorization and a marking of w let K(x i) = { p x 1... x i 1 < p x 1... x i } K Thus K(x i) simply consists of all the marked positions in block x i.

55 The Iteration Theorem 55 Theorem Let G = V, Σ, P, S be a CFG. Then there exists a number N = N(G) such that for all x L(G), K [ x ] a marking of x of cardinality at least N: there exists a 5-factorization x 1,..., x 5 of x such that, letting K i = K(x i), we have: K 1, K 2, K 3 or K 3, K 4, K 5 K 2 K 3 K 4 N. t 0 ( x 1x t 2x 3x t 4x 5 L(G) ). Proof. Stare at parse trees.

56 Non-Closure 56 Lemma { a i b i c i i 0 } is not context free. Proof. Recall that this shows non-closure under complements and intersections. So a CFG can count and compare two letters, as in but three letters are not manageable. L 1 = { a i b i c j i, j 0 } L 2 = { a i b j c j i, j 0 } The intuition behind this will become clear next time when we introduce a machine model.

57 Proof 57 Let N be as in the iteration theorem and set w = a N b N c N, K = [N + 1, 2N] (so the b s in the middle are marked). Then there is a factorization x 1,..., x 5 of w such that, letting K i = K(x i), we have: Case 1: K 1, K 2, K 3 Then x 1 = a N b i, x 2 = b j, x 3 = b k y where j > 0. But then x 1x 3x 5 / L, contradiction. Case 2: K 3, K 4, K 5 Then x 3 = yb i, x 4 = b j, x 5 = b k c N where j > 0. Again x 1x 3x 5 / L, contradiction.

58 More Non-Closure 58 It follows that { x {a, b, c} x a = x b = x c } is not context free: otherwise the intersection with a b c would also be context free. Exercise Show that the copy language L copy = { x x x Σ } fails to be context free. Compare this to the palindrome language { x x op x Σ }

Context Free Grammars

Context Free Grammars Automata and Formal Languages Context Free Grammars Sipser pages 101-111 Lecture 11 Tim Sheard 1 Formal Languages 1. Context free languages provide a convenient notation for recursive description of languages.

More information

Context-Free Grammars and Languages

Context-Free Grammars and Languages Context-Free Grammars and Languages Seungjin Choi Department of Computer Science and Engineering Pohang University of Science and Technology 77 Cheongam-ro, Nam-gu, Pohang 37673, Korea seungjin@postech.ac.kr

More information

Computational Models - Lecture 4 1

Computational Models - Lecture 4 1 Computational Models - Lecture 4 1 Handout Mode Iftach Haitner. Tel Aviv University. November 21, 2016 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice Herlihy, Brown University.

More information

Lecture 11 Context-Free Languages

Lecture 11 Context-Free Languages Lecture 11 Context-Free Languages COT 4420 Theory of Computation Chapter 5 Context-Free Languages n { a b : n n { ww } 0} R Regular Languages a *b* ( a + b) * Example 1 G = ({S}, {a, b}, S, P) Derivations:

More information

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET Regular Languages and FA A language is a set of strings over a finite alphabet Σ. All languages are finite or countably infinite. The set of all languages

More information

Context-Free Grammars and Languages. Reading: Chapter 5

Context-Free Grammars and Languages. Reading: Chapter 5 Context-Free Grammars and Languages Reading: Chapter 5 1 Context-Free Languages The class of context-free languages generalizes the class of regular languages, i.e., every regular language is a context-free

More information

Computational Models - Lecture 4

Computational Models - Lecture 4 Computational Models - Lecture 4 Regular languages: The Myhill-Nerode Theorem Context-free Grammars Chomsky Normal Form Pumping Lemma for context free languages Non context-free languages: Examples Push

More information

Chapter 5: Context-Free Languages

Chapter 5: Context-Free Languages Chapter 5: Context-Free Languages Peter Cappello Department of Computer Science University of California, Santa Barbara Santa Barbara, CA 93106 cappello@cs.ucsb.edu Please read the corresponding chapter

More information

Computational Models - Lecture 4 1

Computational Models - Lecture 4 1 Computational Models - Lecture 4 1 Handout Mode Iftach Haitner and Yishay Mansour. Tel Aviv University. April 3/8, 2013 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

Suppose h maps number and variables to ɛ, and opening parenthesis to 0 and closing parenthesis

Suppose h maps number and variables to ɛ, and opening parenthesis to 0 and closing parenthesis 1 Introduction Parenthesis Matching Problem Describe the set of arithmetic expressions with correctly matched parenthesis. Arithmetic expressions with correctly matched parenthesis cannot be described

More information

Computational Models - Lecture 3

Computational Models - Lecture 3 Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 1 Computational Models - Lecture 3 Equivalence of regular expressions and regular languages (lukewarm leftover

More information

CDM Parsing and Decidability

CDM Parsing and Decidability CDM Parsing and Decidability 1 Parsing Klaus Sutner Carnegie Mellon Universality 65-parsing 2017/12/15 23:17 CFGs and Decidability Pushdown Automata The Recognition Problem 3 What Could Go Wrong? 4 Problem:

More information

The View Over The Horizon

The View Over The Horizon The View Over The Horizon enumerable decidable context free regular Context-Free Grammars An example of a context free grammar, G 1 : A 0A1 A B B # Terminology: Each line is a substitution rule or production.

More information

Foundations of Informatics: a Bridging Course

Foundations of Informatics: a Bridging Course Foundations of Informatics: a Bridging Course Week 3: Formal Languages and Semantics Thomas Noll Lehrstuhl für Informatik 2 RWTH Aachen University noll@cs.rwth-aachen.de http://www.b-it-center.de/wob/en/view/class211_id948.html

More information

Section 1 (closed-book) Total points 30

Section 1 (closed-book) Total points 30 CS 454 Theory of Computation Fall 2011 Section 1 (closed-book) Total points 30 1. Which of the following are true? (a) a PDA can always be converted to an equivalent PDA that at each step pops or pushes

More information

Context Free Languages (CFL) Language Recognizer A device that accepts valid strings. The FA are formalized types of language recognizer.

Context Free Languages (CFL) Language Recognizer A device that accepts valid strings. The FA are formalized types of language recognizer. Context Free Languages (CFL) Language Recognizer A device that accepts valid strings. The FA are formalized types of language recognizer. Language Generator: Context free grammars are language generators,

More information

Automata Theory CS F-08 Context-Free Grammars

Automata Theory CS F-08 Context-Free Grammars Automata Theory CS411-2015F-08 Context-Free Grammars David Galles Department of Computer Science University of San Francisco 08-0: Context-Free Grammars Set of Terminals (Σ) Set of Non-Terminals Set of

More information

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 10 : Context-Free Grammars

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 10 : Context-Free Grammars COMP-330 Theory of Computation Fall 2017 -- Prof. Claude Crépeau Lec. 10 : Context-Free Grammars COMP 330 Fall 2017: Lectures Schedule 1-2. Introduction 1.5. Some basic mathematics 2-3. Deterministic finite

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Lecture 14 Ana Bove May 14th 2018 Recap: Context-free Grammars Simplification of grammars: Elimination of ǫ-productions; Elimination of

More information

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 11 CHAPTER 3 CONTEXT-FREE LANGUAGES 1. Context Free Grammars 2. Pushdown Automata 3. Pushdown automata and context -free

More information

Context Free Languages and Grammars

Context Free Languages and Grammars Algorithms & Models of Computation CS/ECE 374, Fall 2017 Context Free Languages and Grammars Lecture 7 Tuesday, September 19, 2017 Sariel Har-Peled (UIUC) CS374 1 Fall 2017 1 / 36 What stack got to do

More information

Pushdown Automata. Reading: Chapter 6

Pushdown Automata. Reading: Chapter 6 Pushdown Automata Reading: Chapter 6 1 Pushdown Automata (PDA) Informally: A PDA is an NFA-ε with a infinite stack. Transitions are modified to accommodate stack operations. Questions: What is a stack?

More information

Introduction to Theory of Computing

Introduction to Theory of Computing CSCI 2670, Fall 2012 Introduction to Theory of Computing Department of Computer Science University of Georgia Athens, GA 30602 Instructor: Liming Cai www.cs.uga.edu/ cai 0 Lecture Note 3 Context-Free Languages

More information

TAFL 1 (ECS-403) Unit- III. 3.1 Definition of CFG (Context Free Grammar) and problems. 3.2 Derivation. 3.3 Ambiguity in Grammar

TAFL 1 (ECS-403) Unit- III. 3.1 Definition of CFG (Context Free Grammar) and problems. 3.2 Derivation. 3.3 Ambiguity in Grammar TAFL 1 (ECS-403) Unit- III 3.1 Definition of CFG (Context Free Grammar) and problems 3.2 Derivation 3.3 Ambiguity in Grammar 3.3.1 Inherent Ambiguity 3.3.2 Ambiguous to Unambiguous CFG 3.4 Simplification

More information

CISC4090: Theory of Computation

CISC4090: Theory of Computation CISC4090: Theory of Computation Chapter 2 Context-Free Languages Courtesy of Prof. Arthur G. Werschulz Fordham University Department of Computer and Information Sciences Spring, 2014 Overview In Chapter

More information

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen Pushdown automata Twan van Laarhoven Institute for Computing and Information Sciences Intelligent Systems Version: fall 2014 T. van Laarhoven Version: fall 2014 Formal Languages, Grammars and Automata

More information

Context Free Languages. Automata Theory and Formal Grammars: Lecture 6. Languages That Are Not Regular. Non-Regular Languages

Context Free Languages. Automata Theory and Formal Grammars: Lecture 6. Languages That Are Not Regular. Non-Regular Languages Context Free Languages Automata Theory and Formal Grammars: Lecture 6 Context Free Languages Last Time Decision procedures for FAs Minimum-state DFAs Today The Myhill-Nerode Theorem The Pumping Lemma Context-free

More information

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) October,

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever.   ETH Zürich (D-ITET) October, Automata & languages A primer on the Theory of Computation Laurent Vanbever www.vanbever.eu ETH Zürich (D-ITET) October, 5 2017 Part 3 out of 5 Last week, we learned about closure and equivalence of regular

More information

Part 3 out of 5. Automata & languages. A primer on the Theory of Computation. Last week, we learned about closure and equivalence of regular languages

Part 3 out of 5. Automata & languages. A primer on the Theory of Computation. Last week, we learned about closure and equivalence of regular languages Automata & languages A primer on the Theory of Computation Laurent Vanbever www.vanbever.eu Part 3 out of 5 ETH Zürich (D-ITET) October, 5 2017 Last week, we learned about closure and equivalence of regular

More information

Definition: A grammar G = (V, T, P,S) is a context free grammar (cfg) if all productions in P have the form A x where

Definition: A grammar G = (V, T, P,S) is a context free grammar (cfg) if all productions in P have the form A x where Recitation 11 Notes Context Free Grammars Definition: A grammar G = (V, T, P,S) is a context free grammar (cfg) if all productions in P have the form A x A V, and x (V T)*. Examples Problem 1. Given the

More information

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs Harry Lewis October 8, 2013 Reading: Sipser, pp. 119-128. Pushdown Automata (review) Pushdown Automata = Finite automaton

More information

60-354, Theory of Computation Fall Asish Mukhopadhyay School of Computer Science University of Windsor

60-354, Theory of Computation Fall Asish Mukhopadhyay School of Computer Science University of Windsor 60-354, Theory of Computation Fall 2013 Asish Mukhopadhyay School of Computer Science University of Windsor Pushdown Automata (PDA) PDA = ε-nfa + stack Acceptance ε-nfa enters a final state or Stack is

More information

Context-free Grammars and Languages

Context-free Grammars and Languages Context-free Grammars and Languages COMP 455 002, Spring 2019 Jim Anderson (modified by Nathan Otterness) 1 Context-free Grammars Context-free grammars provide another way to specify languages. Example:

More information

MA/CSSE 474 Theory of Computation

MA/CSSE 474 Theory of Computation MA/CSSE 474 Theory of Computation CFL Hierarchy CFL Decision Problems Your Questions? Previous class days' material Reading Assignments HW 12 or 13 problems Anything else I have included some slides online

More information

Context-Free Grammars (and Languages) Lecture 7

Context-Free Grammars (and Languages) Lecture 7 Context-Free Grammars (and Languages) Lecture 7 1 Today Beyond regular expressions: Context-Free Grammars (CFGs) What is a CFG? What is the language associated with a CFG? Creating CFGs. Reasoning about

More information

An automaton with a finite number of states is called a Finite Automaton (FA) or Finite State Machine (FSM).

An automaton with a finite number of states is called a Finite Automaton (FA) or Finite State Machine (FSM). Automata The term "Automata" is derived from the Greek word "αὐτόματα" which means "self-acting". An automaton (Automata in plural) is an abstract self-propelled computing device which follows a predetermined

More information

Properties of Context-Free Languages. Closure Properties Decision Properties

Properties of Context-Free Languages. Closure Properties Decision Properties Properties of Context-Free Languages Closure Properties Decision Properties 1 Closure Properties of CFL s CFL s are closed under union, concatenation, and Kleene closure. Also, under reversal, homomorphisms

More information

Languages. Languages. An Example Grammar. Grammars. Suppose we have an alphabet V. Then we can write:

Languages. Languages. An Example Grammar. Grammars. Suppose we have an alphabet V. Then we can write: Languages A language is a set (usually infinite) of strings, also known as sentences Each string consists of a sequence of symbols taken from some alphabet An alphabet, V, is a finite set of symbols, e.g.

More information

NPDA, CFG equivalence

NPDA, CFG equivalence NPDA, CFG equivalence Theorem A language L is recognized by a NPDA iff L is described by a CFG. Must prove two directions: ( ) L is recognized by a NPDA implies L is described by a CFG. ( ) L is described

More information

Theory of Computation (II) Yijia Chen Fudan University

Theory of Computation (II) Yijia Chen Fudan University Theory of Computation (II) Yijia Chen Fudan University Review A language L is a subset of strings over an alphabet Σ. Our goal is to identify those languages that can be recognized by one of the simplest

More information

Miscellaneous. Closure Properties Decision Properties

Miscellaneous. Closure Properties Decision Properties Miscellaneous Closure Properties Decision Properties 1 Closure Properties of CFL s CFL s are closed under union, concatenation, and Kleene closure. Also, under reversal, homomorphisms and inverse homomorphisms.

More information

CS5371 Theory of Computation. Lecture 7: Automata Theory V (CFG, CFL, CNF)

CS5371 Theory of Computation. Lecture 7: Automata Theory V (CFG, CFL, CNF) CS5371 Theory of Computation Lecture 7: Automata Theory V (CFG, CFL, CNF) Announcement Homework 2 will be given soon (before Tue) Due date: Oct 31 (Tue), before class Midterm: Nov 3, (Fri), first hour

More information

This lecture covers Chapter 7 of HMU: Properties of CFLs

This lecture covers Chapter 7 of HMU: Properties of CFLs This lecture covers Chapter 7 of HMU: Properties of CFLs Chomsky Normal Form Pumping Lemma for CFs Closure Properties of CFLs Decision Properties of CFLs Additional Reading: Chapter 7 of HMU. Chomsky Normal

More information

DD2371 Automata Theory

DD2371 Automata Theory KTH CSC VT 2008 DD2371 Automata Theory Dilian Gurov Lecture Outline 1. The lecturer 2. Introduction to automata theory 3. Course syllabus 4. Course objectives 5. Course organization 6. First definitions

More information

The Pumping Lemma. for all n 0, u 1 v n u 2 L (i.e. u 1 u 2 L, u 1 vu 2 L [but we knew that anyway], u 1 vvu 2 L, u 1 vvvu 2 L, etc.

The Pumping Lemma. for all n 0, u 1 v n u 2 L (i.e. u 1 u 2 L, u 1 vu 2 L [but we knew that anyway], u 1 vvu 2 L, u 1 vvvu 2 L, etc. The Pumping Lemma For every regular language L, there is a number l 1 satisfying the pumping lemma property: All w L with w l can be expressed as a concatenation of three strings, w = u 1 vu 2, where u

More information

6.8 The Post Correspondence Problem

6.8 The Post Correspondence Problem 6.8. THE POST CORRESPONDENCE PROBLEM 423 6.8 The Post Correspondence Problem The Post correspondence problem (due to Emil Post) is another undecidable problem that turns out to be a very helpful tool for

More information

Parsing. Context-Free Grammars (CFG) Laura Kallmeyer. Winter 2017/18. Heinrich-Heine-Universität Düsseldorf 1 / 26

Parsing. Context-Free Grammars (CFG) Laura Kallmeyer. Winter 2017/18. Heinrich-Heine-Universität Düsseldorf 1 / 26 Parsing Context-Free Grammars (CFG) Laura Kallmeyer Heinrich-Heine-Universität Düsseldorf Winter 2017/18 1 / 26 Table of contents 1 Context-Free Grammars 2 Simplifying CFGs Removing useless symbols Eliminating

More information

Theory of Computation - Module 3

Theory of Computation - Module 3 Theory of Computation - Module 3 Syllabus Context Free Grammar Simplification of CFG- Normal forms-chomsky Normal form and Greibach Normal formpumping lemma for Context free languages- Applications of

More information

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES Contents i SYLLABUS UNIT - I CHAPTER - 1 : AUT UTOMA OMATA Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 2 : FINITE AUT UTOMA OMATA An Informal Picture of Finite Automata,

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY REVIEW for MIDTERM 1 THURSDAY Feb 6 Midterm 1 will cover everything we have seen so far The PROBLEMS will be from Sipser, Chapters 1, 2, 3 It will be

More information

Notes for Comp 497 (Comp 454) Week 10 4/5/05

Notes for Comp 497 (Comp 454) Week 10 4/5/05 Notes for Comp 497 (Comp 454) Week 10 4/5/05 Today look at the last two chapters in Part II. Cohen presents some results concerning context-free languages (CFL) and regular languages (RL) also some decidability

More information

Chapter 3. Regular grammars

Chapter 3. Regular grammars Chapter 3 Regular grammars 59 3.1 Introduction Other view of the concept of language: not the formalization of the notion of effective procedure, but set of words satisfying a given set of rules Origin

More information

Computational Models: Class 5

Computational Models: Class 5 Computational Models: Class 5 Benny Chor School of Computer Science Tel Aviv University March 27, 2019 Based on slides by Maurice Herlihy, Brown University, and modifications by Iftach Haitner and Yishay

More information

Automata Theory and Formal Grammars: Lecture 1

Automata Theory and Formal Grammars: Lecture 1 Automata Theory and Formal Grammars: Lecture 1 Sets, Languages, Logic Automata Theory and Formal Grammars: Lecture 1 p.1/72 Sets, Languages, Logic Today Course Overview Administrivia Sets Theory (Review?)

More information

MA/CSSE 474 Theory of Computation

MA/CSSE 474 Theory of Computation MA/CSSE 474 Theory of Computation Bottom-up parsing Pumping Theorem for CFLs Recap: Going One Way Lemma: Each context-free language is accepted by some PDA. Proof (by construction): The idea: Let the stack

More information

CS481F01 Prelim 2 Solutions

CS481F01 Prelim 2 Solutions CS481F01 Prelim 2 Solutions A. Demers 7 Nov 2001 1 (30 pts = 4 pts each part + 2 free points). For this question we use the following notation: x y means x is a prefix of y m k n means m n k For each of

More information

Automata: a short introduction

Automata: a short introduction ILIAS, University of Luxembourg Discrete Mathematics II May 2012 What is a computer? Real computers are complicated; We abstract up to an essential model of computation; We begin with the simplest possible

More information

CSCI 340: Computational Models. Regular Expressions. Department of Computer Science

CSCI 340: Computational Models. Regular Expressions. Department of Computer Science CSCI 340: Computational Models Regular Expressions Chapter 4 Department of Computer Science Yet Another New Method for Defining Languages Given the Language: L 1 = {x n for n = 1 2 3...} We could easily

More information

Concordia University Department of Computer Science & Software Engineering

Concordia University Department of Computer Science & Software Engineering Concordia University Department of Computer Science & Software Engineering COMP 335/4 Theoretical Computer Science Winter 2015 Assignment 3 1. In each case, what language is generated by CFG s below. Justify

More information

CISC 4090 Theory of Computation

CISC 4090 Theory of Computation CISC 4090 Theory of Computation Context-Free Languages and Push Down Automata Professor Daniel Leeds dleeds@fordham.edu JMH 332 Languages: Regular and Beyond Regular: Captured by Regular Operations a b

More information

Computational Models - Lecture 5 1

Computational Models - Lecture 5 1 Computational Models - Lecture 5 1 Handout Mode Iftach Haitner and Yishay Mansour. Tel Aviv University. April 10/22, 2013 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

Before We Start. The Pumping Lemma. Languages. Context Free Languages. Plan for today. Now our picture looks like. Any questions?

Before We Start. The Pumping Lemma. Languages. Context Free Languages. Plan for today. Now our picture looks like. Any questions? Before We Start The Pumping Lemma Any questions? The Lemma & Decision/ Languages Future Exam Question What is a language? What is a class of languages? Context Free Languages Context Free Languages(CFL)

More information

Properties of Context-free Languages. Reading: Chapter 7

Properties of Context-free Languages. Reading: Chapter 7 Properties of Context-free Languages Reading: Chapter 7 1 Topics 1) Simplifying CFGs, Normal forms 2) Pumping lemma for CFLs 3) Closure and decision properties of CFLs 2 How to simplify CFGs? 3 Three ways

More information

CPS 220 Theory of Computation

CPS 220 Theory of Computation CPS 22 Theory of Computation Review - Regular Languages RL - a simple class of languages that can be represented in two ways: 1 Machine description: Finite Automata are machines with a finite number of

More information

Functions on languages:

Functions on languages: MA/CSSE 474 Final Exam Notation and Formulas page Name (turn this in with your exam) Unless specified otherwise, r,s,t,u,v,w,x,y,z are strings over alphabet Σ; while a, b, c, d are individual alphabet

More information

FLAC Context-Sensitive Grammars

FLAC Context-Sensitive Grammars FLAC Context-Sensitive Grammars Klaus Sutner Carnegie Mellon Universality Fall 2017 1 Context-Sensitive Grammars Linear Bounded Automata LBA and Counting Where Are We? 3 Context-free languages based on

More information

Harvard CS 121 and CSCI E-207 Lecture 9: Regular Languages Wrap-Up, Context-Free Grammars

Harvard CS 121 and CSCI E-207 Lecture 9: Regular Languages Wrap-Up, Context-Free Grammars Harvard CS 121 and CSCI E-207 Lecture 9: Regular Languages Wrap-Up, Context-Free Grammars Salil Vadhan October 2, 2012 Reading: Sipser, 2.1 (except Chomsky Normal Form). Algorithmic questions about regular

More information

Final exam study sheet for CS3719 Turing machines and decidability.

Final exam study sheet for CS3719 Turing machines and decidability. Final exam study sheet for CS3719 Turing machines and decidability. A Turing machine is a finite automaton with an infinite memory (tape). Formally, a Turing machine is a 6-tuple M = (Q, Σ, Γ, δ, q 0,

More information

Context-Free Grammars and Languages. We have seen that many languages cannot be regular. Thus we need to consider larger classes of langs.

Context-Free Grammars and Languages. We have seen that many languages cannot be regular. Thus we need to consider larger classes of langs. Context-Free Grammars and Languages We have seen that many languages cannot be regular. Thus we need to consider larger classes of langs. Contex-Free Languages (CFL s) played a central role natural languages

More information

1. (a) Explain the procedure to convert Context Free Grammar to Push Down Automata.

1. (a) Explain the procedure to convert Context Free Grammar to Push Down Automata. Code No: R09220504 R09 Set No. 2 II B.Tech II Semester Examinations,December-January, 2011-2012 FORMAL LANGUAGES AND AUTOMATA THEORY Computer Science And Engineering Time: 3 hours Max Marks: 75 Answer

More information

CS500 Homework #2 Solutions

CS500 Homework #2 Solutions CS500 Homework #2 Solutions 1. Consider the two languages Show that L 1 is context-free but L 2 is not. L 1 = {a i b j c k d l i = j k = l} L 2 = {a i b j c k d l i = k j = l} Answer. L 1 is the concatenation

More information

Theory of Computation (Classroom Practice Booklet Solutions)

Theory of Computation (Classroom Practice Booklet Solutions) Theory of Computation (Classroom Practice Booklet Solutions) 1. Finite Automata & Regular Sets 01. Ans: (a) & (c) Sol: (a) The reversal of a regular set is regular as the reversal of a regular expression

More information

Theory Bridge Exam Example Questions

Theory Bridge Exam Example Questions Theory Bridge Exam Example Questions Annotated version with some (sometimes rather sketchy) answers and notes. This is a collection of sample theory bridge exam questions. This is just to get some idea

More information

Computational Theory

Computational Theory Computational Theory Finite Automata and Regular Languages Curtis Larsen Dixie State University Computing and Design Fall 2018 Adapted from notes by Russ Ross Adapted from notes by Harry Lewis Curtis Larsen

More information

Theory of computation: initial remarks (Chapter 11)

Theory of computation: initial remarks (Chapter 11) Theory of computation: initial remarks (Chapter 11) For many purposes, computation is elegantly modeled with simple mathematical objects: Turing machines, finite automata, pushdown automata, and such.

More information

Non-context-Free Languages. CS215, Lecture 5 c

Non-context-Free Languages. CS215, Lecture 5 c Non-context-Free Languages CS215, Lecture 5 c 2007 1 The Pumping Lemma Theorem. (Pumping Lemma) Let be context-free. There exists a positive integer divided into five pieces, Proof for for each, and..

More information

Formal Languages and Automata

Formal Languages and Automata Formal Languages and Automata 5 lectures for 2016-17 Computer Science Tripos Part IA Discrete Mathematics by Ian Leslie c 2014,2015 AM Pitts; 2016,2017 IM Leslie (minor tweaks) What is this course about?

More information

Closure Properties of Context-Free Languages. Foundations of Computer Science Theory

Closure Properties of Context-Free Languages. Foundations of Computer Science Theory Closure Properties of Context-Free Languages Foundations of Computer Science Theory Closure Properties of CFLs CFLs are closed under: Union Concatenation Kleene closure Reversal CFLs are not closed under

More information

In English, there are at least three different types of entities: letters, words, sentences.

In English, there are at least three different types of entities: letters, words, sentences. Chapter 2 Languages 2.1 Introduction In English, there are at least three different types of entities: letters, words, sentences. letters are from a finite alphabet { a, b, c,..., z } words are made up

More information

Notes for Comp 497 (454) Week 10

Notes for Comp 497 (454) Week 10 Notes for Comp 497 (454) Week 10 Today we look at the last two chapters in Part II. Cohen presents some results concerning the two categories of language we have seen so far: Regular languages (RL). Context-free

More information

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I Internal Examination 2017-18 B.Tech III Year VI Semester Sub: Theory of Computation (6CS3A) Time: 1 Hour 30 min. Max Marks: 40 Note: Attempt all three

More information

Theory Of Computation UNIT-II

Theory Of Computation UNIT-II Regular Expressions and Context Free Grammars: Regular expression formalism- equivalence with finite automata-regular sets and closure properties- pumping lemma for regular languages- decision algorithms

More information

Grammars and Context-free Languages; Chomsky Hierarchy

Grammars and Context-free Languages; Chomsky Hierarchy Regular and Context-free Languages; Chomsky Hierarchy H. Geuvers Institute for Computing and Information Sciences Version: fall 2015 H. Geuvers Version: fall 2015 Huygens College 1 / 23 Outline Regular

More information

Context-Free Grammars. 2IT70 Finite Automata and Process Theory

Context-Free Grammars. 2IT70 Finite Automata and Process Theory Context-Free Grammars 2IT70 Finite Automata and Process Theory Technische Universiteit Eindhoven May 18, 2016 Generating strings language L 1 = {a n b n n > 0} ab L 1 if w L 1 then awb L 1 production rules

More information

CDM Closure Properties

CDM Closure Properties CDM Closure Properties Klaus Sutner Carnegie Mellon Universality 15-closure 2017/12/15 23:19 1 Nondeterministic Machines 2 Determinization 3 Closure Properties Where Are We? 3 We have a definition of regular

More information

Arithmetical Hierarchy

Arithmetical Hierarchy Arithmetical Hierarchy Klaus Sutner Carnegie Mellon University 60-arith-hier 2017/12/15 23:18 1 The Turing Jump Arithmetical Hierarchy Definability Formal Systems Recall: Oracles 3 We can attach an orcale

More information

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013 Q.2 a. Prove by mathematical induction n 4 4n 2 is divisible by 3 for n 0. Basic step: For n = 0, n 3 n = 0 which is divisible by 3. Induction hypothesis: Let p(n) = n 3 n is divisible by 3. Induction

More information

Automata and Computability. Solutions to Exercises

Automata and Computability. Solutions to Exercises Automata and Computability Solutions to Exercises Spring 27 Alexis Maciel Department of Computer Science Clarkson University Copyright c 27 Alexis Maciel ii Contents Preface vii Introduction 2 Finite Automata

More information

UNIT II REGULAR LANGUAGES

UNIT II REGULAR LANGUAGES 1 UNIT II REGULAR LANGUAGES Introduction: A regular expression is a way of describing a regular language. The various operations are closure, union and concatenation. We can also find the equivalent regular

More information

Theory of Computation

Theory of Computation Thomas Zeugmann Hokkaido University Laboratory for Algorithmics http://www-alg.ist.hokudai.ac.jp/ thomas/toc/ Lecture 10: CF, PDAs and Beyond Greibach Normal Form I We want to show that all context-free

More information

Computability and Complexity

Computability and Complexity Computability and Complexity Rewriting Systems and Chomsky Grammars CAS 705 Ryszard Janicki Department of Computing and Software McMaster University Hamilton, Ontario, Canada janicki@mcmaster.ca Ryszard

More information

Lecture Notes on Inductive Definitions

Lecture Notes on Inductive Definitions Lecture Notes on Inductive Definitions 15-312: Foundations of Programming Languages Frank Pfenning Lecture 2 August 28, 2003 These supplementary notes review the notion of an inductive definition and give

More information

download instant at Assume that (w R ) R = w for all strings w Σ of length n or less.

download instant at  Assume that (w R ) R = w for all strings w Σ of length n or less. Chapter 2 Languages 3. We prove, by induction on the length of the string, that w = (w R ) R for every string w Σ. Basis: The basis consists of the null string. In this case, (λ R ) R = (λ) R = λ as desired.

More information

This lecture covers Chapter 5 of HMU: Context-free Grammars

This lecture covers Chapter 5 of HMU: Context-free Grammars This lecture covers Chapter 5 of HMU: Context-free rammars (Context-free) rammars (Leftmost and Rightmost) Derivations Parse Trees An quivalence between Derivations and Parse Trees Ambiguity in rammars

More information

Introduction and Motivation. Introduction and Motivation. Introduction to Computability. Introduction and Motivation. Theory. Lecture5: Context Free

Introduction and Motivation. Introduction and Motivation. Introduction to Computability. Introduction and Motivation. Theory. Lecture5: Context Free ntroduction to Computability Theory Lecture5: Context Free Languages Prof. Amos sraeli 1 ntroduction and Motivation n our study of RL-s we Covered: 1. Motivation and definition of regular languages. 2.

More information

CPSC 421: Tutorial #1

CPSC 421: Tutorial #1 CPSC 421: Tutorial #1 October 14, 2016 Set Theory. 1. Let A be an arbitrary set, and let B = {x A : x / x}. That is, B contains all sets in A that do not contain themselves: For all y, ( ) y B if and only

More information

Properties of Context-Free Languages

Properties of Context-Free Languages Properties of Context-Free Languages Seungjin Choi Department of Computer Science and Engineering Pohang University of Science and Technology 77 Cheongam-ro, Nam-gu, Pohang 37673, Korea seungjin@postech.ac.kr

More information

Pushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen

Pushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen Pushdown Automata Notes on Automata and Theory of Computation Chia-Ping Chen Department of Computer Science and Engineering National Sun Yat-Sen University Kaohsiung, Taiwan ROC Pushdown Automata p. 1

More information

Arithmetical Hierarchy

Arithmetical Hierarchy Arithmetical Hierarchy 1 The Turing Jump Klaus Sutner Carnegie Mellon University Arithmetical Hierarchy 60-arith-hier 2017/12/15 23:18 Definability Formal Systems Recall: Oracles 3 The Use Principle 4

More information

Context-free grammars and languages

Context-free grammars and languages Context-free grammars and languages The next class of languages we will study in the course is the class of context-free languages. They are defined by the notion of a context-free grammar, or a CFG for

More information