Post on 22-Dec-2015
transcript
1
Soundness and Completeness
KB |- S: S is provable from KB.A proof procedure is sound if:
If KB |- S, then KB |= S. That is, the procedure produces only correct
consequences.A proof procedure is complete if:
If KB |= S, then KB |- S. That is, the procedure produces all the consequences.
Ideally, the procedure should be sound and complete. (Ideals are nice in theory).
2
Knock Knock Logic
Who’s there? Joe Mike, Sally
Background knowledge: Mike => Sally
Sally Rita
Hence?
3
Modus Ponens
From A and A B, infer B.A and B can be any sentence.Modus ponens with a few axiom schemas
is sound and complete: A (B A) A (B C) ((A B) (A C)) ( A B) (B A) More in the book.
4
Some Useful Equivalences
P Q is equivalent to: P Q(P Q) is equivalent to: P Q
(P Q) is equivalent to: P Q
5
Normal Forms
CNF = Conjunctive Normal FormConjunction of disjuncts (each disjunct =
“clause”)
(P Q) R
(P Q) R
(P Q) R P Q R
(P Q) R
(P R) (Q R)
6
Resolution
A B C, C D E A B D E
Refutation Complete Given an unsatisfiable KB in CNF, Resolution will eventually deduce the empty clause
Proof by Contradiction To show = Q Show {Q} is unsatisfiable!
9
Computational ComplexityDetermining satisfiability is NP-complete. Even when all clauses have at most 3 literals.Hence, also validity and entailment testing are NP-
complete.But, some recent progress is encouraging!If all clauses have at most 2 literals, it is polynomial.But if the KB is in DNF, satisfiability is polynomial.
What does this tell us about transforming a CNF into a DNF knowledge base?
10
Horn Clauses
If every sentence in KB is of the form:
• Then Modus Ponens is– Polynomial time, and– Complete!
A B C ... F Z
equivalently A B C ... F Z
Clause mean
s a
big disjuncti
on
At most one
positive literal
12
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).
13
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).
14
FOL DefinitionsConstants: 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 objectsAtomic Sentences: in(father-of(dog33), h1)
Can be true or false Correspond to propositional symbols P, Q
15
More DefinitionsLogical connectives: , , Quantifiers:
Forall There exists
Examples Abraham is a man.
All professors wear glasses.
Every person is loved by someone who isn’t their mother.
16
Quantifier / Connective Interaction
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)
E(x) == “x is an elephant”G(x) == “x has the color grey”
17
Nested Quantifiers: Order matters!
Examples Every dog has a tail
Someone is loved by everyone
x y P(x,y) y x P(x,y)
18
If your thesis is entirely vacuous,
add a few formulas in predicate
calculus.
- famous disgruntled advisor
19
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.
20
UnificationUseful for first order inference
a,b city(a) city(b) connected(a,b)city(kent)city(seattle)
Also for compilationEmphasize variables with ?Unify(x, y) return mgu
Unify(city(?a), city(kent)) returns ?a/kent
21
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))