SlideShare a Scribd company logo
Course Objectives:
• 1-Develop basic mathematical reasoning
skills for understanding and constructing
• mathematical arguments.
• 2. Learn how to analyze and solve counting
problems.
• 3. Learn how to specify, verify, and analyze
simple algorithms
Topics Covered:
1. Formal logic
2. Proofs
4. Sets and combinatorics
5. Algorithms and their complexity
6. Induction
7. Counting
8. Discrete probability
9. Relations
10. Graphs and trees
11. Boolean algebra
12. Finite-state machines
13. Turing machines
Textbooks:
• 1 Rosen, “Discrete Mathematics and Its
Applications”, 6th ed., McGraw-Hill,.
•
Chapter 1
Propositional Logic
Formal logic
1.1 Propositional Logic
A proposition :is a declarative sentence (that is, a sentence that declares a
fact) that is either true or false, but not both.
EXAMPLE 1: l All the following declarative sentences are propositions.
1. Washington., is the capital of the USA.
2 . Omdurman is the capital of Sudan .
3 . 1 + 1 = 2 .
4 . 2 + 2 = 3 .
Propositions 1 and 3 are true, whereas 2 and 4 are false
EXAMPLE 2: Consider the following sentences.
1 . What time is it?
2 . Read this carefully.
3 . x + 1 = 2 .
4 . x + y = Z
1.1 Propositional Logic
Sentences 1 and 2 are not propositions because they are not
declarative sentences. Sentences 3 and 4 are not propositions
because they are neither true nor false. Note that each of sentences 3
and 4 can be turned into a proposition if we assign values to the
variables.
We use letters to denote propositional variables (or statement
variables), that is, variables that represent propositions, just as letters
are used to denote numerical variables.
cont
The conventional letters used for propositional
variables are p, q , r, s, . . . . The truth value of a
proposition is true, denoted by T, if it is a true
proposition and false, denoted by F, if it is a false
proposition.
The area of logic that deals with propositions is called
the propositional calculus or propositional logic.
It was first developed systematically by the Greek
philosopher Aristotle more than 300 years ago
1.1 Propositional Logic
Compound: propositions, are formed from existing
propositions using logical operators.
DEFINITION 1 :Let p be a proposition. The negation of p, denoted
by p, is the statement
"It is not the case that p."
The proposition p is read "not p." The truth value of the
negation of p, p, is the opposite
of the truth value of p.
• EXAMPLE 3: Find the negation of the proposition
• "Today is Friday."
• Solution: The negation is
• "It is not the case that today is Friday."
• This negation can be more simply expressed by
• "Today is not Friday,"
• Or, "It is not Friday today."
1.1 Propositional Logic
DEFINITION 2:Let p and q be propositions. The
conjunction of p and q, denoted by p  q, is the
proposition "p and q ." The conjunction p  q is
true when both p and q are true and is false
otherwise.
EXAMPLE 4: Find the conjunction of the
propositions p and q where p is the proposition
"Today is Friday"
and q is the proposition "It is raining today."
• Solution: The conjunction of these propositions,
p  q, is the proposition "Today is Friday and
• it is raining today." This proposition is true on
rainy Fridays and is false on any day that is not a
Friday and on Fridays when it does not .rain
1.1 Propositional Logic
DEFINITION 3:Let p and q be propositions. The
disjunction of p and q, denoted by p V q, is the
proposition
"p or q ." The disjunction p V q is false when both p
and q are false and is true otherwise.
• The use of the connective or in a disjunction
corresponds to one of the two ways the word
• or is used in English, namely, in an inclusive
way. A disjunction is true when at least one of
the two propositions is true. For instance, the
inclusive or is being used in the statement
• "Students who have taken calculus or
computer science can take this class.
1.1 Propositional Logic
EXAMPLE 5: What is the disjunction of the
propositions p and q where p and q are the same
propositions as
in Example 4?
Solution: The disjunction of p and q, p v q, is the
proposition
"Today is Friday or it is raining today."
This proposition is true on any day that is either a
Friday or a rainy day (including rainy Fridays).
It is only false on days that are not Fridays when it
also does not rain.
1.1 Propositional Logic
DEFINITION 4: Let p and q be propositions. The
exclusive or of p and q, denoted by p q (p XOR q),
is the proposition that is true when exactly one of p
and q is true and is false otherwise.
p q p ⊕ q
T T F
T F T
F T T
F F F
1.1 Propositional Logic
Conditional Statements:
Let p and q be propositions. The conditional statement p → q is the proposition "if p,
then q ." The conditional statement p → q is false when p is true and q is false, and true
otherwise.
In the conditional statement p → q , p is called the hypothesis (premise) and q is called
the conclusion (or consequence).
The statement p→ q is called a conditional statement because p → q asserts that q is
true on the condition that p holds. A conditional statement is also called an implication.
The truth table for the conditional statement p → q is shown in Table 5. Note that the
statement p → q is true when both p and q are true and when p is false (no matter what
truth value q has).
1.1 Propositional Logic
The statement p→ q is called a conditional statement because p → q asserts that q is
true on the condition that p holds. A conditional statement is also called an implication.
The truth table for the conditional statement p → q is shown in Table 5. Note that the
statement p → q is true when both p and q are true and when p is false (no matter what
truth value q has).
ways to express this conditional statement:
"if p, then q"
"if p, q "
"p is sufficient for q"
"q if p"
"q when p"
"a necessary condition for p is q"
"q unless → p"
"p implies q"
"p only if q"
"a sufficient condition for q is p"
"q whenever p"
"q is necessary for p"
"q follows from p"
1.1 Propositional Logic
CONVERSE, CONTRAPOSITIVE, AND INVERSE We
can form some new conditional statements
starting with a conditional statement p → q . In
particular, there are three related conditional.
The proposition q → p is called the converse of p
→ q
The contra positive of p → q is the proposition ¬ q
→ ¬ p.
The proposition ¬ p → ¬ q is called the inverse of
p → q.
1.1 Propositional Logic
EXAMPLE 9: What are the contrapositive, the
converse, and the inverse of the conditional
statement
"The home team wins whenever it is raining."?
Solution: Because "q whenever p" is one of the
ways to express the conditional statement p → q ,
the original statement can be rewritten as
"If it is raining, then the home team wins."
Consequently, the contrapositive of this
conditional statement is "If the home team does
not win, then it is not raining."
The converse is
"If the home team wins, then it is raining."
The inverse is
"If it is not raining, then the home team does not win."
Only the contrapositive is equivalent to the original
statement.
BICONDITIONALS: another way to combine propositions
that expresses that two propositions have the same truth
value.
1.1 Propositional Logic
DEFINITION 6 :Let p and q be propositions. The biconditional
statement p q is the proposition "p if and only if q ." The
biconditional statement p q is true when p and q have the same
truth values, and is false otherwise. Biconditional statements are
also called bi-implications.
1.1 Propositional Logic
1.1 Propositional Logic
EXAMPLE 10: Let p be the statement "You can
take the flight" and let q be the statement "You
buy a ticket."
Then p q is the statement
"You can take the flight if and only if you buy a
ticket."
This statement is true if p and q are either both
true or both false, that is, if you buy a ticket and
can take the flight or if you do not buy a ticket
and you cannot take the flight. It is false when p
and q have opposite truth values.
EXAMPLE 11: Construct the truth table of the
compound proposition
(p v ¬ q) → (p  q).
1.1 Propositional Logic
EXAMPLE 12 :How can this English sentence be
translated into a logical expression? "You can
access the Internet from campus only if you are a
computer science major or you are not a
freshman.” a= access the internet,
C = computer science student and,
F =freshman
1.1 Propositional Logic
Chapter 1.2
Propositional Equivalences
1.2 Propositional Equivalences
DEFINITION 1:A compound proposition that is
always true, no matter what the truth values of the
propositions that occur in it, is called a tautology. A
compound proposition that is always false is called
a contradiction. A compound proposition that is
neither a tautology nor a contradiction is called a
contingency. Tautologies and contradictions are
often important in mathematical reasoning.
1.2 Propositional Equivalences
EXAMPLE 1: We can construct examples of tautologies and
contradictions using just one propositional variable.
Logical Equivalences: Compound propositions that have the same
truth values in all possible cases are called logically equivalent. We
can also define this notion as follows.
DEFINITION 2: The compound propositions p and q are called
logically equivalent if p q is a tautology.
The notation p == q denotes that p and q are logically equivalent.
1.2 Propositional Equivalences
EXAMPLE 4 :Show that
are logically equivalent. This is the distributive law of
disjunction over conjunction.
TABLE 6 Logical Equivalences.
De Morgan’s Laws
De Morgan’s Laws
c
Propositional operations summary
Bit Operations
Boolean values can be represented as 1 (true) and 0 (false)
A bit string is a series of Boolean values. Length of the string
is the number of bits.
10110100 is eight Boolean values in one string
 We can then do operations on these Boolean strings.
