0% found this document useful (0 votes)
5K views71 pages

Discrete Mathematics: Logic and Proofs

This document provides an overview of propositional logic and proofs. It defines key logical concepts like propositions, connectives, truth tables, quantifiers and proofs. Propositions can be simple or compound, connected using operators like AND, OR and NOT. Truth tables systematically define the truth values of statements. Quantifiers like "for all" and "there exists" allow generalizing over domains. Proofs require showing statements are true for all cases or providing a counterexample if false for some case. De Morgan's laws and logic equivalencies are also summarized.

Uploaded by

anzoroman
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5K views71 pages

Discrete Mathematics: Logic and Proofs

This document provides an overview of propositional logic and proofs. It defines key logical concepts like propositions, connectives, truth tables, quantifiers and proofs. Propositions can be simple or compound, connected using operators like AND, OR and NOT. Truth tables systematically define the truth values of statements. Quantifiers like "for all" and "there exists" allow generalizing over domains. Proofs require showing statements are true for all cases or providing a counterexample if false for some case. De Morgan's laws and logic equivalencies are also summarized.

Uploaded by

anzoroman
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 71

Discrete Mathematics

5
th
edition, 2001
Chapter 1
Logic and proofs
These Notes
Originally provided by the author
You will find my traces here and there
You can download them from the site
referenced in the textbook, and the
modify your hardcopies as necessary
during class
I will upload finished chapters online
Logic
Logic = the study of correct reasoning
Use of logic
In mathematics:
to prove theorems
In computer science:
to prove that programs do what they are
supposed to do
Logic
Logic focuses on the relationship among
statements a.o.t. the content of any particular
statement. For example:
My watch is digital
All digital devices run on batteries
Therefore, my watch runs on batteries
Note that logic is not concerned with the truth
of the first two statements. But if they were
true, then the inference is true
Section 1.1 Propositions


A proposition is a statement or sentence
that can be determined to be either true or
false.

Its usually declared as a declarative
sentence (a.o.t. a question, command, etc.)


Section 1.1 Propositions

Examples. Which are the propositions?
The only positive integers that divide 23 are 1
and itself
For every positive integer n, there is a prime
number > n
Buy tickets to spend vacation in Malaysia
Earth is the only planet in the universe that has
life
I wish I were a black belt holder


Section 1.1 Propositions

The only positive integers that divide 23 are 1
and itself. Yes
For every positive integer n, there is a prime
number > n. Yes
Buy tickets to spend vacation in Malaysia. No
Earth is the only planet in the universe that has
life. Yes
I wish I were a black belt holder. No


Connectives
If p and q are propositions, new compound
propositions can be formed by using
connectives
Most common connectives:
Conjunction AND. Symbol ^
Inclusive disjunction OR Symbol v
Exclusive disjunction OR Symbol v
Negation NOT Symbol ~
Implication Symbol
Double implication Symbol
Truth table of conjunction



The truth values of compound propositions
can be described by truth tables.
Truth table of conjunction






p ^ q is true only when both p and q are true.
p q p ^ q
T T T
T F F
F T F
F F F
Example
Let p = Tigers are wild animals
Let q = Chicago is the capital of Illinois
p ^ q = "Tigers are wild animals and
Chicago is the capital of Illinois"
p ^ q is false. Why?
Note that p and q need not be related in
any way!

Truth table of disjunction
The truth table of (inclusive) disjunction is




p v q is false only when both p and q are false
Example: p = "John is a programmer", q = "Mary is a lawyer"
p v q = "John is a programmer or Mary is a lawyer"
p q p v q
T T T
T F T
F T T
F F F
Exclusive disjunction
Either p or q (but not both), in symbols p v
q






p v q is true only when p is true and q is false,
or p is false and q is true.
Example: p = "John is programmer, q = "Mary is a lawyer"
p v q = "Either John is a programmer or Mary is a lawyer"
p q p v q
T T F
T F T
F T T
F F F
Negation
Negation of p: in symbols ~p





~p is false when p is true, ~p is true when p is
false
Example: p = "John is a programmer"
~p = "It is not true that John is a programmer"

p ~p
T F
F T
More compound statements

Let p, q, r be simple statements
We can form other compound statements,
such as
(pvq)^r
pv(q^r)
(~p)v(~q)
(pvq)^(~r)
and many others
Example

Let p = There is a hurricane
Let q = It is raining
Let r = The sun is shining
Now, represent the proposition:
Either there is a hurricane and it is not true that
the sun is shining, or it is raining
Example

