[PDF] Practice Problems for Final Exam: Solutions CS 341: Foundations of





Previous PDF Next PDF





Automata and Computability Solutions to Exercises

Theory and Formal Languages taught at Clarkson University. The course is also listed as MA345 and CS541. The solutions are organized according to the same.



CMPE4003 Formal Languages and Automata Theory Problem Set

CMPE4003 Formal Languages and Automata Theory. Problem Set IV. Solutions. 1. Exercise 3.1b (From course textbook p. 159). The solution is given in your 



CMPE4003 Formal Languages and Automata Theory Problem Set

Convert G to an equivalent PDA (using the procedure given in Lemma 2.21 in your textbook). Solution: First create an initial PDA as follows: Then insert 



RESEARCH ARTICLE Synthesis of Regular Expression Problems

ABSTRACT. Formal languages and automata (FLA) theory is perceived by many as one of the hardest topics to teach or learn at undergraduate level 



FORMAL LANGUAGES AND AUTOMATA THEORY

general solution exists for the specified problem using theory of computation



Synthesis of regular expression problems and solutions

Formal languages and automata (FLA) theory is perceived by many as one of the hardest topics to teach or learn at the undergraduate level 



Process languages and nets

These problems probably the most important in the classic theory of formal. (string) languages and automata



QUESTION BANK SOLUTION Unit 1 Introduction to Finite Automata

The Chomsky hierarchy consists of the following levels: Type-0 grammars (unrestricted grammars) include all formal grammars. They generate exactly all languages 



Solutions to Selected Exercises

Hopcroft J.E. and Ullman J.D. (1979) Introduction to Automata Theory Languages and Computation. (1998) Automata and Formal Languages: An Introduction.



Automata and Computability Solutions to Exercises

2.2 Introduction to Finite Automata . 8.2 Problems Concerning Finite Automata . ... Theory and Formal Languages taught at Clarkson University.



QUESTION BANK SOLUTION Unit 1 Introduction to Finite Automata

Deterministic finite automaton (DFA)—also known as deterministic finite state family of formal languages can be obtained by regular expressions.



200 Problems in Formal Languages and Automata Theory

10-May-2017 solutions scribbled in the margins of my own yellowish dog-eared ... more there is to learn about automata and formal languages.



FORMAL LANGUAGES AND AUTOMATA THEORY

general solution exists for the specified problem using theory of computation



Theory of Automata Course Code: CSC-315 Pre-Requisites

theory and formal languages including grammar finite automaton



Introduction To Automata Theory Languages And

Introduction to Formal Languages Automata Theory and Problems With Solutions Have Been Provided For Each. Chapter. A Lot Of Exercises Have Been Given ...



Klp Mishra Automata [PDF] - m.central.edu

Formal Languages and Automata Theory K.V.N. Sunitha 2010 Formal Languages and A Number Of Problems With Solutions Have Been Provided For Each Chapter.



Practice Problems for Final Exam: Solutions CS 341: Foundations of

Equivalently NP is the class of languages that can be decided by a nondeterministic Turing machine in polynomial time. xv. Language A is polynomial-time 





Theory of Computation - (Finite Automata)

24-Jan-2021 Problem. Construct a DFA that accepts all strings from the language. L = {strings of size divisible by 6}. Solution. Let n = string size.

Practice Problems for Final Exam: Solutions

CS 341: Foundations of Computer Science II

Prof. Marvin K. Nakayama

1. Short answers:

(a) Define the following terms and concepts: i. Union, intersection, set concatenation, Kleene-star, set subtraction, complement

Answer:Union:S?T={x|x?Sorx?T}

Intersection:S∩T={x|x?Sandx?T}

Concatenation:S◦T={xy|x?S,y?T}

Kleene-star:S?={w1w2···wk|k≥0,wi?S?i= 1,2,...,k}

Subtraction:S-T={x|x?S,x??T}

Complement:

S={x?Ω|x??S}= Ω-S, where Ω is the universe of all elements under consideration. ii. A setSis closed under an operationf Answer:Sis closed underfif applyingfto members ofSalways returns a member ofS. iii. Regular language

Answer:A regular language is defined by a DFA.

iv. Kleene"s theorem Answer:A language is regular if and only if it has a regular expression. v. Context-free language

Answer:A CFL is defined by a CFG.