Each column is its own Boolean operation
01011010
10110100
11101110
Bit Operations
EXAMPLE : Find the bitwise OR, bitwise AND, and bitwise XOR of the bit strings
0 1 1 0 1 1 0 1 1 0 and 1 1 000 1 1 1 0 1 . (Note that: bit strings will be split into
blocks of four bits to make them easier to read.)
Solution: The bitwise OR, bitwise AND, and bitwise XOR of these strings are
obtained by taking the OR, AND, and XOR of the corresponding bits, respectively.
0 1 1 0 1 1 0 1 1 0
1 1 0 0 0 1 1 1 0 1
1 1 1 0 1 1 1 1 1 1 bitwise OR
0 1 0 0 0 1 0 1 0 0 bitwise AND
1 0 1 0 1 0 1 0 1 1 bitwise XOR
Logical Equivalences
Proof using Logical Equivalence
(p  r)  (q  r)
 ( p  r)  ( q  r) Definition of implication
  p  r   q  r Associative
  p   q  r  r Commutative
( p   q)  (r  r) Associative
  (p  q)  r De Morgan, Idempotent
 (p  q)  r Definition of implication
Example
Prove that (p  q)  (p  q) is a Tautology.
(Proof)
(p  q)  (p  q)
      (p  q)  (p  q) Implication
 ( p   q)  (p  q) De Morgan
( p  p)  ( q  q) Commutative, Associative
T  T Negation
 T Identity
Tautology, Contradiction, Equivalence
 Tautology: a statement that’s always true
p   p will always be true
 Contradiction: a statement that’s always false
p   p will always be false
A logical equivalence means that the two sides always have the same
truth values
Symbol is ≡ or  (we’ll use ≡)
Homework 1
Question 7 from Rosen, p. 17
p = “It is below freezing”
q = “It is snowing”
• It is below freezing and it is snowing
• It is below freezing but not snowing
• It is not below freezing and it is not snowing
• It is either snowing or below freezing (or both)
• If it is below freezing, it is also snowing
• It is either below freezing or it is snowing,
but it is not snowing if it is below freezing
• That it is below freezing is necessary and
sufficient for it to be snowing
Chapter 1.3
Predicates and Quantifiers
1.3 Predicates and Quantifiers
 How can we express?
“every computer in CS department is protected by
intrusion detection system”
“There exists at least one student who has a red hair”.
 “x is greater than 3”
x: subject
“is greater than 3”: predicate
P(x): propositional function P at x
Propositional Functions
Consider P(x) = x < 5
P(x) has no truth values (x is not given a value)
P(1) is true: The proposition 1<5 is true
P(10) is false: The proposition 10<5 is false
P(x) will create a proposition when given a value
Let P(x) = “x is a multiple of 5”
For what values of x is P(x) true?
Let P(x) = x + 3
For what values of x is P(x) true?
Propositional Functions
Functions with multiple variables:
• P(x, y) = x + y == 0
P(1,2) is false, P(1,-1) is true
• P(x, y, z) = x + y == z
P(3,4,5) is false, P(1,2,3) is true
• P(x1,x2,x3 … xn) = …
Propositional Functions
EXAMPLE 1 :
Propositional Functions
EXAMPLE 3:
Quantifiers
 Why quantifiers?
Many things (in this course and beyond) are specified using
quantifiers
A quantifier is “an operator that limits the variables of a
proposition”
Two types:
1- Universal
2- Existential
Universal quantifiers
DEFINITION 1:
The universal quantification of P (x) is the statement
"P(x) for all values of x in the domain."
The notation x P (x) denotes the universal quantification
of P(x). Here is called the universal quantifier.
We read x P(x) as "for all x P(x)" or "for every x P(x )."
An element for which P(x) is false is called a counterexample
of x P (x).
Universal quantifiers
Represented by an upside-down A: 
• It means “for all”
• Let P(x) = x+1 > x
We can state the following:
• x P(x)
• English translation: “for all values of x, P(x) is true”
• English translation: “for all values of x, x+1>x is true”
But is that always true?
x P(x)
Let x = the character ‘a’
Is ‘a’+1 > ‘a’?
Universal quantifiers
You need to specify your universe!
• What values x can represent
• Called the “domain” or “universe of discourse” by the
textbook.
Let the universe be the real numbers.
Let P(x) = x/2 < x
• Not true for the negative numbers!
• Thus, x P(x) is false
When the domain is all the real numbers
In order to prove that a universal quantification is true, it
must be shown for ALL cases
In order to prove that a universal quantification is false, it
must be shown to be false for only ONE case
Existential quantification
 Represented by an backwards E: 
• It means “there exists”
• Let P(x) = x+1 > x
 We can state the following:
• x P(x)
• English translation: “there exists (a value of) x
such that P(x) is true”
• English translation: “for at least one value of x,
x+1>x is true”
Existential quantification
DEFINITION 2 :The existential quantification of P(x)
• Note that you still have to specify your universe
• Let P(x) = x+1 < x
There is no numerical value x for which
x+1<x
Thus, x P(x) is false
Existential quantification
• Let P(x) = x+1 > x
There is a numerical value for which x+1>x
In fact, it’s true for all of the values of x!
Thus,  x P(x) is true
• In order to show an existential quantification is
true, you only have to find ONE value.
• In order to show an existential quantification is
false, you have to show it’s false for ALL values
Existential quantification
EXAMPLE 14:
Quantifiers
A note on quantifiers
• Recall that P(x) is a propositional function
Let P(x) be “x == 0”
• Recall that a proposition is a statement that is either true or false
 P(x) is not a proposition
• There are two ways to make a propositional function into a
proposition:
 Supply it with a value
For example, P(5) is false, P(0) is true
 Provide a quantification
For example, x P(x) is false and x P(x) is true
Let the universe of discourse be the real numbers
Binding variables
 Let P(x, y) be x > y
• Consider: x P(x, y)
This is not a proposition!
• What is y?
If it’s 5, then x P(x, y) is false
If it’s x-1, then x P(x, y) is true
• Note that y is not “bound” by a quantifier
Binding variables
 (x P(x))  Q(x)
The x in Q(x) is not bound; thus not a proposition
 (x P(x))  (x Q(x))
Both x values are bound; thus it is a proposition
 (x P(x)  Q(x))  (y R(y))
All variables are bound; thus it is a proposition
 (x P(x)  Q(y))  (y R(y))
The y in Q(y) is not bound; this not a proposition
Negating quantifications
 Consider the statement:
• All students in this class have red hair
 What is required to show the statement is false?
• There exists a student in this class that does NOT have
red hair
 To negate a universal quantification:
• You negate the propositional function
• AND you change to an existential quantification
• ¬x P(x) = x ¬P(x)
Negating quantifications
Consider the statement:
• There is a student in this class with red hair
 What is required to show the statement is false?
• All students in this class do not have red hair
 Thus, to negate an existential quantification:
• To negate the propositional function
• AND you change to a universal quantification
• ¬x P(x) = x ¬P(x)
Chapter 1.4
Nested Quantifiers
1.4 Nested Quantifiers
EXAMPLE 1 :
Multiple quantifiers
 You can have multiple quantifiers on a statement
 x y P(x, y)
“For all x, there exists a y such that P(x, y)”
Example: x y (x + y == 0)
 x y P(x, y)
There exists an x such that for all y P(x, y) is true”
x y (x*y == 0)
Order of quantifiers
 x y and x y are not equivalent!
 x y P(x, y)
P(x, y) = (x + y == 0) is false
 x y P(x, y)
P(x, y) = (x + y == 0) is true
Negating multiple quantifiers
 Recall negation rules for single quantifiers:
• ¬x P(x) = x ¬P(x)
• ¬x P(x) = x ¬P(x)
• Essentially, you change the quantifier(s), and negate
what it’s quantifying
 Examples:
