pREPOSITIONAL LOGIC
pREPOSITIONAL LOGIC
First-Order Logic
Chapter 7.4─7.8, 8.1─8.3, 8.5
Some material adopted from notes by Andreas Geyer-Schulz and Chuck Dyer
Logic roadmap overview
• Propositional logic (review)
• Problems with propositional logic
• First-order logic (review)
– Properties, relations, functions, quantifiers, …
– Terms, sentences, wffs, axioms, theories, proofs, …
• Extensions to first-order logic
• Logical agents
– Reflex agents
– Representing change: situation calculus, frame problem
– Preferences on actions
– Goal-based agents
Disclaimer
A B A→B OK?
True True True
True False False
(P Q) = (P Q)
Significance of Horn logic
• We can also have horn sentences in FOL
• Reasoning with horn clauses is much simpler
– Satisfiability of a propositional KB (i.e., finding
values for a symbols that will make it true) is NP
complete
– Restricting KB to horn sentences, satisfiability is in P
• For this reason, FOL Horn sentences are the basis
for Prolog and Datalog
• What Horn sentences give up are handling, in a
general way, (1) negation and (2) disjunctions
Entailment and derivation
• Entailment: KB |= Q
– Q is entailed by KB (set sentences) iff there is no
logically possible world where Q is false while all the
sentences in KB are true
– Or, stated positively, Q is entailed by KB iff the
conclusion is true in every logically possible world in
which all the premises in KB are true
• Derivation: KB |- Q
– We can derive Q from KB if there’s a proof consisting
of a sequence of valid inference steps starting from the
premises in KB and resulting in Q
Two important properties for inference
Soundness: If KB |- Q then KB |= Q
– If Q is derived from 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 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
Problems with
Propositional
Logic
Propositional logic: pro and con
• Advantages
– Simple KR language sufficient for some problems
– Lays the foundation for higher logics (e.g., FOL)
– Reasoning is decidable, though NP complete, and
efficient techniques exist for many problems
• Disadvantages
– Not expressive enough for most problems
– Even when it is, it can very “un-concise”
PL is a weak KR 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 (FOL) is expressive enough to
represent this kind of information using 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))
PL 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?
PL Example
• In PL we have to create propositional symbols to stand for
all or part of each sentence, e.g.:
P = “person”; Q = “mortal”; R = “Confucius”
• The above 3 sentences are represented as:
P Q; R P; R Q
• The 3rd sentence is entailed by the first two, but we need an
explicit symbol, R, to represent an individual, Confucius,
who is a member of the classes person and mortal
• Representing other individuals requires introducing separate
symbols for each, with some way to represent the fact that all
individuals who are “people” are also “mortal”
Hunt the Wumpus domain
• Some atomic propositions:
S12 = There is a stench in cell (1,2)
B34 = There is a breeze in cell (3,4)
W22 = Wumpus is in cell (2,2)
V11 = We’ve visited cell (1,1)
OK11 = Cell (1,1) is safe.
…
• Some rules:
(R1) S11 W11 W12 W21
(R2) S21 W11 W21 W22 W31
(R3) S12 W11 W12 W22 W13
(R4) S12 W13 W12 W22 W11
…