Let p = There is a hurricane
Let q = It is raining
Let r = The sun is shining
Now, represent the proposition:
Either there is a hurricane and it is not true that
the sun is shining, or it is raining
(p^~r)vq
The truth table of (p^~r)vq
p q r (p^~r)vq
T T T T
T T F T
T F T F
T F F T
F T T T
F T F T
F F T F
F F F F
1.2 Conditional propositions
and logical equivalence

A conditional proposition is of the form
If p then q
In symbols: p q
Example:
p = " John is a programmer"
q = " Mary is a lawyer "
p q = If John is a programmer then Mary is
a lawyer"

Truth table of p q






p q is true when both p and q are true
or when p is false
p q p q
T T T
T F F
F T T
F F T
Example on p q
p = I run fast
q = I win the race
p q p q
T T T
T F F
F T T
F F T
Hypothesis and conclusion

In a conditional proposition p q,
p is called the antecedent or hypothesis
q is called the consequent or conclusion
If "p then q" is considered logically the
same as "p only if q
Make sure you comprehend discussion on
Page 9
Necessary and sufficient

A necessary condition is expressed by the
conclusion.
A sufficient condition is expressed by the
hypothesis.
Example:
If John is a programmer then Mary is a lawyer"
Necessary condition: Mary is a lawyer
Sufficient condition: John is a programmer

Logical equivalence
Two propositions are said to be logically
equivalent if their truth tables are identical.






Example: ~p v q is logically equivalent to p q
p q ~p v q p q
T T T T
T F F F
F T T T
F F T T
Converse
The converse of p q is q p






These two propositions
are not logically equivalent
p q p q q p
T T T T
T F F T
F T T F
F F T T
Contrapositive
The contrapositive of the proposition p q is
~q ~p.






They are logically equivalent.

p q p q ~q ~p
T T T T
T F F F
F T T T
F F T T
Double implication
The double implication p if and only if q is
defined in symbols as p q






p q is logically equivalent to (p q)^(q p)


p q p q (p q) ^ (q p)
T T T T
T F F F
F T F F
F F T T
Tautology
A proposition is a tautology if its truth table
contains only true values for every case
Example: p p v q
p q p p v q
T T T
T F T
F T T
F F T
Contradiction
A proposition is a tautology if its truth table
contains only false values for every case
Example: p ^ ~p

p p ^ (~p)
T F
F F
De Morgans laws for logic

The following pairs of propositions are
logically equivalent:

~ (p v q) and (~p)^(~q)
~ (p ^ q) and (~p) v (~q)

1.3 Quantifiers
A propositional function P(x) is a statement
involving a variable x over domain D
For example:
P(x): 2x is an even integer
x is an element of a set D
For example, x is an element of the set of integers
D is called the domain of P(x)
Domain of a propositional function
In the propositional function
P(x): 2x is an even integer,
the domain D of P(x) must be defined, for
instance D = {integers}.
D is the set where the x's come from.
For every and for some
Most statements in mathematics and
computer science use terms such as for
every and for some.
For example:
For every triangle T, the sum of the angles of T
is 180 degrees.
For every integer n, n is less than p, for some
prime number p.

Universal quantifier

One can write P(x) for every x in a domain D
In symbols: x P(x)
is called the universal quantifier
Truth of as propositional function

The statement x P(x) is
True if P(x) is true for every x e D
False if P(x) is not true for some x e D
Example: Let P(n) be the propositional
function n
2
+ 2n is an odd integer
n e D = {all integers}
P(n) is true only when n is an odd integer,
false if n is an even integer.

Existential quantifier

For some x e D, P(x) is true if there exists
an element x in the domain D for which P(x) is
true. In symbols: -x, P(x)

The symbol - is called the existential
quantifier.
Counterexample
The universal statement x P(x) is false if
-x e D such that P(x) is false.

The value x that makes P(x) false is called a
counterexample to the statement x P(x).
Example: P(x) = "every x is a prime number", for
every integer x.
But if x = 4 (an integer) this x is not a prime
number. Then 4 is a counterexample to P(x)
being true.
Generalized De Morgans
laws for Logic
If P(x) is a propositional function, then each
pair of propositions in a) and b) below have
the same truth values:
a) ~(x P(x)) and -x: ~P(x)
"It is not true that for every x, P(x) holds" is equivalent
to "There exists an x for which P(x) is not true"
b) ~(-x P(x)) and x: ~P(x)
"It is not true that there exists an x for which P(x) is
true" is equivalent to "For all x, P(x) is not true"
Summary of propositional logic
In order to prove the
universally quantified
statement x P(x) is
true
It is not enough to
show P(x) true for
some x e D
You must show P(x) is
true for every x e D

