Unit - 1
Unit - 1
Theory of Basic
Foundation
Computation
Presented by: Loknath
Regmi
TOPICS COVERED
• Introduction
• Review of Set
• Review of Logic
• Review of Proof
• Automata Theory
• Symbols and alphabet
• Language
• Valid/invalid computation
RESOURSES
• TEXT BOOK:
• J.E.Hopcroft, R.Motwani and J.D Ullman, ―Introduction to Automata
Theory, Languages and Computationsǁ, Second Edition, Pearson
Education, 2003.
• REFERENCES:
• H.R.Lewis and C.H.Papadimitriou, ―Elements of the theory
Computation,
of Second Edition, PHI, 2003.
• J.Martin, ―Introduction to Languages and the Theory of Computation,
Third Edition, TMH, 2003.
• Micheal Sipser, ―Introduction of the Theory and
Computation,
Thomson Brokecole, 1997.
Theory of Computation
❖ Computation is calculation, solving, making decision or
any task done by computer/calculator/ any machine.
❖ The term Theory defines capabilities, limitations of those
machines.
N = {0, 1, 2, 3, …}
Formal Languages
🡪 Let Σ be a finite set, which we will, henceforth, call an
alphabet.
🡪 A string of characters of the alphabet Σ (or a string
over Σ ) is either: (1) an ordered n-tuple of elements of
Σ written without parentheses or commas, or (2) the
null string ε, which has no characters.
5.1.
26
Examples
Let Σ = {0, 1}:
Σ3 = {000, 001, 010, 011, 100, 101, 110, 111}
Γ3 = {ε, 0, 1, 00, 01, 10, 11, 000, 001, 010, 011, 100,
101, 110, 111}
Σ* = {ε, 0, 1, 00, 01, 10, 11, 000, 001, 010, 011, 100,
101, 110, 111, …, 000000, …, 111111, ...}.
5.3.
29
Partitions of a Set
🡪 Two sets are called disjoint if they have no
elements in common. That is, A and B are
disjoint provided A ∩ B = ∅.
🡪 Theorem: If A and B are any sets, then (A − B)
and B are disjoint.
🡪 A collection of sets {A1,A2,…,An} is called
mutually or pairwise disjoint if
Ai ∩ Aj = ∅ whenever i ≠ j.
5.3.
32
Power Sets
🡪 If A is a set, the Power Set of A, denoted P (A),
is the set of all subsets of A.
🡪 Since ∅ ⊆ A, we conclude ∅ ∈ P (A), and A ⊆
A implies A ∈ P (A).
🡪 If A = {0,1}, P (A) = {∅,{0},{1},{0,1}}
🡪 Theorem: If A and B are sets with A ⊆ B, then P
(A) ⊆ P (B).
🡪 Theorem: If |A| = n, then | P (A) | = 2n.
5.3.3
4
Boolean Algebras
🡪 If A is a set, the collection {A, +, ⋅} is called a
Boolean Algebra if:
1. ∀ a,b∈A, a + b = b + a and a ⋅ b = b ⋅ a
2. ∀ a,b,c∈A, (a + b) + c = a + (b + c)
and (a ⋅ b) ⋅ c = a ⋅ (b ⋅ c)
3. ∀ a,b,c∈A, a + (b ⋅ c) = (a + b) ⋅ (a + c)
and a ⋅ (b + c) = (a ⋅ b) + (a ⋅ c)
4. ∃! 0,1∈A ∍ ∀ a∈A, a + 0 = a and a ⋅ 1 = a
5. ∀ a∈A, ∃ b∈A ∍ a + b = 1 and a ⋅ b = 0
1.1.3
5
Counterexamples
🡪 If a sentence cannot be judged to be T or F or is not
even a sentence, it cannot be a statement.
🡪 Examples:
Open the door! (imperative)
Did you open the door? (interrogative)
If x2 = 4. (fragment)
1.1.3
7
Compound Statements
🡪 Denote statements using the symbols p, q, r, ...
🡪 Denote the operations ∧, ∨, ~, → (to be defined
shortly), where:
p ∧ q - conjunction of p and q (p and q);
p ∨ q - disjunction of p and q (p or q);
~ p - negation of p (not p);
p → q - implication of p and q (p implies q);
1.1.3
8
Logical Operations
🡪 Negation:p ~p
T F
F T
🡪 Conjunction: • Disjunction:
p q (p ∧ q) p q (p ∨ q)
T T T T T T
T F F T F T
F T F F T T
F F F F F F
1.1.4
Example: (p ∨ q) ∧ ~r 1
Procedural Versions
of the Set Operations
🡪 x ∈ A ∪ B means x ∈ A or x ∈ B.
🡪 x ∈ A ∩ B means x ∈ A and x ∈ B.
🡪 x ∈ A − B means x ∈ A and x ∉ B.
🡪 x ∈ Ac means x ∉ A.
🡪 (x, y) ∈ A × B means x ∈ A and y ∈ B.
5.2.
61
Example: Show A ∩ B ⊆ A
🡪 Let x ∈ A ∩ B. Show x ∈ A.
🡪 x ∈ A ∩ B means x ∈ A and x ∈ B.
🡪 In particular, this means x ∈ A.
🡪 Hence, given x ∈ A ∩ B, we deduce that x
∈ A.
🡪 Therefore A ∩ B ⊆ A.
5.2.
62
Example 1:
A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)
Example 2: If A ⊆ B, then
A ∪ B = B and A ∩ B = A
First, show A ∩ B ⊆ A.
Then, show A ⊆ A ∩ B.
2.1.
65
Predicates
🡪 To study these types of logical arguments, we turn to
predicate calculus.
🡪 A predicate is a sentence that contains a finite
number of variables and becomes a statement when
specific values are substituted for the variables.
🡪 The domain of a predicate variable is the set of all
values that may be substituted in place of the
variable.
2.1.
66
Predicate Notation
🡪 If P(x) is a predicate and x has a domain D, the truth
set of P(x) is the set of all elements of D that make P(x)
true when substituted for x.
🡪 The truth set is denoted {x ∈ D | P(x)}.
🡪 If P(x) and Q(x) are predicates and the common
domain of x is D, then the notation P(x) ⇒ Q(x)
denotes that the truth set of P(x) is a subset of the
truth set of Q(x).
🡪 If P(x) and Q(x) have the same truth set, we denote
this as P(x) ⇔ Q(x).
2.1.
67
Examples
🡪 Example 1: Let D = {1,2,3,4,5} and let P(x) be the
predicate x2 ≥ x. Using the Method of Exhaustion, we
find that 12 ≥ 1, 22 ≥ 2, 32 ≥ 3,
42 ≥ 4, and 52 ≥ 5 are all true, hence the universal
statement ∀x ∈ {1,2,3,4,5}, x2 ≥ x is true.
🡪 Example 2: If we change this universal statement to:
∀x ∈ R, x2 ≥ x, it is no longer true since x = 1/2 is a
counterexample.
2.1.
69
More Examples
🡪 Consider: ∃x ∈ D ∍ x < 0.
2
Negations of Quantifiers
🡪 As seen in the previous example, the negation of an
existential statement is a universal statement.
🡪 Formally, we denote:
~[∃x ∈ D ∍ P(x)] ≡ ∀x ∈ D, ~P(x).
🡪 By the same process, we have that:
~[∀x ∈ D, P(x)] ≡ ∃x ∈ D ∍ ~P(x).
🡪 Intuitively, the first says the opposite of at least one
thing satisfying a property is that none do, and the
opposite of all things satisfying the property is that at
least one does not.
2.1.
72
Examples of Negations
🡪 The negation of:
Some people are sad.
is
All people are not sad.
🡪 The negation of:
All integers are rational.
is
At least one integer is irrational.
🡪 Which of each pair is true?
2.1.
73
Universal Conditional
🡪 The statement:
∀x, if P(x), then Q(x)
is called the universal conditional.
🡪 Many mathematical statements are universal
conditionals.
🡪 Example: ∀x ∈ R, if x > 2 then x2 > 4 (formal)
is equivalent to: (informally)
🡪 Every real number greater than 2 has a square greater
than 4.
🡪 The square of any real number greater than 2 is greater
than 4.
2.1.74
Universal Conditionals
🡪 Given the statement:
∀ x∈D, if P(x), then Q(x)
analogous to our definitions from propositional
calculus, we can construct the following.
🡪 Contrapositive: ∀ x∈D, if ~Q(x), then ~P(x).
🡪 Converse: ∀ x∈D, if Q(x), then P(x).
🡪 Inverse: ∀ x∈D, if ~P(x), then ~Q(x).
🡪 Negation: ∃ x∈D ∍ P(x), and ~Q(x).
3.1.
78
Common Mistakes
🡪 Arguing from examples;
🡪 Using the same letter to mean different things;
🡪 Jumping to a conclusion;
🡪 Begging the question (i.e. assuming true that which
you want to prove);
🡪 Using if when you mean since, hence, thus, therefore,
hencely, thusly, hereforthwith, etc.
3.6.
Proof by Contradiction 86
Example of Contraposition
Theorem: Given any integer n, if n2 is even, then
n is even.
(Contrapositive: If n is odd, then n2 is odd.)
Proof: (Contraposition) Let n be an integer and assume
that n is odd. Thus, there is an integer k such that n =
2k + 1. Show that n2 is odd.
Now, n2 = (2k + 1)2 = 4k2 + 4k + 1
= 2(2k2 + 2k) + 1.
Since k is an integer, (2k2 + 2k) is an integer.
Therefore n2 is odd. QED
4.2.92
What Is Induction
🡪 One of the more recently developed proof
techniques;
🡪 Used to verify conjectures about processes that
occur repeatedly, according to definite patterns;
🡪 Used to prove statements indexed on the Natural
Numbers (i.e. For all integers n ≥ 0, ...)
4.2.93
In Pictures
Induction
Induction
Induction
Induction
Basis
4.2.95
1
2 a
3 b
4
10.1.10
3
Inverse Relations
🡪 Definition: If R is a relation from set A to set B, then the
inverse relation of R, denoted R−1, is
R−1 = {(y,x) | (x,y) ∈ R}.
🡪 For example, if R = {(1,3), (2,1), (4,5), (6,6)}, then R −1 =
{(3,1), (1,2), (5,4), (6,6)}.
🡪 Could R = R−1?
🡪 Sure - let R = {(1,2), (2,1), (2,3), (3,2), (4,4)}.
10.1.10
2
1 3
4
10.2.10
Reflexivity, 5
1 2
4 3
10.2.11
Properties of Equality 0
• Example:
void main ()
{
int a,b;
etc; etc;
}
Valid / Invalid Computation: