You are on page 1of 21

# Introduction to Logic

Overview: Literature:
What is Logic? Handouts: (J. Kelly)
Propositional Logic The Essence of Logic:
Predicate Logic chapter 1 (not 1.6)
chapter 6

What is Logic?

## J λογικη (logikè) = relative to logos (reason)

J Definitions of ‘logic’
J The art of reasoning
J the branch of philosophy that analyzes inference
J Reasoned and reasonable judgment; "it made a certain kind of
logic"
J the principles that guide reasoning within a given field or
situation: "economic logic requires it"; "by the logic of war"
J a system of reasoning

## 2 20-11-2007 DKS - Module 3

1
Aristotoles (384–322 B.C.)

## J The instrument (the "organon") by means of

which we come to know anything.
J formal rules for correct reasoning

J Syllogism:

## All man are mortal

Socrates is a man
Socrates is mortal

## J Human reasoning can be reduced to calculation

J characteristica universalis
J universal language to describe all scientific concepts
J calculus ratiocinator
J method to reason with that language
J salva veritate
J two expressions can be interchanged without changing the
truth-value of the statements in which they occur

## “when there are disputes among persons, we can simply

say: Let us calculate [calculemus]!”

## 4 20-11-2007 DKS - Module 3

2
Criticism to logic

## J “… logic is not a model of reasoning at all but is more a

means of constraining the reasoning process; we [people]
don’t solve problems using logic, we just use it to explain
our solutions.”
[Marvin Minsky]

## J High-level language for expressing knowledge

J High expressive power
J Well-understood formal semantics
J Precise notion of logical consequence
J Proof systems that can automatically derive statements
syntactically from a set of premises
J Logic can provide explanations for answers
J By tracing a proof that leads to a logical consequence

## 6 20-11-2007 DKS - Module 3

3
Uses of Logic

J Argumentation
J Inference (systems)
J Cognitive psychology & AI
J descriptive use of logic
J Normative systems
J prescriptive use of logic
J Knowledge representation

## 7 20-11-2007 DKS - Module 3

Warning!

J Meta-language
J Different levels
J Abstraction
J Difference to everyday use of concepts
J Temporal, causal, … relations

## 8 20-11-2007 DKS - Module 3

4
Propositional Logic and Predicate Logic

J Propositional Logic
J The study of statements and their connectivity structure.
J Predicate Logic
J The study of individuals and their properties.

## J Propositional logic more abstract and hence less detailed

than predicate logic.
J Propositional/predicate logic are unique in the sense that
sound and complete proof systems do exist.
J Not for more expressive logics (higher-order logics)

## All man are mortal All man have blue skin

Socrates is a man Socrates is a man
Socrates is mortal Socrates has blue skin

## J Reasoning is valid (deduction, syllogism)

J Nothing is said about the actual truth of premisses!
J The concern of logic is that…
J … never a false conclusion can be reached from true
premises!

## 10 20-11-2007 DKS - Module 3

5
Propositional Logic

J Truth Tables
J Logical equivalence
J Tautology
J Contradiction

## 11 20-11-2007 DKS - Module 3

Basic elements

J Logical connectives
J ∧ and
J ∨ or
J ¬ not
J → implication, if … then …
J ↔ bi-implication, iff (if and only if)

## J Connectives are used to link atoms

J atoms = facts = statements
J Propositions can be constructed based on atoms and
connectives

6
Truth values

## J A proposition has a truth value:

J true (T) or false (F)
J v(A) represents the truth value of A
J T and F are often represented as 1 resp. 0

Truth tables

## J Truth tables give the operational definition of logical

connectives
J List ALL possible cases
J Example, for negation :

A ¬A
T F
F T

## 14 20-11-2007 DKS - Module 3

7
Truth table for AND (∧)

A B A∧B
F F F
F T F
T F F
T T T

A B A∨B
F F F
F T T
T F T
T T T

## 16 20-11-2007 DKS - Module 3

8
Truth table for implication (→)

A B A→B
F F T
F T T
T F F
T T T

## V((the sun is a planet) → (1+1 = 3)) = T

V((dog is animal) → (dog breaths) ) = T
17 20-11-2007 DKS - Module 3

A B A↔B
F F T
F T F
T F F
T T T

## 18 20-11-2007 DKS - Module 3

9
Remarks on implication

## J Implication in propositional logic is different from its use in

natural language
J Temporal issues
J Causal relations
J Implication in propositional logic refers to the truth values
of the atoms!

J E.g. compare:
J If the moon is made of cheese then it is tasty
J If the moon is made of cheese then 2 x 2 = 5
J Both are true, but the first sounds more ‘logical’!!

## Tautology and contradiction

J Tautology
J A logical expression that has truth value T is all cases

J Contradiction
J A logical expression that has truth value F is all cases

## 20 20-11-2007 DKS - Module 3

10
Example: tautology

(A∧B)→ (C∨(¬B→¬C))
A B C A∧B ¬B ¬C ¬B→¬C C∨(¬B→¬C) (A∧B)→ (C∨(¬B→¬C))

F F F F T T T T T

F F T F T F F T T

F T F F F T T T T

F T T F F F T T T

T F F F T T T T T

T F T F T F F T T

T T F T F T T T T

T T T T F F T T T

## 21 20-11-2007 DKS - Module 3

Example: tautology

(A∧B)→ (C∨(¬B→¬C))
A B C A∧B ¬B ¬C ¬B→¬C C∨(¬B→¬C) (A∧B)→ (C∨(¬B→¬C))

F F F F T T T T T

