Toward naive type theories David Ripley University of Connecticut - - PowerPoint PPT Presentation

toward naive type theories
SMART_READER_LITE
LIVE PREVIEW

Toward naive type theories David Ripley University of Connecticut - - PowerPoint PPT Presentation

Toward naive type theories David Ripley University of Connecticut http://davewripley.rocks Types Why type theory? Types Why type theory? Type theories are a family of formalisms with a wide range of uses. Invented to block paradox, they


slide-1
SLIDE 1

Toward naive type theories

David Ripley

University of Connecticut http://davewripley.rocks

slide-2
SLIDE 2

Types

Why type theory?

slide-3
SLIDE 3

Types Why type theory?

Type theories are a family of formalisms with a wide range of uses. Invented to block paradox, they have taken on a life of their own.

slide-4
SLIDE 4

Types Why type theory?

They have long been used in the semantics of natural languages and programming languages. Their connection to proofs ties them to formalized, constructive, and proof-relevant mathematics as well.

slide-5
SLIDE 5

Types

Simple types and propositions

slide-6
SLIDE 6

Types Simple types and propositions

The connection to proofs turns on the ability to see propositions as types, and vice versa. Think of each type A as the proposition ‘A is inhabited’,

  • r think of each proposition as the type of its proofs.
slide-7
SLIDE 7

Types Simple types and propositions

It is usual to suppose we can form function types: given types A and B there is a type A → B of functions from A to B.

slide-8
SLIDE 8

Types Simple types and propositions

Γ, x : A ⊢ x : A Γ, x : A ⊢ M : B Γ ⊢ λ(x : A).M : A → B Γ ⊢ M : A → B Γ ⊢ N : A Γ ⊢ MN : B

slide-9
SLIDE 9

Types Simple types and propositions

Simultaneously a logic and a theory of functions. (The logic is Int→.)

slide-10
SLIDE 10

Types Simple types and propositions

Can add other connectives/type formers. For example, conjunctions/pairs: Γ ⊢ M : A Γ ⊢ N : B Γ ⊢ ⟨M, N⟩ : A × B Γ ⊢ M : A × B Γ ⊢ fst(M) : A Γ ⊢ M : A × B Γ ⊢ snd(M) : B

slide-11
SLIDE 11

Types Simple types and propositions

Can get to full propositional Int this way. But to capture even moderately-complex reasoning, we must go beyond propositional.

slide-12
SLIDE 12

Types

Dependent types

slide-13
SLIDE 13

Types Dependent types

How to say ‘Every natural number is ≥ 0’? We want a function type with input type N. But what is its output type?

slide-14
SLIDE 14

Types Dependent types

When given a natural n : N, the function should produce a proof of the proposition that n ≥ 0. That is, the output type depends on the input. (Not on the input’s type; on the input itself!) We need what’s called a dependent function type.

slide-15
SLIDE 15

Types Dependent types

Dependent function types are usually written with a ∏. The proposition that every natural is ≥ 0, then, is the type ∏

n:N

n ≥ 0 Its inhabitants are functions that, when given an n : N, yield a proof that n ≥ 0.

slide-16
SLIDE 16

Types Dependent types

Γ, x : A ⊢ M : B Γ ⊢ λ(x : A)M : ∏

(x:A) B

Γ ⊢ M : ∏

(x:A) B

Γ ⊢ N : A Γ ⊢ MN : B[N/x] When x is not free in B, this is just → again. But it can be free in B, and then this is something new.

slide-17
SLIDE 17

Types Dependent types

Dependent function types give restricted universal quantification. (Similarly, dependent pair types give restricted particular quantification.) So with dependent types, quantification is in the mix; the resulting logic is much more expressive.

slide-18
SLIDE 18

Types

Where do types come from?

slide-19
SLIDE 19

Types Where do types come from?

This is all well and good as a way of forming new types from old. But it doesn’t get us anywhere without some types to start with.

slide-20
SLIDE 20

Types Where do types come from?

One option (Martin-Löf’s original formulation) is to start by assuming Type : Type. This is surprisingly powerful.

slide-21
SLIDE 21

Types Where do types come from?

