03 -1 Lecture 03 First-Order Predicate Logic Topics –Syntax –Formal Semantics –Denotational Semantics –Formal Inference –Resolution
03 -2 Syntax Atomic Sentence –Predicate(term 1, term 2, …, term n ) –Term Constant Variable Function –Predicate must be constant –Classmate(Jack, x, Brother(Allen)) Function –Fun-name(term 1, term 2, …, term n ) –Fun-name : function name must be constant Cardinality –Classmate(Jack, x) vs Classmate(Jack, x, Brother(Allen))
03 -3 Syntax Connectives –NOT / AND / OR / Imply → –Example: Classmate(x, Allen) Classmate(x, Jack) Classmate(x, Andy) → Classmate(x, Aho) Quantifiers –Universal quantifier ForAll –Existential quantifier ThereExist –Example: x Classmate(Adam, x) → y Like(x, y) Well formed sentence (wff, or Sentence)
03 -4 Formal Semantics Atomic sentence –True (T)/ False (F) –Example: Classmate(x, Jack)= T Connectives –Truth tables –Identity Example: S1→S2 ≡ S1 S2 Quantifiers – x S(x)=T IF S(x 1 ) S(x 2 ) … S(x n )=T – x S(x)=T IF S(x 1 ) S(x 2 ) … S(x n )=T Truth functional: The formal semantics of a sentence can be determined by the formal semantics of its components
03 -5 Denotational Semantics Denotational mappings to objects and relationships (Physical meaning) Atomic sentence –Constant denotes a named object –Variable denotes some unnamed object –Function indirectly denotes an object –Predicate denote a relationship –Atomic sentence denotes a fact –Example: Classmate(x, Jack) Denotes the fact that some unnamed man denoted by x is a classmate of an object named Jack
03 -6 Denotational Semantics Connectives – S denotes that the fact denoted by S isn’t existent –S1 S2 denotes that the fact denoted by S1 and the fact denoted by S2 are co-existent –S1 S2 denotes that one or both of the facts denoted by S1 and by S2 are existent –S1 → S2 denotes that if the fact denoted by S1 exists, the fact denoted by S2 will exist
03 -7 Denotational Semantics Quantifiers – – x S denotes the fact that every object in the system can make the fact of S existent – x S denotes the fact that there is at least one object in the system which can make the fact of S existent The denotational semantics of a sentence contains the set of denotational mappings of its constituents.
03 -8 Formal Inference Reason about the formal semantics of a new sentence only according to syntactical structure –From KB={Classmate(Adam, Allen) Classmate(Allen, Andy)}= T we derive Classmate(Adam, Allen) = T without consulting the underlying physical meanings Problem: How can we guarantee that under all denotational semantics, the above inference is correct? Or the denotational semantics of the derived sentence holds?
03 -9 Formal Inference Key: Make the inference independent of denotation semantics How: Make the inference sound and complete Definition of “Model” –Give a denotational semantics M, M is a model of KB={S|S:wff}, denoted as M KB, if M makes the formal semantics of KB true.
Formal Inference Definition of “Entailment” –Given KB={S|S:wff} and a is a wff, if every M KB is also M a, then we say a is entailed by KB (or KB entails a ), denoted as KB ┝ a –Example: KB={S1=Classmate(Adam, Allen) S2=Classmate(Allen, Andy)} then KB ┝ S1; KB ┝ S2; KB ┝ KB All M KB are also M 1 and M 2 KB={S1 S2}S2S1 F F F F {M 20 }: T F {M 10 }: T F F {M KB }: T{M 1 }: T{M 2 }: T
Formal Inference Definitions of Soundness and Completeness –Suppose KB ┝ a. Given i a formal inference mechanism, if i can derive b from KB, denoted as KB├ i b, then i is sound, iff {b} {a}, i is complete, iff {b} {a}, and i is sound and complete, iff {b} = {a}
Formal Inference Sound and complete inference mechanisms –A sound inference mechanism only derives wff’s that are entailed by the original KB; that is, no matter what models are used to interpret the derived wff’s they are CORRECT. –A complete inference mechanism can derive all entailed wff’s.
Formal Inference Example of formal inference mechanisms –ae, a formal inference, defined as {S 1 S 2 … S n }├ ae S i, i =1,2…, n Example: –KB ┝ {KB={S 1 S 2 }, S1, S2} (P. 9) –KB├ ae {S1, S2} {KB, S1, S2} –ae is sound Is ae complete? –In general, NO, if KB contains other connectives than Find a sound and complete formal inference mechanism for First-Order Logic?
Resolution Canonical form –Clause l 1 … l j … l m, where L i is a literal Literal: positive or negative atomic sentence –CNF (Conjunctive Normal Form) KB={l 1 … l j … l m, L 1 … L k … L n } Horn Clause: at most one positive literal in a sentence First-Order Definite Clause: exactly one positive literal in a sentence
Resolution Resolution, denoted by res, as a formal inference mechanism on CNF –{l 1 … l j … l m, L 1 … L k … L n } ├ res ( , l 1 … l j-1 l j+1 … l m L 1 … L k-1 L k+1 … L n ) = Unify(l j, L k ), a substitution is a substitution application function
Resolution Illustration of ├ res –KB={ Classmate(x, Allen) Like(x, Joyce), Classmate(Adam, Allen)} –Resolution procedure 1. = Unify(Classmate(x, Allen), Classmate(Adam, Allen))={x/Adam} 2. KB={ Classmate(x, Allen) Like(x, Joyce), Classmate(Adam, Allen)} 3. ({x/Adam}, Like(x, Joyce))= Like(Adam, Joyce)
Resolution ├ res is sound on CNF All First-Order Logic KBs can be converted to CNF ├ res is a sound formal inference mechanism for First-Order Logic ├ res is refutationally complete on CNF and First-Order Logic –Given any C with KB ┝ C, resolution can prove KB C contains contradiction –Proof by contradiction
Resolution Application –Conversion of wffs to CNF –Control strategies Set-of-support resolution strategy with unit preference –Automated theorem prover –System verification Related languages –Horn clause/ First-order definite clause/ Prolog/ Rule/ Attribute-based language/ Planning language/ Frame/ Description Logic