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

1.1. Propositional Logic - Discrete Structures For Computing

The document discusses propositional logic including the language of propositions, connectives like negation and conjunction, and logical equivalences. Propositional logic uses propositions that are either true or false and connectives to combine propositions. Truth tables are used to determine the truth values of compound propositions formed using connectives.

Uploaded by

onyedikachukwur
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

1.1. Propositional Logic - Discrete Structures For Computing

The document discusses propositional logic including the language of propositions, connectives like negation and conjunction, and logical equivalences. Propositional logic uses propositions that are either true or false and connectives to combine propositions. Truth tables are used to determine the truth values of compound propositions formed using connectives.

Uploaded by

onyedikachukwur
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Propositional Logic

Contents
1.1.1. The Language of Propositions
1.1.2. Applications
1.1.3. Logical Equivalences
1.1.4. Exercises

Propositional Logic is the logical system built around propositions. From such
propositions one can build logical arguments and implications.

In this section we will explore the language of propositions, their applications, and
deriving logical equivalences.

The Language of Propositions


Propositions
Constructing Propositions
Connectives
Negation
Conjunction
Disjunction
Implication
Biconditional
Propositional Formulas
Truth Tables
Implication, Inverse, Converse, and Contrapositive
Applications
Translating English to Propositional Logic
Boolean Searches
Formal Specifications
Solving logic puzzles
Logical Equivalences
Logically Equivalent
Equivalence proof
Exercises
Basic Propositions
Applications
Logical Equivalences

1.1.1. The Language of Propositions

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 1 of 27
:
r
Propositions are all about truth. Is a statement true or false? Is a statement correct or
incorrect?

Propositions

 Definition (Proposition)

A proposition is a declarative sentence or statement has a truth value. It is a


statement which is either true or false. Each proposition has a “truth value”:
either true or false.

To get acquainted with propositions, let us see some examples and counterexamples.

 Examples of propositions

Socrates was a human.

Socrates was a pigeon.

It is raining today.

The logo of Starbucks is a green mermaid.

1+1=2
1+1=4

Notice that propositions need not be a true statement. Propositions only need to be
declarative. Their truth value may be true or false. However, all propositions must
have a particular truth value. The statement cannot be both true and false. The
statement must be able to be interpreted as true or false.

From the previous definition and examples, propositions are therefore not questions,
general statements, demands, or hypotheses. Propositions do not have any variables,
quantifiers, or parameters (e.g. the words “some” or “any” typically do not appear).
Consider now a few non-examples.

 Examples of statements that are not propositions

Do you have a dog?

Let’s go!

Some coffee mug with a mermaid on it.

x+2=3
y = x2 − 1

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 2 of 27
:
r
Checkpoint Solution

 Are each of these propositions?

1. I am a dolphin.

2. Supercalifragilisticexpialidocious.

3. Jupiter is the 5th planet from the sun.

4. On Thursdays, van Gogh painted landscapes.

5. 11+56∗3−8 = 9
19

Constructing Propositions
An entire proposition is often denoted by a single propositional variable. Propositional
variables are typically among p, q, r, s, t, ….

 Using propositional variables

p := “The sky is blue”

q := “The sun rises from the west”

We also denote truth values in particular ways. “True” may be denoted by T . “False”
may be denoted by F . When a proposition (or proposition variable) is known to always
be true, we can replace it by T . When a proposition (or proposition variable) is known
to always be false, we can replace it by F .

Connectives
We can combine propositions (and propositional variables) into compound
propositions or propositional formulas. This is akin to compound sentences and other
logical connectives in natural language.

In propositional logic, we have 5 main connectives. Each connective has a


corresponding meaning in natural language as we will soon see.

Negation: ¬
Conjunction: ∧
Disjunction: ∨
Implication: →
Biconditional: ↔

Logical connectives are like arithmetic operators (+, −, ×, ÷).

Negation
The negation of a proposition results in a proposition with the opposite truth value. It
is akin to adding “not” into a sentence, or starting a sentence with “it is not that case
that…”.

Given a proposition p its negation is ¬p and has the following truth values.

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 3 of 27
:
r
p ¬p

F T

T F

Table 1.1 Negation truth table

 Negation

Let p := “the sky is blue”.


