ai 02

45
06/22/22 1 AI in logic perspective AI is the study of mental faculties through the use of computational models. It is on the premise that what brain does may be thought of as a kind of computation. Though what brain does easily takes enormous efforts to be done by a machine. Eg: vision.

Upload: shailesh-singh

Post on 12-May-2015

326 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Ai 02

04/12/23 1

AI in logic perspective AI is the study of mental faculties through the

use of computational models. It is on the premise that what brain does may

be thought of as a kind of computation. Though what brain does easily takes enormous

efforts to be done by a machine. Eg: vision.

Page 2: Ai 02

04/12/23 2

Internal representation In order to act intelligently, a computer must

have the knowledge about the domain of interest.

Knowledge is the body of facts and principles gathered or the act, fact, or state of knowing.

This knowledge needs to be presented in a form, which is understood by the machine.

This unique format is called internal representation.

Thus plain English sentences could be translated into an internal representation and they could be used to answer based on the given sentences.

Page 3: Ai 02

04/12/23 3

Properties of internal representation

Internal representation must remove all referential ambiguity.

Referential ambiguity is the ambiguity about what the sentence refers to.

Eg: ‘ Raj said that Ram was not well. He must be lying.’

Who does ‘he ‘ refers to…?.

Page 4: Ai 02

04/12/23 4

Properties of internal representation..

Internal representation should avoid word-sense ambiguity.

Word-sense ambiguity arise because of multiple meaning of words.

Eg: ‘Raj caught a pen. Raj caught a train. Raj caught fever.’

Page 5: Ai 02

04/12/23 5

Properties of internal representation..

Internal representation must explicitly mention functional structure

Functional structure is the word order used in the language to express an idea.

Eg: ‘Ram killed Ravan. Ravan was killed by Ram.’ Thus internal representation may not use the

order of the original sentence.

Page 6: Ai 02

04/12/23 6

Properties of internal representation..

Internal representation should be able handle complex sentence without losing meaning attached with it.

Page 7: Ai 02

04/12/23 7

Predicate Calculus Predicate Calculus is an internal representation

methodology which help us in deducing more results from the given propositions (statements).

Predicate calculus accesses individual components of a proposition and represent the proposition.

For example, the sentence ‘ Raj came late on Sunday’ can be represented in predicate calculus as

(came-late Raj Sunday) Here ‘came-late’ is a predicate that describes the

relation between a person and a day.

Page 8: Ai 02

04/12/23 8

‘ Raj came late on a rainy Sunday’ can be represented as

(came-late Raj Sunday) (inst Sunday rainy)Predicate permits us to break a statement down

into component parts namely, objects, a characteristic of the object, or some assertion about the object.

 

Page 9: Ai 02

04/12/23 9

Syntax of Predicate calculus 

1. Predicate and Arguments In predicate calculus, a proposition is divided

into two parts:          Arguments (or objects)        Predicate (or assertion) The arguments are the individual or objects an

assertion is made about. The predicate is the assertion made about them.

 

Page 10: Ai 02

04/12/23 10

In an English language sentence, objects are nouns that serve as subject and object of the sentence and predicate would be the verb or part of the verb.  

For example the proposition: ‘Vinod likes apple’ would be stated as:

(likes Vinod apple) Where ‘likes’ is the predicate and Vinod and

apple are the arguments.  In some cases, the proposition may not have

any predicates. For example:   Anita is a woman. i.e. (inst Anita woman). 

Page 11: Ai 02

04/12/23 11

2. Constants Constants are fixed value terms that belong to

a given domain. They are denoted by numbers and words. Eg:

123,abc.

Page 12: Ai 02

04/12/23 12

3.Variables In predicate calculus, letters may be substituted for

the arguments. The symbols x or y could be used to designate some

object or individual. The example “Vinod likes apple “ could be expressed

in variable form if x = Vinod and y = apple. Then the proposition becomes:

(likes x,y) If variables are used, then the stated proposition must

be true for any names substituted for the variables.

Page 13: Ai 02

04/12/23 13

Instantiation Instantiation is the process of assigning the

name of a specific individual or object to a variable.

That object or individual becomes an “ instance“ of that variable.

In the previous example, supplying Vinod and apple for x and y is a case of instantiation.

Page 14: Ai 02

04/12/23 14

4. Connectives There are four connectives used in predicate

calculus. The are ‘not’, ‘and’, ‘or’ and ‘if’. If p and q are formulas then (and p, q),

(or p, q), (not p) and (if p, q) are also formulas.

They can be expressed in truth tables.

