250 likes | 358 Views
First-Order Classical Deduction. Jacques Robin. Outline. 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
E N D
First-Order Classical Deduction Jacques Robin
Outline • 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
FCLUnaryConnective FCLBinaryConnective Arg Arg Connective: enum{} Connective: enum{, , , } 1..* 1..* Arg 1..2 QuantifierExpression Quantifier: enum{,} Full Classical First-Order Logic (FCFOL): syntax Syntax Functor FCLConnective FCFOLFormula FCFOLAtomicFormula FCFOLTerm Functor * FCFOLNonFunctionalTerm FCFOLFunctionalTerm PredicateSymbol Functor Arg 1..* FunctionSymbol FOLVariable ConstantSymbol X,Y (p(f(X),Y) q(g(a,b))) (U,V Z ((X = a) r(Z)) (U = h(V,Z))))
Arg Arg INFCFOLFormula CNFCFOLFormula 1..* 1..* Functor = Functor = CNFCFOLClause INFCFOLClause INFCLPLHS NegativeLiteral INFCLPRHS Functor = Functor = Functor = Functor = Functor = FCFOL Normal Forms Implicative Normal Form (INF) Premisse * * Conclusion FCFOLAtomicFormula FCFOLTerm Functor FCFOLFunctionalTerm * FCFOLNonFunctionalTerm PredicateSymbol * Functor FunctionSymbol FOLVariable ConstantSymbol * * Literal Conjunctive Normal Form (CNF)
CNFCFOLFormula INFCFOLFormula Functor = Functor = INFCFOLClause CNFCFOLClause INFCFOLLHS NegativeLiteral Functor = Functor = Functor = Functor = Horn CFOL (HCFOL) Implicative Normal Form (INF) * Premisse * Conclusion IntegrityConstraint context IntegrityConstraint inv IC: Conclusion.ConstantSymbol = false DefiniteClause context DefiniteClause inv DC: Conclusion.ConstantSymbol false Fact context Fact inv Fact: Premisse -> size() = 1 and Premisse -> ConstantSymbol = true FCFOLAtomicFormula Conjunctive Normal Form (CNF) * * Literal IntegrityConstraint context IntegrityConstraint inv IC: Literal->forAll(oclIsKindOf(NegativeLiteral)) context DefiniteClause inv DC: Literal.oclIsKindOf(ConstantSymbol)->size() = 1 DefiniteClause context Fact inv Fact: Literal->forAll(oclIsKindOf(ConstantSymbol)) Fact
TruthValue Arg Arg Value: enum{true,false} 1..* 1..* Arg 1..2 * EntitySet Entity * RelationName ComplexRelation SimpleRelation EntityName * * * ComplexEntityProperty SimpleEntityProperty EntityPropertyName PredicateMapping ConstantMapping FunctionMapping FCFOL semantics: cognitive interpretations Syntax FCFOLFormula FCFOLAtomicFormula FCFOLTerm FCFOLNonFunctionalTerm FCFOLFunctionalTerm FCFOLNonGroundTerm FOLVariable ConstantSymbol PredicateSymbol FunctionSymbol FCFOLGroundTerm Semantics
TruthValue Arg Arg Value: enum{true,false} 1..* 1..* Arg 1..2 FormulaMapping AtomMapping NounGroundTermMapping GroundTermMapping TruthMapping FCFOL semantics: cognitive interpretations Syntax FCFOLFormula FCFOLAtomicFormula FCFOLTerm FCFOLNonFunctionalTerm FCFOLFunctionalTerm FCFOLNonGroundTerm PredicateSymbol FOLVariable ConstantSymbol FunctionSymbol FCFOLGroundTerm * EntitySet Entity * RelationName ComplexRelation SimpleRelation EntityName * * * ComplexEntityProperty SimpleEntityProperty EntityPropertyName Semantics
FCFOL semantics: cognitive interpretations FCFOLFormula semantics FCFOLCognitiveInterpretation TruthMapping FormulaMapping AtomMapping NounGroundTermMapping GroundTermMapping PredicateMapping FunctionMapping ConstantMapping
FCFOL 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),broOf(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)},...}
FCFOL 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 }
TruthValue Arg Arg Value: enum{true,false} 1..* 1..* Arg 1..2 Herbrandsemantics 1..* HerbrandBase HerbrandUniverse HerbrandInterpretation AtomValuation HerbrandModel FCFOL semantics: Herbrand interpretations Syntax FCFOLFormula FCFOLAtomicFormula FCFOLTerm FCFOLNonFunctionalTerm FCFOLFunctionalTerm FCFOLNonGroundTerm FOLVariable ConstantSymbol PredicateSymbol FunctionSymbol FCFOLGroundTerm Semantics
Reasoning 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
Propositionalization • 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)
Propositionalization • 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),joe))) (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)))
Propositionalization • 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)
X/b X/b p p p p p p p p p fail X/a Y/a a b a a a a a a X X X X X X Y X b b X/f(c,Z) X/f(c,d) Y/a Y/a Z/d p p p p X/p(a,X) X X X/p(a,X) p fail Y Y f f a a f f a p Guarantees termination c c Z Z c c Z d c p First-Order Term Unification Failure by Occur-Check
Lifted 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
FCFOL theorem proving by repeated lifted resolution and factoring: example
Deduction 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(X+c)) with {X/b}
Characteristics of logics and knowledge representation languages • Commitments: • ontological: meta-conceptual elements to model agent’s environment • epistemological: meta-conceptual elements to model agent’s 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
Characteristics 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?)
Characteristics of logics and knowledge representation languages
Characteristics of logics and knowledge representation languages
Characteristics 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
Some 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