190 likes | 296 Views
Limitations of Prop. Logic. Cumbersome for large domains: Man-Abraham, Man-Isaac, Man-Jacob Woman-Sara, Woman-Rachel, Woman-Leah Man-Abraham Human-Abraham Woman-Sara Human-Sara Cannot deal with infinite domains. We’d like to say: Abraham, Sara etc. are objects.
E N D
Limitations of Prop. Logic • Cumbersome for large domains: • Man-Abraham, Man-Isaac, Man-Jacob • Woman-Sara, Woman-Rachel, Woman-Leah • Man-Abraham Human-Abraham • Woman-Sara Human-Sara • Cannot deal with infinite domains. • We’d like to say: • Abraham, Sara etc. are objects. • for all X, Man(X) Human(X) • for all n, Integer(n) Integer(n+1).
If your thesis is entirely vacuous, add a few formulas in predicate calculus. - famous disgruntled advisor
First Order Logic (FOPC) • We identify the objects in our domain. • Abraham, Sara, Isaac, Rachel, • Father-of(Isaac), Mother-of(Isaac). • Predicates specify properties of objects, and tuples of objects: • Man(Abraham), Woman(Sara), • Married(Abraham, Sara). • Quantified formulas: • X Man(X) Human(X) • X Y Loves(Y,X).
FOL Definitions • Constants: a,b, dog33, Abraham. • Name a specific object. • Variables: X, Y. • Refer to an object without naming it. • Functions: dad-of • Mapping from objects to objects. • Terms: father-of(mother-of(dog33)) • Refer to objects • Atomic Sentences: in(father-of(dog33), h1) • Can be true or false • Correspond to propositional symbols P, Q
More Definitions • Logical connectives: , , • Quantifiers: • For all • There exists • Examples • Abraham is a man. • All professors wear glasses. • Every person is loved by someone who isn’t their mother.
Quantifier / Connective Interaction E(x) == “x is an elephant” G(x) == “x has the color grey” • x E(x) G(x) • equivalent to x E(x) x G(x)? • x E(x) G(x) • equivalent to x E(x) x G(x)? • x E(x) G(x) • x E(x) G(x) • x E(x) G(x)
Nested Quantifiers: Order matters! • Examples • Every dog has a tail • Someone is loved by everyone xy P(x,y) yx P(x,y)
FOPC Semantics • An interpretation includes: • A non-empty universe of discourse, O • A mapping from the constants to elements of O. • For every function symbol of arity n, a mapping from O n to O. • For every predicate symbol of arity n, a subset of O n. • We can now define the truth value of every well formed formula. • If an interpretation I satisfies a formula S, we say that I is a model of S.
When is a formula satisfied? • Define I |= S:
Example • X, Person(X) (Man(X) Woman(X)) • Person(Pam) • Man(Pam) • Woman(Rex)
Entailment (first order) • A knowledge base KB entails a sentence S, if S is satisfied in model of KB: • For every I, if I |= KB, then I |= S. • Unlike propositional logic, we cannot exhaustively check every interpretation. • Satisfiability and validity of a knowledge base are defined as before. • KB |= S if and only if {KB S} is not satisfiable.
Decidability of Entailment • In general, deciding satisfiability (and hence, entailment) is semi-decidable. • It is decidable if every sentence has at most 2 variables, but undecidable with 3 or more. • Subsets of FOL are decidable: • No function symbols • Horn with no function symbols (a.k.a. Datalog) • Description Logics (Friday) • Resolution is refutation complete (but may go on forever with a satisfiable KB).
Unification • Useful for first order inference x,y,z edge(x,z) path(z,y) path(x,y) x,y edge(x,y) edge(y,x) path(x,x) • Queries: • path(a,b) • path(a,a) • path(a, parent(a)) • To determine which rules are applicable, we need to unify the query and the rule heads. Unify(path(a,b), path(x,y)) returns:
Unification Examples • Unify(road(?a, kent), road(seattle, ?b)) • Unify(road(?a, ?a), road(seattle, kent)) • Unify(f(g(?x, dog), ?y)), f(g(cat, ?y), dog) • Unify(f(g(?x)), f(?x))
Skolemization • We want to transform formulas to a canonical form: X,Y,Z {P(X) Q(Y) R(Z,Y)} • Sometimes, it’s easy: x,y,z edge(x,z) path(z,y) path(x,y) • {edge(x,z), path(z,y), path(x,y) } • What about: X, Woman(X) ? • We invent a new Skolem constant: • Woman (the-woman). • How about Y X Loves(X,Y)? • Loves(f(Y), Y).
A B C, C D E A B D E Resolution • First, convert all formulas to CNF (possibly Skolemizing). • Negate the query. • Iterate: • Let f be the mgu of C and C • Then, we can derive the clause • f(A) f(B) f(D) f(E)
Example Resolution • X (Dem(X) Rep(X)) • X (Dem(X) Rep(X)) • X Rep(X) Z (Know(X,Z) Rep(Z)) • X Know(A,Z) Dem(Z) • Query: Dem(A)?
Example Resolution: Clauses • X (Dem(X) Rep(X)) • { Dem(X), Rep(X)} • X (Dem(X) Rep(X)) • {Dem(X), Rep(X)} • X Rep(X) Z (Know(X,Z) Rep(Z)) • {Rep(X), Know(x, f(x)}, {Rep(X), Rep(f(X)} • X Know(A,Z) Dem(Z) • {Know(A,Z), Dem(Z)} • Dem(A)? • {Dem(A)}
Example: Resolve Away... • {Dem(X), Rep(X)} • {Dem(X), Rep(X)} • {Rep(X), Know(x, f(x)}, • {Rep(X), Rep(f(X)} • {Know(A,Z), Dem(Z)} • {Dem(A)}