Not signed in (Sign In)

Not signed in

Want to take part in these discussions? Sign in if you have an account, or apply for one below

  • Sign in using OpenID

Site Tag Cloud

2-category 2-category-theory abelian-categories adjoint algebra algebraic algebraic-geometry algebraic-topology analysis analytic-geometry arithmetic arithmetic-geometry book bundles calculus categorical categories category category-theory chern-weil-theory cohesion cohesive-homotopy-type-theory cohomology colimits combinatorics complex complex-geometry computable-mathematics computer-science constructive cosmology deformation-theory descent diagrams differential differential-cohomology differential-equations differential-geometry digraphs duality elliptic-cohomology enriched fibration foundation foundations functional-analysis functor gauge-theory gebra geometric-quantization geometry graph graphs gravity grothendieck group group-theory harmonic-analysis higher higher-algebra higher-category-theory higher-differential-geometry higher-geometry higher-lie-theory higher-topos-theory homological homological-algebra homotopy homotopy-theory homotopy-type-theory index-theory integration integration-theory k-theory lie-theory limits linear linear-algebra locale localization logic mathematics measure-theory modal modal-logic model model-category-theory monad monads monoidal monoidal-category-theory morphism motives motivic-cohomology nforum nlab noncommutative noncommutative-geometry number-theory of operads operator operator-algebra order-theory pages pasting philosophy physics pro-object probability probability-theory quantization quantum quantum-field quantum-field-theory quantum-mechanics quantum-physics quantum-theory question representation representation-theory riemannian-geometry scheme schemes set set-theory sheaf sheaves simplicial space spin-geometry stable-homotopy-theory stack string string-theory superalgebra supergeometry svg symplectic-geometry synthetic-differential-geometry terminology theory topology topos topos-theory tqft type type-theory universal variational-calculus

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

