AI Glossary / Mathematics and optimization / Advanced

Situation calculus

Definition

Situation calculus is a logical framework for describing actions and reasoning about how their effects change the world. It represents properties that can vary, the conditions under which actions are possible, and the situations reached after sequences of actions.

What it means

An intelligent agent often needs to answer questions such as: Can this action be performed now? What will become true afterward? Which existing facts will remain true? Situation calculus turns those questions into explicit logical statements.

In the widely used Reiter-style formulation, a situation represents an action history beginning from an initial situation S₀. It is not merely a snapshot of current property values. Different histories can lead to identical current values while remaining distinct situations.

A property whose value depends on the situation is called a fluent. For example, Approved(order,s) can express whether an order is approved after the history s. Ordinary fixed facts, such as a product identifier's type, need not be fluents. Different variants of situation calculus use different notation and extensions, so a description should identify its chosen formulation.

How it works

The term do(a,s) denotes the situation following action a after situation s. A predicate Poss(a,s) states whether a is executable there. Writing a successor situation term does not by itself prove that its action history is executable.

Action precondition axioms define Poss. Successor-state axioms specify when a fluent holds after an action: typically, when the action makes it true, or when it was already true and the action does not make it false. This captures both change and persistence.

Persistence is central to the frame problem: describing an action's effects is insufficient if every unrelated property is left unspecified. Successor-state axioms provide a systematic solution within an appropriately specified action theory, rather than assuming that arbitrary missing information is false.

Reasoning can project a known action sequence forward or regress a question about a later situation into conditions on earlier situations. Planning additionally requires finding a sequence with executable actions and a desired result. Logical entailment remains relative to the axioms, so omitted effects and incorrect preconditions limit the conclusions.

Three practical examples

  • A symbolic planning system checks whether a robot can perform a sequence of pickup and delivery actions under a modeled world state.
  • A workflow researcher represents approval and dispatch rules to reason about permitted order histories.
  • An agent-programming study uses a situation-calculus action theory as the basis for evaluating conditions in a high-level control program.

Think of it this way

Think of an annotated activity log together with rules explaining what each recorded action changes. To determine the current status, reason through the log using those rules.

The analogy is limited because the formalism can also describe hypothetical histories and incomplete initial knowledge. It is a logical model of actions, not simply a database of events that actually occurred.

Worked example

Checking an approval sequence

Consider one order with fluents Approved(s) and Sent(s). Initially both are false, and Reviewed(S₀) is true. In this simplified model, approval requires Reviewed(s) and not Approved(s); dispatch requires Approved(s) and not Sent(s). A Snapshot action is always permitted and changes neither fluent.

Use the successor rule Approved(do(a,s)) iff a=Approve or [Approved(s) and a≠Revoke]. Use Sent(do(a,s)) iff a=Dispatch or Sent(s). Assume the named actions are distinct and apply these rules together with the preconditions on executable histories.

Let s₁=do(Approve,S₀). Approval is possible, so Approved(s₁) becomes true while Sent(s₁) remains false. Let s₂=do(Snapshot,s₁). Both values persist. Dispatch is now possible, and in s₃=do(Dispatch,s₂), Sent(s₃) is true.

Dispatch directly from S₀ is not executable because approval is false. Also, s₁ and s₂ have the same displayed fluent values but different histories. These rules establish the result only for this teaching model; a real workflow would need effects for amendments, revocation, retries and other relevant events.

Illustrative case study

A fictional purchasing-software team wants its planning agent to reason before dispatching orders. It initially models only actions that make approval true and shipment occur, leaving persistence and revocation unspecified.

A formal-model review adds explicit successor-state rules and tests short action histories. The team discovers that its business process also invalidates approval when an order changes, requiring an amendment effect in the model.

The corrected theory helps explain which planned sequences satisfy the stated rules. The company still checks the actual service integration, because a logically valid plan does not prove that an external system executes actions exactly as modeled.

Common misconceptions and mistakes

  • A situation is always just the current state. In the selected formulation it records an action history.
  • Naming do(a,s) proves a is possible. Executability needs precondition reasoning.
  • Unmentioned effects automatically stay unchanged. Persistence must be represented by the action theory.
  • A proof covers everything that can happen in reality. It covers the modeled assumptions and actions.
  • Situation calculus is numerical calculus. It is a logic for actions and change, unrelated to taking ordinary derivatives.

Business use

The framework is useful when an agent's permitted actions depend on explicit rules and when explaining a plan matters. It can make hidden assumptions about approvals, resources and action effects visible to reviewers.

Start with a bounded domain and a small set of important fluents. Include exceptions that materially affect executability. Keep the model aligned with implementation behavior and identify where sensing or external information is incomplete. The value lies in precise, reviewable reasoning; using formal notation alone does not make an incomplete business model reliable.

People also ask

Can it represent incomplete initial knowledge?

Yes. The initial theory can describe what is known without listing one fully specified world state.

Is it the same as a planning algorithm?

No. It is a representation and reasoning framework; an algorithm must still perform inference or search.

Can it handle time or uncertainty?

Extensions exist, but such capabilities should not be assumed from the basic deterministic action description alone.

Check your understanding

After Approve and then Snapshot, approval remains true. Does that mean the two resulting situations are identical?

Answer: No. Their relevant fluent values can match while their action histories differ. The Snapshot action still appears in the later situation term.

Related terms

  • Fluent
  • Frame problem
  • Successor-state axiom
  • action precondition
  • planning
  • Golog

Learn next

Read frame problem and action precondition. Extend the example with Amend, which invalidates approval, and check whether a later Dispatch remains executable without a new approval.

  • Frame problem

More in Mathematics and optimization

  • Absolute error loss - Absolute error loss measures a numerical prediction's error as the absolute difference between its predicted and reference values: L(y,y-hat)=|y-y-hat|.
  • Active-set method - An active-set method is an optimization approach that works with a changing subset of constraints believed to be tight at the solution.
  • Adjoint state method - The adjoint state method computes how a chosen objective changes when the parameters of a mathematical model change.
  • Σ-algebra
  • Algebraic connectivity - Algebraic connectivity is the second-smallest eigenvalue of a graph's Laplacian matrix.
  • Algorithm IMED - Algorithm IMED, short for Indexed Minimum Empirical Divergence, is a method for choosing actions in a stochastic multi-armed bandit problem.

Sources

Schiffel and Thielscher, Reconciling Situation Calculus and Fluent Calculus, background section: https://cgi.cse.unsw.edu.au/~mit/Papers/AAAI06.pdf. Primary treatment of situations, fluents, successor-state axioms and executability.

McCarthy, The situation calculus formalism: https://www-formal.stanford.edu/jmc/sitcalc/node2.html. Author's alternative formulation illustrates terminology variation. The order workflow is an original teaching model.

Previous: Situated robotics Next: Size invariance

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer