Cohesion, coupling and the meta-theory of actions

Andreas Herzig, Ivan VarzinczakIJCAI 2005

Abstract

This paper explores an intriguing cross-pollination of ideas: taking the foundational principles of software engineering and applying them to the formal logic used in Artificial Intelligence. By adapting the concepts of cohesion and coupling to evaluate "domain descriptions" in reasoning about actions, the authors provide a rigorous framework for detecting design flaws in AI models, ensuring they are modular, maintainable, and computationally efficient.

Introduction

In the field of Knowledge Representation (KR), researchers construct "domain descriptions"—sets of logical axioms that describe how an environment works and how actions (like "moving a block" or "shooting a gun") change that environment. As these descriptions grow in complexity, they often suffer from issues analogous to "spaghetti code": they become difficult to debug, hard to extend (lacking "elaboration tolerance"), and prone to unintended side effects.

Historically, there have been few formal criteria to distinguish a well-designed set of axioms from a poorly designed one. This research addresses this gap by treating knowledge engineering as a form of software engineering, recasting classic software metrics into the language of formal logic.

Modular Design Principles

The authors propose that a domain description should be structured into distinct "natural modules" to improve clarity and maintainability. This decomposition allows for the application of software engineering principles to logical axioms.

The decomposition of a domain description into specialized modules.

As illustrated in the figure above, a domain description is divided into several categories of laws:

  • Effect Laws: Define what happens when an action is performed.
  • Inexecutability Laws: Specify conditions under which an action cannot be performed.
  • Executability Laws: Specify conditions under which an action is guaranteed to work.
  • State Constraints: Define general truths about the world that are always true (e.g., "if a turkey is walking, it must be alive").
  • Non-effects: Describe what remains unchanged after an action (often related to the frame problem).

Cohesion and Coupling

To evaluate these modules, the authors define two primary metrics:

  1. Maximal Cohesion (P1’): A module is cohesive if it serves a single purpose. In logical terms, an "Effect Laws" module is highly cohesive if it only entails effect laws. If it inadvertently implies when an action is impossible, its cohesion is considered low.
  2. Minimal Coupling (P2’): Modules should remain as independent as possible. The authors identify "implicit laws"—laws that emerge only when two modules are combined—as a sign of undesirable high coupling.

The authors utilize the Situation Calculus and a modal logic framework ($\mathcal{LAP}_{\leadsto}$) to prove that these principles provide measurable mathematical benefits rather than just heuristic advice.

Key Insights and Logical "Code Smells"

The paper identifies "implicit inexecutability laws" and "implicit state constraints" as the logical equivalents of software bugs. For example, if axioms for "teasing a turkey" and "shooting a turkey" accidentally imply that the turkey is immortal, a coupling error has occurred.

A well-designed, modular domain description is "elaboration tolerant." This means adding a new action or effect requires effort proportional only to the complexity of that new information, rather than requiring a total system rewrite. Furthermore, the authors demonstrate that following these design principles allows for local reasoning; one does not need to load the entire world model to determine the result of a single action, only the relevant action module and state constraints.

Key Results

The theoretical framework yields several significant theorems:

  • Theorem 5.1: Proves that if a domain description lacks "implicit state constraints," checking the consistency of the entire system reduces to checking the consistency of the state constraints alone.
  • Theorem 6.2: Demonstrates that under minimal coupling, modularity is preserved during reasoning. When deducing the effects of action $a$, the laws governing all other actions ($b, c, d...$) can be safely ignored.
  • Formal Validation: The authors successfully translated informal software engineering "best practices" into formal logical theorems that can be used to automatically verify the quality of an AI's knowledge base.

Limitations and Future Work

While the framework is robust, the authors acknowledge challenges in worlds with complex indirect effects (the ramification problem), where total decoupling is difficult to achieve. Additionally, while the paper provides methods to detect poor design via consistency tests, it does not yet offer automated methods to refactor axioms once a flaw is identified. Future research may also focus on the computational overhead required to run these consistency checks on very large-scale domains.

Summary updated

BibTeX
@inproceedings{herzig2005cohesion,
  author = {Andreas Herzig and Ivan Varzinczak},
  title = {{Cohesion, coupling and the meta-theory of actions}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2005},
}
Figure