Inductive Construction in NuprlType Theory using Bar Induction Mark - - PowerPoint PPT Presentation

inductive construction in nuprltype theory using bar
SMART_READER_LITE
LIVE PREVIEW

Inductive Construction in NuprlType Theory using Bar Induction Mark - - PowerPoint PPT Presentation

Inductive Construction in NuprlType Theory using Bar Induction Mark Bickford, Robert Constable May 12, 2014 Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 1/67 Introduction: Two questions What are the fundamental induction


slide-1
SLIDE 1

Inductive Construction in NuprlType Theory using Bar Induction

Mark Bickford, Robert Constable May 12, 2014

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 1/67

slide-2
SLIDE 2

Introduction: Two questions

What are the fundamental induction principles?

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 2/67

slide-3
SLIDE 3

Introduction: Two questions

What are the fundamental induction principles? What are the fundamental type constructors?

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 3/67

slide-4
SLIDE 4

Introduction: Two questions

What are the fundamental induction principles? What are the fundamental type constructors? We are giving two talks on Nuprl and the type theory it implements (CTT 2014). In CTT14 we can reason about untyped computation using a version of Kleene equality. We reason about partial recursive functions using partial types that contain divergent terms.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 4/67

slide-5
SLIDE 5

Introduction: Two questions

What are the fundamental induction principles? What are the fundamental type constructors? We are giving two talks on Nuprl and the type theory it implements (CTT 2014). In CTT14 we can reason about untyped computation using a version of Kleene equality. We reason about partial recursive functions using partial types that contain divergent terms. This talk is about why we have added Brouwer’s Bar Induction and how it answers the first question.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 5/67

slide-6
SLIDE 6

Introduction: Two questions

What are the fundamental induction principles? What are the fundamental type constructors? We are giving two talks on Nuprl and the type theory it implements (CTT 2014). In CTT14 we can reason about untyped computation using a version of Kleene equality. We reason about partial recursive functions using partial types that contain divergent terms. This talk is about why we have added Brouwer’s Bar Induction and how it answers the first question. The talk tomorrow proposes an answer to the second question and shows how we can define the CTT14 types, including the partial types, from a few very basic type constructors.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 6/67

slide-7
SLIDE 7

What is CTT14?

Starts with terms of an untyped computation system:

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 7/67

slide-8
SLIDE 8

What is CTT14?

Starts with terms of an untyped computation system: Canonical terms (values) include integers, tokens, λx.t, t1, t2, inl(t), inr(t), and Ax.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 8/67

slide-9
SLIDE 9

What is CTT14?

Starts with terms of an untyped computation system: Canonical terms (values) include integers, tokens, λx.t, t1, t2, inl(t), inr(t), and Ax. Non-canonical terms include (lazy) application, t1t2, (eager) “call-by-value”, let x := t1 in t2, and general recursion, fix(t), as well as “spread”, “decide”, arithmetic operators, and

  • thers.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 9/67

slide-10
SLIDE 10

Howe’s version of Kleene equality

From term evaluation, Howe (1996) defined a co-inductive approximation relation, t1 ≤ t2, on terms.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 10/67

slide-11
SLIDE 11

Howe’s version of Kleene equality

From term evaluation, Howe (1996) defined a co-inductive approximation relation, t1 ≤ t2, on terms. Computational equivalence ∼ (a congruence) is a ∼ b a ≤ b & b ≤ a.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 11/67

slide-12
SLIDE 12

Howe’s version of Kleene equality

From term evaluation, Howe (1996) defined a co-inductive approximation relation, t1 ≤ t2, on terms. Computational equivalence ∼ (a congruence) is a ∼ b a ≤ b & b ≤ a. Examples: For all terms t, ⊥ ≤ t. (λx.x + 1) 2 ∼ 3. ⊥ ∼ fix(λx.x).

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 12/67

slide-13
SLIDE 13

Howe’s version of Kleene equality

From term evaluation, Howe (1996) defined a co-inductive approximation relation, t1 ≤ t2, on terms. Computational equivalence ∼ (a congruence) is a ∼ b a ≤ b & b ≤ a. Examples: For all terms t, ⊥ ≤ t. (λx.x + 1) 2 ∼ 3. ⊥ ∼ fix(λx.x). The proposition “t has a value” is defined using approx and call-by-value: halts(t) Ax ≤ (let x := t in Ax)

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 13/67