F F T F T F F T T

F T F F F T T T T

F T T F F F T T T

T F F F T T T T T

T F T F T F F T T

T T F T F T T T T

T T T T F F T T T

## 22 20-11-2007 DKS - Module 3

11
Example: Contradiction

A ¬A A∧¬A

F T F

T F F

## 23 20-11-2007 DKS - Module 3

Logical equivalence

## J Two logical expressions are logically equivalent if

they have the same truth table
J That is, each truth assignment of the atoms results in
the same truth value for the expression

J Notation: A ≡ B
J A and B are logically equivalent

12
Example

## A B A∧B A B ¬A ¬B ¬A∨¬B ¬(¬A∨¬B)

F F F F F T T T F

F T F F T T F T F

T F F T F F T T F

T T T T T F F F T

Example

## A B A∧B A B ¬A ¬B ¬A∨¬B ¬(¬A∨¬B)

F F F F F T T T F

F T F F T T F T F

T F F T F F T T F

T T T T T F F F T

Conclusion:

A ∧ B ≡ ¬(¬A ∨ ¬B)

13
Equivalence laws

J A ∧0 ≡0
J A ∧1 ≡A
J A ∨0 ≡A
J A ∨1 ≡1
J A ∧A ≡A
J A ∨A ≡A

## 27 20-11-2007 DKS - Module 3

Equivalence laws

J A ∧0 ≡0 J A ∧ B≡B∧ A
J A ∧1 ≡A J A ∨ B≡B∨ A
J A ∨0 ≡A J A ∧ (A ∨ B) ≡ A
J A ∨1 ≡1 J A ∨ (A ∧ B) ≡ A
J A ∧A ≡A J A ∨ (¬A ∧ B) ≡ A ∨ B
J A ∨A ≡A J A ∧ (¬A ∨ B) ≡ A ∧ B
J A ∧ ¬A ≡ 0 J (A ∧ B) ∨ (A ∧ ¬B) ≡ A
J A ∨ ¬A ≡ 1 J A → B ≡ ¬A ∨ B
J ¬¬A ≡ A J A → B ≡ ¬(A ∧ ¬B)

## 28 20-11-2007 DKS - Module 3

14
Equivalence laws (general)

J Distributivity
J A ∧ (B ∨ C) ≡ (A ∧ B) ∨ (A ∧ C)
J A ∨ (B ∧ C) ≡ (A ∨ B) ∧ (A ∨ C)

J De Morgan Laws
J ¬(A ∧ B) ≡ ¬A ∨ ¬B
J ¬(A ∨ B) ≡ ¬A ∧ ¬B

Inference

J Modus Ponens
A→B
A
∴B

## J IfA → B and A hold (are true) then it can be safely

concluded that B also is true
J E.g. if the rule is (smoke → fire) and you see smoke
then you can conclude that there is fire

15
Predicate logic

## J Objects, predicates, functions

J Quantifiers
J 1st order language
J Substitutions, interpretations

## 31 20-11-2007 DKS - Module 3

Syllogistic reasoning

J Syllogistic reasoning as

## All man are mortal

Socrates is a man
∴Socrates is mortal
cannot be expressed in propositional logic

## 32 20-11-2007 DKS - Module 3

16
Objects, predicates, quantifiers

J Needed:
J Objects, such as Socrates
J Predicates, such as mortal
J Quantifiers, such as all

J Formally: or:
J ∀x : M(x) → S(x) ∀x : man(x) → mortal(x)
J M(s) man(socrates)
∴ S(s) ∴mortal(socrates)

## 33 20-11-2007 DKS - Module 3

Quantifiers

J Universal quantifier
J Notation: ∀
J “for all”
J Ex. “(∀x)M(x)” or “∀x : M(x)”

J Existential quantifier
J Notation: ∃
J “exists, there is”
J Ex. “(∃x)M(x)” of “∃x : M(x)”

## 34 20-11-2007 DKS - Module 3

17
Often used formulas

J All A are B:
J For all x: if x is A then x is B
J (∀x)(A(x) → B(x))

J Some A are B:
J There is x: x is A and x is B
J (∃x)(A(x) ∧ B(x))

Warning

## J Order of quantifiers is essential!

J Big difference:
J (∀x)(∃y)A(x,y)
• For all x there is a y such that A(x,y)
• For all men x there is a woman y such that mother(x,y)

J (∃y)(∀x)A(x,y)
• There is a y such that for all x, A(x,y)
• There is a woman y such that for all man x, mother(x,y)

## 36 20-11-2007 DKS - Module 3

18
Quantifiers in finite domains

## J When the domain is finite,

say {a1, …, an}, the universal and existential quantifiers
are a abbreviation for the finite conjunction resp.
disjunction:
J (∀x)A(x) = A(a1) ∧ … ∧ A(an)
J (∃x)A(x) = A(a1) ∨ … ∨ A(an)

## Relation between ∀ and ∃

J (∃x)A(x) ↔ ¬(∀x)¬A(x)

J (∀x)A(x) ↔ ¬(∃x)¬A(x)

19
Inference

J Modus ponens

## J Universal Elimination (Syllogism)

(∀x) P(x) → Q(x)
P(a)
∴ Q(a)
where x ∈ X, a ∈ X
J E.g (all kids like ice-cream) and (Bob is a kid) hold, then
deduce (Bob likes ice-cream)
J Exercise: translate into predicate logic!

Next module:

## Rule Based Systems

(27 november 2007)

## 40 20-11-2007 DKS - Module 3

20
41 20-11-2007 DKS - Module 3

21