If we have a type, we can assume a variable in it: Γ ⊢ A : Type Γ, x : A ⊢ x : A If we have Type : Type, then, we can assume our way to types.

slide-22
SLIDE 22

Types Where do types come from?

⊢ Type : Type X : Type ⊢ X : Type X : Type, y : X ⊢ y : X X : Type ⊢ λ(y : X).y : ∏

(y:X) X

⊢ λ(X : Type).λ(y : X).y : ∏

(X:Type)

(y:X) X

This gives the polymorphic identity function. Given any type as an argument, it returns the identity function on that type.

slide-23
SLIDE 23

Types Where do types come from?

⊢ Type : Type X : Type ⊢ X : Type X : Type, y : X ⊢ y : X X : Type ⊢ λ(y : X).y : X → X ⊢ λ(X : Type).λ(y : X).y : ∏

(X:Type) X → X

This gives the polymorphic identity function. Given any type as an argument, it returns the identity function on that type.

slide-24
SLIDE 24

Types Where do types come from?

Type : Type is also elegant. We need some way to say that A is a type; A : Type works well! But if Type isn’t a type, this is no good. More usual is a separate judgment A type.

slide-25
SLIDE 25

Types

Meaning explanations

slide-26
SLIDE 26

Types Meaning explanations

So Type : Type is powerful and elegant. But can it be justified?

slide-27
SLIDE 27

Types Meaning explanations

One attempt to provide an understanding of types: Martin-Löf’s meaning explanations.

slide-28
SLIDE 28

Types Meaning explanations

ME1: To define a type A: say how an object of type A is formed, and how an equality between two objects of type A is formed. ME2: Types A and B are equal when they have the same objects and the same equalities between objects.

slide-29
SLIDE 29

Types Meaning explanations

ME1 examples:

  • to give the type N, we say how to form a natural

and when two are equal

  • to give the type N → N, we say how to form a function

from N to N and when two are equal

  • to give the type Type, we say how to form a type

and when two are equal.

slide-30
SLIDE 30

Types Meaning explanations

But ME1 and ME2 do say how to form a type and when two are equal. According to ME1, then, the two together define Type, the type of types.

slide-31
SLIDE 31

Types Meaning explanations

The inhabitants of Type are then those things formed via ME1 and ME2. Since Type is so formed, we have Type : Type.

slide-32
SLIDE 32

Types Meaning explanations

Thus, Type : Type follows from these meaning explanations. It is not only convenient, but justified.

slide-33
SLIDE 33

Paradoxes and naivete

Paradox

slide-34
SLIDE 34

Paradoxes and naivete Paradox

Few existing dependent type theories allow Type : Type.

slide-35
SLIDE 35

Paradoxes and naivete Paradox

It tends to lead to paradoxes. In Martin-Löf’s original Type : Type system, every type is inhabited. That is, every proposition is provable.

slide-36
SLIDE 36

Paradoxes and naivete Paradox

So in applications to proofs, Type : Type is usually jettisoned. One common replacement is a cumulative hierarchy.

slide-37
SLIDE 37

Paradoxes and naivete Paradox

Types like ∏

X:Type X → X are no good in a cumulative hierarchy.

We have only ∏

X:Ui X → X, with Ui some level universe.

But since we will not have Ui : Ui, functions of this type are not fully polymorphic. We can’t use them to get an identity function on Ui.

slide-38
SLIDE 38

Paradoxes and naivete

Set-theoretic paradox

slide-39
SLIDE 39

Paradoxes and naivete Set-theoretic paradox

This should all smell familiar to set-theoretic paradoxers.

slide-40
SLIDE 40

Paradoxes and naivete Set-theoretic paradox

Playing the role of the meaning explanations, we have either Basic Law V or naive comprehension. These are part of a fine story about sets (sets are the extensions of predicates/open sentences), but they lead to paradoxes.

slide-41
SLIDE 41

Paradoxes and naivete Set-theoretic paradox

Sophisticated set theories are built to avoid these paradoxes. (Many involve cumulative hierarchies.)

slide-42
SLIDE 42

Paradoxes and naivete Set-theoretic paradox

But there are other options. Paradoxes can be blocked or ameliorated by a shift in logic instead, leading to naive set theories.

slide-43
SLIDE 43

Paradoxes and naivete Set-theoretic paradox

Naive set theories can be split into four rough categories:

  • Paraconsistent
  • Paracomplete
  • Noncontractive
  • Nontransitive
slide-44
SLIDE 44

Towards naive type theories

Where to make the change?

slide-45
SLIDE 45

Towards naive type theories Where to make the change?

What I want to suggest, then, is a heterodox type theory. The aim is an approach that holds to Type : Type, while blocking or ameliorating the paradoxes elsewhere.

slide-46
SLIDE 46

Towards naive type theories Where to make the change?

There is much to be learned from existing naive set theories. But the type-theoretic situation is much more constrained.

slide-47
SLIDE 47

Towards naive type theories Where to make the change?

The logic and the type theory can’t be split off from each other; the logic is built from the types in the first place! There are fewer places to tinker, and each place has broader ramifications.

slide-48
SLIDE 48

Towards naive type theories Where to make the change?

Paraconsistent and paracomplete approaches work with distinctive theories of negation. Here, negation is → ⊥.

slide-49
SLIDE 49

Towards naive type theories Where to make the change?

Paracomplete theories work by blocking reductio. So this must go: Γ, x : A ⊢ M : ⊥ Γ ⊢ λ(x : A).M : A → ⊥ Seems unpromising: needs to restrict λ abstraction.

slide-50
SLIDE 50

Towards naive type theories Where to make the change?

Analogs to other naive set theories need to reject: Γ ⊢ M : A → B Γ ⊢ N : A Γ ⊢ MN : B How are we to see → as a function type, then? We need some replacement for this rule. Paraconsistent approaches have nothing to offer here.

slide-51
SLIDE 51

Towards naive type theories Where to make the change?

This leaves noncontractive and nontransitive approaches. Both must reject: Γ ⊢ M : A Γ, x : A ⊢ N : B Γ ⊢ N[M/x] : B[M/x] Seems awkward: can we really not substitute terms for variables? According to nontransitive approaches, really.

slide-52
SLIDE 52

Towards naive type theories Where to make the change?

This leaves noncontractive and nontransitive approaches. Both must reject: Γ ⊢ M : A ∆, x : A ⊢ N : B Γ∆ ⊢ N[M/x] : B[M/x] Seems awkward: can we really not substitute terms for variables? Noncontractive approaches have another option.

slide-53
SLIDE 53

Towards naive type theories Where to make the change?

A different option for function application as well: Γ ⊢ M : A → B ∆ ⊢ N : A Γ∆ ⊢ MN : B Instead of sharing left sides, this rule combines them.

slide-54
SLIDE 54

Towards naive type theories Where to make the change?

By taking special care to avoid using any assumption multiple times, noncontractive set theories avoid paradox-based trouble. Can this adapt to type-theoretic paradoxes?

slide-55
SLIDE 55

Towards naive type theories Where to make the change?

Noncontractive simple type theories are straightforward. What about noncontractive dependent type theories?

slide-56
SLIDE 56

Towards naive type theories Where to make the change?

Alas, here we reach the state of the art. For now, I’m cautiously optimistic.

slide-57
SLIDE 57

Appendix

Naive homotopy type theory?

slide-58
SLIDE 58

Appendix Naive homotopy type theory?

Homotopy type theory adds an axiom to a dependently-typed base. Given types A and B, we have further types A ≃ B and A =Type B.

slide-59
SLIDE 59

Appendix Naive homotopy type theory?

Univalence is an inhabitant of (A ≃ B) ≃ (A =Type B). It is broadly like an extensionality principle.

slide-60
SLIDE 60

Appendix Naive homotopy type theory?

Here’s a worry: noncontractive set theories don’t do well with extensionality. So it’s possible that the kind of type theory I’m after won’t do well with univalence.

slide-61
SLIDE 61

Appendix Naive homotopy type theory?

As usual, the devil is in the pudding. It’s the combination of three factors that causes trouble in the set-theoretic case: naive comprehension extensionality weakening

slide-62
SLIDE 62

Appendix Naive homotopy type theory?

To see whether the same tricks can be pulled in the target type theory would require actually having the target type theory. So: too early to say. But keep an eye on weakening.