---
title: Propositional Program Equivalence
url: https://www.emergentmind.com/topics/propositional-program-equivalence
type: topic
---

# Propositional Program Equivalence

Propositional program equivalence is a family of interchangeability relations for programs analyzed at propositional granularity. Its exact meaning depends on the semantic framework. In propositional Krom logic programs, equivalence may be defined by equality of least models, by subsumption, or by invariance under addition of facts; in answer set programming, the central notions are ordinary, strong, and uniform equivalence; in Kleene Algebra with Tests, equivalence means equality under all interpretations of primitive tests and actions; and in propositional dynamic logic, program equivalence can itself be a proposition stating equality of successor relations at a state [2302.04664] [0712.0948] [2507.07480] [1103.1433].

## 1. Semantic scope and basic notions

The literature does not use a single universal definition of propositional program equivalence. Rather, each framework fixes a semantics and then asks when one program can replace another without changing the relevant observable behavior. In answer set programming this behavior is usually the set of answer sets, possibly under arbitrary context extension; in positive Krom programs it is the least model or its closure under added facts; in KAT and GKAT it is control-flow behavior under all interpretations of primitive operations; and in PDL it is equality of reachable states from the current world [0712.0948] [2507.07480].

| Notion | Criterion | Setting |
|---|---|---|
| Least-model equivalence | \(K \equiv_{lm} L \iff LM(K)=LM(L)\) | Propositional Krom logic programs |
| Subsumption equivalence | \(I \models K \Leftrightarrow I \models L\) for all \(I\) | Propositional Krom logic programs |
| Uniform equivalence | \(K \cup I \equiv_{lm} L \cup I\) for every \(I\subseteq A\) | Propositional Krom logic programs |
| Ordinary equivalence | \(P \equiv Q \iff AS(P)=AS(Q)\) | Propositional ASP |
| Strong equivalence | \(P \equiv_s Q\) iff \(AS(P\cup R)=AS(Q\cup R)\) for every program \(R\) | Propositional ASP |
| Uniform equivalence | \(P \equiv_u Q\) iff \(AS(P\cup F)=AS(Q\cup F)\) for every set of facts \(F\) | Propositional ASP |
| Propositional equivalence | \(e \equiv f \iff \forall I.\; e_I=f_I\) | KAT / GKAT |
| Program equivalence formula | \((W,R,V),w\models \pi\equiv\rho \iff \forall u\,[(w,u)\in R_\pi \Leftrightarrow (w,u)\in R_\rho]\) | PDL with equivalence operator |

A recurring distinction is between ordinary equivalence and substitutivity-based equivalence. Woltran emphasizes that ordinary equivalence requires only the same answer sets, whereas strong equivalence requires faithful replacement within any context program; uniform equivalence lies between these extremes by restricting contexts to facts [0712.0948]. In KAT, by contrast, the intended abstraction ignores the internal meaning of primitive statements and tracks only how tests govern control flow and how actions interleave [2507.07480].

## 2. Algebraic characterizations for propositional Krom logic programs

A propositional Krom logic program \(K\) over a finite nonempty alphabet \(A\) is a finite set of facts \(a\) and proper rules \(a \leftarrow b\), with \(a,b\in A\). Writing \(f(K)\) for the set of facts and \(p(K)\) for the set of proper rules, interpretations are subsets \(I\subseteq A\), and \(K\) has a unique \(\subseteq\)-least model \(LM(K)\). Least-model equivalence is then \(K \equiv_{lm} L\) iff \(LM(K)=LM(L)\); subsumption equivalence is \(K \equiv_s L\) iff \(I\models K \Leftrightarrow I\models L\) for all \(I\); and uniform equivalence is \(K \equiv_u L\) iff \(K\cup I \equiv_{lm} L\cup I\) for every context \(I\subseteq A\) [2302.04664].