slide-14
SLIDE 14

Nuprl Type System

is built on top of the untyped computation system. Allen (1987) A type is a partial equivalence relation on closed terms.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 14/67

slide-15
SLIDE 15

Nuprl Type System

is built on top of the untyped computation system. Allen (1987) A type is a partial equivalence relation on closed terms. Equality: a =T b Dependent function: a:A → B[a] Dependent product: a:A × B[a] Disjoint union: A + B Universe: Ui i = 0, 1, 2, . . . Subtype: A ⊑ B Quotient: T//E Intersection:

a:A .B[a]

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 15/67

slide-16
SLIDE 16

More Nuprl Types

Kopylov,Nogin (2006) Image: image(T, f ) Subset: {a : A | B[a]} image(a:A × B[a], π1) squash: ↓ P {a : Unit | P} Union:

a:A B[a] image(a:A × B[a], π2)

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 16/67

slide-17
SLIDE 17

More Nuprl Types

Kopylov,Nogin (2006) Image: image(T, f ) Subset: {a : A | B[a]} image(a:A × B[a], π1) squash: ↓ P {a : Unit | P} Union:

a:A B[a] image(a:A × B[a], π2)

Smith (1989), Crary (1998) Partial types: T contains all members of T as well as all divergent terms

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 17/67

slide-18
SLIDE 18

More Nuprl Types

Kopylov,Nogin (2006) Image: image(T, f ) Subset: {a : A | B[a]} image(a:A × B[a], π1) squash: ↓ P {a : Unit | P} Union:

a:A B[a] image(a:A × B[a], π2)

Smith (1989), Crary (1998) Partial types: T contains all members of T as well as all divergent terms Allen’s PER semantics (extended by Smith, Crary, et.al.) defines an inductive construction of universes closed under all

  • f these type constructors. (Defined in Coq by V. Rahli & A.

Anand, ITP 2014)

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 18/67

slide-19
SLIDE 19

Inductive types in CTT14

Types A and B are extensionally equal, A ≡ B, if A ⊑ B & B ⊑ A.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 19/67

slide-20
SLIDE 20

Inductive types in CTT14

Types A and B are extensionally equal, A ≡ B, if A ⊑ B & B ⊑ A. Type T is a fixedpoint of F if T ≡ F(T) and is the least fixedpoint if T ⊑ A when A is a fixedpoint of F.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 20/67

slide-21
SLIDE 21

Inductive types in CTT14

Types A and B are extensionally equal, A ≡ B, if A ⊑ B & B ⊑ A. Type T is a fixedpoint of F if T ≡ F(T) and is the least fixedpoint if T ⊑ A when A is a fixedpoint of F. Equivalently, T is the least fixedpoint of F when the appropriate induction principle holds.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 21/67

slide-22
SLIDE 22

Inductive types in CTT14

Types A and B are extensionally equal, A ≡ B, if A ⊑ B & B ⊑ A. Type T is a fixedpoint of F if T ≡ F(T) and is the least fixedpoint if T ⊑ A when A is a fixedpoint of F. Equivalently, T is the least fixedpoint of F when the appropriate induction principle holds. Rather than add least fixedpoints (for suitable functions F) to the universes as primitive types, we can construct them as subtypes of co-recursive types (which we also construct.)

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 22/67

slide-23
SLIDE 23

Inductive types in CTT14

Types A and B are extensionally equal, A ≡ B, if A ⊑ B & B ⊑ A. Type T is a fixedpoint of F if T ≡ F(T) and is the least fixedpoint if T ⊑ A when A is a fixedpoint of F. Equivalently, T is the least fixedpoint of F when the appropriate induction principle holds. Rather than add least fixedpoints (for suitable functions F) to the universes as primitive types, we can construct them as subtypes of co-recursive types (which we also construct.) The needed induction principle follows from Brouwer’s Bar Induction.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 23/67

slide-24
SLIDE 24

Intersection Types and Corecursive Types

All the co-recursive types we need can be constructed using intersection and induction on N Top

a:Void .Void

This is the PER λx, y.True, so for all types T, T ⊑ Top

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 24/67

slide-25
SLIDE 25

Intersection Types and Corecursive Types

All the co-recursive types we need can be constructed using intersection and induction on N Top

a:Void .Void

This is the PER λx, y.True, so for all types T, T ⊑ Top corec(G) =

  • n:N