Page 15: Ai 02

04/12/23 15

(not p) p (not p) T F F T

Page 16: Ai 02

04/12/23 16

(and p, q) p q (and p, q) T T T T F F F T T F F F

Page 17: Ai 02

04/12/23 17

(or p, q) p q (or p, q) T T T T F T F T T F F F

Page 18: Ai 02

04/12/23 18

(if p, q) p q (if p, q) T T T T F F F T T F F T

Page 19: Ai 02

04/12/23 19

5. Quantifiers A quantifier is a symbol that permits us to state

the range or scope of the variables in a predicate logic expression.

Two quantifiers are used in logic: The universal quantifier –’for all’. i.e

(forall (x) f) for a formula f. The existential quantifier – ‘exists’. i.e.

(exists (x) f) for a formula f.

Page 20: Ai 02

04/12/23 20

6. Function applications It consists of a function which takes zero or

more arguments. Eg: friend-of(x).

Page 21: Ai 02

04/12/23 21

“All Maharastrians are Indian citizens” could be expressed as:

(forall (x) (if Maharastrian(x) Indiancitizen(x)). “ Every car has a wheel” could be expressed as: (forall (x) (if (Car x) (exists (y) wheel-of (x y))).

Page 22: Ai 02

04/12/23 22

The predicate calculus consists of:

A set of constant terms. A set of variables. A set of predicates, each with a specified

number of arguments. A set of functions, each with a specified

number of arguments. The connectives- ‘if’, ‘and’, ‘or’ and ‘not’. The quantifiers- ‘exists’ and ‘forall’.

Page 23: Ai 02

04/12/23 23

The terms used in predicate calculus are: Constant terms. Variables. Functions applied to the correct number of

terms.

Page 24: Ai 02

04/12/23 24

The formulas used in predicate calculus are: A predicate applied to the correct number of

terms. If p and q are formulas then (if p, q), (and p,

q), or(p, q) and (not p). If x is a variable, and p is a formula, then

(exists(x) p), and (forall(x) p).

Page 25: Ai 02

04/12/23 25

In predicate calculus, the initial facts from which we can derive more facts are called axioms.

The facts we deduce from the axioms are called theorems.

The set of axioms are not stable and in fact change over time as new information (axioms) come.

Page 26: Ai 02

04/12/23 26

Inference Rules

From a given set of axioms, we can deduce more facts using inference rules. The important inference rules are:

Modus ponens: From p and (if p q ) infer q. Chain rule: From (if p q ) and (if q r ) infer

(if p r ). Substitution: if p is a valid axiom, then a

statement derived using consistent substitution of propositions is also valid.

Simplification: From (and p q) infer p.

Page 27: Ai 02

04/12/23 27

Conjunction: From p and q infer (and p q). Transposition: From (if p q ) infer (if (not q )

(not p)) Universal instantiation: if something is true

of everything, then it is true for any particular thing.

Abduction: From q and (if p q ) infer p. (Abduction can lead to wrong conclusions. Still, it is very important as it gives lot explanation. For example: medical diagnosis.)

Induction: From (P a), (P, b),…. infer (forall (x) (P x)).( Induction leads to learning.)

Page 28: Ai 02

04/12/23 28

Express the following in predicate calculus:

Roses are red. (if (inst x rose) (color x red)). Violets are blue. (if (inst x violet) (color x blue)). Every chicken hatched from an egg. (forall (x) (if (chicken x) (exists (y) hatched-from(x y))). Some language is spoken by everyone in this class. (forall (x) (if (belong-to-class x) (exists (y) speak-

language(x y))). If you push anything hard enough, it will fall over. (forall (x) (if (push-hard x) (fall-over x)). Everybody loves somebody sometime. (forall (x) ((exists (y) loves-sometime(x y))). Anyone with two or more spouses is a bigamist. (forall (x) ((inst x have-more-spouse) (inst x bigamist(x)))

Page 29: Ai 02

04/12/23 29

Arun likes all kinds of food. Apples are food. Chicken is a food. Anything anyone eats and is not killed

by is food. Varun eats peanuts and is still alive. Kavita eats everything Varun eats.

Page 30: Ai 02

04/12/23 30

The members of The Club are Anil, Sangita, Ajit and Vanita.

Anil is married to Sangita. Ajit is Vanita’s brother. The spouse of every married person

in the club is also in the club. The last meeting of the club was at

Anil’s house.

Page 31: Ai 02

04/12/23 31

Alternative notations

Page 32: Ai 02

04/12/23 32

Knowledge, which is represented in the internal representation technique predicate calculus, could be represented in a number of alternative notations.

The important representations are: Semantic networks Slot assertion notation. Frame notation

Page 33: Ai 02

04/12/23 33

Semantic network ( Associative networks)

One of the oldest and easiest to understand knowledge representation schemes is the semantic network.

They are basically graphical depictions of knowledge that show hierarchical relationships between objects.  

Page 34: Ai 02

04/12/23 34

For example ‘Sachin is a cricketer’ ie. ( inst Sachin cricketer), can be represented

in associative network as

Cricketer

Sachin

inst

Page 35: Ai 02

04/12/23 35

A semantic network is made up of a number of ovals or circles called nodes.

Nodes represent objects and descriptive information about those objects.

Objects can be any physical item, concept, event or an action.

The nodes are interconnected by links called arcs.

These arcs show the relationships between the various objects and descriptive factors.

The arrows on the lines point from an object to its value along the corresponding arc.

Page 36: Ai 02

04/12/23 36

From the viewpoint of predicate calculus, associative networks replace terms with nodes and relation with labeled directed arcs.

The semantic network is a very flexible method of knowledge representation.

There are no hard rules about knowledge in this form.

Page 37: Ai 02

04/12/23 37

Semantic networks can show inheritances in the sense that it can explain how elements of specific classes inherit attributes and values from more general classes in which they are included.

The isa relation is a subset relation. The cricketers is a subset of the set of sportsman.

Cricketer

Sachin

Sportsmaninst

isa

Page 38: Ai 02

04/12/23 38

Eg: (isa cricketer sportsman). The instance relation corresponds to the

relation element-of. Sachin is an element of the set of cricketers.

Thus he is an element of all the supersets of Indian international cricketers.

The ‘isa’ relation corresponds to the relation ‘subset of’.

Cricketers is a subset of sportsmen and hence cricketers inherit al the properties of sportsmen.

Page 39: Ai 02

04/12/23 39

Anil

ManIs a

Human

married to

AnithaIs a WomanIs a has a

Child Ravi

BoyIs a Is a

is a

Goes to School

owns Car

Is a

Maruti

Color

White

made in

India

plays

Cricket

is a

Sport

is a S.Eworks for TCS

Belongs to

TATA

Example..

Page 40: Ai 02

04/12/23 40

The predicate calculus lacks a backward pointer resulting a long search for retrieving information.

Thus the predicate calculus along with an indexing (pointing) scheme is a much better internal representation scheme than semantic networks as it has connectives and quantifiers.

Page 41: Ai 02

04/12/23 41

Slot assertion notation.

In a slot assertion notation various arguments , called slots, of predicate are expressed as separate assertions.

Slot assertion notation is a special type of predicate calculus representation.

For example (catch-object sachin ball) can be expressed as

(inst catch1 catch-object)…. // catch1 is a one type of catching.

(catcher catch1 sachin)….// sachin did the catching.

(caught catch1 ball)…..// he caught the ball.

Page 42: Ai 02

04/12/23 42

Frame notation combines the different slots of the slot assertion notation.

Thus we have, (catch-object catch1 (catcher sachin) (caught ball)). Here we have constructed a single structure

called a frame that includes all the information.

Frame ( Slot and Filler)notation.

 

Page 43: Ai 02

04/12/23 43

Convert the following to first-order predicate logic

using the predicates indicated:

swimming_pool(X) steamy(X) large(X) unpleasant(X) noisy(X) place(X)

All large swimming pools are noisy and steamy places.

All noisy and steamy places are unpleasant. All noisy and steamy places except swimming

pools are unpleasant. The swimming pool is small and quiet.

Page 44: Ai 02

04/12/23 44

All large swimming pools are noisy and steamy places. (forall (x) (if (and large(X) swimming_pool(X))

(and noisy(X) (and (steamy(X) place(X)))). All noisy and steamy places are unpleasant. (forall (x)(and noisy(X) (and (steamy(X) place(X))

unpleasant(X))). All noisy and steamy places except swimming pools are

unpleasant. (forall (x)((not swimming_pool(x)) and noisy(X) (and

(steamy(X) place(X)) unpleasant(X)))). The swimming pool is small and quiet. (and swimming_pool(x) and (not large(X)) (not noisy(X)))

Page 45: Ai 02

04/12/23 45

Represent in predicate calculus and then in semantic network

Circus elements are elephants.Elephants have heads and trunks.Heads have mouths.Elephants are animals.Animals have hearts.Circus elephants are performers.Performers have costumes.Costumes are clothes.