¬p is “the sky is not blue” or “it is not the case that the sky is blue”.
Let q := “2 + 2 = 5”.
¬q is “2 + 2 ≠ 5.

Notice in these examples that negation does not necessarily make a proposition false.
Rather, it makes the proposition have the opposite truth value.

Conjunction
The conjunction of two propositions is the logical “and” of the two propositions. The
conjunction of two proposition is only true if both the propositions are individually
true, otherwise the conjunction is false.

Given proposition p and q their conjunction is denoted p ∧ q and has the following
truth values.

p q p∧q

F F F

F T F

T F F

T T T

Table 1.2 Conjunction truth table

 Conjunction

Let p be “birds lay eggs” and q be “my eyes are blue”. p ∧ q is then “birds lay
eggs and my eyes are blue”.

Disjunction
The disjunction of two propositions is the “or” of the two propositions. The disjunction
is true if at least one of the propositions is individually true, otherwise the disjunction
is false.

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 4 of 27
:
r
Given proposition p and q their disjunction is denoted p ∨ q and has the following
truth values.

p q p∨q

F F F

F T T

T F T

T T T

Table 1.3 Disjunction truth table

 Disjunction

Let p be “it is raining” and q be “I am wearing sunglasses”. p ∨ q is then “it is


raining or I am wearing sunglasses”.

Notice that in this previous example, it is may be true that it is both raining and that I
am wearing sunglasses. While that may be silly, p ∨ q is still true! In logic, we only
require that at least one of the propositions in a disjunction is true. That means both
are allowed to simultaneously be true.

 Caution

In natural language, “or” is often interpreted as an exclusive or.

 Language “or”

“You can have a cookie or a piece of cake.” Most people assume


that this means you can have a cookie or a piece of cake, but not
both.

In logic, “or” is not exclusive. You can have a cookie, a piece of cake, or both!

If you want logical exclusive or, we use the symbol ⊕. However, we will not use that in
this course.

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 5 of 27
:
r
Checkpoint Solution

 What is the truth value of these compound propositions?

1. “The earth is round and the sky is blue.”

2. “Dogs or cats make great pets.”

3. “It is 20∘ Celsius outside and it is snowing.”

4. “Lemons are purple or grass is green”

Implication
Implication is one of the most challenging connectives to understand. Yet it is
arguably the most important for creating logical arguments (see Logical
Equivalences).

An implication is a conditional statement. For two propositions p and q, p → q is an


implication which is read “if p, then q”. You can also say “p implies q”.

 Implication

Let p be “it is raining” and q be “the ground is wet”. p → q can be read “if it
is raining, then the ground is wet”.

In an implication p → q, the first proposition p is known as the hypothesis,


antecedent, or premise. The second proposition q is known as the conclusion or
consequence.

Because an implication is a conditional, the truth value of the implication as a whole


changes depending on the truth value of the premise. The following truth table
summarizes the truth values of an implication.

p q p→q

F F T

F T T

T F F

T T T

Table 1.4 Implication truth table

An implication can be viewed as an obligation, a contract, or a commitment. The


implication p → q is false (the contract is broken; the obligation is unmet) only when
p is true and q is false.

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 6 of 27
:
r
There are several important observations from this truth table about logical
implication.

If q is true, then p → q is always true.


If p is true and the implication correct (the obligation is upheld), then q can
never be false.
“Falsity can imply anything.” If the hypothesis is false, then the implication is
always true, regardless of the whether or not the conclusion is true.

Some of these observations may seem counter-intuitive at first. Let us clarify with
some examples.

 The truth value of implications

Let p be “that animal is a panda bear” and q be “that animal is black and
white”. p → q can be read as “if that animal is a panda bear, then that animal
is black and white”.

If p is true, and that animal is indeed a panda bear (and the implication is
correct),
then it is also black and white. If q is true, and the animal is black and white,
it might be a panda bear, but it might also be a cow.

From p → q, we can say that knowing the animal is a panda bear is


sufficient to know that the animal is black and white.

Valid implications can be formed from completely unrelated propositions. Moreover, if


you begin with a nonsensical hypothesis, then one can construct valid (but equally
nonsensical) implications. Falsity implies anything.

 Absurd but valid implications

“If pigs can fly, then I am the pope.”

“If 2 + 2 = 5, then lemons are purple.”

