70,894 research outputs found

    Combining Static and Dynamic Contract Checking for Curry

    Full text link
    Static type systems are usually not sufficient to express all requirements on function calls. Hence, contracts with pre- and postconditions can be used to express more complex constraints on operations. Contracts can be checked at run time to ensure that operations are only invoked with reasonable arguments and return intended results. Although such dynamic contract checking provides more reliable program execution, it requires execution time and could lead to program crashes that might be detected with more advanced methods at compile time. To improve this situation for declarative languages, we present an approach to combine static and dynamic contract checking for the functional logic language Curry. Based on a formal model of contract checking for functional logic programming, we propose an automatic method to verify contracts at compile time. If a contract is successfully verified, dynamic checking of it can be omitted. This method decreases execution time without degrading reliable program execution. In the best case, when all contracts are statically verified, it provides trust in the software since crashes due to contract violations cannot occur during program execution.Comment: Pre-proceedings paper presented at the 27th International Symposium on Logic-Based Program Synthesis and Transformation (LOPSTR 2017), Namur, Belgium, 10-12 October 2017 (arXiv:1708.07854

    C++ Templates as Partial Evaluation

    Full text link
    This paper explores the relationship between C++ templates and partial evaluation. Templates were designed to support generic programming, but unintentionally provided the ability to perform compile-time computations and code generation. These features are completely accidental, and as a result their syntax is awkward. By recasting these features in terms of partial evaluation, a much simpler syntax can be achieved. C++ may be regarded as a two-level language in which types are first-class values. Template instantiation resembles an offline partial evaluator. This paper describes preliminary work toward a single mechanism based on Partial Evaluation which unifies generic programming, compile-time computation and code generation. The language Catat is introduced to illustrate these ideas.Comment: 13 page

    Supervising Offline Partial Evaluation of Logic Programs using Online Techniques

    No full text
    A major impediment for more widespread use of offline partial evaluation is the difficulty of obtaining and maintaining annotations for larger, realistic programs. Existing automatic binding-time analyses still only have limited applicability and annotations often have to be created or improved and maintained by hand, leading to errors. We present a technique to help overcome this problem by using online control techniques which supervise the specialisation process in order to help the development and maintenance of correct annotations by identifying errors. We discuss an implementation in the Logen system and show on a series of examples that this approach is effective: very few false alarms were raised while infinite loops were detected quickly. We also present the integration of this technique into a web interface, which highlights problematic annotations directly in the source code. A method to automatically fix incorrect annotations is presented, allowing the approach to be also used as a pragmatic binding time analysis. Finally we show how our method can be used for efficiently locating built-in errors in Prolog source code

    Type-Directed Weaving of Aspects for Polymorphically Typed Functional Languages

    Get PDF
    Incorporating aspect-oriented paradigm to a polymorphically typed functional language enables the declaration of type-scoped advice, in which the effect of an aspect can be harnessed by introducing possibly polymorphic type constraints to the aspect. The amalgamation of aspect orientation and functional programming enables quick behavioral adaption of functions, clear separation of concerns and expressive type-directed programming. However, proper static weaving of aspects in polymorphic languages with a type-erasure semantics remains a challenge. In this paper, we describe a type-directed static weaving strategy, as well as its implementation, that supports static type inference and static weaving of programs written in an aspect-oriented polymorphically typed functional language, AspectFun. We show examples of type-scoped advice, identify the challenges faced with compile-time weaving in the presence of type-scoped advice, and demonstrate how various advanced aspect features can be handled by our techniques. Lastly, we prove the correctness of the static weaving strategy with respect to the operational semantics of AspectFun

    A retarded coupling approach to intermolecular interactions

    Get PDF
    A wide range of physical phenomena such as optical binding and resonance energy transfer involve electronic coupling between adjacent molecules. A quantum electrodynamical description of these intermolecular interactions reveals the presence of retardation effects. The clarity of the procedure associated with the construction of the quantum amplitudes and the precision of the ensuing results for observable energies and rates are widely acknowledged. However, the length and complexity of the derivations involved in such quantum electrodynamical descriptions increase rapidly with the order of the process under study. Whether through the use of time-ordering approaches, or the more expedient state-sequence method, time-consuming calculations cannot usually be bypassed. A simple and succinct method is now presented, which provides for a direct and still entirely rigorous determination of the quantum electrodynamical amplitudes for processes of arbitrarily high order. Using the approach, new results for optical binding in two- and three-particle systems are secured and discussed

    Action semantics in retrospect

    Get PDF
    This paper is a themed account of the action semantics project, which Peter Mosses has led since the 1980s. It explains his motivations for developing action semantics, the inspirations behind its design, and the foundations of action semantics based on unified algebras. It goes on to outline some applications of action semantics to describe real programming languages, and some efforts to implement programming languages using action semantics directed compiler generation. It concludes by outlining more recent developments and reflecting on the success of the action semantics project

    Quasienergy spectrum and tunneling current in ac-driven triple quantum dot shuttles

    Full text link
    The dynamics of electrons in ac driven double quantum dots have been extensively analyzed by means of Floquet theory. In these systems, coherent destruction of tunneling has been shown to occur for certain ac field parameters. In the present work we analyze, by means of Floquet theory, the electron dynamics of a triple quantum dot in series attached to electric contacts, where the central dot position oscillates. In particular, we analyze the quasienergy spectrum of this ac driven nanoelectromechanical system, as a function of the intensity and frequency of the ac field and of external dc voltages. For strong driving fields, we derive, by means of perturbation theory, analytical expressions for the quasienergies of the driven oscillator system. From this analysis we discuss the conditions for coherent destruction of tunneling (CDT) to occur as a function of detuning and field parameters. For zero detuning, and from the invariance of the Floquet Hamiltonian under a generalized parity transformation, we find analytical expressions describing the symmetry properties of the Fourier components of the Floquet states under such transformation. By using these expressions, we show that in the vicinity of the CDT condition, the quasienergy spectrum exhibits exact crossings which can be characterized by the parity properties of the corresponding eigenvectors
    corecore