• Aucun résultat trouvé

First-order logic

N/A
N/A
Protected

Academic year: 2022

Partager "First-order logic"

Copied!
6
0
0

Texte intégral

(1)

First-order logic

Chapter8

Chapter81

Outline

♦WhyFOL?

♦SyntaxandsemanticsofFOL

♦Funwithsentences

♦WumpusworldinFOL

Chapter82

Pros and cons of prop ositional logic

Propositionallogicisdeclarative:piecesofsyntaxcorrespondtofacts

Propositionallogicallowspartial/disjunctive/negatedinformation(unlikemostdatastructuresanddatabases)

Propositionallogiciscompositional:meaningofB1,1∧P1,2isderivedfrommeaningofB1,1andofP1,2

Meaninginpropositionallogiciscontext-independent(unlikenaturallanguage,wheremeaningdependsoncontext)

Propositionallogichasverylimitedexpressivepower(unlikenaturallanguage)E.g.,cannotsay“pitscausebreezesinadjacentsquares”exceptbywritingonesentenceforeachsquare

Chapter83

First-order logic

Whereaspropositionallogicassumesworldcontainsfacts,first-orderlogic(likenaturallanguage)assumestheworldcontains

•Objects:people,houses,numbers,theories,RonaldMcDonald,colors,baseballgames,wars,centuries...

•Relations:red,round,bogus,prime,multistoried...,brotherof,biggerthan,inside,partof,hascolor,occurredafter,owns,comesbetween,...

•Functions:fatherof,bestfriend,thirdinningof,onemorethan,endof...

Chapter84

Logics in general

LanguageOntologicalEpistemologicalCommitmentCommitmentPropositionallogicfactstrue/false/unknownFirst-orderlogicfacts,objects,relationstrue/false/unknownTemporallogicfacts,objects,relations,timestrue/false/unknownProbabilitytheoryfactsdegreeofbeliefFuzzylogicfacts+degreeoftruthknownintervalvalue

Chapter85

Syn tax of F OL: Basic elemen ts

ConstantsKingJohn,2,UCB,...PredicatesBrother,>,...FunctionsSqrt,LeftLegOf,...Variablesx,y,a,b,...Connectives∧∨¬⇒⇔Equality=Quantifiers∀∃

Chapter86

(2)

A tomic sen tences

Atomicsentence=predicate(term1,...,termn)orterm1=term2

Term=function(term1,...,termn)orconstantorvariable

E.g.,Brother(KingJohn,RichardTheLionheart)>(Length(LeftLegOf(Richard)),Length(LeftLegOf(KingJohn)))

Chapter87

Complex sen tences

Complexsentencesaremadefromatomicsentencesusingconnectives

¬S,S1∧S2,S1∨S2,S1⇒S2,S1⇔S2

E.g.Sibling(KingJohn,Richard)⇒Sibling(Richard,KingJohn)>(1,2)∨≤(1,2)>(1,2)∧¬>(1,2)

Chapter88

T ruth in first-order logic

Sentencesaretruewithrespecttoamodelandaninterpretation

Modelcontains≥1objects(domainelements)andrelationsamongthem

Interpretationspecifiesreferentsforconstantsymbols→objectspredicatesymbols→relationsfunctionsymbols→functionalrelations

Anatomicsentencepredicate(term1,...,termn)istrueifftheobjectsreferredtobyterm1,...,termnareintherelationreferredtobypredicate

Chapter89

Mo dels for F OL: Example

R J

$

left legleft leg on headbrotherbrother personpersonking crown

Chapter810

T ruth example

ConsidertheinterpretationinwhichRichard→RichardtheLionheartJohn→theevilKingJohnBrother→thebrotherhoodrelation

Underthisinterpretation,Brother(Richard,John)istruejustincaseRichardtheLionheartandtheevilKingJohnareinthebrotherhoodrelationinthemodel

Chapter811

Mo dels for F OL: Lots!

Entailmentinpropositionallogiccanbecomputedbyenumeratingmodels

WecanenumeratetheFOLmodelsforagivenKBvocabulary:

Foreachnumberofdomainelementsnfrom1to∞Foreachk-arypredicatePkinthevocabularyForeachpossiblek-aryrelationonnobjectsForeachconstantsymbolCinthevocabularyForeachchoiceofreferentforCfromnobjects...

ComputingentailmentbyenumeratingFOLmodelsisnoteasy!

Chapter812

(3)

Univ ersal quan tification

∀hvariablesihsentencei

EveryoneatBerkeleyissmart:∀xAt(x,Berkeley)⇒Smart(x)

∀xPistrueinamodelmiffPistruewithxbeingeachpossibleobjectinthemodel

Roughlyspeaking,equivalenttotheconjunctionofinstantiationsofP

(At(KingJohn,Berkeley)⇒Smart(KingJohn))∧(At(Richard,Berkeley)⇒Smart(Richard))∧(At(Berkeley,Berkeley)⇒Smart(Berkeley))∧...

Chapter813

