first order logic levent tolga eren. index propositional logic limitations of propositional logic...

17
FIRST ORDER LOGIC Levent Tolga EREN

Upload: milo-sparks

Post on 24-Dec-2015

218 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: FIRST ORDER LOGIC Levent Tolga EREN. Index Propositional Logic Limitations of Propositional Logic Predicate Logic Predicate Logic Notations/Examples/Syntax

FIRST ORDER LOGICLevent Tolga EREN

Page 2: FIRST ORDER LOGIC Levent Tolga EREN. Index Propositional Logic Limitations of Propositional Logic Predicate Logic Predicate Logic Notations/Examples/Syntax

Index• Propositional Logic• Limitations of Propositional Logic• Predicate Logic• Predicate Logic Notations/Examples/Syntax• Propositional Logic compared to Predicate Logic• Atomic/Complex Sentences• A Model for First Order Logic• Using First Order Logic• Conclusion

Page 3: FIRST ORDER LOGIC Levent Tolga EREN. Index Propositional Logic Limitations of Propositional Logic Predicate Logic Predicate Logic Notations/Examples/Syntax

Propositional Logic

• In mathematical logic, a propositional logic is a formal system in which formulas of a formal language may be interpreted to represent propositions.

• Symbols : ^ conjunction v disjunction -> implication <-> equivalence Etc…E.g : p=1 q=0 pVq=1

Page 4: FIRST ORDER LOGIC Levent Tolga EREN. Index Propositional Logic Limitations of Propositional Logic Predicate Logic Predicate Logic Notations/Examples/Syntax

Limitations of Propositional Logic

• Propositional logic is declarative“peter is a man”, “paul is a man”, “john is a man” can be symbolized by P, Q and R respectively in propositional logic but can’t draw any conclusions about similarities between P, Q and R.

• Propositional logic is compositionalmeaning of P Q R is derived from meaning of P, Q and R

• Meaning in Propositional Logic is context independentUnlike natural language, where meaning depends on context. (Domain)

• Propositional logic has very limited expressive power (unlike natural language)

E.g., cannot say "pits cause breezes in adjacent squares“

Page 5: FIRST ORDER LOGIC Levent Tolga EREN. Index Propositional Logic Limitations of Propositional Logic Predicate Logic Predicate Logic Notations/Examples/Syntax

Predicate Logic• In Predicate Logic, these limitations are removed to great

extent.• Propositional logic assumes the world contains facts means

that first-order logic (like natural language) assumes the world contains;

• Objects: people, houses, numbers, colors, baseball games, …• Relations: red, round, prime, brother of, bigger than, part of,

comes between, …• Functions: father of, best friend, one more than, plus, …

Page 6: FIRST ORDER LOGIC Levent Tolga EREN. Index Propositional Logic Limitations of Propositional Logic Predicate Logic Predicate Logic Notations/Examples/Syntax

Predicate Logic Notations• There are three logical notions as compared to propositional calculus.

• Predicatea relation that maps n terms to a truth value true (T) or false (F).– LOVE (john , mary)– LOVE(father(john), john)– LOVE is a predicate. Father is a function.

• Terma constant (single individual or concept i.e.,5,john etc.),a variable that stands for different individuals

a function: a mapping that maps n terms to a term. I.e : if f is n-place function symbol and t1,….tn are terms, then f(t1….., tn) is a term.

Page 7: FIRST ORDER LOGIC Levent Tolga EREN. Index Propositional Logic Limitations of Propositional Logic Predicate Logic Predicate Logic Notations/Examples/Syntax

• Quantifiers:Variables are used in conjunction with quantifiers. – There are two types of quantifiers,“there exist” ( ) and “for all” ( ).∃ ∀– “every man is mortal” can be represented as ( x) (MAN(x) →MORTAL(x)).∀

Page 8: FIRST ORDER LOGIC Levent Tolga EREN. Index Propositional Logic Limitations of Propositional Logic Predicate Logic Predicate Logic Notations/Examples/Syntax

Nesting QuantifiersThe order of quantifiers of the same type doesn’t matter∀x∀y(Parent(x,y) ^ Male(y) -> Son(y,x))

∃x ∃y(Loves(x,y) ^ Loves(y,x))The order of mixed quantifiers does matter:∀x∃y(Loves(x,y))Says everybody loves somebody, i.e. everyone has someone whom they love.∃y∀x(Loves(x,y))Says there is someone who is loved by everyone in the universe.∀y∃x(Loves(x,y))Says everyone has someone who loves them.∃x∀y(Loves(x,y))Says there is someone who loves everyone in the universe.

Page 9: FIRST ORDER LOGIC Levent Tolga EREN. Index Propositional Logic Limitations of Propositional Logic Predicate Logic Predicate Logic Notations/Examples/Syntax

Predicate Logic Notations ExampleA statement “x is greater than y”is represented in predicate calculus as GREATER(x, y). It is defined as follows:GREATER( x, y) = T , if x >y = F , otherwiseThe predicate names GREATER takes two terms and map toT or F depending upon the values of their terms.

