Académique Documents
Professionnel Documents
Culture Documents
Logic
Gorkem Asilioglu
(Slides modified from: Laura E. Brown)
Mar. 4, 2019
1 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
Logic
The ability to express logical statements and reason about them is
important for virtually every area of computer science.
Learning Goals:
Usage Convert logical statements from informal language to
propositional and predicate logic expressions.
Usage Apply formal methods of symbolic propositional and
predicate logic, e.g., validity of formulae.
Usage Use the rules of inference to construct proofs in propositional
and predicate logic.
Usage Describe how symbolic logic can be used to model real-life
situations or applications.
Usage Apply formal logic proofs and/or informal but rigorous,
logical reasoning to problems.
Familiarity Describe the strengths and limitations of
propositional and predicate logic.
2 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
Logics
3 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
Logic
4 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
Key Definitions
Each combination of possible truth values for a statement
(compound proposition) is model.
Definition 1
Two compound propositions p and q are logically equivalent if
p ↔ q is a tautology (the propositions have all the same truth
values). Logical equivalence is denoted as p ≡ q. (Rosen Ch 1.3,
p. 25)
5 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
Key Definitions
Definition 2
A compound proposition that is always true is called a tautology.
(Rosen Ch 1.3, p. 25)
6 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
Key Definitions
Definition 4
A compound proposition that is neither a tautology nor a
contradiction is called a contingency. (Rosen Ch 1.3, p. 25)
7 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
Example
Example 1
Determine if the following expression is a tautology, contradiction,
or contingency.
(¬p ∧ (p ∨ q)) → q
p q ¬p p∨q ¬p ∧ (p ∨ q) (¬p ∧ (p ∨ q)) → q
T T
T F
F T
F F
8 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
Logical Equivalences
Example 2
Use a truth table to show that ¬(p ∧ q) and ¬p ∨ ¬q are
equivalent.
p q p ∧ q ¬(p ∧ q) ¬p ¬q ¬p ∨ ¬q
T T
T F
F T
F F
9 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
11 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
Example Problems
Example 3
Show two expressions are logically equivalent using laws.
¬(q ∧ ¬p) ∨ p ≡ ¬q ∨ p
13 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
Example Problems
Example 4
Show two expressions are logically equivalent using laws
(p ∨ ¬q) ∧ (q ∨ ¬p) ≡ (q ∧ p) ∨ (¬p ∧ ¬q).
14 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
Terminology
Definition 5
An argument is a sequence of statements that ends with a
conclusion. (Rosen, Ch 1.6, p. 69)
Definition 6
An argument is valid if the conclusion (final statement) must follow
from the truth of the preceding statements. (Rosen, Ch 1.6, p. 69)
15 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
16 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
((p → q) ∧ p) → q
is a tautology.
Arguments of this form are valid.
This particular rule of inference is called modus ponens.
17 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
Logical Entailment
Definition 7
The proposition p logically entails q, denoted as p |= q, if and only
if the proposition p → q is a tautology.
KB |= p
that is p follows from the KB.
18 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
Rules of Inference
Templates for a Valid Argument
19 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
Rules of Inference
Templates for a Valid Argument
Addition Simplification
p p∧q
p∨q p
Conjunction Resolution
p p∨q
q ¬p ∨ r
p∧q q∨r
20 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
Logical Inference
Definition 8
If we can use the knowledge base KB to derive (or prove)
proposition p, then the KB infers p, or p is inferred from KB,
denoted as KB ` p.
21 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
22 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
Procedure:
A Identify premises and conclusions
B Express formally (translate into logic)
C Apply rules of inference
23 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
24 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
Fallacies
Is the following argument valid?
“If you have a valid access card, then you can enter the lab.”
“You can enter the lab.”
Therefore,
“You have a valid access card.”
25 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
Fallacies
Is the following argument valid?
“If you have a valid access card, then you can enter the lab.”
“You do not have a valid access card.”
Therefore,
“You can not enter the lab.”
26 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
27 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
28 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
29 / 30
Introduction Logical Equivalence Laws Rules of Inference Examples Fallacies Examples
30 / 30