Lecture 8+9 Flashcards
How can we make an NFA from a regular grammar
the rules for regular grammars are A → cB, A → c, A → λ.. We can actually remove the second rule by making A -> cZ, where Z only has the option of giving an empty string. We can then make an NFA in which the states are the non terminals, the final states are those where X -> empty string and its rules to be based on the terminal characters.
How can we show an language accepted by an NFA will always be regular?
Make the NFA have less and less states by combining the actions used to get from one location to another, eventually there will be one transition which is just a regular expression.
What are some ways to make regular languages from regular languages?
The complement of a regular language is regular. The intersection of two regular languages is regular. If there is a language consisting of all suffixes(or prefixes) of words in a regular language it will be regular as well. The language which is the reversal of a regular language will be regular.
How do we use the pumping lemma?
Pumping lemma: To show a language is not regular we can use the pumping lemma, for any regular language there is a positive integer k, such that if a string is in the language, and the length is greater than k, then for some u, v, w which make up the string in the form u.v.w, the length of u and v is less than or equal to k, the length of v is greater than 0 and u.vx.w is in the language for all x values greater than or equal to 0. If this cannot possibly be true then the language is not regular(proof by contradiction
What is a push down automata?
A non deterministic finite automata which also has a stack, this means it has
Q a finite set of states,
Σ the input alphabet (lower case letters)
Γ the stack alphabet (upper case letters)
δ a transition function
q0 the initial state
F the set of accepting states
In order for the machine to accept it must be in a finishing state and the stack must be empty.
a transition is written in the form: a λ/A which means read an a, pop an empty string off the stack(nothing) and add an A to the stack
What languages can push down automata accept?
Precisely the languages of a context free grammar
How do we do pumping lemma for push down automata?
Pumping lemma for context free grammars: We now have 5 variables which make up a string u,v,w,x,y we can then pump up v and x. Theorem: Let a language be a context free language, there is a positive integer k such that for all strings in the language with length greater than or equal to k we can write z = uvwxy such that the length of vwx is less than or equal to k, the length of v + the length of x is greater than 0 and uviwxiy is in the language for all i greater than or equal to 0.