Core type theory David Ripley Monash University - - PowerPoint PPT Presentation

core type theory
SMART_READER_LITE
LIVE PREVIEW

Core type theory David Ripley Monash University - - PowerPoint PPT Presentation

Core type theory David Ripley Monash University http://davewripley.rocks Core logic Core logic What is it? Core logic (aka intuitionistic relevant logic) is a system of logic devised and developed by Neil Tennant over the last 40ish


slide-1
SLIDE 1

Core type theory

David Ripley

Monash University http://davewripley.rocks

slide-2
SLIDE 2

Core logic

slide-3
SLIDE 3

Core logic What is it?

Core logic (aka ‘intuitionistic relevant logic’) is a system of logic devised and developed by Neil Tennant

  • ver the last 40ish years.
slide-4
SLIDE 4

Core logic What is it?

No, not that Neil Tennant

(At least I don’t think so.)

slide-5
SLIDE 5

Core logic What is it?

No, not that Neil Tennant

(At least I don’t think so.)

slide-6
SLIDE 6

Core logic What is it?

[φ]n . . . ψ

→In:

φ → ψ [φ]n . . .

  • →I!n:

φ → ψ φ → ψ φ [ψ]n . . . θ

→E:

θ [φ]n . . .

  • ¬In:

¬φ ¬φ φ

¬E:

  • In →I and →E, discharge may be vacuous.

In →I! and ¬I, discharge must not be vacuous.

slide-7
SLIDE 7

Core logic What is it?

As it stands, that’s a proof system for intuitionistic logic. With the additional restriction that major premises for elimination must be assumptions, we get to core logic. (Caveat: this isn’t exactly how Tennant does it. His proofs are more restrictive. But all the same things are provable.)

slide-8
SLIDE 8

Core logic What is it?

Let an argument Γ C be core valid iff: there is a core proof of C whose open assumptions are all in Γ. Then core validity is not closed under cut: ¬φ φ → ψ and φ → ψ, φ ψ are both core valid, but ¬φ, φ ψ is not. Rather, ¬φ, φ is.

slide-9
SLIDE 9

Core logic What is it?

Core validity is closely related to intuitionistic validity: Results (Tennant):

  • Γ ⊢Core iff Γ ⊢Int ⊥
  • If Γ ̸⊢ , then Γ ⊢Int φ iff Γ ⊢ φ

The difference is in what follows from inconsistent premise sets.

slide-10
SLIDE 10

Curry-Howard

slide-11
SLIDE 11

Curry-Howard Types

The simply-typed lambda calculus encodes a theory of typed data and functions on that data. This is importantly connected to intuitionistic logic, via the Curry-Howard correspondence.

slide-12
SLIDE 12

Curry-Howard Types

Our types are atoms, or ⊥, or formed by → from other types. ⊥ is interpreted as an empty type, and φ → ψ the type of functions that take an input of type φ and give an output of type ψ.

slide-13
SLIDE 13

Curry-Howard Terms

There are variables xϕ, yϕ, zϕ, . . . of each type φ, (variables are assumptions) given terms Mϕ→ψ and Nϕ, there is (MNϕ)ψ, (function application is modus ponens) given a variable xϕ and a term Mψ, there is (λx.M)ϕ→ψ, (function formation is conditional proof; variable binding is discharging an assumption) given a term M⊥, there is (explode M)ϕ. (crying uncle is explosion)

slide-14
SLIDE 14

Curry-Howard Terms

There are variables xϕ, yϕ, zϕ, . . . of each type φ, (variables are assumptions) given terms Mϕ→ψ and Nϕ, there is (MNϕ)ψ, (function application is modus ponens) given a variable xϕ and a term Mψ, there is (λx.M)ϕ→ψ, (function formation is conditional proof; variable binding is discharging an assumption) given a term M⊥, there is (explode M)ϕ. (crying uncle is explosion)

slide-15
SLIDE 15

Curry-Howard Terms

There are variables xϕ, yϕ, zϕ, . . . of each type φ, (variables are assumptions) given terms Mϕ→ψ and Nϕ, there is (MNϕ)ψ, (function application is modus ponens) given a variable xϕ and a term Mψ, there is (λx.M)ϕ→ψ, (function formation is conditional proof; variable binding is discharging an assumption) given a term M⊥, there is (explode M)ϕ. (crying uncle is explosion)