In order to prove the
universally quantified
statement x P(x) is
false
It is enough to exhibit
some x e D for which
P(x) is false
This x is called the
counterexample to
the statement x P(x)
is true
De Morgans laws
~ (p v q) (~p)^(~q)
~ (p ^ q) (~p) v (~q)
~(x P(x)) -x: ~P(x)
~(-x P(x)) x: ~P(x)
~ (=, ~=) (~=, =)
~ (<, <=, >, >=) (>=, >, <=, <)
1.4 Proofs
A mathematical system consists of
Undefined terms
Definitions
Axioms



Undefined terms
Undefined terms are the basic building blocks of
a mathematical system. These are words that
are accepted as starting concepts of a
mathematical system.
Example: in Euclidean geometry we have undefined
terms such as
Point
Line


Definitions
A definition is a proposition constructed from
undefined terms and previously accepted
concepts in order to create a new concept.
Example. In Euclidean geometry the following
are definitions:
Two triangles are congruent if their vertices can
be paired so that the corresponding sides are
equal and so are the corresponding angles.
Two angles are supplementary if the sum of their
measures is 180 degrees.
Axioms
An axiom is a proposition accepted as true
without proof within the mathematical system.
There are many examples of axioms in
mathematics:
Example: In Euclidean geometry the following are
axioms
Given two distinct points, there is exactly one line that
contains them.
Given a line and a point not on the line, there is exactly one
line through the point which is parallel to the line.
Theorems
A theorem is a proposition of the form p q
which must be shown to be true by a
sequence of logical steps that assume that p
is true, and use definitions, axioms and
previously proven theorems.

Lemmas

A lemma is a small theorem which is
used to prove a bigger theorem. That is,
if it wasnt for the bigger theorem we
need to prove, it become of no interest
by itself

Example: if n is a positive integer, then either
n-1 is positive, or n-1=0
Not of interest in its own right, but see Ex.
1.4.6


Corollaries

A corollary is a theorem that can be
proven to be a logical consequence of
another theorem

Example from Euclidean geometry: "If the
three sides of a triangle have equal length,
then its angles also have equal measure."