A common mistak e to a v oid

Typically,⇒isthemainconnectivewith∀

Commonmistake:using∧asthemainconnectivewith∀:

∀xAt(x,Berkeley)∧Smart(x)

means“EveryoneisatBerkeleyandeveryoneissmart”

Chapter814

Existen tial quan tification

∃hvariablesihsentencei

SomeoneatStanfordissmart:∃xAt(x,Stanford)∧Smart(x)

∃xPistrueinamodelmiffPistruewithxbeingsomepossibleobjectinthemodel

Roughlyspeaking,equivalenttothedisjunctionofinstantiationsofP

(At(KingJohn,Stanford)∧Smart(KingJohn))∨(At(Richard,Stanford)∧Smart(Richard))∨(At(Stanford,Stanford)∧Smart(Stanford))∨...

Chapter815

Another common mistak e to a v oid

Typically,∧isthemainconnectivewith∃

Commonmistake:using⇒asthemainconnectivewith∃:

∃xAt(x,Stanford)⇒Smart(x)

istrueifthereisanyonewhoisnotatStanford!

Chapter816

Prop erties of quan tifiers

∀x∀yisthesameas∀y∀x(why??)

∃x∃yisthesameas∃y∃x(why??)

∃x∀yisnotthesameas∀y∃x

∃x∀yLoves(x,y)“Thereisapersonwholoveseveryoneintheworld”

∀y∃xLoves(x,y)“Everyoneintheworldislovedbyatleastoneperson”

Quantifierduality:eachcanbeexpressedusingtheother

∀xLikes(x,IceCream)¬∃x¬Likes(x,IceCream)

∃xLikes(x,Broccoli)¬∀x¬Likes(x,Broccoli)

Chapter817

F un with sen tences

Brothersaresiblings

Chapter818

(4)

F un with sen tences

Brothersaresiblings

∀x,yBrother(x,y)⇒Sibling(x,y).

“Sibling”issymmetric

Chapter819

F un with sen tences

Brothersaresiblings

∀x,yBrother(x,y)⇒Sibling(x,y).

“Sibling”issymmetric

∀x,ySibling(x,y)⇔Sibling(y,x).

One’smotherisone’sfemaleparent

Chapter820

F un with sen tences

Brothersaresiblings

∀x,yBrother(x,y)⇒Sibling(x,y).

“Sibling”issymmetric

∀x,ySibling(x,y)⇔Sibling(y,x).

One’smotherisone’sfemaleparent

∀x,yMother(x,y)⇔(Female(x)∧Parent(x,y)).

Afirstcousinisachildofaparent’ssibling

Chapter821

F un with sen tences

Brothersaresiblings

∀x,yBrother(x,y)⇒Sibling(x,y).

“Sibling”issymmetric

∀x,ySibling(x,y)⇔Sibling(y,x).

One’smotherisone’sfemaleparent

∀x,yMother(x,y)⇔(Female(x)∧Parent(x,y)).

Afirstcousinisachildofaparent’ssibling

∀x,yFirstCousin(x,y)⇔∃p,psParent(p,x)∧Sibling(ps,p)∧Parent(ps,y)

Chapter822

Equalit y

term1=term2istrueunderagiveninterpretationifandonlyifterm1andterm2refertothesameobject

E.g.,1=2and∀x×(Sqrt(x),Sqrt(x))=xaresatisfiable2=2isvalid

E.g.,definitionof(full)SiblingintermsofParent:∀x,ySibling(x,y)⇔[¬(x=y)∧∃m,f¬(m=f)∧Parent(m,x)∧Parent(f,x)∧Parent(m,y)∧Parent(f,y)]

Chapter823

In teracting with F OL KBs

Supposeawumpus-worldagentisusinganFOLKBandperceivesasmellandabreeze(butnoglitter)att=5:

Tell(KB,Percept([Smell,Breeze,None],5))Ask(KB,∃aAction(a,5))

I.e.,doesKBentailanyparticularactionsatt=5?

Answer:Yes,{a/Shoot}←substitution(bindinglist)

GivenasentenceSandasubstitutionσ,SσdenotestheresultofpluggingσintoS;e.g.,S=Smarter(x,y)σ={x/Hillary,y/Bill}Sσ=Smarter(Hillary,Bill)

Ask(KB,S)returnssome/allσsuchthatKB|=Sσ

Chapter824

(5)

Kno wledge base for the wumpus w orld

“Perception”∀b,g,tPercept([Smell,b,g],t)⇒Smelt(t)∀s,b,tPercept([s,b,Glitter],t)⇒AtGold(t)

Reflex:∀tAtGold(t)⇒Action(Grab,t)

Reflexwithinternalstate:dowehavethegoldalready?∀tAtGold(t)∧¬Holding(Gold,t)⇒Action(Grab,t)

Holding(Gold,t)cannotbeobserved⇒keepingtrackofchangeisessential

Chapter825

Deducing hidden prop erties

Propertiesoflocations:∀x,tAt(Agent,x,t)∧Smelt(t)⇒Smelly(x)∀x,tAt(Agent,x,t)∧Breeze(t)⇒Breezy(x)

Squaresarebreezynearapit:

Diagnosticrule—infercausefromeffect∀yBreezy(y)⇒∃xPit(x)∧Adjacent(x,y)

Causalrule—infereffectfromcause∀x,yPit(x)∧Adjacent(x,y)⇒Breezy(y)

Neitheroftheseiscomplete—e.g.,thecausalruledoesn’tsaywhethersquaresfarawayfrompitscanbebreezy

DefinitionfortheBreezypredicate:∀yBreezy(y)⇔[∃xPit(x)∧Adjacent(x,y)]

Chapter826

Keeping trac k of c hange

Factsholdinsituations,ratherthaneternallyE.g.,Holding(Gold,Now)ratherthanjustHolding(Gold)

SituationcalculusisonewaytorepresentchangeinFOL:Addsasituationargumenttoeachnon-eternalpredicateE.g.,NowinHolding(Gold,Now)denotesasituation

SituationsareconnectedbytheResultfunctionResult(a,s)isthesituationthatresultsfromdoingains

PIT PIT PIT

Gold

PIT PIT PIT

Gold

S0 Forward S1

Chapter827

Describing actions I

“Effect”axiom—describechangesduetoaction∀sAtGold(s)⇒Holding(Gold,Result(Grab,s))

“Frame”axiom—describenon-changesduetoaction∀sHaveArrow(s)⇒HaveArrow(Result(Grab,s))

Frameproblem:findanelegantwaytohandlenon-change(a)representation—avoidframeaxioms(b)inference—avoidrepeated“copy-overs”tokeeptrackofstate

Qualificationproblem:truedescriptionsofrealactionsrequireendlesscaveats—whatifgoldisslipperyornaileddownor...

Ramificationproblem:realactionshavemanysecondaryconsequences—whataboutthedustonthegold,wearandtearongloves,...

Chapter828

Describing actions I I

Successor-stateaxiomssolvetherepresentationalframeproblem

Eachaxiomis“about”apredicate(notanactionperse):

Ptrueafterwards⇔[anactionmadePtrue∨PtruealreadyandnoactionmadePfalse]

Forholdingthegold:∀a,sHolding(Gold,Result(a,s))⇔[(a=Grab∧AtGold(s))∨(Holding(Gold,s)∧a6=Release)]

Chapter829

Making plans

InitialconditioninKB:At(Agent,[1,1],S0)At(Gold,[1,2],S0)

Query:Ask(KB,∃sHolding(Gold,s))i.e.,inwhatsituationwillIbeholdingthegold?

Answer:{s/Result(Grab,Result(Forward,S0))}i.e.,goforwardandthengrabthegold ThisassumesthattheagentisinterestedinplansstartingatS0andthatS0istheonlysituationdescribedintheKB

Chapter830

(6)

Making plans: A b etter w a y

Representplansasactionsequences[a1,a2,...,an]

PlanResult(p,s)istheresultofexecutingpins

ThenthequeryAsk(KB,∃pHolding(Gold,PlanResult(p,S0)))hasthesolution{p/[Forward,Grab]}

DefinitionofPlanResultintermsofResult:∀sPlanResult([],s)=s∀a,p,sPlanResult([a|p],s)=PlanResult(p,Result(a,s))

Planningsystemsarespecial-purposereasonersdesignedtodothistypeofinferencemoreefficientlythanageneral-purposereasoner

Chapter831

Summary

First-orderlogic:–objectsandrelationsaresemanticprimitives–syntax:constants,functions,predicates,equality,quantifiers

Increasedexpressivepower:sufficienttodefinewumpusworld

Situationcalculus:–conventionsfordescribingactionsandchangeinFOL–canformulateplanningasinferenceonasituationcalculusKB

Chapter832

Références

Documents relatifs

The proof is obtained by a direct mapping between formal E-strategies and derivations in a cut-free complete sequent calculus for first order intuitionistic logic.. Our approach

Le solvant est alors évaporé sous pression réduite puis le produit halogéné est purifié par chromatographie liquide sur colonne de silice avec un éluant constitué

The notion of stability inside a model appears for example in the work of Krivine and Maurey on stable Banach spaces [KM81]: a Banach space E is stable in the sense of Krivine

In the present paper we replace the unit ball approach with the formalism of unbounded continuous first order logic, directly applicable to unbounded metric structures and in

In essence then, it comes down to a choice between having a form of entailment that satisfies Strict Entailment (PT-entailment), and one that satisfies the Single Model postulate

form of entailment that satisfies Strict Entailment (PT-entailment), and one that satisfies the Single Model postulate and Conditional Rationality, i.e., is based on a

Since the membership problem is existential (asking for the existence of a derivation) and the entailment problem is universal (every model of the left-hand side is a model of

Sequen- tial composition of compensable programs δ ; γ is interpreted by two sets, one where the successful termination of δ allows the execution of γ, the other where δ fails