Title: First-Order Classical Deduction
1First-Order Classical Deduction
2Outline
- Classical First-Order Logic (CFOL)
- Syntax
- Full CFOL
- Implicative Normal Form CFOL (INFCFOL)
- Horn CFOL (HCFOL)
- Semantics
- First-order interpretations and models
- Reasoning
- Lifting propositional reasoning to first-order
reasoning - INFCFOL reasoning
- First-order resolution
- An ontology of logics and engines
- Properties of logics
- Commitments, complexity
- Properties of inference engines
- Soundness, completeness, complexity
3Full Classical First-Order Logic (FCFOL) syntax
Syntax
Functor
FCLConnective
FCFOLFormula
FCFOLAtomicFormula
FCFOLTerm
Functor
PredicateSymbol
FCFOLFunctionalTerm
FCFOLNonFunctionalTerm
Functor
Arg
1..
FunctionSymbol
ConstantSymbol
FOLVariable
?X,Y (p(f(X),Y) ? ?q(g(a,b))) ? (?U,V ?Z ((X a)
? r(Z)) ? (U h(V,Z))))
4FCFOL Normal Forms
Implicative Normal Form (INF)
Premisse
Conclusion
FCFOLAtomicFormula
FCFOLTerm
Functor
FCFOLFunctionalTerm
PredicateSymbol
FCFOLNonFunctionalTerm
Functor
FunctionSymbol
ConstantSymbol
FOLVariable
Literal
Conjunctive Normal Form (CNF)
5Horn CFOL (HCFOL)
Implicative Normal Form (INF)
Premisse
Conclusion
IntegrityConstraint
context IntegrityConstraint inv IC
Conclusion.ConstantSymbol false
DefiniteClause
context DefiniteClause inv DC Conclusion.Constant
Symbol ? false
Fact
context Fact inv Fact Premisse -gt size() 1 and
Premisse -gt ConstantSymbol true
FCFOLAtomicFormula
Conjunctive Normal Form (CNF)
Literal
IntegrityConstraint
context IntegrityConstraint inv IC
Literal-gtforAll(oclIsKindOf(NegativeLiteral))
DefiniteClause
context DefiniteClause inv DC Literal.oclIsKindOf
(ConstantSymbol)-gtsize() 1
Fact
context Fact inv Fact Literal-gtforAll(oclIsKindOf
(ConstantSymbol))
6FCFOL semantics cognitive interpretations
Syntax
FCFOLFormula
FCFOLAtomicFormula
FCFOLTerm
FCFOLNonGroundTerm
FCFOLFunctionalTerm
FCFOLNonFunctionalTerm
ConstantSymbol
FOLVariable
PredicateSymbol
FunctionSymbol
FCFOLGroundTerm
Semantics
7FCFOL semantics cognitive interpretations
Syntax
FCFOLFormula
FCFOLAtomicFormula
FCFOLTerm
FCFOLNonGroundTerm
FCFOLFunctionalTerm
FCFOLNonFunctionalTerm
PredicateSymbol
FunctionSymbol
ConstantSymbol
FOLVariable
FCFOLGroundTerm
EntitySet
Entity
RelationName
SimpleRelation
ComplexRelation
EntityName
EntityPropertyName
SimpleEntityProperty
ComplexEntityProperty
Semantics
8FCFOL semantics cognitive interpretations
FCFOLFormula
semantics
FCFOLCognitiveInterpretation
TruthMapping
FormulaMapping
AtomMapping
NounGroundTermMapping
GroundTermMapping
PredicateMapping
FunctionMapping
ConstantMapping
9FCFOL semantics Herbrand interpretations
- Herbrand universe Uh of FCFOL formula k
- Set of all terms built from constant and
function symbols appearing in k - Uh(k) t f(t1,...,tn) f ? functions(k), ti
? constants(k) ? Uh(k) - ex k parent(joe,broOf(dan)) ?
parent(broOf(dan),pat) ? (?A,D
anc(A,D) ? (parent(A,D) ? (?P anc(A,P) ?
parent(P,D)))) Uh(k) joe,dan,pat,broOf(joe),b
roOf(dan),broOf(pat),
broOf(broOf(joe), broOf(broOf(dan),
broOf(broOf(pat), ... - Herbrand base Bh of FCFOL formula k
- Set of all atomic formulas built from predicate
symbols appearing in k and Herbrand universe
elements as arguments - Bh a p(t1,...,tn) p ? predicates(k), ti ?
Uh(k) - ex Bh parent(joe,joe), parent(joe,dan),...,
parent(broOf(pat),broOf(pat)),...,
anc(joe,joe), anc(joe,dan),...,
anc(broOf(pat),broOf(pat),...
10FCFOL semantics Herbrand interpretations
- Herbrand interpretation Ih of FCFOL formula k
- Truth valuation of Herbrand base
- Ih(k) Bh(k) ? true,false
- ex parent(joe,joe) false, ...parent(joe,dan)
true, ... parent(broOf(pat),broOf(pat))
false, ... anc(joe,joe) true, ...,
anc(joe,dan) true - Herbrand model Mh of FCFOL formula k
- Interpretation Ih(k) in which k is true
- ex, Mh(k) parent(joe,broOf(dan)) true,
parent(broOf(dan),pat) true,
anc(joe,brofOf(dan)) true,
anc(joe,pat) true, all
others members of Bh(k) false
11FCFOL semantics Herbrand interpretations
Syntax
FCFOLFormula
FCFOLAtomicFormula
FCFOLTerm
FCFOLNonGroundTerm
FCFOLFunctionalTerm
FCFOLNonFunctionalTerm
PredicateSymbol
FunctionSymbol
ConstantSymbol
FOLVariable
FCFOLGroundTerm
Semantics
12Reasoning in CFOL
- Key difference between CFOL and CPL?
- Quantified variables which extend expressive
power of CPL - Ground terms do not extend expressive power of
CPL - Alone, they are merely syntactic sugar
- i.e, clearer for the knowledge engineer but
equivalent to constant symbols for an inference
engine - ex, anc(joe,broOf(dan)) ? ancJoeBroOfDan,
loc(agent,step(3),coord(2,2)) ? locAgent3_2_2 - How to reason in CFOL?
- Reuse CPL reasoning approaches, principles and
engines! - Fully (formulas propositionalization)
- transforms CFOL formulas into CPL formulas as
preprocessing step - Partially (inference method generalization)
- lift CPL reasoning engines with new, variable
handling component (unification) - all CPL approaches free of exhaustive truth value
enumeration can be lifted to CFOL
13Propositionalization
- Variable substitution function Subst(?,k)
- Given a set ? of pairs variable/constant,
- Subst(?,k) formula obtained from k by
substituting its variables with their associated
constants in ? - Subst(X/a,Y/b, ?X,Y,Z p(X,Y) ? q(Y,Z)) ? (?Z
p(a,b) ? q(b,Z)) - Substitutes CFOL formula k by conjunction of
ground formulas ground(k) generated as follows - For each universally quantified variable X in k
and each v ? Uh(k) - Add Subst(X/v,k) to the conjunction
- For each existentially quantified variable Y in
k - Add Subst(Y/s,k) to the conjunction where s is
a new Skolem ground term, i.e. s ? Uh(k) - Skolem term to eliminate existentially quantified
variable Y in scope of outer universal quantifier
Q must be function of the variables quantified by
Q - ex, ?Y ?X,Z p(X,Y,Z) becomes ?X,Z p(X,a,Z))but
?X,Z ?Y p(X,Y,Z) becomes ?X,Z p(X,f(X,Z),Z)
14Propositionalization
- Get prop(k) from ground(k) by turning each ground
atomic formula into an equivalent constant symbol
through concatenation of its predicate, function
and constant symbol - Example
- k parent(joe,broOf(dan)) ? parent(broOf(dan),pat
) ? (?A,D anc(A,D) ? (parent(A,D) ? (?P
anc(A,P) ? parent(P,D)))) - ground(k) parent(joe,broOf(dan)) ?
parent(broOf(dan),pat) ?
(anc(joe,joe) ? (parent(joe,joe) ?
(anc(joe,s1(joe,joe) ? -
parent(s1(joe,joe),jo
e))) ? (anc(joe,broOf(dan)) ?
(parent(joe,broOf(dan)) ?
(anc(joe,s2(joe,broOf(dan))) ?
parent(s2(joe,broOf(dan)),joe))) ? ...
... (anc(pat,pat) ?
(parent(pat,pat) ? (anc(pat,sn(pat,pat)) ?
parent(sn(pat,pat),pat)))) - prop(k) parentJoeBroOfDan ? parentBroOfDanPat
? (ancJoeJoe ? (parentJoeJoe ?
(ancJoeS1JoeJoe ?
parentS1JoeJoeJoe))) ?
(ancJoeBroOfDan ? (parentJoeBroOfDan ?
(ancJoeS2JoeBroOfDan ?
parentS2JoeBroOfDanJoe
? ... ...
(ancPatPat ? (parentPatPat ? (ancPatSnPatPat ?
parentSnPatPatPat)))
15Propositionalization
- k CFOL k iff prop(k) CPL prop(k)
- Fixed-depth Herbrand base Uh(k,d) f ? Uh(k)
depth(f) d - Fixed-depth propositionalization
- prop(k,d) c1 ? ... ? cn ci built only from
elements in Uh(k,d) - Thm de Herbrand
- prop(k) CPL prop(k) ? ?d, prop(k,d) CPL
prop(k,d) - For infinite prop(k) prove prop(k) CPL prop(k)
iteratively - try proving prop(k,0) CPL prop(k,0),
- then prop(k,1) CPL prop(k,1),
- ...
- until prop(k,d) CPL prop(k,d)
16First-Order Term Unification
Failure by Occur-Check
17Lifted inference rules
- Bi-direction CPL rules trivially lifted as valid
CFOL rules by substituting CPL formulas inside
them by CFOL formulas - Lifted modus ponens
- Subst(?,p1), ..., Subst(?,pn), (p1 ? ... ? pn ?
c) Subst(?,c) - Lifted resolution
- l1 ? ... ? li ? ... lk, m1 ? ... ? mj? ... mk,
Subst(?,li) Subst(?,?mj) Subst(?, l1 ? ... ?
li-1 ? li-1... lk ? m1 ? ... ? mj-1 ? mj-1...
mk) - CFFOL inference methods (theorem provers)
- Multiple lifted inference rule application
- Repeated application of lifted resolution and
factoring - CHFOL inference methods (logic programming)
- First-order forward chaining through lifted
modus ponens - First-order backward chaining through lifted
linear unit resolution guided by negated query as
set of support - Common edge over propositionalization focus on
relevant substitutions
18FCFOL theorem proving by repeated lifted
resolution and factoring example
19Deduction with equality
- Axiomatization
- Include domain independent sub-formulas defining
equality in the KB - (?X X X) ? (?X,Y X Y ? Y X) ? (?X,Y,Z (X
Y ? Y Z) ? X Z) ? (?X,Y X Y ? (f1(X)
f1(Y) ? ... ? fn(X) fn(Y)) ? (?X,Y,U,V (X Y ?
U V) ? f1(X,U) f1(Y,V) ? ... ? fn(X,U)
fn(Y,V)) ?... - (?X,Y X Y ? (p1(X) ? p1(Y) ? ... ? pm(X) ?
pm(Y)) ? - (?X,Y,U,V (X Y ? U V) ? p1(X,U) ? p1(Y,V)
? ... ? pm(X,U) ? pm(Y,V)) ?... - New inference rule (parademodulation)
- l1 ? ... ? lk ? t u, m1 ? ... mn(...,v,...)
Subst(unif(t,v), l1 ? ... ? lk ? m1 ? ...
mn(...,y,...)) - ex,
- Extend unification to check for equality
- ex, if a b c, then p(X,f(a)) unifies with
p(b,f(Xc)) with X/b
20Characteristics of logics and knowledge
representation languages
- Commitments
- ontological meta-conceptual elements to model
agents environment - epistemological meta-conceptual elements to
model agents beliefs - Hypothesis and assumptions
- Unique name or equality theory
- open-world or closed-world
- Monotonicity if KB f, then KB ? g f
- Semantic compositionality
- semantics(a1 c1 a2 c2 ... cn-1 an)
f(semantics(a1), ... ,semantics(an) - ex, propositional logic truth tables define
functions to compute semantics of a formula from
semantics of its parts - Modularity
- semantics(ai) independent from its context in
larger formulas - ex, semantics(a1) independent of semantics(a2),
... , semantics(an) - in contrast to natural language
21Characteristics of logics and knowledge
representation languages
- Expressive power
- theoretical (in terms of language and grammar
theory) - practical concisely, directly, intuitively,
flexibly, etc. - Inference efficiency
- theoretical limits
- practical limits due to availability of
implemented inference engines - Acquisition efficiency
- easy to formulate and maintain by human experts
- possible to learn automatically from data (are
machine learning engines available?)
22Characteristics of logics and knowledge
representation languages
Logic / Knowledge Representation Language Ontological commitment Epistemic commitment Name Hypothesis World Hypothesis Decidable Modular
Classical Propositional Logic facts true, false unique name open yes yes
Classical First-Order Logic entities, relations and functions among entities true, false entity name open semi yes
Classical High-Order Logic entities, relations and functions among entities, relations and functions true, false entity, relation, function name open no yes
Propositional Temporal Logic properties, time points, time intervals true, false unique name open ? yes
Propositional Modal Logic facts true, false, possible, necessary unique name open yes yes
Bayesian Networks facts 0,1 unique name closed yes no
Definite Logic Programs entities, relations and functions among entities true, false unique name closed semi yes
Event Calculus entities, relations and functions among entities, time points, time intervals, events true, false, unknown unique name closed semi /-
23Characteristics of logics and knowledge
representation languages
Logic / Knowledge Representation Language Ontological commitment Epistemic commitment Name Hypothesis World Hypothesis Decidable Modular
UML classes, objects, attributes, methods, associations, generalizations, compositions, aggregations ? ? ? ? yes
OCL classes, objects, ..., invariant constraints, pre and post condition constraints ? ? ? ? yes
Bayesian Logic Programs entities, functions and relations of entities 0,1 unique closed semi no
CHRD entities, functions and relations of entities true, false unique closed semi yes
Transaction Frame Logic classes, objects, attributes, methods, generalizations, entities, functions and relations among entities, functions, relations, classes, objects, attributes, methods, generalizations true, false, unknown object closed semi yes
24Characteristics of inference engines
- Engine inference f -E g, if engine E infers g
from f - Engine E sound for logic L
- f -E g only if f L g
- Engine E fully complete for logic L
- if f L g, then f -E g
- if f ?L g, then (f ? g) -E false
- Engine E refutation-complete for logic L
- if f L g, then f -E g
- but if f ?L g, then either (f ? g) -E false or
inference never terminates (equivalent to halting
problem) - Engine inference complexity exponential,
polynomial, linear, logarithmic in KB size
25Some theoretical results about logics and
inference methods
- Results about logic
- Satisfiability of full classical propositional
logic formula is decidable but exponential - Entailment between two full classical
first-order logic formulas is semi-decidable - Entailment between two full classical high-order
logic formulas is undecidable - Results about inference methods
- Truth-table model checking, multiple inference
rule application resolution-factoring application
and DPLL are sound and fully complete for full
classical propositional logic - WalkSAT sound but fully incomplete for full
classical propositional logic - Forward-chaining and backward chaining sound,
fully complete and worst-case linear for Horn
classical propositional logic - Lifted resolution-factoring sound, refutation
complete and worst case exponential for full
classical first-order logic