Core type theory I: Implication and negation David Ripley Monash - - PowerPoint PPT Presentation

core type theory i implication and negation
SMART_READER_LITE
LIVE PREVIEW

Core type theory I: Implication and negation David Ripley Monash - - PowerPoint PPT Presentation

Core type theory I: Implication and negation David Ripley Monash University http://davewripley.rocks Introduction Introduction Background: core logic Core logic (aka intuitionistic relevant logic) is a system of logic devised and


slide-1
SLIDE 1

Core type theory I: Implication and negation

David Ripley

Monash University http://davewripley.rocks

slide-2
SLIDE 2

Introduction

slide-3
SLIDE 3

Introduction Background: core logic

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

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

Introduction Background: core logic

In its usual presentation, it’s a first-order logic with vocabulary: →, ¬, ∧, ∨, ∀, ∃ Here, I’ll just consider the propositional fragment.

slide-5
SLIDE 5

Introduction Background: core logic

In its usual presentation, it’s a first-order logic with vocabulary: →, ¬, ∧, ∨, ∀, ∃ Here, I’ll just consider the →, ¬ propositional fragment.

slide-6
SLIDE 6

Introduction Background: core logic

Core logic has close connections to intuitionistic logic. This will loom large here. But its treatment of negation is distinctive.

slide-7
SLIDE 7

Introduction Background: Curry-Howard

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-8
SLIDE 8

Introduction Background: Curry-Howard

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-9
SLIDE 9

Introduction Background: Curry-Howard

The connection to proofs turns on the ability to see propositions as types, and vice versa. Think of each type ϕ as the proposition ‘ϕ is inhabited’. Each inhabitant of ϕ is a proof of it.

slide-10
SLIDE 10

Introduction Background: Curry-Howard

It is usual to suppose we can form function types: given types ϕ and ψ there is a type ϕ → ψ of functions from ϕ to ψ. We may also suppose a empty type ⊥: a type that cannot be inhabited.

slide-11
SLIDE 11

Introduction Background: Curry-Howard

Γ, x : ϕ x : ϕ Γ, x : ϕ M : ψ Γ (λx.M) : ϕ → ψ Γ M : ϕ → ψ Γ N : ϕ Γ MN : ψ Γ M : ⊥ Γ explodeϕ(M) : ϕ

slide-12
SLIDE 12

Introduction Background: Curry-Howard

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

slide-13
SLIDE 13

Introduction Core type theory

The purpose of this talk is to develop core type theory: the type theory that stands to core logic→,¬ as a more usual type theory stands to Int→,⊥. (Future work will extend this to include ∧, ∨, which present their own complications in core logic.)

slide-14
SLIDE 14

Introduction Outline

Here’s the plan: Core logic, its distinctive approach to negation, and ‘epistemic gain’ Core type theory and its properties Tying the two together

slide-15
SLIDE 15

Introduction Outline

One reason to pursue this project: Γ M : ⊥ Γ explodeϕ(M) : ϕ is pretty conspicuously ill-motivated.

slide-16
SLIDE 16

Core logic

slide-17
SLIDE 17

Core logic A formulation of core logic

Formulas ϕ, ψ, . . . are built from atoms with →, ¬. Sequents are Γ C, where Γ is a set of formulas, and C is either a formula or nothing. Say D ≤ C iff either D is empty or else D is C.

slide-18
SLIDE 18

Core logic A formulation of core logic

Structural rule:

Id:

ϕ ϕ Important: no rules of weakening (either side) or cut!

slide-19
SLIDE 19

Core logic A formulation of core logic

→ rules: Γ ϕ ∆, ψ C

→L:

Γ, ∆, ϕ → ψ C Γ, ϕ ψ

→R:

Γ ϕ → ψ Γ ψ

→R_:

Γ ϕ → ψ Γ, ϕ

→R!:

Γ ϕ → ψ Even without weakening, we can introduce the →s that weakening would allow.

slide-20
SLIDE 20

Core logic A formulation of core logic

¬ rules: Γ ϕ

¬L:

Γ, ¬ϕ Γ, ϕ

¬R:

Γ ¬ϕ These are almost usual (intuitionistic) negation rules. But they don’t absorb weakening like the → rules did. So ¬ is where we can see core logic’s nonmonotonicity.

slide-21
SLIDE 21

Core logic The resulting logic

Tennant defines core consequence ⊢ like so: Γ ⊢ C iff there is some Γ′ ⊆ Γ such that Γ′ C is derivable. This builds in left weakening but not right, and only at the end of a derivation.

