Вы находитесь на странице: 1из 4

Different forms of logic CS 5300/6300 Introduction to Articial Intelligence

Language Propositional logic First-order logic Ontological Commitment facts facts, objects, relations facts, objects, relations, times facts facts + degree of truth Epistemological Commitment true/false/unknown true/false/unknown true/false/unknown degree of belief known interval value

First-order predicate calculus

Temporal logic Probability theory Fuzzy logic

University of Utah School of Computing

CS 5300/6300: First-order predicate calculus p. 1

CS 5300/6300: First-order predicate calculus p. 4

Pros/cons of propositional logic


The good: Propositional logic is declarative: pieces of syntax correspond to facts Propositional logic allows partial/disjunctive/negated information (unlike most data structures and databases) Propositional logic is compositional: meaning of P1 P2 is derived from meaning of P1 and P2 Propositional logic is context-independent (unlike natural language, where meaning depends on context) The bad: Propositional calculus requires explicit enumeration All elephants are gray: elephant1 isgray elephant2 isgray . . .
CS 5300/6300: First-order predicate calculus p. 2

Syntax of predicate logic basic elements


Constants Predicates Functions Variables Connectives Equality Quantiers Chair, 2, UofU, . . . Brother, GreaterThan, . . . Sqrt, LeftLegOf, . . . x, y, a, b, . . . , , , , = ,

CS 5300/6300: First-order predicate calculus p. 5

Predicate calculus
Predicate logic (aka predicate calculus) extends propositional logic with:
Functions:

Syntax of predicate logic sentences


Atomic sentences predicate ( term1 , . . . , termn ) or term1 = term2 Term function ( term1 , . . . , termn ) or constant or variable Example: GreaterThan ( Length ( LeftLegOf ( John ) ), ( Length ( LeftLegOf ( Eric ) ) ) ) Complex sentences made from atomic sentences using connectives:

transform zero or more constant values into some other constant value. Functions of one or more arguments that return the value true or false. Allow reference to arbitrary, unspecied values. color(x,GRAY) is predicate indicating that some as yet unbound variable x has the color gray. Indicate whether some or all objects exhibit a particular property.

Predicates: Variables:

Quantiers:

S, S1 S2 , S1 S2 , S1 S2 , S1 S2
CS 5300/6300: First-order predicate calculus p. 3 CS 5300/6300: First-order predicate calculus p. 6

Quantiers
Universal quantier

Properties of quantiers
When order matters:
p(x) is true for all values of x p(x) is true for some value of x

(x)p(x): (x)p(x):

Existential quantier

x y is the same as y x (why?) x y is the same as y x (why?) x y is not the same as y x (why?)
DeMorgans Laws for quantication Universal and existential quantication can be related using negation:

All elephants are gray.


(x)(elephant(x)

color(x, GRAY))

Someone wrote Computer Chess.


(x)write(x, COMPUTER-CHESS)

x P xP xP xP
CS 5300/6300: First-order predicate calculus p. 7

xP x P x P x P
CS 5300/6300: First-order predicate calculus p. 10

Common mistakes
Typically, is the main connective with Be careful about using as the main connective with : x At(x, UofU) Smart(x) Everyone is at the UofU and Everyone is smart More accurately, Everything in the universe is at. . . Typically, is the main connective with Be careful about using as the main connective with : x At(x, UofU) Smart(x) Implication is true as long as there is anyone (anything) not at the UofU!

First-order Predicate Logic


In rst-order predicate calculus, quantiers can only be applied to variables Higher order calculi allow quantication over entities such as functions First-order predicate calculus is adequate for expressing most mathematical concepts or computational principles Proof procedures for predicate calculus are similar to those for propositional calculus . . . but the details considerably more complex!

CS 5300/6300: First-order predicate calculus p. 8

CS 5300/6300: First-order predicate calculus p. 11

Nested Quantiers (syntax)


With multiple quantiers of same type, use one quantication symbol but list multiple variables

Decidability
Predicate calculus is undecidable There exist predicate calculus theorems that are always true, yet can never be proven true by any systematic procedure Proof procedures for predicate calculus are guaranteed to produce proof of any provable theorem Will not terminate for true but unprovable theorems Guaranteed to demonstrate falsity of any non-theorem Complexity, not undecidability, is the real problem

x,y father-of(x,y) female(y) daughter-of(y,x)


Order can be important when mixing quantier types!

x y owns(x,y)
Every entity in the universe owns at least one entity in the universe.

