Type as Obligations
Migratory Typing · Interoperability · Type Obligations · Blame Theorems · Bisimulation · Vigilance · Formal Verification
Formalized Rocq proofs complete; manuscript in preparation.
When typed and untyped modules interact, runtime enforcements must determine which type requirements to preserve and which boundaries to blame when those requirements fail. Different strategies use contracts, merge casts, or insert shallow checks, making their guarantees difficult to compare. Type soundness alone does not capture whether a value respects its typing history, i.e., every type requirement it encounters during execution.
Type as Obligations (TAO) makes these requirements explicit. Given an ordinary semantics, TAO will mechanically construct a corresponding profiler semantics. In addition to ordinary computation steps, the profiler semantics records each value’s typing history as type obligations, including their boundary origins, and propagates them through function calls and pair projections. This separates the requirements imposed by types from the runtime strategies to enforce them, giving different semantics a common basis for analysis.
My contributions connect this runtime profiling to formal guarantees:
- Mechanical profiler semantics with evaluation correspondence. For any ordinary semantics, TAO mechanically constructs the corresponding profiler semantics by intercepting reduction steps, inserting profiling commands at appropriate points, and delegating the computational reductions back to the ordinary semantics. I prove a bidirectional correspondence between the ordinary and profiler evaluations.
- A stronger enforcement criterion. I define obligation soundness and prove that it implies type soundness, but not conversely: returning a correctly typed result does not ensure that every accumulated obligation was respected.
- Obligation-based blame criteria. The framework defines blame soundness and completeness using violated obligations and their boundary provenance as the reference for blame assignment.
I have applied these definitions to modeled versions of Natural, Threesomes, Forgetful, and Transient, proving positive results and exhibiting counterexamples. The framework, metatheory, and counterexamples are formalized in Rocq/Coq, with an executable Racket/Redex model. This comparison makes differences in enforcement and blame explicit and their causes inspectable through execution.