180 likes | 296 Views
Lecture 03 First-Order Predicate Logic. Topics Syntax Formal Semantics Denotational Semantics Formal Inference Resolution. Syntax. Atomic Sentence Predicate(term 1 , term 2 , …, term n ) Term Constant Variable Function Predicate must be constant Classmate(Jack, x, Brother(Allen))
E N D
Lecture 03 First-Order Predicate Logic • Topics • Syntax • Formal Semantics • Denotational Semantics • Formal Inference • Resolution
Syntax • Atomic Sentence • Predicate(term1, term2, …, termn) • Term • Constant • Variable • Function • Predicate must be constant • Classmate(Jack, x, Brother(Allen)) • Function • Fun-name(term1, term2, …, termn) • Fun-name:function name must be constant • Cardinality • Classmate(Jack, x) vs Classmate(Jack, x, Brother(Allen))
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)
Formal Semantics • Atomic sentence • True (T)/ False (F) • Example: Classmate(x, Jack)= T • Connectives • Truth tables • Identity • Example: S1→S2 ≡ S1S2 • Quantifiers • "xS(x)=TIF S(x1)S(x2)…S(xn)=T • $xS(x)=TIF S(x1)S(x2)…S(xn)=T • Truth functional: The formal semantics of a sentence can be determined by the formal semantics of its components
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
Denotational Semantics • Connectives • S denotes that the fact denoted by Sisn’t existent • S1S2 denotes that the fact denoted by S1 and the fact denoted by S2are co-existent • S1S2 denotes that one or both of the facts denoted by S1 and by S2are existent • S1→S2 denotes that ifthe fact denoted by S1 exists, the fact denoted by S2 will exist
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 ofdenotational mappingsofits constituents.
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?
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 amodel of KB={S|S:wff}, denoted as MKB, 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 MKB is also Ma, 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 MKB are also M1 and M2 KB={S1S2} S1 S2 {MKB}: T {M1}: T {M2}: T F {M10}: T F F F {M20}: T F F F
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 iis sound, iff {b}{a}, iis complete, iff{b}{a}, and iis 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, aformal inference, defined as {S1S2…Sn}├aeSi, i =1,2…, n • Example: • KB┝ {KB={S1S2}, 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 • l1 … lj… lm, where Liis a literal • Literal: positive or negative atomic sentence • CNF (Conjunctive Normal Form) • KB={l1 … lj… lm, L1 …Lk… Ln} • 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 • {l1…lj…lm, L1…Lk…Ln} ├ress(, l1…lj-1lj+1…lmL1… Lk-1Lk+1 …Ln) • = Unify(lj, Lk), a substitution • s 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. s({x/Adam},Like(x, Joyce))= Like(Adam, Joyce)
Resolution • ├resis 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