Parse trees, ambiguity, and Chomsky normal form


 Angel Pitts
 1 years ago
 Views:
Transcription
1 Prse trees, miguity, nd Chomsky norml form In this lecture we will discuss few importnt notions connected with contextfree grmmrs, including prse trees, miguity, nd specil form for contextfree grmmrs known s the Chomsky norml form. 8.1 Leftmost derivtions nd prse trees In the previous lecture we covered the definition of contextfree grmmrs s well s derivtions of strings y contextfree grmmrs. Let us consider one of the contextfree grmmrs from the previous lecture: (8.1) Agin we ll cll this CFG G, nd s we proved lst time we hve L(G) = { w Σ : w 0 = w 1 }, (8.2) where Σ = {0, 1} is the inry lphet nd w 0 nd w 1 denote the numer of times the symols 0 nd 1 pper in w, respectively. Leftmost derivtions Here is n exmple of derivtion of the string 0101: (8.3) This is n exmple of leftmost derivtion, which mens tht it is lwys the leftmost vrile tht gets replced t ech step. For the first step there is only one 1
2 C 360 Introduction to the Theory of Computing vrile tht cn possily e replced this is true oth in this exmple nd in generl. For the second step, however, one could choose to replce either of the occurrences of the vrile, nd in the derivtion ove it is the leftmost occurrence tht gets replced. Tht is, if we underline the vrile tht gets replced nd the symols nd vriles tht replce it, we see tht this step replces the leftmost occurrence of the vrile : (8.4) The sme is true for every other step lwys we choose the leftmost vrile occurrence to replce, nd tht is why we cll this leftmost derivtion. The sme terminology is used in generl, for ny contextfree grmmr. If you think out it for moment, you will quickly relize tht every string tht cn e generted y prticulr contextfree grmmr cn lso e generted y tht sme grmmr using leftmost derivtion. This is ecuse there is no interction mong multiple vriles nd/or symols in ny contextfree grmmr derivtion; if we know which rule is used to sustitute ech vrile, then it doesn t mtter wht order the vrile occurrences re sustituted, so you might s well lwys tke cre of the leftmost vrile during ech step. We could lso define the notion of rightmost derivtion, in which the rightmost vrile occurrence is lwys evluted first ut there isn t relly nything importnt out rightmost derivtions tht isn t lredy represented y the notion of leftmost derivtion, t lest from the viewpoint of this course. For this reson, we won t hve ny reson to discuss rightmost derivtions further. Prse trees With ny derivtion of string y contextfree grmmr we my ssocite tree, clled prse tree, ccording to the following rules: We hve one node of the tree for ech new occurrence of either vrile, symol, or n in the derivtion, with the root node of the tree corresponds to the strt vrile. (We only hve nodes lelled when rules of the form V re pplied.) Ech node corresponding to symol or n is lef node (hving no children), while ech node corresponding to vrile hs one child for ech symol or vrile with which it is replced. The children of ech (vrile) node re ordered in the sme wy s the symols nd vriles in the rule used to replce tht vrile. For exmple, the derivtion (8.3) yields the prse tree illustrted in Figure
3 Figure 8.1: The prse tree corresponding to the derivtion (8.3) of the string Figure 8.2: A prse tree corresponding to the derivtion (8.5) of the string There is onetoone nd onto correspondence etween prse trees nd leftmost derivtions, mening tht every prse tree uniquely determines leftmost derivtion nd ech leftmost derivtion uniquely determines prse tree. 8.2 Amiguity ometimes contextfree grmmr will llow multiple prse trees (or, equivlently, multiple leftmost derivtions) for some strings in the lnguge tht it genertes. For exmple, different leftmost derivtion of the string 0101 y the CFG (8.1) from the derivtion (8.3) is given y (8.5) The prse tree corresponding to this derivtion is illustrted in Figure 8.2. When it is the cse, for given contextfree grmmr G, tht there exists t lest one string w L(G) hving t lest two different prse trees, then the CFG G is 3
4 C 360 Introduction to the Theory of Computing sid to e miguous. Note tht this is so even if there is just single string hving multiple prse trees in order to e unmiguous, CFG must hve just single, unique prse tree for ech string it genertes. Being unmiguous is generlly considered to e positive ttriute of CFG, nd indeed it is requirement for some pplictions of contextfree grmmrs. Designing unmiguous CFGs In some cses it is possile to come up with n unmiguous contextfree grmmr tht genertes the sme lnguge s n miguous contextfree grmmr. For exmple, we cn come up with different contextfree grmmr for the lnguge { w {0, 1} : w 0 = w 1 } (8.6) tht, unlike the CFG (8.1), is unmiguous. Here is such CFG: 0 X 1 1 Y 0 X 0 X 1 X Y 1 Y 0 Y (8.7) We won t tke the time to go through proof tht this CFG is unmiguous ut if you think out it for few moments, it shouldn t e too hrd to convince yourself tht it is unmiguous. The vrile X genertes strings hving the sme numer of 0s nd 1s, where the numer of 1s never exceeds the numer of 0s, nd the vrile Y is similr except the role of the 0s nd 1s is reversed. If try to generte prticulr string, you ll never hve more thn one option s to which rule to pply, ssuming you restrict your ttention to leftmost derivtions. Here is nother exmple of how n miguous CFG cn e modified to mke it unmiguous. Let us define n lphet long with CFG Σ = {,, +,, (, ) } (8.8) + ( ) (8.9) This grmmr genertes strings tht look like rithmetic expressions in vriles nd, where we llow the opertions nd +, long with prentheses. For instnce, the ( + ) + (8.10) is such n expression, nd we cn generte it (for instnce) s follows: () ( + ) ( + ) ( + ) ( + ) + ( + ) + ( + ) +. (8.11) 4
5 ( ) + + Figure 8.3: Prse tree for ( + ) + corresponding to the derivtion (8.11). This hppens to e leftmost derivtion, s it is lwys the leftmost vrile tht is sustituted. The prse tree corresponding to this derivtion is shown in Figure 8.3. You cn imgine more complex version of this grmmr llowing for other rithmetic opertions, vriles, nd so on, ut we will stick to the grmmr in (8.9) for the ske of simplicity. Now, the CFG (8.9) is certinly miguous. For instnce, different (leftmost) derivtion for the sme string ( + ) + s efore is + + () + ( + ) + ( + ) + ( + ) + ( + ) + ( + ) +, (8.12) nd the prse tree for this derivtion is shown in Figure 8.4. Notice tht there is something ppeling out the prse tree illustrted in Figure 8.4, which is tht it ctully crries the mening of the expression ( + ) +, in the sense tht the tree structure properly cptures the order in which the opertions should e pplied. In contrst, the first prse tree seems to represent wht the expression ( + ) + would evlute to if we lived in society where ddition ws given higher precedence thn multipliction. The miguity of the grmmr (8.9), long with the fct tht prse trees my not represent the mening of n rithmetic expression in the sense just descried, is prolem in some settings. For exmple, if we were designing compiler nd wnted prt of it to represent rithmetic expressions (presumly llowing much more complicted ones thn our grmmr from ove llows), CFG long the lines of (8.9) would e completely indequte. 5
6 C 360 Introduction to the Theory of Computing + ( ) + Figure 8.4: Prse tree for ( + ) + corresponding to the derivtion (8.12). We cn, however, come up with new CFG for the sme lnguge tht is much etter it is unmiguous nd it properly cptures the mening of rithmetic expressions. Here it is: T + T T F T F F I ( ) I (8.13) For exmple, the unique prse tree corresponding to the string ( + ) + is s shown in Figure 8.5. In order to etter understnd the CFG (8.13), it my help to ssocite menings with the different vriles. In this CFG, the vrile T genertes terms, the vrile F genertes fctors, nd the vrile I genertes identifiers. An expression is either term or sum of terms, term is either fctor or product of fctors, nd fctor is either n identifier or n entire expression inside of prentheses. Inherently miguous lnguges While we hve seen tht it is sometime possile to come up with n unmiguous CFG tht genertes the sme lnguge s n miguous CFG, it is not lwys possile. There re some contextfree lnguges tht cn only e generted y miguous CFGs. uch lnguges re clled inherently miguous contextfree lnguges. 6
7 + T T F T F I F I ( ) T F I + T F I Figure 8.5: Unique prse tree for ( + ) + for the CFG (8.13). An exmple of n inherently miguous contextfree lnguge is this one: { 0 n 1 m 2 k : n = m or m = k }. (8.14) We will not discuss proof tht this lnguge is inherently miguous, ut the intuition is tht the string 0 n 1 n 2 n will lwys hve multiple prse trees for some sufficiently lrge nturl numer n. 8.3 Chomsky norml form ome contextfree grmmrs re strnge. For exmple, the CFG (8.15) 7
8 C 360 Introduction to the Theory of Computing simply genertes the lnguge {}; ut it is oviously miguous, nd even worse it hs infinitely mny prse trees (which of course cn e ritrrily lrge) for the only string it genertes. While we know we cnnot lwys eliminte miguity from CFGs s some contextfree lnguges re inherently miguous we cn t lest eliminte the possiility to hve infinitely mny prse trees for given string. Perhps more importntly, for ny given CFG G, we cn lwys come up with new CFG H for which it holds tht L(H) = L(G), nd for which we re gurnteed tht every prse tree for given string w L(H) hs the sme size nd very simple, inrytreelike structure. To e more precise out the specific sort of CFGs nd prse trees we re tlking out, it is pproprite t this point to define wht is clled the Chomsky norml form for contextfree grmmrs. Definition 8.1. A contextfree grmmr G is in Chomsky norml form if every rule of G hs one of the following three forms: 1. X YZ, for vriles X, Y, nd Z, nd where neither Y nor Z is the strt vrile, 2. X σ, for vrile X nd symol σ, or 3., for the strt vrile. Now, the reson why CFG in Chomsky norml form is nice is tht every prse tree for such grmmr hs simple form: the vrile nodes form inry tree, nd for ech vrile node tht doesn t hve ny vrile node children, single symol node hngs off. A hypotheticl exmple ment to illustrte the structure we re tlking out is given in Figure 8.6. Notice tht the strt vrile lwys ppers exctly once t the root of the tree ecuse it is never llowed on the righthnd side of ny rule. If the rule is present in CFG in Chomsky norml form, then we hve specil cse tht doesn t fit exctly into the structure descried ove. In this cse we cn hve the very simple prse tree shown in Figure 8.7 for, nd this is the only possile prse tree for this string. Becuse of the very specil form tht prse tree must tke for CFG G in Chomsky norml form, we hve tht every prse tree for given string w L(G) must hve exctly 2 w 1 vrile nodes nd w lef nodes (except for the specil cse w =, in which we hve one vrile node nd 1 lef node). An equivlent sttement is tht every derivtion of (nonempty) string w y CFG in Chomsky norml form requires exctly 2 w 1 sustitutions. The following theorem estlishes tht every contextfree lnguge is generted y CFG in Chomsky norml form. 8
9 X Y X Z 0 0 Y X 1 1 Figure 8.6: A hypotheticl exmple of prse tree for CFG in Chomsky norml form. Figure 8.7: The unique prse tree for for CFG in Chomsky norml form, ssuming it includes the rule. Theorem 8.2. Let Σ e n lphet nd let A Σ e contextfree lnguge. There exists CFG G in Chomsky norml form such tht A = L(G). The usul wy to prove this theorem is through construction tht converts n ritrry CFG G into CFG H in Chomsky norml form for which it holds tht L(H) = L(G). The conversion is, in fct, quite strightforwrd summry of the steps one my perform to do this conversion for n ritrry CFG G = (V, Σ, R, ) is s follows: 1. Add new strt vrile 0 long with the rule 0. Doing this will ensure tht the strt vrile 0 never ppers on the righthnd side of ny rule. 2. Eliminte rules of the form X nd repir the dmge. Aside from the specil cse 0, there is never ny need for rules of the form X ; you cn get the sme effect y simply duplicting rules in which X ppers on the righthnd side, nd directly replcing or not replcing X 9
10 C 360 Introduction to the Theory of Computing with in ll possile comintions. For exmple, if we hve the CFG we cn esily eliminte the rule in this wy: 0 ( ) (8.16) 0 ( ) ( ) ( ) ( ) (8.17) It cn get quite messy for lrger grmmrs, nd when rules for multiple vriles re involved one needs to tke cre in mking the process terminte correctly, ut it is lwys possile to remove ll rules (side from 0 ) in this wy. 3. Eliminte unit rules, which re rules of the form X Y. Rules like this re never necessry, nd they cn e eliminted y simply hrd coding the sustitution X Y into every other (nonunit) rule where X ppers on the righthnd side. For instnce, crrying on the exmple from ove, we cn eliminte the unit rule 0 like this: 0 ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) (8.18) 4. Introduce new vrile X σ for ech symol σ. Include the rule X σ σ, nd replce every instnce of σ ppering on the righthnd side of rule y X σ. (Of course you don t hve to do this in cses where σ ppers ll y itself on the righthnd side of rule.) For the exmple ove, we my use L nd R (for leftprenthesis nd rightprenthesis) to otin 0 L R L R L R L R L R L R L R L R L ( R ) (8.19) 5. Finlly, we cn split up rules of the form X Y 1 Y m using uxiliry vriles in strightforwrd wy. For instnce, X Y 1 Y m cn e roken up s X Y 1 X 2 X 2 Y 2 X 3. X m 1 Y m 1 Y m. (8.20) 10
11 We need to e sure to use seprte uxiliry vriles for ech rule so tht there is no cross tlk etween seprte rules. Let s not write this out explicitly for our exmple ecuse it will e lengthy nd hopefully the ide is cler. The description ove is only ment to give you the sic ide of how the construction works nd does not constitute proof of Theorem 8.2. It is possile, however, to e more forml nd precise in descriing this construction in order to otin proper proof of Theorem 8.2. As you my y now suspect, this conversion of CFG to Chomsky norml form often produces very lrge CFGs. The steps re routine ut things get messy nd it is esy to mke mistke when doing it y hnd. I will never sk you to perform this conversion on n ctul CFG, ut we will mke use of the theorem from time to time when we re proving things out contextfree lnguges it is sometimes extremely helpful to know tht we cn lwys ssume tht given contextfree lnguge is generted y CFG in Chomsky norml form. Finlly, it must e stressed tht the Chomsky norml form sys nothing out miguity in generl CFG in Chomsky norml form my or my not e miguous, just like we hve for ritrry CFGs. On the other hnd, if you strt with n unmiguous CFG nd perform the conversion descried ove, the resulting CFG in Chomsky norml form will still e unmiguous. 11
Lecture 3: Equivalence Relations
Mthcmp Crsh Course Instructor: Pdric Brtlett Lecture 3: Equivlence Reltions Week 1 Mthcmp 2014 In our lst three tlks of this clss, we shift the focus of our tlks from proof techniques to proof concepts
More informationClosure Properties of Regular Languages
Closure Properties of Regulr Lnguges Regulr lnguges re closed under mny set opertions. Let L 1 nd L 2 e regulr lnguges. (1) L 1 L 2 (the union) is regulr. (2) L 1 L 2 (the conctention) is regulr. (3) L
More informationCoalgebra, Lecture 15: Equations for Deterministic Automata
Colger, Lecture 15: Equtions for Deterministic Automt Julin Slmnc (nd Jurrin Rot) Decemer 19, 2016 In this lecture, we will study the concept of equtions for deterministic utomt. The notes re self contined
More informationImproper Integrals. The First Fundamental Theorem of Calculus, as we ve discussed in class, goes as follows:
Improper Integrls The First Fundmentl Theorem of Clculus, s we ve discussed in clss, goes s follows: If f is continuous on the intervl [, ] nd F is function for which F t = ft, then ftdt = F F. An integrl
More informationIntermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4
Intermedite Mth Circles Wednesdy, Novemer 14, 2018 Finite Automt II Nickols Rollick nrollick@uwterloo.c Regulr Lnguges Lst time, we were introduced to the ide of DFA (deterministic finite utomton), one
More informationQuadratic Forms. Quadratic Forms
Qudrtic Forms Recll the Simon & Blume excerpt from n erlier lecture which sid tht the min tsk of clculus is to pproximte nonliner functions with liner functions. It s ctully more ccurte to sy tht we pproximte
More informationLecture 2e Orthogonal Complement (pages )
Lecture 2e Orthogonl Complement (pges ) We hve now seen tht n orthonorml sis is nice wy to descrie suspce, ut knowing tht we wnt n orthonorml sis doesn t mke one fll into our lp. In theory, the process
More information1 Nondeterministic Finite Automata
1 Nondeterministic Finite Automt Suppose in life, whenever you hd choice, you could try oth possiilities nd live your life. At the end, you would go ck nd choose the one tht worked out the est. Then you
More informationCS 275 Automata and Formal Language Theory
CS 275 utomt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Prolem (II) Chpter II.5.: Properties of Context Free Grmmrs (14) nton Setzer (Bsed on ook drft y J. V. Tucker nd K. Stephenson)
More informationCS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018
CS 301 Lecture 04 Regulr Expressions Stephen Checkowy Jnury 29, 2018 1 / 35 Review from lst time NFA N = (Q, Σ, δ, q 0, F ) where δ Q Σ P (Q) mps stte nd n lphet symol (or ) to set of sttes We run n NFA
More informationset is not closed under matrix [ multiplication, ] and does not form a group.
Prolem 2.3: Which of the following collections of 2 2 mtrices with rel entries form groups under [ mtrix ] multipliction? i) Those of the form for which c d 2 Answer: The set of such mtrices is not closed
More informationReview of Gaussian Quadrature method
Review of Gussin Qudrture method Nsser M. Asi Spring 006 compiled on Sundy Decemer 1, 017 t 09:1 PM 1 The prolem To find numericl vlue for the integrl of rel vlued function of rel vrile over specific rnge
More informationCM10196 Topic 4: Functions and Relations
CM096 Topic 4: Functions nd Reltions Guy McCusker W. Functions nd reltions Perhps the most widely used notion in ll of mthemtics is tht of function. Informlly, function is n opertion which tkes n input
More informationHomework Solution  Set 5 Due: Friday 10/03/08
CE 96 Introduction to the Theory of Computtion ll 2008 Homework olution  et 5 Due: ridy 10/0/08 1. Textook, Pge 86, Exercise 1.21. () 1 2 Add new strt stte nd finl stte. Mke originl finl stte nonfinl.
More informationContextFree Grammars and Languages
ContextFree Grmmrs nd Lnguges (Bsed on Hopcroft, Motwni nd Ullmn (2007) & Cohen (1997)) Introduction Consider n exmple sentence: A smll ct ets the fish English grmmr hs rules for constructing sentences;
More informationpadic Egyptian Fractions
padic Egyptin Frctions Contents 1 Introduction 1 2 Trditionl Egyptin Frctions nd Greedy Algorithm 2 3 Setup 3 4 pgreedy Algorithm 5 5 pegyptin Trditionl 10 6 Conclusion 1 Introduction An Egyptin frction
More informationBases for Vector Spaces
Bses for Vector Spces 22625 A set is independent if, roughly speking, there is no redundncy in the set: You cn t uild ny vector in the set s liner comintion of the others A set spns if you cn uild everything
More informationLecture 3. In this lecture, we will discuss algorithms for solving systems of linear equations.
Lecture 3 3 Solving liner equtions In this lecture we will discuss lgorithms for solving systems of liner equtions Multiplictive identity Let us restrict ourselves to considering squre mtrices since one
More informationLecture 08: Feb. 08, 2019
4CS46:Theory of Computtion(Closure on Reg. Lngs., regex to NDFA, DFA to regex) Prof. K.R. Chowdhry Lecture 08: Fe. 08, 2019 : Professor of CS Disclimer: These notes hve not een sujected to the usul scrutiny
More informationThings to Memorize: A Partial List. January 27, 2017
Things to Memorize: A Prtil List Jnury 27, 2017 Chpter 2 Vectors  Bsic Fcts A vector hs mgnitude (lso clled size/length/norm) nd direction. It does not hve fixed position, so the sme vector cn e moved
More informationFormal languages, automata, and theory of computation
Mälrdlen University TEN1 DVA337 2015 School of Innovtion, Design nd Engineering Forml lnguges, utomt, nd theory of computtion Thursdy, Novemer 5, 14:1018:30 Techer: Dniel Hedin, phone 021107052 The exm
More informationConvert the NFA into DFA
Convert the NF into F For ech NF we cn find F ccepting the sme lnguge. The numer of sttes of the F could e exponentil in the numer of sttes of the NF, ut in prctice this worst cse occurs rrely. lgorithm:
More information1.4 Nonregular Languages
74 1.4 Nonregulr Lnguges The number of forml lnguges over ny lphbet (= decision/recognition problems) is uncountble On the other hnd, the number of regulr expressions (= strings) is countble Hence, ll
More informationThe University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER LANGUAGES AND COMPUTATION ANSWERS
The University of Nottinghm SCHOOL OF COMPUTER SCIENCE LEVEL 2 MODULE, SPRING SEMESTER 2016 2017 LNGUGES ND COMPUTTION NSWERS Time llowed TWO hours Cndidtes my complete the front cover of their nswer ook
More informationexpression simply by forming an OR of the ANDs of all input variables for which the output is
2.4 Logic Minimiztion nd Krnugh Mps As we found ove, given truth tle, it is lwys possile to write down correct logic expression simply y forming n OR of the ANDs of ll input vriles for which the output
More informationFormal Languages and Automata Theory. D. Goswami and K. V. Krishna
Forml Lnguges nd Automt Theory D. Goswmi nd K. V. Krishn Novemer 5, 2010 Contents 1 Mthemticl Preliminries 3 2 Forml Lnguges 4 2.1 Strings............................... 5 2.2 Lnguges.............................
More informationHarvard University Computer Science 121 Midterm October 23, 2012
Hrvrd University Computer Science 121 Midterm Octoer 23, 2012 This is closedook exmintion. You my use ny result from lecture, Sipser, prolem sets, or section, s long s you quote it clerly. The lphet is
More informationCS103 Handout 32 Fall 2016 November 11, 2016 Problem Set 7
CS103 Hndout 32 Fll 2016 Novemer 11, 2016 Prolem Set 7 Wht cn you do with regulr expressions? Wht re the limits of regulr lnguges? On this prolem set, you'll find out! As lwys, plese feel free to drop
More informationHomework 3 Solutions
CS 341: Foundtions of Computer Science II Prof. Mrvin Nkym Homework 3 Solutions 1. Give NFAs with the specified numer of sttes recognizing ech of the following lnguges. In ll cses, the lphet is Σ = {,1}.
More informationTutorial Automata and formal Languages
Tutoril Automt nd forml Lnguges Notes for to the tutoril in the summer term 2017 Sestin Küpper, Christine Mik 8. August 2017 1 Introduction: Nottions nd sic Definitions At the eginning of the tutoril we
More informationHow do we solve these things, especially when they get complicated? How do we know when a system has a solution, and when is it unique?
XII. LINEAR ALGEBRA: SOLVING SYSTEMS OF EQUATIONS Tody we re going to tlk out solving systems of liner equtions. These re prolems tht give couple of equtions with couple of unknowns, like: 6= x + x 7=
More information2.4 Linear Inequalities and Interval Notation
.4 Liner Inequlities nd Intervl Nottion We wnt to solve equtions tht hve n inequlity symol insted of n equl sign. There re four inequlity symols tht we will look t: Less thn , Less thn or
More informationThe Evaluation Theorem
These notes closely follow the presenttion of the mteril given in Jmes Stewrt s textook Clculus, Concepts nd Contexts (2nd edition) These notes re intended primrily for inclss presenttion nd should not
More informationHandout: Natural deduction for first order logic
MATH 457 Introduction to Mthemticl Logic Spring 2016 Dr Json Rute Hndout: Nturl deduction for first order logic We will extend our nturl deduction rules for sententil logic to first order logic These notes
More informationInfinite Geometric Series
Infinite Geometric Series Finite Geometric Series ( finite SUM) Let 0 < r < 1, nd let n be positive integer. Consider the finite sum It turns out there is simple lgebric expression tht is equivlent to
More informationRegular Language. Nonregular Languages The Pumping Lemma. The pumping lemma. Regular Language. The pumping lemma. Infinitely long words 3/17/15
Regulr Lnguge Nonregulr Lnguges The Pumping Lemm Models of Comput=on Chpter 10 Recll, tht ny lnguge tht cn e descried y regulr expression is clled regulr lnguge In this lecture we will prove tht not ll
More informationCS 275 Automata and Formal Language Theory
CS 275 Automt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Problem (II) Chpter II.5.: Properties of Context Free Grmmrs (14) Anton Setzer (Bsed on book drft by J. V. Tucker nd K. Stephenson)
More information5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.
Regulr Expressions, Pumping Lemm, Right Liner Grmmrs Ling 106 Mrch 25, 2002 1 Regulr Expressions A regulr expression descries or genertes lnguge: it is kind of shorthnd for listing the memers of lnguge.
More informationI1 = I2 I1 = I2 + I3 I1 + I2 = I3 + I4 I 3
2 The Prllel Circuit Electric Circuits: Figure 2 elow show ttery nd multiple resistors rrnged in prllel. Ech resistor receives portion of the current from the ttery sed on its resistnce. The split is
More informationCS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata
CS103B ndout 18 Winter 2007 Ferury 28, 2007 Finite Automt Initil text y Mggie Johnson. Introduction Severl childrens gmes fit the following description: Pieces re set up on plying ord; dice re thrown or
More informationGrammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages
5//6 Grmmr Automt nd Lnguges Regulr Grmmr Contextfree Grmmr Contextsensitive Grmmr Prof. Mohmed Hmd Softwre Engineering L. The University of Aizu Jpn Regulr Lnguges Context Free Lnguges Context Sensitive
More information7.2 The Definite Integral
7.2 The Definite Integrl the definite integrl In the previous section, it ws found tht if function f is continuous nd nonnegtive, then the re under the grph of f on [, b] is given by F (b) F (), where
More informationAssignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages
Deprtment of Computer Science, Austrlin Ntionl University COMP2600 Forml Methods for Softwre Engineering Semester 2, 206 Assignment Automt, Lnguges, nd Computility Smple Solutions Finite Stte Automt nd
More informationCMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014
CMPSCI 250: Introduction to Computtion Lecture #31: Wht DFA s Cn nd Cn t Do Dvid Mix Brrington 9 April 2014 Wht DFA s Cn nd Cn t Do Deterministic Finite Automt Forml Definition of DFA s Exmples of DFA
More informationLecture Solution of a System of Linear Equation
ChE Lecture Notes, Dept. of Chemicl Engineering, Univ. of TN, Knoville  D. Keffer, 5/9/98 (updted /) Lecture 8  Solution of System of Liner Eqution 8. Why is it importnt to e le to solve system of liner
More informationDesigning finite automata II
Designing finite utomt II Prolem: Design DFA A such tht L(A) consists of ll strings of nd which re of length 3n, for n = 0, 1, 2, (1) Determine wht to rememer out the input string Assign stte to ech of
More informationImproper Integrals, and Differential Equations
Improper Integrls, nd Differentil Equtions October 22, 204 5.3 Improper Integrls Previously, we discussed how integrls correspond to res. More specificlly, we sid tht for function f(x), the region creted
More informationVectors , (0,0). 5. A vector is commonly denoted by putting an arrow above its symbol, as in the picture above. Here are some 3dimensional vectors:
Vectors 1232018 I ll look t vectors from n lgeric point of view nd geometric point of view. Algericlly, vector is n ordered list of (usully) rel numers. Here re some 2dimensionl vectors: (2, 3), ( )
More informationChapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1
Chpter Five: Nondeterministic Finite Automt Forml Lnguge, chpter 5, slide 1 1 A DFA hs exctly one trnsition from every stte on every symol in the lphet. By relxing this requirement we get relted ut more
More information1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.
York University CSE 2 Unit 3. DFA Clsses Converting etween DFA, NFA, Regulr Expressions, nd Extended Regulr Expressions Instructor: Jeff Edmonds Don t chet y looking t these nswers premturely.. For ech
More informationThe Regulated and Riemann Integrals
Chpter 1 The Regulted nd Riemnn Integrls 1.1 Introduction We will consider severl different pproches to defining the definite integrl f(x) dx of function f(x). These definitions will ll ssign the sme vlue
More information1B40 Practical Skills
B40 Prcticl Skills Comining uncertinties from severl quntities error propgtion We usully encounter situtions where the result of n experiment is given in terms of two (or more) quntities. We then need
More informationFirst Midterm Examination
2425 Fll Semester First Midterm Exmintion ) Give the stte digrm of DFA tht recognizes the lnguge A over lphet Σ = {, } where A = {w w contins or } 2) The following DFA recognizes the lnguge B over lphet
More informationRiemann Sums and Riemann Integrals
Riemnn Sums nd Riemnn Integrls Jmes K. Peterson Deprtment of Biologicl Sciences nd Deprtment of Mthemticl Sciences Clemson University August 26, 2013 Outline 1 Riemnn Sums 2 Riemnn Integrls 3 Properties
More information3 Regular expressions
3 Regulr expressions Given n lphet Σ lnguge is set of words L Σ. So fr we were le to descrie lnguges either y using set theory (i.e. enumertion or comprehension) or y n utomton. In this section we shll
More informationRiemann Sums and Riemann Integrals
Riemnn Sums nd Riemnn Integrls Jmes K. Peterson Deprtment of Biologicl Sciences nd Deprtment of Mthemticl Sciences Clemson University August 26, 203 Outline Riemnn Sums Riemnn Integrls Properties Abstrct
More informationUNIFORM CONVERGENCE. Contents 1. Uniform Convergence 1 2. Properties of uniform convergence 3
UNIFORM CONVERGENCE Contents 1. Uniform Convergence 1 2. Properties of uniform convergence 3 Suppose f n : Ω R or f n : Ω C is sequence of rel or complex functions, nd f n f s n in some sense. Furthermore,
More informationFirst Midterm Examination
Çnky University Deprtment of Computer Engineering 203204 Fll Semester First Midterm Exmintion ) Design DFA for ll strings over the lphet Σ = {,, c} in which there is no, no nd no cc. 2) Wht lnguge does
More informationMA123, Chapter 10: Formulas for integrals: integrals, antiderivatives, and the Fundamental Theorem of Calculus (pp.
MA123, Chpter 1: Formuls for integrls: integrls, ntiderivtives, nd the Fundmentl Theorem of Clculus (pp. 27233, Gootmn) Chpter Gols: Assignments: Understnd the sttement of the Fundmentl Theorem of Clculus.
More informationLecture 1. Functional series. Pointwise and uniform convergence.
1 Introduction. Lecture 1. Functionl series. Pointwise nd uniform convergence. In this course we study mongst other things Fourier series. The Fourier series for periodic function f(x) with period 2π is
More information1.3 Regular Expressions
56 1.3 Regulr xpressions These hve n importnt role in describing ptterns in serching for strings in mny pplictions (e.g. wk, grep, Perl,...) All regulr expressions of lphbet re 1.Ønd re regulr expressions,
More informationName Ima Sample ASU ID
Nme Im Smple ASU ID 2468024680 CSE 355 Test 1, Fll 2016 30 Septemer 2016, 8:359:25.m., LSA 191 Regrding of Midterms If you elieve tht your grde hs not een dded up correctly, return the entire pper to
More informationCS 311 Homework 3 due 16:30, Thursday, 14 th October 2010
CS 311 Homework 3 due 16:30, Thursdy, 14 th Octoer 2010 Homework must e sumitted on pper, in clss. Question 1. [15 pts.; 5 pts. ech] Drw stte digrms for NFAs recognizing the following lnguges:. L = {w
More informationLecture 2 : Propositions DRAFT
CS/Mth 240: Introduction to Discrete Mthemtics 1/20/2010 Lecture 2 : Propositions Instructor: Dieter vn Melkeeek Scrie: Dlior Zelený DRAFT Lst time we nlyzed vrious mze solving lgorithms in order to illustrte
More informationLinear Inequalities. Work Sheet 1
Work Sheet 1 Liner Inequlities RentHep, cr rentl compny,chrges $ 15 per week plus $ 0.0 per mile to rent one of their crs. Suppose you re limited y how much money you cn spend for the week : You cn spend
More informationLinear Systems with Constant Coefficients
Liner Systems with Constnt Coefficients 4305 Here is system of n differentil equtions in n unknowns: x x + + n x n, x x + + n x n, x n n x + + nn x n This is constnt coefficient liner homogeneous system
More informationand that at t = 0 the object is at position 5. Find the position of the object at t = 2.
7.2 The Fundmentl Theorem of Clculus 49 re mny, mny problems tht pper much different on the surfce but tht turn out to be the sme s these problems, in the sense tht when we try to pproimte solutions we
More informationSeptember 13 Homework Solutions
College of Engineering nd Computer Science Mechnicl Engineering Deprtment Mechnicl Engineering 5A Seminr in Engineering Anlysis Fll Ticket: 5966 Instructor: Lrry Cretto Septemer Homework Solutions. Are
More information1 From NFA to regular expression
Note 1: How to convert DFA/NFA to regulr expression Version: 1.0 S/EE 374, Fll 2017 Septemer 11, 2017 In this note, we show tht ny DFA cn e converted into regulr expression. Our construction would work
More informationHomework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama
CS 341: Foundtions of Computer Science II Prof. Mrvin Nkym Homework 4 1. UsetheproceduredescriedinLemm1.55toconverttheregulrexpression(((00) (11)) 01) into n NFA. Answer: 0 0 1 1 00 0 0 11 1 1 01 0 1 (00)
More informationMath 1B, lecture 4: Error bounds for numerical methods
Mth B, lecture 4: Error bounds for numericl methods Nthn Pflueger 4 September 0 Introduction The five numericl methods descried in the previous lecture ll operte by the sme principle: they pproximte the
More informationChapter 6 Techniques of Integration
MA Techniques of Integrtion Asst.Prof.Dr.Suprnee Liswdi Chpter 6 Techniques of Integrtion Recll: Some importnt integrls tht we hve lernt so fr. Tle of Integrls n+ n d = + C n + e d = e + C ( n ) d = ln
More information12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2016
CS125 Lecture 12 Fll 2016 12.1 Nondeterminism The ide of nondeterministic computtions is to llow our lgorithms to mke guesses, nd only require tht they ccept when the guesses re correct. For exmple, simple
More informationThe First Fundamental Theorem of Calculus. If f(x) is continuous on [a, b] and F (x) is any antiderivative. f(x) dx = F (b) F (a).
The Fundmentl Theorems of Clculus Mth 4, Section 0, Spring 009 We now know enough bout definite integrls to give precise formultions of the Fundmentl Theorems of Clculus. We will lso look t some bsic emples
More informationThe practical version
Roerto s Notes on Integrl Clculus Chpter 4: Definite integrls nd the FTC Section 7 The Fundmentl Theorem of Clculus: The prcticl version Wht you need to know lredy: The theoreticl version of the FTC. Wht
More informationLecture 2: Fields, Formally
Mth 08 Lecture 2: Fields, Formlly Professor: Pdric Brtlett Week UCSB 203 In our first lecture, we studied R, the rel numbers. In prticulr, we exmined how the rel numbers intercted with the opertions of
More informationMath 4310 Solutions to homework 1 Due 9/1/16
Mth 4310 Solutions to homework 1 Due 9/1/16 1. Use the Eucliden lgorithm to find the following gretest common divisors. () gcd(252, 180) = 36 (b) gcd(513, 187) = 1 (c) gcd(7684, 4148) = 68 252 = 180 1
More informationCS 330 Formal Methods and Models
CS 330 Forml Methods nd Models Dn Richrds, George Mson University, Spring 2017 Quiz Solutions Quiz 1, Propositionl Logic Dte: Ferury 2 1. Prove ((( p q) q) p) is tutology () (3pts) y truth tle. p q p q
More informationCSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science
CSCI 340: Computtionl Models Kleene s Theorem Chpter 7 Deprtment of Computer Science Unifiction In 1954, Kleene presented (nd proved) theorem which (in our version) sttes tht if lnguge cn e defined y ny
More informationImproper Integrals. Type I Improper Integrals How do we evaluate an integral such as
Improper Integrls Two different types of integrls cn qulify s improper. The first type of improper integrl (which we will refer to s Type I) involves evluting n integrl over n infinite region. In the grph
More informationSWEN 224 Formal Foundations of Programming WITH ANSWERS
T E W H A R E W Ā N A N G A O T E Ū P O K O O T E I K A A M Ā U I VUW V I C T O R I A UNIVERSITY OF WELLINGTON Time Allowed: 3 Hours EXAMINATIONS 2011 ENDOFYEAR SWEN 224 Forml Foundtions of Progrmming
More informationMinimal DFA. minimal DFA for L starting from any other
Miniml DFA Among the mny DFAs ccepting the sme regulr lnguge L, there is exctly one (up to renming of sttes) which hs the smllest possile numer of sttes. Moreover, it is possile to otin tht miniml DFA
More informationThe University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER MACHINES AND THEIR LANGUAGES ANSWERS
The University of ottinghm SCHOOL OF COMPUTR SCIC A LVL 2 MODUL, SPRIG SMSTR 2015 2016 MACHIS AD THIR LAGUAGS ASWRS Time llowed TWO hours Cndidtes my omplete the front over of their nswer ook nd sign their
More informationCS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)
CS 373, Spring 29. Solutions to Mock midterm (sed on first midterm in CS 273, Fll 28.) Prolem : Short nswer (8 points) The nswers to these prolems should e short nd not complicted. () If n NF M ccepts
More information5.7 Improper Integrals
458 pplictions of definite integrls 5.7 Improper Integrls In Section 5.4, we computed the work required to lift pylod of mss m from the surfce of moon of mss nd rdius R to height H bove the surfce of the
More informationHow do we solve these things, especially when they get complicated? How do we know when a system has a solution, and when is it unique?
XII. LINEAR ALGEBRA: SOLVING SYSTEMS OF EQUATIONS Tody we re going to tlk bout solving systems of liner equtions. These re problems tht give couple of equtions with couple of unknowns, like: 6 2 3 7 4
More informationf(x) dx, If one of these two conditions is not met, we call the integral improper. Our usual definition for the value for the definite integral
Improper Integrls Every time tht we hve evluted definite integrl such s f(x) dx, we hve mde two implicit ssumptions bout the integrl:. The intervl [, b] is finite, nd. f(x) is continuous on [, b]. If one
More informationProject 6: Minigoals Towards Simplifying and Rewriting Expressions
MAT 51 Wldis Projet 6: Minigols Towrds Simplifying nd Rewriting Expressions The distriutive property nd like terms You hve proly lerned in previous lsses out dding like terms ut one prolem with the wy
More informationDiscrete Mathematics and Probability Theory Spring 2013 Anant Sahai Lecture 17
EECS 70 Discrete Mthemtics nd Proility Theory Spring 2013 Annt Shi Lecture 17 I.I.D. Rndom Vriles Estimting the is of coin Question: We wnt to estimte the proportion p of Democrts in the US popultion,
More informationCS12N: The Coming Revolution in Computer Architecture Laboratory 2 Preparation
CS2N: The Coming Revolution in Computer Architecture Lortory 2 Preprtion Ojectives:. Understnd the principle of sttic CMOS gte circuits 2. Build simple logic gtes from MOS trnsistors 3. Evlute these gtes
More informationMath Lecture 23
Mth 8  Lecture 3 Dyln Zwick Fll 3 In our lst lecture we delt with solutions to the system: x = Ax where A is n n n mtrix with n distinct eigenvlues. As promised, tody we will del with the question of
More informationCS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions
CS 330 Forml Methods nd Models Dn Richrds, George Mson University, Spring 2016 Quiz Solutions Quiz 1, Propositionl Logic Dte: Ferury 9 1. (4pts) ((p q) (q r)) (p r), prove tutology using truth tles. p
More informationSurface maps into free groups
Surfce mps into free groups lden Wlker Novemer 10, 2014 Free groups wedge X of two circles: Set F = π 1 (X ) =,. We write cpitl letters for inverse, so = 1. e.g. () 1 = Commuttors Let x nd y e loops. The
More informationACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER /2019
ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS MATH00030 SEMESTER 208/209 DR. ANTHONY BROWN 7.. Introduction to Integrtion. 7. Integrl Clculus As ws the cse with the chpter on differentil
More information1 ELEMENTARY ALGEBRA and GEOMETRY READINESS DIAGNOSTIC TEST PRACTICE
ELEMENTARY ALGEBRA nd GEOMETRY READINESS DIAGNOSTIC TEST PRACTICE Directions: Study the exmples, work the prolems, then check your nswers t the end of ech topic. If you don t get the nswer given, check
More informationW. We shall do so one by one, starting with I 1, and we shall do it greedily, trying
Vitli covers 1 Definition. A Vitli cover of set E R is set V of closed intervls with positive length so tht, for every δ > 0 nd every x E, there is some I V with λ(i ) < δ nd x I. 2 Lemm (Vitli covering)
More informationBernoulli Numbers Jeff Morton
Bernoulli Numbers Jeff Morton. We re interested in the opertor e t k d k t k, which is to sy k tk. Applying this to some function f E to get e t f d k k tk d k f f + d k k tk dk f, we note tht since f
More informationFarey Fractions. Rickard Fernström. U.U.D.M. Project Report 2017:24. Department of Mathematics Uppsala University
U.U.D.M. Project Report 07:4 Frey Frctions Rickrd Fernström Exmensrete i mtemtik, 5 hp Hledre: Andres Strömergsson Exmintor: Jörgen Östensson Juni 07 Deprtment of Mthemtics Uppsl University Frey Frctions
More information6.5 Improper integrals
Eerpt from "Clulus" 3 AoPS In. www.rtofprolemsolving.om 6.5. IMPROPER INTEGRALS 6.5 Improper integrls As we ve seen, we use the definite integrl R f to ompute the re of the region under the grph of y =
More information