6 ms·
> (Static) types may be seen as propositions, but this is just one interpretation of them. We can also interpret types as sets (although this doesn't work out v
by naasking 10y ago
> (Static) types may be seen as propositions, but this is just one interpretation of them. We can also interpret types as sets (although this doesn't work out very well except in very simple languages), as domains (most commonly), as cpos, as relations over closed terms (PERs), and so forth.
Right, I wasn't advancing the propositional definition as the only one, merely as one that sufficiently captures the generality, because the article's current definition of types-as-sets is insufficiently general.
- catnaroek 10y agoUnder HoTT's take on propositions as “types where any two inhabitants are equal”, “types as propositions” is even less general than “types as sets”. As I stated in a comment on that gist, what types denote varies from one type system to another: https://gist.github.com/garybernhardt/122909856b570c5c457a6cd674795a9c?#gistcomment-1856634 https://gist.github.com/garybernhardt/122909856b570c5c457a6c...
- naasking 10y agoNo one except mathematicians and type theorists are using HoTT, where every programmer in existence is using first-order and sometimes second-order logic. I think it should be obvious which is more appropriate if this is supposed to be an introduction. The idea that types express propositions in first- or second-order logic about a program one is writing is sufficiently general for every programmer to understand the proper scope of type checking. Types-as-sets is simply false as an introductory concept.
- catnaroek 10y ago> No one except mathematicians and type theorists are using HoTT, Right. > where every programmer in existence is using first-order and sometimes second-order logic. I'm not so sure about this one. Perhaps by “programmer” you mean “every Haskell programmer”? Even then I'm still not sure. Are you counting “let's approximate `forall x. P(x)` with the large but finite conjunction `P(a) /\ P(b) /\ P(c) ...`” as “using first-order logic”?
- naasking 10y agoI mean pretty much every programmer, even C programmers. Simple business logic is rife with such propositions. Note that I didn't say they use first-order logic to encode invariants in types or anything, but they obviously use it everyday to write programs Haskell programmers also use higher order logic, which is also common now in Java and C#.
- catnaroek 10y ago> Note that I didn't say they use first-order logic to encode invariants in types or anything, but they obviously use it everyday to write programs I wasn't talking about types either. Most programmers I've talked to simply can't use formal logic.
- naasking 10y agoHmm, I don't think you're being very charitable. That these programmers can write working programs suggest they sufficiently understand disjunction, conjunction, negation, conditionals and quantification. Perhaps they have trouble abstracting the semantics from their preferred language and/or syntax, but that doesn't mean they don't grasp their meaning.
- catnaroek 10y agoI offer this thread as evidence: https://news.ycombinator.com/item?id=12342583 https://news.ycombinator.com/item?id=12342583
- naasking 10y agoThat's definitely not being charitable. Subtyping has some pretty subtle interaction with other typing features, which is why it's still being studied more than 20 years after Cardelli's "Subtyping Recursive Types". The pernicious conflation of subtyping and subclassing in common OO programming languages just compounds the confusion.
- 10y ago