slide-22
SLIDE 22

Core logic The resulting logic

There is no proposition ⊥ in core logic (and so no E⊥Q rule). Rather, there are proofs and refutations. A proof of ϕ from Γ is a derivation

  • f Γ′ ϕ for some Γ′ ⊆ Γ.

A refutation of Γ is a derivation

  • f Γ′ for some Γ′ ⊆ Γ.

Refuting Γ does not suffice for proving ϕ from Γ.

slide-23
SLIDE 23

Core logic The resulting logic

⊢ is closely related to ⊢Int: Results (Tennant):

  • Γ ⊢ iff Γ ⊢Int.
  • If Γ ̸⊢, then Γ ⊢Int ϕ iff Γ ⊢ ϕ.

But it is different: ¬ϕ, ϕ ⊢Int ψ, but ¬ϕ, ϕ ̸⊢ ψ, although ¬ϕ, ϕ ⊢. (These results hold for full first-order core logic too.)

slide-24
SLIDE 24

Core logic Epistemic gain

Core logic does not admit cut. Γ ϕ ∆, ϕ C

Cut:

Γ, ∆ C For example, ¬ϕ ϕ → ψ and ϕ → ψ, ϕ ψ are both derivable, but ¬ϕ, ϕ ψ is not.

slide-25
SLIDE 25

Core logic Epistemic gain

Instead, core logic has a property Tennant calls epistemic gain: If Γ ϕ and ∆, ϕ C are both derivable, then there is a derivable sequent Σ D such that Σ ⊆ Γ ∪ ∆ and D ≤ C. This is meant to supersede cut-admissibility; not a partial replacement, but a more precise statement of what really mattered all along.

slide-26
SLIDE 26

Core logic Epistemic gain

In terms of consequence, this gives us: if Γ ⊢ ϕ and ∆, ϕ ⊢ C, then Γ, ∆ ⊢ D, for some D ≤ C. We can chain proofs together, so long as we’re prepared to maybe find a refutation of our combined premises instead.

slide-27
SLIDE 27

Core logic Epistemic gain

One last fact about core logic: adding cut to the system gives precisely intuitionistic logic. Seen this way, it is a distinctive proof system for good old Int, with not all derivable sequents having cutfree derivations. All derivable sequents do have cutfree derivable subsequents. (‘Subsequent’ here with ⊆ on left and ≤ on right.)

slide-28
SLIDE 28

Core logic Epistemic gain

Full disclosure: I’m not yet 100% sure this is core logic. Tennant’s formulation involves more restrictive discharge policies, and his derivations are not closed under substitution. My derivations are all substitution instances of core derivations. I don’t think this affects derivability, even though it adds more derivations.

slide-29
SLIDE 29

A term calculus

slide-30
SLIDE 30

A term calculus Types

Types are our old formulas: built from atoms with →, ¬. ϕ → ψ are function types: their canonical inhabitants give you a ψ if you give them a ϕ. ¬ϕ are exception types: their canonical inhabitants cancel the current calculation when they encounter a ϕ.

slide-31
SLIDE 31

A term calculus Terms

Terms are either typed terms or refutation terms. Handled Church-style; every term wears a hat: either its (unique) type, or else ⊥ if it’s a refutation term. (Hoping to extend this to Curry-style, but the proofs were easier this way.)

slide-32
SLIDE 32

A term calculus Terms

Terms start from countably many variables xϕ, yϕ, . . . of each type ϕ. There are no refutation variables. There are six kinds of complex term: (Mϕ→ψNϕ)ψ (λxϕ.Mψ)ϕ→ψ (λ_.Mψ)ϕ→ψ (λ!xϕ.M⊥)ϕ→ψ (M¬ϕNϕ)⊥ (rxϕ.M⊥)¬ϕ In the right column, xϕ must occur free in M, and becomes bound. There is no vacuous binding. α equivalents are identified.

slide-33
SLIDE 33

A term calculus Terms

Terms start from countably many variables xϕ, yϕ, . . . of each type ϕ. There are no refutation variables. There are six kinds of complex term: (Mϕ→ψNϕ)ψ (λxϕ.Mψ)ϕ→ψ (λ_.Mψ)ϕ→ψ (λ!xϕ.M⊥)ϕ→ψ (M¬ϕNϕ)⊥ (rxϕ.M⊥)¬ϕ In the right column, xϕ must occur free in M, and becomes bound. There is no vacuous binding. α equivalents are identified.

slide-34
SLIDE 34

A term calculus Terms

