-
Regular Typed Unification
Authors:
João Barbosa,
Mário Florido,
Vítor Santos Costa
Abstract:
Here we define a new unification algorithm for terms interpreted in semantic domains denoted by a subclass of regular types here called deterministic regular types. This reflects our intention not to handle the semantic universe as a homogeneous collection of values, but instead, to partition it in a way that is similar to data types in programming languages. We first define the new unification al…
▽ More
Here we define a new unification algorithm for terms interpreted in semantic domains denoted by a subclass of regular types here called deterministic regular types. This reflects our intention not to handle the semantic universe as a homogeneous collection of values, but instead, to partition it in a way that is similar to data types in programming languages. We first define the new unification algorithm which is based on constraint generation and constraint solving, and then prove its main properties: termination, soundness, and completeness with respect to the semantics. Finally, we discuss how to apply this algorithm to a dynamically typed version of Prolog.
△ Less
Submitted 25 April, 2024;
originally announced April 2024.
-
Linear Rank Intersection Types
Authors:
Fábio Reis,
Sandra Alves,
Mário Florido
Abstract:
Non-idempotent intersection types provide quantitative information about typed programs, and have been used to obtain time and space complexity measures. Intersection type systems characterize termination, so restrictions need to be made in order to make typability decidable. One such restriction consists in using a notion of finite rank for the idempotent intersection types. In this work, we defi…
▽ More
Non-idempotent intersection types provide quantitative information about typed programs, and have been used to obtain time and space complexity measures. Intersection type systems characterize termination, so restrictions need to be made in order to make typability decidable. One such restriction consists in using a notion of finite rank for the idempotent intersection types. In this work, we define a new notion of rank for the non-idempotent intersection types. We then define a novel type system and a type inference algorithm for the lambda-calculus, using the new notion of rank 2. In the second part of this work, we extend the type system and the type inference algorithm to use the quantitative properties of the non-idempotent intersection types to infer quantitative information related to resource usage.
△ Less
Submitted 4 May, 2023; v1 submitted 30 November, 2022;
originally announced November 2022.
-
Execution Time Program Verification With Tight Bounds
Authors:
Ana Carolina Silva,
Manuel Barbosa,
Mario Florido
Abstract:
This paper presents a proof system for reasoning about execution time bounds for a core imperative programming language. Proof systems are defined for three different scenarios: approximations of the worst-case execution time, exact time reasoning, and less pessimistic execution time estimation using amortized analysis. We define a Hoare logic for the three cases and prove its soundness with respe…
▽ More
This paper presents a proof system for reasoning about execution time bounds for a core imperative programming language. Proof systems are defined for three different scenarios: approximations of the worst-case execution time, exact time reasoning, and less pessimistic execution time estimation using amortized analysis. We define a Hoare logic for the three cases and prove its soundness with respect to an annotated cost-aware operational semantics. Finally, we define a verification conditions (VC) generator that generates the goals needed to prove program correctness, cost, and termination. Those goals are then sent to the Easycrypt toolset for validation. The practicality of the proof system is demonstrated with an implementation in OCaml of the different modules needed to apply it to example programs. Our case studies are motivated by real-time and cryptographic software.
△ Less
Submitted 20 October, 2022;
originally announced October 2022.
-
Typed SLD-Resolution: Dynamic Ty** for Logic Programming
Authors:
João Barbosa,
Mário Florido,
Vítor Santos Costa
Abstract:
The semantic foundations for logic programming are usually separated into two different approaches. The operational semantics, which uses SLD-resolution, the proof method that computes answers in logic programming, and the declarative semantics, which sees logic programs as formulas and its semantics as models. Here, we define a new operational semantics called TSLD-resolution, which stands for Ty…
▽ More
The semantic foundations for logic programming are usually separated into two different approaches. The operational semantics, which uses SLD-resolution, the proof method that computes answers in logic programming, and the declarative semantics, which sees logic programs as formulas and its semantics as models. Here, we define a new operational semantics called TSLD-resolution, which stands for Typed SLD-resolution, where we include a value "wrong", that corresponds to the detection of a type error at run-time. For this we define a new typed unification algorithm. Finally we prove the correctness of TSLD-resolution with respect to a typed declarative semantics.
△ Less
Submitted 30 July, 2022;
originally announced August 2022.
-
Structural Rules and Algebraic Properties of Intersection Types
Authors:
Sandra Alves,
Mário Florido
Abstract:
In this paper we define several notions of term expansion, used to define terms with less sharing, but with the same computational properties of terms typable in an intersection type system. Expansion relates terms typed by associative, commutative and idempotent intersections with terms typed in the Curry type system and the relevant type system, terms typed by non-idempotent intersections with t…
▽ More
In this paper we define several notions of term expansion, used to define terms with less sharing, but with the same computational properties of terms typable in an intersection type system. Expansion relates terms typed by associative, commutative and idempotent intersections with terms typed in the Curry type system and the relevant type system, terms typed by non-idempotent intersections with terms typed in the affine and linear type systems and terms typed by non-idempotent and non-commutative intersections with terms typed in an ordered type system. Finally, we show how idempotent intersection is related with the contraction rule, commutative intersection with the exchange rule and associative intersection with the lack of structural rules in a type system.
△ Less
Submitted 3 May, 2022; v1 submitted 26 April, 2022;
originally announced April 2022.
-
Data Type Inference for Logic Programming
Authors:
João Barbosa,
Mário Florido,
Vítor Santos Costa
Abstract:
In this paper we present a new static data type inference algorithm for logic programming. Without the need of declaring types for predicates, our algorithm is able to automatically assign types to predicates which, in most cases, correspond to the data types processed by their intended meaning. The algorithm is also able to infer types given data type definitions similar to data definitions in Ha…
▽ More
In this paper we present a new static data type inference algorithm for logic programming. Without the need of declaring types for predicates, our algorithm is able to automatically assign types to predicates which, in most cases, correspond to the data types processed by their intended meaning. The algorithm is also able to infer types given data type definitions similar to data definitions in Haskell and, in this case, the inferred types are more informative in general. We present the type inference algorithm, prove some properties and finally, we evaluate our approach on example programs that deal with different data structures.
△ Less
Submitted 14 August, 2021;
originally announced August 2021.
-
A Three-Valued Semantics for Typed Logic Programming
Authors:
João Barbosa,
Mário Florido,
Vítor Santos Costa
Abstract:
Types in logic programming have focused on conservative approximations of program semantics by regular types, on one hand, and on type systems based on a prescriptive semantics defined for typed programs, on the other. In this paper, we define a new semantics for logic programming, where programs evaluate to true, false, and to a new semantic value called wrong, corresponding to a run-time type er…
▽ More
Types in logic programming have focused on conservative approximations of program semantics by regular types, on one hand, and on type systems based on a prescriptive semantics defined for typed programs, on the other. In this paper, we define a new semantics for logic programming, where programs evaluate to true, false, and to a new semantic value called wrong, corresponding to a run-time type error. We then have a type language with a separated semantics of types. Finally, we define a type system for logic programming and prove that it is semantically sound with respect to a semantic relation between programs and types where, if a program has a type, then its semantics is not wrong. Our work follows Milner's approach for typed functional languages where the semantics of programs is independent from the semantic of types, and the type system is proved to be sound with respect to a relation between both semantics.
△ Less
Submitted 18 September, 2019;
originally announced September 2019.
-
Non-Blocking Concurrent Imperative Programming with Session Types
Authors:
Miguel Silva,
Mário Florido,
Frank Pfenning
Abstract:
Concurrent C0 is an imperative programming language in the C family with session-typed message-passing concurrency. The previously proposed semantics implements asynchronous (non-blocking) output; we extend it here with non-blocking input. A key idea is to postpone message reception as much as possible by interpreting receive commands as a request for a message. We implemented our ideas as a trans…
▽ More
Concurrent C0 is an imperative programming language in the C family with session-typed message-passing concurrency. The previously proposed semantics implements asynchronous (non-blocking) output; we extend it here with non-blocking input. A key idea is to postpone message reception as much as possible by interpreting receive commands as a request for a message. We implemented our ideas as a translation from a blocking intermediate language to a non-blocking language. Finally, we evaluated our techniques with several benchmark programs and show the results obtained. While the abstract measure of span always decreases (or remains unchanged), only a few of the examples reap a practical benefit.
△ Less
Submitted 17 January, 2017;
originally announced January 2017.
-
Liquid Intersection Types
Authors:
Mário Pereira,
Sandra Alves,
Mário Florido
Abstract:
We present a new type system combining refinement types and the expressiveness of intersection type discipline. The use of such features makes it possible to derive more precise types than in the original refinement system. We have been able to prove several interesting properties for our system (including subject reduction) and developed an inference algorithm, which we proved to be sound.
We present a new type system combining refinement types and the expressiveness of intersection type discipline. The use of such features makes it possible to derive more precise types than in the original refinement system. We have been able to prove several interesting properties for our system (including subject reduction) and developed an inference algorithm, which we proved to be sound.
△ Less
Submitted 16 March, 2015;
originally announced March 2015.
-
CLP(H): Constraint Logic Programming for Hedges
Authors:
Besik Dundua,
Mário Florido,
Temur Kutsia,
Mircea Marin
Abstract:
CLP(H) is an instantiation of the general constraint logic programming scheme with the constraint domain of hedges. Hedges are finite sequences of unranked terms, built over variadic function symbols and three kinds of variables: for terms, for hedges, and for function symbols. Constraints involve equations between unranked terms and atoms for regular hedge language membership. We study algebraic…
▽ More
CLP(H) is an instantiation of the general constraint logic programming scheme with the constraint domain of hedges. Hedges are finite sequences of unranked terms, built over variadic function symbols and three kinds of variables: for terms, for hedges, and for function symbols. Constraints involve equations between unranked terms and atoms for regular hedge language membership. We study algebraic semantics of CLP(H) programs, define a sound, terminating, and incomplete constraint solver, investigate two fragments of constraints for which the solver returns a complete set of solutions, and describe classes of programs that generate such constraints.
△ Less
Submitted 1 March, 2015;
originally announced March 2015.
-
Proceedings First International Workshop on Linearity
Authors:
Mário Florido,
Ian Mackie
Abstract:
This volume contains the proceedings of LINEARITY 2009: the first International Workshop on Linearity, which took place 12th September 2009 in Coimbra, Portugal. The workshop was a satellite event of CSL 2009, the 18th EACSL Annual Conference on Computer Science Logic.
This volume contains the proceedings of LINEARITY 2009: the first International Workshop on Linearity, which took place 12th September 2009 in Coimbra, Portugal. The workshop was a satellite event of CSL 2009, the 18th EACSL Annual Conference on Computer Science Logic.
△ Less
Submitted 29 March, 2010;
originally announced March 2010.
-
Linear Recursion
Authors:
Sandra Alves,
Maribel Fernández,
Mário Florido,
Ian Mackie
Abstract:
We define two extensions of the typed linear lambda-calculus that yield minimal Turing-complete systems. The extensions are based on unbounded recursion in one case, and bounded recursion with minimisation in the other. We show that both approaches are compatible with linearity and typeability constraints. Both extensions of the typed linear lambda-calculus are minimal, in the sense that taking ou…
▽ More
We define two extensions of the typed linear lambda-calculus that yield minimal Turing-complete systems. The extensions are based on unbounded recursion in one case, and bounded recursion with minimisation in the other. We show that both approaches are compatible with linearity and typeability constraints. Both extensions of the typed linear lambda-calculus are minimal, in the sense that taking out any of the components breaks the universality of the system. We discuss implementation techniques that exploit the linearity of the calculi. Finally, we apply the results to languages with fixpoint operators: we give a compilation of the programming language PCF into a linear lambda-calculus with linear unbounded recursion.
△ Less
Submitted 25 November, 2016; v1 submitted 19 January, 2010;
originally announced January 2010.