• Aucun résultat trouvé

Linear Logic and Intersection Types

N/A
N/A
Protected

Academic year: 2022

Partager "Linear Logic and Intersection Types"

Copied!
35
0
0

Texte intégral

(1)

Introduction Non-Idempotent Types Inhabitation

Linear Logic and Intersection Types

(2)

Introduction Non-Idempotent Types Inhabitation

Agenda for Today

1 Introduction

2 Non-Idempotent Types

3 Inhabitation

(3)

Introduction Non-Idempotent Types Inhabitation

Agenda

1 Introduction

2 Non-Idempotent Types

3 Inhabitation

(4)

Introduction Non-Idempotent Types Inhabitation

Simply versus Intersection Types

Simply typedterms⊆strongly-normalizingterms.

Simply typedterms+strongly-normalizingterms.

(e.g.λx.xx).

Finite polymorphism

Simply types No

Intersection Types Yes x:(σ→σ)∧σ`xx:σ

Intersection typedterms=strongly-normalizingterms.

Intersection type systems areundecidable.

(5)

Introduction Non-Idempotent Types Inhabitation

Intersection Types

SystemC(Coppo-Dezani).

Contains aconstant typeωto typeALLterms.

SystemP(Pottinger).

No constant type.

Types in both systems enjoy ACI Axioms.

Associativity (σ∧ρ)∧τ ∼ σ∧(ρ∧τ) Commutativity σ∧ρ ∼ ρ∧σ

Idempotence σ∧σ ∼ σ

(6)

Introduction Non-Idempotent Types Inhabitation

Some Typical Results in λ -Calculus by means of Intersection Types

Definition

LetRbe any reduction sequence.

A termtis anR-normal formiff there is nopsuch thatt→Rp.

A termtisR-weakly normalizingiff there is some reduction sequencet→Rp, wherepis a normal form.

A termtisR-strongly normalizingiff there is no infinite reduction sequence t→RR. . ..

The previous three notions will be considered for different reduction relations, notably for β-reduction.

A termtisβ-head normalizingifft→βλx1...xn.yt1...tm(n,m≥0). Ahead contextis a context of the shape(λx1...xn.)t1...tm(n,m≥0) A termtissolvableiff there is a head contextCs.t.C[t]→βλx.x

(7)

Introduction Non-Idempotent Types Inhabitation

Some Typical Results by means of Intersection Types

Theorem

A termtissolvableiff it isβ-head normalizingiffΓ`t:σin systemCfor someΓand σsuch thatσ/ω.

Theorem

A termtisβ-weakly normalizingiffΓ`t:σin systemCfor someΓandσsuch that ω<pos+([Γ, σ]).

Theorem

A termtisstrongly-normalizingiffΓ`t:σin systemPfor someΓandσ.

(8)

Introduction Non-Idempotent Types Inhabitation

Comments

Only qualitative (and not quantitative) information is provided in the previous theorems.

No relation between types and consumption of resources.

(9)

Introduction Non-Idempotent Types Inhabitation

Towards Non-Idempotent Intersection Types

The idempotence axiom is ruled out, i.e.σ∧σ/σ

The non-idempotent intersection operator∧can be seen as the multiplicative linear logic connective⊗.

Quantitave models forλ-calculi (De Carvalho, Ehrhard).

Head-Normalization, Solvability, Weak-Normalization and Strong-Normalization can be proved bycombinatorialarguments (weightedsubject reduction properties).

Implicit Complexity⇒use of ressources (e.g. substitution) can be measured.

Partial substitution (c.f. Proof-Nets) can be seen as a measured operation of substitution.

(10)

Introduction Non-Idempotent Types Inhabitation

Agenda

1 Introduction

2 Non-Idempotent Types

3 Inhabitation

(11)

Introduction Non-Idempotent Types Inhabitation

Towards non-idempotent types

Pioneers: P. Gardner, A. Kfoury, D. de Carvalho.

Several typing systems sharing the same principles.

Intuitionistic calculi, classical calculi, etc.

Called alsoquantitative types.

We choose here to present the main principles of non-idempotent types on a language with partial substitution.

(12)

Introduction Non-Idempotent Types Inhabitation

The Linear Substitution Calculus

Inspired from Milner’s calculus with partial substitution and the structural lambda calculus.

Terms:λ-terms withexplicit substitutions.

Contexts are terms with one whole.

