03 -1 lecture 03 first-order predicate logic topics –syntax –formal semantics –denotational...

18
03<Logic>-1 Lecture 03 First-Order Predicate Logic • Topics – Syntax Formal Semantics Denotational Semantics Formal Inference – Resolution

Post on 21-Dec-2015

220 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 03 -1 Lecture 03 First-Order Predicate Logic Topics –Syntax –Formal Semantics –Denotational Semantics –Formal Inference –Resolution

03<Logic>-1

Lecture 03 First-Order Predicate Logic

• Topics– Syntax– Formal Semantics– Denotational Semantics– Formal Inference– Resolution

Page 2: 03 -1 Lecture 03 First-Order Predicate Logic Topics –Syntax –Formal Semantics –Denotational Semantics –Formal Inference –Resolution

03<Logic>-2

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))

Page 3: 03 -1 Lecture 03 First-Order Predicate Logic Topics –Syntax –Formal Semantics –Denotational Semantics –Formal Inference –Resolution

03<Logic>-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)

Page 4: 03 -1 Lecture 03 First-Order Predicate Logic Topics –Syntax –Formal Semantics –Denotational Semantics –Formal Inference –Resolution

03<Logic>-4

Formal Semantics

• Atomic sentence– True (T)/ False (F)– Example: Classmate(x, Jack)= T

• Connectives– Truth tables– Identity

• Example: S1→S2 ≡ S1S2

• Quantifiers– x S(x)=T IF S(x1)S(x2)…S(xn)=T

– x S(x)=T IF 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

Page 5: 03 -1 Lecture 03 First-Order Predicate Logic Topics –Syntax –Formal Semantics –Denotational Semantics –Formal Inference –Resolution

03<Logic>-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

Page 6: 03 -1 Lecture 03 First-Order Predicate Logic Topics –Syntax –Formal Semantics –Denotational Semantics –Formal Inference –Resolution

03<Logic>-6

Denotational Semantics• Connectives

S denotes that the fact denoted by S isn’t existent

– S1S2 denotes that the fact denoted by S1 and the fact denoted by S2 are co-existent

– S1S2 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

Page 7: 03 -1 Lecture 03 First-Order Predicate Logic Topics –Syntax –Formal Semantics –Denotational Semantics –Formal Inference –Resolution

03<Logic>-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.

Page 8: 03 -1 Lecture 03 First-Order Predicate Logic Topics –Syntax –Formal Semantics –Denotational Semantics –Formal Inference –Resolution

03<Logic>-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?

Page 9: 03 -1 Lecture 03 First-Order Predicate Logic Topics –Syntax –Formal Semantics –Denotational Semantics –Formal Inference –Resolution

03<Logic>-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 MKB, if M makes the formal semantics of KB true.

Page 10: 03 -1 Lecture 03 First-Order Predicate Logic Topics –Syntax –Formal Semantics –Denotational Semantics –Formal Inference –Resolution

03<Logic>-10

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 M2KB={S1S2} S2S1

FFF

F{M20}: T

F

{M10}: T

FF

{MKB}: T {M1}: T {M2}: T

Page 11: 03 -1 Lecture 03 First-Order Predicate Logic Topics –Syntax –Formal Semantics –Denotational Semantics –Formal Inference –Resolution

03<Logic>-11

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}, andi is sound and complete, iff {b} = {a}

Page 12: 03 -1 Lecture 03 First-Order Predicate Logic Topics –Syntax –Formal Semantics –Denotational Semantics –Formal Inference –Resolution

03<Logic>-12

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.

Page 13: 03 -1 Lecture 03 First-Order Predicate Logic Topics –Syntax –Formal Semantics –Denotational Semantics –Formal Inference –Resolution

03<Logic>-13

Formal Inference• Example of formal inference mechanisms

– ae, a formal inference, defined as {S1S2…Sn}├ae Si, i =1,2…, n

• Example:– KB {KB={S┝ 1S2}, 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?

Page 14: 03 -1 Lecture 03 First-Order Predicate Logic Topics –Syntax –Formal Semantics –Denotational Semantics –Formal Inference –Resolution

03<Logic>-14

Resolution

• Canonical form – Clause

• l1 … lj… lm, where Li is 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

Page 15: 03 -1 Lecture 03 First-Order Predicate Logic Topics –Syntax –Formal Semantics –Denotational Semantics –Formal Inference –Resolution

03<Logic>-15

Resolution

• Resolution, denoted by res, as a formal inference mechanism on CNF– {l1…lj…lm, L1…Lk…Ln}

├res (, l1…lj-1lj+1…lmL1…

Lk-1Lk+1 …Ln)

= Unify(lj, Lk), a substitution

• is a substitution application function

Page 16: 03 -1 Lecture 03 First-Order Predicate Logic Topics –Syntax –Formal Semantics –Denotational Semantics –Formal Inference –Resolution

03<Logic>-16

Resolution

• Illustration of ├res – KB={Classmate(x, Allen)Like(x, Joyce), Classmate(Adam, Allen)}

– Resolution procedure1. = 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)

Page 17: 03 -1 Lecture 03 First-Order Predicate Logic Topics –Syntax –Formal Semantics –Denotational Semantics –Formal Inference –Resolution

03<Logic>-17

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

Page 18: 03 -1 Lecture 03 First-Order Predicate Logic Topics –Syntax –Formal Semantics –Denotational Semantics –Formal Inference –Resolution

03<Logic>-18

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