logics ai
TRANSCRIPT
-
8/8/2019 logics AI
1/21
1
Introduction to Logic
Overview:What is Logic?
Propositional Logic
Predicate Logic
Literature:
Handouts: (J. Kelly)The Essence of Logic:
chapter 1 (not 1.6)
chapter 6
2 20-11-2007 DKS - Module 3
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 oflogic"
the principles that guide reasoning within a given field orsituation: "economic logic requires it"; "by the logic of war"
a system of reasoning
-
8/8/2019 logics AI
2/21
3 20-11-2007 DKS - Module 3
Socrates is mortal
All man are mortalSocrates is a man
Aristotoles (384322 B.C.)
The instrument (the "organon") by means ofwhich we come to know anything.
formal rules for correct reasoning
Syllogism:
4 20-11-2007 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 simplysay: Let us calculate [calculemus]!
-
8/8/2019 logics AI
3/21
5 20-11-2007 DKS - Module 3
Criticism to logic
logic is not a model of reasoning at all but is more ameans of constraining the reasoning process; we [people]dont solve problems using logic, we just use it to explainour solutions.
[Marvin Minsky]
6 20-11-2007 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 statementssyntactically from a set of premises
Logic can provide explanations for answers By tracing a proof that leads to a logical consequence
-
8/8/2019 logics AI
4/21
7 20-11-2007 DKS - Module 3
Uses of Logic
Argumentation
Inference (systems)
Cognitive psychology & AI descriptive use of logic
Normative systems prescriptive use of logic
Knowledge representation
8 20-11-2007 DKS - Module 3
Warning!
Meta-language Different levels
Abstraction
Difference to everyday use of concepts Temporal, causal, relations
-
8/8/2019 logics AI
5/21
9 20-11-2007 DKS - Module 3
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 detailedthan predicate logic.
Propositional/predicate logic are unique in the sense thatsound and complete proof systems do exist.
Not for more expressive logics (higher-order logics)
10 20-11-2007 DKS - Module 3
Reasoning = Reach valid conclusions
Reasoning is valid (deduction, syllogism)
Nothing is said about the actual truth of premisses!
The concern of logic is that
never a false conclusion can be reached from truepremises!
Socrates is mortal
All man are mortal
Socrates is a man
Socrates has blue skin
All man have blue skin
Socrates is a man
-
8/8/2019 logics AI
6/21
11 20-11-2007 DKS - Module 3
Propositional Logic
Truth Tables
Logical equivalence
Tautology
Contradiction
12 20-11-2007 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 andconnectives
-
8/8/2019 logics AI
7/21
13 20-11-2007 DKS - Module 3
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
14 20-11-2007 DKS - Module 3
Truth tables
Truth tables give the operational definition of logicalconnectives List ALL possible cases
Example, for negation :
F
T
AA
F
T
-
8/8/2019 logics AI
8/21
15 20-11-2007 DKS - Module 3
V( ) =
Truth table for AND ()
TT
FT
TF
FF
ABBA
F
F
F
T
(1+1 = 2) (the sun is a star) T
16 20-11-2007 DKS - Module 3
V( ) =
Truth table for OR ()
TT
FT
TF
FF
ABBA
F
T
T
T
(1+1 = 2) (the sun is a planet) T
-
8/8/2019 logics AI
9/21
17 20-11-2007 DKS - Module 3
V( ) =
Truth table for implication ()
TT
FT
TF
FF
ABBA
T
T
F
T
(the sun is a planet) (1+1 = 3)
(dog is animal) (dog breaths)
T
V( ) = T
18 20-11-2007 DKS - Module 3
Truth table for iff ()
TT
FT
TF
FF
ABBA
T
F
F
T
(the sun is a star) (1+1 = 2)V( ) = T
-
8/8/2019 logics AI
10/21
19 20-11-2007 DKS - Module 3
Remarks on implication
Implication in propositional logic is different from its use innatural language Temporal issues
Causal relations
Implication in propositional logic refers to the truth valuesof the atoms!
E.g. compare: Ifthe moon is made of cheese then it is tasty
Ifthe moon is made of cheese then 2 x 2 = 5
Both are true, but the first sounds more logical!!
20 20-11-2007 DKS - Module 3
Tautology and contradiction
Tautology A logical expression that has truth value T is all cases
Contradiction A logical expression that has truth value F is all cases
-
8/8/2019 logics AI
11/21
21 20-11-2007 DKS - Module 3
Example: tautology
TTTFFTTTT
TTTTFTFTT
TTFFTFTFT
TTTTTFFFT
TTTFFFTTF
TTTTFFFTF
TTFFTFTFF
TTTTTFFFF
(AB) (C(BC))C(BC)BCCBABCBA
(AB) (C(BC))
22 20-11-2007 DKS - Module 3
Example: tautology
TTTFFTTTT
TTTTFTFTT
TTFFTFTFT
TTTTTFFFT
TTTFFFTTF
TTTTFFFTF
TTFFTFTFF
TTTTTFFFF
(AB) (C(BC))C(BC)BCCBABCBA
(AB) (C(BC))
-
8/8/2019 logics AI
12/21
23 20-11-2007 DKS - Module 3
Example: Contradiction
FFT
FTF
AAAA
24 20-11-2007 DKS - Module 3
Logical equivalence
Two logical expressions are logically equivalent ifthey 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
-
8/8/2019 logics AI
13/21
25 20-11-2007 DKS - Module 3
Example
TTT
FFT
FTF
FFF
ABBA
TFFFTT
FTTFFT
FTFTTF
FTTTFF
(AB)ABBABA
26 20-11-2007 DKS - Module 3
Example
TTT
FFT
FTF
FFF
ABBA
TFFFTT
FTTFFT
FTFTTF
FTTTFF
(AB)ABBABA
Conclusion:
A B (A B)
-
8/8/2019 logics AI
14/21
27 20-11-2007 DKS - Module 3
Equivalence laws
A 0 0
A 1 A
A 0 A
A 1 1
A A A
A A A
28 20-11-2007 DKS - Module 3
Equivalence laws
A 0 0
A 1 A
A 0 A
A 1 1
A A A
A A A
A A 0
A A 1
A A
A B B A
A B B A
A (A B) A
A (A B) A
A (A B) A B
A (A B) A B
(A B) (A B) A
A B A B
A B (A B)
-
8/8/2019 logics AI
15/21
29 20-11-2007 DKS - Module 3
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.
30 20-11-2007 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
-
8/8/2019 logics AI
16/21
31 20-11-2007 DKS - Module 3
Predicate logic
Objects, predicates, functions
Quantifiers
1st order language
Substitutions, interpretations
32 20-11-2007 DKS - Module 3
Syllogistic reasoning as
cannot be expressed in propositional logic
Socrates is mortal
Syllogistic reasoning
All man are mortal
Socrates is a man
-
8/8/2019 logics AI
17/21
33 20-11-2007 DKS - Module 3
Objects, predicates, quantifiers
Needed: Objects, such as Socrates
Predicates, such as mortal
Quantifiers, such as all
Formally: x : M(x) S(x)
M(s)
S(s)
or:
x : man(x) mortal(x)man(socrates)mortal(socrates)
34 20-11-2007 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)
-
8/8/2019 logics AI
18/21
35 20-11-2007 DKS - Module 3
Often used formulas
All A are B:
For all x: ifx 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))
36 20-11-2007 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)
-
8/8/2019 logics AI
19/21
37 20-11-2007 DKS - Module 3
Quantifiers in finite domains
When the domain is finite,say {a1, , an}, the universal and existential quantifiersare a abbreviation for the finite conjunction resp.disjunction:
(x)A(x) = A(a1) A(an)
(x)A(x) = A(a1) A(an)
38 20-11-2007 DKS - Module 3
Relation between and
(x)A(x) (x)A(x)
(x)A(x) (x)A(x)
-
8/8/2019 logics AI
20/21
39 20-11-2007 DKS - Module 3
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!
40 20-11-2007 DKS - Module 3
Next module:
Rule Based Systems
(27 november 2007)
-
8/8/2019 logics AI
21/21
41 20-11-2007 DKS - Module 3