Reduction Relation→LSCis at adistanceand performspartialsubstitution:

(λx.t)[y1/v1]. . .[yn/vn]u 7→B t[x/u][y1/v1]. . .[yn/vn] C[[x]][x/u] 7→c C[[u]][x/u]

t[x/u] 7→Gc t if|t|x=0

Example

(xx)[x/I]→c(xI)[x/I]→c(II)[x/u]→GcII→Bx[x/I]→cI[x/I]→Gc I

(13)

Introduction Non-Idempotent Types Inhabitation

Linear-Head Reduction

Inspired from Milner’s calculus.

With Linear-Logic Proof-Nets flavour.

Conexion with Krivine’s Abstract Machine.

Linear-Head Reduction is astandard strategy.

Linear-Head Reduction (lineary) performs reduction only onhead-positions.

Linear-Head Reductiondoes not eraseterms.

(14)

Introduction Non-Idempotent Types Inhabitation

Linear-Head Reduction Formally

Linear-Head Contexts:LH::=|λx.LH|LHt|LH[x/t].

Linear-Head Reduction (written→lhr): rules{B,hc}closed byhead-linear contexts.

(λx.t)[y1/v1]. . .[yn/vn]u 7→B t[x/u][y1/v1]. . .[yn/vn]

LH[[x]][x/u] 7→hc LH[[u]][x/u]

Remark:lhr⊆→LSC.

Example

(xx)[x/I]→hc(I x)[x/I]→By[y/x][x/I]→hcx[y/x][x/I]→hcI[y/x][x/I]

is a linear-head reduction

(xx)[x/I]→c(xI)[x/I]→c(II)[x/I]→Gc II→By[y/I]→cI is not

(15)

Introduction Non-Idempotent Types Inhabitation

Types for Milner’s calculus

Types:

Strict Types

Non-idempotent intersection

Intersection types are represented by multisets (σ∧σis{{σ, σ}}).

σ ::= α|A→σ (linear types) A ::= {{ }} |B (multiset types)

B ::= {{σk}}k∈K(I,∅) (non-empty multiset types) Typing Rules:

Relevance (no weakening) Multiplicative rules

Syntax-directed typing rules

Typed termsmay containuntyped subterms(I=∅)

(16)

Introduction Non-Idempotent Types Inhabitation

The Type System H W

x:{{σ}} `x:σ (var) Γ`t:σ

Γ\x`λx.t:Γ(x)→σ (→I) Γ`t:{{σk}}k∈K→σ (∆k`u:σk)k∈K

Γ +k∈Kk`tu:σ (→E) x:{{σk}}k∈K;Γ`t:σ (∆k`u:σk)k∈K

Γ +k∈Kk`t[x/u] :σ (Cut)

(17)

Introduction Non-Idempotent Types Inhabitation

Example

(var) x:{{{{ }} →σ}} `x:{{ }} →σ

(→E) x:{{{{ }} →σ}} `xv:σ

(Cut) x:{{{{ }} →σ}} `(xv)[y/u] :σ

Typed terms may contain (pink) untyped subterms.

(18)

Introduction Non-Idempotent Types Inhabitation

Measuring Typing Derivations

Definition

Given a type derivationΦ, we define themeasureM(Φ)as the number of occurrences of typing rulesvar,→I,→EandCutinΦ.

Example

(var) x:{{{{ }} →σ}} `x:{{ }} →σ

(→E)

x:{{{{ }} →σ}} `xv:σ

(Cut) x:{{{{ }} →σ}} `(xv)[y/u] :σ

The measure of this type derivation is3.

(19)

Introduction Non-Idempotent Types Inhabitation

Relevance

Lemma (Weak Relevance)

IfΓ`H W t:σ, thendom(Γ)⊆fv(t).

(20)

Introduction Non-Idempotent Types Inhabitation

Technical Tools for Characterizing Head-Linear Normalization

Positionof terms are finite words on the alphabet{0,1}.

A positionp∈pos(t)is atyped occurrenceofΦif eitherp=, orp=ip0(i=0,1) andp0∈pos(t|i)is a typed occurrence ofsomeof their corresponding

subderivations.

A redex occurrence oftwhich is also a typed occurrence ofΦis atyped redex occurrenceoftinΦ.

