General Flashcards
What is the closure property?
If two regular languages are combined using an operator, then the resulting language is also regular
Name the closure properties
Union, intersect, complement, difference, reversal, Kleene, concatenation, homomorphism, inverse homomorphism
What is the Kleene operator?
The set of all finite sequences of the language
What is homomorphism?
A function that converts one language into another. Such as ab = 0, bbb = 1
How does one unionize two DFA’s?
lump all starting states as one, and each letter added leads to a new lumped state. If one of the languages’ states is an accepting state, the lumped union state is also regular
How does one create a complement DFA?
Swap all accepting states to non accepting states, as well as all non accepting states to accepting states
How does one create the intersection of two DFA’s
Lump the initial states together, then each letter creates a new lumped state. This is the same as union, except a state is only accepting if both languages states are accepting.
What is L1 - L2 equivalent to?
L1 intersect L2^c
How does one create a reversed DFA, given a DFA?
Create a new initial state, and link it to all of the accepting states. Then, swap all of the arrows, and make the old initial state the accepting state, and the old accepting states non accepting states.
What is a homomorphism?
A string homomorphism is a function which substitute each symbol in ∑
(main alphabet) by a corresponding string in T (another alphabet)
What is a counterexample for Infinite union of finite sets is regular.
Sol: all sets: {01}, {0011}, {000111} … are regular but their union {01}∪{0011}∪{000111} … will be {0n 1n | n for n>0} which is not regular.
Find a counterexample for: If A is regular and A ∪ B is regular, then B is necessarily regular.
Sol: A = 01 and B = 0n 1n A is regular, A ∪ B = 01 is regular, but B is not
regular
Is this regular? L = the number of 0’s in w is 7k (for some k) and the number of 1’s in w is 5r (for some r)
Sol: It is regular, you can create a DFA with 35 states which captures all possible situations for the number of 0’s and 1’s (5 reminders for 5r, and 7 reminders for 7k).
Is this regular? L={w, the number of 0’s in w is less than the number of 1’s}
Sol: it is not regular and we can prove it using pumping lemma:
1. Assume n is the pumping length.
2. Let w = 0n 1n +1, (note: the |w| >= n).
3. w = xyz, so that |xy| <= n and |y| >=1, with these conditions, y should be in 0 part of the string: 0r (r>=1),
4. So if we choose k = 2, then xyyz will be 0n +r1 n +1, which is not in the language (because n+r >= n+1, the number of zero’s will be greater or equal to the number of ones)
Is this regular? L={a^n b^n, where m≠n and m, n ≥ 0}
Sol: Not regular, we can prove using closure properties.
L1 = 01 is regular, assume L is also regular, then L1 - L should be regular (because regular languages are closed under set difference).
L1-L = 0n 1n which we know is not regular. It is a contradiction. Then L is not regular