0% found this document useful (0 votes)
9 views14 pages

Logic

The document provides an overview of logic in mathematics, focusing on propositions, their truth values, and logical operators such as negation, conjunction, disjunction, and implication. It explains the definitions and truth tables for various compound propositions and introduces concepts like logical equivalence, tautology, and contradiction. Additionally, it covers important logical laws, including De Morgan's laws and properties of conditionals.

Uploaded by

rk5428832
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views14 pages

Logic

The document provides an overview of logic in mathematics, focusing on propositions, their truth values, and logical operators such as negation, conjunction, disjunction, and implication. It explains the definitions and truth tables for various compound propositions and introduces concepts like logical equivalence, tautology, and contradiction. Additionally, it covers important logical laws, including De Morgan's laws and properties of conditionals.

Uploaded by

rk5428832
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Logic

(The language of Mathematics)

1 Propositions

Definition
A proposition, or statement, is a declarative sentence that is either true or false.

Notes:

• We refer to T (true) or F (false) as the truth value of the proposition

• Note that we may not know if a proposition is true of false. We do know, however, that it is
either true, or false, but not both.

• When a sentence can be both true and false, we say that it is a paradox. A famous example
is the liar’s paradox. I refer the reader to the excellent article in the Stanford encyclopedia
of philosophy on this paradox( see https://plato.stanford.edu/entries/liar-paradox/)
and especially their first paragraph:
‘The first sentence in this essay is a lie. There is something odd about saying so, as has
been known since ancient times. To see why, remember that all lies are untrue. Is the first
sentence true? If it is, then it is a lie, and so it is not true. Conversely, suppose that it is
not true. We (viz., the authors) have said it, and normally things are said with the intention
of being believed. Saying something that way when it is untrue is a lie. But then, given what
the sentence says, it is true after all!”

Examples:
Sentence Is it a proposition? Truth value
1+2=4 Yes F
2×3=6 Yes T
It depends! It is a proposi-
tion that is true on Friday,
Today is Friday Yes
and false the other days of
the week
It will rain on July 4th 2022 Yes We will know in 6 months
x+1=2 No (we do not know what x is)
I am lying now No (liar’s paradox)

Notation:

p: “Today is Monday”

means that p is the proposition “Today is Monday”.

1
2 Compound propositions

Definition
A compound proposition is a proposition that involves the assembly of possibly multiple propo-
sitions, where the assembly is performed using logic operators.

Notes:

• There are two types of logic operators:

– Those that operate on a single proposition (unary)


– Those that operate on two propositions (binary)

• The truth value of a compound proposition depends on the truth values of the propositions
that define it. To analyze this dependence, we usually use a truth table that lists exhaustively
all options. A compound proposition that depends on N proposition will be represented with
a truth table with 2N possibilities.

2.1 Negation (NOT) (unary)

Definition
Let p be a proposition. The sentence “It is not the case that p” is another proposition, called
the negation of p, denoted ¬p, sometimes ∼ p.

The negation of p is also read “not p”.


Truth table:

p ¬p
T F
F T

Examples:
Truth Truth
Proposition p Negation ¬p
value value
2+2=4 T 2 + 2 6= 4 F
1=0 F 1 6= 0 T
There is at least one politician
All politicians are crooks
that is not a crook
All students in this class will There is at least one student in
get an A in ECS17 this class that will not get an A

2
2.2 Conjunction (AND) (binary)

Definition
The conjunction of two propositions p and q is the compound proposition that we write p ∧ q
and read “p and q”, which is only true if both p and q are true.

Truth table:

p q p∧q
T T T
T F F
F T F
F F F
Examples:

p: “John likes pizza”


q: “Bill likes milk”

Proposition Value
p∧q John likes pizza and Bill likes milk
¬p ∧ q John does not like pizza and Bill likes milk
p ∧ ¬q John likes pizza and Bill does not like milk
¬p ∧ ¬q John does not like pizza and Bill does not like milk

2.3 Disjunction (OR) (binary)

Definition
The disjunction of two propositions p and q is the compound proposition that we write p ∨ q
and read “p or q”, which is true if p is true, q is true, or both p and q are true.

Truth table:

p q p∨q
T T T
T F T
F T T
F F F
Examples:

3
p: “The butler did it”
q: “The cook did it”
p ∨ q: “Either the butler or the cook did it”

Notes:

p ∧ ¬p is always false, while p ∨ ¬q is always true.

p ¬p p ∧ ¬p p ¬p p ∨ ¬p
T F F T F T
F T F F T T

2.4 Exclusive or (XOR) (binary)

Definition
The exclusive or of two propositions p and q is the compound proposition that we write p ⊕ q,
which is true if and only if p is true, or q is true, but not when both p and q are true.

Truth table:

p q p⊕q
T T F
T F T
F T T
F F F

Examples:

p: “The butler did it”


q: “The cook did it”
p ⊕ q: “Either the butler or the cook did it, but they did not do it together!”

Notes:

p ⊕ p is always false, while p ⊕ ¬q is always true.

p p p⊕p p ¬p p ⊕ ¬p
T T F T F T
F F F F T T

4
2.5 (Material) implication (binary)

Definition
The compound proposition p → q that reads “p implies q” is true unless p is true and q is false.

Truth table:

p q p→q
T T T
T F F
F T T
F F T
Note: when p is false, p → q is true, no matter what the truth value of q is.
Example:
Consider the statement “If you earn an A in this class, then I will buy you a car”. This is a
compound proposition made of the two propositions

p: “You earn an A in this class”


q: “I’ll buy you a car”

that reads “p → q. This statement can be seen as a “contract” between you and me. If you do
satisfy your part of the contract, namely you earn an A, and I buy you a car, then the contract
is satisfied; we call it true. However, if you do satisfy your part of the contract, but I do not buy
you a car, then the contract is broken; we call it false. Interestingly, if you do not satisfy your part
of the contract, then it does not matter what I do, the contract does not apply, or at least is not
broken; it is then true.

Definitions

i) The compound proposition ¬q → ¬p is called the contrapositive of the proposition p → q.