“If the sun is made of ice, then my father is Morgan Freeman”.

There are many equivalent ways to think about the implication p → q.

If p, then q q whenever p
p implies q q follows from p
q when p p is sufficient for q
q, if p q is necessary for p

Necessity and Sufficiency

An implication connects propositions by a necessary or sufficient condition. From


p → q we get two relations:

p is sufficient for q
q is necessary for p

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 7 of 27
:
r
That is, “if sufficient condition, then necessary condition”.

 Necessary and Sufficient

“If all birds have feathers, then a chicken is a type of bird.”

Knowing birds have feathers is sufficient information to conclude that a


chicken is a type of bird. If a chicken is a type of bird, then chickens
necessarily have feathers.

Fig. 1.1 Being in the inner circle is sufficient for being in the outer circle. Being in
the outer circle is necessary for being in the inner circle.

Biconditional
For two propositions p and q, they can be connected by a biconditional as p ↔ q.

A biconditional is an double implication. A biconditional is true if both propositions


have the same truth value. p ↔ q can be read as “p if and only if q”. A biconditional
has the following truth table.

p q p↔q

F F T

F T F

T F F

T T T

Table 1.5 Biconditional truth table

The biconditional p ↔ q can be expressed in many ways:

“p if and only if q”
“if p then q, and if q then p”
“p is necessary and sufficient for q”

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 8 of 27
:
r
“p iff q”

 Biconditional

Let p be “2 is an even number”. Let q be “4 is an even number”. p ↔ q is a


biconditional and its truth value is true, since both p and q are true.

 Tip (thinking in memes)

“The venn diagram is a circle” exactly means that the two subjects form a
biconditional.

Checkpoint Solution

 What is the truth value of these compound propositions?

1. “The Earth is flat” → “Pigeons are robots”

2. “Bats have wings” → “Bats are birds”

3. “A square is a rectangle” ↔ “A square had four 90∘ interior angles”

4. “Spinach is green” ↔ “Penguins can fly”

Propositional Formulas
In the previous section we saw 5 different logical connectives: ¬, ∧, ∨, →, and ↔.
Much like arithmetic formulas using addition, multiplication, division, etc.,
propositional formulas may use several connectives simultaneously.

Remember BEDMAS or PEDMAS? Now we have “PaNCo DIB” (“Panko Dib”)?

For logical connectives we have a similar order of precedence.

1. Parenthesis: always perform operations on expressions inside parentheses first.


2. Negation: apply negation to a proposition before binary connectives.
3. Conjunction: conjunction before disjunction
4. Disjunction: disjunction after conjunction, but before implication

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 9 of 27
:
r
5. Implication: → after ∧, ∨
6. Biconditional: ↔ after ∧, ∨, →.

 Logical order of precendence

p ∨ q → ¬r is the same as (p ∨ q) → (¬r)


p ∨ ¬q ∧ r is the same as p ∨ ( (¬q) ∧ r)

Propositional variables need not be associated with a particular proposition or truth


value. A propositional variable could be just that: a variable. Replacing the variables in
a propositional formula with a truth value is called a truth assignment.

 Definition (truth assignment)

A truth assignment is the assignment of a truth value (true or false) to a


propositional variable. Equally, it is the replacement of a propositional
variable with a truth value.

Much like logical connectives, propositional formulas will result in different truth
values depending on the particular truth assignment on its consituent propositional
variables. When at least one truth assignment exists so that a formula is true, that
formula is said to be satisfiable.

 Definition (satisfiable)

A propositional formula is satisfiable if its truth value can be true under some
truth assignment. If every possible truth assignment makes the formula have
false as its truth value, that formula is said to be unsatisfiable.

In order to determine the truth value of a propositional formula, and to determine if it


is satisfiable, we can create a truth table.

Truth Tables
Truth tables are tools for determining the truth values of propositional formulas.

The table is separated into two sets of columns:


The first set of columns represent each proposition (or propositional
variable) in a formula.
The second set of columns represents the sub-formulas and formulas
whose truth values are to be determined.
There must be one row in the table for every possible combination of truth
values of the propositional variables. For example, in a formula with two
variables, the possible combinations are: (T , T ), (T , F ), (F , T ), (F , F ).

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 10 of 27
:
r
 3-variable truth table

