Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Theory of Computation

WK1: Introduction

Welcome
Instructor: Khalilah Burrell-Battick Module Assessment Breakdown
Email: kburrell@utech.edu.jm • 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?

What are the fundamental capabilities and limitations of computers?


Automata Theory Computability Theory Complexity Theory
What can we compute with very little space? Is a given problem solvable or unsolvable? What makes some problems computationally hard
and others easy?
Allows practice with formal definitions of Defines whether a problem is solvable by any
computation and introduces concepts relevant abstract machine The objective is to classify problems as easy ones
to other nontheoretical areas of computer and hard one
Theoretical models are proposed in order to
science understand solvable/unsolvable problems which “Easy” problem - searching for a name in a
leads to the development of the real computers directory
Has two models
• finite automaton - used in text processing, • The Turing machine is a simple abstract “Hard” problem - if it cannot be solved efficiently,
compilers, and hardware design mathematical model of a real computer or if we don’t know whether it can be solved
• context-free grammar - used in programming efficiently. An example is finding an optimal
languages and AI timetable for all UTech students

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.

Functions and Relations It enables the precise definition and analysis of


Graphs computational models and their properties, making it an
essential tool in computer science research and practice.
Boolean Logic
Strings and Languages

Set is a collection of objects e.g. {7, 2, 8}


“A contains 7, 2, & 8”
Mathematical Concepts •


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”

Sets The order of elements is meaningless. It does not matter


how often the same element is listed.
Sequences and Tuples
For A = {7, 2, 8} and B = {8, 7, 5, 2}
Functions and Relations
• AB “A is a subset of B”
Graphs If every member of A is also a member of B
Boolean Logic • If A is a subset of B and not equal to B, then A ⊊ B
Strings and Languages “A is a proper subset of B”
The set with zero elements is an empty set, written as 

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:

 =  |    ℎ  ℎ ℎ 

The set of all x such that x is greater than or equal to 5


Example:  |  ≥ 5

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} XY={2} Y\X = {3, 4}
• Two sets are called disjoint if their intersection is empty, that is, they
share no elements: AB = 
• The relative complement of two sets is the set of elements that is
one set but not in the other
/ = 1 / = 3,4
XY={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

Sequence is list of objects in some order


• Sequence (7, 2, 8) is not the same as (2, 7, 8)

Repetition is not allowed in a set but allowed in a sequence


Sequence and • Sequence (7, 7, 2, 8) is identical to set {7, 2, 8}
Tuples • Sequences (7, 7, 2, 8) and (7, 2, 8) are not identical
Finite sequences are called tuples
• (7, 2, 8) is a 3-tuple
• (7, 9) is a 2-tuple (also called a pair)

14

6
Set and sequences may appear as elements of other sets and
sequences

Power set: is the set of all subsets of a set


• Let A = {a, b} , the power set of A is { , {a}, {b}, {a, b} }

The set of all pairs whose elements are 0s and 1s


{ (0,0), (0,1), (1,0), (1,1) }

Cartesian product: where A = {a, b} and B = {1, 2, 3}


• All pairs where the 1 st element is a member of A and the
2nd element is a member of B.
$×&= ', ( , ', ) , ', * , +, ( , +, ) , +, *

Set and Sequence

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.

Functions and Relations Relations describe associations or connections between


sequences and are used to define the structure and
Graphs dependencies of formal languages, automata,
Boolean Logic computational models, and problems in complexity theory.

Strings and Languages

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

Functions & Relations


Rock-paper-scissors
In the game Rock-Paper-Scissors two players simultaneously select a member of the set
{rock, paper, scissors} BEATS rock paper scissors
rock false false true
• If the two players’ selection are the same, then nobody wins
• If the two players’ selection is different, then the winner is determined by the function BEATS paper true false false
• The predicate 8: 1 → : ,   can be written (D, S)
scissors false true false
where ; = ∈ 1|8 = : .
• Hence the relation of beats can be written as
=>, =  ,   , => , = ,  

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.

Relations 2-ary relation is called a binary relation

A special type of binary relation is called an equivalence relation if it is reflexive,


symmetric, and transitive

19

Consider relation ? = @, A | @ = A

• R is reflexive, if for every , 3

equivalence If = is true

Relations • R is symmetric, if for every  and B, 3B iff y3


If =  , then  = is true

• R is transitive, if for every , B, and D, 3B and B3D implies 3D


If =  and  = = , then = = 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.

Strings and Languages

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

Lemmas are statements


that assist the proof of
another significant
statement
Theorem: mathematical statement
Definitions, proven true
Corollaries are
statements that allow
us to conclude easily
that other related

Theorems, And statements are 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

Reference Introduction to the Theory of Computation,


Michael Sipser
Chapter 0: Introduction

30

14

You might also like