Fundamentals of Computation Flashcards
(48 cards)
What does DFA stand for and what is it?
- Deterministic Finite-state Automaton
- Machine with a set of states where each input symbol leads to exactly one next state
What are the types of states in a DFA?
- Start state: Where the string begins
- Accepting state: If a string ends here, it is accepted
- Dump state: Dead-end state where invalid strings go, and it cannot be exited
- Unreachable state: A state that can’t be reached by any input string
Can a DFA have unreachable accepting states?
No, all accepting states in a DFA must be reachable by some string
What does NFA stand for and what is it?
- Non-deterministic Finite-state automaton
- An input symbol can lead to multiple possible next states
What is the key difference between a DFA and an NFA?
- DFA uses a transition function (one symbol=one next state) whereas NFA uses a transition relation (one symbol=zero or more possible next states)
- NFAs don’t require dump states
Do DFAs and NFAs need accepting states?
No but if they dont have any accepting states, they won’t accept any input strings
Do DFAs and NFAs need transitions?
No, if they don’t have transitions, they can still accept the empty string
What is algorithm A used for?
Converts an NFA to an equivalent DFA, using the idea of state subsets
What are the steps of Algorithm A?
- Make new DFA states, using subset of NFA states (all possible combinations including the empty set)
- Mark a subset as accepting if any NFA state in it is accepting
- Add transitions based on NFA’s transitions
- Remove unreachable or isolated states
Does every DFA have a corresponding NFA?
- Yes, every DFA can be seen as an NFA
- Not every NFA has a DFA
What are epsilon transitions?
Epsilon transitions allow us to move to another state without having to consume a character
How are epsilon transitions used for concatenation?
- Add epsilon transitions from accepting states in first NFA to start state in second NFA
- Make them not accepting
How are epsilon transitions used for alternative/ or function?
- Add epsilon transitions from new start state to both starting states
How are epsilon transitions used for star operators?
- Introduce new start state and make it accepting
- Add epsilon transition to existing start state
- Then add epsilon transitions from any accepting state to the origional starting state
What is algorithm 4 used for?
To remove epsilon transitions
How is algorithm 4 done?
- If you can reach an accepting state using only e-transitions, make it an accepting state, and copy all non-e transitions as normal
- Take each transition labelled x and add a transition from i to j labelled x if we can go between them using e-transitions followed by origional x
If L1 is a subset of L2 then…
The intersect between L1 and the complement of L2 are empty
Q to P is a simulation between automata A and B if:
- The start states are related
- If there is a transition x from q-a then then is also a transition x from p-b
- If q is an accepting state, then p must also be an accepting state
Describe a minimum automaton M
- M is equivalent to a deterministic automaton A
- For every automaton B that is equivalent to A, the number of states in B will be >= to the number of states in M
What makes 2 automata equivalent?
- If they accept the same language
- If they result in the same minimisation (disregarding state labels)
Describe regular vs non-regular languages
- A language is regular is we can find a regex, DFA, NFA or NFA with e-transitions
- Non-regular languages cannot be finite
What is the pigeonhole principle?
- For any word longer than n, there is a state that must be visited twice
- Used to prove languages are not regular
- As some part of the word can be pumped/repeated and still belong to the language (pumping lemma)
What is a context-free grammar?
- Define languages using production rules
- Allow generation of non-regular languages
What are the 4 things that CFGs consist of?
- Terminals: actual symbols
- Non-terminals: symbols that expand into other symbols
- Production rules: define transformations of non-terminals
- Start symbol: root of derivations