Comprehensive Study Notes: Theory of Computer Science - Automata, Languages and Computation

Propositions and Predicates

  • Definition of Proposition: A proposition (or statement) is a declarative sentence that can be assigned exactly one of two truth values: true (TT) or false (FF).

  • Logical Connectives:

    • Negation (NOT): Denoted by ¬P\neg P. If PP is true, ¬P\neg P is false.

    • Conjunction (AND): Denoted by P∧QP \wedge Q. It is true only if both PP and QQ are true.

    • Disjunction (OR): Denoted by P∨QP \vee Q. This is the inclusive OR, meaning it is true if PP is true, QQ is true, or both are true.

    • Implication (IF… THEN): Denoted by P⇒QP \Rightarrow Q. It is false only when PP is true and QQ is false. If PP is false, the implication is true regardless of the value of QQ.

    • If and Only If (Biconditional): Denoted by P  ⟺  QP \iff Q. It is true when both PP and QQ have the same truth value.

  • Well-formed Formulas (wff): A recursive definition where:

    1. A propositional variable is a wff.

    2. If α\alpha is a wff, then ¬α\neg \alpha is a wff.

    3. If α\alpha and β\beta are wffs, then (α∨β)(\alpha \vee \beta), (α∧β)(\alpha \wedge \beta), (α⇒β)(\alpha \Rightarrow \beta), and (α  ⟺  β)(\alpha \iff \beta) are wffs.

  • Tautology and Contradiction:

    • A tautology is a formula that is true for all possible assignments of truth values to its variables (e.g., P∨¬PP \vee \neg P).

    • A contradiction is a formula that is false for all possible assignments (e.g., P∧¬PP \wedge \neg P).

  • Normal Forms:

    • Disjunctive Normal Form (DNF): A sum (disjunction) of elementary products (conjunctions of literals).

    • Principal Disjunctive Normal Form (PDNF): A unique representation as a sum of minterms. A minterm is a product where every variable in the formula appears exactly once (either as PP or ¬P\neg P).

    • Conjunctive Normal Form (CNF): A product of elementary sums.

  • Rules of Inference: These are tautologies in the form of implications used for valid arguments:

    • Modus Ponens: From PP and P⇒QP \Rightarrow Q, infer QQ.

    • Modus Tollens: From ¬Q\neg Q and P⇒QP \Rightarrow Q, infer ¬P\neg P.

    • Hypothetical Syllogism: From P⇒QP \Rightarrow Q and Q⇒RQ \Rightarrow R, infer P⇒RP \Rightarrow R.

    • Disjunctive Syllogism: From ¬P\neg P and P∨QP \vee Q, infer QQ.

  • Predicate Calculus: Extends propositional logic to include predicates and quantifiers.

    • Universal Quantifier (∀\forall): Means "for all."

    • Existential Quantifier (∃\exists): Means "there exists."

    • Bound and Free Variables: A variable is bound if it is within the scope of a quantifier; otherwise, it is free.

Mathematical Preliminaries

  • Set Theory: A set is a well-defined collection of objects. Operations include:

    • Union (A∪BA \cup B): Elements in AA or BB.

    • Intersection (A∩BA \cap B): Elements in both AA and BB.

    • Complement (A−BA - B): Elements in AA that are not in BB.

    • Power Set (2A2^A): The set of all subsets of AA.

  • Algebraic Systems:

    • Semigroup: A set with a binary operation that is closed and associative.

    • Monoid: A semigroup with an identity element (ee).

    • Group: A monoid where every element has an inverse.

  • Relations: A subset of S×SS \times S. Properties include:

    • Reflexive: xRxxRx for all xx.

    • Symmetric: xRy⇒yRxxRy \Rightarrow yRx.

    • Transitive: xRy∧yRz⇒xRzxRy \wedge yRz \Rightarrow xRz.

    • Equivalence Relation: A relation that is reflexive, symmetric, and transitive, partitioning the set into disjoint equivalence classes.

  • Functions: A map f:X→Yf: X \rightarrow Y:

    • One-to-one (Injective): Distinct inputs have distinct outputs.

    • Onto (Surjective): Every output has at least one corresponding input.

    • Bijection: Both one-to-one and onto.

  • Pigeonhole Principle: If nn objects are placed in mm places and n>mn > m, then at least one place must contain two or more objects.

  • Graphs and Trees:

    • Graph: Vertices and edges connecting them.

    • Tree: A connected graph with no circuits.

    • Binary Tree: A tree where the root has degree 2 and other internal vertices have degree 3. The number of leaves in a binary tree with nn vertices is n+12\frac{n+1}{2}, and nn is always odd.

  • Strings: Finite sequences of symbols from an alphabet Σ\Sigma.

    • Levi's Theorem: If vw=xyvw = xy, then there exists a unique string zz such that either v=xzv=xz and y=zwy=zw, or x=vzx=vz and w=zyw=zy.

The Theory of Automata

  • Discrete Automaton Model: Consists of input (Σ\Sigma), output (OO), states (QQ), a state relation (transition function), and an output relation.

    • Moore Machine: Output depends only on the current state (λ(q)\lambda(q)).

    • Mealy Machine: Output depends on both the current state and the input (λ(q,a)\lambda(q, a)).

  • Finite Automata (FA): Represented by a 5-tuple (Q,Σ,δ,q0,F)(Q, \Sigma, \delta, q_0, F).

    • DFA: Deterministic Finite Automaton (one unique next state per input).

    • NDFA (or NFA): Nondeterministic Finite Automaton (set of possible next states).

  • Equivalence of DFA and NFA: For every NFA, there exists an equivalent DFA that accepts the same language. If the NFA has nn states, the equivalent DFA may have up to 2n2^n states.

  • Minimization of FA: An algorithm that identifies equivalent states (kk-equivalence) to construct an automaton with the minimum possible number of states.

Formal Languages

  • Grammar: Defined as (VN,Σ,P,S)(V_N, \Sigma, P, S), where VNV_N is the set of variables, Σ\Sigma is the terminal alphabet, PP is the set of productions, and SS is the start symbol.

  • Chomsky Classification:

    • Type 0 (Unrestricted): No restrictions on productions (Recursive Enumerable).

    • Type 1 (Context-Sensitive): Productions are of the form α→β\alpha \rightarrow \beta with ∣α∣≤∣β∣|\alpha| \le |\beta| (Context-Sensitive Language).

    • Type 2 (Context-Free): Left-hand side is a single variable (A→αA \rightarrow \alpha) (Context-Free Language).

    • Type 3 (Regular): Productions are A→aA \rightarrow a or A→aBA \rightarrow aB (Regular Language).

  • Language Hierarchy: LRegular⊆LContext−Free⊆LContext−Sensitive⊆LType0L_{Regular} \subseteq L_{Context-Free} \subseteq L_{Context-Sensitive} \subseteq L_{Type 0}.

Regular Sets and Regular Grammars

  • Regular Expressions: Represent regular sets. Basic operations are union (++), concatenation (product), and iteration (Kleene closure ∗*).

  • Arden's Theorem: Given the equation R=Q+RPR = Q + RP, if PP does not contain the empty string Λ\Lambda, then the unique solution is R=QP∗R = QP^*.

  • Pumping Lemma for Regular Sets: A string ww in a regular set of length ∣w∣≥n|w| \ge n can be split into three parts uvwuvw (∣uv∣≤n|uv| \le n, ∣v∣≥1|v| \ge 1) such that uviwuv^iw is in the language for all i≥0i \ge 0. This is used to prove a set is not regular.

  • Closure Properties: Regular sets are closed under union, concatenation, closure, transpose, complementation, and intersection.

