For each statement below, state if it is true or false, and explain why. The explanation does not need to be a formal proof, but the argument should be sound.
Statement a
If L1 is regular and ∣L1∣=k and L2 is non-regular, then L1∩L2 is regular.
This statement is false.
All finite languages are regular. ∣L1∣=k implies that L1 is finite, and therefore regular. The intersection of a regular language and a non-regular language is not guaranteed to be regular.
Note that all string under L1∩L2 must be a subset of L1, and a subset of a finite language is finite, therefore regular.
For example, let L1 be a regular language that contains a string anbn and L2={anbn}.
The intersection of L1∩L2 is non-regular.
Statement b
If L1 and L2 are non-regular, then L1∪L2 is regular.
This statement is false.
The union of a regular and a non-regular language is not guaranteed to be regular.
A language is regular if there is an finite automaton that accepts it.
Note that L1 is a regular language, therefore finite, and L2 is non-regular, therefore there does not exist a finite automaton that accepts it.
If L1∪L2 is regular, then there must exist a finite automaton that accepts it. However, such automaton would also accept L2 since L2⊆L1∪L2, therefore meet contradiction.
Which renders the statement false.
Statement c
∀L1∣L1 :non-regular, ∃L2∣L2 :regular∧L1⊆L2
This statement is true.
Let Σ be the alphabet of L1., choose L2=Σ∗, which is regular.
Since Σ∗ is the set of all strings formed from Σ plus empty string, it is guaranteed to contain L1. Therefore L1⊆Σ∗. Therefore, L1⊆L2
Q2.
Create a DFA M such that:
Statement a
M accepts all strings which begin with b but do not contain the substring bab.
Statement b
L(M)={aibjck∣i+j+k is a multiple of 3}, Σ={a,b,c}
Statement c
L(M)={x∣at least two a’s in last three characters of x}
Q3.
Via product construction, create a DFA M such that
L(M)={anbm∣n∨m is a multiple of 3}
First create two machine: one where n is a multiple and one where m is a multiple of 3. Then create the “union” machine:
L(M1)L(M2)={anbm∣n is a multiple of 3={anbm∣m is a multiple of 3
First, we will construct M1:
Then, we will construct M2:
From product construction, we will create M based on M1 and M2:
Q4.
Create an NFA which accepts all string in which the third last character is an a. Then via subset construction, create an equivalent DFA. Show all your work