845 research outputs found

    Semantics of Exceptions

    Get PDF
    We describe a trace semantics of exceptions and then derive a weakest precondition semantics. A program that contains exceptions terminates in one of two possible ways (if it terminates at all): either it terminates exceptionally or it terminates normally. We will therefore consider weakest preconditions that are functions of two postconditions. As a preparation we study aribitrary functions of two arguments, and their compositions

    Weighted programming: A programming paradigm for specifying mathematical models

    Get PDF
    We study weighted programming, a programming paradigm for specifying mathematical models. More specifically, the weighted programs we investigate are like usual imperative programs with two additional features: (1) nondeterministic branching and (2) weighting execution traces. Weights can be numbers but also other objects like words from an alphabet, polynomials, formal power series, or cardinal numbers. We argue that weighted programming as a paradigm can be used to specify mathematical models beyond probability distributions (as is done in probabilistic programming). We develop weakest-precondition- and weakest-liberal-precondition-style calculi Ă  la Dijkstra for reasoning about mathematical models specified by weighted programs. We present several case studies. For instance, we use weighted programming to model the ski rental problem - an optimization problem. We model not only the optimization problem itself, but also the best deterministic online algorithm for solving this problem as weighted programs. By means of weakest-precondition-style reasoning, we can determine the competitive ratio of the online algorithm on source code level

    Predicate transformer semantics of quantum programs

    Full text link
    © Cambridge University Press 2010. This chapter presents a systematic exposition of predicate transformer semantics for quantum programs. It is divided into two parts: The first part reviews the state transformer (forward) semantics of quantum programs according to Selinger’s suggestion of representing quantum programs by superoperators and elucidates D’Hondt-Panangaden’s theory of quantum weakest preconditions in detail. In the second part, we develop a quite complete predicate transformer semantics of quantum programs based on Birkhoff–von Neumann quantum logic by considering only quantum predicates expressed by projection operators. In particular, the universal conjunctivity and termination law of quantum programs are proved, and Hoare’s induction rule is established in the quantum setting

    Weakest Preconditions for Progress

    Get PDF
    Predicate transformers that map the postcondition and all intermediate conditions of a command to a precondition are introduced. They can be used to specify certain progress properties of sequential programs

    Fifty years of Hoare's Logic

    Get PDF
    We present a history of Hoare's logic.Comment: 79 pages. To appear in Formal Aspects of Computin
    • …
    corecore