5,747 research outputs found

    Subclassing errors, OOP, and practically checkable rules to prevent them

    Get PDF
    This paper considers an example of Object-Oriented Programming (OOP) leading to subtle errors that break separation of interface and implementations. A comprehensive principle that guards against such errors is undecidable. The paper introduces a set of mechanically verifiable rules that prevent these insidious problems. Although the rules seem restrictive, they are powerful and expressive, as we show on several familiar examples. The rules contradict both the spirit and the letter of the OOP. The present examples as well as available theoretical and experimental results pose a question if OOP is conducive to software development at all.Comment: 10 pages, 1 LaTeX file; accompanying C++ and Haskell code and compilation instruction

    A principled approach to programming with nested types in Haskell

    Get PDF
    Initial algebra semantics is one of the cornerstones of the theory of modern functional programming languages. For each inductive data type, it provides a Church encoding for that type, a build combinator which constructs data of that type, a fold combinator which encapsulates structured recursion over data of that type, and a fold/build rule which optimises modular programs by eliminating from them data constructed using the buildcombinator, and immediately consumed using the foldcombinator, for that type. It has long been thought that initial algebra semantics is not expressive enough to provide a similar foundation for programming with nested types in Haskell. Specifically, the standard folds derived from initial algebra semantics have been considered too weak to capture commonly occurring patterns of recursion over data of nested types in Haskell, and no build combinators or fold/build rules have until now been defined for nested types. This paper shows that standard folds are, in fact, sufficiently expressive for programming with nested types in Haskell. It also defines buildcombinators and fold/build fusion rules for nested types. It thus shows how initial algebra semantics provides a principled, expressive, and elegant foundation for programming with nested types in Haskell

    On Quasi-Interpretations, Blind Abstractions and Implicit Complexity

    Full text link
    Quasi-interpretations are a technique to guarantee complexity bounds on first-order functional programs: with termination orderings they give in particular a sufficient condition for a program to be executable in polynomial time, called here the P-criterion. We study properties of the programs satisfying the P-criterion, in order to better understand its intensional expressive power. Given a program on binary lists, its blind abstraction is the nondeterministic program obtained by replacing lists by their lengths (natural numbers). A program is blindly polynomial if its blind abstraction terminates in polynomial time. We show that all programs satisfying a variant of the P-criterion are in fact blindly polynomial. Then we give two extensions of the P-criterion: one by relaxing the termination ordering condition, and the other one (the bounded value property) giving a necessary and sufficient condition for a program to be polynomial time executable, with memoisation.Comment: 18 page

    Complexity Hierarchies and Higher-order Cons-free Term Rewriting

    Get PDF
    Constructor rewriting systems are said to be cons-free if, roughly, constructor terms in the right-hand sides of rules are subterms of the left-hand sides; the computational intuition is that rules cannot build new data structures. In programming language research, cons-free languages have been used to characterize hierarchies of computational complexity classes; in term rewriting, cons-free first-order TRSs have been used to characterize the class PTIME. We investigate cons-free higher-order term rewriting systems, the complexity classes they characterize, and how these depend on the type order of the systems. We prove that, for every K \geq 1, left-linear cons-free systems with type order K characterize EK^KTIME if unrestricted evaluation is used (i.e., the system does not have a fixed reduction strategy). The main difference with prior work in implicit complexity is that (i) our results hold for non-orthogonal term rewriting systems with no assumptions on reduction strategy, (ii) we consequently obtain much larger classes for each type order (EK^KTIME versus EXPK1^{K-1}TIME), and (iii) results for cons-free term rewriting systems have previously only been obtained for K = 1, and with additional syntactic restrictions besides cons-freeness and left-linearity. Our results are among the first implicit characterizations of the hierarchy E = E1^1TIME \subsetneq E2^2TIME \subsetneq ... Our work confirms prior results that having full non-determinism (via overlapping rules) does not directly allow for characterization of non-deterministic complexity classes like NE. We also show that non-determinism makes the classes characterized highly sensitive to minor syntactic changes like admitting product types or non-left-linear rules.Comment: extended version of a paper submitted to FSCD 2016. arXiv admin note: substantial text overlap with arXiv:1604.0893

    On Bisimulations for Description Logics

    Full text link
    We study bisimulations for useful description logics. The simplest among the considered logics is ALCreg\mathcal{ALC}_{reg} (a variant of PDL). The others extend that logic with inverse roles, nominals, quantified number restrictions, the universal role, and/or the concept constructor for expressing the local reflexivity of a role. They also allow role axioms. We give results about invariance of concepts, TBoxes and ABoxes, preservation of RBoxes and knowledge bases, and the Hennessy-Milner property w.r.t. bisimulations in the considered description logics. Using the invariance results we compare the expressiveness of the considered description logics w.r.t. concepts, TBoxes and ABoxes. Our results about separating the expressiveness of description logics are naturally extended to the case when instead of ALCreg\mathcal{ALC}_{reg} we have any sublogic of ALCreg\mathcal{ALC}_{reg} that extends ALC\mathcal{ALC}. We also provide results on the largest auto-bisimulations and quotient interpretations w.r.t. such equivalence relations. Such results are useful for minimizing interpretations and concept learning in description logics. To deal with minimizing interpretations for the case when the considered logic allows quantified number restrictions and/or the constructor for the local reflexivity of a role, we introduce a new notion called QS-interpretation, which is needed for obtaining expected results. By adapting Hopcroft's automaton minimization algorithm and the Paige-Tarjan algorithm, we give efficient algorithms for computing the partition corresponding to the largest auto-bisimulation of a finite interpretation.Comment: 42 page
    corecore