.fix(λP.λn.if n = 0 then Top else G (P (n − 1)) ) n i.e.

n:N .G n(Top)

This is the greatest fixedpoint of G if G “preserves ω-limits”.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 25/67

slide-26
SLIDE 26

Intersection Types and Corecursive Types

All the co-recursive types we need can be constructed using intersection and induction on N Top

a:Void .Void

This is the PER λx, y.True, so for all types T, T ⊑ Top corec(G) =

  • n:N

.fix(λP.λn.if n = 0 then Top else G (P (n − 1)) ) n i.e.

n:N .G n(Top)

This is the greatest fixedpoint of G if G “preserves ω-limits”. Aside:

x:T .P(x) is “uniform” all quantifier, ∀[x:T].P(x).

We showed completeness for intuitionistic minimal logic: ⊢IML φ ⇔ ∀[M].M | = φ.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 26/67

slide-27
SLIDE 27

Algebraic Datatypes

For the least fixedpoint DT ≡ F(DT) of an “algebraic” function F, there is a natural size function size ∈ DT → N.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 27/67

slide-28
SLIDE 28

Algebraic Datatypes

For the least fixedpoint DT ≡ F(DT) of an “algebraic” function F, there is a natural size function size ∈ DT → N. On coDT = corec(F) the same function has type coDT → N.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 28/67

slide-29
SLIDE 29

Algebraic Datatypes

For the least fixedpoint DT ≡ F(DT) of an “algebraic” function F, there is a natural size function size ∈ DT → N. On coDT = corec(F) the same function has type coDT → N. Termination: t ∈ T, halts(t) | = t ∈ T

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 29/67

slide-30
SLIDE 30

Algebraic Datatypes

For the least fixedpoint DT ≡ F(DT) of an “algebraic” function F, there is a natural size function size ∈ DT → N. On coDT = corec(F) the same function has type coDT → N. Termination: t ∈ T, halts(t) | = t ∈ T So we can construct DT as {t : coDT | halts(size(t))} and get the induction on DT from induction on size.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 30/67

slide-31
SLIDE 31

Algebraic Datatypes

For the least fixedpoint DT ≡ F(DT) of an “algebraic” function F, there is a natural size function size ∈ DT → N. On coDT = corec(F) the same function has type coDT → N. Termination: t ∈ T, halts(t) | = t ∈ T So we can construct DT as {t : coDT | halts(size(t))} and get the induction on DT from induction on size. The definition of list(T) in Nuprl is now {L : colist(T) | halts(length(L))} where colist(T) corec(λL.Unit ∪ T × L)

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 31/67

slide-32
SLIDE 32

W-types and parameterized families of W-types

We want to construct least fixedpoints W (A; a.B[a]) ≡ a:A × (B[a] → W (A; a.B[a])

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 32/67

slide-33
SLIDE 33

W-types and parameterized families of W-types

We want to construct least fixedpoints W (A; a.B[a]) ≡ a:A × (B[a] → W (A; a.B[a]) and, more generally, a parameterized family of W-types: pW (p.A[p]; p, a.B[p, a]; p, a, b.C[p, a, b]) ≡ λp. a:A[p] × (b:B[p, a] → pW (C[p.a.b]))

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 33/67

slide-34
SLIDE 34

W-types and parameterized families of W-types

We want to construct least fixedpoints W (A; a.B[a]) ≡ a:A × (B[a] → W (A; a.B[a]) and, more generally, a parameterized family of W-types: pW (p.A[p]; p, a.B[p, a]; p, a, b.C[p, a, b]) ≡ λp. a:A[p] × (b:B[p, a] → pW (C[p.a.b])) We can’t define a size function and use induction on N, but we can make an “analogous” construction and get the induction principle from Bar Induction. (For simplicity, we discuss W rather than pW .)

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 34/67

slide-35
SLIDE 35

W-types and parameterized families of W-types

We want to construct least fixedpoints W (A; a.B[a]) ≡ a:A × (B[a] → W (A; a.B[a]) and, more generally, a parameterized family of W-types: pW (p.A[p]; p, a.B[p, a]; p, a, b.C[p, a, b]) ≡ λp. a:A[p] × (b:B[p, a] → pW (C[p.a.b])) We can’t define a size function and use induction on N, but we can make an “analogous” construction and get the induction principle from Bar Induction. (For simplicity, we discuss W rather than pW .) Basic idea: W = {w : co-W | paths starting at w are finite}

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 35/67

slide-36
SLIDE 36

W-type picture

<a,f> a in A f(b) = <a',g> f(b') = <a'',h> b,b',.. in B(a) h(c) = <a,f'> h(c' ) = <a',f''> c,c',... in B(a'')

W (A; a.B[a]) ≡ a:A × (B[a] → W (A; a.B[a]))

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 36/67

slide-37
SLIDE 37

Bar Induction in pictures

nil [t] [t'] [t',c] [t',c'] c,c',..s.t R [t'] c t,t' s.t. R nil t

R is the spread law.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 37/67

slide-38
SLIDE 38

Bar Induction in pictures

nil [t] [t'] [t',c] [t',c'] c,c',..s.t R [t'] c t,t' s.t. R nil t

R is the spread law. If (1) every path is barred.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 38/67

slide-39
SLIDE 39

Bar Induction in pictures

nil [t] [t'] [t',c] [t',c'] c,c',..s.t R [t' ] c t,t' s.t. R nil t

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 39/67

slide-40
SLIDE 40

Bar Induction in pictures

nil [t] [t'] [t',c] [t',c'] c,c',..s.t R [t' ] c t,t' s.t. R nil t

