Set based failure diagnosis for concurrent constraint programming

Concurrent constraint (CC) programming is a simple and powerful high-level model for concurrent programming. The expressiveness of the CC model has been considerably extended by the Oz Programming Model (OPM) which is realised in the programming language Oz. Oz subsumes well-established programming paradigms such as higher-order functional and object-oriented programming, and it supports problem solving facilities beyond those known from constraint logic programming. Oz is a dynamically typed language like Prolog, Scheme, or Smalltalk. This means that Oz is a type safe language that guarantees type-correctness of primitive operations, but that it lacks static (compile-time) type checking. This is advantageous for simplicity and flexibility of the language but it complicates the debugging of programs. In this thesis we investigate two approaches of making static type checking available for Oz: Set-based failure diagnosis and strong typing. Set-based failure diagnosis is a method for program analysis with the goal to detect programming errors at compile-time. The method is called set-based because it employs set constraints, a class of predicate logic formulas interpreted over sets of trees. The design of a set-based program analysis involves the following steps. First, one defines a class of set constraints that is appropriate for the given language and the analysis problem. Second, one defines a mapping from programs to set constraints and proves that this mapping preserves certain run-time properties of the programs. Third, one provides algorithms to solve the constraints. We define a new system of set constraints over feature trees. This constraint system is motivated by the analysis of records, since Oz incorporates records as a central data structure through equality constraints over feature trees. We study the satisfiability, emptiness, and entailment problems for set constraints over feature trees and provide a number of algorithms and complexity results. Set constraints over feature trees are also interesting independent from their application in program analysis, and in comparison with other systems of set constraints. We present a diagnosis for constraint logic programming and concurrent constraint programming as first-order fragments of Oz. We prove our diagnosis correct by showing that it rejects only programs that contain an inevitable run-time error. For a larger sublanguage of Oz including higher-order procedures we present a diagnosis and illustrate it with examples. The interesting problem of proving correctness for this analysis is left open. In presence of higher-order procedures, the correctness problem becomes fundamentally harder, and the proof techniques used for the first-order case fail. Complementary to the set-based failure diagnosis, we consider the design of strong static type systems for sublanguages of Oz. We define Plain, and we show that an expressive strong type system is possible for a language that combines key features of Oz, namely higher-order procedures, logic variables and partially determined data structures, cells, and records, and we highlight the restrictions of Plain with respect to Oz. Plain’s type system supports record types, subtyping, higher-order polymorphic types, modes, and mode polymorphism. We prove its soundness through a type preservation theorem.