πŸ“˜ FIT2014: Theory of Computation

Map of Content

Index for FIT2014 (Malaysia campus). Arc: languages β†’ logic/CNF β†’ automata β†’ grammars β†’ parsing β†’ Turing machines β†’ NP-completeness. Conventions: alphabets, empty word, CNF is the working form β€” but Conjunctive Normal Form (logic) β‰  Chomsky Normal Form (grammars); W1–2 logic notes are shared dual-unit with FIT1058_MOC.

πŸ“Š Assessment Map

  • Practical Preparation (5%) βž” ongoing weekly prac work β€” part of the in-semester threshold hurdle.
  • Assignment 1 (10%) βž” Regular Expressions + Finite Automata β€” the W2 logic/CNF + coming automata material.
  • Mid-semester Test (15%) βž” everything to ~W6 ⟹ languages, logic, encoding, regex↔automata must be solid EARLY.
  • Assignment 2 (20%) βž” Lexical Analysis, Parsing, Computability.
  • Final exam (3h10, 50%) βž” whole unit; the exam is a hurdle AND the in-semester tasks form a threshold hurdle.
  • Reference text βž” Sipser (pp. 13–14 strings/languages; Β§0.3 pp. 17–20 definitions/theorems/proofs; pp. 14–15 and p. 302 for normal forms).
  • LO thread so far βž” define and manipulate formal languages; read/write propositional and predicate logic; encode real problems in CNF (the recurring assessable skill).

🧰 Toolkit Cheatsheets

  • FIT2014 Unit Cheatsheet β†’ the whole-unit exam crib β€” W1β†’W11 as formulas/rules with firing preconditions, in syllabus order; the single re-read before the 3h10 exam
  • Shell Toolkit (Cheatsheet) β†’ tri-unit (FIT1043 + FIT2014 + FIT2109); FIT2014 adds the sed/tr/grep-regex block (Lab 0)

πŸ“… Knowledge Index

Lab 0 β€” Linux Tooling (all assignment work runs in Linux)

Week 1 β€” Languages, Propositional & Predicate Logic (Lectures 1–3)

Week 2 β€” Proof Craft & Regular Expressions (Lectures 4–6)

Week 3 β€” Finite Automata & Kleene’s Theorem (Lectures 7–9)

Week 4 β€” Minimisation, Lexical Analysis & the Limits of Regularity (Lectures 10–11)

Week 5 β€” Context-Free Grammars & Pushdown Automata (Lectures 12–14)

Week 6 β€” Parsing, Chomsky Normal Form & the CFL Frontier (Lectures 15–17)

Week 7 β€” Turing Machines & Universality (Lectures 18–19)

Week 8 β€” Decidability & Mapping Reductions (Lectures 20–21)

Week 9 β€” Undecidability & Recursive Enumerability (Lectures 22–23)

Week 10 β€” Complexity: P, NP & Polynomial-Time Reductions (Lectures 24–26)

Week 11 β€” NP-Completeness (Lectures 27–30)

  • NP-Completeness β†’ Parent Framework: Verifiers, Certificates and the Class NP (conditions (a)+(b), the master theorem poly-decider , co-NP, the four engineering options)
  • Reducing to SATISFIABILITY β†’ Parent Framework: NP-Completeness (the W11 hand skill β€” the 4-step recipe + PARTITION INTO TRIANGLES worked end-to-end; the W1 CNF templates re-timed)
  • Cook-Levin Theorem β†’ Parent Framework: NP-Completeness (SAT is NP-complete; proof explicitly non-examinable β€” statement, part (a), and architecture only)
  • Proving NP-Completeness by Reduction β†’ Parent Framework: NP-Completeness (the exam hand skill β€” inheritance theorem, SAT 3-SAT, 3-SAT VERTEX COVER with )
  • (Closes the unit’s arc: the [[Polynomial-Time Reductions|]] relation acquires a summit β€” one efficient algorithm for any NP-complete language would settle vs outright.)

🧭 Suggested Reading Order

(read left→right within each week · bold = assessment-critical hand skill)

🎯 Learning Outcomes (key skills per week)

  • Lab 0 (Linux) βž”
    • navigate the filesystem (pwd/ls/cd/mkdir)
    • pipe & redirect (|, >, >>, <)
    • transform text with sed 's/pat/rep/g' (backrefs \(...\)/\1, char classes, anchors), tr (map/-d/-s), grep regex
    • know sed/grep use POSIX BRE (escaped \(...\)) β€” the applied face of Regular Expressions
  • W1 βž”
    • define /word/language (, , )
    • decide EVEN-EVEN / DOUBLEWORD / PALINDROMES membership
    • one example proves , never
    • truth-table the connectives + prove equivalence via the Boolean laws
    • DNF from True rows, CNF from False rows
    • encode problems in CNF + cardinality templates ( literals, clauses)
    • quantifier discipline ( / , order, negation)
  • W2 βž”
    • pick the proof technique from the claim’s shape
    • prove by double inclusion
    • phrase the inductive hypothesis correctly + test the smallest step
    • diagnose faulty inductions and ex falso traps
    • listings prove countable; Cantor diagonalisation proves languages uncountable
    • read/write regexes (; includes )
    • find a regex from a description, checking the smallest strings
  • W3 βž”
    • define an FA both ways (state diagram + transition table)
    • trace acceptance + state the language
    • complement a DFA by swapping Final states (fails for NFAs)
    • define an NFA (accept iff SOME path)
    • state Kleene’s cycle Regexp β†’ NFA β†’ FA β†’ Regexp
    • run the three conversions by hand (regexβ†’NFA edge rewriting
    • NFAβ†’DFA subset construction with -closure
    • FAβ†’regex GNFA state elimination)
  • W4 βž”
    • minimise a DFA by colouring (Final/non-Final seed; split when row colour-patterns differ; iterate to fixpoint)
    • implement an FA from its table
    • distinguish pattern (regex) vs token (name) vs lexeme (text); lexer conventions maximal munch then first-listed
    • prove closure under complement/union/intersection via De Morgan/concatenation (subsets & supersets are NOT closed)
    • state + prove the Pumping Lemma from the circuit/pigeonhole argument, quantifiers exact
    • prove non-regularity: choose so leaves one case (), pump up or down, or use the closure shortcut (EQUAL = HALF-AND-HALF)
  • W5 βž”
    • define a CFG (terminals/nonterminals/productions, start symbol) + read/write BNF
    • give the language generated; a CFL is what some CFG generates
    • build a derivation and its parse tree, distinguish leftmost/rightmost (same tree, same length) and use the prefix property
    • write a grammar from an inductive definition (Dyck ; PALINDROME; via )
    • recognise a regular grammar (semiword rules) and build one from an NFA (); know {regular} ⊊ {CFL}
    • define a PDA (NFA + stack; transition = read/pop/push; $$$ bottom-marker; accept iff some path reaches Final) and know CFG ⟺ PDA (both construction directions), that NFA = stackless PDA, and that deterministic PDAs are weaker
  • W6 βž”
    • run a shift-reduce trace (stack + buffer; reduce = rule in reverse; accept iff stack , buffer empty)
    • diagnose shift-reduce vs reduce-reduce conflicts and read them as grammar ambiguity; know
    • set up Lex (lex.yy.c, yylex()) + Yacc (y.tab.c, yyparse()) and their conflict defaults (shift; first-listed rule)
    • convert a grammar to Chomsky Normal Form by the 5 steps and decide by nullability
    • fill a CYK table by increasing substring length; state
    • state the CFL pumping lemma (, , , ) and where CNF enters its proof
    • prove non-context-freeness: pick , split on where sit, kill straddling cases by repeated boundary patterns
  • W7 βž”
    • define a TM (tape, head, program; Start , Accept ; crash reject) and trace one
    • partition into , , ; a decider has
    • convert an FA β†’ TM by the 5 steps ⟹ every regular language is decidable
    • build a TM for and by the mark-and-sweep recipe
    • read the unary code (, tuples -separated) and define by a TM; state the Church–Turing thesis and why it is not a theorem
    • encode and decode a TM table ( states, 2-letter symbols, 1-letter direction); know is regular but {TM codes}
    • say what a UTM does, lay out \langle M\rangle\,\,x$, and justify why UTMs exist
  • W8 βž”
    • define a decider () and decidable (, so free); decidable recursive solvable
    • convert a decision problem to its YES-input language and back; encode objects as , tuples as
    • place the tier: regular ⊊ context-free ⊊ decidable; prove closure under , , , concatenation by running deciders as subroutines
    • run the FA-Empty marking algorithm (seed Start, propagate forward, Accept iff no Final State marked)
    • run the CFG-Empty marking algorithm (seed terminals, propagate upward, Accept iff unmarked)
    • decide RegExpEquiv by emptiness of
    • define a mapping reduction ( computable, ) and write the certifying iff chain
    • apply the transfer theorem: decidable decidable; undecidable undecidable; is transitive, not symmetric
    • build the standard reductions (EQUAL β†’ HALF-AND-HALF by sorting, FA-Empty β†’ No-Digraph-Path by the sink vertex )
    • know why reducing from a decidable to any proves nothing
  • W9 βž”
    • argue from countability that undecidable languages exist (existence only β€” names nobody)
    • state the Halting Problem and its diagonal one-argument form
    • prove undecidability: build flipping the diagonal, say which assumption dies
    • run the input-blind gadget = β€œignore , run on ” ⟹ HALT-FOR-ZERO / ALWAYS HALTS / SOMETIMES HALTS
    • get NEVER HALTS by the Accept/Reject swap; say why that is illegal on recognisers
    • classify: bounded-step halting and state-counting decidable; acceptance and -input halting not
    • define r.e. (, unrestricted) + synonyms (Turing recognisable, type 0)
    • prove decidable and both r.e. via the one-step interleaved decider
    • prove is r.e. but undecidable, is not r.e.; decidable r.e. co-r.e.
    • prove r.e. enumerated, with the -then- dovetailing schedule
  • W10 βž”
    • compute and say why it needs a decider
    • define polynomial time (, fixed) and ; place regular ⊊ CFL ⊊ ⊊ decidable
    • run the polynomial-slowdown argument for model-independence of
    • define verifier and certificate; bound time in , never
    • prove membership of in 4 parts: certificate Β· verifier Β· iff claim Β· time claim (3-colourability, )
    • prove (ignore the certificate) and (search certificates)
    • state the NDTM characterisation of and why DFA NFA does not transfer
    • recall instance certificate for VERTEX COVER, INDEPENDENT SET, CLIQUE, SAT/2-SAT/3-SAT, colouring, PARTITION, SUBSET SUM
    • build a reduction: function iff chain time bound, via the one-symbol-per-step output-length lemma
    • apply the transfer theorem (; ) and re-time old reductions
  • W11 βž”
    • define NP-complete by both conditions and name the failure mode of each (NP-hard when (a) fails)
    • prove the master theorem: an NP-complete has a poly decider
    • place SAT/3-SAT/VC/IS/CLIQUE, GRAPH ISOMORPHISM, and the problems on the two-lobe diagram
    • reduce a language to SAT: certificate variables rule clauses clause count
    • state the Cook-Levin Theorem and prove part (a) only (the rest is non-examinable)
    • apply the inheritance theorem ( NP-complete, , ) β€” just one reduction
    • run (fresh-variable padding and chaining) and ()
    • choose the response to NP-completeness: exponential Β· randomised Β· special-case Β· approximation