x:{{{{τ, τ}} →τ}} `x:{{τ, τ}} →τ

y:{{{{ }} →τ}} `y:{{ }} →τ y:{{{{ }} →τ}} `yz:τ

y:{{{{τ}} →τ}} `y:{{τ}} →τ z:{{τ}} `z:τ y:{{{{τ}} →τ}},z:{{τ}} `yz:τ x:{{{{τ, τ}} →τ}},y:{{{{ }} →τ,{{τ}} →τ}},z:{{τ}} `x(yz):τ

x:{{{{τ, τ}} →τ}} `x:{{τ, τ}} →τ

y:{{{{ }} →τ}} `y:{{ }} →τ y:{{{{ }} →τ}} `yz:τ

y:{{{{ }} →τ}} `y:{{ }} →τ y:{{{{ }} →τ}} `yz:τ x:{{{{τ, τ}} →τ}},y:{{{{ }} →τ,{{ }} →τ}} `x(yz):τ

(21)

Introduction Non-Idempotent Types Inhabitation

Results: towards characterization of head-linear normalization

Lemma (Weighted Subject Reduction for Typed Redex Occurrences)

WheneverΠ:Γ`H Wt:σandt→LSCt0reduces atyped redex occurrence, then Π0:Γ`H Wt0:σandM(Π)>M(Π0).

Corollary (Weighted Subject Reduction for Linear-Head Reduction)

WheneverΠ:Γ`H Wt:σandt→lhrt0, thenΠ0:Γ`H Wt0:σandM(Π)>M(Π0).

Lemma (Subject Expansion for the Linear Substitution Calculus)

IfΠ:Γ`H Wt:σandt0LSCt, thenΠ0:Γ`H W t0:σ.

Corollary (Subject Reduction for Linear-Head Reduction)

IfΠ:Γ`H Wt:σandt0lhrt, thenΠ0:Γ`H W t0:σ.

(22)

Introduction Non-Idempotent Types Inhabitation

Results: characterization of head-linear normalization

Theorem

The following statements are equivalent:

tislhr-weakly normalizing.

tisH W-typable.

Proof.uses, between others,

WeightedSubject Reduction (combinatorial argument for non-idempotent types).

Subject Expansion.

(23)

Introduction Non-Idempotent Types Inhabitation

Results: towards characterization of weak normalization

PositiveandNegativeoccurrences of types are defined as follows.

A∈pos+(A).

A∈pos+({{σk}}k∈K)if∃kA∈pos+k);A∈pos({{σk}}k∈K)if∃kA∈posk). A∈pos+(E→τ)ifA∈pos(E)orA∈pos+(τ);A∈pos(E→τ)ifA∈pos+(E)or A∈pos(τ).

A∈pos+(Γ)if∃y∈dom(Γ)s.t.A∈pos(Γ(y));A∈pos(Γ)if∃y∈dom(Γ)s.t.

A∈pos+(Γ(y)).

A∈pos+([Γ, τ])ifA∈pos+(Γ)orA∈pos+(τ);A∈pos([Γ, τ])ifA∈pos(Γ)or A∈pos(τ).

As an example,{{ }} ∈pos+({{ }}), so that{{ }} ∈pos({{ }} →σ),{{ }} ∈pos+(x:{{{{ }} →σ}})and {{ }} ∈pos+([x:{{{{ }} →σ}}, σ]).

(24)

Introduction Non-Idempotent Types Inhabitation

Results: characterization of weak normalization

Theorem (Weak-Normalization)

A termtisLSC-weakly normalizingiffΓ`t:σin systemH Wfor someΓandσsuch that{{ }}<pos+([Γ, σ]).

The following term isLSC-weakly normalizing:

z:α`(λx.z)(∆∆) :α The following term is notLSC-weakly normalizing:

z:{{{{ }} →α}} `z(∆∆) :α

(25)

Introduction Non-Idempotent Types Inhabitation

The Type System S

x:{{σ}} `x:σ (var) Γ`t:σ

Γ\x`λx.t:Γ(x)→σ (→I) Γ`t:{{σk}}k∈K→σ (∆k`u:σk)k∈K I,∅

Γ +k∈Kk`tu:σ (→E1)

x:{{σk}}k∈K;Γ`t:σ (∆k`u:σk)k∈K I,∅ Γ +k∈Kk`t[x/u] :σ (Cut1) Γ`t:{{ }} →σ ∆`u:τ

Γ + ∆`tu:σ (→E2) Γ`t:σ ∆`u:τ x<dom(Γ) Γ + ∆`t[x/u] :σ (Cut2)

(26)

Introduction Non-Idempotent Types Inhabitation

Relevance

Lemma (Strong Relevance)

IfΓ`St:σ, thendom(Γ)=fv(t).

