Introduction to Logic
Document Sample


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
1
What is Logic?
λογικη (logikè) = relative to logos (reason)
Definitions of ‘logic’
The art of reasoning
The branch of philosophy that analyzes inference
Reasoned and reasonable judgment; "it made a certain kind of
logic"
The principles that guide reasoning within a given field or
situation: "economic logic requires it"; "by the logic of war"
A system of reasoning
2 14/09/09
DKS - Module 3
1
Aristotoles (384–322 B.C.)
The instrument (the "organon") by means of
which we come to know anything.
Formal rules for correct reasoning
Syllogism:
All man are mortal
Socrates is a man
Socrates is mortal
3 14/09/09
DKS - Module 3
Gottfried Leibniz (1646-1716)
Human reasoning can be reduced to calculation
Characteristica universalis
universal language to describe all scientific concepts
Calculus ratiocinator
method to reason with that language
Salva veritate
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 14/09/09
DKS - Module 3
2
Criticism to logic
“… 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]
5 14/09/09
DKS - Module 3
The Importance of Logic
High-level language for expressing knowledge
High expressive power
Well-understood formal semantics
Precise notion of logical consequence
Proof systems that can automatically derive statements
syntactically from a set of premises
Logic can provide explanations for answers
By tracing a proof that leads to a logical consequence
6 14/09/09
DKS - Module 3
3
Uses of Logic
Argumentation
Inference (systems)
Cognitive psychology & AI
descriptive use of logic
Normative systems
prescriptive use of logic
Knowledge representation
7 14/09/09
DKS - Module 3
Warning!
Meta-language
Different levels
Abstraction
Difference to everyday use of concepts
Temporal, causal, … relations
8 14/09/09
DKS - Module 3
4
Propositional Logic and Predicate Logic
Propositional Logic
The study of statements and their connectivity structure.
Predicate Logic
The study of individuals and their properties.
Propositional logic more abstract and hence less detailed
than predicate logic.
Propositional/predicate logic are unique in the sense that
sound and complete proof systems do exist.
Not for more expressive logics (higher-order logics)
9 14/09/09
DKS - Module 3
Reasoning = Reach valid conclusions
All man are mortal All man have blue skin
Socrates is a man Socrates is a man
Socrates is mortal Socrates has blue skin
Reasoning is valid (deduction, syllogism)
Nothing is said about the actual truth of premisses!
The concern of logic is that…
… from true premises one can never reach a false
conclusion!
10 14/09/09
DKS - Module 3
5
Propositional Logic
Truth Tables
Logical equivalence
Tautology
Contradiction
11 14/09/09
DKS - Module 3
Basic elements
Logical connectives
∧ and
∨ or
¬ not
→ implication, if … then …
↔ bi-implication, iff (if and only if)
Connectives are used to link atoms
Atoms = facts = statements
Propositions can be constructed based on atoms and
connectives
12 14/09/09
DKS - Module 3
6
Truth values
A proposition has a truth value:
true (T) or false (F)
v(A) represents the truth value of A
T and F are often represented as 1 resp. 0
13 14/09/09
DKS - Module 3
Truth tables
Truth tables give the operational definition of logical
connectives
List ALL possible cases
Example, for negation :
A ¬A
T F
F T
14 14/09/09
DKS - Module 3
7
Truth table for AND (∧)
A B A∧B
F F F
F T F
T F F
T T T
V( (1+1 = 2) ∧ (the sun is a star) ) = T
15 14/09/09
DKS - Module 3
Truth table for OR (∨)
A B A∨B
F F F
F T T
T F T
T T T
V( (1+1 = 2) ∨ (the sun is a planet)) = T
16 14/09/09
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
(dog is animal) → (dog breaths) ) = T
V(
17 14/09/09
DKS - Module 3
Truth table for iff (↔)
A B A↔B
F F T
F T F
T F F
T T T
V( (the sun is a star) ↔ (1+1 = 2) ) =T
18 14/09/09
DKS - Module 3
9
Remarks on implication
Implication in propositional logic is different from its use in
natural language
Temporal issues
Causal relations
Implication in propositional logic refers to the truth values
of the atoms!
E.g. compare:
If the moon is made of cheese then it is tasty
If the moon is made of cheese then 2 x 2 = 5
Both are true, but the first sounds more ‘logical’!!
19 14/09/09
DKS - Module 3
Tautology and contradiction
Tautology
A logical expression that has truth value T in all cases
Contradiction
A logical expression that has truth value F in all cases
20 14/09/09
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 14/09/09
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 14/09/09
DKS - Module 3
11
Example: Contradiction
A ¬A A∧¬A
F T F
T F F
23 14/09/09
DKS - Module 3
Logical equivalence
Two logical expressions are logically equivalent if
they have the same truth table
That is, each truth assignment of the atoms results in
the same truth value for the expression
Notation: A ≡ B
A and B are logically equivalent
24 14/09/09
DKS - Module 3
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
25 14/09/09
DKS - Module 3
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)
26 14/09/09
DKS - Module 3
13
Equivalence laws
A ∧ F ≡ F
A ∧ T ≡ A
A ∨ F ≡ A
A ∨ T ≡ T
A ∧ A ≡ A
A ∨ A ≡ A
27 14/09/09
DKS - Module 3
Equivalence laws
A ∧ F ≡ F A ∧ B ≡ B ∧ A
A ∧ T ≡ A A ∨ B ≡ B ∨ A
A ∨ F ≡ A A ∧ (A ∨ B) ≡ A
A ∨ T ≡ T A ∨ (A ∧ B) ≡ A
A ∧ A ≡ A A ∨ (¬A ∧ B) ≡ A ∨ B
A ∨ A ≡ A A ∧ (¬A ∨ B) ≡ A ∧ B
A ∧ ¬A ≡ F (A ∧ B) ∨ (A ∧ ¬B) ≡ A
A ∨ ¬A ≡ T A → B ≡ ¬A ∨ B
¬¬A ≡ A A → B ≡ ¬(A ∧ ¬B)
28 14/09/09
DKS - Module 3
14
Equivalence laws (general)
Distributivity
A ∧ (B ∨ C) ≡ (A ∧ B) ∨ (A ∧ C)
A ∨ (B ∧ C) ≡ (A ∨ B) ∧ (A ∨ C)
De Morgan Laws
¬(A ∧ B) ≡ ¬A ∨ ¬B
¬(A ∨ B) ≡ ¬A ∧ ¬B
Logical equivalence satisfies the laws of a Boolean algebra.
29 14/09/09
DKS - Module 3
Inference
How to reason (deduce new facts) with propositional logic
Modus Ponens
A→B
A
∴B
IfA → B and A hold (are true) then it can be safely
concluded that B also is true
E.g. if the rule is (smoke → fire) and you see smoke
then you can conclude that there is fire
30 14/09/09
DKS - Module 3
15
Predicate logic
Objects, predicates, functions
Quantifiers
1st order language
Substitutions, interpretations
31 14/09/09
DKS - Module 3
Syllogistic reasoning
Syllogistic reasoning as
All man are mortal
Socrates is a man
∴Socrates is mortal
cannot be expressed in propositional logic
32 14/09/09
DKS - Module 3
16
Objects, predicates, quantifiers
Needed:
Objects, such as Socrates
Predicates, such as mortal
Quantifiers, such as all
Formally: or:
∀x : M(x) → S(x) ∀x : man(x) → mortal(x)
M(s) man(socrates)
∴ S(s) ∴mortal(socrates)
33 14/09/09
DKS - Module 3
Quantifiers
Universal quantifier
Notation: ∀
“for all”
Ex. “(∀x)M(x)” or “∀x : M(x)”
Existential quantifier
Notation: ∃
“exists, there is”
Ex. “(∃x)M(x)” of “∃x : M(x)”
34 14/09/09
DKS - Module 3
17
Often used formulas
All A are B:
For all x: if x is A then x is B
(∀x)(A(x) → B(x))
Some A are B:
There is x: x is A and x is B
(∃x)(A(x) ∧ B(x))
35 14/09/09
DKS - Module 3
Warning
Order of quantifiers is essential!
Big difference:
(∀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)
(∃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 14/09/09
DKS - Module 3
18
Quantifiers in finite domains
When the domain is finite,
say {a1, …, an}, the universal and existential quantifiers
are a abbreviation for the finite conjunction resp.
disjunction:
(∀x)A(x) = A(a1) ∧ … ∧ A(an)
(∃x)A(x) = A(a1) ∨ … ∨ A(an)
37 14/09/09
DKS - Module 3
Relation between ∀ and ∃
(∃x)A(x) ↔ ¬(∀x)¬A(x)
(∀x)A(x) ↔ ¬(∃x)¬A(x)
38 14/09/09
DKS - Module 3
19
Inference
How to reason (deduce new facts) with predicate logic
Modus ponens
Universal Elimination (Syllogism)
(∀x) P(x) → Q(x)
P(a)
∴ Q(a)
where x ∈ X, a ∈ X
E.g (all kids like ice-cream) and (Bob is a kid) hold, then
deduce (Bob likes ice-cream)
Exercise: translate into predicate logic!
39 14/09/09
DKS - Module 3
Examples of Translations
Old men are wise
(∀x)[(old(x) ∧ man(x)) → wise(x)]
When a man loves a woman, they are happy
(∀x)(∃y)[(man(x) ∧ woman(y) ∧ loves(x,y)) → (happy(x) ∧ happy(y))]
Everyone loves Piet
(∀x)[loves(x,piet)]
Some farmers beat the donkey
(∃x)[farmer(x) ∧ beats(x,donkey)]
Some farmers beat their donkeys
(∃x)(∀y)[(farmer(x) ∧ donkey(y) ∧ owns(x,y)) → beats(x,y)]
40 14/09/09
DKS - Module 3
20
Next module:
Rule Based Systems
(22 September 2007)
41 14/09/09
DKS - Module 3
42 14/09/09
DKS - Module 3
21
Related docs
Other docs by Civet
Get documents about "