Q1.
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 is regular and and is non-regular, then is regular.
This statement is false.
All finite languages are regular. implies that 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 must be a subset of , and a subset of a finite language is finite, therefore regular.
For example, let be a regular language that contains a string and .
The intersection of is non-regular.
Statement b
If and are non-regular, then 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 is a regular language, therefore finite, and is non-regular, therefore there does not exist a finite automaton that accepts it.
If is regular, then there must exist a finite automaton that accepts it. However, such automaton would also accept since , therefore meet contradiction.
Which renders the statement false.
Statement c
This statement is true.
Let be the alphabet of ., choose , which is regular.
Since is the set of all strings formed from plus empty string, it is guaranteed to contain . Therefore . Therefore,
Q2.
Create a DFA such that:
Statement a
M accepts all strings which begin with but do not contain the substring .
Statement b
,
Statement c
Q3.
Via product construction, create a DFA such that
First create two machine: one where is a multiple and one where is a multiple of 3. Then create the “union” machine:
First, we will construct :
Then, we will construct :
From product construction, we will create based on and :
Q4.
Create an NFA which accepts all string in which the third last character is an . Then via subset construction, create an equivalent DFA. Show all your work
Solution
We define the following NFA with:
- Start state
- Accept state
- Transition function as follows:
Via subset construction, we can create the following DFA:
Start state of DFA is , as it is the epsilon closure of the start state of the NFA
Transition table:
DFA state | ||
---|---|---|
The final state are any states that include , which are and .
Where