CSE103

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

L = {x in {0,1}^* | x contains at least two 1's}. Give the DFA along with the DFA's formal description

#9

Given eps = {0,1}, write clear regular expressions for the following language: Strings that are of odd length

((0 + 1)(0 + 1))* (0 + 1)

Given eps = {0,1}, write clear regular expressions for the following language: Strings that have length of at least two and do not end with 11

(0 + 1)* (00 + 01 + 10)

Given eps = {0,1}, write clear regular expressions for the following language: Strings that contain at least one 1 and at least one 0

(0 + 1)* 1 (0 + 1)* 0 (0 + 1)* + (0 + 1)* 0 (0 + 1)* 1 (0 + 1)*

Given eps = {0,1}, write clear regular expressions for the following language: Does not contain the substring 110

(0 + 10)* 1*

Given eps = {0,1}, write clear regular expressions for the following language: String begins with 0 and have a length of at most 5

0 (eps+ 0 + 1) (eps+ 0 + 1) (eps+ 0 + 1) (eps+ 0 + 1) - At most 5, so the empty string can also be an option since the length can be less than 5

Let A = 1, 2 Let B = 2, 4, 6, 8 Find: A union B A intersect B B - A 2^A A x B

1 2 4 6 8 2 4 6 8 empty 1 2 12 12 14 16 18 22 24 26 28

DEFINITION OF A DFA: 1) A DFA is a structure M such that: 2) Extended transition function: 3) A string X is accepted by M if: 4) The language is accepted or recognized by M is: 5) A language is regular if:

1) M: Q, eps, S, s, F Q: finite set of states eps: alphabet of symbols S: Q x eps -> Q (Transition function) For p,q in Q, and a in eps, S(p,a) = q means state q is transitioned to when in state p scanning symbol a. s: start state F: set of accept states 2) Shat = Q x eps -> Q, where Shat(q, empty string) = q, and Shat(q, xa) = S(Shat(q, x), a) 3) Shat(s, x) in F 4) L(M) = {x in eps^* | x is an accepted string} 5) There exists a DFA that recognizes it.

Write the formal def of the syntax of of a regular expression as given in class

1) the empty string is a regex 2) the empty set is a regex 3) a in eps, a is a regex 4) If r1,r2 are regex, r1+r2 and r1r2 are regex 5) If r is regex, r^* is regex 6) Nothing else is regex

Given eps = {0,1}, write clear regular expressions for the following language: Has no more than 2 zeros

1* 0 1* 0 1* 0 + eps

What is the minimum number of states required in a DFA that accepts the language: L = {x in {0, 1}^* | the second symbol from the right in x is a 0}

2^n, so 4

Let A = 6, 5 Let B = 5, 4, 9 Let C = 9, 8, 2 Find the following: A union B C intersect (B union A) A intersect B intersect C 2^A A x (C - B)

6 5 4 9 9 empty empty 6 5 65 68 62 58 52

What is a universal Turing Machine

A UTM is just a Turing Machine that whose programming simulates over other Turing Machines

Given that the complement of a reg lang is regular and that the intersection of reg lang and reg lang is reg, prove that reg lang union reg lang is regular.

Acomplement is regular (1) Bcomplement is regular (1) Acomplement intersect Bcomplement is regular (2) complement(Acomplement intersect Bcomplement) is regular(1) A union B is regular (De Morgan's)

Prove that if a square of a natural number is even then the number must be even.

CONTRAPOSITIVE n is not even => n^2 is not even Prove CONTRAPOSITIVE n is not even => n = 2k - 1 n^2 = 4k^2 - 4k+ 1 Factor out the 2, resulting in an answer that is not even. QED

CS130 Final #10 Product Construction

CS130 #10

Show the state diagram for an NFA (no epsilon) with no more than 4 states that recognizes the following: L = {x in {0, 1}^* | the third symbol from the right in x is a 0}

CS130 #12

Show the state diagram for an eps-NFA that recognizes the language: L = {1^n | n is a multiple of 3 or 5}

CS130 #13

Given eps = {0,1}, L = {0^n 1^n | } n >= 1} Prove L is not regular by the Pumping Lemma

CS130 #15

Minimize the DFA given by the following table: a b 1. 2. 4 2. 3. 2 3F. 2. 3 4F. 5. 4 5. 4. 5 F indicates an accept state

CS130 #16

Let epsilon = {a, b}. Prove the language: L = {a^n b^n | n >= 0} is not regular using Myhill_Nerode theorem.

CS130 #19

Give the CFG that generates the language L = {x in {0, 1}* | x != ww for some w in {0, 1}*}.

CS130 #20 - replace a and b with 0 an 1 respectively

Convert the following CFG to Chomsky Normal form: S -> (S) | SS | epsilon

CS130 #21

Give the state diagram for a PDA that recognizes the following language L: L = {0^n 1^n | n >= 0}

CS130 #22

Use the general procedure that works for any CFG , construct the state diagram for a PDA that recognizes the language generated by the following CFG. S -> aTb | b T -> Ta | epsilon

CS130 #23

Show that the language {a^n b^n c^n | n >= 0} is not a CFL, by playing the Demon game.

CS130 #24

Prove the complement of a CFL is not necessarily a CFL

CS130 #27

L = {x in {0,1}^* | x contains the substring 11}. Give the DFA along with the DFA's formal description

CS130 #9

List the operations covered in class that can be used to prove a language is regular

DFA NFA eps-NFA Regular expression Closure properties

How can we prove a language is regular

DFA, NFA, eps-NFA, regexs Kleene's theorem, myhill-nyrode theorem, closure properties

Prove or disprove that all subsets of a regular language are regular

DISPROVE Counterexample: Let eps = {0,1} eps* is regular {0^n 1^n | n >=0} is a subset of eps*, but is not regular (which can be proved by the pumping lemma).

What does the Myhill-Nerode theorem state?

Given an alphabet (epsilon), and a language L (subset of epsilon*) the following statements are equivalent: 1) The language L is a regular language 2) The index of R_L is finite.

Given eps = {0,1}, write clear regular expressions for the following language: Strings that are members of eps* and whose length is at least 2 and has no prime divisors

If no leading 0's allowed: empty set If leading 0's allowed: 0* 01

Prove that for any regular expression there exists a DFA that recognizes it

Kleene's Theorem Part 1 (notes07 p.8)

Prove that the reverse of a nonregular language must be nonregular

L is nonregular => L(r) is nonregular CONTRAPOSITIVE: L(r) is regular => L is regular PROOF: L(r) is regular => L(r)(r) is regular => L is regular QED

Formally prove that the complement of any regular language is regular.

Let L be a regular language with DFA def M. Define M(complement) as the same def as L(M) except the set of accept states changes to Q - F. This definition is regular given that L(Mcomplement) = Lcomplement and therefore Lcomplement is regular

Compare the effect of nondeterminism on the expressive power of FAs, PDAs, and TMs.

Nondeterminism gives a machine multiple options for its moves.

Prove the first part of Kleene's theorem.

Notes07 Page 8

How can we prove a language is not regular

Pumping lemma, myhill-nyrode theorem

What does the subset construction prove about the relative expressive power of NFAs vs DFAs

Same

What's the difference with the accept states between DFA power construction and NFA->DFA subset construction?

The accept states of a DFA power construction must be a set of which both states are originally accept states. The accept states of an NFA->DFA subset construction, any set that contains at least one original accept state is an accept state.

Prove directly from the definition of countable that the numbers which are one more than the square of a natural number are countable.

The equation pulled is n^2+, which is a 1 to 1 correspondence

The subset construction can produce an exponential blow up in the number of states. Is it possible that some other construction can be found that could avoid the exponential blow up in all cases?

The number of states for DFA for a language L cannot be less than 2^n.

With respect to proving a language is nonregular or regular compare the power of the pumping lemma and the myhill-nerode theorem.

The pumping lemma can only be used to prove that a language L is not regular(xyz) or not context free (uvwxy). The Myhill-Nerode theorem can be used to prove either a language is regular or not regular, making it much more powerful.

What does Kleene's theorem state about the family of languages that can be defined with DFAs and the family of languages that can be denoted with regular expressions?

They are the same family of languages.

How is an NFA different from a DFA?

Transitions: DFA: for each state & letter there must be one and only one arrow NFA: there may be 0, 1, or more arrows for each letter Acceptance: DFA: Accept if ends in an accept state NFA: Accept if possible to end in an accept state

Prove the corollary - the complement of any non regular language is not regular.

Utilize the contrapositive of the fact that L nonregular => Lcomplement is nonregular The contrapositive is: Lcomplement is regular => L is regular Given that the complement of a reg lang is reg - take the double complement of the right side L complement is regular => Lcomplementcomplement is regular Lcomplement is regular => L is regular QED

What are decision problems and why is it reasonable to focus on them in the study of computational models?

Yes and No Easier to analyze Can be as difficult as other types of problems Other problems can be framed as one or more decision problems

