Professional Documents
Culture Documents
Linear Algebra
Topic – 1
Logic and Quantifier
Learning Objectives
LO1:
Explain basic concepts logic of
compound, quantified statements,
set theory and function, and
properties of relation related to
discrete problems.
2
Outline
Definition
A statement (or proposition) is a sentence that is true or
false but not both.
Definition
If p is a statement variable, the negation of p is "not
p" or "It is not the case that p" and is denoted ~p.
6
Conjunction
Definition
If p and q are statement variables, the conjunction of p
and q is "p and q" denoted p q.
7
Disjunction
Definition
If p and q are statement variables, the disjunction of p and
q is "p or q," denoted p v q.
8
A Statement Form (Proposition)
Definition
A statement form (or propositional form) is an
expression made up of statement variables (such as p, q,
and r) and logical connectives (such as ~, , and v) that
becomes a statement when actual statements are
substituted for the component statement variables.
9
Truth Table for Exclusive Or
10
Logical Equivalence
Definition
Two statement forms are called
logically equivalent If and only if,
they have identical truth values for
each possible substitution of
statements for their statement
variables. The logical equivalence of
statement forms P and Q is denoted
by writing P Q.
11
Example: De Morgan’s Laws
Symbolically,
and
12
Showing Nonequivalence
13
Tautology and Contradiction
Definition
A tautology is a statement
form that is always true.
A statement whose form is
a tautology is a tautological
statement.
15
Simplifying Statement Forms
Example : Use Theorem 2.1.1 to verify the logical equivalence
∼(∼p ∧ q) ∧ (p ∨ q) ≡ p.
Solution:
16
Conditional Statements
…Hypothetical Reasoning Implies The Subordination Of The Real To The Realm Of The
Possible … —Jean Piaget, 1972
Conditional Statements (Implication)
Definition
18
Example : Conditional Statements
Example :
the statement
“If you show up for work Monday morning, then you will get the
job”
Solution :
a. My car is in the repair shop and I can get to class.
b. Sara lives in Athens and she does not live in Greece.
(Sara might live in Athens,Georgia; Athens, Ohio; or Athens, Wisconsin.)
20
The Contrapositive, Converse and
Inverse of a Conditional Statement
Definition
Suppose a conditional statement of the form
“If p then q” is given.
The contrapositive is “If ~q then ~p” or (~q → ~p)
The converse is “If q then p“ or (q → p)
The inverse is "If ~p then ~q" or (~p → ~q)
21
The Contrapositive, Converse and
Inverse of a Conditional Statement
Example :
23
Biconditional (Biimplication)
Definition
24
Order of Operations for Logical Operators
Definitions of if and only if, saying “p if, and only if, q” should
mean the same as saying both “p if q” and “p only if q.”
Example : Biconditional
Solution
1. If this program is correct, then it produces the correct answers for all
possible sets of input data;
2. If this program produces the correct answers for all possible sets of
input data, then it is correct.
Necessary and Sufficient Conditions
Definition
If r and s are statements:
r is a sufficient condition for s means “if r then s.”
r is a necessary condition for s means “if not r then not s.”
Solution
If Pia was born on U.S. soil,
then she is a U.S. citizen.
Converting a Necessary
Condition to If-Then Form
Use the contrapositive to rewrite the following statement in two ways:
Solution :
Version 1: If George has not attained the age of 35, then he cannot be
president of the United States.
Definition
•An argument is a sequence of statements (or proposition).
All statements (or proposition) in an argument except for the
final one, are called premises (or assumptions or
hypotheses). The final statement or statement form is called
the conclusion.
The symbol , which is read "therefore," is normally placed
just before the conclusion.
To say that an argument is valid means that if the resulting
premises are all true, then the conclusion is also true.
32
Valid and Invalid Arguments
34
A Valid Argument Form
Show that the following argument form is valid
35
Rules of Inference
36
Application: A More Complex
Deduction
You are about to leave for school in the morning and discover that you
don’t have your glasses. This statements are true:
a. If I was reading the newspaper in the kitchen, then my glasses are on the
kitchen table.
b. If my glasses are on the kitchen table, then I saw them at breakfast.
c. I did not see my glasses at breakfast.
d. I was reading the newspaper in the living room or I was reading the
newspaper in the kitchen.
e. If I was reading the newspaper in the living room then my glasses are on
the coffee table.
Where are the glasses?
37
Application: A More Complex
Deduction
Solution :
Let
RK = I was reading the newspaper in the kitchen.
GK = My glasses are on the kitchen table.
SB = I saw my glasses at breakfast.
RL = I was reading the newspaper in the living room.
GC = My glasses are on the coffee table.
38
The conclusion
1. RK → GK by (a)
GK → SB by (d)
∴ RK → SB by transitivity
2. RK → SB by the conclusion of (1)
∼SB by (c)
∴ ∼RK by modus tollens
3. RL ∨ RK by (d)
∼RK by the conclusion of (2)
∴ RL by elimination
Thus the glasses
4. RL → GC by (e)
are on the coffee
RL by the conclusion of (3) table.
∴ GC by modus ponens 39
Fallacies
Solution
This invalid argument form is called the converse error because the
conclusion of the argument would → follow from the premises if the
premise p q were replaced by its converse.
A conditional statement is not logically equivalent to its converse.
Converse error is also known as the fallacy of affirming the consequent.
Inverse Error
This invalid argument form is called the inverse error because the
conclusion of the argument would → follow from the premises if the
premise p q were replaced by its inverse.
A conditional statement is not logically equivalent to its inverse.
Inverse error is also known as the fallacy of denying the antecedent.
A Valid Argument with a False
Premise and a False Conclusion
The argument below is valid by modus ponens. But its major premise
is false, and so is its conclusion.
If New York is a big city, then New York has tall buildings.
New York has tall buildings.
New York is a big city.
Digital Logic Circuits
47
Black Boxes and Gates
48
“NOT”, “AND”, and “OR” Gates
49
NAND and NOR Gates
50
Constructing the Input/Output
Table for a Circuit
Construct the input/output table for the following circuit.
Solution :
The Boolean Expression
Corresponding to a Circuit
One of the founders of symbolic logic was the English mathematician George
Boole. In his honor, any variable, such as a statement variable or an input
signal, that can take one of only two values is called a Boolean variable.
In circuitry theory, NOT, AND, and OR gates are the basic gates. Any circuit can
be designed using these gates. The circuits designed depend only on the
inputs, not on the output. In other words, these circuits have no memory. Also
these circuits are called combinatorial circuits.
Finding a Boolean Expression for a Circuit
Find the Boolean expressions that correspond to the circuits shown below :
Solution :
The final expression obtained, (P ∨ Q)∧ ∼(P ∧ Q), is the expression for exclusive
or: P or Q but not both.
53
Recognizer
Definition
A recognizer is a circuit that outputs a 1 for exactly one particular
combination of input signals and outputs 0’s for all other combinations.
54
Constructing Circuits for Boolean
Expressions
Construct circuits for the following Boolean expressions
Solution :
a multiple-input AND-gate
55
Designing a Circuit for
a Given Input/Output Table
Design a circuit for the following input/output table:
Solution :
Identify each row for which the output is 1—in this case, the rows 1, 3, and 4.
(P ∧ Q ∧ R) ∨ (P∧ ∼Q ∧ R) ∨ (P∧ ∼Q∧ ∼R).
56
Designing a Circuit for
a Given Input/Output Table
Solution
The circuit corresponding to this expression. Such expressions are said to be in
disjunctive normal form or sum-of-products form.
Disjunctive Normal Form (DNF)
Definition
Disjunctive Normal Form (DNF) is a boolean expression E, which has no duplication
on the multiplication of each variable
Example:
E1 = X Z’ + X’ Y Z’ + X Y’ Z is DNF
58
Full DNF
Definition
A boolean expression E (X1, X2, ...) is full DNF if each fundamental product of
expression consisting of all the variables.
Example:
E = X Y 'Z + X' Y Z + X Y Z ‘
59
Consensus
Definition
Let P1 and P2 are fundamental product. If exactly one variable which has
complement on P1 and P2, then consensus (Q) from P1 and P2 is multiplication
of each variables in P1 and P2 without complement variable and written : P1 +
P2 = P1+ P2 + Q
Example :
1. Let P1 = xy’zp and P2 = xyt, then consensus of P1 and P2 is Q = xzpt , and
written :
xy’zp + xyt = xy’zp + xyt + xzpt
2. Let P1 = xy’z and P2 = x’yzp, then P1 and P2 don’t have consensus because
P1 and P2 have two complement variable, they are x and y.
60
Theorem of Fundamental Product
Theorem (Include)
Example :
61
Karnaugh Map
Karnaugh Map
A Karnaugh map or K-map, for finding terms to combine for Boolean functions
involving a relatively small number of variables
The method we will describe was introduced by Maurice Karnaugh in 1953. His
method is based on earlier work by E.W. Veitch.
K-maps give us a visual method for simplifying sum-of-products expansions; they
are not suited for mechanizing this process
A Karnaugh map has zero and one entries at different positions. Each position in a
grid corresponds to a truth table entry.
Given a Boolean function described by a truth table or logic function, then:
• Draw the Karnaugh Map for the function.
• Use the information from a Karnaugh Map to determine the smallest sum-of-
products function.
63
Karnaugh Map in Two Variables
64
Karnaugh Map in Two Variables
Example :
Find the K-maps for Boolean expression E that equal to :
Solution :
E=y E= E=
65
Karnaugh Map in Three Variables
Let (x,y,z) be a sum of product Boolean expression such that minterm consists
of three variables x,y,z. To define the K-map for (x,y,z) , we consider the
following table
66
Blocks in K-maps in Three Variables.
Karnaugh Map in Three Variables
Example :
Use K-maps to minimize these sum-of-products expansions
Karnaugh Map in Three Variables
Solution :
A K-map in Four Variables
70
A K-map in Four Variables
A K-map in Four Variables
Example :
Use K-maps to simplify these sum-of-products expansions.
A K-map in Four Variables
Solution :
Predicates And Quantified Statements I
…It Was Not Till Within The Last Few Years That It Has Been Realized How
Fundamental Any And Some Are To The Very Nature Of Mathematics. —A.
N. Whitehead (1861–1947)
Predicates
Definition
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.
Definition
If P(x) is a predicate and x has domain D, the truth set of P(x) is the
set of all elements of D that make P(x) true when they are
substituted for x. The truth set of P(x) is denoted
{x D|P(x)}.
75
Finding Truth Values of a Predicate
Let P(x) be the predicate "x2 > x" with domain the set R of all real numbers.
Write P(2), P(1/2), P(-2), and indicate which of these propositions are true
and which are false!
Solution :
76
The Truth Set of The Predicate
Let Q(n) be the predicate “n is a factor of 8.” Find the truth set of Q(n) if
a. the domain of n is the set Z+ of all positive integers
b. the domain of n is the set Z of all integers.
Solution :
a. The truth set is {1, 2, 4, 8} because these are exactly the positive integers
that divide 8 evenly.
b. The truth set is {1, 2, 4, 8,−1,−2,−4,−8} because the negative
integers−1,−2,−4, and −8 also divide into 8 without leaving a remainder. ■
Change Predicates Into Propositions
One sure way to change predicates into propositions is to assign specific values to
all their variables.
Example :
If x represents the number 35, the sentence
"x is (evenly) divisible by 5“
is a true propositions since 35 = 5٠7.
78
The Universal Quantifier,
Example :
The sentence "All human beings are mortal" is to write
human beings x, x is mortal
or, more formally
x S, x is mortal,
and read “ For all x in S, x is mortal “
where S denotes the set of all human beings.
79
Truth and Falsity of Universal Proposition
Definition
It is defined to be false if, and only if, Q(x) is false for at least one x in D.
A value for x for which Q (x) is false is called a counter example to the
universal proposition.
80
Truth and Falsity of Universal Proposition
Example :
a. Let D = {1, 2, 3,4, 5}, and consider the proposition “x D, x2 x”
Show that this proposition is true.
b. Consider the proposition x R, x2 x. Find a counter example to
show that this proposition is false.
Solution:
a. Check that "x2 x" is true for each individual x in D.
12 > 1, 22 > 2, 32 > 3, 42 > 4, 52 > 5.
Hence " x D,x2 x " is true.
b. Counter example: Take x = 1/2. Then x is in R (since 1/2 is a real number) and
Example:
The sentence "There is a student in Math 140" can be written as
a person s such that s is a student in Math 140,
or more formally,
sS such that s is a student in Math 140,
where S is the set of all people.
Some other expressions that can be used in place of there exists are there
is a, we can find a, there is at least one, for some, and for at least one.
82
Truth and Falsity of Existential Proposition
Definition
It is defined to be true if, and only if, Q(x) is true for at least one x in D.
It is defined to be false if, and only if, Q(x) is false for all x in D.
83
Truth and Falsity of Existential Proposition
Example :
a. Consider the proposition “ m Z such that m2 = m”.
Show that this proposition is true.
Solution :
a. Observe that 12 = 1. Thus"m2 = m" is true for at least one integer m. Hence “ m
Z such that m2 = m” is true.
Solution :
a. Every real number has a nonnegative square.
Or : All real numbers have nonnegative squares.
Or : Any real number has a nonnegative square.
Or : The square of each real number is nonnegative.
Translating from Formal
to Informal Language (2)
Solution :
b. All real numbers have squares that do not equal -1.
Or : No real numbers have squares equal to -1.
(The words none are or no … are are equivalent to the words all are not.)
c. There is a positive integer whose square is equal to itself.
Or : We can find at least one positive integer equal to its own square.
Or : Some positive integer equals its own square.
Or : Some positive integers equal their own squares. ■
Translating from Formal
to Informal Language (3)
Example :
Rewrite each of the following statements formally. Use quantifiers and variables.
a. All triangles have three sides.
b. No dogs have wings.
c. Some programs are structured.
Solution :
a. tT, t has three sides
(where T is the set of all triangles).
b. dD, d does not have wings
(where D is the set of all dogs).
c. pP such that p is structured
(where P is the set of all programs).
Universal Conditional Propositions
A reasonable argument can be made that the most important form of proposition
in mathematics is the universal conditional proposition:
x, if P(x) then Q(x)
Example :
Rewrite the following statement informally, without quantifiers or variables.
∀x ∈ R, if x > 2 then > 4.
Solution :
If a real number is greater than 2 then its square is greater than 4. or
The square of any real number greater than 2 is greater than 4.
88
Predicates And Quantified Statements II
Negation of a Universal Statement
Theorem
Example:
A formal negations for the proposition
“ primes p, p is odd”
is
“ a prime p such that p is not odd”. 90
Negation of an Existential Proposition
Theorem
The negation of a statement of the form
x in D such that Q(x)
is logically equivalent to a statement of the form
x in D,~Q(x).
Symbolically,
~(x in D such that Q(x)) x in D,~Q(x).
Example :
A formal negations for the statement
“ a triangle T such that the sum of the angles of T equals 200°”.
is
“ triangles T, the sum of the angles of T does not equal 200° ”.
91
More Negations
Example :
Rewrite the following statements formally. Then write formal and informal
negations.
a. No politicians are honest.
b. The number 1,357 is not divisible by any integer between 1 and 37.
Solution :
a. Formal version (1): politicians x, x is not honest.
Formal negation (2): a politician x such that x is honest.
Informal negation (3) : Some politicians are honest.
b. (1) integer n between 1 and 37, 1,357 is not divisible by n.
(2) an integer n between 1 and 37 such that 1,357 is divisible by n.
(3) The number 1,357 is divisible by some integer between 1 and 37.
Negations of Universal
Conditional Statements
Negation of a Universal Conditional Statement
∼(∀x, if P(x) then Q(x)) ≡ ∃x such that P(x) and ∼Q(x).
Example :
a. ∀ people p, if p is blond then p has blue eyes.
b. If a computer program has more than 100,000 lines, then it contains a
bug.
Solution
a. ∃ a person p such that p is blond and p does not have blue eyes.
b. There is at least one computer program that has more than 100,000 lines
and does not contain a bug. ■
Variants of Universal
Conditional Statements
Definition
Example :
Write a formal and an informal contrapositive, converse, and inverse for the
following statement :
If a real number is greater than 2, then its square is greater than 4.
Example
Solution:
The formal version : ∀xR, if x 2 then 4.
Contrapositive : ∀xR, if 4 then x2.
(If the square of a real number is less than or equal to 4, then
the number is less than or equal to 2).
It Is Not Enough To Have A Good Mind. The Main Thing Is To Use It Well.
—René Descartes
Multiple Quantifier
x y P(x,y)
P(x,y) true for all x, y pairs
x y P(x,y)
P(x,y) true for at least one x, y pair
x y P(x,y)
For every value of x we can find a (possibly different) y so that
P(x,y) is true.
x y P(x,y)
There is at least one x for which P(x,y) is always true.
Interpreting Statements with
More Than One Quantifier (1)
Example :
A college cafeteria line has four stations: salads, main courses, desserts, and
beverages. The salad station offers a choice of green salad or fruit salad; the
main course station offers spaghetti or fish; the dessert station offers pie or cake;
and the beverage station offers milk, soda, or coffee. Three students, Uta, Tim,
and Yuen, go through the line and make the following choices:
Uta : green salad, spaghetti, pie, milk
Tim : fruit salad, fish, pie, cake, milk, coffee
Yuen : spaghetti, fish, pie, soda
Interpreting Statements with
More Than One Quantifier (2)
These choices are illustrated in this figure :
Example
Write each of following statements informally and find its truth value :
a. ∃ an item I such that ∀ students S, S chose I .
b. ∃ a student S such that ∀ items I, S chose I .
c. ∃ a student S such that ∀ stations Z, ∃ an item I in Z such that S chose I .
d. ∀ students S and ∀ stations Z,
∃ an item I in Z such that S chose I .
Solution
a. There is an item that was chosen by every student. This is true; every student
chose pie.
b. There is a student who chose every available item. This is false; no student chose
all nine items.
c. There is a student who chose at least one item from every station. This is true;
both Uta and Tim chose at least one item from every station.
d. Every student chose at least
one item from every station.
This is false; Yuen did not
choose a salad. ■
102