Let L= { a n b m c p : n ≠ p, and n, m, p ≥ 0} 1.Design a context-free grammar that generates L. 2. Design a PDA that accepts L.

Slides:



Advertisements
Similar presentations
The Pumping Lemma for CFL’s
Advertisements

Chapter Three: Closure Properties for Regular Languages
Finite Automata CPSC 388 Ellen Walker Hiram College.
Reducibility Class of problems A can be reduced to the class of problems B Take any instance of problem A Show how you can construct an instance of problem.
1 Section 14.1 Computability Some problems cannot be solved by any machine/algorithm. To prove such statements we need to effectively describe all possible.
1 Introduction to Computability Theory Discussion3: Uses of the Pumping Lemma Prof. Amos Israeli.
Complexity 25-1 Complexity Andrei Bulatov #P-Completeness.
Computability and Complexity 23-1 Computability and Complexity Andrei Bulatov Search and Optimization.
Complexity 15-1 Complexity Andrei Bulatov Hierarchy Theorem.
Complexity 11-1 Complexity Andrei Bulatov Space Complexity.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
Reducibility A reduction is a way of converting one problem into another problem in such a way that a solution to the second problem can be used to solve.
CS 302: Discrete Math II A Review. An alphabet Σ is a finite set (e.g., Σ = {0,1}) A string over Σ is a finite-length sequence of elements of Σ For x.
What is the first line of the proof? a). Assume G has an Eulerian circuit. b). Assume every vertex has even degree. c). Let v be any vertex in G. d). Let.
1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse.
Costas Busch - RPI1 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
Validating Streaming XML Documents Luc Segoufin & Victor Vianu Presented by Harel Paz.
1 Regular Grammars Generate Regular Languages. 2 Theorem Regular grammars generate exactly the class of regular languages: If is a regular grammar then.
1 Decidability continued. 2 Undecidable Problems Halting Problem: Does machine halt on input ? State-entry Problem: Does machine enter state halt on input.
Fall 2004COMP 3351 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
Theory of Computing Lecture 22 MAS 714 Hartmut Klauck.
1 Non-regular languages. 2 Regular languages Non-regular languages.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
Problem of the DAY Create a regular context-free grammar that generates L= {w  {a,b}* : the number of a’s in w is not divisible by 3} Hint: start by designing.
Introduction Chapter 0. Three Central Areas 1.Automata 2.Computability 3.Complexity.
Complexity 2-1 Problems and Languages Complexity Andrei Bulatov.
CSE 3813 Introduction to Formal Languages and Automata Chapter 8 Properties of Context-free Languages These class notes are based on material from our.
1 Proof of the Day: Let P= {(b, acbb), (aac, a), (b, ca)}. 1.Prove that P has a match. 2. Find Q which is P encoded in binary. 3.What match of Q corresponds.
Tutorial CSC3130 : Formal Languages and Automata Theory Haifeng Wan ( )
1 Homework #7 (Models of Computation, Spring, 2001) Due: Section 1; April 16 (Monday) Section 2; April 17 (Tuesday) 2. Covert the following context-free.
1 Let L= { w= u v : u  {a, b}*, v  {c, d}* and |u|= |v|} 1.Design a context-free grammar that generates L. 2.Use your grammar and the construction from.
1 State SymbolRead- Q E(Q) a b a b a b Convert to a DFA: Start state: Final States:
1 3-COLOURING: Input: Graph G Question: Does there exist a way to 3-colour the vertices of G so that adjacent vertices are different colours? 1.What could.
Complexity 25-1 Complexity Andrei Bulatov Counting Problems.
Problem of the Day: Factor (ab) k as xyz in all ways such that y ≠ ε.
TK PrasadPumping Lemma1 Nonregularity Proofs. TK PrasadPumping Lemma2 Grand Unification Regular Languages: Grand Unification (Parallel Simulation) (Rabin.
1 L= { w c w R : w  {a, b}* } is accepted by the PDA below. Use a construction like the one for intersection for regular languages to design a PDA that.
Class Discussion Can you draw a DFA that accepts the language {a k b k | k = 0,1,2,…} over the alphabet  ={a,b}?
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
Properties of Regular Languages
Chapter 6 Properties of Regular Languages. 2 Regular Sets and Languages  Claim(1). The family of languages accepted by FSAs consists of precisely the.
NP-completeness Class of hard problems. Jaruloj ChongstitvatanaNP-complete Problems2 Outline  Introduction  Problems and Languages Turing machines and.
1 Suppose I construct a TM M f which: 1. Preserves its input u. 2. Simulates a machine M b on input ε. 3. If M b hangs on input ε, force an infinite loop.
Non-Context-Free Languages Section 2.3 CSC 4170 Theory of Computation.
CSCI 3130: Formal languages and automata theory Tutorial 3 Chin.
Critique this PDA for L= { u u R v v R : u ∈ {0,1}* and v ∈ {0,1}+ } u0εu0 u1εu1 uεεvε v00vε v11vε vεεfε sεεtε t0εt0 t1εt1 t00tε t11tε tεεuε After you.
Chapter 8 Properties of Context-free Languages These class notes are based on material from our textbook, An Introduction to Formal Languages and Automata,
CSCI 2670 Introduction to Theory of Computing October 13, 2005.
Lecture. Today Problem set 9 out (due next Thursday) Topics: –Complexity Theory –Optimization versus Decision Problems –P and NP –Efficient Verification.
1 Create a NDFA which accepts the language generated by this context-free grammar. Start symbol: S S → aa S S → ε S → M M → bbb M → ab M M → b S M → E.
Complexity 24-1 Complexity Andrei Bulatov Counting Problems.
1 A well-parenthesized string is a string with the same number of (‘s as )’s which has the property that every prefix of the string has at least as many.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
1 Use the pumping theorem for context-free languages to prove that L= { a n b a n b a p : n, p ≥ 0, p ≥ n } is not context-free. Hint: For the pumping.
Recursively Enumerable and Recursive Languages. Definition: A language is recursively enumerable if some Turing machine accepts it.
Formal Language & Automata Theory
Non-regular languages
Standard Representations of Regular Languages
CSE322 PUMPING LEMMA FOR REGULAR SETS AND ITS APPLICATIONS
PROPERTIES OF REGULAR LANGUAGES
Infiniteness Test The Pumping Lemma Nonregular Languages
Elementary Questions about Regular Languages
Chapter 4 Properties of Regular Languages
The Pumping Lemma for CFL’s
Problem Solving 4.
Convert to a DFA: Start state: Final States: State Symbol Read- Q E(Q)
Announcements Midterm is Wednesday June 23 in class.
Algorithms to Answer Questions about Regular Languages
Decidability continued….
Presentation transcript:

Let L= { a n b m c p : n ≠ p, and n, m, p ≥ 0} 1.Design a context-free grammar that generates L. 2. Design a PDA that accepts L.

2 Post’s Correspondence Program (PCP): P = {(a, ab), (b, ca), (ca, a), (abc, c)}, MATCH: (a, ab) (b, ca) (ca, a) (a, ab) (abc, c) a b ca a abc = abcaaabc

3 PCP over a 1-symbol alphabet {a} is easy: If P has a pair (a k, a k ) the answer is yes. If P has two pairs: one with more symbols in the first part: T 1 =(a r+i, a r ) one with more symbols in the second part: T 2 =(a s, a s+j ) the answer is yes- take j copies of T 1 and i copies of T 2. Otherwise, the answer is no.

4 Given: No algorithms exist to solve PCP over an arbitrary alphabet. Theorem: No algorithm exist to solve PCP over {0, 1}. Proof: Assume there is an algorithm which solves PCP over {0,1}. Such an algorithm can be used to solve PCP over an arbitrary alphabet as per the model solutions of assignment #2- the problem over an arbitrary alphabet can be converted to one over {0,1} by encoding in either unary or binary (your choice).

5 The Pumping Lemma for Regular Languages: If L is a language accepted by a DFA with k states, and w  L, |w| ≥ k, then  x, y, z such that 1. w = x y z, 2. y ≠ ε, 3. | x y | ≤ k, and 4. x y n z is in L for all n ≥ 0. The pumping lemma is NOT strong enough to work directly to prove that certain languages are not regular.

6 Let L be a language which has a constant k such that for all w  L, |w| ≥ k,  x, y, z such that 1. w = x y z, 2. y ≠ ε, 3. | x y | ≤ k, and 4. x y n z is in L for all n ≥ 0. Then you CANNOT conclude that L is regular. Counterexample: See assignment 3. L 1 = { u u R v : u, v in {a, b} + } This is necessary but not sufficient for a language to be regular.

7 Theorem 1: If Hamilton Cycle has an algorithm which is polynomial time, then so does Hamilton Path. Theorem 2: If Hamilton Path has an algorithm which is polynomial time, then so does Hamilton Cycle. Currently nobody knows a polynomial time algorithm for either problem.

8 L= { u L 1 = { u u R v : u, v in {a, b} + } Why does every string w in L of length at least 4 have a string y that can be pumped? Case 1: |u| = 1. Case 2: |u| > 1.

9 Hamilton Path If (G has a Hamilton Cycle) return(yes) For each missing edge (u, v), if G+(u,v) has a Hamilton Cycle return(yes) Return(no) Time: O(n 2 * p(n, m+1) )

10 What is inefficient about this code? for (i=0; i < n; i++) for (j=0; j < n; j++) { tmp= G[i][j]; G[i][j]=1; G[j][i]=1; if (hamilton_cycle(n, G)) return(1); G[i][j]=tmp; G[j][i]=tmp; } return(0);

11 My solution: if (hamilton_cycle(n, G)) return(1); for (i=0; i < n; i++) for (j=i+1; j < n; j++) if (G[i][j] == 0) { G[i][j]=1; G[j][i]=1; found= hamilton_cycle(n, G); G[i][j]=0; G[j][i]=0; if (found) return(1); } return(0);

12 Hamilton Cycle: For each edge (u,v) if G + u’ + v’ + (u, u’) + (v, v’) has a Hamilton Path return (yes) Return(no) Time: O(n 2 q(n+2, m+2) )

13 My solution: for (i=0; i < n+2; i++) for (j=n; j < n+2; j++) { G[i][j]=0; G[j][i]=0;} for (i=0; i < n; i++) for (j=i+1; j<n; j++) if (G[i][j]) { G[i][n]=1; G[n][i]=1; G[j][n+1]=1;G[n+1][j]=1; if (hamilton_path(n+2, G)) return(1); G[i][n]=0; G[n][i]=0;G[j][n+1]=0;G[n+1][j]=0; } return(0);

14 Return(no) Time: O(n * q(n+2, m+2) ) Hamilton Cycle: A better solution For each neighbour of v if G + u’ + v’ + (u, u’) + (v, v’) has a Hamilton Path return (yes)

15 Some algorithms which do not work: If G-v has a Hamilton path for all vertices v this does NOT mean G has a Hamilton cycle. If G-e has a Hamilton path for all edges e this does NOT mean G has a Hamilton cycle.

16 Theorem: The Petersen graph has no Hamilton cycles. If it did, the edges would be 3-edge colourable.

17 On outside cycle: one colour used once and others used twice:

18 Colours of spoke edges are forced:

19 More forcings then stuck:

20 G-v has a Hamilton Path for all v.

21 G-e has a Hamilton Path for all e.