Answered step by step
Verified Expert Solution
Question
1 Approved Answer
An automaton is complete if for all states q and all letters a in the alphabet, there is a transition from q labeled a .
An automaton is complete if for all states q
and all letters a
in the alphabet, there is a transition from q
labeled a
This may seem strange, given that delta
is a function, so it should always map qa
to some state; but in general, delta
is what we call a partial function: there may be pairs mapped to nothing.
However, any incomplete automaton can be made complete by adding one state, usually called a sink state. All missing transitions will point to the sink state, and the sink state will have a selfloop on each letter.
In this bonus exercise, you should write the function complete that completes the automaton in place that means that you are not allowed to create a new automaton from scratch in that function You should add a state if and only if the automaton is not complete. Be careful when adding a new state, you should make sure that the state is actually new.
Hint: Have a close look at the documentation, in particular, have a look at the methods inherited. You may also gather some ideas from the testing code.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started