Beruflich Dokumente
Kultur Dokumente
Introduction
Outline
• Symbolic AI
• Some Applications of Propositional Logic
• Propositional Logic
• Syntax
• Semantic
• Truth Table
• Inference rules
• Limitations of Propositional Logic
Symbolic AI
• AI relies on the Physical Symbol System Hypothesis:
Intelligent activity is achieved through the use of
• symbol patterns to represent the problem
• operations on those patterns to generate potential solutions
• search to select a solution among the possibilities
• Systematic
Some Applications:
&
R
1
Formal Languages and Commitments
Language Ontological Epistemological
Commitment Commitment
• Remarks:
– Induction means to infer generalized knowledge from example
observations: Induction is the inference mechanism for (machine)
learning.
Basic Types of Inferences: Abduction
• Abduction: From a known axiom (theory) and some
observation, derive a premise.
• Example:
• Remarks:
– Abduction is typical for diagnostic and expert systems.
• If one has the flue, one has moderate fewer.
• Patient X has moderate fewer.
• Therefore, he has the flue.
– Strong relation to causation
Deduction
• Deductive inferences are also called theorem
proving or logical inference.
– Deduction is truth preserving: If the premises (axioms
and facts) are true, then the conclusion (theorem) is
true.
• To perform deductive inferences on a machine, a
calculus is needed:
– A calculus is a set of syntactical rewriting rules defined
for some (formal) language. These rules must be sound
and should be complete.
Proposition
• A proposition is a symbolic variables whose value must
be either True or False, and which stands for a natural
language statement which could be either true or false
Examples:
A = Smith has chest pain
B = Smith is depressed
C = it is raining
Propositional Logic
Representing simple facts
It is raining
RAINING
It is sunny
SUNNY
It is windy
WINDY
If it is raining, then it is not sunny
RAINING → ¬SUNNY
Propositional Logic
Vocabulary
A set of propositional symbols
P, Q, R, ….
Logical constants
True, False
Propositional Logic
Each symbol P, Q, R etc is a (atomic) sentence
Both True and False are (atomic) sentences
A sentence enclosed in parentheses is a sentence
ComplexSentence → (Sentence )
| ¬ Sentence
Connective → ∧|∨|⇒|⇔
P (P ∧ ¬ Q) ⇒ R
True (P ∧ Q) ⇔ (Q ∧ P)
(P ∧ Q) (P ∨ R )
P means it is hot
P∨Q means either is hot or it is raining (or both)
¬Q means that it is not raining
Well- Formed Formulas
• Formula
A term (string) in propositional logic.
• Variables: P,Q,R
• If a and b are WFF, a ∧ b are WFF
• If a and b are WFF, a ∨ b are WFF
• If a and b are WFF, a →b are WFF
• If a and b are WFF, a ↔b are WFF
39
Models
• if there is an interpretation for a sentence such that
the sentence is true in a particular world, that world is
called a model
– refers to specific interpretations
KB |= α
• inference rules allow the construction of new sentences from
existing sentences
¬¬Irish
¬¬ |- Irish
If we know not not Irish is true, we can infer that
Irish is true. Read as
Not not Irish, Therefore Irish
• satisfiability
– a sentence is satisfiable if there is some interpretation in some world state (a
model) such that the sentence is true
• a sentence is satisfiable iff its negation is not valid
• a sentence is valid iff its negation is not satisfiable
Computational Inference
• computers cannot reason informally (“common sense”)
– they don’t know the interpretation of the sentences
– they usually don’t have access to the state of the real world to
check the correspondence between sentences and facts
• computers can be used to check the validity of sentences
– “if the sentences in a knowledge base are true, then the
sentence under consideration must be true, regardless of its
possible interpretations”
– can be applied to rather complex sentences
Computational Approaches
to Inference
• model checking based on truth tables
– generate all possible models and check them for validity or satisfiability
– exponential complexity, NP-complete
• all combinations of truth values need to be considered
• search
– use inference rules as successor functions for a search algorithm
– also exponential, but only worst-case
• in practice, many problems have shorter proofs
• only relevant propositions need to be considered
Validity and Inference
• truth tables can be used to test sentences for
validity
– one row for each possible combination of truth
values for the symbols in the sentence
– the final value must be True for every sentence
– a variation of the model checking approach
– not very practical for large sentences
sometimes used with customized improvements in
specific domains, such as VLSI design
Validity and Computers
• the computer has no access to the real world, and can’t
check the truth value of individual sentences (facts)
– humans often can do that, which greatly decreases the
complexity of reasoning
– humans also have experience in considering only important
aspects, neglecting others
• if a conclusion can be drawn from premises, independent of
their truth values, then the sentence is valid
– usually too tedious for humans
– may exclude potentially interesting sentences
• some, but not all interpretations are true
Propositional Logic: Proofs
61
Sound rules of inference
• Here are some examples of sound rules of inference
– A rule is sound if its conclusion is true whenever the premise is true
• Each can be shown to be sound using a truth table
RULE PREMISE CONCLUSION
Modus Ponens A, A → B B
And Introduction A, B A∧B
And Elimination A∧B A
Double Negation ¬¬A A
Unit Resolution A ∨ B, ¬B A
Resolution A ∨ B, ¬B ∨ C A∨C
62
Soundness of modus ponens
A B A→ B OK?
True True True
√
True False False
√
False True True
√
False False True
√
63
Soundness of the
resolution inference rule
64
Proving things
• A proof is a sequence of sentences, where each sentence is
either a premise or a sentence derived from earlier sentences
in the proof by one of the rules of inference.
• The last sentence is the theorem (also called goal or query)
that we want to prove.
• Example for the “weather problem” given above.
1 Humid Premise “It is humid”
67
Two important properties for inference
Soundness: If KB |- Q then KB |= Q
– If Q is derived from a set of sentences KB using a
given set of rules of inference, then Q is entailed by
KB.
– Hence, inference produces only real entailments, or
any sentence that follows deductively from the
premises is valid.
Completeness: If KB |= Q then KB |- Q
– If Q is entailed by a set of sentences KB, then Q can
be derived from KB using the rules of inference.
– Hence, inference produces all entailments, or all valid
sentences can be proved from the premises.
68
Soundness and Completeness
• A rule A1 …… An is said to be sound if for every B
Suppose we want to encode the fact that all men are mammals,
we have no choice but to list that fact for each individual man in
the knowledge base
P means Paul is a mammal
Q means Quentin is a mammal
R means Robert is a mammal
S means Steve is a mammal
etc etc
What we really need is a compact way represent these kinds of
facts….
Validity != Provability
• Goldbach’s conjecture: Every even number (>2) is
the sum of 2 primes.
• This is either valid or not.
• It may not be provable.
• Godel: No axiomization of arithmetic will be
complete, i.e. always valid statements that are not
provable.
Limitation of Propositional logic
• Theorem proving is decidable
• The propositional calculus has its limitations
• cannot deal properly with general statements of the
form:-
All men are mortal.
• You cannot derive from the conjunction of this and “
Devindra is a man” that..
Devindra is mortal.
• Cannot represent objects and quantification
Limitations
• If all men are mortal =P
• Devindra is a man = Q
• Devindra is mortal =R
Then (P & Q) → R is not valid
To do this, you need to analyze propositions into
predicates and arguments and delay explicitly with
quantification.
Limitations of Propositional Logic
• number of propositions
– since everything has to be spelled out explicitly, the number of rules is
immense
• dealing with change (monotonicity)
– even in very simple worlds, there is change
– the agent’s position changes
– time-dependent propositions and rules can be used
• even more propositions and rules
• propositional logic has only one representational device, the
proposition
– difficult to represent objects and relations, properties, functions,
variables, ...
Implies =>
• If 2+2 = 5 then monkeys are cows. TRUE
• If 2+2 = 5 then cows are animals. TRUE
• Indicates a difference with natural reasoning. Single
incorrect or false belief will destroy reasoning. No
weight of evidence.
Inference
• Does s1,..sk entail s?
• Say variables (symbols) v1…vn.
• Check all 2^n possible worlds.
• In each world, check if s1..sk is true, that s is true.
• Approximately O(2^n).
• Complete: possible worlds finite for propositional
logic, unlike for arithmetic.
What can’t we say?
• Quantification: every student has a father.
• Relations: If X is married to Y, then Y is married to
X.
• Probability:There is an 80% chance of rain.
• Combine Evidence: This car is better than that
one because…
• Uncertainty: Maybe John is playing golf.
Propositional logic is a weak language
• Hard to identify “individuals” (e.g., Mary, 3)
• Can’t directly talk about properties of individuals or
relations between individuals (e.g., “Bill is tall”)
• Generalizations, patterns, regularities can’t easily be
represented (e.g., “all triangles have 3 sides”)
• First-Order Logic (abbreviated FOL or FOPC) is
expressive enough to concisely represent this kind of
information
FOL adds relations, variables, and quantifiers, e.g.,
•“Every elephant is gray”: ∀ x (elephant(x) → gray(x))
•“There is a white alligator”: ∃ x (alligator(X) ^ white(X))
79
Example
• Consider the problem of representing the
following information:
– Every person is mortal.
– Confucius is a person.
– Confucius is mortal.
• How can these sentences be represented so
that we can infer the third sentence from the
first two?
80
Example II
• In PL we have to create propositional symbols to stand for all or part
of each sentence. For example, we might have:
P = “person”; Q = “mortal”; R = “Confucius”
• so the above 3 sentences are represented as:
P → Q; R → P; R → Q
• Although the third sentence is entailed by the first two, we needed an
explicit symbol, R, to represent an individual, Confucius, who is a
member of the classes “person” and “mortal”
• To represent other individuals we must introduce separate symbols
for each one, with some way to represent the fact that all individuals
who are “people” are also “mortal”
81
Some Applications of
Propositional Logic
SUDOKU
1 2 3 4 5 6 7 8 9
1
2
3
4
5
6
7
8
9
Mathematical models
Dutch Soccer League
• if Eindhoven and Amsterdam play on the same day the TV income is
x
• If Eindhoven and Amsterdam play on two different days, the income
is 2x
• if a team plays on Wednesday champions league it doesn’t play on
Friday
• there are at most 3 plays on Friday
• ….. in sum several thousand constraints over LP and Boolean
variables
88