Static Analysis for Safe Destructive Updates in a Functional Language

  • Authors:
  • Natarajan Shankar

  • Affiliations:
  • -

  • Venue:
  • LOPSTR '01 Selected papers from the 11th International Workshop on Logic Based Program Synthesis and Transformation
  • Year:
  • 2001

Quantified Score

Hi-index 0.01

Visualization

Abstract

Functional programs are more amenable to rigorous mathematical analysis than imperative programs, but are typically less efficient in terms of execution space and time. The update of aggregate data structures, such as arrays, are a significant source of space/time inefficiencies in functional programming. Imperative programs can execute such updates in place, whereas the semantics of functional languages require aggregate data structures to be copied and updated. In many functional programs, the execution of aggregate updates by copying is redundant and could be safely implemented by means of destructive, inplace updates. We describe a method for analyzing higher-order, eager functional programs for safe destructive updates. This method has been implemented for the PVS specification language for the purpose of animating or testing specifications to check if they accurately reflect their intended function. We also give a careful proof of correctness for the safety of the destructive update optimization.