vi. Chomsky normal form Answer:A CFG is in Chomsky normal form if each of its rules has one of 3 forms:A→BC, A→x, orS→ε, whereA,B,Care variables,BandCare not the start variable,xis a terminal, andSis the start variable. vii. Church-Turing Thesis Answer:The informal notion of algorithm corresponds exactly to a Turing machine that always halts (i.e., a decider). viii. Turing-decidable language Answer:A languageAthat is decided by a Turing machine; i.e., there is a Turing machine Msuch thatMhalts and accepts on any inputw?A, andMhalts and rejects on input inputw??A; i.e., looping cannot happen. ix. Turing-recognizable language Answer:A languageAthat is recognized by a Turing machine; i.e., there is a Turing machineMsuch thatMhalts and accepts on any inputw?A, andMrejects or loops on any inputw??A. x. co-Turing-recognizable language Answer:A language whose complement is Turing-recognizable. 1 xi. Countable and uncountable sets Answer:A setSis countable if it is finite or we can define a correspondence betweenSand the positive integers. In other words, we can create a list ofall the elements inSand each specific element will eventually appear in the list. An uncountable set is a set that is not countable. A common approach to prove a set is uncountable isby using a diagonalization argument. Answer:SupposeAis a language defined over alphabet Σ1, andBis a language defined over alphabet Σ belongs toAby checking iff(w) belongs toB.

1Σ?

2 ABf f w?A??f(w)?B YES instance for problemA??YES instance for problemB xiii. Functionf(n) isO(g(n)) xiv. Classes P and NP Answer:P is the class of languages that can bedecidedby adeterministicTuring machine inpolynomial time. NP is the class of languages that can beverifiedin (de- terministic)polynomial time. Equivalently, NP is the class of languages that can be decidedby anondeterministicTuring machine inpolynomial time. Answer:SupposeAis a language defined over alphabet Σ1, andBis a language defined over alphabet Σ f: Σ?1→Σ?2such thatw?Aif and only iff(w)?B. xvi. NP-complete Answer:LanguageBis NP-Complete ifB?NP, and for every languageA?NP, we have A1A 2A 3A4 A 5 B NP 2 The typical approach to proving a languageCis NP-Complete is as follows: •First showC?NP by giving a deterministic polynomial-time verifier forC. (Alterna- tively, we can showC?NP by giving a nondeterministic polynomial-time decider for C.) •Next show that a known NP-Complete languageBcan be reduced toCin polynomial A1A 2A 3A4 A 5 B NP C AtoBin polynomial time becauseBis NP-Complete, and then we can reduceBtoCin polynomial time, so the entire reduction ofAtoCtakes polynomial time. xvii. NP-hard (b) Give the transition functionsδ(i.e., specify the domains and ranges) of a DFA, NFA, PDA, Turing machine and nondeterministic Turing machine.

Answer:

•DFA,δ:Q×Σ→Q, whereQis the set of states and Σ is the alphabet. •NFA,δ:Q×Σε→ P(Q), where Σε= Σ? {ε}andP(Q) is the power set ofQ

•PDA,δ:Q×Σε×Γε→ P(Q×Γε), where Γ is the stack alphabet and Γε= Γ? {ε}.

•Turing machine,δ:Q×Γ→Q×Γ× {L,R}, where Γ is the tape alphabet,Lmeans move

tape head one cell left, andRmeans move tape head one cell right.

•Nondeterministic Turing machine,δ:Q×Γ→ P(Q×Γ× {L,R}), where Γ is the tape

alphabet,Lmeans move tape head one cell left, andRmeans move tape head one cell right. (c) Explain the "P vs. NP" problem. Answer:P is the class of languages that can be solved in polynomial time, and NP is the class of languages that can be verified in polynomial time. We know that P?NP. To see why, note that each TM is also an NTM, so deciding in deterministic polynomial time is a special case of deciding in nondeterministic polynomial time, making P?NP. But it is currently unknown if

P = NP or P?= NP.

2. Recall thatATM={?M,w? |Mis a TM that accepts stringw}.

(a) Prove thatATMis undecidable. You may not cite any theorems or corollariesin your proof. Overview of Proof:We use a proof by contradiction. SupposeATMis decided by some TM H, soHaccepts?M,w?if TMMacceptsw, andHrejects?M,w?if TMMdoesn"t acceptw.

