Dependent Types: How is the dependent pair type analogous to a disjoint union?

前端 未结 6 1979
情深已故
情深已故 2021-01-30 10:38

I\'ve been studying dependent types and I understand the following:

  1. Why universal quantification is represented as a dependent function type. ∀(x:A).B(x)
6条回答
  •  没有蜡笔的小新
    2021-01-30 11:17

    Building on Petr Pudlák’s answer, another angle to see this in a purely non-dependent fashion is to notice that the type Either a a is isomorphic to the type (Bool, a). Although the latter is, at first glance, a product, it makes sense to say it’s a sum type, as it is the sum of two instances of a.

    I have to do this example with Either a a instead of Either a b, because for the latter to be expressed as a product, we need – well – dependent types.

提交回复
热议问题