# 情境演算

情境演算是人工智能中一种用于表示和推理动态变化世界的逻辑形式化方法，建立在三个概念之上：情境、动作和流变（真值随时间变化的属性）。<sup>[1](https://dai.fmph.uniba.sk/~sefranek/kri/handbook/chapter16.pdf)</sup> 它是一阶逻辑的一种方言，但只有在雷·赖特（Ray Reiter）提出其对框架问题的解决方案之后才产生了重大影响，该方案进而引出了基本动作理论和Golog编程语言。<sup>[2](https://ai.stanford.edu/~epacuit/socsit/lakemeyer.pdf)</sup> 在情境演算的规划方法中，人们对所有动作进行公理化，并使用通用定理证明器来证明存在一个使目标为真的情境；证明中的动作即构成规划。<sup>[3](https://opencourse.inf.ed.ac.uk/sites/default/files/https/opencourse.inf.ed.ac.uk/inf2d/2024/14situation-calculus_0.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| 本体论 | 三个不相交的类别：动作、情境和对象，外加初始情境常量 \( S_{0} \) 和二元函数 do：动作 × 情境 → 情境<sup>[4](https://www.cs.toronto.edu/kr/publications/Levesque98.pdf)</sup> |
| 情境 | 在赖特的版本中，是从 \( S_{0} \) 开始的动作历史；在麦卡锡（McCarthy）和海斯（Hayes）的原始版本中，是世界的快照<sup>[2](https://ai.stanford.edu/~epacuit/socsit/lakemeyer.pdf)</sup><sup> • </sup><sup>[5](http://www-formal.stanford.edu/jmc/narrative/node1.html)</sup> |
| 可执行性 | 谓词 Poss(a, s) 表示动作 a 在情境 s 中何时可执行<sup>[6](https://doi.org/10.1007/978-0-387-89299-3_2)</sup> |
| 框架问题的解决 | 每个流变对应一条后继状态公理，其规模约为流变数量的量级，而非流变数量乘以动作数量<sup>[7](https://ar5iv.labs.arxiv.org/html/2406.18930)</sup> |
| 领域理论 | 基本动作理论是基础公理、前提条件公理、后继状态公理、动作的唯一名称公理和初始情境公理的并集<sup>[8](http://www.cs.yorku.ca/~lesperan/papers/KR21.pdf)</sup> |
| 推理 | 回归将关于未来情境的查询归约为关于 \( S_{0} \) 的等价公式，具有可靠性和完备性<sup>[9](https://dl.acm.org/doi/10.1145/316542.316545)</sup> |
| 智能体语言 | Golog（1997）、ConGolog（2000）和IndiGolog（2009）是在情境演算中定义的编程语言<sup>[10](https://doi.org/10.1016/s0743-1066%2896%2900121-5)</sup><sup> • </sup><sup>[11](https://doi.org/10.1016/s0004-3702%2800%2900031-x)</sup><sup> • </sup><sup>[6](https://doi.org/10.1007/978-0-387-89299-3_2)</sup> |

## 工作原理

该形式化方法回答了1969年提出的框架问题：使用数学逻辑，如何可能写出描述动作效果的公式，而不必同时写出大量描述这些动作平凡的、显而易见的非效果的公式？<sup>[12](https://plato.stanford.edu/entries/frame-problem/)</sup> 20世纪90年代初，赖特提出了一个单调解决方案，引入后继状态公理，每个流变对应一条，为任何动作之后流变的值提供必要且充分的条件。<sup>[2](https://ai.stanford.edu/~epacuit/socsit/lakemeyer.pdf)</sup> 一个 (n + 1) 元关系流变 F 的后继状态公理具有如下形式

\[ F(\vec{x}, do(a,s)) \equiv \Phi_{F}(\vec{x},a,s), \]

从而保证[马尔可夫性](https://www.edgepedia.org/zh/markov-property)质：动作之后流变的值仅取决于该动作和当前情境。<sup>[4](https://www.cs.toronto.edu/kr/publications/Levesque98.pdf)</sup> 收益是数量上的：可以预期后继状态公理的集合大约在流变数量的量级，而显式的框架公理集合则大约在流变数量乘以动作数量的量级。<sup>[7](https://ar5iv.labs.arxiv.org/html/2406.18930)</sup>

回归算子 \( \mathcal{R}^{*} \) 将关于未来情境的公式归约为关于 \( S_{0} \) 的等价公式，其基本做法是用后继状态公理的右侧替换流变，直到函数 do 被消去；皮里（Pirri）和赖特证明了这种基于回归的蕴涵方法对于一大类查询是可靠且完备的。<sup>[9](https://dl.acm.org/doi/10.1145/316542.316545)</sup><sup> • </sup><sup>[7](https://ar5iv.labs.arxiv.org/html/2406.18930)</sup> 这将投影问题转化为关于初始情境的推理，适合用一阶定理证明技术来处理。<sup>[2](https://ai.stanford.edu/~epacuit/socsit/lakemeyer.pdf)</sup>

## 具体做法

形式化一个动态领域意味着写出一个基本动作理论 \( \mathcal{D} = \Sigma \cup \mathcal{D}_{ap} \cup \mathcal{D}_{ss} \cup \mathcal{D}_{una} \cup \mathcal{D}_{S_{0}} \)：基础公理 \( \Sigma \)，它将情境刻画为从 \( S_{0} \) 出发、使用二阶归纳公理生成的有限动作历史，可执行性由谓词 Poss 单独确定；动作前提条件公理，说明动作何时可以合法执行；每个流变一条后继状态公理；动作的唯一名称公理；以及描述世界初始配置的公理。<sup>[8](http://www.cs.yorku.ca/~lesperan/papers/KR21.pdf)</sup><sup> • </sup><sup>[13](https://www.ijcai.org/Proceedings/13/Papers/171.pdf)</sup>

真值是相对于情境来索引的。一个最初在桌上的积木，OnTable(B, \( S_{0} \))，在执行一个放置动作之后就不再在桌上了：¬OnTable(B, do(put(B, C), \( S_{0} \)))。<sup>[6](https://doi.org/10.1007/978-0-387-89299-3_2)</sup> 麦卡锡的表述对关系流变写作 Holds(fluent, s)，这允许对流变进行量化，对项流变在情境中的值写作 Value(tfluent, s)。<sup>[14](https://www-formal.stanford.edu/jmc/sitcalc.pdf)</sup> 一个基本的推理任务是可执行性问题：executable(do([\( \alpha_{1} \), …, \( \alpha_{n} \)], \( S_{0} \))) 缩写表示 Poss(\( \alpha_{1} \), \( S_{0} \)) 以及对于每个后续动作的 Poss(\( \alpha_{i} \), do([\( \alpha_{1} \), …, \( \alpha_{i-1} \)], \( S_{0} \)))；如果理论蕴涵 G(do([\( \alpha_{1} \), …, \( \alpha_{n} \)], \( S_{0} \)))，则目标 G 成立。<sup>[15](https://www.ijcai.org/Proceedings/07/Papers/305.pdf)</sup>

## 起源

麦卡锡和海斯将情境视为世界的快照；而由勒维克（Levesque）、皮里和赖特发展的现代公理化则相反，将情境视为历史，即原始动作的有限序列，do(a, s) 表示在历史 s 上添加动作 a 所得到的序列。<sup>[4](https://www.cs.toronto.edu/kr/publications/Levesque98.pdf)</sup> 赖特在20世纪90年代初的重新表述——带有后继状态公理和基本动作理论——是标准使用的版本；他2001年由[麻省理工学院出版社](https://www.edgepedia.org/zh/mit-press)出版的《行动中的知识》（Knowledge in Action）一书将该框架发展为一种一阶逻辑方言，涵盖时间、过程、并发、外生事件、反应性、感知与知识、概率不确定性和决策论。<sup>[2](https://ai.stanford.edu/~epacuit/socsit/lakemeyer.pdf)</sup><sup> • </sup><sup>[16](https://doi.org/10.7551/mitpress/4074.001.0001)</sup>

## 变体

经典语言在保持动作、情境和流变作为基本要素的同时，已在若干方向上得到扩展。<sup>[17](http://robots.stanford.edu/papers/Boutilier00a.pdf)</sup> 并发、优先级中断和外生动作在德贾科莫（De Giacomo）、莱斯佩朗斯（Lespérance）和勒维克1997年的扩展中得到处理。<sup>[18](https://www.ijcai.org/Proceedings/97-2/Papers/062.pdf)</sup> 知识和感知通过一个以后继状态式公理刻画的知识算子来处理，\( K(s'', do(a,s)) \equiv \exists s'.\, s'' = do(a,s') \wedge K(s',s) \wedge Poss(a,s') \wedge sr(a,s'') = sr(a,s') \)；带有感知动作的基于知识的Golog程序显式地引用智能体的知识，并在关于知识的动态封闭世界假设下在线执行。<sup>[2](https://ai.stanford.edu/~epacuit/socsit/lakemeyer.pdf)</sup><sup> • </sup><sup>[19](https://dl.acm.org/doi/10.1145/383779.383780)</sup> 概率和效用——在布蒂利耶（Boutilier）、赖特、苏灿斯基（Soutchanski）和特伦（Thrun）的决策论智能体编程中——以及偏好也得到了处理。<sup>[17](http://robots.stanford.edu/papers/Boutilier00a.pdf)</sup><sup> • </sup><sup>[20](https://www.diag.uniroma1.it/~patrizi/docs/papers/DGLP_KR2012.pdf)</sup> 非确定性情境演算将该框架扩展到具有多个可能结果的动作。<sup>[8](http://www.cs.yorku.ca/~lesperan/papers/KR21.pdf)</sup>

这些扩展最突出的用途是Golog家族。Golog由赫克托·勒维克及其同事于1997年在《逻辑编程杂志》（Journal of Logic Programming）上报告，是一种用于动态领域的逻辑编程语言；ConGolog由德贾科莫、莱斯佩朗斯和勒维克（2000）提出，增加了并发性，并引入了一步转移谓词 Trans(δ, s, δ′, s′) 和终止谓词 Final(δ, s)；IndiGolog（德贾科莫及其同事，2009）面向嵌入式推理智能体。<sup>[10](https://doi.org/10.1016/s0743-1066%2896%2900121-5)</sup><sup> • </sup><sup>[11](https://doi.org/10.1016/s0004-3702%2800%2900031-x)</sup><sup> • </sup><sup>[6](https://doi.org/10.1007/978-0-387-89299-3_2)</sup>

## 应用

这些公理和元理论已支持规划、控制、仿真、数据库更新、动态系统诊断以及智能体编程和机器人学。<sup>[4](https://www.cs.toronto.edu/kr/publications/Levesque98.pdf)</sup> Golog已被应用于真实机器人的控制，更广泛的动作形式化家族已产生了编程机器人智能体的实用方法和高效规划系统，如TALplanner——由克瓦恩斯特伦（Kvarnström）和多尔蒂（Doherty）开发的基于时序逻辑的前向链规划器。<sup>[2](https://ai.stanford.edu/~epacuit/socsit/lakemeyer.pdf)</sup><sup> • </sup><sup>[21](https://plato.stanford.edu/entries/logic-action/)</sup><sup> • </sup><sup>[22](https://doi.org/10.1023/a:1016619613658)</sup>

## 局限与替代方案

基础公理包含一条二阶归纳公理，这使人类推理和自动推理都变得复杂。<sup>[9](https://dl.acm.org/doi/10.1145/316542.316545)</sup> 后继状态公理的解决方案还假定关于流变真值变化条件的完全信息，这些信息编码在每条公理的双条件式中。<sup>[7](https://ar5iv.labs.arxiv.org/html/2406.18930)</sup> 此外，对于非常长的动作序列，回归变得难以处理，而进展（progression）一旦状态被推进，就允许对结果状态的许多查询进行处理而无需额外开销。<sup>[23](https://arxiv.org/html/2511.15069)</sup> 该框架通用性的代价是，情境演算中推理的可判定性结果很罕见：在有界理论之前，结果仅限于捷尔诺夫斯卡娅（Ternovskaia）1999年关于无参数流变的片段和顾（Gu）与苏灿斯基2007年类似描述逻辑的双变量片段，并且识别出了一种修改后的情境演算，其中投影和可执行性问题是可判定的。<sup>[20](https://www.diag.uniroma1.it/~patrizi/docs/papers/DGLP_KR2012.pdf)</sup><sup> • </sup><sup>[15](https://www.ijcai.org/Proceedings/07/Papers/305.pdf)</sup> 对于在封闭世界假设下具有有限初始数据库的有界动作理论，可以获得时序性质的可判定验证。<sup>[20](https://www.diag.uniroma1.it/~patrizi/docs/papers/DGLP_KR2012.pdf)</sup>

最接近的替代方案是[事件演算](https://www.edgepedia.org/zh/event-calculus)，它处理动作对局部事态的影响，而非全局情境之间的转移，主要设计用于推理实际事件（叙事），而情境演算主要设计用于假设性动作和情境。<sup>[24](http://www.doc.ic.ac.uk/~rak/papers/ilps94paper.pdf)</sup> 事件演算使用一种归约为单调谓词完备化的限定解决方案来处理框架问题，适用于具有间接效果、非确定性效果、并发动作和连续变化的领域。<sup>[25](https://dl.acm.org/doi/10.5555/1805750.1805767)</sup> 两者在形式上很接近：经过修改，事件演算在逻辑上蕴涵情境演算，而加上归纳的情境演算在逻辑上蕴涵事件演算。<sup>[24](http://www.doc.ic.ac.uk/~rak/papers/ilps94paper.pdf)</sup> STRIPS不允许表示非确定性、流变之间的静态因果关系、并发动作或认知动作；然而，赖特的后继状态公理解决方案已被转移到动态逻辑中而无需对动作进行量化，并与认知逻辑相结合。<sup>[7](https://ar5iv.labs.arxiv.org/html/2406.18930)</sup>

## References

1. [Situation Calculus (handbook chapter)](https://dai.fmph.uniba.sk/~sefranek/kri/handbook/chapter16.pdf)
2. [The Situation Calculus: A Case for Modal Logic (Lakemeyer et al.)](https://ai.stanford.edu/~epacuit/socsit/lakemeyer.pdf)
3. [Situation Calculus (lecture notes, University of Edinburgh)](https://opencourse.inf.ed.ac.uk/sites/default/files/https/opencourse.inf.ed.ac.uk/inf2d/2024/14situation-calculus_0.pdf)
4. [Foundations for the Situation Calculus (Levesque, Pirri, Reiter)](https://www.cs.toronto.edu/kr/publications/Levesque98.pdf)
5. [Introduction - Objectives of Situation Calculus (McCarthy narrative)](http://www-formal.stanford.edu/jmc/narrative/node1.html)
6. [Giuseppe De Giacomo and colleagues (2009). IndiGolog: A High-Level Programming Language for Embedded Reasoning Agents. .](https://doi.org/10.1007/978-0-387-89299-3_2)
7. [Reasoning about Action and Change (chapter of A Guided Tour of Artificial Intelligence Research, Springer, 2020)](https://ar5iv.labs.arxiv.org/html/2406.18930)
8. [The Nondeterministic Situation Calculus (KR 2021)](http://www.cs.yorku.ca/~lesperan/papers/KR21.pdf)
9. [Some contributions to the metatheory of the situation calculus (Pirri and Reiter)](https://dl.acm.org/doi/10.1145/316542.316545)
10. [GOLOG: A logic programming language for dynamic domains (The Journal of Logic Programming, 1997)](https://doi.org/10.1016/s0743-1066%2896%2900121-5)
11. [ConGolog, a concurrent programming language based on the situation calculus (Artificial Intelligence, 2000)](https://doi.org/10.1016/s0004-3702%2800%2900031-x)
12. [The Frame Problem (Stanford Encyclopedia of Philosophy)](https://plato.stanford.edu/entries/frame-problem/)
13. [A Classification of First-Order Progressable Action Theories in Situation Calculus (IJCAI 2013)](https://www.ijcai.org/Proceedings/13/Papers/171.pdf)
14. [Actions and Other Events in Situation Calculus (McCarthy)](https://www-formal.stanford.edu/jmc/sitcalc.pdf)
15. [Decidable Reasoning in a Modified Situation Calculus (IJCAI 2007)](https://www.ijcai.org/Proceedings/07/Papers/305.pdf)
16. [Raymond Reiter (2001). Knowledge in Action. The MIT Press eBooks.](https://doi.org/10.7551/mitpress/4074.001.0001)
17. [Decision-Theoretic, High-level Agent Programming in the Situation Calculus (Boutilier et al.)](http://robots.stanford.edu/papers/Boutilier00a.pdf)
18. [Reasoning about concurrent execution, prioritized interrupts, and exogenous actions in the situation calculus (IJCAI 1997)](https://www.ijcai.org/Proceedings/97-2/Papers/062.pdf)
19. [On knowledge-based programming with sensing in the situation calculus](https://dl.acm.org/doi/10.1145/383779.383780)
20. [Bounded Situation Calculus Action Theories and Decidable Verification (KR 2012)](https://www.diag.uniroma1.it/~patrizi/docs/papers/DGLP_KR2012.pdf)
21. [The Logic of Action (Stanford Encyclopedia of Philosophy)](https://plato.stanford.edu/entries/logic-action/)
22. [Jonas Kvarnström, Patrick Doherty (2000). TALplanner: A temporal logic based forward chaining planner. Annals of Mathematics and Artificial Intelligence.](https://doi.org/10.1023/a:1016619613658)
23. [ProRAC: A Neuro-symbolic Method for Reasoning about Actions with LLM-based Progression (arXiv, November 2025)](https://arxiv.org/html/2511.15069)
24. [Sit calc and event calc (Miller and Shanahan, ILPS 1994 paper)](http://www.doc.ic.ac.uk/~rak/papers/ilps94paper.pdf)
25. [The event calculus explained (Artificial intelligence today)](https://dl.acm.org/doi/10.5555/1805750.1805767)

---
*Initially written Sep 29, 2026 · Edited: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/situation-calculus

English original: https://www.edgepedia.org/situation-calculus