slide-16
SLIDE 16

Curry-Howard Terms

There are variables xϕ, yϕ, zϕ, . . . of each type φ, (variables are assumptions) given terms Mϕ→ψ and Nϕ, there is (MNϕ)ψ, (function application is modus ponens) given a variable xϕ and a term Mψ, there is (λx.M)ϕ→ψ, (function formation is conditional proof; variable binding is discharging an assumption) given a term M⊥, there is (explode M)ϕ. (crying uncle is explosion)

slide-17
SLIDE 17

Curry-Howard Terms

There are variables xϕ, yϕ, zϕ, . . . of each type φ, (variables are assumptions) given terms Mϕ→ψ and Nϕ, there is (MNϕ)ψ, (function application is modus ponens) given a variable xϕ and a term Mψ, there is (λx.M)ϕ→ψ, (function formation is conditional proof; variable binding is discharging an assumption) given a term M⊥, there is (explode M)ϕ. (crying uncle is explosion)

slide-18
SLIDE 18

Curry-Howard Reduction

Any term of the form ((λx.M)Nϕ)ψ is a redex; its reduct is M[x → N]ψ. Given a term with a selected redex as a subterm, we can reduce the whole term by one step by replacing the redex with its reduct, leaving the context alone. The result is always well-formed.

slide-19
SLIDE 19

Curry-Howard Reduction

One-step reduction ▷1β and its reflexive transitive closure ▷β have some nice properties: Type Preservation If Mϕ ▷β N, then Nϕ Confluence If M ▷1β N and M ▷1β O, then there is a P with N ▷β P and O ▷β P Strong Normalization All reduction paths are finite

slide-20
SLIDE 20

Curry-Howard Reduction

Together, these mean that every Mϕ has a unique normal form Nϕ, which can be reached by reducing it willy-nilly until it can’t be reduced farther. This supports thinking of Mϕ as a program for calculating a φ, normal forms as the values calculated, and reduction as program execution.

slide-21
SLIDE 21

Core type theory

slide-22
SLIDE 22

Core type theory Types

Again, propositions serve as types. There is no ⊥, and is not a proposition/type. → is as before ¬φ is the type of things that take input of type φ and then crash.

slide-23
SLIDE 23

Core type theory Terms

There are variables xϕ, yϕ, zϕ, . . . of each type φ, given terms Mϕ→ψ and Nϕ, there is (MNϕ)ψ, given a variable xϕ and a term Mψ, there is (λx.M)ϕ→ψ,

slide-24
SLIDE 24

Core type theory Terms

given a variable xϕ and a term M in which x occurs, there is (λx.M)¬ϕ and (λx.M)ϕ→ψ, if it crashes, we can note that it crashes, and if it crashes, we can pretend it outputs any given M¬ϕ and Nϕ, there is (MNϕ). with the right input, we can make it crash

slide-25
SLIDE 25

Core type theory Terms

given a variable xϕ and a term M in which x occurs, there is (λx.M)¬ϕ and (λx.M)ϕ→ψ, if it crashes, we can note that it crashes, and if it crashes, we can pretend it outputs any ψ given M¬ϕ and Nϕ, there is (MNϕ). with the right input, we can make it crash

slide-26
SLIDE 26

Core type theory Terms

given a variable xϕ and a term M in which x occurs, there is (λx.M)¬ϕ and (λx.M)ϕ→ψ, if it crashes, we can note that it crashes, and if it crashes, we can pretend it outputs any ψ given M¬ϕ and Nϕ, there is (MNϕ). with the right input, we can make it crash

slide-27
SLIDE 27

Core type theory Reduction

Redexes and their reducts are ‘as before’. A redex is anything of the form (λx.M)N, and its reduct is M[x → N].

slide-28
SLIDE 28

Core type theory Reduction

Redex Reduct

  • ((λx.Mψ)ϕ→ψNϕ)ψ

M[x → N]ψ

  • ((λx.M)ϕ→ψNϕ)ψ

M[x → N]

  • ((λx.M)¬ϕNϕ)

M[x → N]

slide-29
SLIDE 29

Core type theory Reduction

Redex Reduct

  • ((λx.Mψ)ϕ→ψNϕ)ψ

M[x → N]ψ

  • ((λx.M)ϕ→ψNϕ)ψ

M[x → N]

  • ((λx.M)¬ϕNϕ)

