Natural Language Processing vs. Logic.

71
Natural Language Processing vs. Logic. Is logic useful in the computa8onal interpreta8on of language? Dan Cristea [email protected]

Transcript of Natural Language Processing vs. Logic.

Page 1: Natural Language Processing vs. Logic.

NaturalLanguageProcessingvs.Logic.Islogicusefulinthecomputa8onal

interpreta8onoflanguage?

[email protected]

Page 2: Natural Language Processing vs. Logic.

Communica8onthroughlanguage

MFOI–VadulluiVodă,29July2016

Page 3: Natural Language Processing vs. Logic.

Communica8onthroughlanguage

thought

MFOI–VadulluiVodă,29July2016

Page 4: Natural Language Processing vs. Logic.

Communica8onthroughlanguage

thought

MFOI–VadulluiVodă,29July2016

emo8on

Page 5: Natural Language Processing vs. Logic.

Communica8onthroughlanguage

thought

MFOI–VadulluiVodă,29July2016

emo8on

Page 6: Natural Language Processing vs. Logic.

Communica8onthroughlanguage

thought

MFOI–VadulluiVodă,29July2016

emo8on

Page 7: Natural Language Processing vs. Logic.

Communica8onthroughlanguage

thought

MFOI–VadulluiVodă,29July2016

emo8on

Page 8: Natural Language Processing vs. Logic.

Communica8onthroughlanguage

thought

thought

MFOI–VadulluiVodă,29July2016

emo8on

Page 9: Natural Language Processing vs. Logic.

Communica8onthroughlanguage

thought

thought

MFOI–VadulluiVodă,29July2016

emo8on

emo8on

Page 10: Natural Language Processing vs. Logic.

LogicandNL

•  Logic:theexpressionofrigour•  ChallengeoflogicalformalismsinNL:codeanylanguageexpressioninlogicalform

•  Usefulness:clearoutambigui8es

•  Skep8cs:towhatextendcanamessagebeencodedinlogic?

MFOI–VadulluiVodă,29July2016

Page 11: Natural Language Processing vs. Logic.

Thelogicoflanguagecommunica8on…twohorses…–  theemiUerisaman,livesinEnglandin1926,aworkerofthefield–  thereceiveristhisman’smaster

è–  bothemiUerandreceiverhaveacommonknowledgeonthewordhorse–  theemiUerknowsthatthereceiverhasthesamemeaningashimselfonhorse–  theemiUerintendstomakethereceiverbuildtherepresenta8on:

S={x⏐horse(x)}^card(S)=2,where:card(S):thecardinalofthesetS,horse(x):aqualifyingfunc8onasser8ngthatxbelongstoaclassofobjects

sharingtheseman8cpropertythatiscurrentlydenominatedinEnglishbythewordhorse,andthatthepragma8ccontextinwhichtheexpressionisuUered

clearlyseparatesthedifferentmeaningsthatthisEnglishwordmayencode.MFOI–VadulluiVodă,29July2016

Page 12: Natural Language Processing vs. Logic.

Whenislogicofhelp…

MFOI–VadulluiVodă,29July2016

Page 13: Natural Language Processing vs. Logic.

Chunkslevel:Genera8veLexiconandQualiaStructures

•  meaningofwordsdecomposedon4coordinates:– Formal(F):encodingtaxonomicinforma8onaboutthelexicalitem(theis-arela8on);

– Cons4tu4ve(C):encodinginforma8ononthepartsandcons8tu8onofanobject(part-oformade-ofrela8on);

– Telic(T):encodinginforma8ononpurposeandfunc8on(theused-fororfunc4ons-asrela8on);

– Agen4ve(A):encodinginforma8onabouttheoriginoftheobject(thecreated-byrela8on)

MFOI–VadulluiVodă,29July2016

J.Pustejovsky.TheGenera4veLexicon.Cambridge,MA:MITPress,1995.

Page 14: Natural Language Processing vs. Logic.

QualiaStructures

•  Representmeaningofcomposi8onsofwords–  largecar(F=vehicle),– brokencar(C=motor),– speedycar(T=drive),–  Italiancar(A=madeinItaly)

MFOI–VadulluiVodă,29July2016

Page 15: Natural Language Processing vs. Logic.

Whatskep8csgrump?

