Bialgebraic Reasoning on Stateful Languages

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Goncharov, Sergey, Milius, Stefan, Schröder, Lutz, Tsampas, Stelios, Urbat, Henning
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866916854949216256
author Goncharov, Sergey
Milius, Stefan
Schröder, Lutz
Tsampas, Stelios
Urbat, Henning
author_facet Goncharov, Sergey
Milius, Stefan
Schröder, Lutz
Tsampas, Stelios
Urbat, Henning
contents Reasoning about program equivalence in imperative languages is notoriously challenging, as the presence of states (in the form of variable stores) fundamentally increases the observational power of program terms. The key desideratum for any notion of equivalence is compositionality, guaranteeing that subprograms can be safely replaced by equivalent subprograms regardless of the context. To facilitate compositionality proofs and avoid boilerplate work, one would hope to employ the abstract bialgebraic methods provided by Turi and Plotkin's powerful theory of mathematical operational semantics (a.k.a. abstract GSOS) or its recent extension by Goncharov et al. to higher-order languages. However, multiple attempts to apply abstract GSOS to stateful languages have thus failed. We propose a novel approach to the operational semantics of stateful languages based on the formal distinction between readers (terms that expect an initial input store before being executed), and writers (running terms that have already been provided with a store). In contrast to earlier work, this style of semantics is fully compatible with abstract GSOS, and we can thus leverage the existing theory to obtain coinductive reasoning techniques. We demonstrate that our approach generates non-trivial compositionality results for stateful languages with first-order and higher-order store and that it flexibly applies to program equivalences at different levels of granularity, such as trace, cost, and natural equivalence.
format Preprint
id arxiv_https___arxiv_org_abs_2503_10955
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Bialgebraic Reasoning on Stateful Languages
Goncharov, Sergey
Milius, Stefan
Schröder, Lutz
Tsampas, Stelios
Urbat, Henning
Programming Languages
Logic in Computer Science
Reasoning about program equivalence in imperative languages is notoriously challenging, as the presence of states (in the form of variable stores) fundamentally increases the observational power of program terms. The key desideratum for any notion of equivalence is compositionality, guaranteeing that subprograms can be safely replaced by equivalent subprograms regardless of the context. To facilitate compositionality proofs and avoid boilerplate work, one would hope to employ the abstract bialgebraic methods provided by Turi and Plotkin's powerful theory of mathematical operational semantics (a.k.a. abstract GSOS) or its recent extension by Goncharov et al. to higher-order languages. However, multiple attempts to apply abstract GSOS to stateful languages have thus failed. We propose a novel approach to the operational semantics of stateful languages based on the formal distinction between readers (terms that expect an initial input store before being executed), and writers (running terms that have already been provided with a store). In contrast to earlier work, this style of semantics is fully compatible with abstract GSOS, and we can thus leverage the existing theory to obtain coinductive reasoning techniques. We demonstrate that our approach generates non-trivial compositionality results for stateful languages with first-order and higher-order store and that it flexibly applies to program equivalences at different levels of granularity, such as trace, cost, and natural equivalence.
title Bialgebraic Reasoning on Stateful Languages
topic Programming Languages
Logic in Computer Science
url https://arxiv.org/abs/2503.10955