The central algebraic device is the sequential composition \(K\cdot L\), introduced for this setting via Antić’s program algebra. The note defines
\[
K \cdot L := f(K)\;\cup\;\{a \mid a\leftarrow b\in p(K)\ \text{and}\ b\in f(L)\}
\;\cup\;\{a\leftarrow c \mid a\leftarrow b\in p(K)\ \text{and}\ b\in p(L),\ c\in f(L)\},
\]
together with the iterates
\[
K^0:=\emptyset,\qquad K^{n+1}:=K\cdot K^n,\qquad
K^*:=\bigcup_{n\ge 0}K^n,\qquad K^+:=\bigcup_{n\ge 1}K^n,\qquad
K^\omega:=f(K^+).
\]
In the Krom case, this operation satisfies the laws \(f(K)=K\cdot\emptyset\), \(I\cdot K=I\), \((K\cdot U\cdot L)\cdot M=K\cdot U\cdot(L\cdot M)\), and \(M\cdot(K\cdot U\cdot L)=(M\cdot K)\cdot U\cdot(M\cdot L)\) [2302.04664].

The decisive theorem is the algebraic identification of least models:
\[
LM(K)=K^\omega.
\]
Equivalently,
\[
K \equiv_{lm} L
\iff
f(K)\cup \bigcup_{i\ge 1} p(K)^i f(K)
=
f(L)\cup \bigcup_{i\ge 1} p(L)^i f(L).
\]
A second collapse is even sharper: subsumption equivalence in the Krom setting coincides with literal program equality, because \(K\equiv_s L\) implies \(f(K)=f(L)\) and \(p(K)=p(L)\), hence \(K=L\). Uniform equivalence also admits a closed form. For every interpretation \(I\),
\[
(K\cup I)^\omega = K^\omega \cup p(K)^* I,
\]
and therefore
\[
K\equiv_u L
\iff
\forall I\subseteq A,\;
K^\omega \cup p(K)^*I = L^\omega \cup p(L)^*I.
\]
The note illustrates the criterion with \(K=\{a\leftarrow b,\ b\leftarrow a\}\) and \(L=\emptyset\): both are uniformly equivalent because neither program can bootstrap the \(a,b\) cycle without facts, and for every added fact context the closures coincide [2302.04664].

The same source also states the principal limitation of the algebraic method. For arbitrary positive propositional programs, sequential composition loses associativity and ceases to distribute over union, so the simple iterative description of \(LM\) breaks down. This is why the Krom fragment is unusually well behaved: its clean theory depends on the binary rule shape \(a\leftarrow b\), the absence of disjunction and negation as failure, and the associativity of composition.

## 3. Strong equivalence via here-and-there and equilibrium logic

In answer set programming, strong equivalence is the canonical substitutivity notion. For propositional programs \(P\) and \(Q\),
\[
P\equiv_s Q
\iff
\forall R,\; AS(P\cup R)=AS(Q\cup R).
\]
The key characterization is logical: strong equivalence coincides with equivalence in the logic of here-and-there (HT). Harrison, Lifschitz, and Truszczyński extend this principle from finite formulas to infinitary formulas. Their HT-style system starts from an infinitary basic system and adds, among other axioms, the here-and-there schema
\[
F \vee (F\to G) \vee \neg G.
\]
Their main theorem states that if \(F\) is a theorem of the HT-style system, then \(\mathcal H\) and \(\mathcal H\cup\{F\}\) have the same stable models, and if \(F\) and \(G\) are equivalent in that system, then \(\mathcal H\cup\{F\}\) and \(\mathcal H\cup\{G\}\) have the same stable models [1403.6689].

This result yields a proof method for strong equivalence. In the finite case, it reduces to checking provability in finite HT, which is decidable and in PSPACE. The practical method given in the paper is: ground the rules or small programs, translate each rule to a propositional formula, and use an HT-oriented prover or a reduction to SAT to check \(F\leftrightarrow G\) [1403.6689].

Equilibrium Logic supplies the model-theoretic counterpart. For an HT-interpretation \(M=(H,T)\) with \(H\subseteq T\), strong equivalence of theories is equivalent to equality of HT-models. On that basis, Cabalar and Ferraris show that every finite propositional theory \(\Phi\) can be transformed into a disjunctive logic program \(\Pi(\Phi)\), possibly with default negation in heads, such that \(\Phi\) and \(\Pi(\Phi)\) are strongly equivalent. They present both a syntactic transformation and a semantic construction from HT-countermodels. A corollary reported in the same account is that strong equivalence for arbitrary propositional theories is coNP-complete [0701095].

