Introduction To TOC
Introduction To TOC
WK1: Introduction
Welcome
Instructor: Khalilah Burrell-Battick Module Assessment Breakdown
Email: [email protected] • 001: Problem Sheet [20%]
• 002: Tests [30%]
• 003: Group Programming Project [20%]
Instructional Platform: Zoom • 205: Final Exam [30%]
UTechOnline (Moodle)
• Lecture slides Textbook
• Tutorial sheets Introduction to the Theory of Computation, by Michael Sipser
• Assessments
Software: JFLAP
• https://www.jflap.org/
• Must have java JDK in order to use
1
WHAT IS THIS
COURSE ABOUT?
2
Mathematical Concepts
Theorems
Proofs
PREREQUISITE KNOWLEDGE
Mathematical Concepts
Sets
Sequences and Tuples
Functions and Relations
Graphs
Boolean Logic
Strings and Languages
3
Mathematical Concepts
Set theory plays a fundamental role in the theory of
computation, providing a mathematical foundation for
Sets formal languages, automata theory, formal proofs, and
Sequences and Tuples complexity theory.
•
A = {7, 2, 8}
7{7, 2, 8} “7 is an element/member of A”
• 5{7, 2, 8} “5 is not an element of A”
10
4
Set Builder Notations
Set Builder notation is another way to represent a set without listing all its contents.
• For instance A = {a, b, c, d, e, …, z} can be written using set builder notation as:
= | ℎ ℎ ℎ
11
Set operation
Let these sets be defined as follows:
X = {1, 2}; Y= {2, 3, 4} X Y
• The union of two sets is the set that consist of all elements that in
both sets. ∪ = 1,2,3,4
• The intersection of two sets is the set of elements that are common
to both sets. ∩ = 2 X\Y = {1} XY={2} Y\X = {3, 4}
• Two sets are called disjoint if their intersection is empty, that is, they
share no elements: AB =
• The relative complement of two sets is the set of elements that is
one set but not in the other
/ = 1 / = 3,4
XY={1,2,3,4}
12
5
Mathematical Concepts
Sequences are used to represent strings and words over
Sets an alphabet, which form the basis of formal languages.
Sequences and Tuples Tuples are used to represent states, transitions, input
symbols, and instances of computational problems in
Functions and Relations automata theory and complexity theory.
Graphs Understanding these concepts is essential for analyzing
Boolean Logic computational models and algorithms’ behaviour,
properties, and complexity.
Strings and Languages
13
14
6
Set and sequences may appear as elements of other sets and
sequences
15
Mathematical Concepts
Functions describe mappings or computations on
Sets sequences and play a role in language processing,
automata behaviour, computational models, and complexity
Sequences and Tuples analysis.
16
7
Functions
A function is a mathematical relationship involving one or more A table can be used to represent a function
variables • Example: Applying the addition function modulo 4 to the Cartesian
• = “ maps to ” products of two sets : ℤ6 × ℤ6 ⟶ ℤ6
• Example: abs 2 = abs −2 = 2 = row & 7 = column in table with values , 7
0 1 2 3
The domain is the set of possible inputs while the range is the 0 0 1 2 3
outputs of a function. 1 1 2 3 0
• : 1 ⟶ 3 “ is a function with domain 1 and range 3” 2 2 3 0 1
• Example: abs: ℤ ⟶ ℕ
3 3 0 1 2
A predicate or property is a function whose range is {TRUE, FALSE}
• Even(4) = TRUE
• Even(7) = FALSE
17
18
8
A function with k arguments is called a k-ary function
If a function can only take one argument it is If a function can only take two arguments it is
called a unary function called a binary function
Functions & A property whose domain is a set of k-tuples is called a relation, or a k-ary relation.
19
Consider relation ? = @, A | @ = A
equivalence If = is true
20
9
Mathematical Concepts
Graphs are used to represent and analyze various
Sets structures, including parse trees, state transition diagrams,
data flow/control flow graphs, circuit/communication
Sequences and Tuples graphs, and reduction graphs.
Functions and Relations Graph theory and graph algorithms provide insights into
Graphs the behaviour, properties, and complexity of computational
models, formal languages, and problems in the theory of
Boolean Logic computation.
21
Graphs
Graph is a set of points (vertices) with lines (edges) 1 2
connecting some of the points.
The number of edges at a particular node is the degree
• Graph below has a degree of 2 3 4
1 2
The formal definition of the directed graph above is:
3 1,2,3,4 , 1,2 , 1,3 , 2,1 , 2,4 , 3,4
We can describe edges with sets
• E = F, formal description is:
1,2,3 , 1,2 , 1,3 , 2,1 , 2,3 , 3,1 , 3,2
22
10
Mathematical Concepts
Sets
Boolean logic provides the foundation for expressing and
Sequences and Tuples manipulating binary values, enabling the design, analysis,
Functions and Relations and understanding of computational systems and
algorithms.
Graphs
Boolean Logic
Strings and Languages
23
Boolean Logic
Built around two values TRUE (0) & FALSE (1)
Negation (¬) Exclusive or (XOR)
¬
• 0=1 Is 1 if either, but not both, values are 1
¬ 0⨁0 = 0
• 1=0
0⨁1 = 1
Conjunction or AND (∧) 1⨁0 = 1
• The conjunction of two Boolean values is 1 if both values are 1 1⨁1 = 0
0∧0=0 Equality and Implication
0∧1=0
1∧0=0 Equal to 1 if both values are the same
1∧1=1 0 ↔ 0 = 1
0 ↔ 1 = 0
Disjunction or OR (∨) 1 ↔ 0 = 0
1 ↔ 1 = 1
• The disjunction of two Boolean values is 1 if one value is 1
0∨0=0 Implies 0 if 1st value is 1 & 2 nd value is 0; otherwise implies 1
0∨1=1 0 → 0 = 1
1∨0=1 0 → 1 = 1
1∨1=1 1 → 0 = 0
1 → 1 = 1
24
11
Boolean Logic
Operands is the value representing the truth of the statement
• 8 Boolean value for “the sun is shinning”
• M Boolean value for “today is Saturday”
All Boolean operations can be expressed in terms of AND and NOT operations
¬ ¬
• 8∨M 8 ∧ ¬M
¬
• 8→M 8∨M
• 8↔M 8→M ∧ M→8
¬
• 8⨁M 8↔M
25
Mathematical Concepts
Sets
Sequences and Tuples Strings represent data and form the basis for formal
languages, while languages are sets of strings defined by
Functions and Relations specific rules.
Graphs
Boolean Logic
Strings and Languages
26
12
Strings and Languages
The symbol (also called character) is the smallest building block, which can be any alphabet, letter, or picture
• e.g.: a, b, c, 0, 1
An alphabet is a set of symbols, which are always finite
• Greek letter Σ and Γ are used to define an alphabet
• e.g.: Σ = 0, 1, 2, … 9 is an alphabet of decimal digits
A string is a finite set sequence of symbols chosen from some alphabet
• A string is generally denoted as w and the length of a string is denoted as |w|
• e.g.: w=01011001 is a string from binary alphabet Σ={0,1} and |w| = 8
A language is a set of strings from some alphabet (finite or infinite)
• e.g.: L = {w| w is the empty string ε or ends in a 0}
27
Mathematical
Definitions: describe the objects statements are made of
and notions used definitions, which may
or may not be true
Proofs Mathematicians
Proof: convincing logical argument require proof
that a statement is true beyond any
doubt
28
13
Types of Proofs
The three that often occur in the theory of computation
• Proof by Construction: prove by demonstrating how to construct an object
• Proof by Contradiction: prove by assuming the argument to be false, then show the opposite
• Proof by Induction
Used to show that all elements of an infinite set have a specified property
Consists of two parts: basis and inductive step
• Basis proves initial element has property
• Inductive step proves that each other element (iteration) has the same property
29
30
14