What is situation calculus?
by Stephen M. Walker II, CoFounder / CEO
What is situation calculus?
Situation calculus is a logic formalism designed for representing and reasoning about dynamical domains. It was first introduced by John McCarthy in 1963. The main idea behind situation calculus is that reachable states, referred to as situations, can be defined in terms of actions that lead to them.
The ontology of situation calculus consists of three main components: situations, actions, and fluents.

Situations — These are essentially snapshots of the world at a particular point in time. They are logical terms that are made up of the initial situation and all the situations that arise from it.

Actions — These are activities that can change the state of the world. They form a sort of the domain, and variables of sort action can be used, as well as functions whose result is of sort action.

Fluents — These are properties of the domain whose value can change over time. Examples of fluents include the location of a person, the temperature of a room, the speed of a car, or the age of a person. Fluents are modeled as either predicates or functions.
Situation calculus is based on a sorted domain with three sorts: actions, situations, and objects, where the objects include everything that is not an action or a situation.
In the context of AI, situation calculus is used for planning by asking for a situation in which a goal is true. Answer extraction is used to find a situation in which the goal is true. This situation can be interpreted as a sequence of actions that lead to the goal.
It's important to note that situation calculus assumes a fully observable environment, deterministic actions, and a single agent. Despite its advantages, it's worth noting that situation calculus can be complex to implement due to the large number of axioms to be defined for each action, and the large search space for finding solutions.
How is situation calculus used in AI?
Situation calculus is used in AI for representing and reasoning about dynamic domains. It provides a clear and concise representation of knowledge, allowing for the representation of change and action over time. It also enables reasoning about knowledge even in the absence of complete information.
One of the primary applications of situation calculus in AI is in planning. It is used to find a sequence of actions that lead to a goal. This is achieved by converting the planning problem into a theorem proving problem. However, this approach can be challenging due to the large search space and the large number of axioms that need to be defined for each action.
Situation calculus is also used in AI for reasoning about actions and change. It provides a framework for representing change and actions, and for reasoning about them. It is based on firstorder logic, and a situation variable models new states.
In addition, situation calculus has been used within the framework of the Golog family of languages, which combines features from traditional imperative programming language with planning. The actions referred to in Golog programs obtain their meaning from a basic action theory as described in situation calculus. Golog has been applied to the control of real robots.
Despite its usefulness, it's important to note that situation calculus has some limitations. For instance, it can be computationally complex to use for reasoning, and it does not directly support reasoning about change and action, which can be important in many AI applications. Nonetheless, its ability to represent and reason about changes in states over time makes it a powerful tool in AI.
What are some examples of dynamical domains that can be represented using situation calculus?
Situation calculus can be used to represent a wide range of dynamical domains. Here are a few examples:

Robotics — A common example is a simple robot world where there is a single robot and several inanimate objects. The robot can perform actions like moving from one location to another, picking up objects, or putting down objects. The state of the world changes as a result of these actions. For instance, the location of the robot and the location of the objects can change over time.

Multiagent Systems — Situation calculus can also be used to model multiagent systems where multiple agents interact with each other and the environment. Each agent can perform actions that change the state of the world.

Transportation Systems — Situation calculus can be used to model transportation systems. For example, the location of a person or a vehicle can change over time as a result of actions like walking, driving, or taking public transportation.

Environmental Monitoring — In environmental monitoring, situation calculus can be used to model the state of the environment which changes over time due to various factors like weather conditions, human activities, or natural events.

Game Theory — In game theory, situation calculus can be used to model games where the state of the game changes as a result of actions taken by the players.

Healthcare — In healthcare, situation calculus can be used to model the state of a patient which changes over time due to various factors like medication, treatment, or lifestyle changes.
Remember, these are just examples. The power of situation calculus lies in its ability to model any dynamical domain where the state of the world changes as a result of actions.
How does situation calculus compare to other formalisms in AI?
Situation calculus distinguishes itself from other AI formalisms through its unique approach to representing and reasoning about dynamic domains. Unlike other AI formalisms, situation calculus does not require a complete understanding of the world to reason about changes in states. This makes it a powerful tool for reasoning about changes in the world, and has led to its widespread use in AI applications.
One of the key differences between situation calculus and other formalisms is its focus on formal logical representation of actions, situations, and fluents. This allows for a clear and concise representation of knowledge, and it can be used to represent change and action over time. It also enables reasoning about knowledge even in the absence of complete information.
Situation calculus is often compared to featurebased representations of actions. It can be considered as a relationshipbased version of the featurebased way of describing actions. However, there are two critical differences between situations (in situation calculus) and states (in featurebased representations): equality between situations and equality between states are not the same thing, and it is not necessary that every state must have corresponding situations.
Another distinction of situation calculus is its use within the framework of the Golog family of languages, which combines features from traditional imperative programming language with planning. The actions referred to in Golog programs obtain their meaning from a basic action theory as described in situation calculus.
However, it's important to note that situation calculus has its limitations. For instance, it can be computationally complex to use for reasoning, and it does not directly support reasoning about change and action, which can be important in many AI applications. Despite these challenges, its ability to represent and reason about changes in states over time makes it a powerful tool in AI.
What is the difference between a static and dynamic domain in situation calculus?
In situation calculus, a domain can be classified as either static or dynamic based on whether the truth value of its relations change over time.
A static domain is one where the truth value of its relations does not depend on the situation, meaning its truth value remains unchanging over time. For example, in a robot world, the fact that a robot can move from one location to another is a static relation because this ability does not change over time.
On the other hand, a dynamic domain is one where the truth value of its relations can change as a result of actions. In the same robot world, the location of the robot is a dynamic relation because it changes as a result of the robot's actions.
In the context of situation calculus, actions are what make the dynamic world change from one situation to another. To describe a dynamic domain in the situation calculus, one has to decide on the set of actions available for the agents to perform, and the set of fluents that describe the state of the world.
It's worth noting that while situation calculus can be used to model both static and dynamic domains, it is particularly useful for dynamic modeling and reasoning. However, using situation calculus to represent simple static domain representations can sometimes overcomplicate them.