• ¬(x y P(x, y)) = x ¬y P(x, y) = x y ¬P(x, y)
• ¬(x y z P(x, y, z)) = x ¬y z P(x, y, z)
= x y ¬ z P(x, y, z) = x y z ¬P(x, y, z)
Negating multiple quantifiers
 Consider ¬(x y P(x, y)) = x y ¬P(x, y)
• The left side is saying “for all x, there exists a y such
that P is true”
• To disprove it (negate it), you need to show that “there
exists an x such that for all y, P is false”
 Consider ¬(x y P(x, y)) = x y ¬P(x, y)
• The left side is saying “there exists an x such that for all
y, P is true”
• To disprove it (negate it), you need to show that “for all
x, there exists a y such that P is false”
Nested Quantifiers Summary
TABLE 1 :
Translating between English and quantifiers
 The product of two negative integers is positive
x y ((x<0)  (y<0) → (x y > 0))
• Why conditional instead of and?
 The average of two positive integers is positive
x y ((x>0)  (y>0) → ((x + y)/2 > 0))
 The difference of two negative integers is not necessarily
negative
x y ((x<0)  (y<0)  (|x-y|≥0))
• Why and instead of conditional?
 The absolute value of the sum of two integers does not
exceed the sum of the absolute values of these integers
x y (|x + y| ≤ |x| + |y|)
Translating between English and quantifiers
 x y (x + y = y)
There exists an additive identity for all real numbers
 x y (((x≥0)  (y<0)) → (x - y > 0))
A non-negative number minus a negative number is
greater than zero
 x y (((x≤0)  (y≤0))  (x-y > 0))
The difference between two non-positive numbers is not
necessarily non-positive (i.e. can be positive)
 x y (((x≠0)  (y≠0)) ↔ (x y ≠ 0))
The product of two non-zero numbers is non-zero if and
only if both factors are non-zero
Chapter 1.5
Rules of Inference
desmath(1).ppt
Valid Arguments
 Assume you are given the following two statements:
• "If you have a current password, then you can log
onto the network."
• "You have a current password."
• Therefore,
• "You can log onto the network."
p  q
p
 q
Definitions
 An Argument in propositional logic is a sequence of
propositions.
 All but the final proposition are called premises.
 The final proposition is called conclusion.
 An argument is valid if the truth of all premises implies that
the conclusion is true.
i.e. (p1  p2  …  pn)  q is a tautology.
Modus Ponens
 Consider (p  (p → q)) → q
p
p  q
 q
Modus Ponens example
 Assume you are given the following two statements:
“you are in this class”
“if you are in this class, you will get a grade”
 Let p = “you are in this class”
 Let q = “you will get a grade”
 By Modus Ponens, you can conclude that you will get a
grade
Modus Tollens
 Assume that we know: ¬q and p → q
• Recall that p → q  ¬q → ¬p
 Thus, we know ¬q and ¬q → ¬p
 We can conclude ¬p
 q
p  q
  p
Modus Tollens example
 Assume you are given the following two statements:
“you will not get a grade”
“if you are in this class, you will get a grade”
 Let p = “you are in this class”
 Let q = “you will get a grade”
 By Modus Tollens, you can conclude that you are not in this
class
Addition & Simplification
 Addition: If you know that p is true, then p  q will
ALWAYS be true
p
 p  q
 Simplification: If p  q is true, then p will ALWAYS be
true
p  q
 q
Example Proof
 We have the hypotheses:
• “It is not sunny this afternoon and it is colder than yesterday”
• “We will go swimming only if it is sunny”
• “If we do not go swimming, then we will take a canoe trip”
• “If we take a canoe trip, then we will be home by sunset”
 Does this imply that “we will be home by sunset”?
 (( p  q)  (r  p)  ( r  s)  (s  t))  t ???
• When
 p = “It is sunny this afternoon”
 q = “it is colder than yesterday”
 r = “We will go swimming”
 s = “we will take a canoe trip”
 t = “we will be home by sunset
Example of proof
1. ¬p  q 1st hypothesis
2. ¬p Simplification using step 1
3. r → p 2nd hypothesis
4. ¬r Modus tollens using steps 2 & 3
5. ¬r → s 3rd hypothesis
6. s Modus ponens using steps 4 & 5
7. s → t 4th hypothesis
8. t Modus ponens using steps 6 & 7
More Rules of Inference
 Conjunction: if p and q are true separately, then pq is
true
 Disjunctive syllogism: If pq is true, and p is false, then q
must be true
 Resolution: If pq is true, and ¬pr is true, then qr must
be true
 Hypothetical syllogism: If p→q is true, and q→r is true,
then p→r must be true
1.5 Rules of Inference Summary
.
1.5 Rules of Inference
Definition:
EXAMPLE 1 :Suppose that the conditional statement "If it snows today,
then we will go skiing" and its hypothesis, "It is snowing today," are true.
Then, by modus ponens, it follows that the conclusion of the conditional
statement, "We will go skiing," is true..
1.5 Rules of Inference
EXAMPLE 5
Chapter 1.6
Introduction to Proofs
Terminology
 Theorem: a statement that can be shown true. Sometimes
called facts.
• Proposition: less important theorem
 Proof: Demonstration that a theorem is true.
 Axiom: A statement that is assumed to be true.
 Lemma: a less important theorem that is useful to prove a
theorem.
 Corollary: a theorem that can be proven directly from a
theorem that has been proved.
 Conjecture: a statement that is being proposed to be a true
statement.
Terminology
Rules of inference, together with definitions of terms, are
used to draw conclusions from other assertions, tying
together the steps of a proof.
 In practice, the final step of a proof is usually just the
conclusion of the theorem. However, for clarity, we will
often recap the statement of the theorem as the final step of
a proof.
DEFINITION 1:The integer n is even if there exists an
integer k such that n = 2k, and n is odd if there exists an
integer k such that n = 2k + 1 . (Note that an integer is either
even or odd, and no integer is both even and odd.)
Proof methods
 We will discuss ten proof methods:
1. Direct proofs
2. Indirect proofs
3. Vacuous proofs
4. Trivial proofs
5. Proof by contradiction
6. Proof by cases
7. Proofs of equivalence
8. Existence proofs
9. Uniqueness proofs
10.Counterexamples
Direct proofs
 Consider an implication: p → q
• If p is false, then the implication is always true
• Thus, show that if p is true, then q is true
 To perform a direct proof, assume that p is true, and show that q must
therefore be true
 Show that the square of an even number is an even number
• Rephrased: if n is even, then n2 is even
 (Proof) Assume n is even
Thus, n = 2k, for some k (definition of even numbers)
n2 = (2k)2 = 4k2 = 2(2k2)
As n2 is 2 times an integer, n2 is thus even
Indirect proofs
 Consider an implication: p → q
• It’s contrapositive is ¬q →¬p
 Is logically equivalent to the original implication!
• If the antecedent (¬q) is false, then the contrapositive is
always true
• Thus, show that if ¬q is true, then ¬p is true
 To perform an indirect proof, do a direct proof on the
contrapositive
Indirect proof example
 If n2 is an odd integer then n is an odd integer
 Prove the contrapositive: If n is an even integer, then n2 is
an even integer
 Proof: n=2k for some integer k (definition of even
numbers)
 n2 = (2k)2 = 4k2 = 2(2k2)
 Since n2 is 2 times an integer, it is even
 When do you use a direct proof versus an indirect proof?
Example of which to use
 Prove that if n is an integer and n3+5 is odd, then n is even
 Via direct proof
• n3+5 = 2k+1 for some integer k (definition of odd
numbers)
• n3 = 2k-4
• Umm… ???
 So direct proof didn’t work out. So: indirect proof
• Contrapositive: If n is odd, then n3+5 is even
• Assume n is odd, and show that n3+5 is even
• n=2k+1 for some integer k (definition of odd numbers)
• n3+5 = (2k+1)3+5 = 8k3+12k2+6k+6 = 2(4k3+6k2+3k+3)
• As 2(4k3+6k2+3k+3) is 2 times an integer, it is even
3
4
2 
 k
n
Proof by contradiction
 Given a statement p, assume it is false
• Assume ¬p
 Prove that ¬p cannot occur
• A contradiction exists
 Given a statement of the form p → q
• To assume it’s false, you only have to consider the case
where p is true and q is false
Proof by contradiction example
 Prove that if n is an integer and n3+5 is odd, then n is even
 Rephrased: If n3+5 is odd, then n is even
 Assume p is true and q is false
