0% found this document useful (0 votes)
13 views38 pages

Ai Spectrum U-3

The document outlines a syllabus for a course on First-Order Logic, covering topics such as syntax, semantics, knowledge representation, and inference methods. It details learning objectives including understanding first-order logic, knowledge engineering procedures, and various reasoning strategies. Additionally, it includes short questions and answers related to interpretations, quantifiers, and algorithms relevant to first-order logic.

Uploaded by

ketahay994
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views38 pages

Ai Spectrum U-3

The document outlines a syllabus for a course on First-Order Logic, covering topics such as syntax, semantics, knowledge representation, and inference methods. It details learning objectives including understanding first-order logic, knowledge engineering procedures, and various reasoning strategies. Additionally, it includes short questions and answers related to interpretations, quantifiers, and algorithms relevant to first-order logic.

Uploaded by

ketahay994
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

D 3J3

UNIT rt
e
thhLogo
ontheTi
lleCove
foor tBefore
Yo

Logicand Knowl
f u

edgeRepresentati
3
on SIAGROUP

SIA GROUP

Syllabus
First-Order Logic: Representati
on, Syntaxand Semanticsof
Engineering in First-Order Logic. First-Order Logic, Using Fir
st-Order Logic,Knowledge
Inference in First-Order
Logic: Propositionalvs. First-
BackwardChaining, Resolution. Order Inference, Unification an
d Lifting, ForwardChaini
ng,
Knowledge Representation:Ontolo
gical Engineering, Categories and
Objects, Reasoning Systemsfor Cat Objects, Events.Mental Events and
egories,Reasoning with Default Inf Mental
ormation.

LEARNING OB
JeCTIVES

✓ First
OrderLogicAlo ng with its Syntax andSemant
ics
Various Standard Quantifie
rs in First Order Logic

Procedure of Knowledge Eng
ineering in First Order Logic

Comparison ofPropositiona
l and First-Order Logic

Lifted Version ofModus Ponens
i.e., Generalized Modus Pon
ens
Forward andBackwardChaini
ng inFirst Order Logic, Various Resoluti
on Strategies
Definition andBasicConceptsof
Ontology, ConceptofCategories
Event, Generalized and Fluent Calc
ulus
Relationshipsbetween Agents and Ment
al Objects, Semantic System asa
✓ Reasoning System
ClosedWorld Assumption and Unique
NamesAssumption, UsageofTrut
h Maintenance System

INTRODUCTION

First-orderlogicîsmadeofobjectsandrelations.Itiscapableof
expressing facts aboutfeworall
objects
that enable to present general rules.It iswidely used in
mathematics, philosophy andcomputerscience.
TheModelsforfirst-order logic consistsof objects which are somet
imes referred to as domain elements.
The domain of amodelis defined as the setofobjects presen
t inthemodel.Knowledge engineering is
aprocessofknowledge baseconstruction
in whichadomain is investigated and
of objects and relations of adomain a formalrepresentation
is created.

Few inference rulesof propositional logic are alsoapplicable


for first-order logic. In addition to these
rules,three new rules have been defined for first-or
der logic. These rules areuniversal elimination rule,
existential elimination rule and existential introduction rule.The reasoni
ng methodsi.e.,forward chaining
and backward chaining can beused on
first-order logic.
Ontological engineering refers to the representation of abstract ideas. These ideas include Actions,
Time,Physical objects andbeliefs.The process of ontological engineering corresponds to the process of
knowledgeengineering. Oneimportantconceptrelatedto knowledge representation iscategori
eswhich
can bedefined asthecollection ofobjects. Event calculus perform
s actions that areentirely dependent
ontime rather than scenarios. The
term 'event calculus' denotes wider class of actions.It
is implemented
inordertoovercomethe problemsincurred in situation calculus.