A persistent source of confusion is the relation between strong and uniform equivalence. The answer-set literature treats them as distinct notions: strong equivalence quantifies over arbitrary context programs, whereas uniform equivalence restricts contexts to facts. The Krom note explicitly states that uniform equivalence is weaker than strong equivalence, and the ASP survey places it strictly between strong and ordinary equivalence [2302.04664] [0712.0948].

## 4. Relativized, arithmetic, aggregate, and ordered-disjunctive extensions

Woltran’s two-parameter framework unifies many ASP equivalence notions by restricting separately the atoms allowed in context-rule heads and bodies. For alphabets \(A^H,A^B\subseteq \mathcal A\), let \(C_{A^H,A^B}\) be the class of programs whose head atoms lie in \(A^H\) and whose positive and negative body atoms lie in \(A^B\). Then
\[
P\equiv_{A^H,A^B}Q
\iff
\forall R\in C_{A^H,A^B},\; AS(P\cup R)=AS(Q\cup R).
\]
This subsumes strong, uniform, ordinary, and relativized equivalence as special cases. The corresponding model theory uses generalized \((A^H,A^B)\)-SE-models, and the main theorem states
\[
P\equiv_{A^H,A^B}Q
\iff
\sigma_{A^H,A^B}(P)=\sigma_{A^H,A^B}(Q).
\]
For disjunctive programs, deciding \(P\equiv_{A^H,A^B}Q\) is \(\Pi_2^P\)-complete; for normal programs it is coNP-complete [0712.0948].

The HT method extends beyond propositional ASP. Lifschitz’s HTA framework translates finite sets of regular rules with integer arithmetic into two-sorted first-order formulas. If \(F_R=\bigwedge_{r\in R}\phi(r)\) and \(F_S=\bigwedge_{s\in S}\phi(s)\), then
\[
HTA \vdash (F_R \leftrightarrow F_S)
\;\Longrightarrow\;
R \text{ and } S \text{ are strongly equivalent.}
\]
The proof route uses validity of HTA in two-world HT-models, grounding to infinitary propositional HT, and the characterization of strong equivalence by equality of HT-models. The same account states that strong-equivalence checking for propositional ASP is coNP-complete in general, while with arithmetic the problem may be harder, though in many cases it collapses to a combination of coNP checks for Boolean structure and PTIME checks for arithmetic theory [2108.03187].

