代写CS 3800 Homework 7 Spring 2024调试Haskell程序

CS 3800

Homework 7

Spring 2024

1. [8 Points] Pushdown. For each of the following languages over the alphabet {a, b}, draw the state diagram of a pushdown automaton that accepts this language. For full credit, your automaton should have as few states as possible. (Below, assume that m, n ≥ 0).

(a) {a n b m | n ≤ m}.

(b) {a n b m | n ≥ m}.

2. [6 Points] Pushdown. Construct a pushdown automaton P such that (assume m, n ≥ 0):

L(P) = {a mb n | n = 2m}

Specify the components of your automaton and draw a state-diagram. For full credit, your automaton should have as few states as possible.

3. [6 Points] Pushdown. Construct a pushdown automaton P such that (assume m, n ≥ 0):

L(P) = {a mb n | m ≤ n ≤ 2m}

Specify the components of your automaton and draw a state-diagram. For full credit, your automaton should have as few states as possible.

4. [15 Points] Intersection. Consider the language (n and m are natural numbers ≥ 0)

L = {a n b m | n > m and n is even}

Clearly L = Lcf l ∩ Lreg where

Lcf l = {a n b m | n > m} and Lreg = {w ∈ {a, b}* | w has an even number of a’s}

(a) Draw the state diagram of a DFA for Lreg. For full credit, your automaton should have as few states as possible.

(b) Draw the state diagram of a PDA for Lcf l. For full credit, your automaton should have as few states as possible.

(c) Apply the algorithm from class (lecture 15d) to construct a PDA for L. Draw the state diagram of your automaton. (Do not delete useless states, this problem only asks you to demonstrate your understanding of the algorithm.)

5. [8 Points] Closure properties. In this problem, you are not allowed to construct gram-mars or automata. Everything can be shown using closure properties. Throughout, the reference alphabet is Σ = {a, b} and N denotes the natural numbers (including 0); and n, m ∈ N.

(a) In Problem 1, you showed that the languages

{a n b m | n ≤ m} and {a n b m | n ≥ m}

are context-free. Use this fact to give very simple proofs that

{a n b m | n < m} and {a n b m | n > m}

are context-free.

(b) Prove that the language

{a, b}* − {a n b n | n ∈ N}

is context-free.

6. [6 Points] Closure Properties. Suppose that L is context-free and R is regular.

(a) Is L − R necessarily context-free? Justify your answer.

(b) Is R − L necessarily context free? Justify your answer.

7. [5 Points] Pumping Lemma. Prove the following variant of the Pumping Lemma:

For each context-free language L there exists a pumping length p ≥ 0 such that each word w with w ∈ L and |w| ≥ p can be written as

w = u v x y z

such that

i. |v x y| ≤ p

ii. v ≠ ε

iii. u vn x yn z ∈ L for all n ≥ 0

Your proof should be simple and succint. References to problem 2.37 in the textbook will not be accepted.

8. [9 Points] Pumping Lemma. This problem leads you step-by-step through a Pumping Lemma based proof (the next problems will not indicate the steps). You will show that the language

L = {a n b 2n c k | n > k ≥ 0}

is not context free.

(a) Suppose (for contradiction) that L is context free. Then it has a pumping length p ≥ 1. Why is p ≥ 1?

(b) Every word w ∈ L with length |w| ≥ p can be written as w = uvxyz with three properties. What are these three properties?

Select the word w = a p b 2p c p−1

(c) Derive a contradiction in case v begins with a.

(d) Derive a contradiction in case v begins with b.

(e) Derive a contradiction in case v begins with c.

(f) Use problem 7 to explain that the above proof is complete.

9. [8 Points] Pumping Lemma. In this problem, you will show that the language

L = {www | w ∈ {a, b, c} ∗ }

is not context-free.

(a) Use the pumping Lemma to show that the language {a n b an b an b | n ≥ 1} is not context free.

(b) Use closure properties of CFLs to conclude that L is not context-free. (Don’t give a direct proof.)





热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图