Axioms are rules which attempt to capture all of the (important) facts and concepts about a domain.
We want a set of axioms to completely describe the domain.
Mathematicians don't want any unnecessary (dependent) axioms---ones that can be derived from other axioms. But we might want them because they can make reasoning faster.
Here are eight axioms for set theory in the language of FOL:
FORALL s Set(s) <=> (s=EmptySet) OR (EXISTS x,r Set(r) AND s=Adjoin(s,r)
NOT EXISTS x,s Adjoin(x,s)=EmptySet
FORALL x,s Member(x,s) <=> s=Adjoin(x,s)
FORALL x,s Member(x,s) <=> EXISTS y,r (s=Adjoin(y,r) AND (x=y OR Member(x,r)))
FORALL s,r Subset(s,r) <=> (FORALL x Member(x,s) => Member(x,r)
FORALL s,r (s=r) <=> (subset(s,r) AND Subset(r,s))
FORALL x,s,r Member(x, Intersection(s,r)) <=> Member(x,s) AND Member(x,r)
FORALL x,s,r Member(x, Union(s,r)) <=> Member(x,s) OR Member(x,r)
The knowledge-based agent uses subroutines ASK and TELL to manage its internal database.
Recall the design of the agent:
Knowledge enters the database by the agent converting its percepts into FOL sentences which it then TELLs itself. These are called assertions.
We can also imagine a teacher "loading" the knowledge base beforehand using TELL.
For instance, we could TELL the database about eating and wanting:
TELL(KB, FORALL x,y Eats(x,y) AND Hungry(x) => Wants(x,y))
TELL(KB, FORALL x,y,z Wants(x,y) AND IsA(z,y) => Wants(x,z))
TELL(KB, Eats(Sylvester, Birds))
TELL(KB, Hungry(Sylvester))
The agent finds out about which action to perform next by ASKing itself a query. The query can contain variables, in which case they are assumed to be existentially quantified:
ASK(KB, Wants(Sylvester,x))
Queries return a binding list, which is a set of variable/term pairs. In this case, the list would be {x/Tweety}.
If there is more than one possible answers, a list of lists would be returned, one list for each answer.
reflex agents model-based agents goal-based agents
We first define the way the environment gets translated into a percept sequence.
Percept([Stench, Breeze, Glitter, NoScream, NoBump], 5)
The agents possible actions are
Turn(Right), Turn(Left), Forward, Shoot, Grab, Release, Climb
Note that these are all constants except for the first two which are functions of the constants Left and Right.
The agent picks an action by using the MAKE-ACTION-QUERY function to create a query:
Exists a Action(a,5)
Remember that the ASK function returns a binding list if the query can be satisfied. We hope that the agent will grab the gold in this case, so the binding list should be:
{a/Grab}
The agent then TELLs itself what it did.
They cannot even solve the Wumpus problem. Since the agent has no representation of the world, it can't tell when it is back at square [1,1] so it can never no when to climb. Reflex agents always do the same action for the same percepts, so they may get stuck in endless loops.
The world changes. Actions of the agent cause change. So the agent really needs an internal model of the world.
Bad ways to model change:
We add an argument--the situation argument--to each predicate that changes over time.
At(Agent, location)becomes
At(Agent, location, s)
A special predicate Result(action, situation) is used to represent how the world changes.
Result(Forward, S0) = S1 Result(Turn(Right), S1) = S2We describe actions by their effects.
Effect axioms describe the result of an action:
Portable(Gold)
FORALL s AtGold(s) => Present(Gold,s)
FORALL x,s Present(x,s) AND Portdable(x)
=> Holding(x, Result(Grab,s))
FORALL x,s NOT Holding(x, Result(Release,s))
Axioms like these are not sufficient. Somehow we need to specify what does not change when the agent does an action. Does shooting the arrow affect whether the agent is holding the gold? Does it affect the agent's location?
This problem is called the frame problem and was solved by Charles Elkan.
The solution uses successor-state axioms of the form:
true afterwards
<=> [an action made it true
OR true already AND no action made it false]
We need one such axiom for each mutable predicate. For example:
FORALL a,x,s Holding(x,Result(a,s))
<=> [ a=Grab AND Present(x,s) AND Portable(x))
OR (Holding(x,s) AND NOT a=Release) ]
Orientation: 0 is x-axis, 90 y-axis etc.
Orientation(Agent,S0)=0
The map:
FORALL x,y LocationToward([x,y],0)=[x+1,y] FORALL x,y LocationToward([x,y],90)=[x,y+1]What's ahead:
FORALL p,l,s At(p,l,s) = > LocationAhead(p,s)=LocationToward(l,Orientation(p,s))The wall:
FORALL x,y Wall([x,y]) <=> (x=0 OR x=5 OR y=0 OR y=5)Actions change location:
FORALL a,d,p,s At(p,l,Result(a,s)) <=> [(a=Forward AND l=LocationAhead(p,s) AND NOT Wall(l)) ORE (At(p,l,s) AND NOT a=Forward)]
It is important for the agent to be able to reason about places not just situations.
The question comes up of how to represent knowledge about places.
Causal rules are usually better to reason with.
Compare two rules for deciding if a space is ok:
Diagnostic rule:
FORALL x,y,g,u,c,s
Percept(NoBreeze, NoStench, g, u, c],t) AND
At(Agent,x,s) AND Adjacent(x,y) => OK(y)
Causal rule:
FORALL x,s (NOT At(Wumpus,x,s) AND NOT Pit(x)) <=> OK(x)
We want to make the rules for choosing actions modular.
We rate the different actions in diferent situations according to the scale Great, Good, Medium, Risky or Deadly.
FORALL a,s Great(a,s) => Action(a,s)
FORALL a,s Good(a,s) AND
(NOT EXISTS b Great(b,s)) => Action(a,s)
... etc.
An example action value rule:
FORALL s Present(Gold,s) => Great(Grab,s)
Once the gold is found it is necessary to change goals.
So now we need a new set of action values.
We could encode this as a rule:
FORALL s Holding(Gold,s) => GoalLocation([1,1]),s)
We must now decide how the agent will work out a sequence of actions to accomplish the goal.