H-→?M,w??????

????accept, if?M,w? ?ATM reject, if?M,w? ??ATM 3

Define another TMDusingHas a subroutine.

HHD ?M,?M??????? ????acceptreject-→?M? SoDtakes as input any encoded TM?M?, then feeds?M,?M??as input intoH, and finally outputs the opposite of whatHoutputs. BecauseDis a TM, we can feed?D?as input intoD.

What happens when we runDwith input?D??

HHD ?D,?D??????? ????acceptreject-→?D? Note thatDaccepts?D?iffDdoesn"t accept?D?, which is impossible. Thus,ATMmust be undecidable. Complete Proof:Suppose there exists a TMHthat decidesATM. TMHtakes input?M,w?, whereMis a TM andwis a string. If TMMaccepts stringw, then?M,w? ?ATMandH accepts input?M,w?. If TMMdoes not accept stringw, then?M,w? ??ATMandHrejects input?M,w?. Consider the languageL={?M? |Mis a TM that does not accept?M?}. Now construct a TMDforLusing TMHas a subroutine:

D= "On input?M?, whereMis a TM:

1.RunHon input?M,?M??.

2.IfHaccepts,reject. IfHrejects,accept."

If we run TMDon input?D?, thenDaccepts?D?if and only ifDdoesn"t accept?D?. Because this is impossible, TMHmust not exist, soATMis undecidable. (b) Show thatATMis Turing-recognizable. Answer:The universal TMUrecognizesATM, whereUis defined as follows:

U= "On input?M,w?, whereMis a TM andwis a string:

1.RunMonw.

2.IfMacceptsw,accept; ifMrejectsw,reject."

Note thatUonly recognizesATMand does not decideATMBecause when we runMonw, there is the possibility thatMneither accepts nor rejectswbut rather loops onw.

3. Each of the languages below in parts (a), (b), (c), (d) is ofone of the following types:

Type REG. It is regular.

Type CFL. It is context-free, but not regular.

Type DEC. It is Turing-decidable, but not context-free. For each of the following languages, specify which type it is. Also, follow these instructions: 4 •If a languageLis of Type REG, give a regular expressionanda DFA (5-tuple) forL. •If a languageLis of Type CFL, give a context-free grammar (4-tuple)anda PDA (6-tuple) for

L.Also, prove thatLis not regular.

•If a languageLis of Type DEC, give a description of a Turing machine that decidesL.Also, prove thatLis not context-free. (a)A={w?Σ?|w= reverse(w) and the length ofwis divisible by 4}, where Σ ={0,1}.

Circle one type: REG CFL DEC

Answer:Ais of type CFL. A CFGG= (V,Σ,R,S) forAhasV={S}, Σ ={0,1}, starting variableS, and rulesR={S→00S00|01S10|10S01|11S11|ε}. A PDA forAis as follows: q1q2 q3 q4 q5 q6ε, ε→$

0, ε→0

1, ε→10, ε→0

1, ε→1

0,0→ε

1,1→ε0,0→ε

1,1→ε

The above PDA has 6-tuple (Q,Σ,Γ,δ,q1,F), withQ={q1,q2,...,q6}, Σ ={0,1}, Γ =

{0,1,$}, starting stateq1,F={q1,q6}, and transition functionδ:Q×Σε×Γε→ P(Q×Γε)

defined by

Input:01ε

Stack:01$ε01$ε01$ε

q1{(q2,$)} q2{(q3,0)}{(q3,1)}{(q4,ε)} q3{(q2,0)}{(q2,1)} q4{(q5,ε)}{(q5,ε)}{(q6,ε)} q5{(q4,ε)}{(q4,ε)} q6quotesdbs_dbs4.pdfusesText_8
[PDF] formal languages and automata theory syllabus

[PDF] formal languages and automata theory tutorial

[PDF] formal languages and their relation to automata pdf

[PDF] formal report sample for students

[PDF] formal report writing example

[PDF] formal report writing examples igcse

[PDF] formal report writing format for students

[PDF] formal report writing sample for students

[PDF] formal versus informal language pdf

[PDF] formal vs informal language pdf

[PDF] formalin (37 formaldehyde) is used for

[PDF] formalin definition

[PDF] formalin fixation

[PDF] formalin fixation protocol

[PDF] formalin fixation rate