And if Base case: B(s) ⇒ Q(s)

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 40/67

slide-41
SLIDE 41

Bar Induction in pictures

nil [t] [t'] [t',c] [t',c'] c,c',..s.t R [t ' ''] c t,t' s.t. R nil t Q Q Q Q([t]) Q([t'.c'] Q Q

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 41/67

slide-42
SLIDE 42

Bar Induction in pictures

nil [t] [t'] [t',c] [t',c'] c,c',..s.t R [t ' ''] c t,t' s.t. R nil t Q Q Q Q([t]) Q([t'.c'] Q Q

and if Induction step: (∀t.R(s, t) ⇒ Q(s ⊕ t)) ⇒ Q(s)

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 42/67

slide-43
SLIDE 43

Bar Induction in pictures

nil [t] [t'] [t',c] [t',c'] c,c',..s.t R [t'] c t,t' s.t. R nil t Q([t]) Q([t'.c'] Q Q Q

Induction step: (∀t.R(s, t) ⇒ Q(s ⊕ t)) ⇒ Q(s)

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 43/67

slide-44
SLIDE 44

Bar Induction in pictures

nil [t] [t'] [t',c] [t',c'] c,c',..s.t R [t'] t,t' s.t. R nil t Q([t]) Q([t'.c'] Q(t',s']) c

Induction step: (∀t.R(s, t) ⇒ Q(s ⊕ t)) ⇒ Q(s)

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 44/67

slide-45
SLIDE 45

Bar Induction in pictures

nil [t] [t'] [t',c] [t',c'] c,c',..s.t R [t'] t,t' s.t. R nil t Q([t]) Q([t']) c

Induction step: (∀t.R(s, t) ⇒ Q(s ⊕ t)) ⇒ Q(s)

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 45/67

slide-46
SLIDE 46

Bar Induction in pictures

nil [t] [t'] [t',c] [t',c'] c,c',..s.t R [t'] c t,t' s.t. R nil t Q(nil)

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 46/67

slide-47
SLIDE 47

Bar Induction in pictures

nil [t] [t'] [t',c] [t',c'] c,c',..s.t R [t'] c t,t' s.t. R nil t Q(nil)

Then: Q(nil)

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 47/67

slide-48
SLIDE 48

Bar Induction, preliminaries

Brouwer’s bar induction principle, (explicated by Kleene), is about “spreads” of finite sequences (of some type T).

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 48/67

slide-49
SLIDE 49

Bar Induction, preliminaries

Brouwer’s bar induction principle, (explicated by Kleene), is about “spreads” of finite sequences (of some type T). We use s ∈ Vk(T) {i:N | i < k} → T for a sequence s of length k, and s ⊕k t for the sequence of length k + 1 with t appended.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 49/67

slide-50
SLIDE 50

Bar Induction, preliminaries

Brouwer’s bar induction principle, (explicated by Kleene), is about “spreads” of finite sequences (of some type T). We use s ∈ Vk(T) {i:N | i < k} → T for a sequence s of length k, and s ⊕k t for the sequence of length k + 1 with t appended. A relation R ∈ k:N → Vk(T) → T → P is a “spread law” and s is consistent, con(R, k, s), if ∀i < k. R(i, s, s(i)). A function f ∈ N → T is a path, Path(R, f ), if ∀i. R(i, f , f (i)).

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 50/67

slide-51
SLIDE 51

Bar Induction, preliminaries

Brouwer’s bar induction principle, (explicated by Kleene), is about “spreads” of finite sequences (of some type T). We use s ∈ Vk(T) {i:N | i < k} → T for a sequence s of length k, and s ⊕k t for the sequence of length k + 1 with t appended. A relation R ∈ k:N → Vk(T) → T → P is a “spread law” and s is consistent, con(R, k, s), if ∀i < k. R(i, s, s(i)). A function f ∈ N → T is a path, Path(R, f ), if ∀i. R(i, f , f (i)). We state the bar induction rule only for expressions Q(k, s) of the form a(k, s) ∈ X(k, s) with witness Ax.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 51/67

slide-52
SLIDE 52

Bar Induction, preliminaries

Brouwer’s bar induction principle, (explicated by Kleene), is about “spreads” of finite sequences (of some type T). We use s ∈ Vk(T) {i:N | i < k} → T for a sequence s of length k, and s ⊕k t for the sequence of length k + 1 with t appended. A relation R ∈ k:N → Vk(T) → T → P is a “spread law” and s is consistent, con(R, k, s), if ∀i < k. R(i, s, s(i)). A function f ∈ N → T is a path, Path(R, f ), if ∀i. R(i, f , f (i)). We state the bar induction rule only for expressions Q(k, s) of the form a(k, s) ∈ X(k, s) with witness Ax. Bar Induction works “toward the root” from the hypothesis ind(R, T, Q, k, s) ∀t:{t : T | R(k, s, t)}. Q(k + 1, s ⊕ t)

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 52/67

slide-53
SLIDE 53

Bar Induction Rule

H ⊢ T ∈ Type H, k:N, s:Vk(T), t:T ⊢ R(k, s, t) ∈ Type H, k:N , s:Vk(T), con(R, k, s) ⊢ B(k, s) ∨ ¬B(k, s) H, f :N → T, Path(R, f ) ⊢↓∃n:N. B(n, f ) H, k:N , s:Vk(T), con(R, k, s), B(k, s) ⊢ Q(k, s) H, k:N , s:Vk(T), con(R, k, s), ind(R, T, Q, k, s) ⊢ Q(k, s) H ⊢ Q(0, z)

The first two premises prove that R is a spread law. The next two premises prove that B is a decidable bar on the spread. The fifth and sixth premises are the base and induction steps

  • f the proof by bar induction for the term Q(0, z).

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 53/67

slide-54
SLIDE 54

The construction

Let cW = co-W (A, a.B[a]) For w ∈ cW , w = a, f where a ∈ A, f ∈ B[a] → cW

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 54/67

slide-55
SLIDE 55

The construction

Let cW = co-W (A, a.B[a]) For w ∈ cW , w = a, f where a ∈ A, f ∈ B[a] → cW A path will have steps of type TA,B a, f :cW × (B(a) + Unit)

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 55/67

slide-56
SLIDE 56

The construction

Let cW = co-W (A, a.B[a]) For w ∈ cW , w = a, f where a ∈ A, f ∈ B[a] → cW A path will have steps of type TA,B a, f :cW × (B(a) + Unit) The spread law R(k, s, t) is defined to hold when, if the last step in s is a, f , inl(b) then π1(t) = f (b).

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 56/67

slide-57
SLIDE 57

The construction

Let cW = co-W (A, a.B[a]) For w ∈ cW , w = a, f where a ∈ A, f ∈ B[a] → cW A path will have steps of type TA,B a, f :cW × (B(a) + Unit) The spread law R(k, s, t) is defined to hold when, if the last step in s is a, f , inl(b) then π1(t) = f (b). A path g ∈ N → TA,B starts at w if π1(g(0)) = w.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 57/67

slide-58
SLIDE 58

The construction

Let cW = co-W (A, a.B[a]) For w ∈ cW , w = a, f where a ∈ A, f ∈ B[a] → cW A path will have steps of type TA,B a, f :cW × (B(a) + Unit) The spread law R(k, s, t) is defined to hold when, if the last step in s is a, f , inl(b) then π1(t) = f (b). A path g ∈ N → TA,B starts at w if π1(g(0)) = w. The path is barred if ↓ ∃n : N. isr(π2(g(n))).

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 58/67