A parallel extension handles restricted uses of the \(\#count\) aggregate. For MGC programs, Lifschitz gives a finite first-order translation \(\tau^*(\Pi)\), an infinitary grounding \(gr(\tau^*(\Pi))\), and the results:
\[
\Pi_1 \text{ and } \Pi_2 \text{ are strongly equivalent}
\iff
gr(\tau^*(\Pi_1)) \text{ and } gr(\tau^*(\Pi_2)) \text{ are equivalent in } HT,
\]
and if \(\tau^*(\Pi_1)\) and \(\tau^*(\Pi_2)\) are equivalent in \(HTA\) plus the aggregate-defining axioms \(\mathrm{Defs}\), then \(\Pi_1\) and \(\Pi_2\) are strongly equivalent. The exposition further states that the restricted MGC use of \(\#count\) does not raise the worst-case complexity beyond the familiar coNP bound for strong equivalence of ordinary propositional logic programs [2205.07783].

Ordered disjunction requires a different logic. For LPODs, Charalambidis and coauthors work in the four-valued lattice \(V=\{F,F^*,T^*,T\}\) and treat an LPOD rule as a formula \(B\to H\), where the head uses the ordered-disjunction connective \(\times\). Their main theorem identifies two notions of strong equivalence and shows that both coincide with equality of four-valued model sets:
\[
P_1\equiv_s P_2
\iff
\{I\mid I\models P_1\}=\{I\mid I\models P_2\}.
\]
The decision problem is coNP-complete [2205.04882].

## 5. Propositional equivalence in KAT and GKAT

A distinct line of work studies propositional program equivalence as control-flow equivalence abstracted from the meaning of primitive operations. Fix primitive tests \(T\) and primitive actions \(\Sigma\). KAT forms Boolean tests
\[
b,c ::= 0 \mid 1 \mid t \mid b+c \mid bc \mid \overline b
\]
and program expressions
\[
e,f ::= b \mid p \mid e+f \mid ef \mid e^*.
\]
Under relational semantics, an interpretation assigns relations to actions and predicates to tests, and equivalence is
\[
e\equiv f \iff \forall I.\; e_I=f_I.
\]
The same source emphasizes that this captures propositional equivalence because it quantifies over all meanings of primitives [2507.07480].

KAT also has a language semantics by guarded strings, and the defining theorem is
\[
e\equiv f \Longleftrightarrow \llbracket e\rrbracket = \llbracket f\rrbracket.
\]
This permits automata-theoretic decision procedures. Conditionals and loops are encoded algebraically as
\[
\text{if } b \text{ then } e \text{ else } f \equiv be+\overline b f,
\qquad
\text{while } b \text{ do } e \equiv (be)^*\overline b.
\]
The resulting equivalence problem is PSPACE-complete in expression size, while optimized symbolic algorithms can often handle large checks in practice [2507.07480].

GKAT isolates the deterministic fragment by taking conditionals and while-loops as primitives:
\[
e,f ::= b \mid p \mid e +_b f \mid ef \mid e^{(b)}.
\]
Its embedding into KAT is
\[
(e+_b f):=be+\overline b f,
\qquad
e^{(b)} := (be)^*\overline b.
\]
When primitive actions are functional, GKAT equivalence again coincides with equality under all interpretations and with equality of guarded-string languages. The automata are fully deterministic, can be built in \(O(n)\) states and transitions, and language equivalence is decidable by union-find based bisimulation search in nearly linear time \(O(n\,\alpha(n))\). The extended abstract states the metatheoretical contrast succinctly: KAT is PSPACE-complete, whereas GKAT is decidable in almost linear time [2507.07480].

This line of work also records open problems. A fully finitary axiomatization of full GKAT remains open, because completeness currently uses an infinitary fixed-point rule, and there is an open structural question about which deterministic guarded-string automata are expressible in GKAT.

## 6. Undecidability frontiers and expressive limits

At the opposite end of the spectrum from KAT and GKAT lies the dynamic-logic treatment of program equivalence. Goldblatt and Jackson extend PDL with a binary propositional form \(\alpha\equiv\beta\) interpreted by equality of successor sets from the current state:
\[
(W,R,V),w\models \pi\equiv\rho
\iff
\forall u\in W:\; (w,u)\in R_\pi \Leftrightarrow (w,u)\in R_\rho.
\]
They also define
\[
\mathit{Fix}(\pi)=\{\,w\mid \forall u\,[(w,u)\in R_\pi \Rightarrow u=w]\,\},
\]
and show that two well-structured programs \(\alpha,\beta\) are equivalent on all halting computations precisely when
\[
\mathit{Fix}(\alpha\cup\beta)\;\wedge\;([\alpha]\top \leftrightarrow [\beta]\top)
\]
holds. In deterministic PDL with intersection and \(\mathbf{skip}\), program equivalence can be expressed by
\[
\pi\equiv\rho
=
(\pi\cap\rho)\top \;\wedge\; ([\pi]\top \leftrightarrow [\rho]\top).
\]
The main negative result is that any PDL variant able to express \(\mathit{fix}\) or, equivalently, \(\equiv\), has a \(\Pi_1^1\)-hard validity problem; moreover, the set of formulas valid over finite models is not recursively enumerable [1103.1433].

These results sharply delimit the tractable fragments discussed earlier. The Krom fragment owes its algebraic transparency to severe syntactic restrictions; HT-based strong-equivalence checking remains manageable for many propositional and restricted first-order ASP settings; KAT and especially GKAT achieve efficient equivalence checking by abstracting away the semantics of primitive statements; but once program equivalence becomes an operator inside a sufficiently expressive modal logic, the associated validity problem becomes highly undecidable [2302.04664] [2507.07480] [1103.1433].

Taken together, these strands show that propositional program equivalence is not one problem but a spectrum of problems organized by semantic strength and expressiveness. Least-model, uniform, and strong equivalence isolate different substitutivity regimes; HT and related logics provide exact logical criteria for many ASP languages; algebraic methods yield closed forms in Krom logic and efficient decision procedures in GKAT; and expressive dynamic-logic operators reveal how quickly equivalence can cross from decidable verification into the first level of the analytical hierarchy.

Source: https://www.emergentmind.com/topics/propositional-program-equivalence