•  Howtomastertheenormousrangeofpossiblecombina8ons?

•  Haslikesthesamemeaning?– Helikesmysister.vs.Helikesvanillaicecream.

MFOI–VadulluiVodă,29July2016

Page 16: Natural Language Processing vs. Logic.

Discourselevel:meaningofsequencesofsentencesMariadroppedtheeggfromherhand.Shecleanedthefloor.

MFOI–VadulluiVodă,29July2016

Page 17: Natural Language Processing vs. Logic.

Tolinksentenceswemakeinferences

Mariadroppedtheeggfromherhand.

MFOI–VadulluiVodă,29July2016

Page 18: Natural Language Processing vs. Logic.

Tolinksentenceswemakeinferences

Mariadroppedtheeggfromherhand.

MFOI–VadulluiVodă,29July2016

Page 19: Natural Language Processing vs. Logic.

Tolinksentenceswemakeinferences

Mariadroppedtheeggfromherhand.

MFOI–VadulluiVodă,29July2016

Page 20: Natural Language Processing vs. Logic.

Tolinksentenceswemakeinferences

Mariadroppedtheeggfromherhand.

MFOI–VadulluiVodă,29July2016

Page 21: Natural Language Processing vs. Logic.

Tolinksentenceswemakeinferences

Mariadroppedtheeggfromherhand.

MFOI–VadulluiVodă,29July2016

Page 22: Natural Language Processing vs. Logic.

Tolinksentenceswemakeinferences

Shecleanedthefloor.Mariadroppedtheeggfromherhand.

MFOI–VadulluiVodă,29July2016

Page 23: Natural Language Processing vs. Logic.

Tolinksentenceswemakeinferences

Shecleanedthefloor.Mariadroppedtheeggfromherhand.

MFOI–VadulluiVodă,29July2016

Page 24: Natural Language Processing vs. Logic.

Tolinksentenceswemakeinferences

Shecleanedthefloor.Mariadroppedtheeggfromherhand.

MFOI–VadulluiVodă,29July2016

Page 25: Natural Language Processing vs. Logic.

Tolinksentenceswemakeinferences

Shecleanedthefloor.Mariadroppedtheeggfromherhand.

MFOI–VadulluiVodă,29July2016

Page 26: Natural Language Processing vs. Logic.

Tolinksentenceswemakeinferences

Shecleanedthefloor.Mariadroppedtheeggfromherhand.

MFOI–VadulluiVodă,29July2016

Page 27: Natural Language Processing vs. Logic.

Tolinksentenceswemakeinferences

Shecleanedthefloor.Mariadroppedtheeggfromherhand.

MFOI–VadulluiVodă,29July2016

Page 28: Natural Language Processing vs. Logic.

Tolinksentenceswemakeinferences

Shecleanedthefloor.Mariadroppedtheeggfromherhand.

MFOI–VadulluiVodă,29July2016

Page 29: Natural Language Processing vs. Logic.

Tolinksentenceswemakeinferences

Shecleanedthefloor.Mariadroppedtheeggfromherhand.

MFOI–VadulluiVodă,29July2016

Page 30: Natural Language Processing vs. Logic.

Tolinksentenceswemakeinferences

Mariadroppedtheeggfromherhand.drops(AG:Maria,OB:egg)=>falls(REC:egg)=>touches(AG:egg,OB:X)

Qualia.Formal(egg)=container;Qualia.Cons8tu8ve(egg)={eggshell(fragile),liquid}

=>breaks(REC:eggshell)=>leaks(REC:liquid,ON:X)=>perceives(AG:Maria,OB:dirty(X))

Shecleanedthefloor.=>cleans(AG:Maria,OB:floor)=>perceives(AG:Maria,OB:dirty(floor))

MFOI–VadulluiVodă,29July2016

Page 31: Natural Language Processing vs. Logic.

Tolinksentenceswemakeinferences

ShecleanedthefloorMariadroppedtheeggfromherhand.

MFOI–VadulluiVodă,29July2016

Page 32: Natural Language Processing vs. Logic.

Tolinksentenceswemakeinferences

Mariadroppedtheeggfromherhand.Sheturnedthelighton.

MFOI–VadulluiVodă,29July2016

Page 33: Natural Language Processing vs. Logic.

