8 research outputs found
Bootstrapping Inductive and Coinductive Types in HasCASL
We discuss the treatment of initial datatypes and final process types in the
wide-spectrum language HasCASL. In particular, we present specifications that
illustrate how datatypes and process types arise as bootstrapped concepts using
HasCASL's type class mechanism, and we describe constructions of types of
finite and infinite trees that establish the conservativity of datatype and
process type declarations adhering to certain reasonable formats. The latter
amounts to modifying known constructions from HOL to avoid unique choice; in
categorical terminology, this means that we establish that quasitoposes with an
internal natural numbers object support initial algebras and final coalgebras
for a range of polynomial functors, thereby partially generalising
corresponding results from topos theory. Moreover, we present similar
constructions in categories of internal complete partial orders in
quasitoposes
Just do it: simple monadic equational reasoning
Abstract One of the appeals of pure functional programming is that it is so amenable to equational reasoning. One of the problems of pure functional programming is that it rules out computational effects. Moggi and Wadler showed how to get round this problem by using monads to encapsulate the effects, leading in essence to a phase distinction-a pure functional evaluation yielding an impure imperative computation. Still, it has not been clear how to reconcile that phase distinction with the continuing appeal of functional programming; does the impure imperative part become inaccessible to equational reasoning? We think not; and to back that up, we present a simple axiomatic approach to reasoning about programs with computational effects
Optimisation Validation
AbstractWe introduce the idea of optimisation validation, which is to formally establish that an instance of an optimising transformation indeed improves with respect to some resource measure. This is related to, but in contrast with, translation validation, which aims to establish that a particular instance of a transformation undertaken by an optimising compiler is semantics preserving. Our main setting is a program logic for a subset of Java bytecode, which is sound and complete for a resource-annotated operational semantics. The latter employs resource algebras for measuring dynamic costs such as time, space and more elaborate examples. We describe examples of optimisation validation that we have formally verified in Isabelle/HOL using the logic. We also introduce a type and effect system for measuring static costs such as code size, which is proved consistent with the operational semantics
Monad-independent dynamic logic in HasCasl
Monads have been recognized by Moggi as an elegant device for dealing with stateful computation in functional programming languages. In previous work, we have introduced a Hoare calculus for partial correctness of monadic programs. All this has been done in an entirely monad-independent way. Here, we extend this to a monad-independent dynamic logic (assuming a moderate amount of additional infrastructure for the monad). Dynamic logic is more expressive than the Hoare calculus; in particular, it allows reasoning about termination and total correctness. As the background formalism for these concepts, we use the logic of HasCasl, a higher-order language for functional speci cation and programming. As an example application, we develop a monad-independent Hoare calulus for total correctness based on our dynamic logic, and illustrate this calculus by a termination proof for Dijkstra's non-deterministic implementation of Euclid's algorithm