Is Hask locally small?

前端 未结 3 1041
遥遥无期
遥遥无期 2021-02-08 05:36

Is the category Hask of haskell objects an example of a locally small category?

http://ncatlab.org/nlab/show/locally+small+category

Maybe not.. hask as cpo htt

相关标签:
3条回答
  • 2021-02-08 06:03

    What is Hask? If it includes all the haskell definable "functions" as morphism then definitly not

    data Big = Big (Big -> Big)
    

    the "hom set" of Big -> Big contains the entire untyped lambda calculus! I doubt it is locally small even if you only allow terminating functions--I think there are no set theoretic models of system-f.

    EDIT: seven years later I can't make heads or tails of what I was trying to say here. Hask has no set theoretic models, in the sense of models which interpret function types as the full sets of functions. That is true, but I don't know what that has to do with the question. It isn't really clear what "Hask" is, but any reasonable answer seems to me would have small homsets (that is, it is locally small).

    The strangeness of my answer from many years past is slightly embarrassing to me. I'm sure I meant something very insightful--I just have no idea what that was, and as worded it seems rather wrong.

    0 讨论(0)
  • 2021-02-08 06:21

    Especially @PhillipJF, here's a try. I'm not trying to make the most accurate or elegant model of Hask, I'm just trying to make a model. Critique, please.

    If A is a Haskell type, define a value of type A in Hask to be an equivalence class of well-typed Haskell terms of type A (strings x for which x :: A would be accepted by the type checker), modulo extensional equality. That is, two terms are considered equal if they expand out to the same (possibly infinite) normal form, and two terms which have no hnf are also equal. The fact that this is not decidable is irrelevant, we need only state these conditions set-theoretically, which I have little doubt we can do.

    Let the objects of Hask be Haskell types (primitive types & user-defined types; we will assume that all user-definable types exist and have distinct names. User-defined type definitions are source code, so they are countable. Just name them D0,D1, ... according to that counting.).

    Let the morphisms A -> B be values of type A -> B

    Let the identity on A be the equivalence class of id :: A -> A, and similarly let composition of g and f be the equivalence class of g . f.

    The set of all values is a countable set, because terms are just strings over a finite alphabet. So this model of Hask is small.

    Is this wrong?

    0 讨论(0)
  • Hask objects are Haskell types which are countably infinite. Hask arrows are Haskell functions which are also countably infinite. Therefore Hask is not only locally small, Hask is small.

    card(ob(Hask))=card(hom(Hask))=card(N)

    More details about Hask here:

    http://yannesposito.com/Scratch/en/blog/Category-Theory-Presentation/

    0 讨论(0)
提交回复
热议问题