The Final Iteration Flashcards
What is a transition table?
A transition table is used when creating a DFA. States the connections between the different states, as well as what that connection requires to be ‘crossed’
What are some general ‘practices’ when creating DFAs?
(0,a),1 - means going from state 0 to state 1 if the character is a.
Multiple of three - create a triangle pattern, whereby the character required connects the three points
Evens and odds - use a ‘pair’ formation i.e. a path above for evens, and a path below for odds, with crossover when the character amount changes
When told to ‘calculate’ something for a DFA, what does it actually mean?
It means just follow through the DFA until you terminate either successfully or not, and show your steps taken.
When describing a language, what sort of things should you be looking for?
Look for patterns, such as multiples of a character or palindromes or equal amounts of letters. Anything that appears as a ‘regular’ occurrence
How would you go about minimising a finite automata?
Use the table filling algorithm:
Take all the nodes and write them across in ascending order (except the last one), then take all the nodes and write them down the side in descending order (except the last one). Any pair that has one final state (not BOTH), cross off. Then, for the remaining pairs, ‘explore’ their connections. If the resulting pairs have only one final state in them, then cross off the original pair, as they are distinguishable. Otherwise, if they equal another pair that has not been crossed off, then add them below that pair. Once fully finished, if there are any pairs that are unmarked, then ‘overlap’ them and their connections.
How do you convert from an NFA to a DFA?
Using the subset construction method:
Take all the initial states, and start to write their connections which they make using certain characters e.g. state 0 can go to itself and state 1 through a.
Once you have exhausted all possibilities, simply connect everything in a new DFA. Any set that includes a final state is now a final state in the new DFA, and is marked by an outgoing arrow.
What are some general practices when creating regular expressions?
At most, one letter - (x+epsilon)
Any number of letter/s - (x)*
At least one letter - x(x+y)*
At most one letter - x(y+z)*
Ensuring a certain sequence - xyyx(x+y)*
What does plus mean in regular expressions?
Plus is treated as an OR symbol. If used, you can pick either one or the other, you cannot have both. If an even arises like this - x(y+z)*, you can have xy, xz, but not xyz.
What is a CFG?
CFG is defined by a set of nonterminals, a set of terminals, a start symbol and a production defining how to create a word.
What does it mean by ‘left-linear’ and ‘right-linear’ for CFGs?
Left-linear - all productions are left-recursive
Right-linear - all productions are right-recursive
What is a derivation tree?
A derivation tree dictates how a word has been created based on the steps through the production.
How can a CFG be ambiguous?
When a CFG can produce the same word, but with two or more different ways, then it is ambiguous
(a problem with this is that if you want to assign words value, then multiple ways of creating the word causes issues with that)
How can CFGs be equivalent?
CFGs can be equivalent when they both represent the same language
What does it mean by ‘Elimination of Useless/Unreachable Productions’?
Any production that cannot be reached by any other nonterminal is useless, and therefore can be removed.
Any production that causes an infinite loop i.e. there isn’t an end condition or any way to get to one, is considered a useless/unproductive nonterminal, and thus can be removed.
When removing a production, you take out EVERYTHING it is associated with i.e. there is plenty of collateral damage. Example - S -> AB | a | b
If B is marked for removal, then it will look like this:
S -> a | b
What does it mean by ‘Substitution’?
Exactly as it sounds. Take a production, and wherever it occurs, replace it with it’s results i.e. A -> XBY & B -> C | D | epsilon
This would turn into:
A -> XCY | XDY | XY