Free will, both in humans and in computer programs has two aspects--the external aspect and the introspective aspect.
The external aspect is the set of results that an agent P can achieve, i.e. what it can do in a situation s,
Thus in the present situation, I can find my drink. In one sense I can climb on the roof of my house and jump off. In another sense I can't. (The different senses of can will be discussed in Section 3.1). In a certain position, a chess program can checkmate its opponent and can also move into a position leading to the opponent giving checkmate. What is x in Can(P,x,s)? In English it usually has the grammatical form of an action, but in the interesting cases it is not an elementary action like those treated in situation calculus. Thus we have ``I can go to Australia'', ``I can make a million dollars'', ``I can get a new house''. Often the what is to be achieved is a fluent, e.g. the state of having a new house.
In the most important case, Poss(P,s) depends only on the causal position of P in the world and not on the internal structure of P.
The introspective aspect involves the agent P's knowledge of Poss(P,s), i.e. its knowledge of what it can achieve. Here is where the human sense of free will comes in. It depends on P having an internal structure that allows certain aspects of its current state to be interpreted as expressing knowledge. I know I can find my drink. In a simple chess position I would know I could give checkmate in three, because the chess problem column in the newspaper said so, although I mightn't yet have been able to figure out how.
Some present computer programs, e.g. chess programs, have an extensive Poss(P,s). However, their knowledge of Poss(P,s) as a set is very limited. Indeed it is too limited for optimal functionality, and robots' knowledge of their possibilities need to be made more like that of humans. For example, a robot may conclude that in the present situation it has too limited a set of possibilities. It may then undertake to ensure that in future similar situations it will have more choices.