ii) The compound proposition q → p is called the converse of the proposition p → q.

2.6 Biconditional (binary)

Definition
The biconditional compound proposition p ↔ q is defined as the compound proposition (p →
q) ∧ (q → p), for any proposition p and q.

5
Truth table:

p q p↔q
T T T
T F F
F T F
F F T

Phrasing:

The biconditional between two propositions p and q can be written as:

• “p if and only if q”, often written as “p iff q”

• “p is necessary and sufficient for q”

• “p is equivalent to q”

6
3 Comparing Propositions
3.1 Logical equivalence - Tautology - Contradiction

Definitions

i) Two propositions p and q are logically equivalent if they always have the same truth values.
We write p ⇔ q.

ii) A compound proposition p is a tautology if and only if it is always true. We write p ⇔ T ,


where T is used to indicate a proposition that is always true.

iii) A compound proposition q is a contradiction if and only if it is always false.We write


p ⇔ F , where F is used to indicate a proposition that is always false.

Notes:
• Do note the difference between p ↔ q and p ⇔ q: in the former, ↔ refers to the logical
operator “biconditional”, while in the latter, ⇔ refers to the comparison of p and q, signaling
that they always have the same truth value.
• From the definition of the biconditional, we note that to show that two propositions p and q
are logically equivalent, it is enough to show that the proposition p ↔ q is a tautology. In
practice, however, we check directly the truth values of both propositions to see if they are
equal.
• One way to prove that two propositions are logically equivalent is to build the truth table
associated with those two propositions, and check the corresponding columns. Please note,
however, that there are other possibilities. We will see some of them later.

Examples of logical equivalences:


Let p and q be two propositions. Then,
a) ¬(¬p) ⇔ p.
b) p ∨ p ⇔ p.
c) p ∧ p ⇔ p.
d) p ⊕ q ⇔ (p ∨ q) ∧ (¬(p ∧ q)).
Let us show that d) is true using a truth table. I leave the three others (a), b), and c)) as exercises.
p q p∨q p∧q ¬(p ∧ q) (p ∨ q) ∧ ¬(p ∧ q) p⊕q
T T T T F F F
T F T F T T T
F T T F T T T
F F F F T F F

