Traced Types for Safe Strategic Rewriting

04/27/2023
by   Rongxiao Fu, et al.
0

Strategy languages enable programmers to compose rewrite rules into strategies and control their application. This is useful in programming languages, e.g., for describing program transformations compositionally, but also in automated theorem proving, where related ideas have been studies with tactics languages. Clearly, not all compositions of rewrites are correct, but how can we assist programmers in writing correct strategies? In this paper, we present a static type system for strategy languages. We combine a structural type system capturing how rewrite strategies transform the shape of the rewritten syntax with a novel tracing system that keeps track of all possible legal strategy execution paths. Our type system raises warnings when parts of a composition are guaranteed to fail at runtime, and errors when no legal execution for a strategy is possible. We present a formalization of our strategy language and novel tracing type system, and formally prove its type soundness. We present formal results, showing that ill-traced strategies are guaranteed to fail at runtime and that well-traced strategy executions "can't go wrong", meaning that they are guaranteed to have a possible successful execution path.

READ FULL TEXT
research
03/23/2021

Row-Polymorphic Types for Strategic Rewriting

We present a type system for strategy languages that express program tra...
research
06/15/2019

Approximate Normalization for Gradual Dependent Types

Dependent types help programmers write highly reliable code. However, th...
research
06/29/2018

Josephine: Using JavaScript to safely manage the lifetimes of Rust data

This paper is about the interface between languages which use a garbage ...
research
01/29/2020

A Type and Scope Safe Universe of Syntaxes with Binding: Their Semantics and Proofs

Almost every programming language's syntax includes a notion of binder a...
research
07/01/2019

The Semantics of Rank Polymorphism

Iverson's APL and its descendants (such as J, K and FISh) are examples o...
research
01/07/2020

Retentive Lenses

Based on Foster et al.'s lenses, various bidirectional programming langu...

Please sign up or login with your details

Forgot password? Click here to reset