SPECTRUM ALL-IN-ONEJOURNALFORENGINEERINGSTUDENTS
84
ARTIFICIALINTELLIGENCE [JNTU-HYDERABAD

PART-А SHORT QUESTIONSWITH SOLUTIONS

Q1. Write ashortnote oninterpretations.


Answer: Model
Paper-I
I1I,,
Q1(e)
Interpretation refersto the assignment oftruth valueto everyterminawell-formed formula.Thevalue ofagivenwell-

formed formula can be determined usingthetruth table (that specifies truth value for thesubexpression ofwff)because
eve

relation
literal in formula the
thebetween
ship followin
evaluates either trueorfalseundercertain interpretationfirst-orderinterpretationbasically specifiesthe
tog,

1. Objects andconstant symbol


2. Relations andpredicate symbol
3. Functions and function symbol.

Q2. Whatareuniversal quantifiers?

Answer:

Universalquantifier isthequantifierthat represents allthe elements in theuniverse ofdiscourse.It isdenoted by 'A

ThestatementVxP(x) represents the universalquantificationofthe logicalexpression 'P(r)'.Itsays that, "forall


x, P(r)
holds"or"P(x)is truefor every objectxinthe universe".

Example

Thestatement "allbirds havefeathers"canbetransformed intothepropositional form,VxP(x).

Where,P(x)isthepredicate that denotes'xhasfeathers andtheuniverseofdiscourseisonly populated bybirds'.

Theuniversal quantification 'VxP(x)' can begiven as,

P(x) P(x)лP(x,) лP(х)л... лP(x),ifall the elements in the universe canbelisted.


Q3. Definesyntactic sugar.Whatisits significance?
Answer : ModelPaper-II, Q1(e)

Syntactic Sugar
Syntactic sugarreferstoaconstruct defined inaprogramming languagesothattheexpressions canbe statedclearlyand
alsocanbereadeasily.Ingeneral, syntactic sugarrefers to aconcept usingwhichthesyntax canbecharacterized in suchaway
that theexpressions canbemade easier for the programmers.

Significance ofSyntactic Sugar


Thebasic roleofsyntactic sugaris to generate anequivalent sentence in thefirst-order logic bysimply desugarizingthe
sentence i.e., bysystematicallyreplacing with the respectiveequivalents.

Q4. Listthesteps involved in knowledgeengineering.


Answer: Model Paper-l, Q1(e)

Followingarethesteps involved inknowledgeengineering,


1. IdentifyingaTask
2. Acquiring RelevantKnowledge
3. DecidingConstants, PredicatesandFunctions Vocabulary
4. Encoding Domain'sKnowledge
5. Encoding aParticular Problem'sDescription
6. SeekingAnswersfromInference Procedure

7. Debugging the Knowledge Base.

WARNING: Xerox/Photocopyingofthis book isaCRIMINAL act.Anyonefound guilty is LIABLEtoface LEGALproceedings.


UNIT-3 LogicandKnowledge Representati 85
on
Q5. Write thebackwardcha
ining algorithmforfirst-order logic.
Answer:
Theworkingofbackward-
chaining algorithmisgiven below,
FunctionBACKWARD-CHAIN(
KB,query, 0)
Inputs: Knowledge Base (KB),a
listofconjuncts thatfor
msaqueryandcurrent substitution
(0).
Localvariables: Solutions-setof
substitutions initially is-setto
empty{}.
Ifqueryis NULLthen return {0
6←SUBSTITUTE(0, FIRST(
query))
Foreveryb'in KBwhere STA
NDA RDIZE-VARIABLE(b) (a,aa,.,=
b') and
0,←UNIFY(b,b')do
new_query -[a,a.... a/REST(qu
ery)]
solutions BACKWARD-CHAIN(KB,new_qu
ery,COMPOSE(0,,0)

solutions
end

return solutions

Q6. Whatare steps involved in


dynami cprogramming?
Answer:

ModelPaper-1, Q1(f)
Acombinationoffour sequ ential steps occurs indynamicpro
grammingareasfollows,
1. Thestructure ofthe solutionis tobe
characterized.
2. Representing the optimal solutionwhe
rever needed in the subproblems
(defining recursively).
3. Theoptimal solutionhastobecons
tructed fromtheinformation.
4. Thefinal solution hasto beconstruc
ted from theinformation.

Q7. Write ashort note on unitprefer


enc e.
Answer :
Model Paper-II, Q1(f1)

Unitpreferencestrategy prefersto perform


resolutionswhereoneofthe sentences isaunitclause
. This strategyworksonan
ideathat,auser wantstogenerateanemptyclause,
soitisrequiredtoprefer inferences that
resultsinshorter clauses.Resolvingaunit
clause (suchasA)with anyotherclause (such as AB
лC)alwaysresults inaclause (in thiscase BAC)
thantheotherclau that is shorter
se.

In the year 1964, the unit preference strategy was firstly


applied onpropositional inference. Thisresulted inadramatic
speedup, makingitfeasible toprove the theorems that were
practically impossible tobehandledwithout thepreference.
preference isan importantheuristie thatmustbecombinedwithotherstrategiesfor Unit
reducing thebranchingfactorin themedium
sizedproblemsso astomakethemsolvable. However,independently it cannot
reduce thebranching factor.
Q8. Write aboutsemantic
ne tworks.
Answer :
ModelPaper-III,Q1(1)

Semanticnetworks are theforms oflogic that notonly provides graphical support forvisualizing aknowledgebase but
alsofacilitates withefficient algorithms.This
helps theuser to understandthe characteristics ofan
membership.Theyare alsoconsidered to bethepart ofthesystemswhichare designed objectin terms ofcategory
particularly fororganizi
ngandreasoning
alongwithcategories. Inadditiontothis, itprovides aconvenientnotations forobjects,
relationandqualification, providedifthe
humaninterfacefactors aretakeninto consideration. But, ifthehumaninterfacefactors arenotconsideredthenthenotationfor
allobjects,relational andquantification etc.,wouldbeidentical.

ENTS
SPECTRUM ALL-IN-ONE JOURNALFORENGINEERING STUD
86
ARTIFICIAL INTELLIGENCE [JNTU-HYDERABĄD)
SO LUTIONS
PART-B ESSAYQUESTIONSWITH

3.1 FIRST-ORDERLOGIC

3.1.1 Representation

Q9. Whatis first-order logic? Howit is differentfrom propositional logic?Discussaboutprogramming


compo sitio nalit yprope rtywith respe cttorepre senta tionoffirst-order logic.
languages and
ModelPaper-II
Answer: l, Q6 (a)

First-order Logic

representing commonknowledge.Thelanguag
Firstorder logicisawayof
eoffirst-order logiecomprisesofobjects and
It iswidely
relations. Firstorderlogic is capableofexpressing factsaboutfeworallobjects thatenabletopresentgeneral rules.
used in mathematics, philosophy andcomputer science.

Difference between First-order LogicandPropositionalLogic

First-orderlogic assumesthattheworldcontains objectwithsomerelation amongthemwhicheitherhold ordonothold.

Propositional logic assumesthat in theworld, there are facts thateitherholdordo not hold but every fact can eitherbe
true orfalse.

Programming Languages

Theprogramming languages likeC++,Java, LISPare referred toas formal languageswhichare mostlyused forwriting
programs. Thoughdata structures within theseprogramminglanguages are capable ofrepresentingfacts, they lack in deriving
factsfromotherfacts. Thisisbecauseanyupdation donetoadata structure isperformedbyinvokingdomainspecific procedures.
Thesearetheprocedureswhose implementation details are derivedbytheprogrammersbasedonhis/herownknowledgeregarding
thedomain.

These sort ofprogramming languages differ from propositional languages.This is because in propositional language,
knowledge and inference areconsidered asaseparateunitsandinferenceisnotdependent on domain(i.e.,it is domain-independent).

Compositionality

Compositionalityis another propertyofpropositional logicsemantics. Thisproperty explains therelationshipbetweenthe


syntaxandsemanticsofasentence.Itstates that, meaningofasentenceisafunctionof meaningofpartsofsentence(words). Inother
words, this property specifies that meaningofacomplexsentencecanbeinterpretedbyunderstandingthemeaning ofthe partsof
thesentencealongwithaclearunderstanding ofthe syntactierulesused forcombin
ing theseparts.Ifasentence S"consistingofs,
gofS(i.e, M(S) is understood bycombining the meaningof
and S,isdefined undercertain syntacticrule,then thesemanticmeanin
5,(ie.,M(S,) andS,(i.e.,M(S.). ing It isanessentialpropertyin applications of formal semantics innatural language. It is an important
specific solution to the puzz le ofsyste maticity.
guide thatassists theusersin find
Example (ir

Considerthe expression"GermanLecturer". In thisexpression,


Germnan canbe combinedwith lecturerasamodifier(like
Lecturerfrom Germany)orasanargument(LecturerofGerman).Thoughboththese
constituentsreflect thesame meaning, the
syntacticrules bywhichthe
y arecombinedaredifferent.

iscompositionalbecauseiftheexpressionwasnon-compositional
Consideranother expression"red hair".Thisexpression
interpretedasthe "color ofthe blood"
thenthe meaningofeveryconstituent maybeunderstood differentlyi.e., 'red'maybe
theactual meaning
hair.This signifiesameaningwhichdiffersfrom
thereby interpretingtheentire sentence ascoloroftheblood
(i.e., Hairdyedwithred).
ind guilty isLIABLE to face LEGAI
NIT-3 LogicandKnowledgeRepresentation
87
3.1.2 Syntaxand Semantics ofFirst-
Order
(iii) UnaryFunctions
Logic
Thereare certain relationships that aretobe
considered
Q10. Explain various models forfirst order logic as functions.Inthese functions,
givenobjectis related
. a

to exactly one object using the


Answer :
existing relationships..
In this model, there exist only one
unary function that
ModelsforFirst-order Logic includes the following map
pings,
TheModels forfirst-orderlogic <Alice theQueen> →Alice's righ
consists ofobjectswhich t hand
are sometimesreferredto <Racheal>→Racheal's right han
asdomain elements. The
domain of d.
amodel isdefinedasthe
setofobjects presentin
the model. It is necessary tohavetota
l fun ctions defined for the
Example models infirst orderlogic.
That is, there must exist a
value for every individual inp
Consideramodelconsistingof ut tuple. Therefore, the
sixobjects,threebinary Diamondmusthavearighthan
relations, threeunary relations and one dandthere mustalsobe
unary function. aright handfor eve
ry righthand. However, this
seems
Theobjects in this modelare tobeanawkwardsituat
as follows, ion. Toovercome this situat
ion,
atechnical soluti
on [consistingofinvisi
Object1: Alicethe queen bleobject] isto
make anassertion that
righthandofeveryobject
that has
noright handincluding
Object2: Alicefriend Racheal the respective right hand itsel
f.
Q11. Writeshortnotes onthe
Object 3: Alice enemyJohn followingwithrespect
tothesyntaxoffirst-ord
er logic,
Object4: Alice'srighthand (i) Symbols
Object 5: Racheal's right hand
(ii) Interpretations
Object6: Diamond. (iii) Terms.
Answer:
Thefollowing aredifferentways
inwhichthese objects
are related.
(i) Symbols
(i) Binary Relationship Therearethreekinds ofsymbols
availableinfirst-order
logic. Theyare,
Binary relationship exist between,
1. Constant Symbols
AliceandRacheal[becauseRachealis a
friendofAlice],
whichisdefinedas"Friend"rela Constants are the objects withunchange
tionandis represented dvalues. For
as {<Alice, Racheal>
,<Racheal, Alice>}. example, penetc.

2. PredicateSymbols
Alice,John[becauseJohnistheenemyofAlic
e],which
is defined as "Enemy" relation It represents the association between objects that
andis represented as are
{<Alice, John>,<John,Alice>}. eitherconstants or variables andhave true or false as
theirtruth values.
Diamond, Racheal [because diamond is in thehand
of
Racheal], whichis defined as “inhand"relation Apredicate consists of,
and is
represented as {<Diamond, Rac
heal>}. (a) Predicate namewhichspecifiestypeofassociation
This “inhand"relation.consists of amongobjects.
only onetuple.
The "friend","Enemy"and "inhand"rela (b) Arguments that indicate the objects to be
tionsarecalled associated.
binary relationsbecausetheyrel
atedifferentobjectpairs.
(i) Considertwopredicates,
UnaryRelationsh
ips
Loves(Amjad,Football) (Amjadloves football)
Unaryrelationships orproperties
are defined on,
Reads(Atul, b) (Atul reads anything).
Alice,Rachealas "person"property[since itis true In the above example, loves and reads are predicate
forAlice, Racheal].
namesandAmjad, Atul,footballandbaretheassociated
Aliceas "Queen”property[since itistrueonlyfor objects.Eachoftheabovepredicatehas atruthvalue.For
Alice] instance, loves (Amjad, Football) canhavetruth value
false,ifAmjadhatesfootball.Also,theotherpredicatehas
Diamondas "Diamond"property[since it is true a valuetrue,ifAtulreadsanykindofbook.However, this
onlyforDiamond]. is possible onlywhenthequantifier suitablyqualifiesb.

ag JA
SPECTRUMALL-IN-ONEJOURNALFORENGINEERINGSTUDENTS
88

3. FunctionSymbols
ARTIFICIALINTELLIGENCE [JNTU-HYDERABAQL UN

Thedefinition offunctionis almostsimilar to thatofpredicates. The


s. Function only
s also difference
acts ctdescr
asobjeis iptors. alsoassociatethose
thatfunctions
objectswhichhaveother values, apart from truth value
to
Supposetherearetwofunctions, wel
mul (5, 3)(5 multiplied by3is 15) (th
eve
Mother(Amjad)(Amjad'smother) und
ectively.
Here, "mul()" and "mother()"indi
rectly indicates "15"and “Amjad'smother"resp spe

Interpretations ofPredicate Logic Formula 1.


basis of,
Anyformula inpredicate logicisinterpreted onthe 2.

(a) Truthvalues ofthepredicate. 3.

(b) Nature ofquantifiers.


that
(c) Valuesofconstants andfunctions acquired overadomainE.
Anexampleto demonstrate the interpretation
ofpredicate logic formula.
nec
Therearetwoformulas,
1.
(i) Vbq(b)
2.
(ii) 3bq(b)
Where,the domain,E={0, 1} andg(1)=True, q(0)=False.
3.
Interpretationof First Formula

Ifq(b) is trueforallvaluesofbselected from domainE,thenVbq(b)is true.Otherwise it is false.Intheaboveexample 4.


twovalues ofb are chosen fromtheE,Theyare,

(i) q(1)is trueforb=1


to
(ii) q(0)isfalse for b=0
in
Here,(i)isfalse because it is trueonlyforb = 1 butnotfor b=0. sub:
Interpretation ofSecond Formula oft
dete
Ifq(b) is true for at leastanyonevalue ofb, then 3bg(b)istrue. Hence, (ii) is truefor b=0.
sym
Example inte

Considerthemodelgivenbelow.Itcontains fourconstants(objects)(i.e.,driver,key,car,license),twopredicatesymbols Inte


(i.e., drives and starts) andone functionsymbol (i.e.,getlicense).
inw
이 Key
give
Starts inter
cons

Drives oper
indi
Q
spec
Exa

Car
1.
getlicense 2.

Driver 3.

4.

S.

License

Figure: ModelofaWorld nsib)

WARNING:Xerox/Photocopying ofthisbookis aCRIMINALact:AnyonefoundguiltyisLIABLEtofaceLEGALproceedings.


UNIT-3 Logicand Knowledge Representation 89
s
Interpretation
(ii) 6. Person, Queen, Diamond refers to set of objects
Interpretation refers to theassignhient of truth value "Person", "Queen","Diamond"respectively.
toeveryterminawell-f
ormedformula. Thevalue ofagiv 7. Righthand refers to "Righthand"function.
well-formed formula can bedeterminedusing the en
truth table 8.
(thatspecifiestruthvalueforthesubexpression ofwff)because Johnis anenemyofAlice
everyliteral in the formula evaluates to either true or false 9. Diamondis inthehandofRacheal.
undercertaininterpretation.First-orderinterpretationbasically
specifiestherelationshipbetweenthefollowing,
Outofthese interpretations, some ofthe possible
interpretations (intended interpretations) includethe
Objectsandconstant symbol sentences
1. (1),(2), (4), (5), (6), (7).
2. Relations and predicate symbol
Ifamodel consists ofn-objects, then total
number of
Functions andfunction symbol. possible interpretationsaren².Itis notnecessary
3. forevery object
tohave aname. For instance, the
intended interpretation does
Therefore,itcanbesaidthatinterpretationis asemantics
notassign anynamefortheobjects "Dia
mond"or"righthand".
thatrelate sentencesto modelsoasto determinetruthvalue.
(iii) Terms
Inorder to interprete the
meaning ofasentence, it is
necessaryto maintainthe followinginformation, A logical expression used as areference for anobject
is called aterm. Termcanberepresented either as
aconstant
1. Domainofdiscourse(D). oravariable ora function with parenthesized list ofterms as
2. Anelementof'D'as aninterpretationforeveryconstant arguments. Symbolically,it canbe shownas,
symbol Term=Function(Term, ....) orconstantorvariable
3. An K-ary function from Dto D(D →D)as an Example
interpretation forevery K-ary function symbol.
Brother(Ram),indicates Ram'sbrother.
4. AnK-aryrelation on'D' as an interpretation for every
Q12. Define quantifiers. Explain in detail aboutthe
K-ary predicate symbol. different standard quantifiers presentin first
Anyobject that maintains this informationis referred order logic.
to as astructure oramodel. This information helpstheuser Answer
.Model Paper-, Q6(a)
in assigning the truth valuetoanyatomic formu
la onlyafter
Quantifiers
substituting freevariables ofatomic formula with an element
ofthedomain.That is, thetruth value ofany Quantifiersallowtoexpress characteristicsofcollection
sentence canbe
determined byamodeland aninterpretation forthe ofobjects. Therearetwotypes ofstandard quanti
sentence fiers present
symbol.Therefore,itisnecessary todefine entai infirst-orderlogic.
lment, validity
intermsofallpossiblemodels andall possible
interpretations . 1. UniversalQuantifier (V)
Intended Interpretation
Universal quantifieristhe quantifier thatrepre
sents all
Intendedinterpretationisoneofthepossibleinterpretation the elements in the universe ofdiscourse.It is denot
edby'V'.
inwhichthedomainofdiscourse andthe
nonlogical symbolsare The statement VxP(x) represents the universal
giventheir intended meaning.In Peanoarithmetic, the intended quantification ofthe logical expression 'P(x)'. It says
interpretation isreferred toasstandard modelofarithmetic that that,
"for allx,P(x)holds" or "P(x)is true for every
consists ofnatural numbers with their ordinary arithme
objectxinthe
tical universe"
operations. This sort of interpretation does
not have explicit
Endication in the syntactical rules because Example1
it is necessary to
Specify these rules usinga formal The statement "all birds have feathers"
language. can be
Example transformed into the propositionalform,VxP(x).

Where, P(x) isthepredicate that denotes 'xhasfeathers


Considerthe following interpretations,
andthe universe ofdiscourseis onlypopulatedbybirds'.
. Alice refers to "Alice the Que
en" Theuniversal quantification'VxP(x)'can begiven as,
2.
Racheal is afriend ofAli
ce
3.
P(x)^ P(x)^P(x,)^P(x) ... P(x),ifalltheelements
Rachealrefers to "Racheal" intheuniverse canbelisted.

Enemy, friend refers to friend, Enemy relation Example2


respectively. Ifthere are only five birds intheuniverse
ofdiscourse
Inhand refers to Inhandrelationthat is defined between (b,b,b,b,andb,),then the statement canbewritten as,
twoobjects (diamondand Racheal). P(b,) ^P(b,) ^P(b,)^P(b,) ^P(b,).

JA SPECTRUM ALL-IN-ONE JOURNALFOR ENGINEERINGSTUDENTS

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy