This paper introduces λ , a simply typed lambda calculus supporting inductive types and recursive function definitions with termination ensured by types. The system is shown to enjoy subject reduction, strong normalisation of typable terms and to be stronger than a related system λ G in which termination is ensured by a syntactic guard condition. The system can, at will, be extended to support coinductive types and corecursive function definitions also.Type-based termination of recursive definitions 103 2 ι-reduction → ι is defined as the compatible closure of the rulewhere # a = ar(c i ). 3 µ-reduction → µ is defined as the compatible closure of the ruleRemark 2.4. Our formulation of the β-and µ-reduction rules relies on a variable convention: in the β-rule, the bound variables of e are assumed to be different from the free variables of e ; in the µ-rule, the bound and the free variables of e are assumed to be different.The mechanics of the reduction calculus is illustrated by the following example. Example 2.5. Consider the inductive type of natural numbers Nat with C(Nat) = {o, s}. Let plus ≡ (letrec plus = λx. λy. case x of {o ⇒ y | s ⇒ λx . s (plus x y)}). The following is a reduction sequence that computes one plus two, where, as usual, β denotes the reflexive and transitive closure of → β . plus (s o) (s (s o)) → µ (λx. λy. case x of {o ⇒ y | s ⇒ λx . s (plus x y)}) (s o) (s (s o)) β case s o of {o ⇒ s (s o) | s ⇒ λx . s (plus x (s (s o)))} → ι (λx . s (plus x (s (s o)))) o → β s (plus o (s (s o))) → µ s ((λx. λy. case x of {o ⇒ y | s ⇒ λx . s (plus x y)}) o (s(s o))) β s (case o of {o ⇒ s (s o) | s ⇒ λx . s (plus x (s (s o)))}) → ι s (s (s o)) Types and typing systemWe now assume we are given two denumerable sets V T of type variables and V S of stage variables, and adopt the naming convention that α, α , α i , β, δ, . . . range over V T , and ı, , . . . range over V S . Proceeding from these, we define stage and type expressions. Stage expressions are built of stage variables, a symbol for the successor function on stages, and a symbol for the limit stage. A type expression is either a type variable, a function type expression or a datatype approximation expression. Definition 2.6 (Stages and types).1 The set S of stage expressions is given by the abstract syntax: s, r ::= ı | ∞ | s.
Abstract. We introduce a generalization of monads, called relative monads, allowing for underlying functors between different categories. Examples include finite-dimensional vector spaces, untyped and typed λ-calculus syntax and indexed containers. We show that the Kleisli and Eilenberg-Moore constructions carry over to relative monads and are related to relative adjunctions. Under reasonable assumptions, relative monads are monoids in the functor category concerned and extend to monads, giving rise to a coreflection between relative monads and monads. Arrows are also an instance of relative monads.
Effects and coeffects are two general, complementary aspects of program behaviour. They roughly correspond to computations which change the execution context (effects) versus computations which make demands on the context (coeffects). Effectful features include partiality, non-determinism, input-output, state, and exceptions. Coeffectful features include resource demands, variable access, notions of linearity, and data input requirements.The effectful or coeffectful behaviour of a program can be captured and described via type-based analyses, with fine grained information provided by monoidal effect annotations and semiring coeffects. Various recent work has proposed models for such typed calculi in terms of graded (strong) monads for effects and graded (monoidal) comonads for coeffects.Effects and coeffects have been studied separately so far, but in practice many computations are both effectful and coeffectful, e.g., possibly throwing exceptions but with resource requirements. To remedy this, we introduce a new general calculus with a combined effect-coeffect system. This can describe both the changes and requirements that a program has on its context, as well as interactions between these effectful and coeffectful features of computation. The effect-coeffect system has a denotational model in terms of effect-graded monads and coeffect-graded comonads where interaction is expressed via the novel concept of graded distributive laws. This graded semantics unifies the syntactic type theory with the denotational model. We show that our calculus can be instantiated to describe in a natural way various different kinds of interaction between a program and its evaluation context.
Inspired from the recent developments in theories of non-wellfounded syntax (coinductively defined languages) and of syntax with binding operators, the structure of algebras of wellfounded and non-wellfounded terms is studied for a very general notion of signature permitting both simple variable binding operators as well as operators of explicit substitution. This is done in an extensional mathematical setting of initial algebras and final coalgebras of endofunctors on a functor category. The main technical tool is a novel concept of heterogeneous substitution systems.
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.
hi@scite.ai
10624 S. Eastern Ave., Ste. A-614
Henderson, NV 89052, USA
Copyright © 2024 scite LLC. All rights reserved.
Made with 💙 for researchers
Part of the Research Solutions Family.