• Assume that n3+5 is odd, and n is odd
 n=2k+1 for some integer k (definition of odd numbers)
 n3+5 = (2k+1)3+5 = 8k3+12k2+6k+6 = 2(4k3+6k2+3k+3)
 As 2(4k3+6k2+3k+3) is 2 times an integer, it must be even
 Contradiction!
Proof by contradiction example
 Theorem (by Euclid): There are infinitely many prime
numbers.
 Proof. Assume there are a finite number of primes
 List them as follows: p1, p2 …, pn.
 Consider the number q = p1p2 … pn + 1
• This number is not divisible by any of the listed primes
 If we divided pi into q, there would result a
remainder of 1
• We must conclude that q is a prime number, not among
the primes listed above
 This contradicts our assumption that all primes are in
the list p1, p2 …, pn.
Vacuous proofs
 Consider an implication: p → q
 If it can be shown that p is false, then the implication is
always true
• By definition of an implication
 Note that you are showing that the antecedent is false
Vacuous proof example
 Consider the statement:
• All criminology majors in CS 2012 are female
• Rephrased: If you are a criminology major and you are in
CS 2012, then you are female
 Could also use quantifiers!
 Since there are no criminology majors in this class, the
antecedent is false, and the implication is true
Trivial proofs
 Consider an implication: p → q
 If it can be shown that q is true, then the implication is
always true
• By definition of an implication
 Note that you are showing that the conclusion is true
Trivial proof example
 Consider the statement:
• If you are tall and are in CS 2012 then you are a student
 Since all people in CS 2012 are students, the implication is
true regardless
Proof by cases
Show a statement is true by showing all possible cases are
true
 Thus, you are showing a statement of the form:
(p1  p2  …  pn)  q
 is true by showing that:
[(p1p2…pn)q]  [(p1q)(p2q)…(pn q)]
Proof by cases example
 Prove that
Note that b ≠ 0
 Cases:
• Case 1: a ≥ 0 and b > 0
Then |a| = a, |b| = b, and
• Case 2: a ≥ 0 and b < 0
Then |a| = a, |b| = -b, and
• Case 3: a < 0 and b > 0
Then |a| = -a, |b| = b, and
• Case 4: a < 0 and b < 0
Then |a| = -a, |b| = -b, and
b
a
b
a

b
a
b
a
b
a


b
a
b
a
b
a
b
a





b
a
b
a
b
a
b
a





b
a
b
a
b
a
b
a





Proofs of equivalences
This is showing the definition of a bi-conditional
 Given a statement of the form “p if and only if q”
• Show it is true by showing (p → q)(q → p) is true
Proofs of equivalence example
 Show that m2=n2 if and only if m=n or m=-n
 Rephrased: (m2=n2) ↔ [(m=n)(m=-n)]
[(m=n)(m=-n)] → (m2=n2)
• Proof by cases!
• Case 1: (m=n) → (m2=n2)
(m)2 = m2, and (n)2 = n2, so this case is proven
• Case 2: (m=-n) → (m2=n2)
(m)2 = m2, and (-n)2 = n2, so this case is proven
 (m2=n2) → [(m=n)(m=-n)]
• Subtract n2 from both sides to get m2-n2=0
• Factor to get (m + n)(m - n) = 0
• Since that equals zero, one of the factors must be zero
• Thus, either m + n=0 (which means m = - n)
• Or m - n=0 (which means m = n)
Existence proofs
 Given a statement: x P(x)
 We only have to show that a P(c) exists for some value of c
 Two types:
• Constructive: Find a specific value of c for which P(c) is
true.
• Non constructive: Show that such a c exists, but don’t
actually find it
 Assume it does not exist, and show a contradiction
Constructive existence proof example
 Show that a square exists that is the sum of two other
squares
• Proof: 32 + 42 = 52
 Show that a cube exists that is the sum of three other cubes
• Proof: 33 + 43 + 53 = 63
Non-constructive existence proof example
 Prove that either 2*10500+15 or 2*10500+16 is not a perfect
square
• A perfect square is a square of an integer
• Rephrased: Show that a non-perfect square exists in the
set {2*10500+15, 2*10500+16}
 Proof: The only two perfect squares that differ by 1 are 0
and 1
• Thus, any other numbers that differ by 1 cannot both be
perfect squares
• Thus, a non-perfect square must exist in any set that
contains two numbers that differ by 1
• Note that we didn’t specify which one it was!
Uniqueness proofs
 A theorem may state that only one such value exists
 To prove this, you need to show:
• Existence: that such a value does indeed exist
 Either via a constructive or non-constructive existence
proof
• Uniqueness: that there is only one such value
Uniqueness proof example
 If the real number equation 5x+3=a has a solution then it is
unique
 Existence
• We can manipulate 5x+3=a to yield x=(a-3)/5
• Is this constructive or non-constructive?
 Uniqueness
• If there are two such numbers, then they would fulfill the
following: a = 5x+3 = 5y+3
• We can manipulate this to yield that x = y
 Thus, the one solution is unique!
Counterexamples
 Given a universally quantified statement, find a single
example which it is not true
 Note that this is DISPROVING a UNIVERSAL statement
by a counterexample
 x ¬R(x), where R(x) means “x has red hair”
• Find one person (in the domain) who has red hair
 Every positive integer is the square of another integer
• The square root of 5 is 2.236, which is not an integer
What’s wrong with this proof?
 Theorem: All numbers are equal to 0.
(Proof)
Suppose a = b.
Then a2 = a b.
Then a2 - b2 = a b - b2.
Then (a - b)(a + b) = b(a - b).
Then a + b = b.
Therefore, a = 0.

More Related Content

PPT
Discrete mathematics Chapter1 presentation.ppt
PPT
Discrete mathematics Ch2 Propositional Logic_Dr.khaled.Bakro د. خالد بكرو
PPT
lectures in prolog in order to advance in artificial intelligence
PPT
Chapter 1: The Foundations: Logic and Proofs
PPT
First order predicate logic - Artificial Intelligence
PPT
PPT
good teaching skills and other beautiful things
PDF
Propositional logic
Discrete mathematics Chapter1 presentation.ppt
Discrete mathematics Ch2 Propositional Logic_Dr.khaled.Bakro د. خالد بكرو
lectures in prolog in order to advance in artificial intelligence
Chapter 1: The Foundations: Logic and Proofs
First order predicate logic - Artificial Intelligence
good teaching skills and other beautiful things
Propositional logic

Similar to desmath(1).ppt (20)

PPTX
Chapter1p1
PPTX
Chapter1 part1 : PROPOSITIONAL LOGIC || DISCRETE MATHEMATICS
PPTX
Chapter1p1.pptx
PDF
Chapter 01 - p1.pdf
PPTX
Discrete_Mathematics_Chapter1_Part1.pptx
PPT
Best presentation about discrete structure
PPT
Best Presentation about Discrete Computer
PPT
Propositional logic 2 all about logics and gates
PPT
Discrete Maths141 - Course Outline and Lecture Slides
PDF
Chapter1p1.pdf
PPTX
Drinkfromme.pptx
PPTX
DisMath-lecture-2-Logic-and-Proofs-08032022-115009am.pptx
PPT
Discrete Structures_Logic and Proofs_Saleh.ppt
PPTX
Discrete Structure 2 for Bachelor of Science in Computer Science
PPTX
CSE-203 Lec_1.pptx
PDF
Propositional Logic Discrete Mathematics
PDF
dm-logic.pdf
PPTX
Discrete Mathematics Details tree pt.pptx
PDF
Propositional Calculus-Discrete Mathematics
PPTX
DISCRETE MATHEMATICS for IT students.pptx
Chapter1p1
Chapter1 part1 : PROPOSITIONAL LOGIC || DISCRETE MATHEMATICS
Chapter1p1.pptx
Chapter 01 - p1.pdf
Discrete_Mathematics_Chapter1_Part1.pptx
Best presentation about discrete structure
Best Presentation about Discrete Computer
Propositional logic 2 all about logics and gates
Discrete Maths141 - Course Outline and Lecture Slides
Chapter1p1.pdf
Drinkfromme.pptx
DisMath-lecture-2-Logic-and-Proofs-08032022-115009am.pptx
Discrete Structures_Logic and Proofs_Saleh.ppt
Discrete Structure 2 for Bachelor of Science in Computer Science
CSE-203 Lec_1.pptx
Propositional Logic Discrete Mathematics
dm-logic.pdf
Discrete Mathematics Details tree pt.pptx
Propositional Calculus-Discrete Mathematics
DISCRETE MATHEMATICS for IT students.pptx
Ad

More from MemMem25 (20)

PPT
intro to programming languge c++ for computer department
PPTX
‏‏Computer Network lab using packet tracer
PPT
chapter-4-objected-oriented analysis and design with UML.ppt
PPTX
Chapter 3Introduction to Email Communication.pptx
PPT
chapter 3Introduction to Database System.ppt
PPT
chapter 1_Overview of operating systems.ppt
PPT
‏‏‏‏chapter 2 Introduction to Information System - نسخة.ppt
PPT
chapter 4Connectivity and the Internet.ppt
PPTX
chapter2DATA ENTRY AND KEYBOARDING SKILLS.pptx
PPTX
‏‏chpater1Typing Arabic and English Ergonomics .pptx
PPT
‏‏chapter4 Technical Skills Hardware Skills - نسخة.ppt
PPT
chapter3 Technical Skills Software Skills.ppt
PPT
chapter2 Technical Support.ppt
PPT
‏‏chapter1 overview of OFFICE MANAGEMENT - نسخة.ppt
PPT
‏‏chapter 4 Office Management Software.ppt
PPT
chapter3 Major Processes of Office Management.ppt
PPT
chapter 2 FUNCTIONS OF MODERN OFFICE.ppt
PPTX
acd120_Organizational Behavior (2) (1) (1).pptx
PPTX
Chapter 3 .pptx
PPT
NE223_chapter 1_Overview of operating systems.ppt
intro to programming languge c++ for computer department
‏‏Computer Network lab using packet tracer
chapter-4-objected-oriented analysis and design with UML.ppt
Chapter 3Introduction to Email Communication.pptx
chapter 3Introduction to Database System.ppt
chapter 1_Overview of operating systems.ppt
‏‏‏‏chapter 2 Introduction to Information System - نسخة.ppt
chapter 4Connectivity and the Internet.ppt
chapter2DATA ENTRY AND KEYBOARDING SKILLS.pptx
‏‏chpater1Typing Arabic and English Ergonomics .pptx
‏‏chapter4 Technical Skills Hardware Skills - نسخة.ppt
chapter3 Technical Skills Software Skills.ppt
chapter2 Technical Support.ppt
‏‏chapter1 overview of OFFICE MANAGEMENT - نسخة.ppt
‏‏chapter 4 Office Management Software.ppt
chapter3 Major Processes of Office Management.ppt
chapter 2 FUNCTIONS OF MODERN OFFICE.ppt
acd120_Organizational Behavior (2) (1) (1).pptx
Chapter 3 .pptx
NE223_chapter 1_Overview of operating systems.ppt
Ad

Recently uploaded (20)

PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PDF
Computing-Curriculum for Schools in Ghana
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
What if we spent less time fighting change, and more time building what’s rig...
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
History, Philosophy and sociology of education (1).pptx
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Cell Structure & Organelles in detailed.
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Classroom Observation Tools for Teachers
Module 4: Burden of Disease Tutorial Slides S2 2025
Final Presentation General Medicine 03-08-2024.pptx
STATICS OF THE RIGID BODIES Hibbelers.pdf
LDMMIA Reiki Yoga Finals Review Spring Summer
Computing-Curriculum for Schools in Ghana
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Paper A Mock Exam 9_ Attempt review.pdf.
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
What if we spent less time fighting change, and more time building what’s rig...
Microbial disease of the cardiovascular and lymphatic systems
History, Philosophy and sociology of education (1).pptx
Complications of Minimal Access Surgery at WLH
Cell Structure & Organelles in detailed.
Practical Manual AGRO-233 Principles and Practices of Natural Farming
Chinmaya Tiranga quiz Grand Finale.pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
202450812 BayCHI UCSC-SV 20250812 v17.pptx
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Classroom Observation Tools for Teachers

