160 likes | 293 Vues
FIRST-ORDER LOGIC. FOL or FOPC. I n today’s lesson we will introduce a logic that is sufficient for building knowledge. people, houses, numbers, theories, Ronald Mc Donald, colors, baseball games, wars, centuries. Objects:-.
E N D
FIRST-ORDER LOGIC FOL or FOPC In today’s lesson we will introduce a logic that is sufficient for building knowledge
people, houses, numbers, theories, Ronald Mc Donald, colors, baseball games, wars, centuries. Objects:- • brother of, bigger than, inside, part of , has color, occurred after, owns….. Relations:- • round, bogus, prime, multistoried… Properties:- • father of, best friend, third inning of, one more than…. Functions:-
Indeed, almost any fact can be thought of as referring to objects and properties or relations. Some examples follow: “One plus two equals three” one, two, three, one plus two; Objects: Relation: Function: ( One plus two is a name for the object that is obtained by applying the function plus to the objects one and two. Three is another name for this object.) equals: plus.
“ Squares neighboring the wumpus are smelly” Objects: wumpus, square; Property: smelly; Relation: neighboring. • “ Evil king john ruled England in 1200” Objects; John, England, 1200; Relation: ruled; Properties: evil, king.
The syntax of first-order logic Connective – ,,, Quantifier – , Constant – A / X1/ John/…. Variable – a/X/s/… Predicate – Before /HasColor/Raining/…. Function- Mother/LeftLegOf • Sentence:--- • Atomic Sentence, • Sentence Connective Sentence, • Quantifier Variable … Sentence • Sentence, • (Sentence) • AtomicSentence – • Predicate(Term … ) Term = Term, • Term – • Function(Term …..) • Constan , • Variable
Constant symbols: A,B,C,John… An interpretation must specify which object in the world is referred to by each constant symbol. Each constant symbol names exactly one object, but not all objects need to have names, and some can have several names. Thus, the symbol John, in one particular iterpretation, might refer to the evil king John. king of England from 1199 to 1216 and younger brother of Richard the Lionheart. The symbol King could refer to the same object/ person in the same interpretation. Predicate symbols: Round. Brother…. • Function symbols:Cosine, FatherOf , LeftLegOf…..
Terms A terms is a logical expression that refers to an objects. Constant symbols are therefore terms. Sometimes, it is more convenient to use an expression to refer to an object. For example, in English we might use the expression “King John’s left leg ” rather than giving a name to his leg. This is what function symbols are for: instead of using a constant symbol, we use LeftLegOf (John). In the general case, a complex term is formed by a symbol followed by a parenthesized list of terms as arguments to the function symbol. {(king John,King John’s leftleg), (Richard the Lionheart, Richard’s left leg)}
Atomic sentences Now that we have terms for referring to objects, and predicate symbols for referring to relations, we can put them together to make atomic sentences that state facts. An atomic sentence is formed from a predicate symbol followed by a parenthesized list for terms. For example, brother ( Richard , john) States , under the interpretation given before, that Richard the Lioneheart is the brother of king john. Atomic sentences can have arguments that are complex terms: Married ( Father of (Richard ). Mother of (john))
Complex sentences • We can use logical connectives to construct more complex sentences, just as in propositional calculus. The semantics of sentences formed using logical connectives is identical to that in the propositional case. For example: • Brother (Richard, john) ^ Brother (john. Richard)is true just when john is the brother of Richard and Rechard is the brother of john. • Older ( john , 30 ) v younger ( john. 30)is true just when john is older than 30 or john is younger than 30. • Older ( john. 30) - younger ( john . 30)states that if john is older than 30, then he is not younger than 30 • -Brother (Robin, john)is true just when Robin is not the brother of john.
Quantifies Once we have a logic that allows objects, it is only natural to want to express properties of entire collections of objects, rather than having to enumerate the objects by name. Quantifies let us do this. First-order logic contains two stands quantifiers ,called universal and existential. () ( )
Universal quantification ( ) Recall the difficulty we had in previous lesson with the problem of expressing general rules in propositional logic. Rules such as “All cats are mammals” are the bread and butter of first-order logic. P-190 To express this particular rule, we will use unary predicates Cat and Mammal; thus“ sport is a mammal “ by Mammal(Spot). In English, what we want to say is that for any objects x, if x is that a cat then x is a mammal. First-order logic lets us do this as follows: x Cat(x)Mammal(x) is usually pronounced “For all ….” Remember that the upside-down A stands for “all”.
Existential quantification (x) Universal quantification makes statements about every object. Similarly, we can make a statement about some object in the universe without naming it, by using an existential quantifier. To say, for example, that Sopt has a sister who is a cat, we write x Sister(x, Sopt) ⋀Cat(x) is pronounced “There exists…”. In general, x p is true for some object in the universe.
Nested quantifiers We will often want to express more complex sentences using multiple-quantifiers. The simplest case is where the quantitiers are of the same type. For examples, “For all x and all y, if x is the parent of y then y is the child of x” becomes x, y Parent (x, y) Child (y,x) x, y is equivalent to x y, Similarly, the fact that a person’s brother has that person as a sibling is expressed by x, y Brother (x,y) Sibling (y,x) In other cases we will have mixtures. “Everybody loves somebody” means that for every person, there is someone that person loves: x y Loves (x,y) On the other hand, to say “There is someone who is loved by everyone” we write y x Loves (x,y)
Connections between and The two quantifiers are actually intimately connected with each other, through negation. When one syas that everyone dislikes parsnips, one is also saying that there does not exist someone who likes them; and vice versa; x Likes (x, Parsnips) is equivalent to x Likes (x, parsnips) We can go one step further. “Everyone like ice cream” means that there is no one who does not like ice cram: x Likes (x, Ice cream) is equivalent to x Likes (x, Ice Cream) Because is really a conjunction over the universe of object and is a disjunction is should not be surprising that they obey De Morgan’s rule. The De Morgan rules for quantified and unquantified sentences are as follows: x P x P P Q (P Q) x P x P (P Q) P Q x P x P P Q ( P Q) x P x P P Q ( P Q)