Let p, q, r be propositional variables. A truth table for the formula


(p ∧ q) ∨ r is:

p q r p∧q (p ∧ q) ∨ r

F F F F F

F F T F T

F T F F F

F T T F T

T F F F F

T F T F T

T T F T T

T T T T T

Notice that every possible combination of truth values for p, q, and r is


contained in this table. Since at least one choice of truth value for p, q, and r
results in the formula being true, then this formula is satisfiable.

In a truth table, you begin by filling out the columns corresponding to each
propositional variable. These columns represent every possible combination of truth
values on those variables. Then, you add columns for each sub-formula, one at a time,
building up to the final formula.

Consider the formula p ∧ q ∧ r ∨ ¬q ∧ r → p. By order of precendence, this is


equal to ( (p ∧ q ∧ r) ∨ ((¬q) ∧ r) ) → p This contains several sub-formulas
which we can parse:

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

To be as explicit as possible, we could create a truth table with 3 + 6 = 9 columns (3


variables, 6 sub-formulas). But this is excessive. For example, we could directly
compute (¬q ∧ r) and (p ∧ q ∧ r). This gives the following truth table.

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 11 of 27
:
r
 A large truth table

A truth table for the propositional formula p ∧ q ∧ r ∨ ¬q ∧ r → p.

p q r p∧q∧r ¬q ∧ r (p ∧ q ∧ r) ∨ (¬q ∧ r) (p ∧ q ∧ r) ∨ (¬q

F F F F F F T

F F T F T T F

F T F F F F T

F T T F F F T

T F F F F F T

T F T F T T T

T T F F F F T

T T T T F T T

Checkpoint Solution

 Construct a truth table

Give a truth table for the propositional formula p ∧ r → q ∨ ¬r

Implication, Inverse, Converse, and Contrapositive


Now that we have seen propositional formulas and truth tables, let’s revisit
implications. This connective has many related conditionals.

Consider the propositional formula p → q. Then, we have:

Converse: q → p
Inverse: ¬p → ¬q
Contrapositive: ¬q → ¬p

 A conditional and its inverse

The proposition “if it is raining, then I wear a jacket” is a conditional


statement. Its inverse is “if it is not raining I do not wear a jacket”.

Notice from this previous example than an implication and its inverse are not exactly
the same. If the conditional “if it is raining, then I wear a jacket” is true, that is not the
same as its inverse. Indeed, you might still wear a jacket even if its not raining. Maybe

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 12 of 27
:
r
you’re just cold.

 Important

An implication is not equivalent to its converse or inverse. However, it is


equivalent to its contrapositive. See Logical Equivalences and Exercises.

1.1.2. Applications
There are many many applications of propositional logic. You will explore many more
of them in other courses on logic, computer architecture, theoretical computer
science, and more.

In this section we review a small sampling of applications:

1. Translating English to logic.


2. Boolean searches.
3. Formal specifications of software and computer systems.
4. Solving logic puzzles.

Translating English to Propositional Logic


To convert an English sentence to a propositional formula, there are two significant
steps. First, find the atomic propositions, the smallest clauses of the sentence which
do not contain connectives. Represent each such proposition as a unique variable.
Second, determine the appropriate logical connectives for those propositions.

 A first logical translation

“If it is raining and I am going outside, I bring an umbrella.”

Let p be “it is raining”

Let q be “I am going outside”

Let r be “I bring an umbrella”

Choosing the corrective connectives gives the logical translation of this


sentence:

p∧q →r

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 13 of 27
:
r
 A second logical translation

“The dog is large and friendly or small and boisterous”


Print to PDF
Let p be “the dog is large”

Let q be “the dog is friendly”

Let r be “the dog is small”

Let t be “the dog is boisterous”

Choosing the corrective connectives gives the logical translation of this


sentence:

(p ∧ q) ∨ (r ∧ t)

Note the ambiguity of the previous example. Did the English sentence assume an
exlusive or? Probably. Then, a correct translation might be (p ∧ q) ⊕ (r ∧ t).

Boolean Searches
Boolean, from mathematician George Boole, refers to a special kind of mathematics
that deals with turth values: true and false. Boolean algebra is a set of rules for
manipulating formulas containing variables and truth values. This is very similar to, but
slightly distinct from propositional logic. We will not explore Boolean algebra in this
course.

Boolean searches are about using logical connectives to help search through datasets
and filter pieces of data. This includes databases and internet search engines.

Consider a search using two keywords “foo” and “bar”.

AND is used to find records which contain both “foo” and “bar”.
OR is used to find records which contain “foo” or “bar” or both.
NOT is used to exclude records which do contain a keyword.

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 14 of 27
:
r
 Web Searches

Consider the key words “London”, “Beer”, “England”, and “Cider”

If we are looking for places to find beer in London, England we might search:

London AND England AND Beer

In most search engines, the AND is implicit, and we can simply search
“London England Beer”.

If we are looking for places to find beer or cider in London, England we might
search:

London England Beer | Cider

The ANDs are implicit: “London AND England AND (Beer OR Cider)”

If we are looking for places to find beer in London, Ontario we might try to
exclude entries for London, England. Searching for:

(London AND Beer) NOT England

Search engines often use the minus sign to denote NOT: “London Beer -
England”

Formal Specifications
In software, computer, and electrical engineering, the requirements of a system,
software, or defice must often meet very precise specifications.

These specifications are sometimes easy to express. For example, “the circuit carries
115-125 volts”. For softare in particular, its requirements are often expressed as
(ambiguous) natural language requirements. Those requirements must be translated
into precise logical statements.

 Logical Specification

“Mute all notifications during buisness hours when the user’s status is not
available.”

Let p be “it is during business hours”.

Let q be “the user’s status is set to available”.

Let r be “mute all notifications”.

A propositional formula for this specification is:

p ∧ ¬q → r

Propositional logic can also be used to determine if the collection of all requirements
for a system is consistent.

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 15 of 27
:
r
 Definition (consistent)

A set of propositional formulas is consistent if there exsists at least one truth


assignment so that every proposition is simultaneously true.

Notice that consistency is not the same as every formula in a set being satisfiable.
The formulas must be simultaneously satisfied by the same truth assignment.

One way to determine consistency is as follows. Given a collection of propositions


p1, p2, … , pn, the propositions are consistent if their conjunction is satisfiable. That
is, the following formula has at least one truth assignment that makes it true:

p1 ∧ p2 ∧ p3 ∧ ⋯ ∧ pn

To determine the consistency of a requirement set, we must first build propositional


formulas for each requirement. Where the same “clause” exists in multiple
requirements (recall Translating English to Propositional Logic), we should re-use that
propositional variable. Second, we must assign true or false to each variable so that
every formula is simultaneously true. If no such assignment exists, the set of
requirements is said to be inconsistent.

 Exercise

Let us consider an electronic messaging network which requires that all sent
messages are certain to be received. This behaviour might be modelled as
the following specifications:

1. Messages remain in the outbound message queue until they have been
received by the recipient.

2. An unreceived message is either a draft or is in the outbound message


queue.

3. Received messsages cannot be drafts.

Is this set of requirements consistent?

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 16 of 27
:
r
 Solution

Let p be “message is in the outbound message queue”.

Let q be “message is received”.

Let r be “message is a draft”.

We have:

1. p → ¬q

2. ¬q → (p ∨ r)

3. q → ¬r

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

F F F T F F

F F T T T F

F T F T T T

F T T T T F

T F F T T F

T F T T T F

T T F F T T

T T T F T F

Since at least one truth assignment simultaneously satisfies all equations,


namely p := F , q := T , r := F , this set of requirements is consistent. In
the language of this problem, that means the message is received and is not
a draft and is not in the outbound queue.

Solving logic puzzles


Many puzzles are based around logical arguments and reasoning. So solve such
puzzles, propositional logic is a very useful tool. The idea is to model the elements of
the puzzle as propositional formula(s), and use those formulas to determine if the
formula(s) are satisfiable, consistent, etc., depending on the puzzle.

Let’s see an example.

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 17 of 27
:
r
 Activity (Knights and Knaves)

Suppose you are on an island with two kinds of people:

1. knights, who always tell the truth; and

2. knaves, who always lie.

You meet two people, A and B. A says “B is a knight.” B says “the two of
us are different kinds of people”.

What kind of people are A and B?

 Solution

A and B are both knaves.

Let p be “A is a knight”. Let q be “B is a knight”. The statement “the two of


us are different kinds of people” can be represented as
(p ∧ ¬q) ∨ (¬p ∧ q).

Assume A is a knight and therefore p is true. Then, their statement “B is a


knight” must be true and therefore q is true. If B is a knight, then the formula
(p ∧ ¬q) ∨ (¬p ∧ q) should be true. However, this formula is false if both p
and q are true.

Assume A is a knave (i.e. ¬p is true). Then, their statement “B is a knight”


must be false (i.e. ¬q is true). Therefore, B is a knave and their statement
should be a lie. Both p and q being false makes (p ∧ ¬q) ∨ (¬p ∧ q) false,
which is consistent.

1.1.3. Logical Equivalences


Propositional logic is the foundation of more complex logical systems and of formal
mathematical proofs. One particular kind of proof, an “equivalence proof”, proves that
one thing is equivalent to another through a sequence of equivalences.

What is an equivalence? Well, the first quesiton to ask is: what is a tautology?

 Definition (tautology)

A propositional formula that is always true, for every possible truth


assignment, is a tautology.

A proposition that is not a tautology is either a contradiction or a contingency.

 Definition (contradiction)

A propositional formula that is always false, for every possible truth


assignment, is a contradiction.

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 18 of 27
:
r
 Definition (contingency)

A propositional formula that is neither a tautology nor a contradiction is a


contingency.

Logically Equivalent
Two propositional formulas, say p and q, are logically equivalent if p ↔ q is a
tautology. When this is the case, we may write p ⟺ q or p ≡ q.

A simple and explicit way to determine if two expressions are logically equivalent is if
their two columns in a truth table are identical.

 Logically equivalent truth table

p q ¬p p→q ¬p ∨ q

F F T T T

F T T T T

T F F F F

T T F T T

There are several logical equivalences which would be good to memorize. They are
similar to many laws of arithmetic. For example, we know x × 0 = 0 regardless of the
value of x.

Identity Laws p∧T ≡p p∨F ≡p

Annihilation Laws p∧F ≡F p∨T ≡T

Idempotent Laws p∧p≡p p∨p≡p

Complementation Laws p ∧ ¬p ≡ F p ∨ ¬p ≡ T

Double negation ¬(¬p) ≡ p

There are also interesting properties of logical connectives between two or more
propositional variables.

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 19 of 27
:
r
Commutativity p∧q ≡q∧p

Associativity p ∧ (q ∧ r) ≡ (p ∧ q) ∧ r

Distributivity p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)