These six ways of compounding terms correspond directly to the six connective-introducing rules. Γ Mϕ ∆, xψ NC

→L:

Γ, ∆, yϕ→ψ (NC[xψ → (yM)ψ])C Γ, xϕ Mψ

→R:

Γ (λxϕ.Mψ)ϕ→ψ Γ Mψ

→R_:

Γ (λ_.Mψ)ϕ→ψ Γ, xϕ M⊥

→R!:

Γ (λ!xϕ.M⊥)ϕ→ψ Γ Mϕ

¬L:

Γ, y¬ϕ (y¬ϕMϕ)⊥ Γ, xϕ M⊥

¬R:

Γ (rxϕ.M⊥)¬ϕ

slide-35
SLIDE 35

A term calculus Redexes

A redex is an occurrence of one of these four forms. ((λxϕ.Mψ)ϕ→ψ Nϕ)ψ ((λ_.Mψ)ϕ→ψ Nϕ)ψ ((rxϕ.M⊥)¬ϕ Nϕ)⊥ ((λ!xϕ.M⊥)ϕ→ψ Nϕ)ψ The last is an explosive redex; the rest are nonexplosive.

slide-36
SLIDE 36

A term calculus Redexes

All redexes are applications or contradictions with a complex left component. So no redex is created in any core derivation: all applications and contradictions have variables on the left.

slide-37
SLIDE 37

A term calculus Redexes

Redexes are instead created by cuts; the term calculus corresponds to core logic plus cut. Recall that this is intuitionistic logic. The core term calculus is a core-logic lens on intuitionistic logic.

slide-38
SLIDE 38

A term calculus Cut and substitution

Here’s how cut works with terms: Γ Mϕ ∆, xϕ NC

Cut:

Γ, ∆ (NC[Mϕ → xϕ])C Since cuts can put complex terms where variables used to be, they can create redexes.

slide-39
SLIDE 39

A term calculus Cut and substitution

Γ Mψ

→R_:

Γ (λ_.M)ϕ→ψ ∆ Nϕ Σ, yψ OC

→L:

∆, Σ, zϕ→ψ OC[y → zN]

Cut:

Γ, ∆, Σ OC[y → zN][z → λ_.M]

which is:

Γ, ∆, Σ OC[y → (λ_.M)N] M y O

Cut:

O y M

slide-40
SLIDE 40

A term calculus Cut and substitution

Γ Mψ

→R_:

Γ (λ_.M)ϕ→ψ ∆ Nϕ Σ, yψ OC

→L:

∆, Σ, zϕ→ψ OC[y → zN]

Cut:

Γ, ∆, Σ OC[y → zN][z → λ_.M]

which is:

Γ, ∆, Σ OC[y → (λ_.M)N] Γ Mψ Σ, yψ OC

Cut:

Γ, Σ OC[y → M]

slide-41
SLIDE 41

A term calculus Cut and substitution

Γ Mψ

→R_:

Γ (λ_.M)ϕ→ψ ∆ Nϕ Σ, yψ OC

→L:

∆, Σ, zϕ→ψ OC[y → zN]

Cut:

Γ, ∆, Σ OC[y → zN][z → λ_.M]

which is:

Γ, ∆, Σ OC[y → (λ_.M)N] Γ Mψ Σ, yψ OC

Cut:

Γ, Σ OC[y → M]

slide-42
SLIDE 42

A term calculus Reduction

Each redex has a reduct, as follows: ((λxϕ.Mψ)ϕ→ψNϕ)ψ (M[x → N])ψ ((λ_.Mψ)ϕ→ψNϕ)ψ Mψ ((rxϕ.M⊥)¬ϕNϕ)⊥ (M[x → N])⊥ ((λ!xϕ.M⊥)ϕ→ψNϕ)ψ (M[x → N])⊥

slide-43
SLIDE 43

A term calculus Reduction

A step of gentle reduction takes a term O[R] with indicated nonexplosive redex R, and yields O[R′], with R′ the reduct of R. A step of reduction is either a step of gentle reduction,

  • r else takes a term O[R] with indicated explosive redex R,

and yields R′, with R′ the reduct of R. Reducing an explosive redex discards its context, and produces a refutation term.

slide-44
SLIDE 44

A term calculus Explosive reduction

Γ, xϕ M⊥

→R!:

Γ (λ!x.M)ϕ→ψ ∆ Nϕ Σ, yψ OC

→L:

∆, Σ, zϕ→ψ OC[y → zN]

Cut:

Γ, ∆, Σ OC[y → zN][z → λ!x.M]

