1/44 #-Rewriting Systems Based upon Brno University of Technology, Czech Republic  Křivka, Z., Meduna, A., Schönecker, R.: Generation.

Slides:



Advertisements
Similar presentations
1 Pushdown Automata (PDA) Informally: –A PDA is an NFA-ε with a stack. –Transitions are modified to accommodate stack operations. Questions: –What is a.
Advertisements

Grammars, Languages and Parse Trees. Language Let V be an alphabet or vocabulary V* is set of all strings over V A language L is a subset of V*, i.e.,
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
Turing machines Sipser 2.3 and 3.1 (pages )
CS5371 Theory of Computation
1 … NPDAs continued. 2 Pushing Strings Input symbol Pop symbol Push string.
Lecture 3 Goals: Formal definition of NFA, acceptance of a string by an NFA, computation tree associated with a string. Algorithm to convert an NFA to.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture 4 Context-free grammars Jan Maluszynski, IDA, 2007
Discussion #31/20 Discussion #3 Grammar Formalization & Parse-Tree Construction.
1 Reverse of a Regular Language. 2 Theorem: The reverse of a regular language is a regular language Proof idea: Construct NFA that accepts : invert the.
79 Regular Expression Regular expressions over an alphabet  are defined recursively as follows. (1) Ø, which denotes the empty set, is a regular expression.
Normal forms for Context-Free Grammars
Finite State Machines Data Structures and Algorithms for Information Processing 1.
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.
Formal Grammars Denning, Sections 3.3 to 3.6. Formal Grammar, Defined A formal grammar G is a four-tuple G = (N,T,P,  ), where N is a finite nonempty.
Lecture 16 Oct 18 Context-Free Languages (CFL) - basic definitions Examples.
Scattered Context Grammars Alexander Meduna Faculty of Information Technology Brno University of Technology Brno, Czech Republic, Europe.
Chapter 7 PDA and CFLs.
::ICS 804:: Theory of Computation - Ibrahim Otieno SCI/ICT Building Rm. G15.
Context-Free Grammars Normal Forms Chapter 11. Normal Forms A normal form F for a set C of data objects is a form, i.e., a set of syntactically valid.
CSCI 2670 Introduction to Theory of Computing September 20, 2005.
CSCI 2670 Introduction to Theory of Computing September 21, 2004.
Pushdown Automata (PDAs)
Languages, Grammars, and Regular Expressions Chuck Cusack Based partly on Chapter 11 of “Discrete Mathematics and its Applications,” 5 th edition, by Kenneth.
Context Free Grammars CIS 361. Introduction Finite Automata accept all regular languages and only regular languages Many simple languages are non regular:
Grammars CPSC 5135.
Context-free Languages
Dept. of Computer Science & IT, FUUAST Automata Theory 2 Automata Theory V Context-Free Grammars andLanguages.
Regulated Pushdown Automata Alexander Meduna 1/22 Faculty of Information Technology Brno University of Technology Brno, Czech Republic, Europe.
1 Computability Five lectures. Slides available from my web page There is some formality, but it is gentle,
Introduction to Language Theory
Computing languages by (bounded) local sets Dora Giammarresi Università di Roma “Tor Vergata” Italy.
Random Context and Programmed Grammars of Finite Index Have The Same Generative Power Doc. RNDr. Alexander Meduna, CSc. Ing. Zbyněk Křivka DIFS, FIT, Brno.
Part VII. Models for Context-Free Languages 1/50.
Phrase-structure grammar A phrase-structure grammar is a quadruple G = (V, T, P, S) where V is a finite set of symbols called nonterminals, T is a set.
Regular Grammars Chapter 7. Regular Grammars A regular grammar G is a quadruple (V, , R, S), where: ● V is the rule alphabet, which contains nonterminals.
Grammar G = (V N, V T, P, S) –V N : Nonterminal symbols –V T : Terminal symbols V N  V T = , V N ∪ V T = V – P : a finite set of production rules α 
Midterm 1 Breakdown >79 3 >29 7 >69 5 >19 5 >59 7 >49 9 >39 7.
Regular Grammars Chapter 7 1. Regular Grammars A regular grammar G is a quadruple (V, , R, S), where: ● V is the rule alphabet, which contains nonterminals.
Deep Pushdown Automata Alexander Meduna Brno University of Technology, Czech Republic  Based on Meduna, A.: Deep Pushdown Automata,
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.
Chapter 6 Properties of Regular Languages. 2 Regular Sets and Languages  Claim(1). The family of languages accepted by FSAs consists of precisely the.
CS 3813: Introduction to Formal Languages and Automata
Grammars A grammar is a 4-tuple G = (V, T, P, S) where 1)V is a set of nonterminal symbols (also called variables or syntactic categories) 2)T is a finite.
Introduction Finite Automata accept all regular languages and only regular languages Even very simple languages are non regular (  = {a,b}): - {a n b.
Context-Free Languages
1 Pushdown Automata There are context-free languages that are not regular. Finite automata cannot recognize all context-free languages.
Three Basic Concepts Languages Grammars Automata.
Mathematical Foundations of Computer Science Chapter 3: Regular Languages and Regular Grammars.
Chapter 4: Syntax analysis Syntax analysis is done by the parser. –Detects whether the program is written following the grammar rules and reports syntax.
Algorithms for hard problems Automata and tree automata Juris Viksna, 2015.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
CS 154 Formal Languages and Computability February 11 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron.
Unrestricted Grammars
Refining the Nonterminal Complexity of Graph-controlled Grammars Faculty of Informatics TU Wien, Wien, Austria Rudolf FREUND Wilhelm-Schickard-Institut.
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.
Lecture 6: Context-Free Languages
Akram Salah ISSR Basic Concepts Languages Grammar Automata (Automaton)
Chapter 4. Syntax Analysis (1). 2 Application of a production  A  in a derivation step  i   i+1.
Chapter 2. Formal Languages Dept. of Computer Engineering, Hansung University, Sung-Dong Kim.
Lecture #2 Advanced Theory of Computation. Languages & Grammar Before discussing languages & grammar let us deal with some related issues. Alphabet: is.
Formal Language & Automata Theory
Context Sensitive Grammar & Turing Machines
CS314 – Section 5 Recitation 3
Pushdown Automata Reading: Chapter 6.
Context-Free Languages
Context-Free Grammars and Languages
A HIERARCHY OF FORMAL LANGUAGES AND AUTOMATA
Chapter 7 Regular Grammars
Chapter 4. Syntax Analysis (1)
Presentation transcript:

1/44 #-Rewriting Systems Based upon Brno University of Technology, Czech Republic  Křivka, Z., Meduna, A., Schönecker, R.: Generation of Languages by Rewriting Systems that Resemble Automata, In: IJFCS Vol. 17, No. 5, 2006 and An Infinite Hierarchy Resulting from Them

2/44 Contents 1. Concepts 2. Definition 3. Main Result: An Infinite Hierarchy 4. Open Problem Areas

3/44 #-Rewriting Systems in Formal Language Theory Language-defining models Pure rewriting systems Between automata and grammars: have states but generate languages

4/44 Concept #-Rewriting System is based on the rules of the form p m #  q x 0 # x 1 … # x n by which the system makes a computational step  as (p, …#y m-1 #y m #y m+1 …)  (q, …# y m-1 x 0 #x 1 …#x n y m # y m+1 …) mth #

5/44 Definition 1/2 #-Rewriting System (#RS) is a quadruple H = (Q, , s, R), where Q  finite set of states,  alphabet, #   is called a bounder, s  Q  start state, R  finite set of rules of the form p m #  qx where p, q  Q, m is a positive integer, x   *.

6/44 Definition 2/2 Computational step: (p, u#v)  (q, uxv) [p m #  qx  R], where the number of #s in u is m – 1, p, q  Q, u, x, v   *. Configuration: (q, x), q  Q, x   * Generated language: L(H) = {w  (  – #) * : (s, #)  * (q, w) in H, q  Q}.

7/44 Example: #RS #RS H: [1]. s 1 #  p ## [2]. p 1 #  q a#b [3]. q 2 #  p #c [4]. p 1 #  f ab [5]. f 1 #  f c H accepts aabbcc:

8/44 Example: #RS (s, #)  #RS H: H accepts aabbcc: [1]. s 1 #  p ## [2]. p 1 #  q a#b [3]. q 2 #  p #c [4]. p 1 #  f ab [5]. f 1 #  f c

9/44 Example: #RS (s, #)  [1] #RS H: H accepts aabbcc: [1]. s 1 #  p ## [2]. p 1 #  q a#b [3]. q 2 #  p #c [4]. p 1 #  f ab [5]. f 1 #  f c

10/44 Example: #RS (s, #)  (p, ##) [1]  #RS H: H accepts aabbcc: [1]. s 1 #  p ## [2]. p 1 #  q a#b [3]. q 2 #  p #c [4]. p 1 #  f ab [5]. f 1 #  f c

11/44 Example: #RS (s, #)  (p, ##) [1]  [2] #RS H: H accepts aabbcc: [1]. s 1 #  p ## [2]. p 1 #  q a#b [3]. q 2 #  p #c [4]. p 1 #  f ab [5]. f 1 #  f c

12/44 Example: #RS (s, #)  (p, ##) [1]  (q, a#b#) [2]  #RS H: H accepts aabbcc: [1]. s 1 #  p ## [2]. p 1 #  q a#b [3]. q 2 #  p #c [4]. p 1 #  f ab [5]. f 1 #  f c

13/44 Example: #RS (s, #)  (p, ##) [1]  (q, a#b#) [2]  [3] #RS H: H accepts aabbcc: [1]. s 1 #  p ## [2]. p 1 #  q a#b [3]. q 2 #  p #c [4]. p 1 #  f ab [5]. f 1 #  f c

14/44 Example: #RS (s, #)  (p, ##) [1]  (q, a#b#) [2]  (p, a#bc#) [3]  #RS H: H accepts aabbcc: [1]. s 1 #  p ## [2]. p 1 #  q a#b [3]. q 2 #  p #c [4]. p 1 #  f ab [5]. f 1 #  f c

15/44 Example: #RS (s, #)  (p, ##) [1]  (q, a#b#) [2]  (p, a#bc#) [3]  [4] #RS H: H accepts aabbcc: [1]. s 1 #  p ## [2]. p 1 #  q a#b [3]. q 2 #  p #c [4]. p 1 #  f ab [5]. f 1 #  f c

16/44 Example: #RS (s, #)  (p, ##) [1]  (q, a#b#) [2]  (p, a#bc#) [3]  (f, aabbc#) [4]  #RS H: H accepts aabbcc: [1]. s 1 #  p ## [2]. p 1 #  q a#b [3]. q 2 #  p #c [4]. p 1 #  f ab [5]. f 1 #  f c

17/44 Example: #RS (s, #)  (p, ##) [1]  (q, a#b#) [2]  (p, a#bc#) [3]  (f, aabbc#) [4]  [5] #RS H: H accepts aabbcc: [1]. s 1 #  p ## [2]. p 1 #  q a#b [3]. q 2 #  p #c [4]. p 1 #  f ab [5]. f 1 #  f c

18/44 Example: #RS (s, #)  (p, ##) [1]  (q, a#b#) [2]  (p, a#bc#) [3]  (f, aabbc#) [4]  (f, aabbcc) [5] #RS H: H accepts aabbcc: [1]. s 1 #  p ## [2]. p 1 #  q a#b [3]. q 2 #  p #c [4]. p 1 #  f ab [5]. f 1 #  f c

19/44 Example: #RS (s, #)  (p, ##) [1]  (q, a#b#) [2]  (p, a#bc#) [3]  (f, aabbc#) [4]  (f, aabbcc) [5] L(H) = {a n b n c n : n  1} #RS H: H accepts aabbcc: [1]. s 1 #  p ## [2]. p 1 #  q a#b [3]. q 2 #  p #c [4]. p 1 #  f ab [5]. f 1 #  f c

20/44 Finite index of #RS #-Rewriting systems of index k:  over configurations with k or fewer #s #RS k – the language family generated by #RSs of index k Example: Index k = 2: 1. (p, a#a#b)  (q, aa#aa#b) [p 1 #  qa#a  R]OK 2. (p, a#a#b)  (q, a#aa##bb) [p 2 #  qa##b  R]INCORRECT

21/44 Example: #RS of finite index (s, #)  (p, ##) [1]  (q, a#b#) [2]  (p, a#bc#) [3]  (f, aabbc#) [4]  (f, aabbcc) [5] L(H) = {a n b n c n : n  1}  #RS 2 #RS H: H accepts aabbcc: H is of index 2. [1]. s 1 #  p ## [2]. p 1 #  q a#b [3]. q 2 #  p #c [4]. p 1 #  f ab [5]. f 1 #  f c

22/44 Main Result: An Infinite Hierarchy Theorem: #RS k  #RS k+1, for all k  1. Proof: makes use of programmed grammars (PG) of index k

23/44 Proof: Programmed Grammars Programmed Grammar (PG) is a modification of context-free grammar based on the rules of the form: r: A  x, W r r: A  x is a context-free rule labeled by r, W r  finite set of rule labels Derivation step (  ): after the application of rule r, a rule from W r has to be applied

24/44 Proof: Finite index of PG Programmed grammars of index k:  over sentential forms with k or fewer occurrences of nonterminals. P k – the language family defined by programmed grammars of index k

25/44 Example: PG PG G: 1: S  ABC, {2, 5} 2: A  aA, {3} 3: B  bB, {4} 4: C  cC, {2, 5} 5: A  a, {6} 6: B  b, {7} 7: C  c,  G generates aabbcc:

26/44 Example: PG S  PG G: 1: S  ABC, {2, 5} 2: A  aA, {3} 3: B  bB, {4} 4: C  cC, {2, 5} 5: A  a, {6} 6: B  b, {7} 7: C  c,  G generates aabbcc:

27/44 Example: PG S  [1] PG G: 1: S  ABC, {2, 5} 2: A  aA, {3} 3: B  bB, {4} 4: C  cC, {2, 5} 5: A  a, {6} 6: B  b, {7} 7: C  c,  G generates aabbcc:

28/44 Example: PG S  ABC [1]  PG G: 1: S  ABC, {2, 5} 2: A  aA, {3} 3: B  bB, {4} 4: C  cC, {2, 5} 5: A  a, {6} 6: B  b, {7} 7: C  c,  G generates aabbcc:

29/44 Example: PG S  ABC [1]  [2]  PG G: 1: S  ABC, {2, 5} 2: A  aA, {3} 3: B  bB, {4} 4: C  cC, {2, 5} 5: A  a, {6} 6: B  b, {7} 7: C  c,  G generates aabbcc:

30/44 Example: PG S  ABC [1]  aABC [2]  PG G: 1: S  ABC, {2, 5} 2: A  aA, {3} 3: B  bB, {4} 4: C  cC, {2, 5} 5: A  a, {6} 6: B  b, {7} 7: C  c,  G generates aabbcc:

31/44 Example: PG S  ABC [1]  aABC [2]  [3] PG G: 1: S  ABC, {2, 5} 2: A  aA, {3} 3: B  bB, {4} 4: C  cC, {2, 5} 5: A  a, {6} 6: B  b, {7} 7: C  c,  G generates aabbcc:

32/44 Example: PG S  ABC [1]  aABC [2]  aAbBC [3]  PG G: 1: S  ABC, {2, 5} 2: A  aA, {3} 3: B  bB, {4} 4: C  cC, {2, 5} 5: A  a, {6} 6: B  b, {7} 7: C  c,  G generates aabbcc:

33/44 Example: PG S  ABC [1]  aABC [2]  aAbBC [3]  [4] PG G: 1: S  ABC, {2, 5} 2: A  aA, {3} 3: B  bB, {4} 4: C  cC, {2, 5} 5: A  a, {6} 6: B  b, {7} 7: C  c,  G generates aabbcc:

34/44 Example: PG S  ABC [1]  aABC [2]  aAbBC [3]  aAbBcC [4]  PG G: 1: S  ABC, {2, 5} 2: A  aA, {3} 3: B  bB, {4} 4: C  cC, {2, 5} 5: A  a, {6} 6: B  b, {7} 7: C  c,  G generates aabbcc:

35/44 Example: PG S  ABC [1]  aABC [2]  aAbBC [3]  aAbBcC [4]  [5] PG G: 1: S  ABC, {2, 5} 2: A  aA, {3} 3: B  bB, {4} 4: C  cC, {2, 5} 5: A  a, {6} 6: B  b, {7} 7: C  c,  G generates aabbcc:

36/44 Example: PG S  ABC [1]  aABC [2]  aAbBC [3]  aAbBcC [4]  aabBcC [5]  PG G: 1: S  ABC, {2, 5} 2: A  aA, {3} 3: B  bB, {4} 4: C  cC, {2, 5} 5: A  a, {6} 6: B  b, {7} 7: C  c,  G generates aabbcc:

37/44 Example: PG S  ABC [1]  aABC [2]  aAbBC [3]  aAbBcC [4]  aabBcC [5]  [6] PG G: 1: S  ABC, {2, 5} 2: A  aA, {3} 3: B  bB, {4} 4: C  cC, {2, 5} 5: A  a, {6} 6: B  b, {7} 7: C  c,  G generates aabbcc:

38/44 Example: PG S  ABC [1]  aABC [2]  aAbBC [3]  aAbBcC [4]  aabBcC [5]  aabbcC [6]  PG G: 1: S  ABC, {2, 5} 2: A  aA, {3} 3: B  bB, {4} 4: C  cC, {2, 5} 5: A  a, {6} 6: B  b, {7} 7: C  c,  G generates aabbcc:

39/44 Example: PG S  ABC [1]  aABC [2]  aAbBC [3]  aAbBcC [4]  aabBcC [5]  aabbcC [6]  aabbcc [7] PG G: 1: S  ABC, {2, 5} 2: A  aA, {3} 3: B  bB, {4} 4: C  cC, {2, 5} 5: A  a, {6} 6: B  b, {7} 7: C  c,  G generates aabbcc:

40/44 Example: PG S  ABC [1]  aABC [2]  aAbBC [3]  aAbBcC [4]  aabBcC [5]  aabbcC [6]  aabbcc [7] L(G) = {a n b n c n : n  1}  P 3 PG G: 1: S  ABC, {2, 5} 2: A  aA, {3} 3: B  bB, {4} 4: C  cC, {2, 5} 5: A  a, {6} 6: B  b, {7} 7: C  c,  G generates aabbcc:

41/44 Proof: P k = #RS k, k  1 aAbBc  G adXYbBc [p: A  dXY, {q, o}]  G … [q] as (  AB, p , a#b#c)  H (  XYB, q , ad##b#c) [  AB, p  1 #   XYB, q  d##] P k  #RS k : Let G be a PG of index k. Construct a #RS H of index k, so H simulates derivation step P k  #RS k :

42/44 Proof: #RS k = P k, k  1 (p, a#b#c)  H (q, aa#bb#c) [p 1 #  q a#b] as a  p, 1, 2  b  p, 2, 2  c  G a  q , 1, 2  b  p, 2, 2  c  G a  q , 1, 2  b  q, 2, 2  c  G aa  q, 1, 2  bb  q, 2, 2  c  G aa  q, 1, 2  bb  q, 2, 2  c  G aa  q, 1, 2  bb  q, 2, 2  c 1) Renumbering: 2) Rewriting: 3) Finalization: #RS k  P k : Let H be a #RS of index k. Construct a PG G of index k, so G simulates a computational step

43/44 Proof: #RS k  #RS k+1, k  1 Theorem: #RS k  #RS k+1, for all k  1. Recall that: P k  P k+1, for all k  1 As P k = #RS k, for all k  1, we have

44/44 Future Investigation Determinism Unlimited index Other variants: Right-linear Context-sensitive Parallel Discussion