desmath(1).ppt

  • 1. Course Objectives: • 1-Develop basic mathematical reasoning skills for understanding and constructing • mathematical arguments. • 2. Learn how to analyze and solve counting problems. • 3. Learn how to specify, verify, and analyze simple algorithms
  • 2. Topics Covered: 1. Formal logic 2. Proofs 4. Sets and combinatorics 5. Algorithms and their complexity 6. Induction 7. Counting 8. Discrete probability 9. Relations 10. Graphs and trees 11. Boolean algebra 12. Finite-state machines 13. Turing machines
  • 3. Textbooks: • 1 Rosen, “Discrete Mathematics and Its Applications”, 6th ed., McGraw-Hill,. •
  • 5. 1.1 Propositional Logic A proposition :is a declarative sentence (that is, a sentence that declares a fact) that is either true or false, but not both. EXAMPLE 1: l All the following declarative sentences are propositions. 1. Washington., is the capital of the USA. 2 . Omdurman is the capital of Sudan . 3 . 1 + 1 = 2 . 4 . 2 + 2 = 3 . Propositions 1 and 3 are true, whereas 2 and 4 are false EXAMPLE 2: Consider the following sentences. 1 . What time is it? 2 . Read this carefully. 3 . x + 1 = 2 . 4 . x + y = Z
  • 6. 1.1 Propositional Logic Sentences 1 and 2 are not propositions because they are not declarative sentences. Sentences 3 and 4 are not propositions because they are neither true nor false. Note that each of sentences 3 and 4 can be turned into a proposition if we assign values to the variables. We use letters to denote propositional variables (or statement variables), that is, variables that represent propositions, just as letters are used to denote numerical variables.
  • 7. cont The conventional letters used for propositional variables are p, q , r, s, . . . . The truth value of a proposition is true, denoted by T, if it is a true proposition and false, denoted by F, if it is a false proposition. The area of logic that deals with propositions is called the propositional calculus or propositional logic. It was first developed systematically by the Greek philosopher Aristotle more than 300 years ago
  • 8. 1.1 Propositional Logic Compound: propositions, are formed from existing propositions using logical operators. DEFINITION 1 :Let p be a proposition. The negation of p, denoted by p, is the statement "It is not the case that p." The proposition p is read "not p." The truth value of the negation of p, p, is the opposite of the truth value of p.
  • 9. • EXAMPLE 3: Find the negation of the proposition • "Today is Friday." • Solution: The negation is • "It is not the case that today is Friday." • This negation can be more simply expressed by • "Today is not Friday," • Or, "It is not Friday today."
  • 10. 1.1 Propositional Logic DEFINITION 2:Let p and q be propositions. The conjunction of p and q, denoted by p  q, is the proposition "p and q ." The conjunction p  q is true when both p and q are true and is false otherwise. EXAMPLE 4: Find the conjunction of the propositions p and q where p is the proposition "Today is Friday" and q is the proposition "It is raining today."
  • 11. • Solution: The conjunction of these propositions, p  q, is the proposition "Today is Friday and • it is raining today." This proposition is true on rainy Fridays and is false on any day that is not a Friday and on Fridays when it does not .rain
  • 12. 1.1 Propositional Logic DEFINITION 3:Let p and q be propositions. The disjunction of p and q, denoted by p V q, is the proposition "p or q ." The disjunction p V q is false when both p and q are false and is true otherwise.
  • 13. • The use of the connective or in a disjunction corresponds to one of the two ways the word • or is used in English, namely, in an inclusive way. A disjunction is true when at least one of the two propositions is true. For instance, the inclusive or is being used in the statement • "Students who have taken calculus or computer science can take this class.
  • 14. 1.1 Propositional Logic EXAMPLE 5: What is the disjunction of the propositions p and q where p and q are the same propositions as in Example 4? Solution: The disjunction of p and q, p v q, is the proposition "Today is Friday or it is raining today." This proposition is true on any day that is either a Friday or a rainy day (including rainy Fridays). It is only false on days that are not Fridays when it also does not rain.
  • 15. 1.1 Propositional Logic DEFINITION 4: Let p and q be propositions. The exclusive or of p and q, denoted by p q (p XOR q), is the proposition that is true when exactly one of p and q is true and is false otherwise. p q p ⊕ q T T F T F T F T T F F F
  • 16. 1.1 Propositional Logic Conditional Statements: Let p and q be propositions. The conditional statement p → q is the proposition "if p, then q ." The conditional statement p → q is false when p is true and q is false, and true otherwise. In the conditional statement p → q , p is called the hypothesis (premise) and q is called the conclusion (or consequence). The statement p→ q is called a conditional statement because p → q asserts that q is true on the condition that p holds. A conditional statement is also called an implication. The truth table for the conditional statement p → q is shown in Table 5. Note that the statement p → q is true when both p and q are true and when p is false (no matter what truth value q has).
  • 17. 1.1 Propositional Logic The statement p→ q is called a conditional statement because p → q asserts that q is true on the condition that p holds. A conditional statement is also called an implication. The truth table for the conditional statement p → q is shown in Table 5. Note that the statement p → q is true when both p and q are true and when p is false (no matter what truth value q has). ways to express this conditional statement: "if p, then q" "if p, q " "p is sufficient for q" "q if p" "q when p" "a necessary condition for p is q" "q unless → p" "p implies q" "p only if q" "a sufficient condition for q is p" "q whenever p" "q is necessary for p" "q follows from p"
  • 18. 1.1 Propositional Logic CONVERSE, CONTRAPOSITIVE, AND INVERSE We can form some new conditional statements starting with a conditional statement p → q . In particular, there are three related conditional. The proposition q → p is called the converse of p → q The contra positive of p → q is the proposition ¬ q → ¬ p. The proposition ¬ p → ¬ q is called the inverse of p → q.
  • 19. 1.1 Propositional Logic EXAMPLE 9: What are the contrapositive, the converse, and the inverse of the conditional statement "The home team wins whenever it is raining."? Solution: Because "q whenever p" is one of the ways to express the conditional statement p → q , the original statement can be rewritten as "If it is raining, then the home team wins." Consequently, the contrapositive of this conditional statement is "If the home team does not win, then it is not raining."
  • 20. The converse is "If the home team wins, then it is raining." The inverse is "If it is not raining, then the home team does not win." Only the contrapositive is equivalent to the original statement. BICONDITIONALS: another way to combine propositions that expresses that two propositions have the same truth value. 1.1 Propositional Logic
  • 21. DEFINITION 6 :Let p and q be propositions. The biconditional statement p q is the proposition "p if and only if q ." The biconditional statement p q is true when p and q have the same truth values, and is false otherwise. Biconditional statements are also called bi-implications. 1.1 Propositional Logic
  • 22. 1.1 Propositional Logic EXAMPLE 10: Let p be the statement "You can take the flight" and let q be the statement "You buy a ticket." Then p q is the statement "You can take the flight if and only if you buy a ticket." This statement is true if p and q are either both true or both false, that is, if you buy a ticket and can take the flight or if you do not buy a ticket and you cannot take the flight. It is false when p and q have opposite truth values.
  • 23. EXAMPLE 11: Construct the truth table of the compound proposition (p v ¬ q) → (p  q). 1.1 Propositional Logic
  • 24. EXAMPLE 12 :How can this English sentence be translated into a logical expression? "You can access the Internet from campus only if you are a computer science major or you are not a freshman.” a= access the internet, C = computer science student and, F =freshman 1.1 Propositional Logic
  • 26. 1.2 Propositional Equivalences DEFINITION 1:A compound proposition that is always true, no matter what the truth values of the propositions that occur in it, is called a tautology. A compound proposition that is always false is called a contradiction. A compound proposition that is neither a tautology nor a contradiction is called a contingency. Tautologies and contradictions are often important in mathematical reasoning.
  • 27. 1.2 Propositional Equivalences EXAMPLE 1: We can construct examples of tautologies and contradictions using just one propositional variable. Logical Equivalences: Compound propositions that have the same truth values in all possible cases are called logically equivalent. We can also define this notion as follows. DEFINITION 2: The compound propositions p and q are called logically equivalent if p q is a tautology. The notation p == q denotes that p and q are logically equivalent.
  • 28. 1.2 Propositional Equivalences EXAMPLE 4 :Show that are logically equivalent. This is the distributive law of disjunction over conjunction.
  • 29. TABLE 6 Logical Equivalences.
  • 33. Bit Operations Boolean values can be represented as 1 (true) and 0 (false) A bit string is a series of Boolean values. Length of the string is the number of bits. 10110100 is eight Boolean values in one string  We can then do operations on these Boolean strings. Each column is its own Boolean operation 01011010 10110100 11101110
  • 34. Bit Operations EXAMPLE : Find the bitwise OR, bitwise AND, and bitwise XOR of the bit strings 0 1 1 0 1 1 0 1 1 0 and 1 1 000 1 1 1 0 1 . (Note that: bit strings will be split into blocks of four bits to make them easier to read.) Solution: The bitwise OR, bitwise AND, and bitwise XOR of these strings are obtained by taking the OR, AND, and XOR of the corresponding bits, respectively. 0 1 1 0 1 1 0 1 1 0 1 1 0 0 0 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 bitwise OR 0 1 0 0 0 1 0 1 0 0 bitwise AND 1 0 1 0 1 0 1 0 1 1 bitwise XOR
  • 36. Proof using Logical Equivalence (p  r)  (q  r)  ( p  r)  ( q  r) Definition of implication   p  r   q  r Associative   p   q  r  r Commutative ( p   q)  (r  r) Associative   (p  q)  r De Morgan, Idempotent  (p  q)  r Definition of implication
  • 37. Example Prove that (p  q)  (p  q) is a Tautology. (Proof) (p  q)  (p  q)       (p  q)  (p  q) Implication  ( p   q)  (p  q) De Morgan ( p  p)  ( q  q) Commutative, Associative T  T Negation  T Identity
  • 38. Tautology, Contradiction, Equivalence  Tautology: a statement that’s always true p   p will always be true  Contradiction: a statement that’s always false p   p will always be false A logical equivalence means that the two sides always have the same truth values Symbol is ≡ or  (we’ll use ≡)
  • 39. Homework 1 Question 7 from Rosen, p. 17 p = “It is below freezing” q = “It is snowing” • It is below freezing and it is snowing • It is below freezing but not snowing • It is not below freezing and it is not snowing • It is either snowing or below freezing (or both) • If it is below freezing, it is also snowing • It is either below freezing or it is snowing, but it is not snowing if it is below freezing • That it is below freezing is necessary and sufficient for it to be snowing
  • 41. 1.3 Predicates and Quantifiers  How can we express? “every computer in CS department is protected by intrusion detection system” “There exists at least one student who has a red hair”.  “x is greater than 3” x: subject “is greater than 3”: predicate P(x): propositional function P at x
  • 42. Propositional Functions Consider P(x) = x < 5 P(x) has no truth values (x is not given a value) P(1) is true: The proposition 1<5 is true P(10) is false: The proposition 10<5 is false P(x) will create a proposition when given a value Let P(x) = “x is a multiple of 5” For what values of x is P(x) true? Let P(x) = x + 3 For what values of x is P(x) true?
  • 43. Propositional Functions Functions with multiple variables: • P(x, y) = x + y == 0 P(1,2) is false, P(1,-1) is true • P(x, y, z) = x + y == z P(3,4,5) is false, P(1,2,3) is true • P(x1,x2,x3 … xn) = …
  • 46. Quantifiers  Why quantifiers? Many things (in this course and beyond) are specified using quantifiers A quantifier is “an operator that limits the variables of a proposition” Two types: 1- Universal 2- Existential
  • 47. Universal quantifiers DEFINITION 1: The universal quantification of P (x) is the statement "P(x) for all values of x in the domain." The notation x P (x) denotes the universal quantification of P(x). Here is called the universal quantifier. We read x P(x) as "for all x P(x)" or "for every x P(x )." An element for which P(x) is false is called a counterexample of x P (x).
  • 48. Universal quantifiers Represented by an upside-down A:  • It means “for all” • Let P(x) = x+1 > x We can state the following: • x P(x) • English translation: “for all values of x, P(x) is true” • English translation: “for all values of x, x+1>x is true” But is that always true? x P(x) Let x = the character ‘a’ Is ‘a’+1 > ‘a’?
  • 49. Universal quantifiers You need to specify your universe! • What values x can represent • Called the “domain” or “universe of discourse” by the textbook. Let the universe be the real numbers. Let P(x) = x/2 < x • Not true for the negative numbers! • Thus, x P(x) is false When the domain is all the real numbers In order to prove that a universal quantification is true, it must be shown for ALL cases In order to prove that a universal quantification is false, it must be shown to be false for only ONE case
  • 50. Existential quantification  Represented by an backwards E:  • It means “there exists” • Let P(x) = x+1 > x  We can state the following: • x P(x) • English translation: “there exists (a value of) x such that P(x) is true” • English translation: “for at least one value of x, x+1>x is true”
  • 51. Existential quantification DEFINITION 2 :The existential quantification of P(x) • Note that you still have to specify your universe • Let P(x) = x+1 < x There is no numerical value x for which x+1<x Thus, x P(x) is false
  • 52. Existential quantification • Let P(x) = x+1 > x There is a numerical value for which x+1>x In fact, it’s true for all of the values of x! Thus,  x P(x) is true • In order to show an existential quantification is true, you only have to find ONE value. • In order to show an existential quantification is false, you have to show it’s false for ALL values
  • 55. A note on quantifiers • Recall that P(x) is a propositional function Let P(x) be “x == 0” • Recall that a proposition is a statement that is either true or false  P(x) is not a proposition • There are two ways to make a propositional function into a proposition:  Supply it with a value For example, P(5) is false, P(0) is true  Provide a quantification For example, x P(x) is false and x P(x) is true Let the universe of discourse be the real numbers
  • 56. Binding variables  Let P(x, y) be x > y • Consider: x P(x, y) This is not a proposition! • What is y? If it’s 5, then x P(x, y) is false If it’s x-1, then x P(x, y) is true • Note that y is not “bound” by a quantifier
  • 57. Binding variables  (x P(x))  Q(x) The x in Q(x) is not bound; thus not a proposition  (x P(x))  (x Q(x)) Both x values are bound; thus it is a proposition  (x P(x)  Q(x))  (y R(y)) All variables are bound; thus it is a proposition  (x P(x)  Q(y))  (y R(y)) The y in Q(y) is not bound; this not a proposition
  • 58. Negating quantifications  Consider the statement: • All students in this class have red hair  What is required to show the statement is false? • There exists a student in this class that does NOT have red hair  To negate a universal quantification: • You negate the propositional function • AND you change to an existential quantification • ¬x P(x) = x ¬P(x)
  • 59. Negating quantifications Consider the statement: • There is a student in this class with red hair  What is required to show the statement is false? • All students in this class do not have red hair  Thus, to negate an existential quantification: • To negate the propositional function • AND you change to a universal quantification • ¬x P(x) = x ¬P(x)
  • 62. Multiple quantifiers  You can have multiple quantifiers on a statement  x y P(x, y) “For all x, there exists a y such that P(x, y)” Example: x y (x + y == 0)  x y P(x, y) There exists an x such that for all y P(x, y) is true” x y (x*y == 0)
  • 63. Order of quantifiers  x y and x y are not equivalent!  x y P(x, y) P(x, y) = (x + y == 0) is false  x y P(x, y) P(x, y) = (x + y == 0) is true
  • 64. Negating multiple quantifiers  Recall negation rules for single quantifiers: • ¬x P(x) = x ¬P(x) • ¬x P(x) = x ¬P(x) • Essentially, you change the quantifier(s), and negate what it’s quantifying  Examples: • ¬(x y P(x, y)) = x ¬y P(x, y) = x y ¬P(x, y) • ¬(x y z P(x, y, z)) = x ¬y z P(x, y, z) = x y ¬ z P(x, y, z) = x y z ¬P(x, y, z)
  • 65. Negating multiple quantifiers  Consider ¬(x y P(x, y)) = x y ¬P(x, y) • The left side is saying “for all x, there exists a y such that P is true” • To disprove it (negate it), you need to show that “there exists an x such that for all y, P is false”  Consider ¬(x y P(x, y)) = x y ¬P(x, y) • The left side is saying “there exists an x such that for all y, P is true” • To disprove it (negate it), you need to show that “for all x, there exists a y such that P is false”
  • 67. Translating between English and quantifiers  The product of two negative integers is positive x y ((x<0)  (y<0) → (x y > 0)) • Why conditional instead of and?  The average of two positive integers is positive x y ((x>0)  (y>0) → ((x + y)/2 > 0))  The difference of two negative integers is not necessarily negative x y ((x<0)  (y<0)  (|x-y|≥0)) • Why and instead of conditional?  The absolute value of the sum of two integers does not exceed the sum of the absolute values of these integers x y (|x + y| ≤ |x| + |y|)
  • 68. Translating between English and quantifiers  x y (x + y = y) There exists an additive identity for all real numbers  x y (((x≥0)  (y<0)) → (x - y > 0)) A non-negative number minus a negative number is greater than zero  x y (((x≤0)  (y≤0))  (x-y > 0)) The difference between two non-positive numbers is not necessarily non-positive (i.e. can be positive)  x y (((x≠0)  (y≠0)) ↔ (x y ≠ 0)) The product of two non-zero numbers is non-zero if and only if both factors are non-zero
  • 69. Chapter 1.5 Rules of Inference
  • 71. Valid Arguments  Assume you are given the following two statements: • "If you have a current password, then you can log onto the network." • "You have a current password." • Therefore, • "You can log onto the network." p  q p  q
  • 72. Definitions  An Argument in propositional logic is a sequence of propositions.  All but the final proposition are called premises.  The final proposition is called conclusion.  An argument is valid if the truth of all premises implies that the conclusion is true. i.e. (p1  p2  …  pn)  q is a tautology.
  • 73. Modus Ponens  Consider (p  (p → q)) → q p p  q  q
  • 74. Modus Ponens example  Assume you are given the following two statements: “you are in this class” “if you are in this class, you will get a grade”  Let p = “you are in this class”  Let q = “you will get a grade”  By Modus Ponens, you can conclude that you will get a grade
  • 75. Modus Tollens  Assume that we know: ¬q and p → q • Recall that p → q  ¬q → ¬p  Thus, we know ¬q and ¬q → ¬p  We can conclude ¬p  q p  q   p
  • 76. Modus Tollens example  Assume you are given the following two statements: “you will not get a grade” “if you are in this class, you will get a grade”  Let p = “you are in this class”  Let q = “you will get a grade”  By Modus Tollens, you can conclude that you are not in this class
  • 77. Addition & Simplification  Addition: If you know that p is true, then p  q will ALWAYS be true p  p  q  Simplification: If p  q is true, then p will ALWAYS be true p  q  q
  • 78. Example Proof  We have the hypotheses: • “It is not sunny this afternoon and it is colder than yesterday” • “We will go swimming only if it is sunny” • “If we do not go swimming, then we will take a canoe trip” • “If we take a canoe trip, then we will be home by sunset”  Does this imply that “we will be home by sunset”?  (( p  q)  (r  p)  ( r  s)  (s  t))  t ??? • When  p = “It is sunny this afternoon”  q = “it is colder than yesterday”  r = “We will go swimming”  s = “we will take a canoe trip”  t = “we will be home by sunset
  • 79. Example of proof 1. ¬p  q 1st hypothesis 2. ¬p Simplification using step 1 3. r → p 2nd hypothesis 4. ¬r Modus tollens using steps 2 & 3 5. ¬r → s 3rd hypothesis 6. s Modus ponens using steps 4 & 5 7. s → t 4th hypothesis 8. t Modus ponens using steps 6 & 7
  • 80. More Rules of Inference  Conjunction: if p and q are true separately, then pq is true  Disjunctive syllogism: If pq is true, and p is false, then q must be true  Resolution: If pq is true, and ¬pr is true, then qr must be true  Hypothetical syllogism: If p→q is true, and q→r is true, then p→r must be true
  • 81. 1.5 Rules of Inference Summary .
  • 82. 1.5 Rules of Inference Definition: EXAMPLE 1 :Suppose that the conditional statement "If it snows today, then we will go skiing" and its hypothesis, "It is snowing today," are true. Then, by modus ponens, it follows that the conclusion of the conditional statement, "We will go skiing," is true..
  • 83. 1.5 Rules of Inference EXAMPLE 5
  • 85. Terminology  Theorem: a statement that can be shown true. Sometimes called facts. • Proposition: less important theorem  Proof: Demonstration that a theorem is true.  Axiom: A statement that is assumed to be true.  Lemma: a less important theorem that is useful to prove a theorem.  Corollary: a theorem that can be proven directly from a theorem that has been proved.  Conjecture: a statement that is being proposed to be a true statement.
  • 86. Terminology Rules of inference, together with definitions of terms, are used to draw conclusions from other assertions, tying together the steps of a proof.  In practice, the final step of a proof is usually just the conclusion of the theorem. However, for clarity, we will often recap the statement of the theorem as the final step of a proof. DEFINITION 1:The integer n is even if there exists an integer k such that n = 2k, and n is odd if there exists an integer k such that n = 2k + 1 . (Note that an integer is either even or odd, and no integer is both even and odd.)
  • 87. Proof methods  We will discuss ten proof methods: 1. Direct proofs 2. Indirect proofs 3. Vacuous proofs 4. Trivial proofs 5. Proof by contradiction 6. Proof by cases 7. Proofs of equivalence 8. Existence proofs 9. Uniqueness proofs 10.Counterexamples
  • 88. Direct proofs  Consider an implication: p → q • If p is false, then the implication is always true • Thus, show that if p is true, then q is true  To perform a direct proof, assume that p is true, and show that q must therefore be true  Show that the square of an even number is an even number • Rephrased: if n is even, then n2 is even  (Proof) Assume n is even Thus, n = 2k, for some k (definition of even numbers) n2 = (2k)2 = 4k2 = 2(2k2) As n2 is 2 times an integer, n2 is thus even
  • 89. Indirect proofs  Consider an implication: p → q • It’s contrapositive is ¬q →¬p  Is logically equivalent to the original implication! • If the antecedent (¬q) is false, then the contrapositive is always true • Thus, show that if ¬q is true, then ¬p is true  To perform an indirect proof, do a direct proof on the contrapositive
  • 90. Indirect proof example  If n2 is an odd integer then n is an odd integer  Prove the contrapositive: If n is an even integer, then n2 is an even integer  Proof: n=2k for some integer k (definition of even numbers)  n2 = (2k)2 = 4k2 = 2(2k2)  Since n2 is 2 times an integer, it is even  When do you use a direct proof versus an indirect proof?
  • 91. Example of which to use  Prove that if n is an integer and n3+5 is odd, then n is even  Via direct proof • n3+5 = 2k+1 for some integer k (definition of odd numbers) • n3 = 2k-4 • Umm… ???  So direct proof didn’t work out. So: indirect proof • Contrapositive: If n is odd, then n3+5 is even • Assume n is odd, and show that n3+5 is even • n=2k+1 for some integer k (definition of odd numbers) • n3+5 = (2k+1)3+5 = 8k3+12k2+6k+6 = 2(4k3+6k2+3k+3) • As 2(4k3+6k2+3k+3) is 2 times an integer, it is even 3 4 2   k n
  • 92. Proof by contradiction  Given a statement p, assume it is false • Assume ¬p  Prove that ¬p cannot occur • A contradiction exists  Given a statement of the form p → q • To assume it’s false, you only have to consider the case where p is true and q is false
  • 93. Proof by contradiction example  Prove that if n is an integer and n3+5 is odd, then n is even  Rephrased: If n3+5 is odd, then n is even  Assume p is true and q is false • Assume that n3+5 is odd, and n is odd  n=2k+1 for some integer k (definition of odd numbers)  n3+5 = (2k+1)3+5 = 8k3+12k2+6k+6 = 2(4k3+6k2+3k+3)  As 2(4k3+6k2+3k+3) is 2 times an integer, it must be even  Contradiction!
  • 94. Proof by contradiction example  Theorem (by Euclid): There are infinitely many prime numbers.  Proof. Assume there are a finite number of primes  List them as follows: p1, p2 …, pn.  Consider the number q = p1p2 … pn + 1 • This number is not divisible by any of the listed primes  If we divided pi into q, there would result a remainder of 1 • We must conclude that q is a prime number, not among the primes listed above  This contradicts our assumption that all primes are in the list p1, p2 …, pn.
  • 95. Vacuous proofs  Consider an implication: p → q  If it can be shown that p is false, then the implication is always true • By definition of an implication  Note that you are showing that the antecedent is false
  • 96. Vacuous proof example  Consider the statement: • All criminology majors in CS 2012 are female • Rephrased: If you are a criminology major and you are in CS 2012, then you are female  Could also use quantifiers!  Since there are no criminology majors in this class, the antecedent is false, and the implication is true
  • 97. Trivial proofs  Consider an implication: p → q  If it can be shown that q is true, then the implication is always true • By definition of an implication  Note that you are showing that the conclusion is true Trivial proof example  Consider the statement: • If you are tall and are in CS 2012 then you are a student  Since all people in CS 2012 are students, the implication is true regardless
  • 98. Proof by cases Show a statement is true by showing all possible cases are true  Thus, you are showing a statement of the form: (p1  p2  …  pn)  q  is true by showing that: [(p1p2…pn)q]  [(p1q)(p2q)…(pn q)]
  • 99. Proof by cases example  Prove that Note that b ≠ 0  Cases: • Case 1: a ≥ 0 and b > 0 Then |a| = a, |b| = b, and • Case 2: a ≥ 0 and b < 0 Then |a| = a, |b| = -b, and • Case 3: a < 0 and b > 0 Then |a| = -a, |b| = b, and • Case 4: a < 0 and b < 0 Then |a| = -a, |b| = -b, and b a b a  b a b a b a   b a b a b a b a      b a b a b a b a      b a b a b a b a     
  • 100. Proofs of equivalences This is showing the definition of a bi-conditional  Given a statement of the form “p if and only if q” • Show it is true by showing (p → q)(q → p) is true
  • 101. Proofs of equivalence example  Show that m2=n2 if and only if m=n or m=-n  Rephrased: (m2=n2) ↔ [(m=n)(m=-n)] [(m=n)(m=-n)] → (m2=n2) • Proof by cases! • Case 1: (m=n) → (m2=n2) (m)2 = m2, and (n)2 = n2, so this case is proven • Case 2: (m=-n) → (m2=n2) (m)2 = m2, and (-n)2 = n2, so this case is proven  (m2=n2) → [(m=n)(m=-n)] • Subtract n2 from both sides to get m2-n2=0 • Factor to get (m + n)(m - n) = 0 • Since that equals zero, one of the factors must be zero • Thus, either m + n=0 (which means m = - n) • Or m - n=0 (which means m = n)
  • 102. Existence proofs  Given a statement: x P(x)  We only have to show that a P(c) exists for some value of c  Two types: • Constructive: Find a specific value of c for which P(c) is true. • Non constructive: Show that such a c exists, but don’t actually find it  Assume it does not exist, and show a contradiction
  • 103. Constructive existence proof example  Show that a square exists that is the sum of two other squares • Proof: 32 + 42 = 52  Show that a cube exists that is the sum of three other cubes • Proof: 33 + 43 + 53 = 63
  • 104. Non-constructive existence proof example  Prove that either 2*10500+15 or 2*10500+16 is not a perfect square • A perfect square is a square of an integer • Rephrased: Show that a non-perfect square exists in the set {2*10500+15, 2*10500+16}  Proof: The only two perfect squares that differ by 1 are 0 and 1 • Thus, any other numbers that differ by 1 cannot both be perfect squares • Thus, a non-perfect square must exist in any set that contains two numbers that differ by 1 • Note that we didn’t specify which one it was!
  • 105. Uniqueness proofs  A theorem may state that only one such value exists  To prove this, you need to show: • Existence: that such a value does indeed exist  Either via a constructive or non-constructive existence proof • Uniqueness: that there is only one such value
  • 106. Uniqueness proof example  If the real number equation 5x+3=a has a solution then it is unique  Existence • We can manipulate 5x+3=a to yield x=(a-3)/5 • Is this constructive or non-constructive?  Uniqueness • If there are two such numbers, then they would fulfill the following: a = 5x+3 = 5y+3 • We can manipulate this to yield that x = y  Thus, the one solution is unique!
  • 107. Counterexamples  Given a universally quantified statement, find a single example which it is not true  Note that this is DISPROVING a UNIVERSAL statement by a counterexample  x ¬R(x), where R(x) means “x has red hair” • Find one person (in the domain) who has red hair  Every positive integer is the square of another integer • The square root of 5 is 2.236, which is not an integer
  • 108. What’s wrong with this proof?  Theorem: All numbers are equal to 0. (Proof) Suppose a = b. Then a2 = a b. Then a2 - b2 = a b - b2. Then (a - b)(a + b) = b(a - b). Then a + b = b. Therefore, a = 0.