y x owns(x,y)
There is some entity in the universe that is owned by every entity in the universe. How would you limit entities to people?
CS 5300/6300: First-order predicate calculus p. 9

CS 5300/6300: First-order predicate calculus p. 12

Semantics in rst-order logic


Common interpretation: constant symbols objects predicate symbols relations function symbols functional (operational) relations predicate(term1 ,. . . ,termn ) is true iff objects referred to by term1 ,. . . ,termn are in the relationship referred to by predicate

Using logic to represent problems


Information retrieval Logic can be used to specify queries for information not explicitly represented in a data base MANAGER(PURCHASING-DEPT., JOHN-JONES) WORKS-IN(PURCHASING-DEPT., JOE-SMITH) (x, y, z)(WORKS-IN(x, y) MANAGER(x, z) BOSS-OF(y, z)) Query: Who is Joe Smiths boss? Answer query by generating constructive proof of theorem: (x)BOSS-OF(JOE-SMITH, x) A constructive proof will exhibit the x that actually exists
CS 5300/6300: First-order predicate calculus p. 13 CS 5300/6300: First-order predicate calculus p. 16

Examples:
Brothers are siblings

A more complex (but still simple) KB


Suppose we wanted to create a knowledge base for the following facts: 1. Marcus was a man. 2. Marcus was a Pompeian. 3. All Pompeians were Roman. 4. Caesar was a ruler. 5. All Romans were either loyal to Caesar or hated him. 6. Everyone is loyal to someone. 7. People only try to assassinate rulers they are not loyal to. 8. Marcus tried to assassinate Caesar.

x, yBrother (x, y) Sibling(x, y)


Sibling is symmetric

x, ySibling(x, y) Sibling(y, x)
Ones mother is ones female parent

x, yMother (x, y) (Female(x) Parent(x, y))


A rst cousin is a child of a parents sibling

x, yFirstCousin(x, y) p, psParent(p, x) Sibling(ps, p) Parent(ps, y)

CS 5300/6300: First-order predicate calculus p. 14

CS 5300/6300: First-order predicate calculus p. 17

Using logic to represent problems


Spatial reasoning
ON (C,A) ONTABLE(A) ONTABLE(B) CLEAR(C) CLEAR(B) (x)(CLEAR(x)

The KB in predicate logic


1. Marcus was a man. man(MARCUS) Pompeian(MARCUS) 2. Marcus was a Pompeian. 4. Caesar was a ruler.

3. All Pompeians were Roman.

x Pompeian(x) Roman(x)

C A B

ruler (CAESAR)

(y)ON(y, x))

5. All Romans were either loyal to Caesar or hated him. x Roman(x) ( (loyal(x,CAESAR) hated(x,CAESAR)) ( loyal(x,CAESAR) hated(x,CAESAR)) ) 6. Everyone is loyal to someone.

The implication formula gives precise relationship between the CLEAR and ON predicates Show that there is nothing on top of block C. Need to prove theorem (y)ON(y, C)
CS 5300/6300: First-order predicate calculus p. 15

x y loyal-to(x,y)

7. People only try to assassinate rulers they are not loyal to. x,y person(x) ruler(y) try-to-assassinate(x,y) loyal-to(x,y) 8. Marcus tried to assassinate Caesar. try-to-assassinate(MARCUS,CAESAR)
CS 5300/6300: First-order predicate calculus p. 18

Was Marcus loyal to Caesar?


x, y person(x) ruler (y)
try-to-assassinate(x, y)

loyal-to(x, y)

True for any x and y , so true for x = MARCUS , y = CAESAR Removing implication operator, negating conjunction:

loyal-to(MARCUS,CAESAR) person(MARCUS) ruler(CAESAR) try-to-assassinate(MARCUS,CAESAR) ruler(CAESAR) try-to-assassinate(MARCUS,CAESAR): person(MARCUS) loyal-to(MARCUS,CAESAR)


We need one more fact in the knowledge base:

x man(x) person(x) loyal-to(MARCUS,CAESAR)


CS 5300/6300: First-order predicate calculus p. 19

Common Problems
Time Past/present/future tense is not represented Ambiguity Everyone is loyal to someone could mean that everyone is loyal to some person, or that everyone is loyal to the same person Even for simple tasks, KB may not contain all facts needed to derive useful statements Very easy to forget to include statements that represent the most obvious facts!

CS 5300/6300: First-order predicate calculus p. 20

Вам также может понравиться