Professional Documents
Culture Documents
and Applications
COT3100
Dr. Ungor
Foundations of
Logic: Overview
Basic definitions.
Equivalence rules & derivations.
Predicates.
Quantified predicate expressions.
Equivalences & derivations.
Propositional Logic
Propositional Logic is the logic of compound statements built
from simpler statements using Boolean connectives.
Applications:
Propositional Logic
Propositional Logic is the logic of compound statements built
from simpler statements using Boolean connectives.
Definition of a
Proposition
Definition of a
Proposition
A proposition (p, q, r, ) is simply a statement (i.e.,
a declarative sentence) with a definite meaning,
having a truth value thats either true (T) or false
(F) (never both, neither, or somewhere in
between).
Definition of a
Proposition
A proposition (p, q, r, ) is simply a statement (i.e.,
a declarative sentence) with a definite meaning,
having a truth value thats either true (T) or false
(F) (never both, neither, or somewhere in
between).
Examples of
Propositions
Examples of
Propositions
Examples of
Propositions
Examples of
Propositions
Examples of
Propositions
Examples of
Propositions
Examples of
Propositions
Examples of
Propositions
Examples of
Propositions
Examples of
Propositions
1 +- 2
(expression
COT3100
Dr. Ungor
with a non-true/false
value)
6
Boolean operators
Negation (NOT)
Conjunction (AND)
Disjunction (OR)
Exclusive-Or (XOR)
Implication (IF)
Bi-conditional (IFF)
Operators /
Connectives
An operator or connective combines one or more
operand expressions into a larger expression. (e.g.,
+ in numeric exprs.)
The Negation
Operator
The unary negation operator (NOT) transforms
a prop. into its logical negation.
The Conjunction
Operator
The binary conjunction operator (AND)
combines two propositions to form their logical
conjunction.
E.g., If p=I will have salad for lunch. and q=I will
have steak for dinner., then pq=I will have
salad for lunch and I will have steak for dinner.
10
Conjunction Truth
Table
11
Conjunction Truth
Table
Note that a
conjunction
p1 p2 pn
of n propositions
will have 2n rows
in its truth table.
11
The Disjunction
Operator
The binary disjunction operator (OR) combines
two propositions to form their logical disjunction.
p=That car has a bad engine.
q=That car has a bad carburetor.
pq=Either that car has a bad engine, or
that car has a bad carburetor.
12
Disjunction Truth
Table
13
Disjunction Truth
Table
So this operation is
also called inclusive or,
because it includes the
possibility that both p and q are true.
13
A Simple Exercise
Let p=It rained last night,
q=The sprinklers came on last night,
r=The lawn was wet this morning.
Translate each of the following into English:
p
r p
rpq=
COT3100 - Dr. Ungor
Tuesday, January 7, 2014
14
A Simple Exercise
Let p=It rained last night,
q=The sprinklers came on last night,
r=The lawn was wet this morning.
Translate each of the following into English:
p
r p
rpq=
COT3100 - Dr. Ungor
Tuesday, January 7, 2014
14
A Simple Exercise
Let p=It rained last night,
q=The sprinklers came on last night,
r=The lawn was wet this morning.
Translate each of the following into English:
p
r p
rpq=
COT3100 - Dr. Ungor
Tuesday, January 7, 2014
14
A Simple Exercise
Let p=It rained last night,
q=The sprinklers came on last night,
r=The lawn was wet this morning.
Translate each of the following into English:
p
r p
=
=
rpq=
COT3100 - Dr. Ungor
Tuesday, January 7, 2014
14
A Simple Exercise
Let p=It rained last night,
q=The sprinklers came on last night,
r=The lawn was wet this morning.
Translate each of the following into English:
p
r p
rpq=
COT3100 - Dr. Ungor
Tuesday, January 7, 2014
14
A Simple Exercise
Let p=It rained last night,
q=The sprinklers came on last night,
r=The lawn was wet this morning.
Translate each of the following into English:
p
r p
rpq=
COT3100 - Dr. Ungor
Tuesday, January 7, 2014
The Exclusive Or
Operator
The binary exclusive-or operator (XOR)
combines two propositions to form their logical
exclusive or (exjunction?).
p = I will earn an A in this course,
q = I will drop this course,
p q = I will either earn an A for this course, or I
will drop it (but not both!)
COT3100 - Dr. Ungor
Tuesday, January 7, 2014
15
Exclusive-Or Truth
Table
This operation is
called exclusive or,
because it excludes the
possibility that both p and q are true.
16
Natural Language is
Ambiguous
Note that in English or is by itself ambiguous
regarding the both case!
Pat is a singer or
Pat is a writer. Pat is rich or
Pat is poor. Need context to disambiguate the meaning!
For this class, assume or means inclusive.
COT3100 - Dr. Ungor
Tuesday, January 7, 2014
17
Natural Language is
Ambiguous
Note that in English or is by itself ambiguous
regarding the both case!
Pat is a singer or
Pat is a writer. -
Pat is rich or
Pat is poor. Need context to disambiguate the meaning!
For this class, assume or means inclusive.
COT3100 - Dr. Ungor
Tuesday, January 7, 2014
17
Natural Language is
Ambiguous
Note that in English or is by itself ambiguous
regarding the both case!
Pat is a singer or
Pat is a writer. -
Pat is rich or
Pat is poor. -
17
The Implication
Operator
The implication p q states that p implies q.
It is FALSE only in the case that p is TRUE but q
is FALSE.
e.g., p=I am elected.
q=Taxes will be lowered.
p q = If I am elected, then taxes will be
lowered (else it could go either way)
COT3100 - Dr. Ungor
Tuesday, January 7, 2014
18
The Implication
Operator
Terminology for the structure of implication p q
p: Hypothesis (antecedent or premise)
q: Conclusion (consequence)
19
Implication Truth
Table
20
Implication Truth
Table
p q is false only when
p is true but q is not true.
20
Implication Truth
Table
p q is false only when
p is true but q is not true.
p q does not imply
that p causes q!
20
Implication Truth
Table
p q is false only when
p is true but q is not true.
p q does not imply
that p causes q!
p q does not imply
that p or q are ever true!
20
Implication Truth
Table
p q is false only when
p is true but q is not true.
p q does not imply
that p causes q!
p q does not imply
that p or q are ever true!
E.g. (1=0) pigs can fly is TRUE!
COT3100 - Dr. Ungor
Tuesday, January 7, 2014
20
Examples of
Implications
21
Examples of
Implications
21
Examples of
Implications
21
Examples of
Implications
21
Examples of
Implications
21
Inverse, Converse,
Contrapositive
Some terminology:
22
Inverse, Converse,
Contrapositive
Some terminology:
22
Inverse, Converse,
Contrapositive
Some terminology:
Contrapositive
22
23
The biconditional
operator
24
The biconditional
operator
The biconditional p q states that p is true if and only if
(IFF) q is true.
24
The biconditional
operator
The biconditional p q states that p is true if and only if
(IFF) q is true.
24
The biconditional
operator
The biconditional p q states that p is true if and only if
(IFF) q is true.
p = It is raining.
24
The biconditional
operator
The biconditional p q states that p is true if and only if
(IFF) q is true.
p = It is raining.
q = The home team wins.
24
The biconditional
operator
The biconditional p q states that p is true if and only if
(IFF) q is true.
p = It is raining.
q = The home team wins.
p q = If and only if it is raining, the home team
wins.
COT3100 - Dr. Ungor
Tuesday, January 7, 2014
24
Biconditional Truth
Table
25
Biconditional Truth
Table
p q means that p and q
have the same truth value.
25
Biconditional Truth
Table
p q means that p and q
have the same truth value.
25
Biconditional Truth
Table
p q means that p and q
have the same truth value.
25
Biconditional Truth
Table
p q means that p and q
have the same truth value.
25
Boolean Operations
Summary
26
Precedence of
Logical Operators
Operator
Precedence
1
2
3
4
5
27
Nested Propositional
Expressions
(f g) s
fgs
would be ambiguous
28
Some Alternative
Notations
29
30
Bit Strings
31
Bitwise Operations
E.g.:
01 1011 0110
11 0001 1101
11 1011 1111 Bit-wise OR
01 0001 0100 Bit-wise AND
10 1010 1011 Bit-wise XOR
32
Propositional
Equivalences
Propositional
Equivalence
Two syntactically (i.e., textually) different compound
propositions may be semantically identical (i.e.,
have the same meaning). We call them
equivalent.
NEXT:
34
Tautologies and
Contradictions
35
Tautologies and
Contradictions
A tautology is a compound proposition that is true
no matter what the truth values of its atomic
propositions are!
35
Tautologies and
Contradictions
A tautology is a compound proposition that is true
no matter what the truth values of its atomic
propositions are!
Ex. p p [What is its truth table?]
35
Tautologies and
Contradictions
A tautology is a compound proposition that is true
no matter what the truth values of its atomic
propositions are!
Ex. p p [What is its truth table?]
A contradiction is a comp. prop. that is false no
matter what! Ex. p p [Truth table?]
35
Tautologies and
Contradictions
A tautology is a compound proposition that is true
no matter what the truth values of its atomic
propositions are!
Ex. p p [What is its truth table?]
A contradiction is a comp. prop. that is false no
matter what! Ex. p p [Truth table?]
Other comp. props. are contingencies.
COT3100 - Dr. Ungor
Tuesday, January 7, 2014
35
Proving
Equivalences
36
Proving
Equivalences
Compound propositions P and Q are logically
equivalent to each other IFF P and Q contain
the same truth values as each other in all rows
of their truth tables.
36
Proving
Equivalences
Compound propositions P and Q are logically
equivalent to each other IFF P and Q contain
the same truth values as each other in all rows
of their truth tables.
Compound proposition P is logically equivalent to
compound proposition Q, written PQ, IFF the
compound proposition PQ is a tautology.
36
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
37
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
37
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
at pq (p q).
37
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
T
at pq (p q).
T
37
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
T
at pq (p q).
T
T
37
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
T
at pq (p q).
T
T
37
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
T
T
at pq (p q).
T
T
37
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
T
T
at pq (p q).
T
F
T
37
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
T
T
at pq (p q).
T
F
T
F
37
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
T
T
at pq (p q).
T
F
T
F
37
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
T
T F
at pq (p q).
T
F
T
F
37
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
T
T F
at pq (p q).
T
F T
T
F
37
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
T
T F
at pq (p q).
T
F T
T
F F
37
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
T
T F
at pq (p q).
T
F T
T
F F
37
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
T
T F
at pq (p q).
T
F T
T
F F
37
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
T
T F
at pq (p q).
T
F T
T
F F
F
F
37
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
T
T F
at pq (p q).
T
F T
T
F F
F
F
F
37
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
T
T F
at pq (p q).
T
F T
T
F F
F
F
F
37
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
T
T F
at pq (p q).
T
F T
T
F F
F
F
F
37
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
T
T F
at pq (p q).
T
F T
T
F F
F
F
F
37
T
T
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
T
T F
at pq (p q).
T
F T
T
F F
F
F
F
37
T
T
T
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
T
T F
at pq (p q).
T
F T
T
F F
F
F
F
37
T
T
T
Proving Equivalence
via Truth Tables
Q
P
Ex. Prove that
pq (p q).
T
T F
at pq (p q).
T
F T
T
F F
F
F
F
37
T
T
T
Equivalence Laws
38
pT p
pF p
Domination:
pT T
pF F
Idempotent:
pp p
pp p
Double negation:
p p
Commutative: pq qp
Associative:
pq qp
(pq)r p(qr)
(pq)r p(qr)
39
More Equivalence
Laws
Distributive:
p(qr) (pq)(pr)
p(qr) (pq)(pr)
De Morgans:
" (pq) p q
" (pq) p q
40
More Equivalence
Laws
Absorption:
" p(pq) p
p (p q) p
Trivial tautology/contradiction:
p p T
p p F
41
Implication:
pq p q
42
An Example
Problem
43
An Example
Problem
43
An Example
Problem
(p q) (p r)
43
An Example
Problem
(p q) (p r)
[Expand definition of ] (p q) (p r)
43
An Example
Problem
(p q) (p r)
[Expand definition of ] (p q) (p r)
[Defn. of ]
(p q) ((p r) (p r))
43
An Example
Problem
(p q) (p r)
[Expand definition of ] (p q) (p r)
[Defn. of ]
(p q) ((p r) (p r))
[DeMorgans Law]
43
An Example
Problem
(p q) (p r)
[Expand definition of ] (p q) (p r)
(p q) ((p r) (p r))
[Defn. of ]
[DeMorgans Law]
(p q) ((p r) (p r))
COT3100 - Dr. Ungor
Tuesday, January 7, 2014
43
An Example
Problem
(p q) (p r)
[Expand definition of ] (p q) (p r)
(p q) ((p r) (p r))
[Defn. of ]
[DeMorgans Law]
(p q) ((p r) (p r))
COT3100 - Dr. Ungor
Tuesday, January 7, 2014
43
Example
Continued...
44
Example
Continued...
(p q) ((p r) (p r)) [ commutes]
44
Example
Continued...
(p q) ((p r) (p r)) [ commutes]
(q p) ((p r) (p r)) [ associative]
44
Example
Continued...
(p q) ((p r) (p r)) [ commutes]
(q p) ((p r) (p r)) [ associative]
q (p ((p r) (p r))) [distrib. over ]
44
Example
Continued...
(p q) ((p r) (p r)) [ commutes]
(q p) ((p r) (p r)) [ associative]
q (p ((p r) (p r))) [distrib. over ]
q (((p (p r)) (p (p r)))
44
Example
Continued...
(p q) ((p r) (p r)) [ commutes]
(q p) ((p r) (p r)) [ associative]
q (p ((p r) (p r))) [distrib. over ]
q (((p (p r)) (p (p r)))
[assoc.] q (((p p) r) (p (p r)))
44
Example
Continued...
(p q) ((p r) (p r)) [ commutes]
(q p) ((p r) (p r)) [ associative]
q (p ((p r) (p r))) [distrib. over ]
q (((p (p r)) (p (p r)))
[assoc.] q (((p p) r) (p (p r)))
[trivial taut.] q ((T r) (p (p r)))
44
Example
Continued...
(p q) ((p r) (p r)) [ commutes]
(q p) ((p r) (p r)) [ associative]
q (p ((p r) (p r))) [distrib. over ]
q (((p (p r)) (p (p r)))
[assoc.] q (((p p) r) (p (p r)))
[trivial taut.] q ((T r) (p (p r)))
[domination] q (T (p (p r)))
COT3100 - Dr. Ungor
Tuesday, January 7, 2014
44
Example
Continued...
(p q) ((p r) (p r)) [ commutes]
(q p) ((p r) (p r)) [ associative]
q (p ((p r) (p r))) [distrib. over ]
q (((p (p r)) (p (p r)))
[assoc.] q (((p p) r) (p (p r)))
[trivial taut.] q ((T r) (p (p r)))
[domination] q (T (p (p r)))
[identity]
q (p (p r)) cont.
44
End of Long
Example
45
End of Long
Example
q (p (p r))
45
End of Long
Example
q (p (p r))
[DeMorgans] q (p (p r))
45
End of Long
Example
q (p (p r))
[DeMorgans] q (p (p r))
[Assoc.]
q ((p p) r)
45
End of Long
Example
q (p (p r))
[DeMorgans] q (p (p r))
[Assoc.]
q ((p p) r)
[Idempotent] q (p r)
45
End of Long
Example
q (p (p r))
[DeMorgans] q (p (p r))
[Assoc.]
q ((p p) r)
[Idempotent] q (p r)
[Assoc.]
(q p) r
45
End of Long
Example
q (p (p r))
[DeMorgans] q (p (p r))
[Assoc.]
q ((p p) r)
[Idempotent] q (p r)
[Assoc.]
(q p) r
[Commut.]
p q r
45
End of Long
Example
q (p (p r))
[DeMorgans] q (p (p r))
[Assoc.]
q ((p p) r)
[Idempotent] q (p r)
[Assoc.]
(q p) r
[Commut.]
p q r
45