Types of proof
A proof is a logical argument that consists of a
series of steps using propositions in such a
way that the truth of the theorem is established.
Direct proof: p q
A direct method of attack that assumes the truth of
proposition p, axioms and proven theorems so that
the truth of proposition q is obtained.
Logic is a tool for the analysis of proofs
Example
. and then , and
}, , min{ if , , , ,
2 1
2 1 2 1
d x d x d x
d d d x d d d
s s s
= 9 e
Prove that
Example
. and then , and
}, , min{ if , , , ,
2 1
2 1 2 1
d x d x d x
d d d x d d d
s s s
= 9 e
From the definition, it follows that
d <= d1 and d <= d2
From x <= d and d <= d1, we derive that x <= d1
From x <= d and d <= d2, we derive that x <= d2

Therefore what? The conclusion

Indirect proof
The method of proof by contradiction of a
theorem p q consists of the following
steps:
1. Assume p is true and q is false
2. Show that ~p is also true.
3. Then we have that p ^ (~p) is true.
4. But this is impossible, since the statement p ^ (~p) is
always false. There is a contradiction!
5. So, q cannot be false and therefore it is true.
OR: show that the contrapositive (~q)(~p)
is true.
Since (~q) (~p) is logically equivalent to p q, then the
theorem is proven.
Example
" x, y R, if x + y >= 2, then either x>=1 or y>=1.
Proof:
Suppose conclusion is false, then x<1 and y<1
Therefore, x + y < 1 + 1 = 2
We have now derived a contradiction p ^ ~p, where

p: x + y >= 2

Thus we conclude that the statement is true

See Ex. 1.4.8
Valid arguments
Deductive reasoning: the process of reaching a
conclusion q from a sequence of propositions p
1
,
p
2
, , p
n
.
The propositions p
1
, p
2
, , p
n
are called
premises or hypothesis.
The proposition q that is logically obtained
through the process is called the conclusion.
A deductive argument consists of hypothesis
together with the conclusion
Valid arguments
Any argument that has the form:

If p1 and p2 and pn, then q

is said to be valid iff pi , i=1, 2, n is true. In this
case, q is also true

Otherwise, it is said to be invalid
Notations
An argument is a sequence of propositions
written: or:
p1
p2
.
.
.
pn
--------
\q
p1, p2, , pn / \q
Example
Determine if p q, p / \ q is valid
p q p q p q
T T T T T
T F F T F
F T T F T
F F T F F
Note that whenever p q and p are true, q is true
Therefore, argument is valid
Another way: suppose p q and p are true, then q
must be true, otherwise p q would be false.
Therefore, argument is valid
Example
Let p: I study hard, q: I get As, r: I get rich
Now, consider this argument:

if I study hard, then I get As
if I dont get rich, then I dont get As
------------------------------------------------
\ I get rich

First, formulate it
Next, determine whether its valid
Example
p: I study hard, q: I get As, r: I get rich

if I study hard, then I get As
if I dont get rich, then I dont get As
------------------------------------------------
\ I get rich

Formulating:

p q
~r ~q
------------
\ r
Example
p: I study hard, q: I get As, r: I get rich

p q
~r ~q
------------
\ r
If the argument is valid, then whenever p q and
~r ~q are true, r must be also true
Construct a truth table and see if such propositions
hold
Example
p q p q r ~r ~q
T T T T F
T F F T T
F T T F T
F F T F T
Note that when both hypotheses are true, the
consequence is false
The argument is therefore invalid
Another Example (from book)
Let p: 2 = 3, q: I ate my hat
Now, consider this argument:

if 2 = 3, then I ate my hat
I ate my hat
------------------------------------------------
\ 2 = 3

So we have: p q
q
---------
\ p
Another Example
Inspect the third row: hypotheses are true but conclusion is
false, thus argument is invalid

Another way by avoiding truth table. If argument is valid, then
whenever p q and q are both true, p must also be true.
Suppose both hypotheses are true. This is possible if p is false
and q is true. In this case, p, the conclusion, is not true. Thus,
argument is invalid
p q p q p
T T T T
T F F T
F T T F
F F T F
p q
q
---------
\ p
Rules of inference (1)
1. Law of detachment or
modus ponens
p q
p
Therefore, q

2. Modus tollens
p q
~q
Therefore, ~p
Rules of inference (2)
3. Rule of Addition
p
Therefore, p v q

4. Rule of simplification
p ^ q
Therefore, p, or
Therefore, q. Why?


5. Rule of conjunction
p
q
Therefore, p ^ q


Rules of inference (3)



6. Rule of hypothetical syllogism (I know it as transitivity)
p q
q r
Therefore, p r

7. Rule of disjunctive syllogism
p v q
~p
Therefore, q

Rules of inference for
quantified statements
1. Universal instantiation
xeD, P(x)
d e D
Therefore P(d)
2. Universal generalization
P(d) for any d e D
Therefore x, P(x)
3. Existential instantiation
- x e D, P(x)
Therefore P(d) for some
d eD
4. Existential generalization
P(d) for some d eD
Therefore - x, P(x)

1.6 Mathematical induction
Useful for proving statements of the form

n e A S(n)
where

N is the set of positive integers or natural numbers
A is an infinite subset of N
S(n) is a propositional function
Mathematical Induction:
strong form
Suppose we want to show that for each positive
integer n, the statement S(n) is either true or
false.
1. Verify that S(1) is true.
2. Let n be an arbitrary positive integer. Let i be a
positive integer such that i < n.
3. Show that S(i) true implies that S(i+1) is true, i.e.
show S(i) S(i+1).
4. Then conclude that S(n) is true for all positive
integers n.

Mathematical induction:
terminology
Basis step: Verify that S(1) is true.
Inductive step: Assume S(i) is true.
Prove S(i) S(i+1).
Conclusion: Therefore S(n) is true for all
positive integers n.
Example
Use induction to show that




Note that:
0! = 1! = 1
For n>=2, n! = n.(n-1).(n-2). .1
E.g., 5! = 5.4.3.2.1 = 120

1. Basic step: show that n=1 is true.
This is easily accomplished since



(1) ,... 2 , 1 for 2 !
1
= >

n n
n
1 2 1 ! 1
1 1
= > =

Example
Use induction to show that

2. Inductive step: show that if
then


Assume that . Then, for i=n, we
have


We can relate Eq. (2) and (3) by noting that


,... , n n!
n
2 1 for 2
1
= >

,...,n, i i!
i
1 for 2
1
= >

(2) 2 )! 1 (
n
n > +
n 1,..., i for 2 !
1
= >
i
i
(3) 2 !
1
>
n
n
(4) ! ) 1 ( )! 1 ( n n n + = +
Example
Use induction to show that

So we have







Therefore, Eq. (3), the inductive step, is true
Since the basis step and inductive step have been verified, it
follows from the principle pf MI that Eq.(1) is true for every positive
integer n

,... , n n!
n
2 1 for 2
1
= >

)n! (n )! (n 1 1 + = +
n
n
n
n
n
2
2 1 since 2 2
(4) from 2 ) 1 (
1
1
=
> + >
+ >

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy