Predicate Logic Second Term Fourth Year (10 CS) 1.

Slides:



Advertisements
Similar presentations
Applications Computational LogicLecture 11 Michael Genesereth Spring 2004.
Advertisements

Knowledge Representation using First-Order Logic
Artificial Intelligence
1 Knowledge Representation Introduction KR and Logic.
First-Order Logic Chapter 8.
Inference in First-Order Logic
LDK R Logics for Data and Knowledge Representation Exercises: First Order Logics (FOL) Originally by Alessandro Agostini and Fausto Giunchiglia Modified.
Math Vocabulary Review Part 1.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
SUBTRACTING INTEGERS 1. CHANGE THE SUBTRACTION SIGN TO ADDITION
Addition Facts
CS4026 Formal Models of Computation Part II The Logic Model Lecture 1 – Programming in Logic.
Copyright 2012, 2008, 2004, 2000 Pearson Education, Inc.
Knowledge Representation using First-Order Logic CS 271: Fall 2007 Instructor: Padhraic Smyth.
First-Order Logic.
ABC Technology Project
Chapter 4 Gates and Circuits.
Gates and Circuits Nell Dale & John Lewis (adaptation by Erin Chambers and Michael Goldwasser)
Digital Logic Design Gate-Level Minimization
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use Chapter 2 – Combinational.
Other Gate Types COE 202 Digital Logic Design Dr. Aiman El-Maleh
Exclusive-OR and Exclusive-NOR Gates
CS105 Introduction to Computer Concepts GATES and CIRCUITS
Chapter 4 Gates and Circuits.
Quadratic Inequalities
1 Chapter 4 The while loop and boolean operators Samuel Marateck ©2010.
Warm Up Problem of the Day Lesson Presentation Lesson Quizzes.
Chapter 5 Test Review Sections 5-1 through 5-4.
GG Consulting, LLC I-SUITE. Source: TEA SHARS Frequently asked questions 2.
Addition 1’s to 20.
25 seconds left…...
Copyright © Cengage Learning. All rights reserved.
Week 1.
We will resume in: 25 Minutes.
10 주 강의 First-order Logic. Limitation of propositional logic A very limited ontology  to need to the representation power  first-order logic.
Logic. Propositional Logic Logic as a Knowledge Representation Language A Logic is a formal language, with precisely defined syntax and semantics, which.
9/28/98 Prof. Richard Fikes First-Order Logic Knowledge Interchange Format (KIF) Computer Science Department Stanford University CS222 Fall 1998.
FIRST-ORDER LOGIC FOL or FOPC
Represent the following sentences in first-order logic, using a consistent vocabulary
Predicate Calculus.
CE An introduction to Artificial Intelligence CE Chapter 8: First Order Logic Ramin Halavati In which we notice that.
FIRST ORDER LOGIC Levent Tolga EREN.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
Artificial Intelligence Building Knowledge Base Chapter 8.
ARTIFICIAL INTELLIGENCE Lecture 3 Predicate Calculus.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Predicate Logic.
First-Order Logic Chapter 8. Outline Why FOL? Syntax and semantics of FOL Using FOL Wumpus world in FOL Knowledge engineering in FOL.
Word Problem Consider the following problem: To register, you will need either a yellow card or a note from the Dean. To obtain a note from the Dean you.
Artificial Intelligence First-Order Logic (FOL). Outline of this Chapter The need for FOL? What is a FOL? Syntax and semantics of FOL Using FOL.
First-Order Logic Chapter 8 (not 8.1). Outline Why FOL? Why FOL? Syntax and semantics of FOL Syntax and semantics of FOL Using FOL Using FOL Wumpus world.
First-Order Logic. Outline Why FOL? Syntax and semantics of FOL Using FOL Knowledge engineering in FOL.
First-Order Logic Chapter 8. Outline Why FOL? Syntax and semantics of FOL Using FOL Wumpus world in FOL Knowledge engineering in FOL.
PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion.
First-Order Logic Semantics Reading: Chapter 8, , FOL Syntax and Semantics read: FOL Knowledge Engineering read: FOL.
Lecture 8-2CS250: Intro to AI/Lisp What do you mean, “What do I mean?” Lecture 8-2 November 18 th, 1999 CS250.
First-Order Logic Knowledge Representation
First-Order Logic Chapter 8.
Course Instructor: kinza ch
Notes 8: Predicate logic and inference
First-Order Logic Knowledge Representation
First-Order Logic Knowledge Representation
Introduction to Artificial Intelligence
First-Order Logic Chapter 8.
Knowledge Representation using First-Order Logic (Part III)
First-Order Logic Knowledge Representation
First-Order Logic Chapter 8.
Presentation transcript:

Predicate Logic Second Term Fourth Year (10 CS) 1

In this course, we shall only study First order Logic (FOL) Predicate Calculus Predicate Calculus First-Order Logic Higher-Order Logic 2

Introduction to FOL In propositional calculus, each atomic sentence (P, Q etc.) denotes a proposition of some complexity. There is no way to access the components of an individual assertion. Predicate calculus provides this ability. Example: In Propositional logic, we may write the entire sentence: P = It rained on Tuesday In Predicate Calculus, we may create a predicate weather that describes a relationship between a date/day and weather: weather (Tuesday, rained) Through inference rules, we can manipulate predicate calculus expressions, accessing their individual components and inferring new sentences. 3

Introduction to FOL Predicate calculus allows expressions to contain variables. Variables let us create general assertions about classes of entities: Example: we could state that for all values of X, where X is a day of the week, the statement weather(X, rain) is true; i.e. It rains everyday. 4

Basic terminology Object: Objects are things with individual identities and properties that distinguish from other objects. Examples: people, houses, numbers, colours, football matches, 07 CS batch etc. Relations: Among objects, various relations hold. Example: brother, greater than, has colour, inside, part of etc. Functions: Relations in which there is only value for a given input. Example: father of, best friend, one more than etc. 5

Basics Example 1: One plus two equals three Objects: one, two, three, one plus two. Relation: equals Function: plus Example 2: President Musharaf ruled Pakistan in Objects: Musharaf, Pakistan, Relation: ruled Properties: President 6

Basics In Propositional Logic, every expression is a sentence which represents a fact. FOL has sentences and terms (which represent objects) Constant symbols, variables, and function symbols are used to build terms Quantifiers and predicate symbols are used to build sentences. 7

Syntax of FOL Connectives:,,, Quantifiers:, Constants: A, X 1, C, Akber,... Variables: a, x, s,... Predicate: before, HasColor,... Function: father, rightArmof,... 8

Basics Examples: Ahmad likes Chocolates. likes(Ahmad, Chocolates) Asma loves dolls and jewellery. likes(Asma, dolls) likes(Asma, jewellery) Asim and Adil are brothers of Abid brother(Abid, Asim) brother(Abid, Adil) Akhtar is older than 20 or Akhtar is younger than 20. older(Akhtar, 20) younger(Akhtar,20) If Akhtar is older than 20, then he is not younger than 20. older(Akhtar, 20) younger(Akhtar, 20) Father of Jawad is Munir father(Jawad) = Munir 9

Basics Examples: Father of Sarah and Uncle of Shahid are friends. friends(father_of(Sarah), uncle_of(Shahid)) All Shaikhs are not Sindhi. x: Shaikh(x) Sindhi(x) All men are mortal x: man(x) mortal(x) All basket ball players are tall x: (basketball_player(x) tall(x)) Everyone likes ice cream x: likes(x, ice_cream) 10

Basics Examples: If wishes were horses, beggars would ride equal(wishes, horses) ride(beggars) There exists some bird that does not fly x: bird(x) flies(x) Sanya eats everything that she likes x: (likes(Sanya, x) eats(Sanya,x)) There exists a white allegator x: allegator(x) white(x) No body likes taxes x: likes(x, taxes) 11

More Examples Every gardener likes the sun x: gardener(x) likes(x, sun) All purple mushrooms are poisonous x: (mushroom(x) purple(x)) poisonous(x) No purple mushroom is poisonous x: (mushroom(x) purple(x)) poisonous(x) Everybody loves somebody x y loves(x,y) There is someone who is loved by everyone y x loves(x,y) 12

Using FOL Assertions and queries in FOL Sentences are added to a knowledge base (KB) using TELL. Such sentences are called assertions. Examples: TELL(KB, prime_minister(Geelani)) TELL(KB, King(Baber)) TELL(KB, x King(x) Person(x)) 13

Using FOL Queries We ask questions of the knowledge base using ASK. Questions asked using ASK are called queries: ASK(KB, prime_minister(Geelani)) ASK(KB, King(Baber)) ASK(KB, x King(x) Person(x)) 14

Using FOL The Kinship Domain The objects in the Kinship domain are people The properties they have include gender and they related by relations such as parenthood, brotherhood, marriage and so on. Examples: ones mother is ones female parent m,c Mother(c) = m female(m) Parent(m,c) Ones husband is ones male spouse w, h Husband(h,w) Male(h) Spouse(h,w) Male and female are disjoint categories x Male(x) Female(x) 15

Using FOL The Kinship Domain Parent and child are inverse relations: p,c Parent(p,c) Child(c,p) A grand parent is a parent of ones parent g,c Grandparent(g,c) Parent(g,p) parent(p,c) 16

Building a Knowledge Base An important objective of Knowledge engineering is to build knowledge base. Following five steps may be used to develop a knowledge base. Step1: Decide what to talk about. Step2: Decide on a vocabulary of predicates, functions and constants. Step3: Encode general knowledge about the domain Step4: Encode a description of the specific problem instance. Step5: Pose queries to the inference procedure and get answers. 17

Example: Electronic Circuit Domain Step1: Decide what to talk about: Before developing knowledge base, you should know: that there are four types of gates: AND, OR, XOR and NOT. How each gate works How the gates are connected in the given circuit How current flows through the circuit 18

Example: Electronic Circuit Domain Step2: Decide on a vocabulary Introduce the predicate Type to define type of a gate. Introduce the predicate Connected to define connections. Introduce the predicate Signal to define current flow. Use the predicate In and Out to define input and output respectively. Use the connectives,,,, etc. and quantifiers, etc. wherever necessary. 19

Example: Electronic Circuit Domain Step3: Encode general rules Rule 1: If two terminals are connected, then they have the same signal. t 1, t 2 Connected(t 1, t 2 ) Signal(t 1 ) = Signal(t 2 ) Rule 2: The signal at every terminal is either ON or OFF (but not both). t Signal(t) = On Signal(t) = Off On Off Rule 3: Connected is a commutative predicate t 1, t 2 Connected(t 1, t 2 ) Connected(t 2, t 1 ) 20

Example: Electronic Circuit Domain Rule 4: An OR gates output is on if and only if any of inputs are on. g Type(g) = OR Signal(Out(1,g)) = On n Signal(In(n,g)) = On Rule 5: An AND gates output is Off if and only if any of its inputs are off. g Type(g) = AND Signal(Out(1,g)) = Off n Signal(In(n,g)) = Off 21

Example: Electronic Circuit Domain Rule 6: An Exclusive OR gates output is on if and only if its inputs are different g Type(g) = XOR Signal(Out(1,g)) = On Signal(In(1,g)) Signal(In(2,g)) Rule 7: A NOT gates output is different from its input g Type(g) = NOT Signal(Out(1,g)) Signal(In(1,g)) 22

Step 4: Encode the specific instance (a) Categorize the gates Type(X 1 ) = XOR Type(X 2 ) = XORType(A 1 ) = AND Type(A 2 ) = ANDType(O 1 ) = OR (b) Define the Connections Connected(Out(1, X 1 ), In(1,X 2 )) Connected(In(1,C 1 ), In(1,X 1 )) Connected(Out(1, X 1 ), In(2,A 2 )) Connected(In(1,C 1 ), In(1,A 1 )) Connected(Out(1, A 2 ), In(1,O 1 )) Connected(In(2,C 1 ), In(2,X 1 )) Connected(Out(1, A 1 ), In(2,O 1 )) Connected(In(2,C 1 ), In(2,A 1 )) Connected(Out(1, X 2 ), Out(1,C 1 ))Connected(In(3,C 1 ), In(2,X 2 )) Connected(Out(1, O 1 ), In(2,C 1 )) Connected(In(3,C 1 ), In(1,A 2 )) 23

Example: Electronic Circuit Domain Step 5: Pose queries to the inference procedure (i) What combinations of inputs would cause the first output of C 1 (the sum bit) to be OFF and the second output of C 1 to be ON? i 1, i 2, i 3 Signal(In(1,C 1 )=i 1 Signal(In(2,C 1 ) = i 2 Signal(In(3,C 1 ) = i 3 Signal(Out(1,C 1 ) = Off Signal(Out(2,C 1 ) =On The answer is: (i 1 = On i 2 = On i 3 = Off) (i 1 = On i 2 = Off i 3 = On) (i 1 = Off i 2 = On i 3 = On) 24

Example: Electronic Circuit Domain Step 5: Pose queries to the inference procedure (ii) What are the possible set of values of all the terminals for the circuit i 1, i 2, i 3, o 1, o 2 Signal(In(1,C 1 )=i 1 Signal(In(2,C 1 ) = i 2 Signal(In(3,C 1 ) = i 3 Signal(Out(1,C 1 ) = o 1 Signal(Out(2,C 1 ) =o 2 This query will return a complete input/output table for the circuit, which can be used to check that it does in fact add its inputs correctly. 25