7
The two propositions (p ∨ q) ∧ ¬(p ∧ q) and p ⊕ q (columns 6 and 7 in the truth table) always have
the same truth values; they are therefore equivalent.

3.2 De Morgan’s laws in logic

Let p and q be two propositions. Then,

a) ¬(p ∧ q) ⇔ ¬p ∨ ¬q.

b) ¬(p ∨ q) ⇔ ¬p ∧ ¬q.

Let us prove both laws using truth tables:

a) Let p and q be two propositions.

p q p∧q ¬(p ∧ q) ¬p ¬q ¬p ∨ ¬q
T T T F F F F
T F F T F T T
F T F T T F T
F F F T T T T

The two propositions ¬(p ∧ q) and ¬p ∨ ¬q (columns 4 and 7 in the truth table) always have
the same truth values; they are therefore equivalent.

b) Let p and q be two propositions.

p q p∨q ¬(p ∨ q) ¬p ¬q ¬p ∧ ¬q
T T T F F F F
T F T F F T F
F T T F T F F
F F F T T T T

The two propositions ¬(p ∨ q) and ¬p ∧ ¬q (columns 4 and 7 in the truth table) always have
the same truth values; they are therefore equivalent.

Example of application:
Let p and q be two propositions. Show that,

(p ∨ q) ∨ (¬p ∧ ¬q). is a tautology.

a) Method 1: we use a truth table.

8
p q p∨q ¬p ¬q ¬p ∧ ¬q (p ∨ q) ∨ (¬p ∧ ¬q)
T T T F F F T
T F T F T F T
F T T T F F T
F F F T T T T

As (p ∨ q) ∨ (¬p ∧ ¬q), it is a tautology.

b) Method 2: using De Morgan’s law.

– Note first that p ∨ p is a tautology. Indeed,


p ¬p p ∨ ¬p
T F T
F T T
– Let A = (p ∨ q) ∨ (¬p ∧ ¬q). According to de Morgan’s law,

¬p ∧ ¬q ⇔ ¬(p ∨ q)

Therefore,
A ⇔ (p ∨ q) ∨ ¬(p ∨ q)
Defining B = p ∨ q, we get,

A ⇔ (p ∨ q) ∨ ¬(p ∨ q)
A ⇔ B ∨ ¬B
A ⇔ T

using the first property we established.

3.3 Important properties of conditionals

Let p and q be two propositions. Then,

a) p → q ⇔ (¬p) ∨ q.

b) p → q ⇔ ¬q → ¬p, namely a conditional proposition and its contrapositive are logically


equivalent.

Let us prove both properties using truth tables:

a) Let p and q be two propositions.

9
p q p→q ¬p q ¬p ∨ q
T T T F T T
T F F F F F
F T T T T T
F F T T F T

The two propositions p → q and ¬p ∨ q (columns 3 and 6 in the truth table) always have the
same truth values; they are therefore equivalent.

a) Let p and q be two propositions.

p q p→q ¬q ¬p ¬q → ¬p
T T T F F T
T F F T F F
F T T F T T
F F T T T T

The two propositions p → q and ¬q → ¬p (columns 3 and 6 in the truth table) always have
the same truth values; they are therefore equivalent.

10
3.4 List of important logical equivalences

Let p, q, and r be two propositions. T is a tautology and F is a contradiction.

Logical equivalence Name

¬(¬p) ⇔ p Double negation

p∨p⇔p Idempotent 1
p∧p⇔p Idempotent 2

p∨q ⇔q∨p Commutativity 1


p∧q ⇔q∧p Commutativity 2

p ∨ (q ∨ r) ⇔ (p ∨ q) ∨ r Associativity 1
p ∧ (q ∧ r) ⇔ (p ∧ q) ∧ r Associativity 2

p ∨ (q ∧ r) ⇔ (p ∨ q) ∧ (p ∨ r) Distributivity 1
p ∧ (q ∨ r) ⇔ (p ∧ q) ∨ (p ∧ r) Distributivity 2

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


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

p∨F ⇔p Absorption law 1


p∨T ⇔T Absorption law 2
p∧F ⇔F Absorption law 3
p∧T ⇔p Absorption law 4

