Beruflich Dokumente
Kultur Dokumente
LOGICAL
Definition 1. Negation of p
Let p be a proposition.
We can define operations on propositions! The statement “It is
Table 1.
not the case that p” is The Truth Table for the
also a proposition, Negation of a Proposition
1
Definition 4. Exclusive or of p
Definition 5. Implication p→q
and q
Let p and q be Let p and q be propositions. Table 5. The Truth Table for
Table 4. The Truth Table for
the Exclusive OR of two propositions. The The implication p→q is the the Implication of p→q.
propositions
exclusive or of p and q, proposition that is false when
denoted by p⊕q, is the p is true and q is false, and
p q p⊕q p q p→q
proposition that is true true otherwise. In this
when exactly one of p implication p is called the T T T
T T F
T F T and q is true and is hypothesis (or antecedent or T F F
F T T false otherwise. premise) and q is called the F T T
F F F conclusion (or consequence). F F T
Politician Example
2
Special Types of Compound
Practice with English Sentences
Propositions p: You learn the simple things well.
q: The difficult things become easy.
• Contradiction: Compound proposition
that is always false regardless of the • You do not learn the • The difficult things
simple things well. become easy but you
truth values of the propositions in it. did not learn the simple
• If you learn the simple
p ∧ ¬p is a contradiction things well.
things well then the
difficult things become • You learn the simple
• Tautology: compound proposition that things well but the
easy.
is always true regardless of the truth difficult things did not
• If you do not learn the
values of the propositions in it. simple things well, then
become easy.
p ∨ ¬p is a tautology the difficult things will
not become easy.
least?
3
Knights and Knaves Puzzles Let a be the statement that “A is a Knight” and b be the statement that
“B is a Knight.”
A says “B and I are both Knights.” If A is a Knight then a is true and the
statement (a∧b) is true. If A is a Knave, then a is false and the
On a remote island there live Knights and statement is false. These are the two cases that are “true” in that
they are possible solutions to the puzzle. We can code this with the
Knaves. Knights always tell the truth biconditional operator ↔. (Recall that p↔q is true when both
and Knaves always lie. propositions are true or both propositions are false.)
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.
Last Second First
W W W Bit operations correspond to the logical connectives:
W W B ∨ OR
∧ AND
W B W
⊕ XOR
W B B
B W W Information can be represented by bit strings, which are
B W B sequences of zeroes and ones, and manipulated by
operations on the bit strings.
B B W
4
Truth tables for the bit
Binary Math Review
operations OR, AND, and XOR
Decimal has digits 0-9
∨ 0 1
⊕ 0 1 0
___ 0
___ 1
___ 3
___
0 0 1 10 10 10 100
3 2 1
0 0 1
1 1 0 0+1 = 1
1 1 1
∧ 0 1 Binary has digits 0-1 1+0 = 1
1
___ 1
___ 0
___ 1
___ 1+1 = 10
0 0 0
2 3 2 2 2 1 20 10 + 1 = 11
1 0 1 11 + 1 = 100
5
Prove: p↔q⇔(p→q) ∧ (q→p) List of Logical Equivalences
Table 6 in Section 1.2
p∧T ⇔ p; p∨F ⇔ p Identity Laws
pq p↔q p→q q→p (p→q)∧(q→p)
p∨T ⇔ T; p∧F ⇔ F Domination Laws
TT T T T T
TF F F T F p∨p ⇔ p; p∧p ⇔ p Idempotent Laws
List of Equivalences
p∨(q∧r) ⇔ (p∨q)∧(p∨r) Distributive Laws
p∧(q∨r) ⇔ (p∧q)∨(p∧r)
¬(p∨q)⇔(¬p ∧ ¬q) De Morgan’s Laws
¬(p∧q)⇔(¬p ∨ ¬q)
p ∨ (p∧q) ⇔ p Absorption Laws
p ∧ (p∨q) ⇔ p
p ∨ ¬p ⇔ T Negation Laws
p ∧ ¬p ⇔ F Or Tautology; And Contradiction