Modules over Monads and Initial Semantics


 Jonathan Townsend
 2 years ago
 Views:
Transcription
1 Modules over Monads and Initial Semantics André Hirschowitz 1 and Marco Maggesi 2 1 UMR 6621, CNRS, Université de Nice Sophia Antipolis 2 Università degli Studi di Firenze Abstract. Inspired by the classical theory of modules over a monoid, we introduce the natural notion of module over a monad. The associated notion of morphism of left modules ( linear natural transformations) captures an important property of compatibility with substitution, not only in the socalled homogeneous case but also in the heterogeneous case where terms and variables therein could be of different types. In this paper, we present basic constructions of modules and we give a first account on how modules allow a (slightly?) new point of view concerning higherorder syntax and semantics. 1 Introduction Substitution is a major operation. Its relevance to computer sciences has been stressed constantly (see e.g. [7]). Mathematicians of the last century have coined two strongly related notions which capture the formal properties of this operation. The first one is the notion of monad, while the second one is the notion of operad. We focus on the notion of monad. A monad in the category C is a monoid in the category of endofunctors of C (see section 2 below) and as such, has right and left modules. A priori these are endofunctors (in the same category) equipped with an action of the monad. In fact, we introduce a slightly more general notion of modules over a monad, based on the elementary observation that we can readily extend the notion of a right action of a monad in C to the case of a functor from any category B to C, and symmetrically the notion of a left action of a monad in C to the case of a functor from C to any category D. We are mostly interested in left modules. As usual, the interest of the notion of left module is that it generates a companion notion of morphism. We take as morphisms those natural transformations among (left) modules which are compatible with the structure, namely which commute with substitution (we also call these morphisms linear natural transformations). We propose here a first reference for basic properties of categories of left modules, together with basic examples of morphisms of left modules, taken in the area of (possibly higherorder) syntax and semantics. Indeed, there is currently a search for a convincing discipline suited to the programming of theoremprovers in this area [2], and we hope to show, through examples in Haskell and in Coq, the adequacy of the language of left modules for the encoding of higherorder syntax and semantics. In section 2, we briefly review the theory of monads and their algebras. In section 3, we develop the basic theory of modules. In section 4, we present the treatment of firstorder typed syntax based on modules. In section 5, we present our treatment of higherorder untyped syntax based on modules. In section 6, we show, on the example of the λcalculus, how semantics can be approached via modules. In section 7, we give a very preliminary account, again on the example of the λ calculus, of the approach via modules to higherorder typed syntax. Finally in section 8, we discuss related and future works. In the appendix, we describe the formal proof in the Coq proof assistant of one of our examples. 2 Monads and algebras We briefly recall some standard material about monads and algebras. Experienced readers may want to skip this section or just use it as reference for our notations. Mac Lane s book [15] can be used as reference on this material. We fix a category C which admits sums and a final object. The main examples of such a category are the category of sets, the category of endofunctors Set Set and the relative categories Set/D considered in section 4.
2 2.1 The category of monads A monad over C is a monoid in the category C C of endofunctors of C. In more concrete terms: Definition 1 (Monad). A monad R = R, µ, η over C is given by a functor R: C C, and two natural transformations µ: R 2 R and η : I R such that the following diagrams commute: µr R 3 Rµ R 2 R 2 µ R µ ηr I R 1 R R 2 R Rη µ 1 R R I The natural transformations µ and η are often referred to as product (or composition) and unit of the monad R. In the programming language Haskell, their names are join and return respectively. Given a monad R and an arrow f : X RY, we define the morphism bind f : RX RY given by bind f := µ Rf. The equations Rf = bind(η f), µ X = bind 1 RX (1) express the functor and monad structure of R in terms of the bind and η operators. Moreover, we have the following associativity and unity equations for bind bind g bind f = bind(bind g f), bind η X = 1 RX, bind f η = f (2) for any pair of arrows f : X RY and g : Y RZ. In fact, it is easy to verify that equations (2) actually imply the functor and monad axioms on R: Proposition 1. Let R: obj(c) obj(c) be a mapping (where obj(c) denotes the set of objects of C), and bind, η two operators bind: X, Y : obj(c), (X RY ) (RX RY ), η : X : obj(c), X RX satisfying (2). Then the operators defined by equations (1) turn R into a monad. Proof. Let us give the explicit calculation showing that the operators defined by equations (1) satisfy the axioms of monad. First, we check that R verifies the functor axioms: let X, Y, Z be object of C and f : X Y, g : Y Z two arrows. Then R 1 X = bind(η X 1 X ) = bind η X = 1 X, Rg Rf = bind(η Z g) bind(η Y f) = bind(bind(η Z g) η Y f) = bind(η Z g f) = R(g f). For each object X, we have µ X η RX = bind 1 RX η X = 1 RX, µ R η X = bind 1 RX bind(η RX η X ) = bind(bind 1 RX η RX η X ) = bind(1 RX η X ) = 1 RX which proves that η is a left and right identity for µ. Finally, the associativity of µ follows from the following calculation µ X µ RX = bind 1 RX bind 1 RRX = bind(bind 1 RX 1 RRX ) = bind(bind 1 RX ), µ X R µ X = bind 1 RX bind(η RX µ X ) = bind(bind 1 RX η RX bind 1 RX ) = bind(1 RX bind 1 RX ) = bind(bind 1 RX ). Definition 2 (Morphisms of monads). A morphism from the monad P to the monad R (both over C) is a natural transformation φ: P R which respects composition and unit, i.e., such that the following diagrams commute: P 2 µ P P φφ φ R 2 R µ R φ P R η P ηr I It can be easily checked that these morphisms yield a category, the category of monads over C.
3 2.2 Examples of monads Now we focus on some examples and constructions of monads which are especially relevant for the rest of the paper. Example 1. The identity functor I : C C is perhaps the most trivial example of monad (with µ and η given by the identity natural transformation). Definition 3. For any object X in a category D, we define the constant functor X : C D to be the functor which assigns X to every object of C and 1 X to every arrow of C. If D has a final object, then is the final functor (in the functor category C D). Example 2. In particular, if C = D the endofunctor has a natural structure of monad (with µ and η given by the universal property of ) and it is the final monad over C. Example 3 (Maybe monad). The endofunctor X X +, which takes an object in C and adds one point has a natural structure of monad over C. Borrowing from the terminology of the library of the programming language Haskell, we call it the Maybe monad. The monomorphisms X X + and X+, for each object X in C, give the natural transformations I Maybe and Maybe. Both are morphisms of monads. Example 4 (Lists). To construct the monad of lists L (over Set), first take the functor L: Set Set satisfying, for each set X L(X) = Σ n N X n = + X + X X + X X X +... So L(X) is the set of all finite lists with elements in X. Then consider as composition the natural transformation µ: L L L given by the join (or flattening) of lists of lists: µ[[a 1,... ], [b 1,... ],..., [z 1,... ]] = [a 1,..., b 1,...,..., z 1,... ]. The unit η : I L is the collection of singleton maps η X : x X [x] L(X). Example 5 (Lambda Calculus). This example will be worked out with the necessary details in section 5.3, but let us give early some basic ideas (already present e.g. in [1]). We denote by F V (M) the set of free variables of a λterm M. For a fixed set X, consider the collection of λterms (modulo αconversion) with free variables in X: SLC(X) := {M F V (M) X} Given a set X we take as unit morphism η X : X SLC(X) the application assigning to an element x X the corresponding variable in SLC(X). Every map f : X Y induces a morphism SLC(f): SLC(X) SLC(Y ) ( renaming ) which makes SLC an endofunctor. The tautological substitution of free variables gives us a natural transformation µ X : SLC(SLC(X)) SLC(X). With this structure SLC is a monad and we call it monad of the syntactic λcalculus. Moreover, the monad composition is compatible with the β and η conversions. Then, taking the quotient by the β, or the η, or the βη equivalence relation we get three new monads, and the four associated projections are monad morphisms. In particular, we denote by LC the quotient by βηequivalence and we call it monad of the semantic λcalculus (cfr. section 6). The formal development illustrated in the appendix contains the proofs of these facts (see sections 9.3 and 9.4). Definition 4 (Derivative). We define the derivative F of an endofunctor F : C C to be the functor F = F Maybe. We can iterate the construction, and denote by F (n) the nth derivative.
4 Example 6 (The derivative of a monad). The derivative of a monad R has an induced structure of monad defined as follows 3. The unit of R η is simply the composition I R R. Next consider the natural transformation γ : Maybe R R Maybe. Then the action R R R is given by R Maybe R Maybe RγMaybe The necessary verifications are not difficult. R R Maybe Maybe µ Rµ Maybe R Maybe. For our purpose it is relevant to observe that very simple natural transformations among some of our main examples may fail to be morphisms of monads. We take the following as paradigmatic example. Example 7 (Abstraction is not a morphism of monads). Abstraction on λterms gives a natural transformation abs: SLC SLC which takes a λterm M SLC(X + ) and binds the variable. This fails to be a morphism of monads because it does not respect substitution in the sense of monads: a careful inspection reveals that the transformation SLC(SLC(X + ) + ) binds all stars under a single abstraction while SLC(SLC(X + ) + ) µ SLC(X + ) abs SLC(X) abs abs µ SLC(SLC(X)) SLC(X) not. In fact, we will see later that SLC is a left module over SLC and abs is a SLClinear morphism. 2.3 The category of algebras Here we fix a monad R over C. Definition 5 (Algebra). An algebra over R is given by an object A and a morphism ρ: R(A) A in C such that the following diagrams commute: R 2 (A) Rρ R(A) A η A R(A) µ A R(A) ρ A ρ ρ 1 A A Definition 6. Let A, B be two algebras over a monad R. An arrow f : A B in C is said to be a morphism of algebras if it is compatible with the associated actions, i.e., if the following diagram commutes: R(A) R(f) R(B) ρ A A f B ρ B As we will see later (example 17), algebras can be regarded as a special kind of right modules. Example 8 (Monoids). In the category of sets, algebras over the monad L of lists are sets equipped with a structure of monoid; given a monoid A, the corresponding action L(A) A is the product (sending a list to the corresponding product). 3 Modules over monads In this section, we fix a monad R over a category C as above, and we introduce and study R modules. 3 This corresponds to the MaybeT monad transformer in Haskell.
5 3.1 Left modules We start first by concentrating ourselves on left modules over R. Definition 7 (Left modules). A left Rmodule in D is given by a functor M : C D equipped with a natural transformation ρ: M R M, called the action, which is compatible with the monad composition, more precisely, we require that the following diagrams commute M R 2 Mµ M R M R Mη M I ρr M R ρ M We will refer to the category D as the range of M. ρ M ρ 1 M Remark 1. The companion definition of modules over an operad (c.f. e.g. [17, 9]) follows easily from the observation [19] that operads are monoids in a suitable monoidal category. By the way, this monoidal structure is central in [6]. Given a left Rmodule M, we can introduce the mbind operator which, to each arrow f : X RY, associates the arrow mbind f := MX MY defined by mbind f := ρ Y Mf. We have the following relation which expresses the module action in terms of the mbind operator: The axioms of left module imply the following equations over mbind ρ X = mbind 1 RX. (3) mbind g mbind f = mbind(bind g f), mbind η X = 1 MX (4) Conversely, verifications similar to those of proposition 1 lead to: Proposition 2. Let M : obj(c) obj(d) be a mapping (obj( ) denotes the set of objects) and mbind be an operator mbind: X Y : obj(c), (X RY ) (MX MY ) satisfying (4). Then the operator defined by equation (3) turns M into an Rmodule. Example 9. We can see our monad R as a left module over itself (with range C), which we call the tautological module. Example 10. Any constant functor W : C D, W D is a left Rmodule (in an obvious way). Example 11. For any functor F : D E and any left Rmodule M : C D, the composition F M is a left Rmodule (in the evident way). Example 12 (Derived module). As for functors and monads, derivation is wellbehaved also on left modules: for any left Rmodule M, the derivative M = M Maybe has a natural structure of left Rmodule where the action M R M is the composition M Maybe R Mγ M R Maybe ρmaybe M Maybe and γ is the natural morphism from Maybe R to R Maybe. Definition 8 (Morphisms of left modules). We say that a natural transformation of left R modules τ : M N is linear if it is compatible with substitution, in the sense that the following diagram commutes: M R τr N R We take linear natural transformations as left module morphisms. ρ M M τ N ρ N
6 Remark 2. Here the term linear refers to linear algebra: linear applications between modules over a ring are group morphisms compatible with the action of the ring. This is compatible with the usual flavor of the word linear (no duplication, no junk) as the following example shows. Example 13. Here we choose for R the monad on Set generated by two binary constructions + and and we build (by recursion) a natural transformation n: R R as follows: for a variable x, n(x) is x+x, while for the other two cases we have n(a+b) = n(a) n(b) and n(a b) = n(a)+n(b). It is easily verified that n is a nonlinear natural transformation (check the diagram against n(var(x x))). Example 14. We easily check that the natural transformation of a left module into its derivative is linear. Note that there are two natural inclusions of the derivative M into the second derivative M. Both are linear. Definition 9 (Category of left modules). We check easily that linear morphisms between left Rmodules with the same range yield a subcategory of the functor category. We denote by Mod D (R) the category of left Rmodules with range D. Definition 10 (Product of left modules). We check easily that the cartesian product of two left Rmodules as functors (having as range a cartesian category D) is naturally a left Rmodule again and is the cartesian product also in the category Mod D (R). We also have finite products as usual. The final left module is the product of the empty family. Example 15. Consider again the monad of lists L. The concatenation of two lists is a Llinear morphism L L L. Definition 11 (Evaluaton). Given an Rmodule M with range in Set, we have a natural evaluation morphism eval: M R M, where M is the derivative of M. We omit the proof of the following result. However the details can be found in the source of the formalization described in the appendix. Proposition 3. Derivation yields a cartesian endofunctor on the category of left Rmodules with range in a fixed cartesian category D. 3.2 Right modules Let R be a monad over a category C. The definition of right module is similar to that of left module. Definition 12 (Right modules). A right Rmodule with corange D is given by a functor M : D C equipped with a natural transformation ρ: R M M which makes the following diagrams commutative: R 2 M µm R M I M ηm R M Rρ R M ρ M ρ 1 M We remark that for any right Rmodule M and any object X D the image M(X) is an R algebra. Then a right Rmodule is simply a functor from the corange category D to the category of Ralgebras. Example 16. Our monad R is a right module over itself. Example 17. If A is an Ralgebra, then for any category D the constant functor A from D to C with value A has a natural structure of right Rmodule. In particular, we can identify our algebra with the corresponding functor A: C, where is the category with one object and one arrow. Example 18. Let φ: R P be a morphism of monads. Then P is a right and left Rmodule with actions given respectively by P R φr R R µ R R and R P P φ R R µ R R. ρ M
7 Definition 13 (Morphisms of right modules). A morphism of right Rmodules is a natural transformation τ : M N which is compatible with substitution, i.e., such that the following diagram commutes: Rτ R M R N ρ M M τ We check easily that module morphisms among right Rmodules with the same corange yield a subcategory of the functor category. In fact, this category of right modules with corange D is isomorphic with the category of functors from D to the category of Ralgebras. N ρ N 3.3 Limits and colimits of left modules Limits and colimits in the category of left modules can be constructed pointwise: Proposition 4 (Limits and colimits of left modules). If D is complete (resp. cocomplete), then Mod D (R) is complete (resp. cocomplete). Proof. Let D be a complete category and G: I Mod D (R) be a diagram of left modules over the index category I. For any object X C we have a diagram G(X): I D and for any arrow f : X Y in C we have a morphism of diagrams G(X) G(Y ). So define U(X) := lim G(X) Next, given an arrow f : X R(Y ), we have an induced morphism of diagrams G(X) G(Y ) by the module structure on each object of the diagram. This induces a morphism mbind f : U(X) U(Y ). It is not hard to prove that mbind satisfies the module axioms and that U is the limit of G. The colimit construction is carried out analogously. A similar statement holds for right modules (under the relevant assumption on C) but we don t need it. 3.4 Base change Proposition 5 (Base change). Given a morphism f : A B of monads and a left Bmodule M, we have an Aaction on M given by M A Mf M B ρ M M. We denote by f M the resulting Amodule and we refer to f as the base change operator. Proof. Our thesis is the commutativity of the diagram M B A ρa MfA M A A Mff M B B Mµ M A Mf Mµ M B M A Mf ρb M B which follows from the commutativity of the three pieces: M is a left Bmodule, the map from M(B( )) M( ) is functorial, and f is a morphism. Definition 14 (Base change (functoriality)). We upgrade the base change operator into a functor f : Mod D (B) Mod D (A) by checking that if g : M N is a morphism of left Bmodules, then so is the natural transformation f g : f M f N. The following results are easy consequences of the definitions. Proposition 6. The base change functor commutes with products and with derivation. Proposition 7. Any morphism of monads f : A B yields a morphism of left Amodules, still denoted f, from A to f B. ρ M ρ
8 4 Firstorder typed syntax In this section we check the point of view of modules against firstorder typed syntax. We fix a set D of types. From now on, we will say modules instead of left modules. Definition 15 (Dsets). We call Dset any family of sets indexed by D. Alternatively a Dset is a set over D, namely a set A equipped with a map from A to D. This map assigns to each element of A its type (or degree). We have a category Set/D of Dsets, where morphisms are applications preserving the type. For each Dset X and d D, we denote by X d the component of X in degree d. We denote by τ d the corresponding functor from Set/D to Set. Definition 16 (Darities and Dsignatures). A Darity is a finite nonempty list of elements in D. We use a colon to single out the first element of the list, which stands for the type of the result, while the other elements of the list stand for the types of the arguments. A signature is a family of arities, i.e., a pair Σ = (O, α) where α(o) = (b(o) : a(o)) is an arity for every o O. Definition 17 (Elementary Dmodules). We say that a monad over Set/D is a Dmonad. Given a Dmonad R, and a type d D we denote by R d the Rmodule with range in Set obtained by applying τ d to R: R d := τ d R. More generally, for a list a := (a 1,..., a n ) of elements in D, we write R a for the product R a1 R an. These modules are our elementary modules over R. Definition 18 (Representation of a Darity). Given a Dmonad R, we define a representation of the Darity α = (b : a 1,..., a n ) = (b : a) in R to be a morphism of modules: r : n R ai i=1 R b or, in other words: r : R a R b. We also say that r is a construction of arity α in R. Definition 19 (Representation of a Dsignature). A representation of the Dsignature Σ = (O, α) in the Dmonad R, consists of, for each o in O, a representation of the Darity α(o) in R. Definition 20 (The category of representations). Given a signature Σ = (O, α), we build the category Rep Σ D of representations of Σ in Dsets as follows. Its objects are Dmonads equipped with a representation of Σ. A morphism from (R, r) to (S, s) is a morphism f from R to S compatible with the representations in the sense that, for each o in O, with α(o) = (b : a 1,..., a n ), the following diagram of Rmodules commutes: n i=1 R a i R b f n i=1 S a i f S b where the horizontal arrows come from the representations and the vertical arrows come from f. Proposition 8. These morphisms, together with the obvious composition, turn Rep Σ D into a category. Theorem 1. The category Rep Σ D has an initial object which we call the inductive Dmonad generated by Σ, and denote by ˆΣ. As usual, our syntactic object Rep Σ D comes with corresponding recursion and induction principles which we omit to state explicitly. Example 19. For typed lists, we take for set of types the inductive set generated by the grammar τ = list τ. We have to describe the arities of the constructors nil and cons: for each t τ, we want a constructor nil t of arity (list t :) and a constructor cons t of arity (list t : t, list t). (5)
9 5 Higherorder untyped syntax In the previous section we have considered typed constructions without bindings. Here we consider untyped constructions with bindings. We first explain in general our approach to the syntax associated to a (binding) signature. Then we discuss, on the example of the λcalculus, how it can be implemented in Haskell. 5.1 The general construction Definition 21 (HOarities). We define an arity (or HOarity) to be a Narity, namely a nonempty list of integers. We say the arity is raw when the first element of the list is zero. Given an arity (b : a 1,..., a n ), we denote by raw(a) the (raw) arity (0 : a 1,..., a n, 0 b ), where 0 b stands for a list of b zeros. The intended meaning of the integers (except for the first one) is the number of extra variables in each argument which are bound by the construction. The difference with the definition in [6] is that our arity provides one more integer whose intended meaning is the number of extra formal arguments of the output of the operation. Example 20. This point of view allows for instance to consider, in the λcalculus, the app 1 construction, namely the avatar of the usual app which has only one argument, and to assign to it the arity (1 : 0), meaning that it expects a single argument where no extra variable is bound, and that its output expects one extra formal argument. Definition 22 (Binding signatures). We define a (binding) signature Σ = (O, α) to be a family of arities α: O N N. Here N stands for the set of lists of integers. A signature is said to be raw if it consists of raw arities. For a signature Σ = (O, α), we denote by raw(σ) the raw signature (O, o raw(α(o))). Next, we describe what are the elementary modules in the present context. Definition 23 (Elementary modules). Given a monad R over Set, and a possibly empty list a := (a 1,..., a n ) of integers, we denote by R (a) the Rmodule with range in Set obtained as product of derivatives: R (a) := R (a1) R (an). Definition 24 (Representation of an arity). Given a monad R over Set, we define a representation of the arity α = (b : a) in R to be a module morphism r : R (a) R (b). We also say that r is a construction of arity α in R. In case b = 0 we say that r is a raw construction in R. Definition 25 (The category of representations). Given a signature Σ = (O, α), we build the category Mon Σ of representations of Σ as follows. Its objects are monads equipped with a representation of Σ. A morphism from (R, r) to (S, s) is a morphism from R to S compatible with the representations in the sense that, for each o in O with α(o) = (b : a), the following diagram commutes: R (a) R (b) (6) f S (a) f S (b) where the horizontal arrows come from the representations and the vertical arrows come from f (it is used here that f commutes with derivation and products). Proposition 9. These morphisms, together with the obvious composition, turn Mon Σ into a category which comes equipped with a forgetful functor to the category of monads.
10 Theorem 2. Let Σ be a (binding) signature. Then the category Mon Σ of representations of Σ has an initial object ˆΣ. The proof starts by reduction to the case of a raw signature. This reduction is discussed in the next subsection. In the case of a raw signature, the initial object is constructed by means of trees in the usual way, and the required properties are derived by induction or recursion on the height of the tree. At first glance, this result looks like a particular case of the previous theorem concerning typed signatures, namely the case where the set of types is the set of sets. The first difference is in the fact that the set of sets is definitely not a small set of types. Even if it were, there would remain a second difference: we do not consider monads on the same category. With respect to the first difference, we just have to be cautious when proposing our initial object, in order to build a functor with values in the category of small sets. With respect to the second difference, we have to be cautious with nonraw arities. This is why we start by reducing to the case of a raw signature. 5.2 Flattening Definition 26 (Flattening a representation of an arity). Given a monad R and a representation r of the arity α = (b : a 1,..., a n ) = (b : a) in R, we define the natural transformation raw(r): R (a) R b R as the composition R (a) R b r R b R (b) R b eval R It is easily checked that raw(r) is a representation of raw(α). Example 21. A representation of (2 :) in SLC is given by the app 0 : SLC (2) construction. The associated representation of raw(2 :) = (0 : 0, 0) is the usual app. Proposition 10 (Flattening is bijective for arities). Given a monad R and an arity α = (b : a 1,..., a n ) the raw map defined above defines a bijection from the set of representations of α in R to the set of representations of raw(α) in R. Definition 27 (Flattening a representation of a signature). Given a monad R and a representation r of the signature Σ = (O, α) we define raw(r) to be the family o raw(r(o)) which is a representation of raw(σ). Proposition 11 (Flattening is bijective for signatures). Given a monad R and a signature Σ = (O, α) the raw map defined above defines a bijection from the set of representations of Σ in R to the set of representations of raw(σ) in R. Proposition 12. Given a signature Σ, the raw construction extends as a functor Mon Σ Mon raw Σ from the category or representations of Σ to the category of representations of raw(σ). Furthermore, this functor is an isomorphism of categories. From the previous proposition, it follows that theorem 2 can be proved by reduction to the special case of a raw signature. 5.3 Implementation in Haskell In this section we concentrate on the special case of the signature Σ = ((0 : 0, 0), (0 : 1)) and explain how it can be implemented in Haskell [13]. The associated initial monad ˆΣ given by theorem 2 will be denoted by SLC (SLC standing for syntactic λcalculus, cfr. the example in section 2). We consider SLC(X) as the set of λterms with free variables taken from X where
11 the Σrepresentation morphism SLC SLC + SLC SLC gives the familiar constructors of the λcalculus in the nameless encoding [3], namely, the SLClinear natural transformations app: SLC SLC SLC, abs: SLC SLC. We denote by var the unit of the monad which is the constructor of variables. The bind operator of SLC gives us the substitution (or instantiation) of free variables and the monad axioms together with the SLClinearity of the app and abs constructors give us an elegant and concise description of the basic properties of substitution, namely: bind f (var v) = f v bind (app x y) = app (bind f x) (bind f y) bind var x = x bind f (abs x) = abs (mbind f x) bind g (bind f x) = bind (bind g f) x Notice the mbind appearing in the substitution rule for abs which is where the SLCmodule structure of the derivative SLC comes into play. All this can be condensed in the following ten lines of Haskell code implementing altogether the (nested) datatype for λterms and the substitution algorithm. module SLC where import Monad (liftm) data SLC a = Var a App (SLC a) (SLC a) Abs (SLC (Maybe a)) instance Monad SLC where return = Var Var x >>= f = f x App x y >>= f = App (x >>= f) (y >>= f) Abs x >>= f = Abs (x mbind f) mbind :: SLC (Maybe a) > (a > SLC b) > SLC (Maybe b) mbind x f = x >>= maybe (Var Nothing) (liftm Just. f) The last line of this code defines the structure of SLCmodule over the derivative SLC. We recall from [13] that Maybe is the inductive datatype defined by data Maybe a = Nothing Just a and maybe is the associated catamorphism maybe :: b > (a > b) > Maybe a > b The operator liftm :: (Monad m) => (a > b) > m a > m b is the functor action on maps, so the de Bruijn bump of free variables is given by the term liftm Just :: (Monad m) => m a > m (Maybe a) 6 Exponential monads In the present section, we illustrate, through the example of the λcalculus, how modules and morphisms among them interplay with semantics. We also show how this point of view may be implemented in Coq [5]. For any set X, consider the equivalence relation βη on SLC(X) given by the reflexive symmetric transitive closure of β and η conversions and define LC(X) := SLC(X)/ βη. It can be shown that βη is compatible with the structure of SLC so LC has a structure of monad, and that the projection SLC LC is a morphism of monads. Application and abstraction of SLC induces two LClinear morphims which we still denote by app and abs.
12 Now the key fact is that the abstraction abs: LC LC is a linear isomorphism. In fact, it is easy to construct its inverse app 1 : LC LC : app 1 x = app(ˆx, ) where x ˆx denotes the natural inclusion LC LC. The equation abs app 1 = 1 LC clearly corresponds to the ηrule while the other equation app 1 abs = 1 LC can be considered the ultimate formulation of the βrule. In fact, there is a more classical formulation of the βrule which can be stated as the commutativity of the diagram LC LC abs LC LC LC app eval LC We can present this situation from a more syntactical point of view. For this, consider the category of exponential monads: an exponential monad is a monad R endowed with an Rlinear isomorphism with its derivative exp R : R R. A morphism of exponential monads is a monad morphism f such that R f f P exp R R f f P exp P is a commutative diagram of Rmodules (we are implicitly using the compatibility of base change with derivation). Theorem 3. The monad LC is initial in the category of exponential monads. We have developed a formal proof of the above theorem in the Coq proof assistant [5], which is discussed in the appendix. Here we just single out the code for the definition of exponential monad, which shows how our abstract point of view may be readily implemented: Record ExpMonad : Type := { exp_monad :> Monad; exp_abs : Mod_Hom (Derived_Mod exp_monad) exp_monad; exp_app : Mod_Hom exp_monad (Derived_Mod exp_monad); exp_eta : forall X (x : exp_monad X), exp_abs _ (exp_app _ x) = x; exp_beta : forall X (x : Derived_Mod exp_monad X), exp_app _ (exp_abs _ x) = x }. 7 Typed higherorder syntax and semantics So far we have discussed firstorder typed syntax and higherorder untyped syntax. Here we will give a glance at higherorder typed syntax. We first consider the case where the constructions of types are considered out of the syntax, then we say a few words concerning the more general case with constructors of types and of terms.
13 7.1 Simply typed lambda calculus We denote by θ the set of simple types θ := θ θ. Following [22], we consider the syntactic typed λcalculus as an assignment V SLC θ (V ), where V = t θ (V ) t is a θset (of typed variables) while SLC θ (V ) = θ (V )) t t θ(slc is the set of typed λterms (modulo αconversion) built on free (typed) variables taken in V. With the usual substitution, SLC θ becomes a monad on the category Set/θ. Now, given a type t we have SLC t (X) := (SLC θ (X)) t which gives a functor over θsets, which is an elementary module over SLC θ. And given two types s, t, we have the transformation app s,t : SLC s t SLC s SLC t which is linear. For the abs construction, we need a notion of partial derivative for a module. For a module M over θsets, and a type t θ, we set δ t M(V ) := M(V + t ) where V + t is obtained from V by adding one element with type t. It is easily checked how δ t M is again a module. Now, given two types s and t, it turns out that abs s,t : δ s SLC t SLC s t is linear. We omit the description of the category where this representation is initial. As in the untyped case, we can consider the functor LC θ obtained by quotienting modulo βη conversion. This is again a monad over the category of θsets and the natural quotient transformation SLC θ LC θ is a morphism of monads. For this semantic monad, the above module morphisms induce semantic counterparts: app s,t : LC s t LC s LC t and abs s,t : δ s LC t LC s t. In this framework it is possible to give a typed counterpart of our theorem 3, see [22]. 7.2 Typed lambda calculus revisited Our final example of typed monad is just a glance to more general typed λcalculi. The point here is that the set of types is no more fixed. Thus our monads take place in the category Fam of set families: an object in Fam is an application p: I Set while a morphism m: p p is a pair (m 0, m 1 ) with m 0 : I I, and m 1 : (i : I)p(i) p (m 0 (i)). We say that I is the set of types of p: I Set. From Fam there are two forgetful functors T, T ot: Fam Set where T (p: I Set) := I and T ot(p) := i T (p) p(i), and a natural transformation proj : T ot T, defined by proj(p) = p in the obvious sense. Given a monad R on Fam, we thus have a morphism of Rmodules proj R : T ot R T R. We need also two maybe monads on Fam: the first one F F adds one (empty) type (tnew) to F, while the second one, F F / adds one type (tnew) with one element (new). Given a monad R on Fam, we thus have two derived Rmodules: R := F R(F ) and R / := F R(F / ) Now when should we say that R is a λcalculus in this context? At least we should have a module morphism arrow : (T R) 2 T R. and a module morphism for abstraction, abs : R / R (the arity for application is not so simple). We hope this example shows the need for new notions of arity and signature, as well as the new room opened by modules for such concepts. 8 Related and future works We have introduced the notion of module over a monad, and more importantly the notion of linearity for transformations among such modules and we have tried to show that this notion is ubiquitous as soon as syntax and semantics are concerned. Our thesis is that the point of view
14 of modules opens some new room for initial semantics, as we sketched for the λcalculus (see also [12]). Despite the natural ideas involved, the notion of module over a monad has been essentially ignored till now: the only mention of modules over monads we have been able to find is on a blog by Urs Schreiber. 4 On the other hand, modules over operads have been introduced more than ten years ago by M. Markl ([16, 17]) and are commonly used by topologists (see e.g. [9, 14, 4]). In [8], such modules over operads have been considered, under the name of actions, in the context of semantics. The idea that the notion of monad is suited for modelling substitution concerning syntax (and semantics) is deeply rooted in the folklore and appears at least in [1, 3]. It has been retained by many other recent contributions concerned with syntax, although some other settings have been considered. Notably in [6] the authors work within a setting roughly based on operads (although they do not write this word down; the definition of operad is on Wikipedia; operads and monads are not too far from each other). As they mention, their approach is, to some extent, equivalent to an approach through monads. It has been applied e.g. in [21] and generalized e.g. in [20]. Another approach to syntax with bindings, initiated by Gabbay and Pitts [10], relies on a systematic consideration of freshness, an issue which is definitely ignored in the monadic or operadic approach. Let us also mention the contributions [11, 18] where a much more general notion of signature than ours is treated in a (higherorder) algebraoriented approach. Future work should integrate such general signatures in a moduleoriented approach. As far as applications to semantics are concerned, the typed case is of major interest. In this respect, the approach of [6] has been successfully applied to the semantics of process calculi, see e.g. [8]. Future work should definitely check our moduleoriented approach against this and other related applications. Finally let us mention one more track which we envision: it can be checked that the β relation on the syntactic λcalculus may be upgraded into a monad on the category of preordered sets. It seems clear that this construction is pertinent for the study of the operational semantics of the λcalculus. 9 Appendix: Formal proof of theorem 3 In this section we present our formal proof of theorem 3 in the Coq proof assistant [5]. We recall the statement of the theorem The monad LC of semantic untyped λcalculus is an initial object in the category of exponential monads. We include here only a small fraction of the code without proofs. The full sources can be found at 9.1 Structure of the formalisation The structure of our proof can be outlined in the following four major parts: 1. axioms and support library; 2. formalisation of monads, modules and exponential monads; 3. formalisation of syntactic and semantic λcalculus; 4. the main theorem. The second and third part are independent of each other. As for what this paper is concerned, the first part (files Misc.v, Congr.v) can be considered as an extension of the Coq system for practical purposes. This part contains some metalogical material (tactics and notations) and declares the following axioms: functional choice, proof irrelevance, dependent extensionality. We include here their declarations: 4
15 Axiom functional_choice : forall (A B : Type) (R : A > B > Prop), (forall x : A, exists y : B, R x y) > exists f : A > B, (forall x : A, R x (f x)). Axiom proof_irrelevance : forall (A : Prop) (H1 H2 : A), H1 = H2. Axiom extens_dep : forall (X : Type) (T : X > Type) (f g : forall x : X, T x), (forall x : X, f x = g x) > f = g. Moreover, we use an axiomatic definition of quotient types (file Quot.v) to construct the semantic untyped λcalculus as quotient of the syntactic λcalculus. 9.2 Formalisation of monads and modules After the preliminary material, our formalisation opens the theory of monads and (left) modules (files Monad.v, Mod.v, Derived Mod.v). This is constructed starting from a rather straightforward translation of the Haskell monad library. As an example, we report here our definitions of monads and modules in the Coq syntax. Record Monad : Type := { monad_carrier :> Set > Set; bind : forall X Y : Set, (X > monad_carrier Y) > monad_carrier X > monad_carrier Y; unit : forall X : Set, X > monad_carrier X; bind_bind : forall (X Y Z : Set) (f : X > monad_carrier Y) (g : Y > monad_carrier Z) (x : monad_carrier X), bind Y Z g (bind X Y f x) = bind X Z (fun u => bind Y Z g (f u)) x; bind_unit : forall (X Y : Set) (f : X > monad_carrier Y) (x : X), bind X Y f (unit X x) = f x; unit_bind : forall (X : Set) (x : monad_carrier X), bind X X (unit X) x = x }. Notation "x >>= f" := _ f x). Record Mod (U : Monad) : Type := { mod_carrier :> Set > Set; mbind : forall (X Y: Set) (f : X > U Y) (x : mod_carrier X), mod_carrier Y; mbind_mbind : forall (X Y Z : Set) (f : X > U Y) (g : Y > U Z) (x : mod_carrier X), mbind Y Z g (mbind X Y f x) = mbind X Z (fun u => f u >>= g) x; unit_mbind : forall (X : Set) (x : mod_carrier X), mbind X X U X) x = x }. Notation "x >>>= f" := f x). The library also includes the definition of morphism of monads and modules and other related categorical material. Other definitions which are specific to our objective are those of derived module and exponential monad. The latter reads as follows: Record ExpMonad : Type := { exp_monad :> Monad; exp_abs : Mod_Hom (Derived_Mod exp_monad) exp_monad; exp_app : Mod_Hom exp_monad (Derived_Mod exp_monad); exp_eta : forall X (x : exp_monad X), exp_abs _ (exp_app _ x) = x; exp_beta : forall X (x : Derived_Mod exp_monad X), exp_app _ (exp_abs _ x) = x }. and comes with its associated notion of morphism: Record ExpMonad_Hom (M N : ExpMonad) : Type := { expmonad_hom :> Monad_Hom M N; expmonad_hom_app : forall X (x : M X), expmonad_hom _ (exp_app M _ x) = exp_app N _ (expmonad_hom _ x); expmonad_hom_abs : forall X (x : Derived_Mod M X), expmonad_hom _ (exp_abs M _ x) = exp_abs N _ (expmonad_hom _ x) }.
16 9.3 Formalisation of the λcalculus This part contains the definition of the syntactic and the semantic untyped λcalculus (files Slc.v and Lc.v respectively). We use nested datatypes to encode λterms in the Calculus of (Co)Inductive Constructions as already shown in the Haskell fragment of section 5.3 for which we report below the equivalent Coq code. Notice that this encoding can be considered a typeful variant of the wellknown de Bruijn encoding [3]. As does the de Bruijn encoding, it represents λterms modulo αconversion. Inductive term (X : Set) : Set := var : X > term X app : term X > term X > term X abs : term (option X) > term X. Fixpoint fct (X Y : Set) (f : X > Y) (x : term X) { struct x } : term Y := match x with var a => var (f a) app x y => app (x // f) (y // f) abs x => abs (x // (optmap f)) end where "x // f" := f x). Definition shift X (x : term X) : term (option X) := x X. Definition comm (X Y : Set) (f : X > term Y) (x : option X) : term (option Y) := match x with Some a => shift (f a) None => var None end. Fixpoint subst (X Y : Set) (f : X > term Y) (x : term X) { struct x } : term Y := match x with var x => f x app x y => app (x //= f) (y //= f) abs x => abs (x //= comm f) end where "x //= f" := f x). Once the basic definitions are settled, we prove a series of basic lemmas which includes the associativity of substitution, which is the most important ingredient in proving that the λcalculus is a monad. Lemma subst_subst : forall (X Y Z : Set) (f : X > term Y) (g : Y > term Z) (x : term X), x //= f //= g = x //= fun u => f u //= g. Finally, we introduce the betaeta equivalence relation on lambdaterms Inductive lcr (X : Set) : term X > term X > Prop := lcr_var : forall a : X, var a == var a lcr_app : forall x1 x2 y1 y2 : term X, x1 == x2 > y1 == y2 > app x1 y1 == app x2 y2 lcr_abs : forall x y : term (option X), x == y > abs x == abs y lcr_beta : forall x y : term X, Beta x y > x == y lcr_eta : forall x : term X, abs (app1 x) == x lcr_sym : forall x y : term X, y == x > x == y lcr_trs : forall x y z : term X, lcr x y > lcr y z > lcr x z where "x == y" := _ x y). Let r X : Eqv (term X) := Build_Eqv X) X) X) X). and prove some compatibility lemmas with constructors and other operations. The compatibility with substitution is stated as follows: Lemma lcr_subst : forall (X Y : Set) (f g : X > term Y) (x y : term X), (forall u, f u == g u) > x == y > x //= f == y //= g. 9.4 Proof of the main theorem The fourth and last part summarises the results proved in the other parts and proves the main theorem. It starts by proving that our definitions of syntactic and semantic lambda calculus provide indeed two monads, denoted SLC and LC respectively, and by showing that the two transformations abs and app 1 are indeed morphisms of modules:
17 Definition SLC : Monad := Build_Monad term subst var subst_subst subst_var var_subst. Definition lc (X : Set) : Set := term X // r. Definition LC : Monad := Build_Monad lc lc_subst lc_var lc_subst_assoc lc_subst_var lc_var_subst. Let abs_hom : Mod_Hom (Derived_Mod LC) LC := Build_Mod_Hom (Derived_Mod LC) LC lc_abs lc_abs_hom. Let app1_hom : Mod_Hom LC (Derived_Mod LC) := Build_Mod_Hom LC (Derived_Mod LC) lc_app1 lc_app1_hom. Now comes the proof that LC is an exponential monad, which is stated in Coq through the following definition: Definition ELC : ExpMonad := Build_ExpMonad abs_hom app1_hom lc_eta lc_beta. Next comes the construction of the initial morphism which is initially defined as a fixpoint on terms. Variable M : ExpMonad. Fixpoint iota_fix X (x : term X) { struct x } : M X := match x with var a => unit M a app x y => exp_app M _ (iota_fix x) >>= default M X) (iota_fix y) abs x => exp_abs M _ (iota_fix x) end. Then we prove that iota fix is compatible with the βη equivalence relation and thus it factors through the monad LC. Let iota X : lc X > M X := lc_factor X) X). The construction of the initial morphism ends with the verification that it is actually a morphism of exponential monads. Let iota_monad : Monad_Hom LC M := Build_Monad_Hom LC M iota iota_subst iota_var. Let exp_iota : ExpMonad_Hom ELC M := Build_ExpMonad_Hom ELC M iota_monad iota_app1 iota_abs. Finally, we prove that iota monad is unique. Theorem iota_unique : forall j : ExpMonad_Hom ELC M, j = exp_iota. The Coq terms ELC, iota monad and iota unique altogether form the formal proof of the initiality of the monad LC in the category of exponential monads. References 1. Thorsten Altenkirch and Bernhard Reus. Monadic presentations of lambda terms using generalized inductive types. In CSL, pages , B. Aydemir, A. Bohannon, M. Fairbairn, J. Foster, B. Pierce, P. Sewell, D. Vytiniotis, G. Washburn, S. Weirich, and S. Zdancewic. Mechanized metatheory for the masses: The POPLmark challenge. In Proceedings of the Eighteenth International Conference on Theorem Proving in Higher Order Logics (TPHOLs 2005), Richard S. Bird and Ross Paterson. De Bruijn notation as a nested datatype. Journal of Functional Programming, 9(1):77 91, Michael Ching. Bar constructions for topological operads and the Goodwillie derivatives of the identity. Geom. Topol., 9: (electronic), The Coq Proof Assistant. 6. Marcelo Fiore, Gordon Plotkin, and Daniele Turi. Abstract syntax and variable binding (extended abstract). In 14th Symposium on Logic in Computer Science (Trento, 1999), pages IEEE Computer Soc., Los Alamitos, CA, 1999.
18 7. Marcelo P. Fiore. On the structure of substitution. Invited address for the 22nd Mathematical Foundations of Programming Semantics Conf. (MFPS XXII), DISI, University of Genova (Italy). 8. Marcelo P. Fiore and Daniele Turi. Semantics of name and value passing. In Logic in Computer Science, pages , Benoit Fresse. Koszul duality of operads and homology of partition posets. In Homotopy theory: relations with algebraic geometry, group cohomology, and algebraic Ktheory, volume 346 of Contemp. Math., pages Amer. Math. Soc., Providence, RI, Murdoch Gabbay and Andrew Pitts. A new approach to abstract syntax involving binders. In 14th Symposium on Logic in Computer Science (Trento, 1999), pages IEEE Computer Soc., Los Alamitos, CA, Neil Ghani and Tarmo Uustalu. Explicit substitutions and higherorder syntax. In MERLIN 03: Proceedings of the 2003 ACM SIGPLAN workshop on Mechanized reasoning about languages with variable binding, pages 1 7, New York, NY, USA, ACM Press. 12. André Hirschowitz and Marco Maggesi. The algebraicity of the lambdacalculus. arxiv:math/ v1, S. Peyton Jones, editor. Haskell 98 Language and Libraries, The Revised Report. Cambridge University Press, Muriel Livernet. From left modules to algebras over an operad: application to combinatorial Hopf algebras. arxiv:math/ v1, Saunders Mac Lane. Categories for the working mathematician, volume 5 of Graduate Texts in Mathematics. SpringerVerlag, New York, second edition, Martin Markl. Models for operads. arxiv:hepth/ v1, Martin Markl. A compactification of the real configuration space as an operadic completion. arxiv:hepth/ v1, Ralph Matthes and Tarmo Uustalu. Substitution in nonwellfounded syntax with variable binding. Theor. Comput. Sci., 327(12): , V. A. Smirnov. Homotopy theory of coalgebras. Math. USSR Izv,, 27: , Miki Tanaka and John Power. A unified categorytheoretic formulation of typed binding signatures. In MERLIN 05: Proceedings of the 3rd ACM SIGPLAN workshop on Mechanized reasoning about languages with variable binding, pages 13 24, New York, NY, USA, ACM Press. 21. Miki Tanaka and John Power. Pseudodistributive laws and axiomatics for variable binding. Higher Order Symbol. Comput., 19(23): , Julianna Zsidó. Le lambda calcul vu comme monade initiale. Master s thesis, Université de Nice Laboratoire J. A. Dieudonné, 2005/06. Mémoire de Recherche master 2.
Parametric Domaintheoretic models of Linear Abadi & Plotkin Logic
Parametric Domaintheoretic models of Linear Abadi & Plotkin Logic Lars Birkedal Rasmus Ejlers Møgelberg Rasmus Lerchedahl Petersen IT University Technical Report Series TR007 ISSN 600 600 February 00
More informationNOTES ON CATEGORIES AND FUNCTORS
NOTES ON CATEGORIES AND FUNCTORS These notes collect basic definitions and facts about categories and functors that have been mentioned in the Homological Algebra course. For further reading about category
More informationFACTORING POLYNOMIALS IN THE RING OF FORMAL POWER SERIES OVER Z
FACTORING POLYNOMIALS IN THE RING OF FORMAL POWER SERIES OVER Z DANIEL BIRMAJER, JUAN B GIL, AND MICHAEL WEINER Abstract We consider polynomials with integer coefficients and discuss their factorization
More informationCHAPTER 5: MODULAR ARITHMETIC
CHAPTER 5: MODULAR ARITHMETIC LECTURE NOTES FOR MATH 378 (CSUSM, SPRING 2009). WAYNE AITKEN 1. Introduction In this chapter we will consider congruence modulo m, and explore the associated arithmetic called
More informationQuotient Rings and Field Extensions
Chapter 5 Quotient Rings and Field Extensions In this chapter we describe a method for producing field extension of a given field. If F is a field, then a field extension is a field K that contains F.
More informationChapter 4, Arithmetic in F [x] Polynomial arithmetic and the division algorithm.
Chapter 4, Arithmetic in F [x] Polynomial arithmetic and the division algorithm. We begin by defining the ring of polynomials with coefficients in a ring R. After some preliminary results, we specialize
More informationWHAT ARE MATHEMATICAL PROOFS AND WHY THEY ARE IMPORTANT?
WHAT ARE MATHEMATICAL PROOFS AND WHY THEY ARE IMPORTANT? introduction Many students seem to have trouble with the notion of a mathematical proof. People that come to a course like Math 216, who certainly
More informationAndrew Pitts chapter for D. Sangorgi and J. Rutten (eds), Advanced Topics in Bisimulation and Coinduction, Cambridge Tracts in Theoretical Computer
Andrew Pitts chapter for D. Sangorgi and J. Rutten (eds), Advanced Topics in Bisimulation and Coinduction, Cambridge Tracts in Theoretical Computer Science No. 52, chapter 5, pages 197 232 ( c 2011 CUP)
More informationRevision of ring theory
CHAPTER 1 Revision of ring theory 1.1. Basic definitions and examples In this chapter we will revise and extend some of the results on rings that you have studied on previous courses. A ring is an algebraic
More informationominimality and Uniformity in n 1 Graphs
ominimality and Uniformity in n 1 Graphs Reid Dale July 10, 2013 Contents 1 Introduction 2 2 Languages and Structures 2 3 Definability and Tame Geometry 4 4 Applications to n 1 Graphs 6 5 Further Directions
More informationFIBER PRODUCTS AND ZARISKI SHEAVES
FIBER PRODUCTS AND ZARISKI SHEAVES BRIAN OSSERMAN 1. Fiber products and Zariski sheaves We recall the definition of a fiber product: Definition 1.1. Let C be a category, and X, Y, Z objects of C. Fix also
More informationRow Ideals and Fibers of Morphisms
Michigan Math. J. 57 (2008) Row Ideals and Fibers of Morphisms David Eisenbud & Bernd Ulrich Affectionately dedicated to Mel Hochster, who has been an inspiration to us for many years, on the occasion
More informationLinear Algebra I. Ronald van Luijk, 2012
Linear Algebra I Ronald van Luijk, 2012 With many parts from Linear Algebra I by Michael Stoll, 2007 Contents 1. Vector spaces 3 1.1. Examples 3 1.2. Fields 4 1.3. The field of complex numbers. 6 1.4.
More informationThe countdown problem
JFP 12 (6): 609 616, November 2002. c 2002 Cambridge University Press DOI: 10.1017/S0956796801004300 Printed in the United Kingdom 609 F U N C T I O N A L P E A R L The countdown problem GRAHAM HUTTON
More informationExtraction of certified programs with effects from proofs with monadic types in Coq
Extraction of certified programs with effects from proofs with monadic types in Coq Marino Miculan 1 and Marco Paviotti 2 1 Dept. of Mathematics and Computer Science, University of Udine, Italy 2 IT University
More informationElementary Number Theory We begin with a bit of elementary number theory, which is concerned
CONSTRUCTION OF THE FINITE FIELDS Z p S. R. DOTY Elementary Number Theory We begin with a bit of elementary number theory, which is concerned solely with questions about the set of integers Z = {0, ±1,
More informationYou know from calculus that functions play a fundamental role in mathematics.
CHPTER 12 Functions You know from calculus that functions play a fundamental role in mathematics. You likely view a function as a kind of formula that describes a relationship between two (or more) quantities.
More informationSubsets of Euclidean domains possessing a unique division algorithm
Subsets of Euclidean domains possessing a unique division algorithm Andrew D. Lewis 2009/03/16 Abstract Subsets of a Euclidean domain are characterised with the following objectives: (1) ensuring uniqueness
More informationDegree Hypergroupoids Associated with Hypergraphs
Filomat 8:1 (014), 119 19 DOI 10.98/FIL1401119F Published by Faculty of Sciences and Mathematics, University of Niš, Serbia Available at: http://www.pmf.ni.ac.rs/filomat Degree Hypergroupoids Associated
More information(LMCS, p. 317) V.1. First Order Logic. This is the most powerful, most expressive logic that we will examine.
(LMCS, p. 317) V.1 First Order Logic This is the most powerful, most expressive logic that we will examine. Our version of firstorder logic will use the following symbols: variables connectives (,,,,
More information11 Ideals. 11.1 Revisiting Z
11 Ideals The presentation here is somewhat different than the text. In particular, the sections do not match up. We have seen issues with the failure of unique factorization already, e.g., Z[ 5] = O Q(
More informationFIBRATION SEQUENCES AND PULLBACK SQUARES. Contents. 2. Connectivity and fiber sequences. 3
FIRTION SEQUENES ND PULLK SQURES RY MLKIEWIH bstract. We lay out some foundational facts about fibration sequences and pullback squares of topological spaces. We pay careful attention to connectivity ranges
More informationDefining Functions on Equivalence Classes. Lawrence C. Paulson, Computer Laboratory, University of Cambridge
Defining Functions on Equivalence Classes Lawrence C. Paulson, Computer Laboratory, University of Cambridge Outline of Talk 1. Review of equivalence relations and quotients 2. General lemmas for defining
More informationNominal Sets. c 2011 Andrew M. Pitts
Nominal Sets c 2011 Andrew M. Pitts Contents Preface page v 1 Permutations 1 1.1 The category of Gsets 1 1.2 Products and coproducts 3 1.3 Natural numbers 5 1.4 Functions 5 1.5 Power sets 6 1.6 Partial
More informationThe BanachTarski Paradox
University of Oslo MAT2 Project The BanachTarski Paradox Author: Fredrik Meyer Supervisor: Nadia S. Larsen Abstract In its weak form, the BanachTarski paradox states that for any ball in R, it is possible
More informationENRICHED CATEGORIES AND THE FLOYDWARSHALL CONNECTION Vaughan Pratt Computer Science Dept. Stanford University April, 1989
ENRICHED CATEGORIES AND THE FLOYDWARSHALL CONNECTION Vaughan Pratt Computer Science Dept. Stanford University April, 1989 Abstract We give a correspondence between enriched categories and the GaussKleeneFloydWarshall
More informationIntroduction to Finite Fields (cont.)
Chapter 6 Introduction to Finite Fields (cont.) 6.1 Recall Theorem. Z m is a field m is a prime number. Theorem (Subfield Isomorphic to Z p ). Every finite field has the order of a power of a prime number
More informationCONTENTS 1. Peter Kahn. Spring 2007
CONTENTS 1 MATH 304: CONSTRUCTING THE REAL NUMBERS Peter Kahn Spring 2007 Contents 2 The Integers 1 2.1 The basic construction.......................... 1 2.2 Adding integers..............................
More informationFair testing vs. must testing in a fair setting
Fair testing vs. must testing in a fair setting Tom Hirschowitz and Damien Pous Amsterdam, Novembre 2010 Laboratoire de Mathématiques Université de Savoie UMR 5127 Tom Hirschowitz and Damien Pous Fair
More informationON GALOIS REALIZATIONS OF THE 2COVERABLE SYMMETRIC AND ALTERNATING GROUPS
ON GALOIS REALIZATIONS OF THE 2COVERABLE SYMMETRIC AND ALTERNATING GROUPS DANIEL RABAYEV AND JACK SONN Abstract. Let f(x) be a monic polynomial in Z[x] with no rational roots but with roots in Q p for
More informationLocal periods and binary partial words: An algorithm
Local periods and binary partial words: An algorithm F. BlanchetSadri and Ajay Chriscoe Department of Mathematical Sciences University of North Carolina P.O. Box 26170 Greensboro, NC 27402 6170, USA Email:
More informationMathematics Course 111: Algebra I Part IV: Vector Spaces
Mathematics Course 111: Algebra I Part IV: Vector Spaces D. R. Wilkins Academic Year 19967 9 Vector Spaces A vector space over some field K is an algebraic structure consisting of a set V on which are
More informationThe van Hoeij Algorithm for Factoring Polynomials
The van Hoeij Algorithm for Factoring Polynomials Jürgen Klüners Abstract In this survey we report about a new algorithm for factoring polynomials due to Mark van Hoeij. The main idea is that the combinatorial
More informationChapter 1. Logic and Proof
Chapter 1. Logic and Proof 1.1 Remark: A little over 100 years ago, it was found that some mathematical proofs contained paradoxes, and these paradoxes could be used to prove statements that were known
More information3. Prime and maximal ideals. 3.1. Definitions and Examples.
COMMUTATIVE ALGEBRA 5 3.1. Definitions and Examples. 3. Prime and maximal ideals Definition. An ideal P in a ring A is called prime if P A and if for every pair x, y of elements in A\P we have xy P. Equivalently,
More informationBasic Concepts of Point Set Topology Notes for OU course Math 4853 Spring 2011
Basic Concepts of Point Set Topology Notes for OU course Math 4853 Spring 2011 A. Miller 1. Introduction. The definitions of metric space and topological space were developed in the early 1900 s, largely
More informationA NOTE ON TRIVIAL FIBRATIONS
A NOTE ON TRIVIAL FIBRATIONS Petar Pavešić Fakulteta za Matematiko in Fiziko, Univerza v Ljubljani, Jadranska 19, 1111 Ljubljana, Slovenija petar.pavesic@fmf.unilj.si Abstract We study the conditions
More informationCROSSEFFECTS OF HOMOTOPY FUNCTORS AND SPACES OF TREES. WARNING: This paper is a draft and has not been fully checked for errors.
CROSSEFFECTS OF HOMOTOPY FUNCTORS AND SPACES OF TREES MICHAEL CHING WARNING: This paper is a draft and has not been full checked for errors. 1. Total homotop fibres of cubes of based spaces Definition
More information7. Some irreducible polynomials
7. Some irreducible polynomials 7.1 Irreducibles over a finite field 7.2 Worked examples Linear factors x α of a polynomial P (x) with coefficients in a field k correspond precisely to roots α k [1] of
More informationCellular objects and Shelah s singular compactness theorem
Cellular objects and Shelah s singular compactness theorem Logic Colloquium 2015 Helsinki Tibor Beke 1 Jiří Rosický 2 1 University of Massachusetts tibor beke@uml.edu 2 Masaryk University Brno rosicky@math.muni.cz
More informationA CONSTRUCTION OF THE UNIVERSAL COVER AS A FIBER BUNDLE
A CONSTRUCTION OF THE UNIVERSAL COVER AS A FIBER BUNDLE DANIEL A. RAMRAS In these notes we present a construction of the universal cover of a path connected, locally path connected, and semilocally simply
More informationPrime Numbers. Chapter Primes and Composites
Chapter 2 Prime Numbers The term factoring or factorization refers to the process of expressing an integer as the product of two or more integers in a nontrivial way, e.g., 42 = 6 7. Prime numbers are
More informationSo let us begin our quest to find the holy grail of real analysis.
1 Section 5.2 The Complete Ordered Field: Purpose of Section We present an axiomatic description of the real numbers as a complete ordered field. The axioms which describe the arithmetic of the real numbers
More informationProgram equivalence in functional metaprogramming via nominal Scott domains
Program equivalence in functional metaprogramming via nominal Scott domains Steffen Gerhard Lösch Trinity College This dissertation is submitted for the degree of Doctor of Philosophy May 2014 To Niklas,
More informationIntroduction to Algebraic Geometry. Bézout s Theorem and Inflection Points
Introduction to Algebraic Geometry Bézout s Theorem and Inflection Points 1. The resultant. Let K be a field. Then the polynomial ring K[x] is a unique factorisation domain (UFD). Another example of a
More information3. Equivalence Relations. Discussion
3. EQUIVALENCE RELATIONS 33 3. Equivalence Relations 3.1. Definition of an Equivalence Relations. Definition 3.1.1. A relation R on a set A is an equivalence relation if and only if R is reflexive, symmetric,
More informationNondeterministic Semantics and the Undecidability of Boolean BI
1 Nondeterministic Semantics and the Undecidability of Boolean BI DOMINIQUE LARCHEYWENDLING, LORIA CNRS, Nancy, France DIDIER GALMICHE, LORIA Université Henri Poincaré, Nancy, France We solve the open
More informationNotes on Factoring. MA 206 Kurt Bryan
The General Approach Notes on Factoring MA 26 Kurt Bryan Suppose I hand you n, a 2 digit integer and tell you that n is composite, with smallest prime factor around 5 digits. Finding a nontrivial factor
More informationContinued Fractions and the Euclidean Algorithm
Continued Fractions and the Euclidean Algorithm Lecture notes prepared for MATH 326, Spring 997 Department of Mathematics and Statistics University at Albany William F Hammond Table of Contents Introduction
More informationTreerepresentation of set families and applications to combinatorial decompositions
Treerepresentation of set families and applications to combinatorial decompositions BinhMinh BuiXuan a, Michel Habib b Michaël Rao c a Department of Informatics, University of Bergen, Norway. buixuan@ii.uib.no
More informationANAGRAMS: Dimension of triangulated categories
ANAGRAMS: Dimension of triangulated categories Julia Ramos González February 7, 2014 Abstract These notes were prepared for the first session of "Dimension functions" of ANAGRAMS seminar. The goal is to
More informationOnline publication date: 11 March 2010 PLEASE SCROLL DOWN FOR ARTICLE
This article was downloaded by: [Modoi, George Ciprian] On: 12 March 2010 Access details: Access Details: [subscription number 919828804] Publisher Taylor & Francis Informa Ltd Registered in England and
More informationEMBEDDING COUNTABLE PARTIAL ORDERINGS IN THE DEGREES
EMBEDDING COUNTABLE PARTIAL ORDERINGS IN THE ENUMERATION DEGREES AND THE ωenumeration DEGREES MARIYA I. SOSKOVA AND IVAN N. SOSKOV 1. Introduction One of the most basic measures of the complexity of a
More informationMath 3000 Running Glossary
Math 3000 Running Glossary Last Updated on: July 15, 2014 The definition of items marked with a must be known precisely. Chapter 1: 1. A set: A collection of objects called elements. 2. The empty set (
More informationThe fundamental group of the Hawaiian earring is not free (International Journal of Algebra and Computation Vol. 2, No. 1 (1992), 33 37) Bart de Smit
The fundamental group of the Hawaiian earring is not free Bart de Smit The fundamental group of the Hawaiian earring is not free (International Journal of Algebra and Computation Vol. 2, No. 1 (1992),
More informationSOME PROPERTIES OF FIBER PRODUCT PRESERVING BUNDLE FUNCTORS
SOME PROPERTIES OF FIBER PRODUCT PRESERVING BUNDLE FUNCTORS Ivan Kolář Abstract. Let F be a fiber product preserving bundle functor on the category FM m of the proper base order r. We deduce that the rth
More informationEquality and dependent type theory. Oberwolfach, March 2 (with some later corrections)
Oberwolfach, March 2 (with some later corrections) The Axiom of Univalence, a typetheoretic view point In type theory, we reduce proofchecking to typechecking Hence we want typechecking to be decidable
More informationDefinition: Group A group is a set G together with a binary operation on G, satisfying the following axioms: a (b c) = (a b) c.
Algebraic Structures Abstract algebra is the study of algebraic structures. Such a structure consists of a set together with one or more binary operations, which are required to satisfy certain axioms.
More informationFinite Projective demorgan Algebras. honoring Jorge Martínez
Finite Projective demorgan Algebras Simone Bova Vanderbilt University (Nashville TN, USA) joint work with Leonardo Cabrer March 1113, 2011 Vanderbilt University (Nashville TN, USA) honoring Jorge Martínez
More informationORDERS OF ELEMENTS IN A GROUP
ORDERS OF ELEMENTS IN A GROUP KEITH CONRAD 1. Introduction Let G be a group and g G. We say g has finite order if g n = e for some positive integer n. For example, 1 and i have finite order in C, since
More informationNotes on Determinant
ENGG2012B Advanced Engineering Mathematics Notes on Determinant Lecturer: Kenneth Shum Lecture 918/02/2013 The determinant of a system of linear equations determines whether the solution is unique, without
More informationit is easy to see that α = a
21. Polynomial rings Let us now turn out attention to determining the prime elements of a polynomial ring, where the coefficient ring is a field. We already know that such a polynomial ring is a UF. Therefore
More informationINTRODUCTORY SET THEORY
M.Sc. program in mathematics INTRODUCTORY SET THEORY Katalin Károlyi Department of Applied Analysis, Eötvös Loránd University H1088 Budapest, Múzeum krt. 68. CONTENTS 1. SETS Set, equal sets, subset,
More informationSets of Fibre Homotopy Classes and Twisted Order Parameter Spaces
Communications in Mathematical Physics ManuscriptNr. (will be inserted by hand later) Sets of Fibre Homotopy Classes and Twisted Order Parameter Spaces Stefan BechtluftSachs, Marco Hien Naturwissenschaftliche
More information3. Recurrence Recursive Definitions. To construct a recursively defined function:
3. RECURRENCE 10 3. Recurrence 3.1. Recursive Definitions. To construct a recursively defined function: 1. Initial Condition(s) (or basis): Prescribe initial value(s) of the function.. Recursion: Use a
More informationEXERCISES FOR THE COURSE MATH 570, FALL 2010
EXERCISES FOR THE COURSE MATH 570, FALL 2010 EYAL Z. GOREN (1) Let G be a group and H Z(G) a subgroup such that G/H is cyclic. Prove that G is abelian. Conclude that every group of order p 2 (p a prime
More informationON THE EMBEDDING OF BIRKHOFFWITT RINGS IN QUOTIENT FIELDS
ON THE EMBEDDING OF BIRKHOFFWITT RINGS IN QUOTIENT FIELDS DOV TAMARI 1. Introduction and general idea. In this note a natural problem arising in connection with socalled BirkhoffWitt algebras of Lie
More informationThe Mathematics of Origami
The Mathematics of Origami Sheri Yin June 3, 2009 1 Contents 1 Introduction 3 2 Some Basics in Abstract Algebra 4 2.1 Groups................................. 4 2.2 Ring..................................
More informationSummary Last Lecture. Automated Reasoning. Outline of the Lecture. Definition sequent calculus. Theorem (Normalisation and Strong Normalisation)
Summary Summary Last Lecture sequent calculus Automated Reasoning Georg Moser Institute of Computer Science @ UIBK Winter 013 (Normalisation and Strong Normalisation) let Π be a proof in minimal logic
More informationMATHEMATICAL INDUCTION AND DIFFERENCE EQUATIONS
1 CHAPTER 6. MATHEMATICAL INDUCTION AND DIFFERENCE EQUATIONS 1 INSTITIÚID TEICNEOLAÍOCHTA CHEATHARLACH INSTITUTE OF TECHNOLOGY CARLOW MATHEMATICAL INDUCTION AND DIFFERENCE EQUATIONS 1 Introduction Recurrence
More informationChapter 6 Finite sets and infinite sets. Copyright 2013, 2005, 2001 Pearson Education, Inc. Section 3.1, Slide 1
Chapter 6 Finite sets and infinite sets Copyright 013, 005, 001 Pearson Education, Inc. Section 3.1, Slide 1 Section 6. PROPERTIES OF THE NATURE NUMBERS 013 Pearson Education, Inc.1 Slide Recall that denotes
More informationCHAPTER 7 GENERAL PROOF SYSTEMS
CHAPTER 7 GENERAL PROOF SYSTEMS 1 Introduction Proof systems are built to prove statements. They can be thought as an inference machine with special statements, called provable statements, or sometimes
More informationSets and Cardinality Notes for C. F. Miller
Sets and Cardinality Notes for 620111 C. F. Miller Semester 1, 2000 Abstract These lecture notes were compiled in the Department of Mathematics and Statistics in the University of Melbourne for the use
More informationMathematical Induction
Chapter 2 Mathematical Induction 2.1 First Examples Suppose we want to find a simple formula for the sum of the first n odd numbers: 1 + 3 + 5 +... + (2n 1) = n (2k 1). How might we proceed? The most natural
More informationSystem Description: Delphin A Functional Programming Language for Deductive Systems
System Description: Delphin A Functional Programming Language for Deductive Systems Adam Poswolsky 1 and Carsten Schürmann 2 1 Yale University poswolsky@cs.yale.edu 2 IT University of Copenhagen carsten@itu.dk
More informationRelations Graphical View
Relations Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry Introduction Recall that a relation between elements of two sets is a subset of their Cartesian product (of ordered pairs). A binary
More informationFUNCTIONAL ANALYSIS LECTURE NOTES: QUOTIENT SPACES
FUNCTIONAL ANALYSIS LECTURE NOTES: QUOTIENT SPACES CHRISTOPHER HEIL 1. Cosets and the Quotient Space Any vector space is an abelian group under the operation of vector addition. So, if you are have studied
More informationIt is not immediately obvious that this should even give an integer. Since 1 < 1 5
Math 163  Introductory Seminar Lehigh University Spring 8 Notes on Fibonacci numbers, binomial coefficients and mathematical induction These are mostly notes from a previous class and thus include some
More informationIt is time to prove some theorems. There are various strategies for doing
CHAPTER 4 Direct Proof It is time to prove some theorems. There are various strategies for doing this; we now examine the most straightforward approach, a technique called direct proof. As we begin, it
More informationRegular Expressions with Nested Levels of Back Referencing Form a Hierarchy
Regular Expressions with Nested Levels of Back Referencing Form a Hierarchy Kim S. Larsen Odense University Abstract For many years, regular expressions with back referencing have been used in a variety
More informationIn mathematics you don t understand things. You just get used to them. (Attributed to John von Neumann)
Chapter 1 Sets and Functions We understand a set to be any collection M of certain distinct objects of our thought or intuition (called the elements of M) into a whole. (Georg Cantor, 1895) In mathematics
More information4.1 Modules, Homomorphisms, and Exact Sequences
Chapter 4 Modules We always assume that R is a ring with unity 1 R. 4.1 Modules, Homomorphisms, and Exact Sequences A fundamental example of groups is the symmetric group S Ω on a set Ω. By Cayley s Theorem,
More informationCartesian Products and Relations
Cartesian Products and Relations Definition (Cartesian product) If A and B are sets, the Cartesian product of A and B is the set A B = {(a, b) :(a A) and (b B)}. The following points are worth special
More informationA Note on Context Logic
A Note on Context Logic Philippa Gardner Imperial College London This note describes joint work with Cristiano Calcagno and Uri Zarfaty. It introduces the general theory of Context Logic, and has been
More informationComputing divisors and common multiples of quasilinear ordinary differential equations
Computing divisors and common multiples of quasilinear ordinary differential equations Dima Grigoriev CNRS, Mathématiques, Université de Lille Villeneuve d Ascq, 59655, France Dmitry.Grigoryev@math.univlille1.fr
More informationFactoring Polynomials
Factoring Polynomials Sue Geller June 19, 2006 Factoring polynomials over the rational numbers, real numbers, and complex numbers has long been a standard topic of high school algebra. With the advent
More informationTHE FUNDAMENTAL THEOREM OF ALGEBRA VIA PROPER MAPS
THE FUNDAMENTAL THEOREM OF ALGEBRA VIA PROPER MAPS KEITH CONRAD 1. Introduction The Fundamental Theorem of Algebra says every nonconstant polynomial with complex coefficients can be factored into linear
More informationABSTRACT ALGEBRA: A STUDY GUIDE FOR BEGINNERS
ABSTRACT ALGEBRA: A STUDY GUIDE FOR BEGINNERS John A. Beachy Northern Illinois University 2014 ii J.A.Beachy This is a supplement to Abstract Algebra, Third Edition by John A. Beachy and William D. Blair
More informationAlgebraic KTheory of Ring Spectra (Lecture 19)
Algebraic KTheory of ing Spectra (Lecture 19) October 17, 2014 Let be an associative ring spectrum (here by associative we mean A or associative up to coherent homotopy; homotopy associativity is not
More informationACTA UNIVERSITATIS APULENSIS No 15/2008 PRODUCTS OF MULTIALGEBRAS AND THEIR FUNDAMENTAL ALGEBRAS. Cosmin Pelea
ACTA UNIVERSITATIS APULENSIS No 15/2008 PRODUCTS OF MULTIALGEBRAS AND THEIR FUNDAMENTAL ALGEBRAS Cosmin Pelea Abstract. An important tool in the hyperstructure theory is the fundamental relation. The factorization
More informationMath 231b Lecture 35. G. Quick
Math 231b Lecture 35 G. Quick 35. Lecture 35: Sphere bundles and the Adams conjecture 35.1. Sphere bundles. Let X be a connected finite cell complex. We saw that the Jhomomorphism could be defined by
More informationMODULAR ARITHMETIC. a smallest member. It is equivalent to the Principle of Mathematical Induction.
MODULAR ARITHMETIC 1 Working With Integers The usual arithmetic operations of addition, subtraction and multiplication can be performed on integers, and the result is always another integer Division, on
More informationChapter 13: Basic ring theory
Chapter 3: Basic ring theory Matthew Macauley Department of Mathematical Sciences Clemson University http://www.math.clemson.edu/~macaule/ Math 42, Spring 24 M. Macauley (Clemson) Chapter 3: Basic ring
More informationRegular Languages and Finite Automata
Regular Languages and Finite Automata 1 Introduction Hing Leung Department of Computer Science New Mexico State University Sep 16, 2010 In 1943, McCulloch and Pitts [4] published a pioneering work on a
More informationCategorical Monads and Computer Programming
London Mathematical Society Impact150 Stories 1 (2015) 9 14 C 2015 Author(s) doi:10.1112/i150lms/t.0002 Categorical Monads and Computer Programming Nick Benton Abstract The categorical notion of monad
More informationDomain Theory: An Introduction
Domain Theory: An Introduction Robert Cartwright Rebecca Parsons Rice University This monograph is an unauthorized revision of Lectures On A Mathematical Theory of Computation by Dana Scott [3]. Scott
More informationCHAPTER 3. Methods of Proofs. 1. Logical Arguments and Formal Proofs
CHAPTER 3 Methods of Proofs 1. Logical Arguments and Formal Proofs 1.1. Basic Terminology. An axiom is a statement that is given to be true. A rule of inference is a logical rule that is used to deduce
More informationMathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson
Mathematics for Computer Science/Software Engineering Notes for the course MSM1F3 Dr. R. A. Wilson October 1996 Chapter 1 Logic Lecture no. 1. We introduce the concept of a proposition, which is a statement
More informationChange Management for Heterogeneous Development Graphs
Change Management for Heterogeneous Development Graphs Serge Autexier, Dieter Hutter, and Till Mossakowski German Research Center for Artificial Intelligence (DFKI GmbH) Bremen, Germany Abstract. The errorprone
More informationChapter 7: Products and quotients
Chapter 7: Products and quotients Matthew Macauley Department of Mathematical Sciences Clemson University http://www.math.clemson.edu/~macaule/ Math 42, Spring 24 M. Macauley (Clemson) Chapter 7: Products
More information