The whole Theory of Computation formula sheet, to print
28 formulas in 5 topics, each with when to use it. Each is explained in the topic notes.
IAE Academy: Theory of Computation formula sheet (GATE CS)
Regular expressions and finite automata
Read the notesCOMPLEMENT OF A DFA LANGUAGE
Valid only for a complete DFA. Swapping the accepting states of an NFA does not in general complement its language.
PRODUCT CONSTRUCTION (UNION, INTERSECTION, DIFFERENCE)
Run complete DFAs with and states together; states are pairs. Accept when both components accept (intersection), at least one accepts (union), the first accepts and the second does not (difference), or exactly one accepts (symmetric difference).
NUMBER OF DFAS ON N STATES
For a fixed set of labelled states, a fixed start state and an alphabet of symbols: each of the transitions has choices, and is any of the subsets of . This counts machines, not languages; many machines accept the same language. Example: , gives .
REMOVING EPSILON-MOVES (EPSILON-NFA TO NFA)
Same states and start state. Each new edge stands for '-moves, then , then -moves'; a state becomes accepting if an accepting state can be reached from it by -moves alone.
SIZE BOUND OF THE SUBSET CONSTRUCTION
The bound is tight: the language 'the -th symbol from the right is 1' has an -state NFA whose minimal DFA has states. Often far fewer subsets are reachable.
MINIMAL DFA SIZE (MYHILL–NERODE)
Each class of prefixes is one state. is regular exactly when there are finitely many classes.
IDENTITIES FOR $\EMPTYSET$ AND $\VAREPSILON$
Union is commutative and associative; concatenation is associative but not commutative.
IDENTITIES FOR STAR
means one or more repetitions.
STAR OF A UNION
All five denote the strings formed by any mixture of -strings and -strings. is NOT equal to .
SHIFTING IDENTITY
Both sides are followed by alternating , blocks. in general.
DISTRIBUTIVITY
Concatenation distributes over union on both sides; union does not distribute over concatenation ( in general).
ARDEN'S RULE
When the stated solution is the unique one. When it is still a solution (the smallest) but not the only one. The first form fits Arden's method below, where each equation lists the strings that reach a state.
SIZE OF THOMPSON'S MACHINE
Linear in the length of the expression. Each symbol (, or ) and each union or star adds two states; concatenation adds none.
OUTPUT LENGTH
Holds for every input because both machines are deterministic and complete.
Regular languages: closure properties and the pumping lemma
Read the notesCOMPLEMENT OF A REGULAR LANGUAGE
Applies to a total DFA only. If some transitions are missing, first add a dead (trap) state and send every missing transition to it. The complement DFA has the same states, so the minimal total DFAs of and have the same number of states. Swapping accepting states in an NFA does not complement it: convert the NFA to a DFA first (the subset construction can need up to states for an -state NFA).
PRODUCT CONSTRUCTION
For total DFAs with and states, the product has states. A pair is accepting when both components accept for intersection, when either accepts for union, and when the first accepts and the second does not for difference.
INVERSE HOMOMORPHISM
Here is the extended transition function on strings, with . The new DFA has the same states, start state and accepting states as the DFA for , and it accepts .
PUMPING LEMMA FOR REGULAR LANGUAGES
The implication runs one way only. A language can satisfy the conditions and still be non-regular, so the lemma can prove non-regularity but never regularity. For example, satisfies the lemma with (pump the first symbol), yet it is not regular: its intersection with is . The pumping length can be taken as the number of states of any DFA for .
MYHILL-NERODE THEOREM
Unlike the pumping lemma, this is an iff. The number of classes equals the number of states of the minimal total DFA for , counting the dead state if the minimal total DFA has one.
Context-free grammars and push-down automata
Read the notesDERIVATION LENGTH IN CHOMSKY NORMAL FORM
For and any derivation of from in a CNF grammar: steps use and steps use . In the parse tree there are variable nodes with two variable children and variable nodes whose only child is a terminal leaf, so variable nodes, one per step.
DERIVATION LENGTH IN GREIBACH NORMAL FORM
For ; each step adds exactly one terminal.
EQUIVALENCE OF CFGS AND PDAS
Every CFG has an equivalent NPDA and every NPDA has an equivalent CFG, with either acceptance mode.
Context-free languages: closure properties and the pumping lemma
Read the notesINTERSECTION WITH A REGULAR LANGUAGE
Proved by running a PDA and a DFA together; the same holds for DCFLs. Hence is a CFL, but need not be.
PUMPING LEMMA FOR CONTEXT-FREE LANGUAGES
A necessary condition only: it can prove a language is not context-free, never that it is. If L is generated by a Chomsky normal form grammar with k variables, works.
Turing machines, decidability and undecidability
Read the notesLANGUAGE OF A TURING MACHINE
Only accepted strings count; strings on which M loops or rejects are outside L(M).
RECURSIVE = RE AND CO-RE
Here the complement is taken with respect to . To decide, run both recognisers in parallel (alternating steps); exactly one of them accepts: the one for if , the one for otherwise.
REDUCTION PRINCIPLE (MANY-ONE)
Use the contrapositive: if and is undecidable, is undecidable. Also: and RE implies RE; and not RE implies not RE. Since if and only if , reducing to proves is not RE. Direction matters.
RICE'S THEOREM
P is a property of the language L(M). Non-trivial: some TM languages have it and some do not. Semantic: it depends only on L(M), not on the machine's structure.