Sunteți pe pagina 1din 18

KCG College of Technology,Chennai 97 Computer Science and Engineering

VI SEM CSE

CS !"

#rtificial Intelligence

$%IT&III 'ue(tion and #n()er(


* + ,o) Kno)ledge i( repre(entedA variety of ways of knowledge(facts) have been exploited in AI programs. Facts : truths in some relevant world. hese are things we want to represent. *.+ /hat i( propo(itional logicIt is a way of representing knowledge. In logic and mathematics! a propo(itional calculu( or logic is a formal system in which formulae representing propositions can be formed by combining atomic propositions using logical connectives "entences considered in propositional logic are not arbitrary sentences but are the ones that are either true or false! but not both. his kind of sentences are called propo(ition(. E0ample "ome facts in propositional logic: It is raning. # $AI%I%& It is sunny # "'%%( It is windy # )I%*( If it is raining !then it is not sunny # $AI%I%& #+ "'%%(

*!+ /hat are the element( of propo(itional logic"imple sentences which are true or false are basic propositions. ,arger and more complex sentences are constructed from basic propositions by combining them with connecti1e(. hus propo(ition( and connecti1e( are the basic elements of propositional logic. hough there are many connectives! we are going to use the following fi1e 2a(ic connecti1e( here: %- ! A%*! -$! IF. /0% (or I12,()! IF.A%*.-%,(.IF. hey are also denoted by the symbols: ! ! ! ! ! respectively.

*3+ /hat i( inferenceInference is deriving new sentences from old.

*"+ /hat are modu( ponen(here are standard patterns of inference that can be applied to derive chains of conclusions that lead to the desired goal. hese patterns of inference are called inference rule(4 he best#known rule is called Modu( 5onen( and is written as follows:

*6+ /hat i( entailment2ropositions tell about the notion of truth and it can be applied to logical reasoning. )e can have logical entailment between sentences. his is known as entailment where a sentence follows logically from another sentence. In mathematical notation we write :

*7+ /hat are 7no)ledge 2a(ed agent(he central component of a knowledge#based agent is its knowledge base! or 34. Informally! a knowledge base is a set of sentences. 0ach sentence is expressed in a language called a knowledge representation language and represents some assertion about the world.

Figure 5.6 shows the outline of a knowledge#based agent program. ,ike all our agents! it takes a percept as input and returns an action. he agent maintains a knowledge base! 34! which may initially contain some 2ac7ground 7no)ledge4 0ach time the agent program is called! it does three things. First! it 0,," the knowledge base what it perceives. "econd! it A"3" the knowledge base what action it should perform. In the process of answering this 7uery! extensive reasoning may be done about the current state of the world! about the outcomes of possible action se7uences! and so on.

*8+ E0plain in detail the connecti1e( u(ed in propo(itional logic4 he (ynta0 of propositional logic defines the allowable sentences. he atomic (entence(& the indivisible syntactic elements#consist of a single propo(ition (ym2ol4 0ach such symbol

stands for a proposition that can be true or false. )e will use uppercase names for symbols: 2! 8! $! and so on. Comple0 (entence( are constructed from simpler sentences using logical connecti1e(4 here are five connectives in common use:

Figure 5.5 gives a formal grammar of propositional logic9

*9+ 9efine :ir(t order ;ogic)hereas propositional logic assumes the world contains facts! first#order logic (like natural language) assumes the world contains -b:ects: people! houses! numbers! colors! baseball games! wars! ; $elations: red! round! prime! brother of! bigger than! part of! comes between! ; Functions: father of! best friend! one more than! plus! ; * <+ Specify the (ynta0 of :ir(t&order logic in =%: form4

(66)

Compare different 7no)ledge repre(entation language(.

(6<)

/hat are the (yntactic element( of :ir(t >rder ;ogic=

he basic syntactic elements of first#order logic are the symbols that stand for ob:ects! relations! and functions. he symbols!come in three kinds: a) constant symbols! which stand for ob:ects9 b) predicate symbols! which stand for relations9 c) and function symbols! which stand for functions. )e adopt the convention that these symbols will begin with uppercase letters. 0xample: >onstant symbols : $ichard and ?ohn9 predicate symbols : 4rother! -n/ead! 2erson! 3ing! and >rown9 function symbol : ,eft,eg. * !+ /hat are ?uantifier(here is need to express properties of entire collections of ob:ects!instead of enumerating the ob:ects by name. 8uantifiers let us do this. F-, contains two standard 7uantifiers called a) 'niversal ( + and b) 0xistential ( + $ni1er(al ?uantification ( x) 2(x) : means that 2 holds for all values of x in the domain associated with that variable 0.g.! ( x) dolphin(x) @+ mammal(x) E0i(tential ?uantification ( x)2(x) means that 2 holds for (ome value of x in the domain associated with that variable 0.g.! ( x) mammal(x) A lays#eggs(x) 2ermits one to make a statement about some ob:ect without naming it * 3+ E0plain $ni1er(al 'uantifier( )ith an e0ample4 $ules such as BAll kings are persons!CC is written in first#order logic as x 3ing(x) @+ 2erson(x) where is pronounced as D For all ..E hus! the sentence says! BFor all x, if x is a king! then F is a person.B he symbol x is called a variable(lower case letters) he sentence 0 2!where 2 is a logical expression says that 2 is true for every ob:ect x. * "+ E0plain E0i(tential ?uantifier( )ith an e0ample4 'niversal 7uantification makes statements about every ob:ect.

It is possible to make a statement about some ob:ect in the universe without naming it!by using an existential 7uantifier. 0xample D3ing ?ohn has a crown on his headE x >rown(x) A -n/ead(x!?ohn) x is pronounced D here exists an x such that ..E or D For some x ..E * 6+ /hat are ne(ted ?uantifier(-

0xample#< D0verybody loves somebodyE means that for every person!there is someone that person loves x y ,oves(x!y) * 7+ E0plain the connection 2et)een and D0veryone likes icecream D is e7uivalent Dthere is no one who does not like ice creamE his can be expressed as : x ,ikes(x!Ice>ream) is e7uivalent to ,ikes(x!Ice>ream) * 8+ /hat are the (tep( a((ociated )ith the 7no)ledge Engineering proce((*iscuss them by applying the steps to any real world application of your choice. Kno)ledge Engineering
he general process of knowledge base constructiona process is called knowledge engineering. A knowledge engineer is someone who investigates a particular domain! learns what concepts are important in that domain! and creates a formal representation of the ob:ects and relations in the domain. )e will illustrate the knowledge engineering process in an electronic circuit domain that should already be fairly familiar!

The (tep( a((ociated )ith the 7no)ledge engineering proce(( are @


6. Identfy the task. . he task will determine what knowledge must be represented in order to connect problem instances to answers. his step is analogous to the 20A" process for designing agents.

2. Assemble the relevant knowledge. he knowledge engineer might already be an expert in the domain! or might need to work with real experts to extract what they know#a process called 7no)ledge ac?ui(ition4 !4 Decide on a vocabulary of predicates, functions, and constants. hat is! translate the important domain#level concepts into logic#level names. -nce the choices have been made. the result is a vocabulary that is known as the ontology of the domain. he word ontology means a particular theory of the nature of being or existence. 4. Encode general /cnowledge about the domain. he knowledge engineer writes down the axioms for all the vocabulary terms. his pins down (to the extent possible) the meaning of the terms! enabling the expert to check the content. -ften! this step reveals misconceptions or gaps in the vocabulary that must be fixed by returning to step G and iterating through the process. 5. Encode a description of the specijic problem instt nce. For a logical agent! problem instances are supplied by the sensors! whereas a BdisembodiedB knowledge base is supplied with additional sentences in the same way that traditional programs are supplied with input data. H. !ose "ueries to the inference procedure and get answers. his is where the reward is: we can let the inference procedure operate on the axioms and problem#specific facts to derive the facts we are interested in knowing. #. $ebug the %nowledge base. x &um'f(egs)x,4* +, -ammal)x* .s false for reptiles ,amphibians. o understand this seven#step process better! we now apply it to an extended example#the domain of electronic circuits.

The electronic circuit( domain


)e will develop an ontology and knowledge base that allow us to reason about digital circuits of the kind shown in Figure I.J. )e follow the seven#step process for knowledge engineering.

Identify the ta(7 here are many reasoning tasks associated with digital circuits. At the highest level! one analyFes the circuitCs functionality. For example! what are all the gates connected to the first input terminal= *oes the circuit contain feedback loops= hese will be our tasks in this section. #((em2le the rele1ant 7no)ledge )hat do we know about digital circuits= For our purposes! they are composed of wires and gates. "ignals flow along wires to the input terminalls of gates! and each gate produces a signal on the output terminal that flows along another wire. 9ecide on a 1oca2ulary )e now know that we want to talk about circuits! terminals! signals! and gates. he next step is to choose functions! predicates! and constants to represent them. )e will start from individual gates and move up to circuits. First! we need to be able to distinguish a gate from other gates. his is handled by naming gates with constants: / . , /2, and so on Encode general 7no)ledge of the domain -ne sign that we have a good ontology is that there are very few general rules which need to be specified. A sign that we have a good vocabulary is that each rule can be stated clearly and concisely. )ith our example! we need only seven simple rules to describe everything we need to know about circuits: 6. If two terminals are connected! then they have the same signal: <. he signal at every terminal is either 6 or K (but not both): G. >onnected is a commutative predicate: J. An -$ gateCs output is 6 if and only if any of its inputs is 6: 5. An #4%9 gateCs output is K if and only if any of its inputs is K: H. An L-$ gateCs output is 6 if and only if its inputs are different: 5. A %- gateCs output is different from its input: Encode the (pecific pro2lem in(tance he circuit shown in Figure I.J is encoded as circuit 01 with the following description. First! we categoriFe the gates: 2ype)/1*= /'3 2ype)/2*= /'3 5o(e ?uerie( to the inference procedure )hat combinations of inputs would cause the first output of 0l (the sum bit) to be K and the second output of 01 (the carry bit) to be l= 9e2ug the 7no)ledge 2a(e )e can perturb the knowledge base in various ways to see what kinds of erroneous behaviors emerge.

* 9+

Gi1e e0ample( on u(age of :ir(t >rder ;ogic4

he best way to find usage of First order logic is through examples. he examples can be taken from some simple domain(4 In knowledge representation! a domain is :ust some part of the world about which we wish to express some knowledge.

#((ertion( and ?uerie( in fir(t&order logic


"entences are added to a knowledge base using 0,,! exactly as in propositional logic. "uch sentences are called a((ertion(4 For example! we can assert that ?ohn is a king and that kings are persons:

2E(()45, 4ing )6ohn** .

Where KB is knowledge base. 2E(()45, x 4ing)x* +, !erson)x**.


)e can ask 7uestions of the knowledge base using A "3. For example! returns true. 8uestions asked using A"3 are called ?uerie( or goal(
A"3(34!2erson(?ohn)) )ill return true. (A"3 34to find whther ?on is a king)

A"3(34! 0 person(x))

The 7in(hip domain


he first example we consider is the domain of family relationships! or kinship. his domain includes facts such as B0liFabeth is the mother of >harlesB and B>harles is the father of )illiam5C and rules such as B-neCs grandmother is the mother of oneCs parent.B >learly! the ob:ects in our domain are people. )e will have two unary predicates! -ale and 7emale. 3inship relations#parenthood! brotherhood! marriage! and so on#will be represented by binary predicates: !arent, 8ibling, 5rother, 8ister, 0hild, $aughter,8on, 8pouse, 9usband, :randparent, :randchild, 0ousin, ;unt, and <ncle. )e will use functions for -other and 7ather.

*.<+

/hat i( uni1er(al in(tantiation-

'niversal instantiation ('I)


Every instantiation of a universally quantified sentence is entailed by it:
v ubst!"v#g$% &

for any variable v and ground ter' g E.g.% ( King!x& Greedy!x& Evil!x& yields:
King!John& Greedy!John& Evil!John& King!Richard& Greedy!Richard& Evil!Richard& King!Father!John&& Greedy!Father!John&& Evil!Father!John&& . . .

0xistential instantiation (0I)


)or any sentence % variable v% and constant sy'bol k that does not a**ear elsewhere in the knowledge base:
v ubst!"v#k$% &

E.g.% x Crown!x& OnHead!x,John& yields: Crown!C1& OnHead!C1,John& *rovided C1 is a new constant sy'bol% called a kole' constant

*. +

/hat i( for)ard chaining- E0plain )ith an e0ample4

'sing a deduction to reach a conclusion from a set of antecedents is called forward chaining. In other words!the system starts from a set of facts!and a set of rules!and tries to find the way of using these rules and facts to deduce a conclusion or come up with a suitable couse of action. his is known as data driven reasoning. 0LA12,0

he proof tree generated by forward chaining. 0xample knowledge base M he law says that it is a crime for an American to sell weapons to hostile nations. he country %ono! an enemy of America! has some missiles! and all of its missiles were sold to it by >olonel )est! who is American. M 2rove that >ol. )est is a criminal
American x! "ea#on y! $ell% x,y,&! Ho%tile &! Criminal x! Own% 'ono,(1! and (i%%ile (1!

... it is a cri'e for an +'erican to sell wea*ons to hostile nations: ,ono - has so'e 'issiles% i.e.% ( .wns!,ono%(& /issile!(&: - all of its 'issiles were sold to it by 0olonel West /issiles are wea*ons:
(i%%ile x! Own% 'ono,x! $ell% "e%t,x,'ono! (i%%ile x! "ea#on x!

+n ene'y of +'erica counts as 1hostile2: West% who is +'erican American "e%t! Enemy 'ono,America! Enemy x,America! Ho%tile x!

3he country ,ono% an ene'y of +'erica -

%ote:

(a) he initial facts appear in the bottom level (b) Facts inferred on the first iteration is in the middle level (c) he facts inferered on the <nd iteration is at the top level Forward chaining algorithm

*..+ /hat i( 2ac7)ard chaining - E0plain )ith an e0ample4 Forward chaining applies a set of rules and facts to deduce whatever conclusions can be derived. In 2ac7)ard chaining !we start from a conclu(ion!which is the hypothesis we wish to prove!and we aim to show how that conclusion can be reached from the rules and facts in the data base. he conclusion we are aiming to prove is called a goal !and the reasoning in this way is known as goal&dri1en. =ac7)ard chaining e0ample

Fig : 2roof tree constructed by backward chaining to prove that )est is criminal.

%ote: (a) o prove >riminal()est) !we have to prove four con:uncts below it. (b) "ome of which are in knowledge base!and others re7uire further backward chaining. (<G) 0xplain con:unctive normal form for first#order logic with an example.

Every sentence of first=order logic can be converted into an inferentially e"uivalent 0&7 sentence. In particular! the >%F sentence will be unsatisfiable :ust when the original sentence is unsatisfiable! so we have a basis for doing proofs by contradiction on the >%F sentences. /ere we have to eliminate existential 7uantifiers. )e will illustrate the procedure by translating the sentence B0veryone who loves all animals is loved by someone!B or

*.3+

/hat i( >ntological Engineering-

-ntology refers to organiFing every thing in the world into hierarch of categories. $epresenting the abastract concepts such as Actions! ime!2hysical -b:ects!and 4eliefs is called -ntological 0ngineering.

(<N) /ow categories are useful in 3nowledge representation= >A 0&-$I0" A%* -4?0> "
he organiFation of ob:ects into categorie( is a vital part of knowledge representation. Although interaction with the world takes place at the level of individual ob:ects! much reasoning ta%es place at the level of categories.

(<H)

)hat is taxonomy=

"ubclass relations organiFe categories into a taxonomy! or taxonomic hierarchy. axonomies have been used explicitly for centuries in technical fields. For example! systematic biology aims to provide a taxonomy of all living and extinct species9 library science has developed a taxonomy of all fields of knowledge! encoded as the *ewey *ecimal system9 and tax authorities and other government departments have developed extensive taxoriornies of occupations and commercial products. axonomies are also an important aspect of general commonsense knowledge. First#order logic makes it easy to state facts about categories! either by relating ob:ects to categories or by 7uantifying over their members:

(<5)

)hat is physical composition=

(<I) E0plain the >ntology of Situation calculu(. Situation( are logical terms consisting of the initial situation (usually called 8o* and
all situations that are generated by applying an action to a situation. he function 3esult)a, s* (sometimes called $o* names the situation that results when action a is executed in situation s. Figure 6K.< illustrates this idea. :luent( are functions and predicates that vary from one situation to the next! such as the location of the agent or the aliveness of the wumpus. he dictionary says a fluent is something that fllows! like a li7uid. In this use! it means flowing or changing across situations. 4y convention! the situation is always the last argument of a fluent. For example! l9old ng):1, 8o* says that the agent is not holding the gold &I in the initial situation 8o. ;ge) >umpus, 8o* refers to the wumpusCs age in 8o. #temporal or eternal predicates and functions are also allowed. 0xamples include the predicate &old (&I) and the function (eft(eg 'f ! >umpus*.

(<O) )hat is event calculus= Time and e1ent calculu(


"ituation calculus works well when there is a single agent performing instantaneous! discrete actions. )hen actions have duration and can overlap with each other! situation calculus becomes somewhat awkward. herefore! we will cover those topics with an alternative for# E4E,30+50656 malism known as e1ent calculu(, which is based on points in time rather than on situations. ( he terms Bevent C and BactionB may be used interchangeably. Informally! BeventB connotes a wider class of actions! including ones with no explicit agent. hese are easier to handle in event calculus than in situation calculus.) In event calculus! fluents hold at points in time rather than at situations! and the calculus is designed to allow reasoning over intervals of time. he event calculus axiom says that a fluent is true at a point in time if the fluent was initiated by an event at some time in the past and was not terminated by an intervening event. he .nitiates and 2erminates relations play a role similar to the 3esult relation in situation calculus9 .nitiates)e, f , t* means that the occurrence of event e at time t causes fluent ) to become true! while 2erminates (w % f! t* means that ) ceases to be true. )e use 9appens)e, t* to mean that event e happens at time t,
5

(GK) )hat are semantic networks= (G6) "emantic networks are capable of representing individual ob:ects!categories of ob:ects!and relation among ob:ects. -b:ects or >tegory names are represented in ovals and are connected by labeled arcs. "emantic network example

S-ar putea să vă placă și