04-generators-recognizers

04-generators-recognizers - Generators vs. Recognizers Up...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Generators vs. Recognizers Up to now we have only described languages in terms of machines that recognize a particular language. But we could also imagine describing a language by a system that is able to generate all the strings in a language. –p .1/3
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Rewriting Systems In order to define a system that generates a language we introduce a new model of computation: Rewriting Systems. Informally, a rewriting system consists of an alphabet and a set of rules over that alphabet. You are already familiar with a very powerful rewriting system: Algebra! Here, the alphabet are the numerals and variable names in addition to operator names. The rules consist of your standard algebraic laws. –p .2/3
Background image of page 2
Rewriting Systems Example: Consider the set of algebraic laws: x + x =2 × x (1) y +0 = y (2) x + y = y + x (3) We can apply these rules to strings formed from the alphabet. Consider: 5+3+5+0 = 5+3+5 (rule 2) = 5+5+3 (rule 3) × 5+3 (rule 1) The string that we start with is called the input string and the string that we end up with is called the normal form because no other rules apply to this final string. For our purposes we introduce a special rewriting system called a String Rewriting System . –p .3/3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
String Rewriting Systems Definition: [String Rewriting System (SRS)] A string rewriting system is a tuple ,R ) where, Σ is a finite alphabet where Σ is the set of (possibly empty) strings over Σ . a R is a binary relation on Σ , i.e., R Σ × Σ . Each element ( u, v ) R is called a rewriting rule and is usually written as u v . An inference step in this formal system is: given a string u and a rule u v with u, v Σ and u v R then the string u can be rewritten as the string v . a The set Σ is a convenient short hand to describe all the strings over the alphabet Σ . –p .4 /3
Background image of page 4
String Rewriting Systems In order for an SRS ,R ) to be useful we allow rules to be applied to substrings of given strings; let s = xuy , t = xvy , and u v R with x, y, u, v Σ , then we say that s rewrites to t and we write, s t. More formally, Definition: [one-step rewriting relation] Let ) be a string rewriting system, then the one-step rewriting relation RW is defined as the set Σ × Σ with s t RW for strings s, t Σ if and only if there exist x, y, u, v Σ such that s = xuy, t = xvy , and u v R . In plain English: any two string s, t belong to the relation RW if and only if they can be related by a rewrite rule in the rule set R . Exercise: R RW . Why? (spoiler alert, next page holds the solution) –p .5/3
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
String Rewriting Systems Proposition: R RW . Proof: We use the definition of a subset, R RW iff e R. e RW , for our proof. There is nothing to prove for the ‘only if’ direction. More interesting is the ‘if’ direction, if we can show that all elements of R are also elements of RW then it follows from the definition that R RW .
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 32

04-generators-recognizers - Generators vs. Recognizers Up...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online