Page 10: FIRST ORDER LOGIC Levent Tolga EREN. Index Propositional Logic Limitations of Propositional Logic Predicate Logic Predicate Logic Notations/Examples/Syntax

A statement “john loves everyone” is represented as – ( ∀ x) LOVE(john , x) which maps it to true when x getsinstantiated to actual values.A statement “Every father loves his child” isrepresented as – ( ∀ x) LOVE(father(x), x). – Here father is a function that maps x to his father.The predicate name LOVE takes two terms andmap to T or F depending upon the values of theirterms.

Page 11: FIRST ORDER LOGIC Levent Tolga EREN. Index Propositional Logic Limitations of Propositional Logic Predicate Logic Predicate Logic Notations/Examples/Syntax

Syntax of Predicate Logic • 1. Constant Symbols: c, d, c1, c2, ….. , d1, d2, …;• 2. Function Symbols: f, g, h, f1, f2, …. , g1, g2, ….;• 3. Variables: x, y, z, x1, x2,……, y1, y2, ….;• 4. Predicate (Relational) Symbols: P, Q, P1, P2, …. , Q1, Q2, …;• 5. Logical Connectives: ^, v, ->, <->;• 6. Quantifiers: ∀ (read “for all” or “for each”) and ∃ (read

“there exists”); and• 7. Punctuation: “(”, “)”, “;” and “:”.

Page 12: FIRST ORDER LOGIC Levent Tolga EREN. Index Propositional Logic Limitations of Propositional Logic Predicate Logic Predicate Logic Notations/Examples/Syntax

Propositional vs Predicate LogicIn propositional logic, each possible atomic fact requires a separate unique propositional symbol.

If there are n people and m locations, representing the fact that some person moved from one location to another requires nm^2 separate symbols.

Predicate logic includes a richer ontology:• -objects (terms)• -properties (unary predicates on terms)• -relations (n-ary predicates on terms)• -functions (mappings from terms to other terms)

Allows more flexible and compact representation of knowledge• Move(x, y, z) for person x moved from location y to z

Page 13: FIRST ORDER LOGIC Levent Tolga EREN. Index Propositional Logic Limitations of Propositional Logic Predicate Logic Predicate Logic Notations/Examples/Syntax

Atomic Sentences Sentence -> AtomicSentence

| Sentence Connective Sentence| Quantifier Variable Sentence| ¬ Sentence

| (Sentence)AtomicSentence -> Predicate(Term, Term, ...) | Term=TermTerm -> Function(Term,Term,...)

| Constant | Variable

Recall of syntaxConnective -> v | ^ | -> | <->Quanitfier -> ∃ | ∀Constant -> A | John | Car1Variable -> x | y | z |...Predicate -> Brother | Owns | ...Function -> father-of | plus | ...

Page 14: FIRST ORDER LOGIC Levent Tolga EREN. Index Propositional Logic Limitations of Propositional Logic Predicate Logic Predicate Logic Notations/Examples/Syntax

Complex Sentences

An atomic sentence is simply a predicate applied to a set of terms. Owns(John,Car1) Sold(John,Car1,Fred)Semantics is True or False depending on the interpretation, i.e. is the predicate true of these arguments.The standard propositional connectives can be used to construct complex sentences: Owns(John,Car1) V Owns(Fred, Car1) Sold(John,Car1,Fred) -> ¬ Owns(John, Car1) Semantics same as in propositional logic.

Page 15: FIRST ORDER LOGIC Levent Tolga EREN. Index Propositional Logic Limitations of Propositional Logic Predicate Logic Predicate Logic Notations/Examples/Syntax

A Model for First Order Logic

E.g. Sibling(KingJohn,Richard) Sibling(Richard,KingJohn)

Page 16: FIRST ORDER LOGIC Levent Tolga EREN. Index Propositional Logic Limitations of Propositional Logic Predicate Logic Predicate Logic Notations/Examples/Syntax

Using First Order Logic

The kinship domain:

Brothers are siblings

x,y Brother(x,y) <-> Sibling(x,y)

One's mother is one's female parent

m,c Mother(c) = m <-> (Female(m) Parent(m,c))

“Sibling” is symmetric

Page 17: FIRST ORDER LOGIC Levent Tolga EREN. Index Propositional Logic Limitations of Propositional Logic Predicate Logic Predicate Logic Notations/Examples/Syntax

ConclusionThis presentation has introduced first-order logic, a representation language that is far more powerful than propositional logic. The important points are as follows:

Logics differ in their ontological commitments and epistemological commitments.While propositional logic commits only to the existence of facts, first-order logic commits to the existence of objects and relations and thereby gains expressive power.A possible world, or model, for first-order logic is defined by a set of objects, therelations among them, and the functions that can be applied to them.An atomic sentence consists of a predicate applied to one or more terms; it is truejust when the relation named by the predicate holds between the objects named by the terms.Complex sentences use connectives just like propositional logic