# On Transforming Functions Accessing Global Variables into Logically   Constrained Term Rewriting Systems

**Authors:** Yoshiaki Kanazawa (Nagoya University), Naoki Nishida (Nagoya, University)

arXiv: 1902.08421 · 2019-02-25

## TL;DR

This paper introduces a novel method to transform imperative programs with global variables into logically constrained term rewriting systems, accurately modeling execution environments and function calls.

## Contribution

It presents a new transformation approach that encodes global variables and call stacks into term rewriting systems, with proven correctness.

## Key findings

- Accurate modeling of program execution environments.
- Transformation preserves program semantics.
- Formal proof of transformation correctness.

## Abstract

In this paper, we show a new approach to transformations of an imperative program with function calls and global variables into a logically constrained term rewriting system. The resulting system represents transitions of the whole execution environment with a call stack. More precisely, we prepare a function symbol for the whole environment, which stores values for global variables and a call stack as its arguments. For a function call, we prepare rewrite rules to push the frame to the stack and to pop it after the execution. Any running frame is located at the top of the stack, and statements accessing global variables are represented by rewrite rules for the environment symbol. We show a precise transformation based on the approach and prove its correctness.

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/1902.08421/full.md

## Figures

18 figures with captions in the complete paper: https://tomesphere.com/paper/1902.08421/full.md

## References

14 references — full list in the complete paper: https://tomesphere.com/paper/1902.08421/full.md

---
Source: https://tomesphere.com/paper/1902.08421