CSCI 265

Ace your homework & exams now with Quizwiz!

CFG closed under kleene star

A → ε | AA

RE languages closed under kleene star

S → ε | SS | everything else S produces

CSLs are closed under complement.

A CSL is accepted by an LBA. For a given CSL L1, if we swap halt and crash states in an LBA that accepts L1, we get an LBA that accepts ~L1. Thus ~L1 must also be context-sensitive

Regular language is a subset of CFL

A PDAs is basically an ε-NFA with a stack. One could also say that an ε-NFA is a PDA that does not utilize the stack. In other words, a ε-NFA is a "restricted" form of PDA. We thus conclude that a PDA can do anything an ε-NFA can do, and therefore all Regular Languages are also Context Free

NP

A decision problem is in NP if it can be solved by a non-deterministic Turing Machine in polynomial time, and have an answer of "yes" verified by a deterministic Turing machine in polynomial time.

P

A decision problem is in P if it can be solved by a deterministic Turing Machine in polynomial time

NP-complete and NP-hard problems

A problem p is hard for class C if any problem in C can be "efficiently" reduced to p. Informally, this would mean that every problem in C is no harder than p, since it can always be efficiently reduced to p, then solved as an instance of p. However, it's possible that problems in C have solutions that are more efficient than reducing to p.

RE language not closed under complement

Assume RE languages are closed under complement. Then for any RE language L1, both L1 and ~L1 are RE. Because L1 is RE, we can recognize all words in L1. Because ~L1 is RE, we can recognize all words not in L1. However, if we can recognize both all words in L1 and all words not in L1, then L1 is recursive by definition. However, we know not all RE languages are recursive, so this is a contradiction.

CFLs is a proper subset of the class of CSLs

CFGs are the subset of CSGs that only allow a single terminal on the left side. Example of CS but not CF is a^n*b^n*c^n.

CSLs is a subset of recursive languages

CSGs are the subset (i.e. a restriction of) of UGs (unrestricted grammars) that can be put in Kuroda normal form, a non-contracting form

RE languages is a superset of recursive languages

Every recursive language can be decided by a TM, meaning you will accept all words in the language and reject all words not in the language. Thus all recursive languages meet the requirements to be RE, which only require all words in the language to be accepted

To simulate a TM on a 2PDA

First push the input onto stack 1. Then, the states and transitions between them will stay the same, except we replace a move right with popping from stack 1 and pushing the same letter onto stack 2, a move left with popping from stack 2 onto stack 1, and replacing a letter by popping from stack 1 and pushing the new letter.

Turing Machine Algorithms, All palindromes of even length

Go back and forth between the beginning and end of the input, iteratively checking if the first and last letters match and crossing them both out. If at any point they don't match, crash. After crossing everything out, halt and accept. In each iteration, when crossing out the first letter, we enter a state that corresponds to the letter we crossed out. For example, think of these states as being named "read an a" and "read a b". Then when we get to the last letter, we know if it matches based on the state we're in.

CSLs are closed under intersection

L1 and L2 are CSL Using De Morgan's law, we can rewrite the intersection as follows: L1 ∩ L2 = (L1' ∪ L2')' We know CSL is closed under union and complement, so (L1' U L2')' is CSL. Therefore L1 ∩ L2 is also CSL.

Recursive languages closed under concatenation

L1 and L2 are CSL defined by G1 G2 Construct a new language L' = L1L2 defined by a new Unrestricted Grammar G' whose only production is: S → S1S2 where S1S2 is the start symbol of G1G2 the language G' is clearly {L1L2}

NP-complete

NP complete is both hard and NP

CFL closure property

Not closed under intersection and complement

Simulating a PDA on a TM

Put a delimiter (such as #) after the input, and simulate the stack starting from after that. Then for any operation on the PDA, cross out the first remaining letter of the input if a read is involved, move past the delimiter to perform any necessary stack operations, change state, and move back to the next first remaining letter of the input.

To simulate a 2PDA on a TM

Start by reading the input and putting it on the tape. Then put a delimiter before and after the input. Put one stack to the left of the input and one stack to the right. Then, re-write each transition in the 2PDA as a set of states for the TM that moves the r/w head to the input and may "read" by crossing out the first uncrossed letter, then moves to stack 1 and may push or pop, then moves to stack 2 and may push or pop, then changes to the appropriate next state.


Related study sets

Chemistry: Notable Elements - Set #2 (Official Set)

View Set

Chapter 13: psychological testing/ intelligence

View Set

Prep U Ch 32: Skin Integrity and Wound Care

View Set

TLB-Chapter 3: Health, Wellness, and Health Disparities

View Set

Certification Review | Chapter 12/Chapter 24: The Physical Exam

View Set