Table Of ContentJ. LOGIC PROGRAMMING 1986:3:185-215
LOGIN: A LOGIC PROGRAMMING LANGUAGE WITH
BUILT-IN INHERITANCE
HASSAN A’iT-KACI AND ROGER NASR
D An noitarobale fo eht GOLORP egaugnal is debircsed ni hcihw eht noiton
fo redro-tsrif mret is decalper yb a erom lareneg .eno sihT dednetxe mrof fo
smret swolla eht noitargetni fo na-ecnatirehni A-SI yltcerid-ymonoxat
otni eht noitacifinu ssecorp rehtar than yltceridni hguorht eht -noituloser
desab ecnerefni msinahcem fo .GOLORP sihT stluser ni erom tneiciffe
snoitatupmoc and decnahne egaugnal .ssenevisserpxe ehT egaugnal thus
,deniatbo dellac ,NIGOL subsumes ,GOLORP ni eht esnes that -nevnoc
lanoit GOLORP smargorp era yllauqe llew detucexe yb .NIGOL
a
ti si raelc taht eht lanretni gninoitcnuf fo tnegilletni .noitalimissa si yltnatsnoc decrofnier yb eht
lasuac snoitautis ni hcihw eht snoitapicitna era dewollof yb evitceffe slortnoc eht( sseccus ro eruliaf fo eht
gnigniws gnidneped no rehtehw eht gnignah tcejbo saw yllaer a elibom ro ,ton .).cte
sihT seod ton naem taht lla eht etaidemmi secnerefni fo eht lanoitarepoerp slevel evah a lasuac
.tnetnoc yehT nac evres sa .sreifissalc
JEAN ,TEGAIP Understanding Causality
1. INTRODUCTION
ecniS eht ylrae syad fo hcraeser ni detamotua ,noitcuded ecnatirehni has neeb
desoporp as a snaem ot erutpac a laiceps dnik fo ,noitamrofni ,.ziv cimonoxat
.noitamrofni roF ,elpmaxe nehw ti is detressa that “whales era mammals”, ew
dnatsrednu that revetahw seitreporp mammals possess dluohs osla dloh rof .selahw
Address correspondence to nassaH icaK-t’iA ro regoR ,rsaN laicifitrA ecnegilletnI ,margorP -celcorciM
scinort dna retupmoC ygolonhceT ,noitaroproC 0349 hcraeseR ,draveluoB ,nitsuA TX .95787
THE JOURNAL FO LOGIC PROGRAMMING
reiveslEO ecneicS gnihsilbuP ,.oC ,.cnI 6891
25 tlibrednaV ,.evA weN ,kroY NY 71001 05.30$/68/6601-3470
186 HASSAN AiT-KACI AND ROGER NASR
,yllarutaN this gninaem fo ecnatirehni nac eb llew derutpac ni cigol yb eht
scitnames fo lacigol .noitacilpmi ,deednI
)x(elahW.xV )x(lammaM*
is .yrotcafsitas
semantically
,revewoH ti is ton .yrotcafsitas nI a redro-tsrif cigol noitcuded
pragmaticalfy
metsys using this ,noitacilpmi ecnatirehni morf “mammal” ot “ ”elahw is deveihca
yb an .pets tuB eht laiceps dnik fo noitamrofni desserpxe ni this alumrof
inference
wohemos seod ton mees ot eb tnaem as a noitcuded suht-pets .sfoorp
lengthening
,rehtaR its esoprup smees ot eb ot ,etarelecca ro ,sucof a noitcuded suht-ssecorp
.sfoorp
shortening
ynaM slasoporp evah neeb dereffo ot laed htiw ecnatirehni and cimonoxat
noitamrofni ni detamotua .noitcuded ,yldettimdA gniod ti all ni redro-tsrif ,cigol as
desoporp ni ]5[ and ,]3[ is yllacitnames ;tcerroc ,sselehtreven eseht sehcaorppa egdod
eht issue fo gnivorpmi eht lanoitarepo noitcuded .ssecorp ,rehtO erom lanoitarepo
,stpmetta ekil esoht detroper ni ]8[ and ,]4[ esoporp eht esu fo emos smrof fo
citnames .krowten ,revewoH ti is ton syawla raelc what scitnames ot etubirtta ot
eseht ,smsilamrof hcihw ni yna esac esol eht elpmis ecnagele fo ekil-GOLORP
.ssenevisserpxe
As nwohs ni ,]2[ eht xatnys and lanoitarepo noitaterpretni fo redro-tsrif smret nac
eb dednetxe ot etadommocca cimonoxat gniredro snoitaler neewteb rotcurtsnoc
.slobmys As a ,tluser ew‘ esoporp a elpmis and tneiciffe mgidarap fo noitacifinu
hcihw swolla eht noitarapes fo )elpitlum( ecnatirehni morf eht lacigol ecnerefni
yrenihcam fo .GOLORP
yB snaem fo ,selpmaxe ew ecudortni ni noitceS 2 eht rovalf fo what ew eveileb ot
eb a erom evisserpxe and tneiciffe yaw fo using cimonoxat ,noitamrofni as desoppo
ot straight .GOLORP ,nehT ni noitceS 3, ew evig a kciuq lamrof yrammus fo woh
redro-tsrif smret yam eb dednetxe ot ydobme cimonoxat noitamrofni as ekildrocer
epyt ,serutcurts rehtegot htiw an tneiciffe epyt noitacifinu .mhtirogla sihT sdael ot a
lacinhcet lasoporp rof gnitargetni this noiton fo smret otni eht noituloser-DLS
msinahcem fo .GOLORP eW llac eht gnitluser egaugnal .NIGOL rehtegoT htiw
,selpmaxe ew ebircsed a NIGOL reterpretni ni noitceS 4. An xidneppa is dehcatta ni
hcihw a lamrof scitnames rof NIGOL is ,dehcteks as llew as a citeroeht-ecittal
tnemugra gniwohs woh s’NIGOL ecnatirehni yb noitacifinu and its epyt“ as ”tes
scitnames yllarutan edivorp a ni-tliub tes noitcartsba hcihw sekam tes“ at a ”emit
snoitatupmoc .elbissop
2.
MOTIVATIONAL EXAMPLES
teL us redisnoc eht gniwollof :elpmaxe
tI is nwonk that all snosrep ekil .sevlesmeht ,oslA stneduts era ,snosrep and eht
laudividni nhoJ is a .tneduts
sihT elpmis noitamrofni nac eb desserpxe ni redro-tsrif cigol as
Vx.person(x) - likes(x, x)
& Vx.student(x) *person(x)
& student( john).
LOGIC PROGRAMMING WITH BUILT-IN INHERITANCE 187
and thus ni GOLORP :yb
il )X,X(sek -: .)(onosrep
)X(nosrep :- .)X(tneduts
ttneduts .)nhoj
oT kcehc rehtehw nhoJ sekil flesmih is ecneh
-v . .)nhoj,nhoj(sekiL
seY
On eht reht hand, ew nac yltnelaviuqe tneserper eht noitamrofni evoba ni deprt
redro-tsrif cigol as :swollof
xV E
person. likes(x, x)
& student c person
& john E student.
fi ,.e.i( that eno tes is eht subset fo ,rehtona ro eno tnemele
Now, type checking
sgnoleb ot a ,)tes nac eb enod ,yltneiciffe neht eht depyt noitalsnart nac eveihca
retteb ,ecamofrep htiw on ssol fo .scitnames ,deednI ni ruo elttil ,elpmaxe ot refni
that nhoJ sekil flesmih is eno-etaidemmi noitacilppa fo rehtar than
modus ponens
owt ni this .esac sihT elpmis aedi nac eb edam lacitcarp and is eht basis fo eht
noisnetxe fo GOLORP ew era gnitneserp ni this .repap
teL us redisnoc rehtona :elpmaxe
A tneduts is a ;nosrep pl,. . . , p, era ;snosrep sl,. . . , ,s era ;stneduts pi and jS
evah eht ytreporp rof emos 1 I and emos ,j 1 I j I
prop i, i 5 n, m.
esehT elpmis data nac eb detneserper ni a drawrofthgiarts yaw ni GOLORP as
:swollof
)X(nosrep :- .)X(tneduts
1p(nosrep .I
. . .
(nosrep
.)ls(tneduts
. . .
.)ms(tneduts
ip(porp .1
js(porp .1
,suhT a yreuq asking rof a nosrep gnivah eht ytreporp is detalumrof yb
prop
-? .)X(porp,)X(nosrep
s’GOLORP noituloser-DLS enigne sdnif eht snoitulos ot this yreuq ,yleman( X =
pi,
yb tcerid hctam )ip( and yb eno noituloser pets )js( using eht elur
X= sj),
translating eht noitamrofni that a tneduts is osla a nosrep and neht gnihctam no eht
tneduts sj ohw has ytreporp
prop.
nI ,GOLORP a noituloser pets sevlovni a etats noitisnart htiw txetnoc ,gnivas
elbairav ,gnidnib ,.cte and is erofereht .yltsoc ehT elpmis dnik fo lacigol noitacilpmi
188 HASSAN A’iT-KACI AND ROGER NASR
FIGURE 1. A erutangis for .ecnatirehni
ni eht evoba melborp dluohs ton etubirtnoc ot eht htgnel fo a .noitcuded ,deednI ni
this elpmaxe ti dluohs eb etaidemmi ot ees that yb eutriv fo gnieb a tneduts s, is
osla a .nosrep
tI dluow eb tneinevnoc fi eno dluoc declare that, ni eht noitacifinu ,ssecorp eht
lobmys student nac hctam eht lobmys person. hcuS snoitaralced dluoc kool ekil
tneduts < .nosrep
...,lpC 3np, < .nosrep
,...,lsC 3ms C .tneduts
erehw eht lobmys ’<‘ stands rof “is a”.
nI weiv fo eseht ,snoitaralced eht lanigiro melborp dluoc eb detalumrofer as
ip(porp .1
prop( s j .1
eW nac etirw eht yreuq using a gnipyt noitaton hcus as
-‘ . propo( : .)nosrep
noitacifinU semoceb eht ssecorp fo gnitupmoc eht greatest lower bound fo owt
slobmys evitaler ot eht < .gniredro ,nehT yb a unifcation pets rehtar than yb a
resolution ,pets eht owt suoiverp answers .wollof
A noitaralced fo ecnatirehni noitamrofni hcus as eht evoba nac eb yllacihparg
dezilausiv as detciped ni erugiF 1.
eW llac hcus a noitaralced eht noitacificeps fo a signature. ehT erutangis
noitamrofni is ot eb desu yb eht noitacifinu ssecorp ni redro ot ezilaer .ecnatirehni
ehT laitrap gniredro fo epyt slobmys hcus as person ro student ni eht ,erutangis
setoned class .tnemniatnoc
sihT elpmis elpmaxe yam ton eb gnicnivnoc as a eurt .tnemevorpmi tahT is, eno
yam eugra that gnidart a noitacifinu pets rof a noituloser pets is ton .elihwhtrow
,revewoH as ew shall wohs ,retal noitacifinu htiw ecnatirehni is yb raf erom
lacimonoce than .noituloser nevE fi this erew ton eht ,.e.i-esac eht owt steps fo
snoitatupmoc erew yllauqe sa-yltsoc eht htgnel fo ecnatirehni sniahc ,sesaercni eht
noitavitom rof using tsaf noitacifinu htiw ni-tliub ecnatirehni sraeppa erom .ylraelc
,redisnoC rof ,elpmaxe eht gniwollof cireneg .melborp
LOGIC PROGRAMMING WITH BUILT-IN INHERITANCE 981
A ,t is a ;,t a ,t is a ;,t . . . ; a ,_,t is a ;,t emos laudividni t is a ,,t and has eht
ytreporp
prop.
sihT setalsnart otni GOLORP as
tntX1 :- tn-l(X).
tn-l(X) :- tn-2(X).
. . .
t2tx1 :- t1tx1.
tl(t).
prop(t).
Now, asking rof a ,t htiw ytreporp prop lliw eriuqer n noituloser steps erofeb
gnihctam no .t
nI ruo wen ,noitaton eht ecnatirehni noitamrofni rof this cireneg elpmaxe nac eb
desserpxe yb eht gniredro snoitaralced
t < .lt
1t < .2t
. . .
tn-1 < tn.
rehtegot htiw eht tcaf
prop(t).
,ecneH eht yreuq
-? propo( : tn).
sdeeccus ni eno pets fo ,noitacifinu rehtar than noituloser steps.
n
3. EXTENDED FIRST-ORDER TERMS
3.1. An Operational Interpretation of Terms
nI redro-tsrif ,cigol a is a citcatnys gnieb fo eht :mrof
literal
Pb l,...,fJ
erehw p is a etaciderp ,lobmys and eht t,‘s era )lanoitcnuf( redro-tsrif .smret
redro-tsriF smret raeppa ylsuotiuqibu ni cigol and lasrevinu .arbegla neviG a ylimaf
1,X{ fo tniojsid fo noitcnuf ,slobmys eht )lanoitcnuf(
n E N} ranked signatures
erutangis Z = sniatnoc slobmys ot eb deterpretni as snoitcnuf ni emos
U ncNZn
citnames ,ledom and eht tpircsbus stands rof eht ro( rebmun fo )stnemugra
n arity
fo eht snoitcnuf eseht slobmys era ot .etoned slobmyS fo ytira 0 era ot etoned
c0nstants.l
teL Y eb a ,ytpmenon ylbatnuoc etinifni tes fo .selbairav nehT eht tes fo
Tx,y-
redro-tsrif smret no eht erutangis Z and eht selbairav V is denifed ylevitcudni as
sihT‘ snialpxe eht llams ytilacinhcet fo syawla gniriuqer taht ,,Z eb hcihw-ytpmenon seetnaraug
taht laitnetop sledom era .ytpmenon
190 HASSAN APT-KACI AND ROGER NASR
:swollof
stnemele fo V and 2, era redro-tsrif ;smret
fi Ef ,Z and ,...,it ,t era redro-tsrif ,smret neht f(tr, . . . , t,) is osla a redro-tsrif
.mret
nI eht cigol noitaterpretni fo ,GOLORP lanoitcnuf redro-tsrif smret hcihw era
ton selbairav raeppa as melokS stnatsnoc ro .snoitcnuf ,revewoH ni ,GOLORP hcus
era reven .detaulave ,rehtaR yeht era desu as
functions operationally type construc-
ehT nwonk-tseb elpmaxe is eht suomaf snoc list ,rotcurtsnoc tub a GOLORP
tors.
resu nac ekat egatnavda fo this lanoitarepo noitaterpretni fo smret rof gnizinagro
data, as rof ,ecnatsni ni database snoitacilppa fo GOLORP .]7[
As a ,tluser s’GOLORP lanoitarepo esu fo redro-tsrif smret sekam meht evaheb
as a mret hcus as is nees as a dleif-eerht
record structures; e.g., person(x, y, z)
,drocer esohw sdleif yam eb nevig emos lanoitnevnoc noitaterpretni yb eht -orp
remmarg ,yas( tsrif tnemugra is ,eman dnoces is etad fo ,htrib and driht is .)xes ehT
ticilpmi lanoitarepo scitnames fo hcus a rotcurtsnoc mret is that ti setoned eht tes
)epyt( fo all sdrocer ni eht database.
person
noitacifinU fo redro-tsrif smret is a dednim-elpmis ,noitarepo as
inheritance
selbairav ni smret tca as stols hcihw era dellif as yeht emoceb .detaitnatsni A
epytbus fo
,x(nosrep
Y, z),
a cireneg noitatoned fo eht tes fo all sdrocer( )fo snosrep ni eht database, yam
thus eb
person (name ( nhoj , X) , ,y male),
a cireneg noitatoned fo eht tes fo all sdrocer( )fo elam snosrep htiw tsrif eman nhoJ
ni eht database. nI ,tcaf rednu this noitaterpretni fo smret as ,sepyt noitacifinu is
deterpretni as fo .sepyt roF ,elpmaxe eht noitcesretni fo eht tes fo
intersection
snosrep esohw last eman is eht emas as rieht tsrif eman
person(name(x, x), y, z),
htiw eht tes fo elam snosrep esohw tsrif eman is ,nhoJ
person ( name ( nhoj , x ) , y , male ) ,
must eb deedni eht tes fo all elam snosrep deman nhoJ ,nhoJ
person (name ( nhoj , nhoj ) , ,x male ) .
ecniS yeht era ton yllanoitarepo desu as ,snoitcnuf GOLORP redro-tsrif smret
reffus morf devresednu snoitatimil ni rieht ,xatnys a ycagel fo rieht lanigiro
lanoitcnuf .scitnames
gnikooL at redro-tsrif smret ylerup yllacitcatnys ni rieht esu as epyt ,srotcurtsnoc
eno sdnif that fo erutangis slobmys is an tnavelerri .nedrub roF ,elpmaxe
$xed arity
fi retfa evisnetxe esu fo a dleif-eerht drocer a resu sezilaer that a
person(x, y, z),
htruof dleif ,yas( laicos ytiruces )rebmun is ,dedeen all suoiverp secnerrucco fo eht
drocer must eb desiver and nevig a htruof tnemugra .]5[
person
rehtonA ,noitatimil hcihw is osla a ecneuqesnoc fo dexif ,ytira is that eht
noitaterpretni fo tnemugra snoitisop is tnerapsnartnon ot eht .resu ,deednI ni using
LOGIC PROGRAMMING WITH BUILT-IN INHERITANCE 191
a nosrep record, eno tsum syawla eb aware that the tsrif tnemugra si a ,eman the
dnoces si a date, etc. ,ylraelC the lacissalc ticilpxe gnilebal of record sdleif yb
cilobmys sdrowyek si retteb naht ylticilpmi gnitimil these slebal ot eb ordered
deppagnu secneuqes of .sregetni
ehT driht tsom latnemadnuf noitatimil of smret as epyt serutcurts nac eb tseb
dootsrednu nehw eno srednop the evitcepser selor of erutangis dna elbairav slobmys
ni mret .noitacifinu A erutangis lobmys si a epyt rotcurtsnoc dna suht acts as na
noitaitnatsni jilter. ,deednI noitacifinu sliaf for two lacitnedinon erutangis .slobmys
sA a ,tluser yna rehtruf ecnatsni of, ,yas person(x, y, z) tsum evah person as root
.lobmys erehT si on nosaer yhw siht gniretlif elor of rotcurtsnoc slobmys tsum eb
detimil ot na desolc/nepo .roivaheb ,deednI person(x, y, z) record dluohs eb
dewolla ot eb rehtruf detaitnatsni as student(x, y, z) fi the noitaterpretni of the data
si hcus that a student epyt si a epytbus of a person .epyt sihT laudarg gniretlif nac
eb expressed as a laitrap gniredro epyt( )noitpmusbus no the rotcurtsnoc .erutangis
,ecneH noitacifinu of erutangis slobmys si won nees as a greatest fewer bound )BLG(
.noitarepo fI a erutangis si detnemgua htiw a laiceps least element lobmys I
gnitoned eruliaf of ,noitacifinu lanoitnevnoc noitacifinu of rotcurtsnoc slobmys si
llits a BLG .noitarepo
nO the other ,dnah a elbairav ecnerrucco snaem the ecnesba of yna ;retlif ,.e.i ti si
a dliw curd for mret .noitaitnatsni sA ,yltnatropmi a elbairav has a dnoces elor ni
that ti acts as a gat gnisopmi equality constraints gnoma lla-smretbus secnerrucco
of the emas elbairav ni a nevig mret tsum eb detaitnatsni yb lacitnedi .smret sA na
noitaitnatsni dliw card, a elbairav sevaheb as a yrev-retlif ,evissimrep tub a retlif
.sselehtenon sA a tag, ti sevaheb as na ytilauqe .tniartsnoc tI si a yek noitavresbo
that selbairav dluohs ton yrrac hcus a laud .noitamrofni ,yltsriF esuaceb ti si the elor
of the erutangis slobmys ot yrrac gniretlif .noitamrofni ,yldnoceS esuaceb neve ni
rieht lanoitauqe ,elor selbairav are yludnu .detimil ,deednI as selbairav are dewolla
ot rucco ylno as sevael ni a ,mret yeht tonnac esopmi ytilauqe stniartsnoc nihtiw the
;mret ,.e.i erehwyna morf root ot .sevael
Based no these ,snoitavresbo ti semoc larutan that the dliw card elor dluohs eb
deyalp yb a laiceps greatest element lobmys gnitnemgua the .erutangis sA for
T
ytilauqe ,stniartsnoc we propose that selbairav eb dellac sgut dna dewolla ot appear
erehwyna nihtiw a .mret
llA the gniogerof snoitatimil are emocrevo ni the xatnys of yllaitrap ordered epyt
serutcurts denifed .txen
.2.3 A Calculus of yllaitraP Ordered Type Structures
eW llahs llac the citcatnys noitatneserper of a derutcurts epyt a q-term. ,yllamrofnI
a mret-# stsisnoc :fo
(1) A root symbol, hcihw si a epyt rotcurtsnoc dna setoned a ssalc of .stcejbo
(2) etubirttA labels, hcihw are record dleif ,slobmys detaicossa htiw .smret-#
Each lebal setoned a noitcnuf ni intenso morf the root epyt ot the epyt
detoned yb sti detaicossa .mret-$-bus noitanetacnoC of slebal setoned -cnuf
noit .noitisopmoc
192 HASSAN AiT-KACI AND ROGER NASR
stniartsnoc gnoma paths fo ,slebal hcihw etacidni that eht
(3) Coreference
gnidnopserroc etubirtta snoitisopmoc etoned eht emas .snoitcnuf nI rehto
,sdrow ecnereferoc seificeps that emos lanoitcnuf margaid fo setubirtta must
eb .evitatummoc
An elpmaxe fo a mret-# is
persontid => name;
born => datetday => integer;
month => monthname;
year => integer);
father => person)
ehT toor lobmys is ti has eerht smret-#-bus rednu eht etubirtta slebal
person; id,
and .ylevitcepser eW wollof eht noitnevnoc fo using sreifitnedi starting
born, father,
htiw a esacrewol rettel rof epyt slobmys and etubirtta .slebal sreifitnedI starting htiw
an esacreppu rettel era gut slobmys and etoned ecnereferoc gnoma etubirtta
.snoitisopmoc
An elpmaxe fo a mret-# htiw tags is
personcid => nametfirst => string;
last => x : string);
father => persontid => nametlast => X : string)))
ehT tag lobmys X srucco rednu and and setacidni a ecnereferoc
id. last father. id. last,
,tniartsnoc ,.e.i lacitnedi .serutcurtsbus
eW shall etoned yb Z eht tes fo epyt srotcurtsnoc eht( epyt yb Y eht
signature),
tes fo etubirtta ,slebal and yb .Y eht tes fo tag .slobmys sgnirtS fo etubirtta slebal
era dellac )mret-#( ,suhT *S is eht tes fo all elbissop .sesserdda A
addresses.
mret-# is eht subset fo *ZL fo eht sesserdda fo eht ;mret-# ,.g.e eht niamod
domain
fo eht mret-+ fo eht tsrif fo eht owt smret-# evoba is
{ ;E .month ,
id, born, born .day, born born. year, father }
erehw E setoned eht ytpme eht-gnirts toor address.
oT eb ,tnetsisnoc a s’mret-# xatnys tonnac eb hcus that tnereffid epyt serutcurts
era deggat yb eht emas tag .lobmys roF ,elpmaxe fi gnihtemos rehto than
string
deraeppa at eht address ni eht mret-+ ,evoba ti dluow eb lli .demrof
father.id.lust
,ecneH ni a demrof-llew ro-mret-# rof ew-trohs shall timo gnitirw erom
wft,
than ecno eht epyt rof yna nevig tag. roF ,ecnatsni eht dnoces fo eht owt smret-$
evoba lliw rehtar eb :nettirw
persontid => nametfirst => string;
last => x : string);
.))1X
father => persontid => nametlast =>
nI ,ralucitrap this noitnevnoc swolla eht esicnoc noitatneserper fo ,serutcurts
infinite
as nwohs ni
persontid => nametfirst => string;
last => string);
father => X : person(son => persontfather => XI))
erehw a cilcyc ecnereferoc is deggat yb X.
LOGIC PROGRAMMING WITH BUILT-IN INHERITANCE 193
ehT epyt erutangis Z si a yllaitrap ordered set of .slobmys hcuS a erutangis
syawla sniatnoc two laiceps :stnemele a greatest tnemele dna a tsael tnemele
(T)
.)I( epyT slobmys etoned sets of ,stcejbo dna the laitrap order no Z setoned set
.noisulcni ,ecneH setoned the set lla.fo elbissop eht--stcejbo uniuerse. eW llahs
T
timo* gnitirw the lobmys ylticilpxe ni a ;tfw yb ,noitnevnoc revenehw a epyt
T
lobmys si ,gnissim ti si dootsrednu ot eb roF ,elpmaxe ni the wft
T .
(nosrep di q > tsrif( q > ;gnirts
tsal >= XI;
father >= dicnosrep >= tsalceman q > XI))
si the epyt lobmys gnirrucco at addresses id, id.last, dna father.id.last.
T
nO the other ,dnah I setoned the ytpme set dna si the epyt of on .tcejbo
,yltneuqesnoC _L yam appear ni on wft other naht I , ecnis that dluow liatne that
there was on elbissop tcejbo for the gnidnopserroc .etubirtta sA a ,tluser yna mret-q
htiw at tsael eno ecnerrucco of _L si deifitnedi htiw I .
,yllaniF ecnis the noitamrofni tnetnoc of tags si ylpmis ot esopmi ecnereferoc
,stniartsnoc ti si raelc that yna eno-ot-eno gnimaner of a wft’s tags does ton retla the
noitamrofni tnetnoc of the wft.
ehT noitamrofni tnetnoc of epyt serutcurts hcus as those whose xatnys si
yllamrofni decudortni evoba nac eb yllamrof .denifed ,ylemaN a wft erutcurts nac
eb nees as the noitcnujnoc of three lacitamehtam :snoitcartsba
(1) A mret-/J niamod a-A regular set of etinif sgnirts of 8* desolc rednu the
prefix .noitarepo
(2) A ecnereferoc noitaler na-K ecnelaviuqe noitaler no A of etinif ,xedni hcihw
si right-inuariant for lebal .noitanetacnoc tahT ,si the rebmun of ecnereferoc
sessalc si ,etinif dna revenehw two addresses corefer, yna riap of addresses ni
the niamod deniatbo morf meht yb rehtruf noitanetacnoc no the thgir tsum
osla corefer.
(3) A epyt noitcnuf gnidnetxe--+ a laitrap noitcnuf denifed morf the set of
ecnereferoc sessalc K/A ot the epyt erutangis Z yb gnitaicossa the epyt
lobmys to lla sgnirts of 9* hcihw are ton ni .A
T
,suhT a wft si ylesicerp dezilamrof as hcus a elpirt ,A(
K, 4).
ehT laitrap order no the epyt erutangis Z si dednetxe ot the set of wfts ni hcus a
yaw as ot tcelfer the noisulcni-tes .noitaterpretni ,yllamrofnI a wft ,t si a subtype of
a wft ,t :fi
(1) the root lobmys of ,t si a epytbus ni :I of the root lobmys of ;,t
(2) lla etubirtta slebal of ,t are osla etubirtta slebal of ,,t dna rieht wfts ni ,t are
sepytbus of rieht gnidnopserroc wfts ni ;,t dna
(3) lla ecnereferoc stniartsnoc gnidnib ni ,t tsum osla eb gnidnib ni .,t
roF ,elpmaxe fi Z si hcus that the gniwollof gniredro :sdloh
student ,nosrep< nitsua < cityname
194 NASSAH ICAK-Ti’A DNA REGOR RSAN
neht eht tfw
studenttid => nametfirst => string;
last => x : string);
Lives-at => Y : addressccity => austin);
father => persontid => name(Last => Xl;
Lives-at q> Y))
is a epytbus fo eht tfw
personcid => name(Last => X : string);
Lives-at => addresstcity => cityname);
di => tsaL(eman => .))1X
father => person(
sihT laitrap gniredro no stfw is yllamrof denifed as .swollof A tfw ,t is a epytbus
fo a tfw ,t fi and ylno :fi
either 1t = I ;
or ,t = ,4( ,~K G,), 2t = ,2A( ,~K ,)2q dna
(1) 2A c ,,A
(2) 2K c ,1K
)3( uv ,*pE )u(1$ 5
It/2(u).
nI ,tcaf a regnorts tluser is devorp ni .]2[ ,ylemaN fi eht erutangis Z is hcus that
sBLG ,ylevitcepser( ~)SBUL tsixe rof all pairs fo epyt slobmys htiw tcepser ot eht
erutangis ,gniredro neht sBLG )sBUL( osla tsixe rof eht dednetxe tfw .gniredro nI
rehto ,sdrow eht tfw gniredro sdnetxe a ecittal)-imes( erutcurfs morf eht erutangis ot
eht .stfw As an ,elpmaxe fi ew redisnoc eht erutangis fo erugiF 2, neht eht BUL fo
eht tfw
chiLd(knows => X : person(knows => queen;
hates => Y : monarch);
hates => chiLd(knows q> Y;
Likes => wicked-queen);
Likes => Xl
and eht tfw
aduLt(knows => aduLt(knows => witch);
x :
hates => person(knows q> monarch;
Likes => Xl)
is the wft
person(knows => person;
hates => person(knows => monarch;
Likes => monarch))
*The smynorca ”BLG“ dna ”BUL“ dnats rof tsetaerg“ rewol ”dnuob dna tsael“ reppu ,”dnuob
.ylevitcepser
Description:LOGIN: A LOGIC PROGRAMMING LANGUAGE WITH. BUILT-IN INHERITANCE.
HASSAN A'iT-KACI AND ROGER NASR. D. An elaboration of the PROLOG