Вы находитесь на странице: 1из 48

COMPUTER MATHEMATICS

LECTURE 2

BY TARAMBIWA E
CATHOLIC UNIVERSITY OF
ZIMBABWE

OBJECTIVES

TO INTRODUCE STUDENTS TO BASIC LAWS OF


LOGIC AND OTHER TYPES OF LOGIC

TO GIVE STUDENTS AN INSIGHT IN VERIFYING


MATHEMATICAL STATEMENTS USING PROOFS

SCOPE

Laws of Logic
Tautologies and Contradictions
Predicate Logic
Quantifiers
Proofs of mathematical statements

LAWS OF LOGIC

LAWS OF LOGIC

.
TAUTOLOGIES
A Tautology is a proposition form whose truth table is
true for all possible values of its propositional
variables. Example:
.

QUANTIFIERS
Definition: Words that tell how much quantity is
available
Existential

Universal

Some

All

Sometimes

Always

There is
There exists

none
never

QUANTIFIERS AND FIRST ORDER LOGIC


Predicate or Propositional Function
Let x be a variable and D be a set; P(x) is a
sentence
Then P(x) is called a predicate or propositional
function with respect to the set D if for each
value of x in D, P(x) is a statement; i.e., P(x) is
true or false
Moreover, D is called the domain (universe of
discourse) and x is called the free variable

QUANTIFIERS AND FIRST ORDER LOGIC


Universal Quantifier
Let P(x) be a predicate and let D be the domain of
the discourse. The universal quantification of P(x)
is the statement:
For all x, P(x)

or

For every x, P(x)


The symbol

x, P ( x)

is read as for all and every


or

x D, P ( x)

Two-place predicate:

x, y, P ( x, y )

QUANTIFIERS AND FIRST ORDER LOGIC


Existential Quantifier
Let P(x) be a predicate and let D be the universe of discourse.
The existential quantification of P(x) is the statement:
There exists x, P(x)
The symbol

is read as there exists

x D, P ( x)

orx, P ( x)

Bound Variable In both cases x is bound and the predicate


x, P( x) ;
becomes a proposition.x, P ( x )

QUANTIFIERS AND FIRST ORDER LOGIC


Negation of Predicates (DeMorgans Laws)

Example:

x, P( x) x, P( x)

If P(x) is the statement x has won a race where the domain of


x, P( x)
discourse is all runners, then the universal quantification
of P(x) is
, i.e., every runner has won a race. The negation of this
statement is it is not the case that every runner has won a race.
Therefore there exists at least one runner who has not won a race.
x, P( x)
Therefore:

x, P ( x) x, P ( x)

PREDICATE LOGIC
Predicates are dependent on the value of the
given variable to get a truth value.
They are written as:
P(x) Unary Predicate
P(x , y) Binary Predicate
P(x1, x2, x3, .. Xn) N-ary Predicate
X and Y can be any integers chosen from a
domain of values called Universe of
discourse

PREDICATE LOGIC
In Predicate logic the statements truth differs with the nature
of values.
As such we have Predicate constants and Predicate Variables.
Example
Sum(x,y,z) Predicate Constant
Sum(x1, x2, x3, .. Xn) Predicate variables
However if a predicate is assigned a value it fits the conditions
of a proposition.

PREDICATE LOGIC
Validity If P(x1, x2, x3, .. Xn) is true for all values (x1, x2,
x3, .. Xn) from the universal U. Then P(x1, x2, x3, .. Xn) is
valid in Universe (U)
Satisfiability
If P(x1, x2, x3, .. Xn) is not true for all
values (x1, x2, x3, .. Xn) from the universal U. Then P(x1,
x2, x3, .. Xn) is satisfiable in Universe (U). And if no
values exists is unsatisfiable in Universe (U)
Binding of predicates is achieved through quantifiers

INFERENCE RULES

Inference rules let us construct valid


arguments, which have the useful property that
if their premises are true, their conclusions are
also true.
When inference rule are applied on
quantified statements when can apply any
of the following:

INFERENCE RULES

FOR EXAMPLE
The commonly used and important inference
rule is known modus ponens, which is a
tautology based on the expression (p ^ (p q))
q;
1. If it doesnt taste good, you must spit.
[Premise]
2. It doesnt taste good. [Premise]
3. You must spit. [Apply Modus ponens to
1+2]
Modus tollens
1. If it doesnt taste good, you must spit.