which is:

Γ, ∆, Σ OC[y → (λ!x.M)N] N x M

Cut:

M x N

slide-45
SLIDE 45

A term calculus Explosive reduction

Γ, xϕ M⊥

→R!:

Γ (λ!x.M)ϕ→ψ ∆ Nϕ Σ, yψ OC

→L:

∆, Σ, zϕ→ψ OC[y → zN]

Cut:

Γ, ∆, Σ OC[y → zN][z → λ!x.M]

which is:

Γ, ∆, Σ OC[y → (λ!x.M)N] ∆ Nϕ Γ, xϕ M⊥

Cut:

∆, Γ M⊥[x → N]

slide-46
SLIDE 46

A term calculus Explosive reduction

A typed term Nϕ is a plan to calculate a ϕ. But plans can run into exceptions, and terminate before they produce their output. (λ!xϕ.M⊥)ϕ→ψ promises a ψ if given a ϕ, but what it will do is terminate. So it doesn’t matter what we were going to do with the ψ we were planning to produce; the context can be discarded.

slide-47
SLIDE 47

A term calculus Subject reduction

We do not in general have that reduction preserves type, because of explosive reduction. But: Lemmas: If M⊥ reduces to N, then N is a refutation term. If Mϕ reduces to Nψ, then the reduction is gentle. If Mϕ gently reduces to N, then N has type ϕ. Reduction preserves refutationhood. Explosive reduction always produces refutation terms. Gentle reduction preserves type.

slide-48
SLIDE 48

A term calculus Normalisation

Theorem: Reduction (and so gentle reduction) is strongly normalising. That is, from any term, every sequence of reductions is finite.

slide-49
SLIDE 49

A term calculus Normalisation

A term that can’t be reduced is a normal form. A term that can’t be gently reduced is a gentle normal form. Every normal form is a gentle normal form, but not vice versa. SN gives: every reduction sequence reaches a normal form, and every gentle reduction sequence reaches a gentle normal form.

slide-50
SLIDE 50

A term calculus Confluence

A relation ▷ is confluent iff whenever M ▷ N and M ▷ O, then there is a P with N ▷ P and O ▷ P. It is weakly confluent iff whenever M ▷ N and M ▷ O, then there is a P with N ▷⋆ P and O ▷⋆ P. (⋆ is reflexive transitive closure.)

slide-51
SLIDE 51

A term calculus Confluence

Uh-oh: Reduction isn’t confluent. One-step reduction isn’t weakly confluent.

slide-52
SLIDE 52

A term calculus Nonconfluence: example 1

( (λ_.wδ)ψ→δ ( (λ!xϕ.(y¬ϕxϕ)⊥)ϕ→ψzϕ)ψ)δ reduces in one step via its outer (left) redex to wδ, and in one step via its inner (right) redex to (y¬ϕzϕ)⊥, both of which are in normal form.

slide-53
SLIDE 53

A term calculus Nonconfluence: example 1

( (λ_.wδ)ψ→δ ( (λ!xϕ.(y¬ϕxϕ)⊥)ϕ→ψzϕ)ψ)δ reduces in one step via its outer (left) redex to wδ, and in one step via its inner (right) redex to (y¬ϕzϕ)⊥, both of which are in normal form.

slide-54
SLIDE 54

A term calculus Nonconfluence: example 1

( (λ_.wδ)ψ→δ ( (λ!xϕ.(y¬ϕxϕ)⊥)ϕ→ψzϕ)ψ)δ reduces in one step via its outer (left) redex to wδ, and in one step via its inner (right) redex to (y¬ϕzϕ)⊥, both of which are in normal form.

slide-55
SLIDE 55

A term calculus Nonconfluence: example 2

(( (λ!xϕ.(y¬ϕxϕ)⊥)ϕ→ψ→θvϕ)ψ→θ ( (λ!sδ.(r¬δsδ)⊥)δ→ψqδ)ψ)θ reduces in one step via its left redex to (y¬ϕvϕ)⊥, and in one step via its right redex to (r¬δqδ)⊥, both of which are in normal form.

slide-56
SLIDE 56

A term calculus Nonconfluence: example 2

(( (λ!xϕ.(y¬ϕxϕ)⊥)ϕ→ψ→θvϕ)ψ→θ ( (λ!sδ.(r¬δsδ)⊥)δ→ψqδ)ψ)θ reduces in one step via its left redex to (y¬ϕvϕ)⊥, and in one step via its right redex to (r¬δqδ)⊥, both of which are in normal form.