¬T ⇔ F Complement law 1
¬F ⇔ T Complement law 2
p ∨ ¬p ⇔ T Complement law 3
p ∧ ¬p ⇔ F Complement law 4

p → q ⇔ (¬p) ∨ q Implication law 1


p → q ⇔ ¬q → ¬p Implication law 2

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

11
4 Predicates and quantifiers
4.1 Definitions
We have seen that the expression “x + 3 = 1” is not a proposition as we cannot assess of its truth
value. We can denote this expression as P (x), where x is the variable defined in a “universe” D and
P is the predicate. A predicate can become a proposition through quantification.

There are two main types of quantification:

• Universal quantification:
P (x) is true for all x in the universe D of discourse
Notation: ∀x ∈ D, P (x)
Example: ∀n ∈ N, n2 ≥ 0.

• Universal quantification:
There exists a value x in the universe D if discourse such at P (x) is true.
Notation: ∃x ∈ D, P (x)
Example: ∃n ∈ N, n is prime.

4.2 How do we validate a quantified predicate?


Statement When is is true? When is it false?
We need to show that P (x) is true for There exists (at least) one x ∈ D for
∀x ∈ D, P (x)
all x ∈ D which P (x) is false
There is (at least) one x ∈ D for which We need to show that P (x) is false for
∃x ∈ D, P (x)
P (x) is true all x ∈ D

4.3 Negating quantifiers


Statement Negation Equivalent statement
∀x ∈ D, P (x) ¬(∀x ∈ D, P (x)) ∃x ∈ D, ¬P (x)
∃x ∈ D, P (x) ¬(∃x ∈ D, P (x)) ∀x ∈ D, ¬P (x)

12
5 Some Applications
5.1 Boolean searches
Boolean operators form the basis of database logic. They connect your search words together to
either narrow or broaden your set of results. Given two search terms, the three basic boolean
operators are:
• AND: match records that contains both terms

• OR: match records that contains either term

• NOT.: match records that do not contain a term


Why use Boolean operators?
• To focus a search, particularly when your topic contains multiple search terms.

• To connect various pieces of information to find exactly what you’re looking for.

5.2 Logic puzzles: Smullyan’s island


These puzzles are set on a fictional island, Smullyan’s island, where all inhabitants are eitherknights,
who always tell the truth, or knaves, who alwayslie.
The puzzles involve a visitor to the island who meets a small group of inhabitants. The aim is
for the visitor to deduce the inhabitants’ type only from their statements. We solve those puzzles
using a table:
i) Assign all possible types for the inhabitants: rows of the table

ii) For each assignment (row of the table), evaluate the truth values of the statements of the
inhabitants.

iii) Finally, check for each row of the table, check if the truth values assigned in ii) are compatible
with the corresponding types of the inhabitant
The solution is then the row that is found compatible in step iii). Note that some problems my be
ill-posed, in which case multiple solutions, or no solutions are possible.
Examples

a) Let John and Bill be two inhabitants of the island. John says, ”the two of use are both
knights,” but Bill says, ”John is a knave.? Can you find out what types John and Bill are?
We define:

PJ : “The two of us are both knights”


PB : “John is a knave”

the statements provided by John and Bill, respectively. Then,

13
If John is a If Bill is a PJ PB Validity
Knight Knight T F No: Bill would be a knight that lies
Knight Knave F F No: John would be a knight that lies
Yes, John is a Knave that lies and Bill is a
Knave Knight F T
Knight that tells the truth
Knave Knave F T No: Bill would be a knave that tells the truth

Therefore, John is a knave, and Bill is a Knight.

b) Let John and Bill be two inhabitants of the island. John says, ”We are both knaves,” but Bill
says nothing. Can you find out what types John and Bill are?
We define:

PJ : “The two of us are knaves”

the statement provided by John. Then,

If John is a If Bill is a PJ Validity


Knight Knight F No:John would be a knight that lies
Knight Knave F No: John would be a knight that lies
Knave Knight F Yes, John is a Knave that lies
Knave Knave T No: John would be a knave that tells the truth

Therefore, John is a knave, and Bill is a Knight.

14

You might also like