M[x → N] Reduction does not always preserve type!

slide-30
SLIDE 30

Core type theory Reduction

Redex Reduct

  • ((λx.Mψ)ϕ→ψNϕ)ψ

M[x → N]ψ

  • ((λx.M)ϕ→ψNϕ)ψ

M[x → N]

  • ((λx.M)¬ϕNϕ)

M[x → N] Reduction can remove free variables!

slide-31
SLIDE 31

Core type theory Reduction

So one-step reduction of a term at a redex is not so simple. Just replacing the redex with its reduct, leaving the context alone, is not always well-formed. (!) The solution: leave the context alone when you can, and otherwise discard what you must.

slide-32
SLIDE 32

Core type theory Reduction

  • If Mϕ ▷1β M′ϕ,

then MN ▷1β M′N

  • If M ▷1β M′,

then MN ▷1β M′

  • If Nϕ ▷1β N′ϕ,

then MN ▷1β MN′

  • If N ▷1β N′,

then MN ▷1β N′

  • If Mϕ ▷1β M′ϕ,

then λx.M ▷1β λx.M′

  • If M ▷1β M′,
  • if x ∈ FV(M′),

then λx.M ▷1β λx.M′ (preserving hat)

  • if x ̸∈ FV(M′),

then λx.M ▷1β M′

slide-33
SLIDE 33

Core type theory Reduction

Example ( (λyϕ.(x¬ϕyϕ))ϕ→θzϕ)θ is a redex, and it reduces in one step to (x¬ϕzϕ). Example Let M be the above redex, and let M′ be its reduct. Then (λwρ.Mθ)ρ→θ ▷1β M′. Example With the same M and M′, we have ( λzϕ.(λwρ.Mθ)ρ→θ)ϕ→ρ→θ ▷1β (λzϕ.M′)ϕ→ρ→θ.

slide-34
SLIDE 34

Results

slide-35
SLIDE 35

Results Preservation?

Reduction does not preserve type. But: it can only change from a type to Never from one type to another, or from to a type

slide-36
SLIDE 36

Results Confluence?

Reduction is not confluent. Example ( λvρ. ( (λxψ.yθ)ψ→θ ( (λu¬ρ.(u¬ρvρ))¬ρ→ψz¬ρ)ψ)θ)ρ→θ reduces in one step to (λvρ.yθ)ρ→θ, or to (λvρ.(z¬ρvρ))ρ→θ

slide-37
SLIDE 37

Results Confluence?

Example (( (λvθ.(u¬θvθ))θ→ϕ→ψtθ)ϕ→ψ ( (λxρ.(y¬ρxρ))ρ→ϕwρ)ϕ)ψ reduces in one step to (u¬θtθ), or to (y¬ρwρ)

slide-38
SLIDE 38

Results Confluence?

Let =β be the least equivalence relation including ▷β. Then for all terms M, N, regardless of type, M =β N. (!)

slide-39
SLIDE 39

Results Weakenings of confluence?

It might be nice to find a weakening of confluence that reduction does obey. It’s definitely not: confluent on closed terms, confluent-but-for-s, confluent on atomic types. But is it confluent-but-for-s on closed terms of atomic type? Is there a confluent reduction strategy?

slide-40
SLIDE 40

Results Strong normalization?

Reduction is still strongly normalizing. Every reduction path is finite.

slide-41
SLIDE 41

Results Strong normalization?

The proof is an old one (newfangled proofs don’t work here!): define a notion of ‘strongly computable term’ by induction on types, then show simultaneously that all SC terms are SN and that all terms are SC.

slide-42
SLIDE 42

Results Strong normalization?

So core ‘programs’ always terminate. But whether they crash, and what result they produce if they don’t, can depend on choices made in execution.

slide-43
SLIDE 43

Wrapup

slide-44
SLIDE 44

Wrapup Comparisions

Core logic is not very far from intuitionistic logic. But their associated type theories are very different. Preservation and confluence do not hold in core type theory, although strong normalization still does.

slide-45
SLIDE 45

Wrapup Conclusion

Girard has said that a logic without cut elimination is ‘like a car without [an] engine’. Core type theory seems to show that this is wrong: despite the lack of cut elimination, computation proceeds as usual. (This is basically what Tennant’s been saying all along.)

slide-46
SLIDE 46

Wrapup Conclusion

Core logic, it turns out, is more like a car without a steering wheel.