slide-57
SLIDE 57

A term calculus Nonconfluence: example 2

(( (λ!xϕ.(y¬ϕxϕ)⊥)ϕ→ψ→θvϕ)ψ→θ ( (λ!sδ.(r¬δsδ)⊥)δ→ψqδ)ψ)θ reduces in one step via its left redex to (y¬ϕvϕ)⊥, and in one step via its right redex to (r¬δqδ)⊥, both of which are in normal form.

slide-58
SLIDE 58

A term calculus Conditions for confluence

Theorem: Gentle reduction is confluent. Nonconfluence comes from explosive redexes.

slide-59
SLIDE 59

A term calculus Conditions for confluence

A term is forking iff it contains either: a λ_ redex with an explosive redex in its argument, or two nonoverlapping explosive redexes. Theorem: One-step reduction is weakly confluent on nonforking terms. A term is hereditarily nonforking iff it does not reduce to any forking term. Corollary: Reduction is confluent on hereditarily nonforking terms.

slide-60
SLIDE 60

A term calculus Nonforking terms

Reduction can produce forks. ( ( λyϕ.((λ_.wψ)ϕ→ψyϕ)ψ)ϕ→ψ ( (λ!zδ.(v¬δzδ)⊥)δ→ϕuδ)ϕ)ψ is nonforking. Reduced at its outer (left) redex, it yields ( (λ_.wψ)ϕ→ψ ( (λ!zδ.(v¬δzδ)⊥)δ→ϕuδ)ϕ)ψ which is forking. Both terms reduce at their explosive redex directly to (v¬δuδ).

slide-61
SLIDE 61

A term calculus Nonforking terms

Reduction can produce forks. ( ( λyϕ.((λ_.wψ)ϕ→ψyϕ)ψ)ϕ→ψ ( (λ!zδ.(v¬δzδ)⊥)δ→ϕuδ)ϕ)ψ is nonforking. Reduced at its outer (left) redex, it yields ( (λ_.wψ)ϕ→ψ ( (λ!zδ.(v¬δzδ)⊥)δ→ϕuδ)ϕ)ψ which is forking. Both terms reduce at their explosive redex directly to (v¬δuδ).

slide-62
SLIDE 62

A term calculus Nonforking terms

Reduction can produce forks. ( ( λyϕ.((λ_.wψ)ϕ→ψyϕ)ψ)ϕ→ψ ( (λ!zδ.(v¬δzδ)⊥)δ→ϕuδ)ϕ)ψ is nonforking. Reduced at its outer (left) redex, it yields ( (λ_.wψ)ϕ→ψ ( (λ!zδ.(v¬δzδ)⊥)δ→ϕuδ)ϕ)ψ which is forking. Both terms reduce at their explosive redex directly to (v¬δuδ).

slide-63
SLIDE 63

A term calculus Normal forms again

Every term MC has a unique gentle normal form MC

gnf.

If MC

gnf is a typed normal form, it is MC’s unique typed normal form;

if it is not, MC does not have a typed normal form. So no term has multiple distinct typed normal forms; all or all but one of a term’s normal forms must be refutation terms. Hereditarily nonforking terms have unique normal forms; the two examples of nonconfluence are the only kinds.

slide-64
SLIDE 64

A term calculus Normal forms again

Every calculation produces at most one result: its gentle normal form, if that’s a normal form, and no result if it isn’t. A calculation might be able to fail in multiple distinct ways, but its result, if any, remains unique, and gentle reduction will find it.

slide-65
SLIDE 65

Correspondence

slide-66
SLIDE 66

Correspondence Derivations and terms

So we have a sequent calculus on the one hand, and a bunch of terms with reduction behaviour on the other.

slide-67
SLIDE 67

Correspondence Derivations and terms

Each derivation determines a term in a straightforward way. If the derivation is of Γ ϕ, the term has type ϕ and free variables of types in Γ. If the derivation is of Γ , it’s a refutation term with free variables of types in Γ. The term is in normal form iff the derivation contains no proper cuts.

slide-68
SLIDE 68

Correspondence Derivations and terms

Each term determines a derivation in a straightforward way. If the term has type ϕ and free variables of types Γ, the derivation is of Γ ϕ. If it’s a refutation term with free variables of types Γ, the derivation is of Γ . All cuts in these derivations are principal. The term is in normal form iff the derivation contains no cuts.

slide-69
SLIDE 69

Correspondence Derivations and terms

The round trip is the identity on terms, and pushes cuts up to principal cases on derivations.