Absorption p ∧ (p ∨ q) ≡ p

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

p∨q ≡q∨p

p ∨ (q ∨ r) ≡ (p ∨ q) ∨ r

p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)

p ∨ (p ∧ q) ≡ p

¬(p ∨ q) ≡ ¬p ∧ ¬q

De Morgan’s Laws are very important. These laws explain how negation distributes
over a conjunction and disjunction. In particular, it turns disjunctions into
conjunctions, and vice versa.

 Important

In these laws and properties, we can replace any propositional variable with
an entire propositional formula, and the law is still correct.

 Variable-expression replacement

Let p := (¬a ∧ b) ∨ c.

(¬a ∧ b) ∨ c ∨ T ≡ ( (¬a ∧ b) ∨ c ) ∨ T
≡p∨T
≡T

These laws and properties can be used as building blocks to prove that certain
expressions are logically equivalent. Before we see that process, let’s see some more
interesting logical equivalences.

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 20 of 27
:
r
 More logical equivalences

(p → q) ≡ ¬p ∨ q
(p → q) ∧ (p → r) ≡ p → (q ∧ r)
(p → r) ∧ (q → r) ≡ (p ∨ q) → r
p ↔ q ≡ (p → q) ∧ (q → p)
p ↔ q ≡ ¬p ↔ ¬q
p ↔ q ≡ (p ∧ q) ∨ (¬p ∧ ¬q)

 Tip

