The Structure of Nuprl's Type Theory

Total Page:16

File Type:pdf, Size:1020Kb

The Structure of Nuprl's Type Theory The Structure of Nuprls Typ e Theory Rob ert L Constable Cornell University Ithaca NY Intro duction Context After my lectures on this topic were delivered in July at Marktob erdorf my col leagues and I made available much more related material b oth at the Nuprl home page on the World Wide Web the Web wwwcscornelleduInfoNuPrlnuprlhtml and in publications some so on to app ear At the Web site the thesis of Jackson and the article byForester are esp ecially relevanttomy lecture Also the Nuprl b o ok is nowavailable on line at the Web site as is the Nuprl reference manual and a host of Nuprl libraries As a result of the ready access to this material and b ecause the material in the Cor nell Technical Rep ort series is part of an expanding digital library whose longevity seems guaranteed I designed this article to concentrate on the material not available elsewhere eg a discussion of the Core Theory and its relation to Nuprl A naive accountofCoreTyp e Theory is esp ecially simple and I think it provides a bridge to understanding the more daunting axiomatization of the Nuprl typ e theory which is used in all of the online libraries This article presents the Core Theory and relates it to a corresp onding part of Nuprl Comparisons are made to set theory as a way to motivate the concepts Typ es and Sets The informal language of mathematics uses typ es and sets but when mathematicians want to b e rigorous ab out a concept they tend to rely on the year old tradition of reducing it to concepts in pure set theory In this article we will nd the rigorous concepts in type theoryFor p edagogical reasons we will often mention the set theory version of a concept as well The idea of a typ e is built up inductively as is the Zermelo hierarchical concept of set We start with primitive types and typeconstructors The Core Theory needed for Nuprl involves only six typ e constructors pro duct disjoint union function space inductive typ e set typ eand quotient typ eWe need some primitive typ es as well void unit Typ eandPropIhavechosen to add coinductivetyp es as well although they are not in Nuprl TheCoreTheory PrimitiveTyp es void is a typ e with no elements unit is a typ e with one element denoted There will b e other primitivetyp es intro duced later Notice in set theory we usually have only one primitive set some innite set usually Sometimes the emptyset is primitiveaswell although it is denable by separation from Comp ound Typ es We build new typ es using typeconstructors These tell us how to construct various kinds of ob jects In pure set theory there is only one kind sets The typ e constructors wecho ose are motivated b oth by mathematical and compu tational considerations So we will see a tight relationship to the notion of type in programming languages The notes by CAR Hoare Notes on Data Structuring make the p ointwell Cartesian Pro ducts If A and B are typ es then so is their pro duct written A B There will b e many formation rules of this form so we adopt a simple convention for stating them We write A is a Type B is a Type A B is a Type The elements of a pro duct are pairs ha bi Sp ecically if a b elongs to A and b b elongs to B then ha bi b elongs to A B We abbreviate this by writing aA bB ha bi A B In programming languages these typ es are generalized to nary pro ducts say A A A They are the basis for dening records n Wesay that ha bi hc di in A B i a c in A and b d in B In set theory equalityisuniformandbuiltinbutintyp e theory we dene equality with each constructor either builtin as in Nurpl or by denition as in this core theory There is essentially only one way to decomp ose pairs Wesay things like take the rst elements of the pair P symb olically wemightsay rstP orofP We can also take the second elementof P secondP orofP Function Space We use the words function space as well as function typ e for historical reasons If A and B are typ es then A B is the typ e of computable functions from A to B These are given by rules which are dened for each a in A and which pro duce a unique valueWe summarize by A is a Type B is a Type A B is a Type The function notation we use informally comes from mathematics texts eg Bour f bakis AlgebraWe write expressions like x b or x b the latter gives a name to the function For example x x is the squaring function on numb ers If b computes to an elementof B when x has value a in A for each athenwesay x b A B We will also use lambda notation xbfor x b The informal rule for typing a function xbistosay that xb A B provided that when x is of typ e A b is of typ e B We can express these typing judgments in the form x A b B The phrase x A declares x to b e of typ e AThetyping rule is then x A b B xb A B If f g are functions we dene their equalityas f g i f xg x for all x in A If f is a function from A to B and aAwe write f a for the value of the function Disjoint Unions also called Discriminated Unions Forming the union of two sets say x y is a basic op eration in set theory It is basic in typ e theory as well but for computational purp oses wewant to discriminate based on whichtyp e an element is in To accomplish this we put tags on the elements to keep them disjoint Here weuse inl and inr as the tags A is a Type B is a Type A B is a Type The memb ership rules are bB a A inl a A B inr b A B Wesay that inl ainl a i a a and likewise for inr b We can now use a case statement to detect the tags and use expressions like if x inl z then some expression in z if x inr z then some expression in z in dening other ob jects The test for inl z or inr z is computable There is an op eration called decide that discriminates on the typ e tags The typing rule and syntax for it are given in terms of a typing judgment of the form E t T where is a list of declarations of the form x A x A called a typing environment The n n A are typ es and x are variables declared to b e of typ e A The rule is i i i E d A B E u A t T E v B t T E decided ut vt T Subtyping Intuitively A is a subtyp e of B i every elementof A is also an elementof B we write this relation as A B Clearly A for any A Notice that A is not a subtyp e of A B since the elements of A in A B have the form inl a Wehave these prop erties however A A B B A B A B A B A B A B A B For A B we also require that a a in A implies a a in B InductiveTyp es Dening typ es in terms of themselves is quite common in programming often p ointers are used in the denition in Pascal and C for example but in languages like ML direct recursive denitions are p ossible For example a list of numb ers L can b e intro duced by a denition like dene type L N N L In due course we will give conditions telling when such denitions are sensible but for now let us understand howelements of sucha typ e are created Basically a typ e of this kind will b e sensible just when we understand exactly what elements b elong to the typ e Clearly elements like inl inl are elements Given them it is clear that inr h inl iinrhinli and generally inr hn inl mi are elements and given these we can also build inr hk inr hn inl mii and so forth In general we can build elements in anyofthetyp es N N Y N N N N Y N N N N N N Y The key question ab out this pro cess is whether wewanttoallow anything else in the typ e L Our decision is nowewant only elements obtained by this nite pro cess In set theorywe can understand similar inductive denitions saya set L suchthat L N N L as least xed p oints of monotonic op erators F Set Set In general given suchanoperatorF wesay that the set inductively dened by F is the least F cl osed set call it I F We dene it as I F fY jF Y Y g We use set theory as a guide to justify recursivetyp e denitions For the sake of dening monotonicitywe use the subtyping relation S T This holds just when the elements of S are also elements of T and the equalityon S and T is the same For example if S T then N N S N N T Def Given a typ e expression F Type Type suchthatifT T then F T F T then write X F X asthetype inductively denedbyF To construct elements of X F X we basically just unwind the denition That is if tFX F X then t XFX Wesay that t t in X F X i t t in F X F X The p ower of recursivetyp es comes from the fact that we can dene total computable functions over them very elegantlyandwe can prove prop erties of elements recursively Recursive denitions are given by this term inda f zb called a recursor or recursiveform It ob eys the computation rule inda f zb evaluates in one step to baz y indy f zbf Note in this rule we use the notation bsx ty to mean that we substitute s for x and t for y in b typing The waywe gure out a typ e for this form is given by a simple rule Wesay that inda f zb is in typ e B provided that a X F X and if when Y is a Typ e and Y X F X and z b elongs to F Y and f maps Y to B then b is of typ e B induction The principle of inductive reasoning over X F X is just this induction Let R X F X and assume that Y is a subtyp e of R and that for all x in Y P x is true This is the induction hyp othesis Then if we can show z F Y P z we can conclude x RP x With this principle and the form indwe can write programs over recursivetyp es and prove prop erties of them The approach presented here is quite abstract so it applies to a large variety of sp ecic programming languages It also stands on its own as a mathematical theory of typ es typing rules We will write these informal rules
Recommended publications
  • Pragmatic Quotient Types in Coq Cyril Cohen
    Pragmatic Quotient Types in Coq Cyril Cohen To cite this version: Cyril Cohen. Pragmatic Quotient Types in Coq. International Conference on Interactive Theorem Proving, Jul 2013, Rennes, France. pp.16. hal-01966714 HAL Id: hal-01966714 https://hal.inria.fr/hal-01966714 Submitted on 29 Dec 2018 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. Pragmatic Quotient Types in Coq Cyril Cohen Department of Computer Science and Engineering University of Gothenburg [email protected] Abstract. In intensional type theory, it is not always possible to form the quotient of a type by an equivalence relation. However, quotients are extremely useful when formalizing mathematics, especially in algebra. We provide a Coq library with a pragmatic approach in two complemen- tary components. First, we provide a framework to work with quotient types in an axiomatic manner. Second, we program construction mecha- nisms for some specific cases where it is possible to build a quotient type. This library was helpful in implementing the types of rational fractions, multivariate polynomials, field extensions and real algebraic numbers. Keywords: Quotient types, Formalization of mathematics, Coq Introduction In set-based mathematics, given some base set S and an equivalence ≡, one may see the quotient (S/ ≡) as the partition {π(x) | x ∈ S} of S into the sets π(x) ˆ= {y ∈ S | x ≡ y}, which are called equivalence classes.
    [Show full text]
  • Multi-Level Constraints
    Multi-Level Constraints Tony Clark1 and Ulrich Frank2 1 Aston University, UK, [email protected] 2 University of Duisburg-Essen, DE, [email protected] Abstract. Meta-modelling and domain-specific modelling languages are supported by multi-level modelling which liberates model-based engi- neering from the traditional two-level type-instance language architec- ture. Proponents of this approach claim that multi-level modelling in- creases the quality of the resulting systems by introducing a second ab- straction dimension and thereby allowing both intra-level abstraction via sub-typing and inter-level abstraction via meta-types. Modelling ap- proaches include constraint languages that are used to express model semantics. Traditional languages, such as OCL, support intra-level con- straints, but not inter-level constraints. This paper motivates the need for multi-level constraints, shows how to implement such a language in a reflexive language architecture and applies multi-level constraints to an example multi-level model. 1 Introduction Conceptual models aim to bridge the gap between natural languages that are required to design and use a system and implementation languages. To this end, general-purpose modelling languages (GPML) like the UML consist of concepts that represent semantic primitives such as class, attribute, etc., that, on the one hand correspond to concepts of foundational ontologies, e.g., [4], and on the other hand can be nicely mapped to corresponding elements of object-oriented programming languages. Since GPML can be used to model a wide range of systems, they promise at- tractive economies of scale. At the same time, their use suffers from the fact that they offer generic concepts only.
    [Show full text]
  • Union Types for Semistructured Data
    Edinburgh Research Explorer Union Types for Semistructured Data Citation for published version: Buneman, P & Pierce, B 1999, Union Types for Semistructured Data. in Union Types for Semistructured Data: 7th International Workshop on Database Programming Languages, DBPL’99 Kinloch Rannoch, UK, September 1–3,1999 Revised Papers. Lecture Notes in Computer Science, vol. 1949, Springer-Verlag GmbH, pp. 184-207. https://doi.org/10.1007/3-540-44543-9_12 Digital Object Identifier (DOI): 10.1007/3-540-44543-9_12 Link: Link to publication record in Edinburgh Research Explorer Document Version: Peer reviewed version Published In: Union Types for Semistructured Data General rights Copyright for the publications made accessible via the Edinburgh Research Explorer is retained by the author(s) and / or other copyright owners and it is a condition of accessing these publications that users recognise and abide by the legal requirements associated with these rights. Take down policy The University of Edinburgh has made every reasonable effort to ensure that Edinburgh Research Explorer content complies with UK legislation. If you believe that the public display of this file breaches copyright please contact [email protected] providing details, and we will remove access to the work immediately and investigate your claim. Download date: 27. Sep. 2021 Union Typ es for Semistructured Data Peter Buneman Benjamin Pierce University of Pennsylvania Dept of Computer Information Science South rd Street Philadelphia PA USA fpeterbcpiercegcisupenn edu Technical
    [Show full text]
  • Djangoshop Release 0.11.2
    djangoSHOP Release 0.11.2 Oct 27, 2017 Contents 1 Software Architecture 1 2 Unique Features of django-SHOP5 3 Upgrading 7 4 Tutorial 9 5 Reference 33 6 How To’s 125 7 Development and Community 131 8 To be written 149 9 License 155 Python Module Index 157 i ii CHAPTER 1 Software Architecture The django-SHOP framework is, as its name implies, a framework and not a software which runs out of the box. Instead, an e-commerce site built upon django-SHOP, always consists of this framework, a bunch of other Django apps and the merchant’s own implementation. While this may seem more complicate than a ready-to-use solution, it gives the programmer enormous advantages during the implementation: Not everything can be “explained” to a software system using graphical user interfaces. After reaching a certain point of complexity, it normally is easier to pour those requirements into executable code, rather than to expect yet another set of configuration buttons. When evaluating django-SHOP with other e-commerce solutions, I therefore suggest to do the following litmus test: Consider a product which shall be sold world-wide. Depending on the country’s origin of the request, use the native language and the local currency. Due to export restrictions, some products can not be sold everywhere. Moreover, in some countries the value added tax is part of the product’s price, and must be stated separately on the invoice, while in other countries, products are advertised using net prices, and tax is added later on the invoice.
    [Show full text]
  • Presentation on Ocaml Internals
    OCaml Internals Implementation of an ML descendant Theophile Ranquet Ecole Pour l’Informatique et les Techniques Avancées SRS 2014 [email protected] November 14, 2013 2 of 113 Table of Contents Variants and subtyping System F Variants Type oddities worth noting Polymorphic variants Cyclic types Subtyping Weak types Implementation details α ! β Compilers Functional programming Values Why functional programming ? Allocation and garbage Combinatory logic : SKI collection The Curry-Howard Compiling correspondence Type inference OCaml and recursion 3 of 113 Variants A tagged union (also called variant, disjoint union, sum type, or algebraic data type) holds a value which may be one of several types, but only one at a time. This is very similar to the logical disjunction, in intuitionistic logic (by the Curry-Howard correspondance). 4 of 113 Variants are very convenient to represent data structures, and implement algorithms on these : 1 d a t a t y p e tree= Leaf 2 | Node of(int ∗ t r e e ∗ t r e e) 3 4 Node(5, Node(1,Leaf,Leaf), Node(3, Leaf, Node(4, Leaf, Leaf))) 5 1 3 4 1 fun countNodes(Leaf)=0 2 | countNodes(Node(int,left,right)) = 3 1 + countNodes(left)+ countNodes(right) 5 of 113 1 t y p e basic_color= 2 | Black| Red| Green| Yellow 3 | Blue| Magenta| Cyan| White 4 t y p e weight= Regular| Bold 5 t y p e color= 6 | Basic of basic_color ∗ w e i g h t 7 | RGB of int ∗ i n t ∗ i n t 8 | Gray of int 9 1 l e t color_to_int= function 2 | Basic(basic_color,weight) −> 3 l e t base= match weight with Bold −> 8 | Regular −> 0 in 4 base+ basic_color_to_int basic_color 5 | RGB(r,g,b) −> 16 +b+g ∗ 6 +r ∗ 36 6 | Grayi −> 232 +i 7 6 of 113 The limit of variants Say we want to handle a color representation with an alpha channel, but just for color_to_int (this implies we do not want to redefine our color type, this would be a hassle elsewhere).
    [Show full text]
  • Arithmetic in MIPS
    6 Arithmetic in MIPS Objectives After completing this lab you will: • know how to do integer arithmetic in MIPS • know how to do floating point arithmetic in MIPS • know about conversion from integer to floating point and from floating point to integer. Introduction The definition of the R2000 architecture includes all integer arithmetic within the actual CPU. Floating point arithmetic is done by one of the four possible coprocessors, namely coprocessor number 1. Integer arithmetic Addition and subtraction are performed on 32 bit numbers held in the general purpose registers (32 bit each). The result is a 32 bit number itself. Two kinds of instructions are included in the instruction set to do integer addition and subtraction: • instructions for signed arithmetic: the 32 bit numbers are considered to be represented in 2’s comple- ment. The execution of the instruction (addition or subtraction) may generate an overflow. • instructions for unsigned arithmetic: the 32 bit numbers are considered to be in standard binary repre- sentation. Executing the instruction will never generate an overflow error even if there is an actual overflow (the result cannot be represented with 32 bits). Multiplication and division may generate results that are larger than 32 bits. The architecture provides two special 32 bit registers that are the destination for multiplication and division instructions. These registers are called hi and lo as to indicate that they hold the higher 32 bits of the result and the lower 32 bits respectively. Special instructions are also provided to move data from these registers into the general purpose ones ($0 to $31).
    [Show full text]
  • Practical Subtyping for System F with Sized (Co-)Induction Rodolphe Lepigre, Christophe Raffalli
    Practical Subtyping for System F with Sized (Co-)Induction Rodolphe Lepigre, Christophe Raffalli To cite this version: Rodolphe Lepigre, Christophe Raffalli. Practical Subtyping for System F with Sized (Co-)Induction. 2017. hal-01289760v3 HAL Id: hal-01289760 https://hal.archives-ouvertes.fr/hal-01289760v3 Preprint submitted on 10 Jul 2017 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. Distributed under a Creative Commons Attribution - NonCommercial - NoDerivatives| 4.0 International License PRACTICAL SUBTYPING FOR SYSTEM F WITH SIZED (CO-)INDUCTION RODOLPHE LEPIGRE AND CHRISTOPHE RAFFALLI LAMA, UMR 5127 CNRS - Universit´eSavoie Mont Blanc e-mail address: frodolphe.lepigre j christophe.raff[email protected] Abstract. We present a rich type system with subtyping for an extension of System F. Our type constructors include sum and product types, universal and existential quanti- fiers, inductive and coinductive types. The latter two may carry annotations allowing the encoding of size invariants that are used to ensure the termination of recursive programs. For example, the termination of quicksort can be derived by showing that partitioning a list does not increase its size. The system deals with complex programs involving mixed induction and coinduction, or even mixed polymorphism and (co-)induction (as for Scott- encoded data types).
    [Show full text]
  • Quotient Types: a Modular Approach
    Quotient Types: A Modular Approach Aleksey Nogin Department of Computer Science Cornell University, Ithaca, NY 14853 [email protected] Abstract. In this paper we introduce a new approach to axiomatizing quotient types in type theory. We suggest replacing the existing mono- lithic rule set by a modular set of rules for a specially chosen set of primitive operations. This modular formalization of quotient types turns out to be much easier to use and free of many limitations of the tradi- tional monolithic formalization. To illustrate the advantages of the new approach, we show how the type of collections (that is known to be very hard to formalize using traditional quotient types) can be naturally for- malized using the new primitives. We also show how modularity allows us to reuse one of the new primitives to simplify and enhance the rules for the set types. 1 Introduction NuPRL type theory differs from most other type theories used in theorem provers in its treatment of equality. In Coq’s Calculus of Constructions, for example, there is a single global equality relation which is not the desired one for many types (e.g. function types). The desired equalities have to be handled explicitly, which is quite burdensome. As in Martin-L¨of type theory [20] (of which NuPRL type theory is an extension), in NuPRL each type comes with its own equality relation (the extensional one in the case of functions), and the typing rules guar- antee that well–typed terms respect these equalities. Semantically, a quotient in NuPRL is trivial to define: it is simply a type with a new equality.
    [Show full text]
  • Mathematics for Computer Scientists (G51MCS) Lecture Notes Autumn 2005
    Mathematics for Computer Scientists (G51MCS) Lecture notes Autumn 2005 Thorsten Altenkirch October 26, 2005 Contents 1 1 Types and sets What is a set? Wikipedia 1 says Informally, a set is just a collection of objects considered as a whole. And what is a type? Wikipedia offers different definitions for different subject areas, but if we look up datatype in Computer Science we learn: In computer science, a datatype (often simply type) is a name or label for a set of values and some operations which can be performed on that set of values. Here the meaning of type refers back to the meaning of sets, but it is hard to see a substantial difference. We may conclude that what is called a set in Mathematics is called a type in Computer Science. Here, we will adopt the computer science terminology and use the term type. But remember to translate this to set when talking to a Mathematician. There is a good reason for this choice: I am going to use the type system of the programming language Haskell to illustrate many important constructions on types and to implement mathematical constructions on a computer. Please note that this course is not an introduction to Haskell, this is done in the 2nd semester in G51FUN. If you want to find out more about Haskell now, I refer to Graham Hutton’s excellent, forthcoming book, whose first seven chapters are available from his web page 2 . The book is going to be published soon and is the course text for G51FUN. Another good source for information about Haskell is the Haskell home page 3 While we are going to use Haskell to illustrate mathematical concepts, Haskell is also a very useful language for lots of other things, from designing user interfaces to controlling robots.
    [Show full text]
  • Categorical Models of Type Theory
    Categorical models of type theory Michael Shulman February 28, 2012 1 / 43 Theories and models Example The theory of a group asserts an identity e, products x · y and inverses x−1 for any x; y, and equalities x · (y · z) = (x · y) · z and x · e = x = e · x and x · x−1 = e. I A model of this theory (in sets) is a particularparticular group, like Z or S3. I A model in spaces is a topological group. I A model in manifolds is a Lie group. I ... 3 / 43 Group objects in categories Definition A group object in a category with finite products is an object G with morphisms e : 1 ! G, m : G × G ! G, and i : G ! G, such that the following diagrams commute. m×1 (e;1) (1;e) G × G × G / G × G / G × G o G F G FF xx 1×m m FF xx FF m xx 1 F x 1 / F# x{ x G × G m G G ! / e / G 1 GO ∆ m G × G / G × G 1×i 4 / 43 Categorical semantics Categorical semantics is a general procedure to go from 1. the theory of a group to 2. the notion of group object in a category. A group object in a category is a model of the theory of a group. Then, anything we can prove formally in the theory of a group will be valid for group objects in any category. 5 / 43 Doctrines For each kind of type theory there is a corresponding kind of structured category in which we consider models.
    [Show full text]
  • Quotient Types — a Modular Approach *,**
    Quotient Types — a Modular Approach ?;?? Aleksey Nogin Department of Computer Science Cornell University Ithaca, NY 14853 E-mail: [email protected] Web: http://nogin.org/ Abstract. In this paper we introduce a new approach to defining quo- tient types in type theory. We suggest replacing the existing monolithic rule set by a modular set of rules for a specially chosen set of primitive operations. This modular formalization of quotient types turns out to be very powerful and free of many limitations of the traditional monolithic formalization. To illustrate the advantages of the new formalization, we show how the type of collections (that is known to be very hard to formal- ize using traditional quotient types) can be naturally formalized using the new primitives. We also show how modularity allows us to reuse one of the new primitives to simplify and enhance the rules for the set types. 1 Introduction NuPRL type theory differs from most other type theories used in theorem provers in its treatment of equality. In Coq’s Calculus of Constructions, for example, there is a single global equality relation which is not the desired one for many types (e.g. function types). The desired equalities have to be handled explicitly, which is quite burdensome. As in Martin-L¨oftype theory [17] (of which NuPRL type theory is an extension), in NuPRL each type comes with its own equality relation (the extensional one in the case of functions), and the typing rules guar- antee that well–typed terms respect these equalities. Semantically, a quotient in NuPRL is trivial to define: it is simply a type with a new equality.
    [Show full text]
  • Algebraic Data Types
    Composite Data Types as Algebra, Logic Recursive Types Algebraic Data Types Christine Rizkallah CSE, UNSW (and data61) Term 3 2019 1 Classes Tuples Structs Unions Records Composite Data Types as Algebra, Logic Recursive Types Composite Data Types Most of the types we have seen so far are basic types, in the sense that they represent built-in machine data representations. Real programming languages feature ways to compose types together to produce new types, such as: 2 Classes Unions Composite Data Types as Algebra, Logic Recursive Types Composite Data Types Most of the types we have seen so far are basic types, in the sense that they represent built-in machine data representations. Real programming languages feature ways to compose types together to produce new types, such as: Tuples Structs Records 3 Unions Composite Data Types as Algebra, Logic Recursive Types Composite Data Types Most of the types we have seen so far are basic types, in the sense that they represent built-in machine data representations. Real programming languages feature ways to compose types together to produce new types, such as: Classes Tuples Structs Records 4 Composite Data Types as Algebra, Logic Recursive Types Composite Data Types Most of the types we have seen so far are basic types, in the sense that they represent built-in machine data representations. Real programming languages feature ways to compose types together to produce new types, such as: Classes Tuples Structs Unions Records 5 Composite Data Types as Algebra, Logic Recursive Types Combining values conjunctively We want to store two things in one value.
    [Show full text]