Discourselevel:variabilityinlanguage

Meaning

Language Ambiguity

Variability

MFOI–VadulluiVodă,29July2016

Page 34: Natural Language Processing vs. Logic.

Discourselevel:variabilityinlanguage

•  Reducethedistancebetweenformandmeaningare:Informa8onRetrieval(IE),TextualEntailment(TE)andQues8onAnswering(QA)

MFOI–VadulluiVodă,29July2016

Page 35: Natural Language Processing vs. Logic.

TextualEntailment

•  Texttentailshypothesish(t⇒h)ifhumansreadingtwillinferthathismostlikelytrue

Atrueentailment•  t:…ashootoutattheGuadalajaraairportinMay,1993,thatkilledCardinalJuanJesusPosadasOcampoandsixothers.

•  h:CardinalJuanJesusPosadasOcampodiedin1993.

MFOI–VadulluiVodă,29July2016

Page 36: Natural Language Processing vs. Logic.

TextualEntailment

…andofafalseone•  t:ReganaTendedaceremonyinWashingtontocommemoratethelandingsinNormandy.

•  h:WashingtonislocatedinNormandy.

MFOI–VadulluiVodă,29July2016

Page 37: Natural Language Processing vs. Logic.

Howisentailmentchecked?

•  t:PhilanthropicGoldingInc.cameintoexistenceinJanuary2004.Oneyeara[eritsfounda4onthecompanydeclaredbankruptcy.

•  h:PhilanthropicGoldingInc.bankruptedinJanuary2005.

MFOI–VadulluiVodă,29July2016

Page 38: Natural Language Processing vs. Logic.

Howisentailmentchecked?

•  Launchapipelineofprocesses,attheendofwhichthesentencesofbothtandhareexpressedinasymbolicformthatallowsclosecomparison.

MFOI–VadulluiVodă,29July2016

Page 39: Natural Language Processing vs. Logic.

Howisentailmentchecked?

PhilanthropicGoldingInc.cameintoexistenceinJanuary2004.

•  Step1:tokenisa8on(notshown),part-of-speechtagging(notshown),chunkingnounphrasesandclashingmul8-wordexpressions.<NPid=”n1”>PhilanthropicGoldingInc.</NP><MWEid=”m1”>cameintoexistence</MWE>

MFOI–VadulluiVodă,29July2016

Page 40: Natural Language Processing vs. Logic.

Howisentailmentchecked?

•  Step2:recogni8onofen8tymen8ons,of8meexpressionsandresolu8onofanaphora.<COREF-LISTid=”ent1”TYPE=“ENTITY”REF-LIST=”n1”/>

PhilanthropicGoldingInc.isanameden8ty

<TIMEX38d=”t1”type=”DATE”value=”2004-01”>January2004</TIMEX3>

January2004isatemporalexpression

MFOI–VadulluiVodă,29July2016

Page 41: Natural Language Processing vs. Logic.

Howisentailmentchecked?

•  Step3:func8onaldependencyparsing;hereweshowaUniversalDependency(UD)coding

MFOI–VadulluiVodă,29July2016

Page 42: Natural Language Processing vs. Logic.

Howisentailmentchecked?

•  Step4:8meanalysis,inwhichEVENTandTLINKelements,formalizingtheeventsandtheirtemporalrela8ons,aregenerated.<EVENTeid=”ev1”VB=”m1”AG=”ent1”/>

ThecamingintoexistenceofPhilanthropicGoldingInc.isanevent

<TLINKeventID="ev1"relatedToTime="t1"relType="BEGINS"/>

ThemomentofthiseventistheonecodedbythetemporalexpressionJanuary2004

MFOI–VadulluiVodă,29July2016

Page 43: Natural Language Processing vs. Logic.

Howisentailmentchecked?•  Step5:equivalentstructures(transforma8ons)andcomputa8onoftransi8veclosuresoftemporalrela8ons:equivalenceoftheexpressions:XcomesintoexistenceandUNKNOWNfoundsXè<EVENTeid=”ev2”VB=”found”AG=”UNKNOWN”OB=”ent1”/>

ThecamingintoexistenceofPhilanthropicGoldingInc.canequallybeexpressedbyafoundingeventinwhichPGIhastheobjectrole.

<TLINKeventID="ev2"relatedToTime="t1"relType="BEGINS"/>ThemomentofthiseventistheonecodedbythetemporalexpressionJanuary

2004

MFOI–VadulluiVodă,29July2016

Page 44: Natural Language Processing vs. Logic.

Howisentailmentchecked?

Oneyeara[eritsfounda4onthecompanydeclaredbankruptcy.

•  Step1:NP-chunking<NPid=”n3”><NPid=”n2”>its</NP>founda4on</NP><NPid=”n4”>thecompany</NP><NPid=”n5”>bankruptcy</NP>

MFOI–VadulluiVodă,29July2016

Page 45: Natural Language Processing vs. Logic.

Howisentailmentchecked?

•  Step2:NER,TimexandAR<TIMEX38d=”t2”type=”DURATION”value=”P1Y”>oneyear</TIMEX3>

oneyearisatemporalexpression<COREF-LISTid=”ent1”TYPE=”ENTITY”REF-LIST=”n1n2n4”/>

itsandthecompanyarecoreferen8alwithPhilanthropicGoldingInc.

<COREF-LISTid=”eve1”TYPE=”EVENT”REF-LIST=”ev1ev2n3”/>itsfounda4onisrecognisedasaneventcoreferen8alwiththefoundingof

PhilanthropicGoldingInc.

<COREF-LISTid=”eve2”TYPE=”EVENT”REF-LIST=”n5”/>banckrupcyisrecognisedasanevent

MFOI–VadulluiVodă,29July2016

Page 46: Natural Language Processing vs. Logic.

Howisentailmentchecked?

•  Step3:UD

MFOI–VadulluiVodă,29July2016

Page 47: Natural Language Processing vs. Logic.

Howisentailmentchecked?

•  Step4:EVENTandTLINKelements<EVENTeid=”e3”POS=”VERB”CLASS=”REPORTING”AG=”ent1”OB=”eve2”>declared</EVENT><EVENTeid=”e4”POS=”NOUN”CLASS=”OCCURRENCE”AG=”ent1”>bankruptcy</EVENT>

BothactsofdeclaringbankruptcyandofbankruptcyitselfinvolvingPhilanthropicGoldingInc.arerecognisedasevents.

<TLINKeventID="e3"relatedToTime="t2"relType="AFTER"/><SLINKeventID="e3"subordinatedEvent="e4"relType="FACTIVE"/>Thedeclaringbankruptcyeventtakesplaceoneyearayerthefounda8on

event.

MFOI–VadulluiVodă,29July2016

Page 48: Natural Language Processing vs. Logic.

Howisentailmentchecked?

•  Step5:theTimeClosuretool<TIMEX38d=”t4”type=”DATE”value=”2005-01-xx”/><TLINKeventID="e4"relatedToTime="t4"relType="DURING"/>

ThedeclaringbankruptcyeventtakesinJanuary2005.

MFOI–VadulluiVodă,29July2016

Page 49: Natural Language Processing vs. Logic.

Howisentailmentchecked?PhilanthropicGoldingInc.bankruptedinJanuary2005.

•  Asimilarprocessingchainproduces:<EVENTeid=”e5”POS=”VERB”AG=”ent1”>bankrupted</EVENT>

AneventofbankruptcyinwhichisinvolvedPhilanthropicGoldingInc.

<TIMEX38d=”t5”type=”DATE”value=”2005-01-xx”>January2005</TIMEX3><TLINKeventID="e5"relatedToTime="t5"relType="DURING"/>

ThemomentofthiseventisJanuary2005.

Page 50: Natural Language Processing vs. Logic.

Otherformalisms

•  NaturalLogic:TreestructuredRecursiveNeuralNetworkscanlearntoiden8fylogicalrela8onshipssuchasentailmentandcontradic8on…

MFOI–VadulluiVodă,29July2016

Page 51: Natural Language Processing vs. Logic.

Andwhenlogicisofnouse?...

MFOI–VadulluiVodă,29July2016

Page 52: Natural Language Processing vs. Logic.

Doublenega8on

•  DoubleNega?onlanguages(amongwhichstandardvarie8esofGermanicandScandinavian):–  twonega8veelementscanceleachotherout

resul8nginaposi8vereading:Pauldidn’tseenobody.=Paulsawsomebody.“Thereisanindividualx,suchthatPaulsawx.”

A.Falaus.RomanianN-wordsasNega4veQuan4fiers,WorkingPapersinLinguis8cs,31stAnnualPennLinguis8csColloquium,Univ.Pennsylvania,2008.

MFOI–VadulluiVodă,29July2016

Page 53: Natural Language Processing vs. Logic.

Doublenega8on

•  Nega?veConcordlanguages(amongwhichRomanianandItalian):– mul8pleoccurrencesofnega8onareinterpretedasoneseman8cnega8on:Pauln-avăzutpenimeni.=Pauldidn’tseeanybody.“Itisnotthecasethatthereisanindividualx,suchthatPaulsawx.”

MFOI–VadulluiVodă,29July2016

Page 54: Natural Language Processing vs. Logic.

Linearposi8onambivalence

•  Associa8onsnoun+adjec8vevs.adjec8ve+nounhavedifferentmeanings

femeiasingură=>thewomanalonesingurafemeie=>theonlywoman

A.Cornilescu.Thelineariza4onoftheRomanianadjec4vesandthestructureoftheRomanianDP,inTorckD.andWetzlesL.(eds),RomanceLanguages

andLinguis8cTheory,2006",JohnBenjamins,2009.

MFOI–VadulluiVodă,29July2016

Page 55: Natural Language Processing vs. Logic.

Linearposi8onambivalence

today10yearsago

mașinalui(cea)vechevechealuimașină

MFOI–VadulluiVodă,29July2016

Page 56: Natural Language Processing vs. Logic.

Linearposi8onambivalence…

•  …doesnotapplytoanyadjec8ve:certainmodifiersmakesenseonlywhensituatedinthepre-posi8onwithrespecttothemodifiednounbiet(poor,pi4ful)isnotacceptedunlessitprecedesthenoun:bietom(poorman),butnot:ombiet M.-D.Vulchanova.Modifica4onintheBalkannominalexpression:Anaccountof

the(A)NA–AN(A)ordercontract.InMar8neCoeneandYvesD’hulst(eds):FromNPtoDP:Thesyntaxandseman8csofnounphrases,JohnBenjamin,2003.

MFOI–VadulluiVodă,29July2016

Page 57: Natural Language Processing vs. Logic.

Linearposi8on

•  Theintersec8on-basedcomposi8oncontradicted:–  ifX(adj)andY(noun),thenXY(orYX):•  setofobjectsYthathavethepropertyX•  intersec8onbetweenthesetofobjectshavingthepropertyXandthesetofobjectsY

è poormen:intersec8onbetweenthesetofthingswhicharepoorandthesetofmen

è s8ll,bieţiioameni:subsetofthesetofmenwhichareinapi8ful/miserablestate

MFOI–VadulluiVodă,29July2016

Page 58: Natural Language Processing vs. Logic.

Contextsandthemistofpragma8cs

•  Textualcontext:sensefixedbythecontext•  Disambigua8oncomputedsta8s8cally…

GoogleTranslate

MFOI–VadulluiVodă,29July2016

Page 59: Natural Language Processing vs. Logic.

Textualcontextandwordsenses

•  LogiclackspowerHowwouldalogicalsolu8onwork?Andifoneexists,whatwouldbethecostofthesuppor8velexical-seman8cresourcestogeneraliseit?

MFOI–VadulluiVodă,29July2016

Page 60: Natural Language Processing vs. Logic.

Thewoodlanguage•  Wordsinducedifferentreac8onsinhumans:

herehumorous(contrarytotheinten8on)“SăluptămpentrupropăţireaneamuluişiaducereaRomânieipecelemaiînalteculmidecivilizaţiemul8lateraldezvoltată.”(approx.Let’sfighttothriveours4rpsandbringRomaniaonthehighestpeaksofmul4laterallydevelopedciviliza4on.)R.Zafiu.Limbadelemn(Thewoodlanguage).InDilemaveche,Nr.314/

18-24februarie,2010.

Page 61: Natural Language Processing vs. Logic.

Thewoodlanguage

“Pusas�elînlumină,ancoratînsinergiafaptelor,recursullauniversalitatenueludeazămeandreleconcretului.”(approx.Thusputinlight,anchoredinthesynergyoffacts,theappealtouniversalitydoesnotcircumventthemeandersoftheconcrete.)

aUributedtoIonIliescu

MFOI–VadulluiVodă,29July2016

Page 62: Natural Language Processing vs. Logic.

Styleinliterature

•  Humansperceiveco-occurrenceofwordsasproducingverysugges8veimages“constelațiaochilormei”(theconstella4onofmyeyes)“a8ngicuauzul”(approx.yourhearingtouches)“nisipuridefiară”(beastsands)NichitaStănescu,Autoportretîn4mpdeveghe(Autoportraitduringwatch

8me)

MFOI–VadulluiVodă,29July2016

Page 63: Natural Language Processing vs. Logic.

Styleinliterature

•  Seizingemo8onsincurredbysentenceslikethefollowinginlogicalexpressions?"It’senoughformetobesurethatyouandIexistatthismoment.”

GabrielGarciaMarquez:OneHundredYearsofSolitude

MFOI–VadulluiVodă,29July2016

Page 64: Natural Language Processing vs. Logic.

Styleinliterature

•  Formaliseinlogicaltermsametonymicsenseofanexpression?“lipindu-sederăcoareatoculuiuşii”(approx.s4ckingtothechillofthedoorframe)

GabrielGarciaMarquez:OneHundredYearsofSolitude

Atouchedobjectisreplacedwithasensa8onthattheagentborrowsfromthatobject.

MFOI–VadulluiVodă,29July2016

Page 65: Natural Language Processing vs. Logic.

Styleinliterature

•  Lookforlogicalequivalentofmetaphoricallanguage:“Temângâicudegetelemuiateînamin8ri.”(Icaressyouwithmyfingersdippedinmemories)

MFOI–VadulluiVodă,29July2016

Page 66: Natural Language Processing vs. Logic.

Styleinliterature

•  Confrontedwiththeextraordinarydiversityofsugges8onsthatwordscanconvey,logicseemstomefaint,forceless,impuissant.

•  Howcouldsuchpoe8calexpressionsbeencodedinlogicalconstruc8ons?

MFOI–VadulluiVodă,29July2016

Page 67: Natural Language Processing vs. Logic.

Andthesolu8onis?

•  Logicprovessuccessfulinrepresen8ngmanylanguageaspects.

•  Thereshouldbealimitwheretheambi8ontoexpressnaturallanguageinlogicalformhastostopbecauseitreachesaninsurmountablelimit.

MFOI–VadulluiVodă,29July2016

Page 68: Natural Language Processing vs. Logic.

Andthesolu8onis?•  4categoriesofthinkersontherela8onshipbetweenlanguageandlogic–  thelogicpurists:everythingcanbeexpressedinlogical(symbolic)forms

–  thesta8s8cal-neuralpurists:everythingcanbeexpressedbysta8s8cs/neuralformalisms

–  theskep8cals:languagecanneverbeinterpretedtotally,neitherbysymbolicnorsta8s8calmeans

–  themoderates,dirtyworkers:onlyacombina8onbetweenthetwoparadigmscanhelp,andthisonlytoacertainlimit

MFOI–VadulluiVodă,29July2016

Page 69: Natural Language Processing vs. Logic.

Insteadofconclusions

•  Theirlackofconfidenceinlogicasauniversalmachineryforprocessinglanguagecomesfromobserva8onsoftheinabilityoflogictosupportexhaus8velytheprocessinginfrastructuresoflanguage.

•  Theydon’tbelievethateachsentence,oreachsequenceofsentences,shouldbetransformedintoatheoremthatnecessitatesaproof.

MFOI–VadulluiVodă,29July2016

Page 70: Natural Language Processing vs. Logic.

Insteadofconclusions

•  Reasoning,thatpartoflanguageusethatnecessitatesvoli8onalconnec8onsinordertodecipherinforma8on,tofindexplicitlinks,withoutwhichunderstandingwouldbeimpossible–yes.

•  Primaryprocessesthatenabletheuseoflanguagetoexpressemo8ons,thereforethatallowcogni8onbasedonlanguage–no.

MFOI–VadulluiVodă,29July2016

Page 71: Natural Language Processing vs. Logic.

Thankyou!

MFOI–VadulluiVodă,29July2016