Context-Free Languages (CFL)

  • Derivation Trees (Parse Trees): Graphical representation of string generation. The yield of the tree is the terminal string derived.

  • Ambiguity: A grammar is ambiguous if a string has more than one derivation tree or more than one leftmost derivation.

  • Simplification:

    1. Eliminate variables that do not derive any terminal string.

    2. Eliminate symbols that do not appear in any sentential form.

    3. Eliminate null productions (A→ΛA \rightarrow \Lambda).

    4. Eliminate unit productions (A→BA \rightarrow B).

  • Chomsky Normal Form (CNF): Every production is of the form A→BCA \rightarrow BC or A→aA \rightarrow a.

  • Greibach Normal Form (GNF): Every production is of the form A→aαA \rightarrow a\alpha, where aa is a terminal and α\alpha is a string of variables.

  • Pumping Lemma for CFLs: For a CFL, there exists a constant nn such that a string zz (∣z∣≥n|z| \ge n) can be split into uvwxyuvwxy (∣vwx∣≤n|vwx| \le n, ∣vx∣≥1|vx| \ge 1) such that uviwxiyuv^iwx^iy is in the language for all i≥0i \ge 0.

Pushdown Automata (PDA)

  • Definition: An extension of finite automata with a pushdown store (stack). Represented by (Q,Σ,Γ,δ,q0,Z0,F)(Q, \Sigma, \Gamma, \delta, q_0, Z_0, F).

  • Acceptance: PDA can accept by reaching a final state or by having an empty stack (null store).

  • Relations: A language is a CFL if and only if it is accepted by a PDA. Deterministic PDAs accept a proper subclass of CFLs called deterministic languages.

Turing Machines (TM) and Linear Bounded Automata (LBA)

  • Standard Turing Machine: A finite control with a read/write head moving on an infinite tape. Moves are specified as (q,a)→(q′,y,D)(q, a) \rightarrow (q', y, D), where D∈{L,R}D \in \{L, R\}.

  • Instantaneous Description (ID): Represents the tape contents, state, and head position (e.g., αqβ\alpha q \beta).

  • Construction Techniques: Use of storage in state, multiple tracks, and subroutines.

  • Multitape TM: Equivalent in power to a single-tape TM. To simulate nn moves of a multitape TM, a single-tape TM requires O(n2)O(n^2) time.

  • Nondeterministic TM (NTM): Equivalent to a deterministic TM.

  • LBA: A nondeterministic TM where the tape is restricted to a linear function of the input length. LBAs accept Context-Sensitive Languages.

Decidability and Computability

  • Recursive Language: A language accepted by a TM that halts on all inputs.

  • Recursively Enumerable (RE) Language: A language accepted by a TM; it may not halt if the input is not in the language.

  • Uncountability: The set of all languages over an alphabet is uncountable, but the set of TMs is countable, proving languages exist that are not RE.

  • Halting Problem: The decision problem of whether a given TM halts on a specific input is undecidable.

  • Post Correspondence Problem (PCP): Determining if two lists of strings can form matching sequences. PCP is undecidable for alphabets with size ≥2\ge 2.

  • Primitive Recursive Functions: Built from initial functions (Zero, Successor, Projection) using composition and recursion.

  • Ackermann's Function: A recursive function that is not primitive recursive.

Complexity Theory

  • Growth Rate: Measured using Big-Oh notation (O(g(n))O(g(n))). Polynomial growth is generally considered efficient, while exponential growth is inefficient.

  • Class P: Languages decidable by a deterministic TM in polynomial time.

  • Class NP: Languages decidable by a nondeterministic TM in polynomial time.

  • NP-Complete: A language LL is NP-complete if it is in NP and every language in NP can be reduced to LL in polynomial time.

  • Cook's Theorem: The Satisfiability Problem (SAT) is NP-complete.

  • Quantum Computation: Uses quantum bits (qubits) like ∣ψ⟩=α∣0⟩+β∣1⟩|\psi\rangle = \alpha|0\rangle + \beta|1\rangle. Quantum computers can potentially solve certain problems (like factoring) more efficiently than classical computers using principles like superposition and entanglement.