(27)

Introduction Non-Idempotent Types Inhabitation

Results: characterization of strong normalization

Theorem (Strong-Normalization)

A termtisLSC-strongly normalizingifftisS-typable.

Proof.uses

Postponementoferasingsteps (which does not hold inλ-calculus).

WeightedSubject Reduction for systemS. Subject Expansion for systemS.

(28)

Introduction Non-Idempotent Types Inhabitation

Agenda

1 Introduction

2 Non-Idempotent Types

3 Inhabitation

(29)

Introduction Non-Idempotent Types Inhabitation

Turning the inhabitation problem into a decidable

question

(30)

Introduction Non-Idempotent Types Inhabitation

Typing and Inhabitation Problems

Typing Inhabitation

?`t: ? Γ`?:A

Simple Types: Decidable Decidable

Idempotent Types: Undecidable Undecidable (Urzyczyn) Non-idempotent Types: Undecidable Decidable

(Bucciarelli-K.-Ronchi Della Rocca)

Decidability of restricted classes of idempotent types (Kurata & Takahashi), (Urzyczyn), (Bunder), (Ku´smierek), (Dudenhefner & Rehof), . . .

(31)

Introduction Non-Idempotent Types Inhabitation

The Typing System for the Lambda-Calculus

x:{{σ}} `x:σ (var) Γ`t:σ

Γ\x`λx.t:Γ(x)→σ (→I) Γ`t:{{σi}}i∈I→σ (∆i`u:σi)i∈I

Γ +i∈Ii`tu:σ (→E)

(32)

Introduction Non-Idempotent Types Inhabitation

Approximants

How to restrict the search space of the algorithm?

We use the normalization property to restrict the search space toapproximants:

a,b,c ::= Ω| N N ::= λx.N | L L ::= x| La

(33)

Introduction Non-Idempotent Types Inhabitation

The Algorithm

a∈T(Γ +(x:A), τ) x<dom(Γ)

λx.a∈T(Γ,A→τ) (Abs)

Γ = +i=1...nΓi (bi∈TI(Γi, σi))i=1...n

xb1. . .bn∈T(Γ +(x:{{A1→. . .→An→τ}}), τ) (Head)

(ai∈T(Γi, σi))iIiIai _

i∈I

ai∈TI(+iIΓi,{{σi}}iI) (Union)

(34)

Introduction Non-Idempotent Types Inhabitation

Soundness and Completeness

Theorem

The algorithm terminates, is sound and complete.

(35)

Introduction Non-Idempotent Types Inhabitation

Some Final Remarks

Non-idempotentintersection types are particularly pertinent for calculi with ressources.

Arithmeticalarguments for terminating proofs.

New logical characterization oflinear-headnormalization.

The inhabitation problem for intersection types has been proved to be undecidable, but breaking the idempotency of intersection types makesinhabitation decidable.

Références

Documents relatifs

Moreover, the Koletsos and Stavrinos’s method depends on the inclusion of typable λ-terms in the set of λ-terms possessing the Church-Rosser property, whereas the Ghilezan and

Various kinds of denotational semantics have helped in reasoning about the properties of entire type systems and also of specific typed terms. E-variables pose serious challenges

As women’s life course is not only a history of motherhood: middle-class women, like people in general, are engaged in a various spheres of experience, in and out of home

Dans ce contexte, nous avons entrepris d’évaluer les performances analytiques et la qualité de l’utilisation de ces lecteurs à deux niveaux : dans un premier temps au

We present a typing system with non-idempotent intersection types, typing a term syntax covering three different calculi: the pure λ-calculus, the calculus with explicit

Le pic de dureté enregistré est plus supérieur comparativement aux pics de dureté des autres tôles (2, 4, 7 et 8) sans cuivre. Cette amélioration de durcissement est justifiée par

We define two intersection type systems for the pure, untyped, probabilistic λ-calculus, and prove that type derivations precisely reflect the probability of convergence of the

First, we index each type with a natural number and show that although this intuitively captures the use of E-variables, it is difficult to index the universal type ω with