0% found this document useful (0 votes)
4 views

LOGIC 1

The document provides an overview of propositional logic, defining key concepts such as propositions, negation, conjunction, disjunction, exclusive or, implication, and biconditional. It includes truth tables for these operations and discusses logical equivalences and laws, such as De Morgan's Laws. Additionally, it presents examples and practice problems to illustrate the application of these logical principles.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

LOGIC 1

The document provides an overview of propositional logic, defining key concepts such as propositions, negation, conjunction, disjunction, exclusive or, implication, and biconditional. It includes truth tables for these operations and discusses logical equivalences and laws, such as De Morgan's Laws. Additionally, it presents examples and practice problems to illustrate the application of these logical principles.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

Propositional Logic

Proposition
A proposition is a statement that is either
true or false, but not both.
• Atlanta was the site of the 1996
Summer Olympic games.
• 1+1 = 2
• 3+1 = 5
• What will my CS1050 grade be?
Definition 1. Negation of p
Let p be a proposition.
The statement “It is
Table 1.
not the case that p” is The Truth Table for the
also a proposition, Negation of a Proposition

called the “negation of


p ¬p
p” or ¬p (read “not p”)
p = The sky is blue. T F
¬p = It is not the case that F T
the sky is blue.
¬p = The sky is not blue.
Definition 2. Conjunction of p
and q
Let p and q be Table 2. The Truth Table for
propositions. The the Conjunction of two
propositions
proposition “p and q,”
denoted by p∧q is p q p∧q
true when both p and
q are true and is false T T T
otherwise. This is T F F
called the conjunction F T F
F F F
of p and q.
Definition 3. Disjunction of p
and q
Let p and q be
Table 3. The Truth Table for
the Disjunction of two propositions. The
propositions
proposition “p or q,”
denoted by p∨q, is the
p q p∨q
proposition that is false
T T T when p and q are both
T F T false and true otherwise.
F T T
F F F
Definition 4. Exclusive or of p
and q
Let p and q be
Table 4. The Truth Table for
the Exclusive OR of two propositions. The
propositions
exclusive or of p and q,
denoted by p⊕q, is the
p q p⊕q
proposition that is true
T T F when exactly one of p
T F T and q is true and is
F T T false otherwise.
F F F
Definition 5. Implication p→q
Let p and q be propositions.
Table 5. The Truth Table for
The implication p→q is the the Implication of p→q.
proposition that is false when
p is true and q is false, and
p q p→q
true otherwise. In this
implication p is called the T T T
hypothesis (or antecedent or T F F
premise) and q is called the F T T
conclusion (or consequence). F F T
Implications
• If p, then q • Not the same as the
• p implies q if-then construct
• if p,q used in
programming
• p only if q
languages such as
• p is sufficient for q If p then S
• q if p
• q whenever p
• q is necessary for p
Implications
How can both p and q be false, and p→q be true?
•Think of p as a “contract” and q as its “obligation” that is
only carried out if the contract is valid.
•Example: “If you make more than $25,000, then you must
file a tax return.” This says nothing about someone who
makes less than $25,000. So the implication is true no
matter what someone making less than $25,000 does.
•Another example:
p: Bill Gates is poor.
q: Pigs can fly.
p→q is always true because Bill Gates is not poor. Another
way of saying the implication is
“Pigs can fly whenever Bill Gates is poor” which is true
since neither p nor q is true.
Related Implications
Converse of Contrapositive
p→q of p → q
is is the proposition
q→p ¬q → ¬p
Definition 6. Biconditional
Let p and q be
Table 6. The Truth Table for propositions. The
the biconditional p↔q.
biconditional p↔q is the
proposition that is true
p q p↔q
when p and q have the
T T T same truth values and is
T F F false otherwise. “p if and
F T F only if q, p is necessary
F F T and sufficient for q”
Practice
p: You learn the simple things well.
q: The difficult things become easy.

• You do not learn the • The difficult things


simple things well. become easy but you
• If you learn the simple did not learn the simple
things well then the things well.
difficult things become • You learn the simple
easy. things well but the
• If you do not learn the difficult things did not
simple things well, then become easy.
the difficult things will
not become easy.
Practice
p: You learn the simple things well.
q: The difficult things become easy.
• You do not learn the • The difficult things
simple things well. ¬p become easy but you
• If you learn the simple did not learn the simple
things well then the things well. q ∧ ¬p
difficult things become • You learn the simple
easy. p→q things well but the
• If you do not learn the difficult things did not
simple things well, then become easy.
the difficult things will p ∧ ¬q
not become easy.
¬p → ¬q
Truth Table Puzzle
Steve would like to determine the relative
salaries of three coworkers using two facts
(all salaries are distinct):
• If Fred is not the highest paid of the three,
then Janice is.
• If Janice is not the lowest paid, then Maggie is
paid the most.
Who is paid the most and who is paid the least?
p : Janice is paid the most. •If Fred is not the highest paid of
q: Maggie is paid the most. the three, then Janice is.
•If Janice is not the lowest paid,
r: Fred is paid the most. then Maggie is paid the most.
s: Janice is paid the least.

p q r s ¬r→p ¬s →q (¬r→p)∧ (¬s→q)


T F F F T F F
F T F T F T F
F F T T T T T
F T F F F T F
F F T F T F F

Fred, Maggie, Janice


p : Janice is paid the most. •If Fred is not the highest paid of
q: Maggie is paid the most. the three, then Janice is.
•If Janice is the lowest paid,
r: Fred is paid the most. then Maggie is paid the most.
s: Janice is paid the least.

p q r s ¬r→p s →q (¬r→p)∧ (s→q)


T F F F T T T
F T F T F T F
F F T T T F F
F T F F F T F
F F T F T T T

Fred, Janice, Maggie or Janice, Maggie, Fred


or Janice, Fred, Maggie
Bit Operations
A computer bit has two possible values: 0 (false) and 1
(true). A variable is called a Boolean variable is its value is
either true or false.

Bit operations correspond to the logical connectives:


∨ OR
∧ AND
⊕ XOR

Information can be represented by bit strings, which are


sequences of zeros and ones, and manipulated by
operations on the bit strings.
Truth tables for the bit
operations OR, AND, and XOR
∨ 0 1
⊕ 0 1

0 0 1 0 0 1

1 1 1 1 1 0
∧ 0 1

0 0 0

1 0 1
Logical Equivalence
• An important technique in proofs is to
replace a statement with another
statement that is “logically equivalent.”
• Tautology: compound proposition that is
always true regardless of the truth values
of the propositions in it.
• Contradiction: Compound proposition
that is always false regardless of the truth
values of the propositions in it.
Logically Equivalent
• Compound propositions P and Q are
logically equivalent if P↔Q is a
tautology. In other words, P and Q
have the same truth values for all
combinations of truth values of simple
propositions.
• This is denoted: P⇔Q (or by P Q)
Example: DeMorgans
• Prove that ¬(p∨q) ⇔ (¬p ∧ ¬q)
p q (p∨q) ¬(p∨q) ¬p ¬q (¬p ∧ ¬q)
TT T F F F F
TF T F F T F
FT T F T F F
FF F T T T T
Illustration of De Morgan’s Law
¬
(p∨q)

p
q
Illustration of De Morgan’s Law
¬p

p
Illustration of De Morgan’s Law
¬q

q
Illustration of De Morgan’s Law
¬p ∧
¬q

p
q
Example: Distribution
Prove that: p ∨ (q ∧ r) ⇔ (p ∨ q) ∧ (p
∨ r)
p q r q∧r p∨(q∧r) p∨q p∨r (p∨q)∧
(p∨r)
T T T T T T T T
T T F F T T T T
T F T F T T T T
T F F F T T T T
F T T T T T T T
F T F F F T F F
F F T F F F T F
F F F F F F F F
Prove: p↔q⇔(p→q) ∧ (q→p)
pq p↔q p→q q→p (p→q)∧(q→p)
TT T T T T
TF F F T F
FT F T F F
FF T T T T

We call this biconditional equivalence.


List of Logical Equivalences
p∧T ⇔ p; p∨F ⇔ p Identity Laws

p∨T ⇔ T; p∧F ⇔ F Domination Laws

p∨p ⇔ p; p∧p ⇔ p Idempotent Laws

¬(¬p) ⇔ p Double Negation Law

p∨q ⇔ q∨p; p∧q ⇔ q∧p Commutative Laws

(p∨q)∨ r ⇔ p∨ (q∨r); (p∧q) ∧ r ⇔ p ∧ (q∧r)


Associative Laws
List of Equivalences
p∨(q∧r) ⇔ (p∨q)∧(p∨r) Distribution Laws
p∧(q∨r) ⇔ (p∧q)∨(p∧r)

¬(p∨q)⇔(¬p ∧ ¬q) De Morgan’s Laws


¬(p∧q)⇔(¬p ∨ ¬q)
Miscellaneous
p ∨ ¬p ⇔ T Or Tautology
p ∧ ¬p ⇔ F And Contradiction
(p→q) ⇔ (¬p ∨ q) Implication Equivalence

p↔q⇔(p→q) ∧ (q→p) Biconditional Equivalence

You might also like