Download First-Order Logic: Semantics & Inference - A Comprehensive Guide and more Slides Artificial Intelligence in PDF only on Docsity!
First-Order Logic
Semantics & Inference
Review Chapters 8.3-8.5, Read 9.1-9.2 (optional: 9.5)
Next Lecture Read Chapters 13, 14.1-14.
Semantics: Worlds
- red, round, bogus, prime, multistoried, beautiful
– Properties (a relation of arity 1):
occurred after
- brother-of, bigger than, inside, part-of, has color,
– Relations:
- father-of, best friend, third inning of, one more than
– Functions on individuals:
- Clock A, John, 7, the-house in the corner, Macca
numbers, colors, baseball games, wars, centuries
– Objects in the world, individuals: people, houses,
objects
– There are relations and functions between these
properties.
• The world consists of objects that have
- Sentences are true with respect to a model and an
interpretation
- Model contains objects (domain elements) and relations
among them
- Interpretation specifies referents for constant symbols → objects
predicate symbols → relations
function symbols → functional relations
- An atomic sentence predicate(term 1 ,...,term (^) n) is true
iff the objects referred to by term 1 ,...,term n
are in the relation referred to by predicate
Truth in first-order logic
- Models are formal worlds within which truth can be evaluated
- Interpretations map symbols in the logic to the world
- Constant symbols in the logic map to objects in the world
- n-ary functions/predicates map to n-ary functions/predicates in the world
- We say m is a model given an interpretation i of a sentence α
if and only if α is true in the world m under the mapping i.
- M(α) is the set of all models of α
- Then KB ╞ α iff M(KB) ⊆ M( α)
- E.g. KB, = “Mary is Sue’s sister and Amy is Sue’s daughter.”
- α = “Mary is Amy’s aunt.” (Must Tell it about mothers/daughters)
- Think of KB and α as constraints, and models as states.
- M(KB) are the solutions to KB and M(α) the solutions to α.
- Then, KB ╞ α, i.e., ╞ (KB ⇒ a) ,
when all solutions to KB are also solutions to α.
Review: Models (and in FOL, Interpretations)
Models for FOL: Example
An interpretation maps all symbols in KB onto matching symbols in a possible world. All possible interpretations gives a combinatorial explosion of mappings. Your job, as a Knowledge Engineer, is to write the axioms in KB so they are satisfied only under the intended interpretation in your own real world.
All possible interpretations will map all of these symbols in the logic onto symbols in the domain in all possible ways.
Summary of FOL Semantics
- A well-formed formula (“wff”) FOL is true or false with respect to a world and an interpretation (a model).
- The world has objects, relations, functions, and predicates.
- The interpretation maps symbols in the logic to the world.
- The wff is true if and only if (iff) its assertion holds among the objects in the world under the mapping by the interpretation.
- Your job, as a Knowledge Engineer, is to write sufficient KB axioms that ensure that KB is true in your own real world under your own intended interpretation. - The KB axioms must rule out other worlds and interpretations.
Conversion to CNF contd.
3. Standardize variables: each quantifier should use a
different variable
∀x [∃y Animal ( y ) ∧ ¬ Loves ( x,y )] ∨ [∃z Loves ( z,x )]
4. Skolemize: a more general form of existential
instantiation. Each existential variable is replaced by a Skolem
function of the enclosing universally quantified variables:
∀x [ Animal ( F ( x )) ∧ ¬ Loves ( x,F ( x ))] ∨ Loves ( G ( x ), x )
5. Drop universal quantifiers:
[ Animal ( F ( x )) ∧ ¬ Loves ( x,F ( x ))] ∨ Loves ( G ( x ), x )
6. Distribute ∨ over ∧ :
[ Animal ( F ( x )) ∨ Loves ( G ( x ), x )] ∧ [¬ Loves ( x,F ( x )) ∨ Loves ( G ( x ), x )]
Unification
- Recall: Subst(θ, p) = result of substituting θ into sentence p
- Unify algorithm: takes 2 sentences p and q and returns a unifier if one exists
Unify(p,q) = θ where Subst(θ, p) = Subst(θ, q)
- Example: p = Knows(John,x) q = Knows(John, Jane)
Unify(p,q) = {x/Jane}
Unification
- To unify Knows(John,x) and Knows(y,z) ,
θ = {y/John, x/z } or θ = {y/John, x/John, z/John}
- The first unifier is more general than the second.
- There is a single most general unifier (MGU) that is unique up to renaming of variables.
MGU = { y/John, x/z }
- General algorithm in Figure 9.1 in the text
Unification Algorithm
Unification Algorithm
If we can unify a variable then do so.
Unification Algorithm
If we already have bound variable var to a value, try to continue on that basis.
There is an implicit assumption that “{var/val } ∈ θ”, if it succeeds, binds val to the value that allowed it to succeed,
Unification Algorithm
If var occurs anywhere within x , then no substitution will succeed.
Unification Algorithm
Else, try to bind var to x , and recurse.