Draw the truth table for some of the above examples to prove to yourself
that the two expressions are logically equivalent.

Equivalence proof
We can show two expressions, say A and B, are logically equivalent by constructing a
sequence of logically equivalent statements Ei, beginning with A and ending with B.

A ≡ E1
E1 ≡ E2
E2 ≡ E3

En ≡ B

 A first equivalence proof

Prove that p ∧ (¬p ∨ q) ≡ p ∧ q.

p ∧ (¬p ∨ q) ≡ p ∧ ¬p ∨ p ∧ q distributivity
≡F ∨p∧q annihilation
≡p∧q identity

Whenever we use propositional logic, we will return to equivalence proofs and truth
tables. It is important that you really understand the manipulation and equivalency of
propositional truth tables.

Checkpoint Solution

 Equivalence proof

Prove that p ∨ (p ∧ q) ∨ (¬p ∧ r) ≡ (p ∧ q) ∨ p ∨ r.

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 21 of 27
:
r
1.1.4. Exercises
Basic Propositions

 Exercise 1.1

If a propositional formula has 5 variables, how many rows are needed in its
truth table?

 Solution to Exercise 1.1

32. Each variable has two choices: true of false. 5 variables means there are
2 × 2 × 2 × 2 × 2 = 25 = 32 possible combinations of truth values.

 Exercise 1.2

Express the following English sentence as a propositional formula. “If it is


snowing I wear a jacket and I wear mittens.”

 Solution to Exercise 1.2

p: It is snowing
q: I wear a jacket
r: I wear mitterns

p → (q ∧ r)

 Exercise 1.3

Express the following English sentence as a propositional formula. “When I


am at the beach or I go swimming, I wear a swimsuit.”

 Solution to Exercise 1.3

p: I am at the beach
q: I go swimming
r: I wear a swimsuit

p∨q →r

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 22 of 27
:
r
 Exercise 1.4

Classify each of the following statements as true or false.

1. “4 = 2 + 2 and 7 < √50”

2. “4 = 2 + 2 → 7 < √50”

3. “4 ≠ 2 + 2 → 7 < √50”

4. “4 = 2 + 2 → 7 ≥ √50”

 Solution to Exercise 1.4

1. True. Both clauses are true.

2. True. Both premise and conclusion are true.

3. True. The hypothesis is false, therefore true.

4. False. The premise is true, but the conclusion is false.

 Exercise 1.5

Give the negation of each of the following compound statements.

1. “Either a2 > 0 or a is not a real number.”

2. “x = ±1”

3. “x is a real number and x2 + 1 = 0”

 Solution to Exercise 1.5

1. “a2 ≤ 0 and a is a real number”; also “a = 0”

2. “x ≠ 1 and x ≠ −1”

3. “x is not a real number or x2 + 1 ≠ 0”

 Exercise 1.6

Give the converse, inverse, and contrapositive of each of the following


implications.

1. “If ab and b are integers, then a is an integer.”


c c

2. “Every Eulerian graph is connected”.

3. “ab = 0 → a = 0 or b = 0”.

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 23 of 27
:
r
 Solution to Exercise 1.6

1.

Converse: “If a is an integer then ab and b are integers”


c c

Inverse: “If ab is not an integer or b is not an integer then a is not an


c c
integer.”

Contrapositive: “If a is not an integer then ab is not an integer or b is not an


c c
integer”

2.

Converse: “Every connected graph is Eulerian”

Inverse: “Every non-Eulerian graph is not connected.”

Contrapositive: “Every non-connected graph is not Eulerian.”

3.

Converse: “a = 0 or b = 0 → ab = 0”

Inverse: “ab ≠ 0 → a ≠ 0 and b ≠ 0”

Contrapositive: “a ≠ 0 and b ≠ 0 → ab ≠ 0

 Exercise 1.7

For each of the following propositional formulas, determine which are


satisfiable. If they are satisfiable, give a truth assignment which satisfies the
formula.

1. p ∧ (¬q ∨ ¬r) ∧ (q ∨ ¬p)

2. p ∧ (q ∨ ¬p) ∧ (¬q ∨ ¬p) ∧ r

3. (p ∧ q ∧ ¬r) ∨ (p ∧ ¬q ∧ ¬r)

 Solution to Exercise 1.7

1. (p, q, r) := (T , T , F )

2. Not satisfiable

3. (p, q, r) := (T , T , F ) or (T , F , F )

Applications

 Exercise 1.8

Julie and Jamie are identical twins. One of then always lies and one of them
always tells the truth. Suppose you meet one of them. What 3-word question
(with a yes/no answer) can you ask to determine which twin is in front of
you? You do not know which twin lies.

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 24 of 27
:
r
 Solution to Exercise 1.8