slide-59
SLIDE 59

The construction

Let cW = co-W (A, a.B[a]) For w ∈ cW , w = a, f where a ∈ A, f ∈ B[a] → cW A path will have steps of type TA,B a, f :cW × (B(a) + Unit) The spread law R(k, s, t) is defined to hold when, if the last step in s is a, f , inl(b) then π1(t) = f (b). A path g ∈ N → TA,B starts at w if π1(g(0)) = w. The path is barred if ↓ ∃n : N. isr(π2(g(n))). So, we define W {w : cW | every path g stating at w is barred}

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 59/67

slide-60
SLIDE 60

The result

The induction principle Ind(W , P) for W is (∀a:A. ∀f :B[a] → W . (∀b:B[a]. P(f (b))) ⇒ P(a, f )) ⇒ (∀w:W . P(w))

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 60/67

slide-61
SLIDE 61

The result

The induction principle Ind(W , P) for W is (∀a:A. ∀f :B[a] → W . (∀b:B[a]. P(f (b))) ⇒ P(a, f )) ⇒ (∀w:W . P(w)) We use the Bar Induction Rule to prove that λH.λw. fix(λG.λw. let a, f = w in H(a, f , λb.G(f (b))))w ∈ Ind(W , P)

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 61/67

slide-62
SLIDE 62

The result

The induction principle Ind(W , P) for W is (∀a:A. ∀f :B[a] → W . (∀b:B[a]. P(f (b))) ⇒ P(a, f )) ⇒ (∀w:W . P(w)) We use the Bar Induction Rule to prove that λH.λw. fix(λG.λw. let a, f = w in H(a, f , λb.G(f (b))))w ∈ Ind(W , P) (suitably generalized for the more general case of the parameterized family pW (A, B, C) )

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 62/67

slide-63
SLIDE 63

Primitive Inductive types not needed

In the abstract we wrote: “we could replace all the primitive rec-types”

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 63/67

slide-64
SLIDE 64

Primitive Inductive types not needed

In the abstract we wrote: “we could replace all the primitive rec-types” Since then, we have constructed all recursive types with one of these two constructions (that use a subtype of a co-recursive type).

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 64/67

slide-65
SLIDE 65

Primitive Inductive types not needed

In the abstract we wrote: “we could replace all the primitive rec-types” Since then, we have constructed all recursive types with one of these two constructions (that use a subtype of a co-recursive type). We redefined the necessary tactics for induction and our code for generating algebraic datatypes.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 65/67

slide-66
SLIDE 66

Primitive Inductive types not needed

In the abstract we wrote: “we could replace all the primitive rec-types” Since then, we have constructed all recursive types with one of these two constructions (that use a subtype of a co-recursive type). We redefined the necessary tactics for induction and our code for generating algebraic datatypes. Then we “deactivated” the rules for the primitive rec-type (Nuprl is a logical framework and interprets the rules in its library). Everything in the library (about 15K lemmas) was rebuilt. About two weeks work.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 66/67

slide-67
SLIDE 67

Primitive Inductive types not needed

In the abstract we wrote: “we could replace all the primitive rec-types” Since then, we have constructed all recursive types with one of these two constructions (that use a subtype of a co-recursive type). We redefined the necessary tactics for induction and our code for generating algebraic datatypes. Then we “deactivated” the rules for the primitive rec-type (Nuprl is a logical framework and interprets the rules in its library). Everything in the library (about 15K lemmas) was rebuilt. About two weeks work. So, induction on N and Bar Induction are the only induction principles we need.

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 67/67

slide-68
SLIDE 68

Further Reading

S.C. Kleene and R. E. Vesley, Foundations of Inuitionistic

  • Mathematics. 1966 (breakthrough document that inspired

Martin-Lof, and others) Stuart F. Allen, A Non-Type-Theoretic Semantics for Type-Theoretic Language. 1987 Karl Crary, Type-Theoretic Methodology for Practical Programming Languages. 1998 Scott F Smith, Partial Objects in Type Theory. 1989 Constable & Smith. Computational Foundations of Basic Recursive function Theory. 1993 Stuart F. Allen, An Abstract Semantics for Atoms in Nuprl. 2006

Mark Bickford, Robert Constable TYPES 2014 May 12, 2014 68/67