21
FIRST ORDER LOGIC Berat YILMAZ

FIRST ORDER LOGIC Berat YILMAZ. BEFORE START, LETS REMEMBER Logic Syntax Semantics

Embed Size (px)

Citation preview

FIRST ORDER LOGIC

Berat YILMAZ

BEFORE START, LETS REMEMBER

•Logic

•Syntax

•Semantics

PROPOSITIONAL LOGIC VS FIRST-ORDER LOGIC

•Propositional logic: We have

•Facts

•Belief of agent: T|F|UNKNOWN

•First-Order Logic: We have

•Facts

•Objects

•Relations

•Propositional logic:

•Sentence-> Atomic|Complex Sentences

•Atom-> True|False|AP

•AP-Basic Propositions

•Complex Sentences->

• |Sentence Connective Sentence

• |¬ Sentence

•Connective-> ^| v| <=>|=>

•First-Order Logic: Syntax

•Constant -> A|5|Something..

•Variable -> a|y|z

•Predicate -> After|HasBorder|Snowing..

•Function -> Father|Sine|…

PREDICATES

•Can have one or more arguments

•Like: P(x,y,z)

•x,y,z are variables

• If for that selected x,y,z values are true, then predicate is true.

FUNCTIONS

•Predicates has true or false value

•But..

•Functions have an event.

•Can return a value.. Numeric for example..

EXAMPLE

•Everyone loves its father.

• x y Father(x,y)Loves(x,y)

•x Father(x)

• x Loves(x,Father(x))

SYNTAX OF FOL

•Sentece-> Atomic Sentence

• |Sentence Connective Sentence

• |Quantifier Variable, …. Sentence

• | Sentence | (Sentence)

•Atomic Sentence -> Predicate (Term, ….)|Term=Term

•Term->Function(Term,…) |Constant | Variable

•Connective ->

•Quantifier ->

WHY WE CALL FIRST ORDER

•Because we are allowing quantifications over variables, not on predicates;

• P x y P(x,y) (More Complex)

EXAMPLE 1

•Not all students takes both AI & Computer Graphics Course

•Student(x) = x is a student

•Takes(x,y) = Subject x is taken by y

FIRST WAY:

• x Student(x) Takes(AI,x)Takes(CG,x)

SECOND WAY

• x Student(x) Takes(AI,x) Takes(CG,x)

EXAMPLE 2

•The Best Score in AI is better than the best score in CG?

•How we do, what we need?

•A ‘Function’ which returns the score value:

•So Function: Score(course,student)

•After?

•Another Function or A Predicate?

A PREDICATE

•Greater(x,y): x>y

SOLUTION

•Solution:

• xStudent(x)Takes(AI)yStudent(y)Takes(CG) Greater(Score(AI),Score(CG))

RUSSEL PARADOX

•There is a single barber in town

•Those and only those who do not shave themselves are shaved by the barber

•So who shaves the barber??

WAY TO SOLUTION

• xBarber(x)y xy Barber(y)• That means there is only one barber in the town

• xShaves(x,x)Shaves(x,y)Barber(y)• That means y is in the domain of x, so member of

town and not shaves itself but shaved by barber

THANK YOU FOR LISTENING