Given an arbitrary DFA, M, is it possible to determine if L(M) != Empty Set

Yes it is possible. Check if M has a final state. If there is no final state, the DFA cannot accept anything, so it equals the empty set. If there exists a final state and if there is a path that exists from the initial state to a final state, then it is not empty.

List the operations covered in class under which regular languages are closed?

complement, union, intersection, difference, concatenation, quotient, Kleene star, reversal

Given eps = {0,1}, write clear regular expressions for the following language: Has a length of at most three

eps + (0 + 1) + (0 + 1)(0 + 1) + (0 + 1)(0 + 1)(0 + 1)

Given eps = {0,1}, write clear regular expressions for the following language: Does not end with 01

eps + (0 + 1)* ((00) + (10) + (11))

Let epsilon be the alphabet {a, b, c}. Declare whether finite or infinite. Finite: cardinality, infinite: count or uncount epsilon 2^epsilon^* epsilon^* 2^epsilon empty set set containing empty set

finite 3 infinite uncountable infinite countable finite 8 finite 0 finite 1

Prove that the intersection of two CFL's is not necessarily a CFL. (Hint: show the two CFLs whose intersection is {a^n b^n c^n | n >= 0} (which we already proved was not a CFL)

https://cs.stackexchange.com/questions/91321/why-are-cfls-not-closed-under-intersection

Design a Turing Machine that adds one binary number...

https://www.chegg.com/homework-help/questions-and-answers/10pts-design-turing-machine-adds-one-binary-number-stops-u-followed-input-binary-number-bl-q38486104

Prove that there can be no Turing Machine H...

https://www.chegg.com/homework-help/questions-and-answers/20pts-prove-turing-machine-h-given-input-encoding-arbitrary-turing-machine-m-arbitrary-inp-q29857230

Give a proof that uses the concept of cardinality to show that there must be languages which are not Turing Machine decidable nor Turing Machine recognizable.

https://www.chegg.com/homework-help/questions-and-answers/30-15pts-give-proof-uses-concept-cardinality-show-must-languages-turing-machine-recognizab-q27602631

Toward a contradiction assume...

https://www.chegg.com/homework-help/questions-and-answers/toward-contradiction-assume-exists-turing-machine-h-given-input-encoding-arbitrary-turing--q22479623

What is the formal definition of a Turing Machine?

https://www.seas.upenn.edu/~cit596/notes/dave/turing2.html

L = {x in {0,1}^* | x does NOT contains at least two 1's}. Give the DFA along with the DFA's formal description

midterm1 #10

Give the DFA with no more than 2 states that recognizes strings over {0, 1} that contain odd number of 0's.

midterm1 #11

Give the DFA with no more than 2 states that recognizes strings over {0, 1} that contain even number of 1's.

midterm1 #12

Use product construction to build a DFA that recognizes the intersection of the following languages: 1) Give the DFA with no more than 2 states that recognizes strings over {0, 1} that contain odd number of 0's. 2) Give the DFA with no more than 2 states that recognizes strings over {0, 1} that contain even number of 1's.

midterm1 #13

Show the state diagram for a NFA (no epsilon and no more than 5 states) and recognizes the language (11+010)* 1

midterm2 #17

Show the state diagram for an NFA (no epsilon) with no more than 3 states that recognizes the following: L = {x in {0, 1}^* | the second symbol from the right in x is a 0}

midterm2 #3

Use the subset construction to build a DFA that recognizes the language, where you find the NFA (no epsilon) first: L = {x in {0, 1}^* | the second symbol from the right in x is a 0} Also identify the inaccessible states.

midterm2 #5

Prove the language L = {w in {0,1}* } | w has an equal number of 0's and 1's} is not regular by the Pumping Lemma

notes08 pg. 7

Show that the language: L = {x in {0,1} | x = ww for some w in {0,1}*} is not a CFL

notes11 pg.25

The basis of the pumping lemma is that for any _____ language, all strings in the language which are _________ long must contain some non-void string that can be pumped, where pump means that if the string is modified by removing the substring or arbitrarily repeating it the modified string will still be ______ the language.

regular sufficiently in

Given an alphabet (epsilon), and a language L (subset of epsilon*). What is the definition of the Myhill-Nerode relationship , R_L, for L on epsilon* For any x,y in epsilon* x R_L y if and only if __________

x is indistinguishable from y


Set pelajaran terkait

Course Point Ch 20: Assessment of Respiratory

View Set

Nurs 114 Exam 1 Chapter 14 (assessing skin, hair and nails) prepU

View Set