1 Basic Foundations

Theory of Computation · Unit 1 · 3 hrs

Basic Foundations

Exam-focused notes for Basic Foundations (Theory of Computation, CSC262): what the TU syllabus asks and how it has actually been tested, with 4 solved past questions from this unit.

Basic Foundations in short

This unit lays the mathematical groundwork for the theory of computation and then opens the subject proper: what an abstract machine is, the alphabets and strings it operates on, and the languages those strings form.

Basic Foundations: notes

Review of Set Theory

A set is a well defined collection of distinct objects, written in roster form such as $S = {1, 3, 5, 7}$ or in set builder form such as $S = {x : x \text{ is odd and } 0 < x < 9}$. Membership is written $x \in S$, non-membership $x \notin S$. A set $A$ is a subset of $B$, written $A \subseteq B$, if every element of $A$ belongs to $B$; it is a proper subset, $A \subset B$, if additionally $A \neq B$. The empty set $\emptyset$ has no elements, a singleton set has exactly one, and the universal set $U$ is the set of every object under discussion in a given context. The power set $P(S)$ is the set of all subsets of $S$, and if $|S| = n$ then $|P(S)| = 2^n$, since each element is independently included or excluded. The standard operations, union $A \cup B$, intersection $A \cap B$, difference $A - B$, and complement $A' = U - A$, are used constantly in the rest of the subject to describe how the language of one machine relates to the language of another.

Logic

Logic studies the form of valid inference: given some assumptions, does a conclusion follow with certainty. In propositional logic, simple declarative sentences (propositions) are combined with connectives (and, or, not, implies) into compound sentences, and the truth value of the compound sentence is fixed once the truth values of its parts are fixed. A predicate, such as $P(x): x > 4$, is not itself a proposition since its truth depends on the unassigned variable $x$; it becomes a proposition once a value is substituted. A quantifier turns a predicate into a proposition without substituting a specific value: the universal quantifier $\forall x, P(x)$ asserts $P(x)$ holds for every $x$ in the domain, and the existential quantifier $\exists x, P(x)$ asserts some $x$ in the domain makes $P(x)$ true. Quantified statements over strings and states are the natural language in which automata definitions and their correctness proofs are phrased throughout this subject.

Functions

A function $f: A \to B$ assigns to every element of $A$ exactly one element of $B$; $A$ is the domain, $B$ the codomain, and the range is ${f(x) : x \in A} \subseteq B$. A function is injective if distinct inputs always give distinct outputs, surjective if every element of $B$ is hit by some input, and bijective if it is both, in which case an inverse function exists. A closely related idea is a relation: a binary relation on sets $A$ and $B$ is simply a subset of $A \times B$. A relation $R$ on a set $A$ is an equivalence relation if it is reflexive ($x R x$ for every $x$), symmetric ($x R y \implies y R x$), and transitive ($x R y$ and $y R z \implies x R z$). Equivalence relations matter directly in this subject because two states of an automaton are grouped together during minimization exactly when an equivalence relation ("indistinguishability") holds between them.

Proofs

A mathematical claim is established by a proof, a finite sequence of logically justified steps from agreed premises to the conclusion. A direct proof assumes the hypothesis and derives the conclusion by a chain of valid inferences. An indirect proof (proof by contrapositive) proves "if $P$ then $Q$" by instead proving "if not $Q$ then not $P$", which is logically equivalent. A proof by contradiction assumes the hypothesis together with the negation of the conclusion and derives an impossibility (such as $1 = 0$), which forces the original conclusion to be true. This subject leans most heavily on proof by contradiction: both the pumping lemma arguments (unit 3 and unit 4) and the undecidability arguments (unit 7) assume a language is regular, context free, or decidable, and derive a contradiction from that assumption. Proof by mathematical induction, where a base case is verified and an inductive step shows truth at $n$ implies truth at $n+1$, is used to define the extended transition function of an automaton over strings of any length from its transition function over single symbols.

What this unit covers

  • Review of Set Theory
  • Logic
  • Functions
  • Proofs
  • Automata, Computability and Complexity
  • Complexity Theory
  • Computability Theory
  • Automata Theory
  • Basic concepts of Automata Theory
  • Alphabets
  • Power of Alphabet
  • Kleen Closure Alphabet
  • Positive Closure of Alphabet
  • Strings
  • Empty String
  • Substring of a string
  • Concatenation of strings
  • Languages
  • Empty Language

Positive Closure of Alphabet

2081 · 5 marks

Does machine always refer to hardware? Justify. Define positive closure and Kleene closure. [5]

--- No, a machine does not always refer to hardware. In the context of Theory of Computation (TOC), the term "machine" refers to an abstract model rather than a physical hardware device. Abstract Model: An abstract model of a computer system is considered either as hardware or software, construct...

Open this answer on its own page →

2080.1 · 5 marks

Differentiate Kleen closure from positive closure. Compute positive and Kleen closure of {ab}. [5]

  • Set: ${ab}$ (a set containing a single element, the string "ab") - Required: differentiate Kleene closure from positive closure; compute both for ${ab}$. Property Kleene Closure ($L^$) Positive Closure ($L^+$) --------- Definition All strings formed by concatenating zero or more members of ...
Open this answer on its own page →

Strings

2080 · 5 marks

Define string, substring, empty string, and empty language over alphabet {a,b}. [5]

Show solved answer

String, Substring, Empty String, and Empty Language over {a, b}

1. String

A string (also called a word) is a finite sequence of symbols taken from an alphabet.

Over the alphabet Σ = {a, b}, a string is any finite arrangement of the symbols a and b.

Examples over {a, b}:

  • a
  • b
  • ab
  • aab
  • bba
  • abab

Formally, if Σ = {a, b}, then Σ* (Kleene closure) gives the set of all possible strings over {a, b}, including the empty string:

Σ* = {ε, a, b, aa, ab, ba, bb, aaa, aab, ...}


2. Substring

A string v is called a substring of string w if v appears as a contiguous sequence of symbols within w (obtained by removing zero or more leading symbols and zero or more trailing symbols from w).

Example over {a, b}:

Let w = abab

Substrings of w include:

  • a, b, ab, ba, aba, bab, abab, ε

Note: Every string is a substring of itself, and the empty string ε is a substring of every string.


3. Empty String

The empty string (denoted ε or sometimes λ) is a string that contains no symbols at all. Its length is 0.

Key properties of ε over {a, b}:

PropertyResult
Length of ε|ε| = 0
Concatenation with any string xε x = x ε = x
ε belongs toΣ* for any alphabet Σ

Example:

If x = ab, then ε · x = ab and x · ε = ab

The empty string acts as the identity element for string concatenation.


4. Empty Language

A language over an alphabet Σ is a set of strings, i.e., a subset of Σ*.

The empty language (denoted ∅) is a language that contains no strings at all.

Over {a, b}:

∅ = { } (a set with no members)

Important distinction:

ConceptNotationContains
Empty stringεA string of length 0
Empty language∅No strings whatsoever
Language with only empty string{ε}Exactly one string (ε)

Note: ∅ ≠ {ε}. The empty language has no strings, whereas {ε} is a language containing one string (the empty string).

The empty language ∅ is a valid language over any alphabet, including {a, b}.


Summary Table

TermDefinitionExample over {a,b}
StringFinite sequence of symbols from Σab, bba, aab
SubstringContiguous part of a stringab is substring of aab
Empty String (ε)String with no symbols, length = 0ε
Empty Language (∅)Language containing no strings∅ = { }
Open this answer on its own page →

Alphabets

2078 · 5 marks

Define the term alphabet, prefix and suffix of string, concatenation and Kleen closure with example. [5]

--- An alphabet is a finite, non-empty collection (set) of symbols. It is usually denoted by Σ. Example: - Σ = {a, b, c} - Σ = {0, 1} --- A string p is called a prefix of a string w if it is obtained by removing zero or more trailing symbols of w. Example: Let w = abcd - Prefixes of w: ε, a, ab, ...

Open this answer on its own page →