Welcome to nForum
If you want to take part in these discussions either sign in now (if you have an account), apply for one now (if you don't).
    • CommentRowNumber1.
    • CommentAuthorKeithEPeterson
    • CommentTimeJan 23rd 2017

    Added the page Enumerated Type.

    • CommentRowNumber2.
    • CommentAuthorUrs
    • CommentTimeJan 24th 2017
    • (edited Jan 24th 2017)

    I have added a pointer to Wikipedia to the entry, to provide a minimum of substance. Also I have removed the symbols

    n1\coprod_{n \in \mathbb{N}}1

    because these denote not a finite union of unit types, but a countably infinite union. Something else needs to go here.

    • CommentRowNumber3.
    • CommentAuthorKeithEPeterson
    • CommentTimeJan 24th 2017

    Whoops. That’s a dumb mistake on my part. Probably from working with nonstandard infinities too long…

  1. Enum types as used in programming language are sometimes richer than simply a coproduct of unit types. To take Java, one can for instance associate a term of type TT to each element of the enum (introduction rule), which one can extract (elimination rule). One can also define methods within an enum class (i.e. add additional elimination rules).

    • CommentRowNumber5.
    • CommentAuthorMike Shulman
    • CommentTimeJan 24th 2017

    Within type theory, I think that such extensions would no longer be regarded as “enumerated”, only more generally “inductive”. However, it might be less ambiguous to rename this page to something like “finite type”.

  2. OK, that makes sense.

  3. I don’t think they would necessarily only be inductive types in the usual sense, though, due to the possibility to add additional methods (elimination rules)?

    • CommentRowNumber8.
    • CommentAuthorMike Shulman
    • CommentTimeJan 25th 2017

    Methods aren’t elimination rules; they’re just functions that happen to take one or more arguments in a different way, and sometimes have some dynamic resolution of overloading.

    • CommentRowNumber9.
    • CommentAuthorRichard Williamson
    • CommentTimeJan 25th 2017
    • (edited Jan 25th 2017)

    The methods I was referring to are part of the definition of a Java class (= type). By an elimination rule here, I was referring to any rule which is part of the definition of the type, and which takes a term of that type as its input. Whether or not you agree with the terminology, the point I was making was that these rules which may be part of the definition of an enum class (= type) are certainly not introduction or elimination rules coming from the definition of an inductive type.

    • CommentRowNumber10.
    • CommentAuthorMike Shulman
    • CommentTimeJan 26th 2017

    Mathematically, however, they do not affect what type you are defining or what rules / universal properties govern it. You could just as well have defined them afterwards instead of as “part of the definition”; the only difference is that then Java wouldn’t allow you to use the same syntactic sugar to call them.

    • CommentRowNumber11.
    • CommentAuthorKeithEPeterson
    • CommentTimeJan 26th 2017

    @4

    I just made the page and plan to add more information.

    That being said…

    Every type, by being a type, has introduction and elimination rules. It would be redundant to say “an enumerated type is a coproduct of unit types with introduction and elimination rules.” Also, because of the equivalence between types and categories, coproducts already have introduction and elimination rules, so it would be doubly redundant.

    What’s more interesting is how introduction and elimination rules of emun. types change in the presence of products. Is there strengthening? Distribution? Eliminations?

  4. Regarding 10: This is not the case, and is exactly my point. Typically a Java class has private final variables which are set once and for all when an object (term) of that class is constructed (the introduction rule is called). These private variables can and typically are used in the methods defined in the class. They cannot be used outside the class for methods involving objects (terms) of that class. This is why I think it very apt to think of the methods inside a class as elimination rules: they are closely related to the introduction rules in the usual kind of way.

  5. (I should perhaps say that a principal part of my job is programming in Java, so I have a fair idea of what I am talking about :-)).

    • CommentRowNumber14.
    • CommentAuthorMike Shulman
    • CommentTimeJan 27th 2017

    Well, I’m not a PL-theory person myself, but my impression is that usually when modeling programming languages mathematically, the access-control rules like private/public markers on class members are described at a different level from the underlying data structures. Mathematically, you can do anything with the data that is determined by its universal property, and that’s what I would call the elimination rule. Whether a programming language lets you impose some further scoping restrictions is, I would say, a separate question.

    In any case, for the most part nLab pages are about mathematics, not programming, and when we talk about type theory we mean formal systems for mathematics, so I think that’s the relevant context here.

    • CommentRowNumber15.
    • CommentAuthorRichard Williamson
    • CommentTimeJan 27th 2017
    • (edited Jan 27th 2017)

    I think that to ignore how type theories are implemented in or reflect actual programming languages is a very limiting perspective :-).

    I’m not sure how familiar you are with Java, or object-oriented programming languages in general, but what I am describing is rather fundamental. The methods of a class are part of its universal property, if we assume that this language is appropriate. If one wishes to construct a method (function) outside the class, one has available only the methods/elimination rules it exposes, not the internal parts of the class. In other words, object oriented programming languages such as Java allow a very rich way to define types, so rich that even very basic ways to construct types from other types (product types for instance) are not part of the standard library, and have no special syntax (Java has no tuples, for instance). In particular, I don’t think there is any way to fit the possible types into a simple framework such as inductive types. The public/private distinction is not so important, the main thing is that one can define rules which take (the data of) of a term (object) of that type (class) as input. If this is not an elimination rule, I do not know what is. Note that even if one constructs a Pair class in Java, one would need to add getters (projections, i.e. elimination rules) by hand as methods of the class; there is no canonical way to obtain them, one has complete freedom to add whatever elimination rules one likes.

    • CommentRowNumber16.
    • CommentAuthorMike Shulman
    • CommentTimeJan 27th 2017

    I’m fairly familiar with OOP, as well as with the arguments for and against it versus other approaches such as functional programming. I did not say that implementation is ignored, only that it is described at a different level. First there is a type theory that describes mathematically what the objects are; then you can add all sorts of bells and whistles on top of that. Nothing stops you from studying the bells and whistles mathematically as well, and people do – the point is just that the type theory that we’re writing about on the nLab is for the most part only about the first level, since that is, for the most part, the more relevant one to the rest of mathematics.

  6. What I am saying is that Java’s type system does not fit into one of the standard paradigms that are studied so far on the nLab, even for something as simple as an enum type. It is not an implementation detail, it is a fundamental part of the type theory that underlies the language. I do not know a nice way to model this type theory mathematically. People may or may not find that question interesting.

    • CommentRowNumber18.
    • CommentAuthorMike Shulman
    • CommentTimeJan 28th 2017

    If you’re interested in type systems that model more complicated aspects of programming languages like that, I believe there is a large literature on them. One place to start might be Bob Harper’s Practical Foundations of Programming Languages. Personally, I’m not very interested in that sort of type theory; since I’m a mathematician and not a programmer (at least, not by profession – I certainly do plenty of programming), I care more about the aspects of type theory that are applicable to mathematics. I expect the same is true of other nLab contributors (and after all, the nLab is billed as being about “mathematics, physics, and philosophy”, not programming (-: ). But there’s nothing intrinsically wrong with that kind of type theory.

    • CommentRowNumber19.
    • CommentAuthorRichard Williamson
    • CommentTimeJan 28th 2017
    • (edited Jan 28th 2017)

    I believe there is a large literature on them.

    I imagine that there is indeed. I’ve not seen anything which views the type theory behind Java in quite the way I was suggesting, but I would not be surprised at all to find something. In general, I am rather interested in these kind of type theories, in which one adds a lot of rules by hand, rather than trying to force things into a well-known formalism. (Of course there is much more to Java’s type system than the things I mentioned. Monads have become quite well known recently, for instance, and there are some examples in the standard library (eg, the Optional class, which is basically Java’s version of the Maybe monad), although no special syntax or monadic-level stuff yet, though again it is perfectly possible to write this oneself, one just lacks syntactical sugar.)

    • CommentRowNumber20.
    • CommentAuthorKeithEPeterson
    • CommentTimeJan 28th 2017

    Part of the power of category theory and type theory is to actively ignore and hide implementation details so as to focus on universal properties that occur in many areas of mathematics, programming, logic, philosophy, and in life in general.

    However, that being said, why not start a page on private/public typing for us, Richard? I’m sure there a use for it mathematics, and we could all be overlooking that.

    • CommentRowNumber21.
    • CommentAuthorMike Shulman
    • CommentTimeJan 29th 2017

    I’d be more inclined to wait on starting a page until we actually have something mathematical to say about them, or at least a reference to give.

  7. Richard: I am mostly unfamiliar with the extensive literature on OOP, but there is an old paper by Reynolds that you might enjoy, because it articulates some distinctions which I think are related to what you are getting at:

    • John C. Reynolds, User-defined types and procedural data structures as complementary approaches to data abstraction. In New Advances in Algorithmic Languages. INRIA, 1975. (pdf)
  8. Noam: Thanks very much, this paper was very interesting indeed. I had never come across it before. It is very much along the lines I was sketching.

    Keith: I feel that the public/private modifier is not really at the heart of things, and tried to explain this a bit above. The fact that I used private variables in the example I mentioned was just to help illustrate the point I was making more clearly (and it is also what Java programmers typically do in practise).

    • CommentRowNumber24.
    • CommentAuthorKeithEPeterson
    • CommentTimeJan 31st 2017
    • (edited Jan 31st 2017)

    @5 Mike, Another name for these would be Finite Pointed Types.

    These things make very nice subobject/subtype classifiers.

    • CommentRowNumber25.
    • CommentAuthorMike Shulman
    • CommentTimeJan 31st 2017

    I don’t understand. A finite type isn’t necessarily pointed.

    • CommentRowNumber26.
    • CommentAuthorKeithEPeterson
    • CommentTimeFeb 1st 2017

    From pointed object

    If CC has finite coproducts, this functor has a left adjoint functor which takes an object XX to the coproduct 1⊔XX, equipped with its obvious point (this functor underlies the “maybe monad”). This is often written X +X_+ and called “XX with a disjoint basepoint adjoined.” A pointed object is equivalently a module over a monad of this monad.

    If our pointed object XX is some Enumerated Type of the form: 1111\sqcup1\sqcup\cdots\sqcup1, then 1⊔XX is another Enumerated Type, no?

    • CommentRowNumber27.
    • CommentAuthorMike Shulman
    • CommentTimeFeb 1st 2017

    A pointed type is one that’s equipped with a point, whereas if you’re just given 1111\sqcup1\sqcup\cdots\sqcup1 then none of those 11s is singled out as the point. Furthermore, the empty type is also finite (it’s the coproduct of zero copies of 11), but of course cannot be given any point.