“Does Julie lie?”

1. Suppose you meet Julie and Julie tells the turth. Julie will reply “no”.

2. Suppose you meet Julie and Julie lies. Julie will reply “no” (i.e. “no, Jamie
lies”).

3. Suppose you meet Jamie and Jamie tells the truth. Jamie will reply “yes”.

4. Suppose you meet Jamie and Jamie lies. Jamie will reply “yes” (i.e. “yes,
Julie lies”).

 Exercise 1.9

Define the basic clauses of each of the following statements as propositional


variables. Then, express each of the following compound statements as
propositional formulas. Finally, is this set of propositions consistent? If so,
give a truth assignment which shows they are consistent.

1. The campus server does not work if the internet is off.

2. Students can skype during the test when the prof is distracted.

3. If the classroom phone does not ring then the prof is not distracted.

4. Students cannot skype during the test unless the internet is on.

5. If the classroom phone rings then the campus server works.

 Solution to Exercise 1.9

I := “internet is on”
C := “the campus server works”
D := “the professor is distracted”
S := “students can Zoom during the test”
R := “the classroom phone rings”

1. ¬I → ¬C

2. D → S

3. ¬R → ¬D

4. S → I ; ¬I → ¬S ; “A unless B” translates logically to “A if not B”

5. R → C

To check consistency, we need to see if the following conjunction is


satisfiable.

(¬I → ¬C) ∧ (D → S) ∧ (¬R → ¬D) ∧ (S → I) ∧ (R → C)

This is satisfiable with: (I, S, R, D, C) := (T , T , T , T , T )

Logical Equivalences

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 25 of 27
:
r
 Exercise 1.10

Show that p → q is logically equivalent to ¬q → ¬p.

 Exercise 1.11

Prove De Morgan’s law ¬(p ∧ q) ≡ ¬p ∨ ¬q by a truth table.

 Solution to Exercise 1.11

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

F F T T

F T T T

T F T T

T T F F

 Exercise 1.12

If (p ∧ q) ∨ ((¬p) ∧ q ∧ r) is logically equivalent to (p ∧ q ∧ r) ∨ (p ∧ q),


show their biconditional is a tautology. If not, give a truth assignment which
results in different truth values for each formula.

 Exercise 1.13

Show that the following expressions are logically equivalent. Do this by (a)
truth tables, and (b) logical equivalences.

p ↔ q ≡ (p ∧ q) ∨ (¬p ∧ ¬q)

 Exercise 1.14

Prove that p ∨ (p ∧ q) ∨ (¬p ∧ r) ≡ p ∨ r.

 Solution to Exercise 1.14

p ∨ (p ∧ q) ∨ (¬p ∧ r) ≡ (p ∧ q) ∨ p ∨ (¬p ∧ r) commu


≡ (p ∧ q) ∨ ( (p ∨ ¬p) ∧ (p ∨ r) ) distri
≡ (p ∧ q) ∨ ( T ∧ (p ∨ r) ) compleme
≡ (p ∧ q) ∨ (p ∨ r)
≡ (p ∧ q) ∨ p ∨ r assoc
≡ p ∧ (q ∨ T ) ∨ r
≡p∨r anni

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 26 of 27
:
r
 Exercise 1.15

Prove that ¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧ ¬q.

 Solution to Exercise 1.15

Let A be ¬p ∧ q.

¬(p ∨ (¬p ∧ q)) ≡ ¬(p ∨ A)


≡ ¬p ∧ ¬A
≡ ¬p ∧ ¬(¬p ∧ q)
≡ ¬p ∧ (¬(¬p) ∨ ¬q)
≡ ¬p ∧ (p ∨ ¬q)
≡ (¬p ∧ p) ∨ (¬p ∧ ¬q)
≡ F ∨ (¬p ∧ ¬q)
≡ ¬p ∧ ¬q

 Exercise 1.16

Prove that p ∧ r ∧ (¬q ∨ p) ≡ p ∧ r.

By Alexander Brandt
© Copyright 2022.

https://www.csd.uwo.ca/~abrandt5/teaching/DiscreteStructu logic.html#implication-inverse-converse-and-contrapositive 22/05/2024, 22 16


Page 27 of 27
:
r

You might also like