OTHER EXAMPLES
DISJUNCTIVE SYLLOGISM
1.
"The ice cream is not vanilla flavoured[Premise]
2. "The ice cream is either vanilla flavoured or
chocolate flavoured[Premise]
3. "The ice cream is chocolate flavoured [Apply rule
to 1+2]
HYPOTHETICAL SYLLOGISM

1.
"If it rains, I shall not go to school[Premise]
2. "If I don't go to school, I won't need to do
homework [Premise]
3. "If it rains, I won't need to do homework
[Apply rule to 1+2]

PROOFS OF MATHEMATICAL STATEMENTS


A proof is a way to derive statements from other statements.
It starts with:
Axioms (statements that are assumed in the current context always
to be true), and
theorems or lemmas (statements that were proved already. The
difference between a theorem and a lemma is whether it is intended
as a final result or an intermediate tool, and
Premises ( normally denoted as P) which are assumptions we are
making for the purpose of seeing what consequences they have, and
finally
Inference rules to derive conclusions (denoted as Q).
The axioms, theorems, and premises are in a sense the
starting position of a game whose rules are given by the
inference rules. The goal of the game is to apply the inference
rules until Q pops out. We refer to anything that isnt proved
in the proof itself (i.e., an axiom, theorem, lemma, or
premise) as a hypothesis; the result Q is the conclusion.

PROOFS OF MATHEMATICAL
STATEMENTS
Proofs have many practical applications:
verification that computer programs are
correct
establishing that operating systems are
secure
enabling programs to make inferences in
artificial intelligence
showing that system specifications are
consistent

TERMS USED IN PROOFS


A theorem is a statement that can be
shown to be true using:

definitions
other theorems
axioms (statements which are given
as true)
rules of inference

TERMS USED IN PROOFS


A corollary is a result which follows directly
from a theorem.
Less important theorems are sometimes
called propositions.
A conjecture is a statement that is being
proposed to be true.
Once a proof of a conjecture is found, it becomes a
theorem.
However, it may turn out to be false.

PROVING THEOREMS
Many theorems have the form:
x (P(x) Q(x))
P(c) Q(x)
To prove them, we show that c is an
arbitrary element of the domain.
By universal generalization the truth of
the original formula follows.
So, we must prove something of the
form: p q.

PROVING CONDITIONAL
STATEMENTS: P Q
Trivial Proof:
If we know q is true, then p q
as well. Therefore
If it is raining then 1=1.
Vacuous Proof:
If we know p is false then p q
as well. Therefore

is true

is true

If I am both rich and poor then 2 + 2 = 5.

BASIC CONCEPTS FOR ODD AND EVEN


INTEGERS
Definition: 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 every integer is either even or odd and
no integer is both even and odd.

BASIC CONCEPTS FOR RATIONAL


NUMBERS

Definition:
The real number r is rational
if there exist integers p and
q where
q 0 such that r = p / q.

PROVING CONDITIONAL
STATEMENTS: P Q
Direct Proof

Assume that p is true.

Use rules of inference, axioms,


and logical equivalences to show
that q must also be true.

DIRECT PROOF ODD NUMBERS.


Example: Give a direct proof of the theorem If n is an odd
integer, then n2 is odd.
Solution:

Assume that n is odd.


Then n = 2k + 1 for an integer k.
Squaring both sides of the equation, we get:
n2 = (2k + 1)2
= 4k2 + 4k +1
= 2(2k2 + 2k) + 1= 2r + 1, where r = 2k2 + 2k is an
integer.

We have proved that if n is an odd integer, then n2 is an


odd integer.
( or QED marks the end of a proof.)

DIRECT PROOF RATIONAL


NUMBERS

Example:
Prove that the sum of two rational numbers
is rational.
Solution:
Assume r and s are two rational numbers. Then there
must be integers p, q and also t, u such that r = p / q,
s = t / u, u 0, q 0. Thereforer + s = p/q + t/u
= (pu + qt)/(qu)
Let v = (pu + qt) and w = (qu) where w can not equal 0.
Then r + s = v/w which is rational .

PROOFS CONTRAPOSITION
Assume q and show p is true

also.
This is sometimes called an
indirect proof method.
If we give a direct proof of q
p then we have a proof of
p q.

INDIRECT PROOF
Example:
Prove that if n is an integer and 3n + 2 is odd, then n is odd.
Solution:
Let p be an odd integer.
Assume n is even.
(n is p so we assume the
contrapositive of p q, which is q p).
So, n = 2k for some integer k.
Thus 3n + 2 = 3(2k) + 2
= 6k +2
= 2(3k + 1)
= 2j for j = 3k +1
Therefore 3n + 2 is even.
Since we have shown q p is logically equivalent to p
q, p q must hold as well.
If n is an integer and 3n + 2 is odd (not even),
then n is odd (not even).

IMPLICATION, CONVERSE AND CONTRAPOSITIVE


Given a statement Like:

If person is black then the person is of African origin.


With Implication the statement takes the form p
q, where
p denotes The person is black and q denotes The person
is of African origin.
Then the converse is q

p, which we can write as follows:

If the person is of African origin then the person is


black.
While the contrapositive is
follows:

, which we write as

If the person is not of African origin then the person is


not black.

PROOF BY CONTRAPOSITION
Example: Prove that for an integer n, if n2 is odd, then
n is odd.
Solution: Use proof by contraposition.
Assume n is even (not odd).
Therefore, there exists an integer k such that n = 2k.
Hence, n2 = 4k2 = 2 (2k2) and n2 is even (not
odd).
We have shown that if n is an even integer, then n2 is
even.
Therefore by contraposition, for an integer n, if n2 is
odd, then n is odd.

CONTRADICTION
Definition:
A contradiction or absurdity is a
propositional form which is always
false
P P = 0

PROOF BY CONTRADICTION
Proof by Contradiction:
To prove p, assume p and
derive a contradiction such as p
p.
(an indirect form of proof).
Since we have shown that p F
is true , it follows that the
contrapositive Tp also holds.

PROOF BY CONTRADICTION
Example:
Use a proof by contradiction to give a proof that 2 is
irrational.
Solution:
Suppose 2 is rational.
Then there exists integers a and b with 2 = a/b,
where b 0 and a and b have no common factors.
Then 2 = a2/b2 and so 2b2 = a2.
Therefore a2 must be even. If a2 is even then a must be
even. Since a is even,
a = 2c for some integer c. Thus, 2b2 = 4c2 and
b2 = 2c2.
Therefore b2 is even. Again then b must be even as well.

PROOF BY CONTRADICTION
But then 2 must divide both a and b.
This contradicts our assumption that a
and b have no common factors.
We have proved by contradiction that
our initial assumption must be false
and therefore 2 is irrational.

PROOF BY CASES
To prove a conditional statement of the form:

Use the tautology

Each of the implications

is a case.

PROOF BY CASES
Example:
Let a b = max{a, b} = a if a b, otherwise a b = max{a,
b} = b.
Show that for all real numbers a, b, c (a b) c = a (b
c). (This means the operation is associative.) Proof:
Let a, b, and c be arbitrary real numbers.
Then one of the
following 6 cases must hold.
1.
2.
3.
4.
5.
6.

abc
acb
b a c
b c a
cab
cba

PROOF BY CASES
Case 1: a b c
(a b) = a,
a c = a,
bc=b
Hence (a b) c = a = a (b c)
Therefore the equality holds for the first case.
A complete proof requires that the equality
be shown to hold for all 6 cases. But the
proofs of the remaining cases are similar.

PROOFS USING LOGICAL EQUIVALENCES


Two expressions (composed of the same variables) are
logically equivalent if they have the same truth values for
every combination of the truth values of the variables.

LAWS OF LOGIC

LAWS OF LOGIC

USING LOGICAL
EQUIVALENCES: EXAMPLE 1
Logical equivalences can be used to construct additional logical
equivalences
Example: Show that (p q) q is a tautology

0.
1.
2.
on 1
3.
4.
5.

(p q) q
(p q) q
(p q) q

Implication Law on 0
De Morgans Law (1st)

p (q q)
p 1
1

Associative Law on 2
Negation Law on 3
Domination Law on 4

USING LOGICAL
Show that (p q) (p q)
EQUIVALENCES:
EXAMPLE
Start with the second proposition (p q)
0.

(p q)
1. (p q) (q p)
Equivalence Law on 0
2.
(p q) (q p)
Implication Law on 1
3.
(((p q) (q p)))
Double negation on 2
4. ((p q) (q p)
De Morgans Law
5. ((p q) (q p))
De Morgans Law
6.
((p q) (p p) (q q) (q p)) Distribution
Law
7. ((p q) (q p))
Identity Law
8. ((q p ) (p q))
Implication Law
9. (p q)
Equivalence Law

NEXT LECTURE LECTURE 3

Sets
Functions
Relations

Вам также может понравиться