FIT2014 Unit Cheatsheet

Context: FIT2014_MOC Β· the WHOLE unit in one re-read β€” languages β†’ logic β†’ automata β†’ grammars β†’ parsing β†’ Turing machines β†’ decidability β†’ complexity β†’ NP-completeness. Every claim is hand-derivable; links for depth only.

Quick Revision

  • 🎯 Objective: match the claim’s SHAPE to a formula or proof blueprint βž” derive in \begin{aligned}, seal with Q.E.D.
  • ⚠️ Key Constraint: hypothesis discipline β€” every rule here has a precondition; marks die when a rule fires without it (infinite vs finite, regular vs context-free, decidable vs recognisable, vs ).

1️⃣ Languages and Words

  • Alphabet & word βž” finite non-empty; a word is a finite sequence over ; is the empty word Β· precondition β€” the empty language has no words, the language has one.
  • Closure βž” all finite words including ; ; is countably infinite for any finite .
  • Language βž” any Β· precondition membership must be decidable by definition, not by intuition β€” state the defining predicate.
  • Named test languages βž” EVEN-EVEN Β· DOUBLEWORD Β· PALINDROME Β· EQUAL () Β· HALF-AND-HALF (-style split).

2️⃣ Propositional Logic β†’ CNF Encoding

  • Connectives βž” ; Β· precondition for CNF conversion β€” implications must be eliminated before De Morgan.
  • De Morgan βž” , ; extends to terms by induction, not by assertion.
  • DNF βž” OR of ANDs; read off the True rows of the truth table, one conjunct per row.
  • CNF βž” AND of ORs; read off the False rows, negating each literal β€” the sign flip is the whole trick.
  • [[CNF Encoding Patterns (At Least, At Most, Exactly)|At least from ]] βž” clause size , write all clauses, literals unnegated.
  • At most from βž” same formula on negated literals with , giving and clauses.
  • Exactly βž” (at least ) (at most ) Β· precondition both halves must be written; one alone is a strict inequality.
  • Encoding a problem βž” β‘  variable per atomic choice β‘‘ clauses per validity rule β‘’ conjoin Β· precondition the rules, not just the certificate, must be encoded.

3️⃣ Predicates and Quantifiers

  • Predicate βž” a proposition-valued function ; a free variable makes it not yet a proposition, a bound one does.
  • Pairing rule βž” pairs with , pairs with Β· precondition β€” over-claims and is vacuously true.
  • Negation βž” ; .
  • Order sensitivity βž” ; the second is strictly stronger Β· precondition swapping is only safe for like quantifiers.
  • Distribution βž” distributes over , over ; the mixed pairs do not.

4️⃣ Proof Craft

  • Claim shape βž” technique βž” : exhibit one witness Β· : never by example Β· : direct or contrapositive Β· β€œno such thing”: contradiction.
  • Set equality βž” by double inclusion and ; each inclusion starts β€œlet β€œ.
  • Contrapositive βž” ; contradiction assumes and derives absurdity (canonical: ).
  • Induction βž” base case at the smallest relevant , then Β· precondition the hypothesis must be the full statement for , and the smallest step must be tested (the classic failure is ).
  • Faulty-proof tells βž” missing/ wrong base case Β· hypothesis assumed for Β· ex falso (a false premise proves anything) Β· example offered for a claim.
  • Countability βž” an explicit listing proves countable; diagonalisation proves languages over uncountable ⟹ some language has no description at all.

5️⃣ Regular Expressions and Finite Automata

  • Regex βž” built from , letters, , concatenation, Β· precondition includes , and β€” precedence is then concat then .
  • Finding one βž” describe the shape of an accepted word, then verify on the shortest strings including .
  • DFA βž” with total and single-valued; accept iff the unique run ends in .
  • NFA βž” may be multi-valued or missing, -moves allowed; accept iff some path ends in .
  • Complement βž” swap Final/non-Final Β· precondition DFA only β€” the same swap on an NFA is wrong, because β€œsome path accepts” does not negate pointwise.
  • Kleene’s Theorem βž” regex NFA DFA; proved by the cycle regex NFA DFA regex.
  • [[Converting Regular Expressions to NFA|regex NFA]] βž” Thompson-style edge rewriting, one construction per operator.
  • [[NFA to DFA (Subset Construction)|NFA DFA]] βž” states are sets of NFA states; start -closure of ; Final iff the set meets Β· cost up to states β€” this is why the construction is not polynomial (see Β§1️⃣2️⃣).
  • [[FA to Regular Expression (GNFA State Elimination)|FA regex]] βž” GNFA state elimination; before deleting a state, relabel every ordered pair as Β· precondition missing a pair loses strings, and must be kept in the union.

6️⃣ Limits of Regularity

  • Minimisation βž” seed two colours (Final / non-Final), split any class whose rows disagree on successor colours, iterate to fixpoint Β· precondition the DFA must be complete first.
  • Lexing vocabulary βž” pattern = the regex Β· token = the name Β· lexeme = the matched text; conflicts resolved by maximal munch, then first-listed rule.
  • Closure βž” regular languages are closed under , , , concatenation, Β· note is obtained via De Morgan; subsets and supersets are NOT closed.
  • Pumping Lemma βž” infinite regular with an -state FA ⟹ , : , , , Β· precondition infinite and regular; it is necessary, never sufficient.
  • Non-regularity recipe βž” assume regular with pumping length βž” choose so that forces into one block (canonically ) βž” pump up or down ( is legal) βž” contradiction.
  • Closure shortcut βž” if is known non-regular for a regular , then is non-regular (e.g. EQUAL ).

7️⃣ Context-Free Grammars and PDAs

  • CFG βž” terminals, nonterminals, productions with a single nonterminal on the left, start symbol ; a CFL is any language some CFG generates.
  • Derivation βž” leftmost and rightmost give the same tree and the same length; the prefix property is what makes leftmost usable for parsing.
  • Grammar-writing stock βž” : Β· Dyck: Β· PALINDROME: .
  • Regular grammar βž” every rule has a semiword RHS; from an NFA, becomes ⟹ regularCFL.
  • PDA βž” NFA + stack; transition = read , pop , push ; $$$ marks the stack bottom; accept iff some path reaches a Final state.
  • Equivalence βž” CFG PDA (both directions constructive); an NFA is a stackless PDA Β· precondition deterministic PDAs are strictly weaker β€” .

8️⃣ Parsing, Chomsky Normal Form, CYK

  • Shift-reduce βž” stack + buffer; shift moves one token across, reduce applies a rule in reverse; accept iff stack and buffer empty.
  • Conflicts βž” shift-reduce (both legal) and reduce-reduce (two rules match) both signal grammar ambiguity.
  • Toolchain βž” Lex lex.yy.c / yylex(); Yacc y.tab.c / yyparse(); defaults resolve shift-reduce by shifting and reduce-reduce by the first-listed rule.
  • Chomsky NF βž” every rule (live) or (dead) Β· precondition CNF generates the non-empty words only; goes to the nullability algorithm. ⚠ not Conjunctive Normal Form.
  • 5-step conversion βž” β‘  eliminate -productions (to fixpoint) β‘‘ eliminate unit productions β‘’ isolate terminals into dead rules β‘£ break long RHS into binary chains β‘€ tidy unreachable/dead nonterminals.
  • CYK βž” fill by increasing substring length; length- cell takes the union over the binary splits; Accept iff appears in the whole-string cell Β· precondition grammar in Chomsky NF Β· cost .
  • CFL Pumping Lemma βž” CFG in CNF with nonterminals ⟹ with , : , , , Β· note CNF enters via the binary-tree height argument.
  • Non-CF recipe βž” take or βž” case-split on which blocks occupy βž” stops them spanning all three blocks ⟹ pumping breaks the counts.

9️⃣ Turing Machines

  • TM βž” two-way infinite tape, head, finite program; Start , Accept ; a crash (no applicable transition) rejects.
  • Three outcomes βž” partitions into , , Β· definition is a decider iff .
  • FA TM βž” 5-step conversion ⟹ every regular language is decidable.
  • Building recipe βž” mark-and-sweep: mark leftmost unmarked , run right to the matching , mark, return, repeat; accept when a full sweep finds nothing left to match.
  • Unary code βž” , tuples separated by ; is computable iff some TM leaves on the tape Β· precondition the Church–Turing thesis is a thesis, not a theorem β€” it cannot be cited as a proof step.
  • Code words βž” one row per transition, 5 fields: state , 2-letter symbols, 1-letter direction; is regular but strictly larger than the set of genuine TM codes.
  • UTM βž” takes \langle M\rangle\,\texttt{\},xMx$ β€” programs as data, the stored-program idea.

πŸ”Ÿ Decidability and Mapping Reductions

  • Decidable βž” for some decider ; then comes free. Synonyms: recursive, solvable.
  • Problem language βž” a decision problem becomes the language of its YES-inputs; objects encode as , tuples as .
  • Closure βž” decidable languages are closed under , concatenation β€” proved by running deciders as subroutines Β· precondition subroutine calls must be shown to terminate, which is exactly what a decider guarantees.
  • FA-Empty βž” mark the Start state, propagate forward along transitions to fixpoint; Accept iff no Final state is marked.
  • CFG-Empty βž” mark terminals, propagate upward through rules to fixpoint; Accept iff is UNmarked.
  • RegExpEquiv βž” decide emptiness of Β· cost requires determinisation, so decidable but not polynomial.
  • Mapping reduction βž” computable total with , written Β· precondition the certifying iff chain must be written both ways.
  • Transfer βž” decidable decidable; undecidable undecidable Β· precondition is reflexive and transitive, not symmetric β€” direction is everything.
  • Degenerate case βž” reducing from a decidable proves nothing about , and needs to exist at all.

1️⃣1️⃣ Undecidability and Recursive Enumerability

  • Existence argument βž” TMs are countable, languages are uncountable ⟹ undecidable languages exist Β· limitation names none of them.
  • HALT βž” halts on is undecidable; proof builds that flips the diagonal, so the assumed decider cannot exist.
  • Input-blind gadget βž” from build = β€œignore the input, run on ” ⟹ HALT-FOR-ZERO, ALWAYS HALTS, SOMETIMES HALTS all undecidable.
  • NEVER HALTS βž” obtained by the Accept/Reject swap Β· precondition the swap is illegal on recognisers (a loop is neither), legal only on deciders.
  • Decidable side βž” bounded-step halting and state-counting are decidable; acceptance and -input halting are not.
  • r.e. βž” with unrestricted; synonyms Turing-recognisable, type 0.
  • Bridge theorem βž” decidable and are both r.e. β€” proved by interleaving both machines one step at a time.
  • Separation βž” is r.e. but undecidable; is not r.e.; decidable r.e. co-r.e.
  • Enumeration βž” r.e. is enumerated by some machine, using the -then- dovetailing schedule Β· precondition a naive β€œrun input 1 to completion first” schedule fails on a looping input.

1️⃣2️⃣ P, NP and Polynomial-Time Reductions

  • Running time βž” Β· precondition must be a decider, else the max is undefined.
  • βž” languages with an decider, fixed β€” does not qualify. Placement: regular CFL decidable.
  • Model independence βž” reasonable machine models simulate each other with polynomial slowdown, and a polynomial of a polynomial is a polynomial.
  • Verifier & certificate βž” iff some polynomial-time has accepts Β· precondition the time bound is in , never .
  • 4-part membership proof βž” β‘  state the certificate β‘‘ state the verifier β‘’ prove the iff β‘£ bound the time. All four are marked.
  • Inclusions βž” (ignore the certificate) and (search certificates).
  • NDTM βž” = languages decided by a nondeterministic TM in polynomial time Β· precondition the DFA NFA equivalence does not transfer β€” determinising costs exponential time here, not just states.
  • Instance stock βž” VERTEX COVER () Β· INDEPENDENT SET, CLIQUE () Β· SAT / 2-SAT / 3-SAT Β· -COLOURABILITY Β· HAMILTONIAN CIRCUIT Β· PARTITION Β· SUBSET SUM Β· GRAPH ISOMORPHISM.
  • [[Polynomial-Time Reductions|]] βž” with computable in ; three marked parts: function Β· iff chain Β· time bound.
  • Output-length lemma βž” a TM emits symbol per step ⟹ in time forces Β· precondition this is the step that makes composition work; omitting it is the standard deduction.
  • Transfer βž” ; Β· precondition every old construction must be re-timed β€” is not .
  • Reduction stock βž” : Β· : Β· : target .

1️⃣3️⃣ NP-Completeness

  • Definition βž” is NP-complete iff (a) and (b) Β· precondition (b) alone is only NP-hard.
  • Master theorem βž” an NP-complete has a polynomial-time decider ; () spends condition (a), () spends (b) plus the transfer theorem.
  • Equivalence class βž” for NP-complete : , and is NP-complete .
  • Cook-Levin Theorem βž” SATISFIABILITY (satisfiable CNF expressions) is NP-complete Β· note the proof is non-examinable; part (a) β€” certificate = truth assignment, verify clause-by-clause β€” is not.
  • Encoding recipe βž” β‘  variables for the certificate β‘‘ auxiliary variables β‘’ rules CNF via the at-least / at-most templates of Β§2️⃣ β‘£ state as an algorithm and count the clauses.
  • PARTITION INTO TRIANGLES SAT βž” per triangle; per vertex one at-least-one clause and per triangle pair at it Β· cost variables, clauses.
  • Inheritance theorem βž” NP-complete NP-complete Β· precondition the reduction runs from the known-hard language; proves nothing.
  • βž” pad clauses of size with fresh in all sign patterns; chain clauses of size with fresh links .
  • βž” variable-edge per variable, triangle per clause, connector edge from each clause position to its literal; Β· precondition must be the exact minimum, else the correspondence breaks.
  • Chain βž” ⟹ all five NP-complete.
  • Living with it βž” drop exactly one of efficient Β· deterministic Β· all-cases Β· exact ⟹ exponential exact / randomised / special-case / approximation algorithm.
  • co-NP βž” complements of languages; , and whether that inclusion is equality is open.

πŸͺœ The ladder, in one line

  • Named separating inhabitants βž” (not regular) Β· (not context-free, still decidable) Β· (r.e., not decidable) Β· (not r.e.).
  • The unproved links βž” every in the first chain is a theorem with a witness above; the second chain’s signs are not known to be strict β€” is the open question, and straddles the /decidable frontier rather than sitting in a tier of its own.