This paper presents a semantics of self-adjusting computation and proves that the semantics are correct and consistent. The semantics integrate change propagation with the classic idea of memoization to enable reuse of computations under mutation to memory. During evaluation, reuse of a computation via memoization triggers a change propagation that adjusts the reused computation to reflect the mutated memory. Since the semantics integrate memoization and change-propagation, it involves both non-determinism (due to memoization) and mutation (due to change propagation). Our consistency theorem states that the non-determinism is not harmful: any two evaluations of the same program starting at the same state yield the same result. Our correctness theorem states that mutation is not harmful: self-adjusting programs are consistent with purely functional programming. We formalize the semantics and their meta-theory in the LF logical framework and machine check our proofs using Twelf.
IntroductionMany applications operate on data that changes over time. Self-adjusting computation is a technique that enables program to respond to changes to their data (e.g., inputs/arguments, external state, or outcome of tests). Advances on self-adjusting computation show that it can speed up response times by orders of magnitude over recomputing from scratch, closely matching best-known (problem-specific) algorithms both in theory and in practice (e.g., [3]). More recent results show that the approach can even enable solving challenging open problems that have resisted traditional algorithmic approaches (e.g. [7,6]).Key to effectiveness of self-adjusting computation is a technique that integrates change propagation [4], and the classic idea of memoization [17]. Due to an interesting duality between memoization and change propagation, combining them turns out to be crucial for efficiency. This technique was first developed in two previously published conference papers. One paper focused on algorithmic, implementation, and experimental aspects (journal version [3]). The other formal *