· 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5....

210
ICTCS ’05 Invited Talk Semantic Subtyping: Challenges, Perspectives, and Open Problems Giuseppe Castagna CNRS ´ Ecole Normale Sup´ erieure de Paris Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 1/39

Transcript of  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5....

Page 1:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

ICTCS ’05 Invited Talk

Semantic Subtyping:Challenges, Perspectives, and Open Problems

Giuseppe Castagna

CNRSEcole Normale Superieure de Paris

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 1/39

Page 2:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

ICTCS ’05 Invited Talk

Outline

1 Motivations and goals.

2 Semantic subtyping.

3 λ-calculus.

4 π-calculus.

5 Some Perspectives.

6 Conclusion

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 2/39

Page 3:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

ICTCS ’05 Invited Talk

Outline

1 Motivations and goals.

2 Semantic subtyping.

3 λ-calculus.

4 π-calculus.

5 Some Perspectives.

6 Conclusion

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 2/39

Page 4:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

ICTCS ’05 Invited Talk

Outline

1 Motivations and goals.

2 Semantic subtyping.

3 λ-calculus.

4 π-calculus.

5 Some Perspectives.

6 Conclusion

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 2/39

Page 5:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

ICTCS ’05 Invited Talk

Outline

1 Motivations and goals.

2 Semantic subtyping.

3 λ-calculus.

4 π-calculus.

5 Some Perspectives.

6 Conclusion

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 2/39

Page 6:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

ICTCS ’05 Invited Talk

Outline

1 Motivations and goals.

2 Semantic subtyping.

3 λ-calculus.

4 π-calculus.

5 Some Perspectives.

6 Conclusion

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 2/39

Page 7:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

ICTCS ’05 Invited Talk

Outline

1 Motivations and goals.

2 Semantic subtyping.

3 λ-calculus.

4 π-calculus.

5 Some Perspectives.

6 Conclusion

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 2/39

Page 8:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Goal

The goal is to show how to take your favourite type constructors

×××, →→→, {. . . }, chan(), . . .

and add boolean combinators:

∨∨∨, ∧∧∧, ¬¬¬

so that they behave set-theoretically w.r.t. ≤

WHY?

Short answer: they are convenient and you need them to programXML in a typed language with pattern matching.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 3/39

Page 9:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Goal

The goal is to show how to take your favourite type constructors

×××, →→→, {. . . }, chan(), . . .

and add boolean combinators:

∨∨∨, ∧∧∧, ¬¬¬

so that they behave set-theoretically w.r.t. ≤

WHY?

Short answer: they are convenient and you need them to programXML in a typed language with pattern matching.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 3/39

Page 10:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Goal

The goal is to show how to take your favourite type constructors

×××, →→→, {. . . }, chan(), . . .

and add boolean combinators:

∨∨∨, ∧∧∧, ¬¬¬

so that they behave set-theoretically w.r.t. ≤

WHY?

Short answer: they are convenient and you need them to programXML in a typed language with pattern matching.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 3/39

Page 11:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Goal

The goal is to show how to take your favourite type constructors

×××, →→→, {. . . }, chan(), . . .

and add boolean combinators:

∨∨∨, ∧∧∧, ¬¬¬

so that they behave set-theoretically w.r.t. ≤

WHY?

Short answer: they are convenient and you need them to programXML in a typed language with pattern matching.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 3/39

Page 12:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Why it is difficult?

t ::= B | t×××t | t→→→t | t∨∨∨t | t∧∧∧t | ¬t | 0 | 1

Handling subtyping without combinators is easy:constructors do not mix, e.g.:

s2 ≤ s1 t1 ≤ t2s1 → t1 ≤ s2 → t2

s1 ≤ s2 t1 ≤ t2s1×××t1 ≤ s2×××t2

With combinators is much harder:combinators distribute over constructors, e.g.

(s1∨∨∨s2) → t R (s1 → t)∧∧∧(s2 → t)

Without a clear semantics, subtyping is hard to define, e.g.

ch+(s)∧∧∧ch−(t) ≤ ch−(s)∨∨∨ch+(t) ???

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 4/39

Page 13:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Why it is difficult?

t ::= B | t×××t | t→→→t | t∨∨∨t | t∧∧∧t | ¬t | 0 | 1

Handling subtyping without combinators is easy:constructors do not mix, e.g.:

s2 ≤ s1 t1 ≤ t2s1 → t1 ≤ s2 → t2

s1 ≤ s2 t1 ≤ t2s1×××t1 ≤ s2×××t2

With combinators is much harder:combinators distribute over constructors, e.g.

(s1∨∨∨s2) → t R (s1 → t)∧∧∧(s2 → t)

Without a clear semantics, subtyping is hard to define, e.g.

ch+(s)∧∧∧ch−(t) ≤ ch−(s)∨∨∨ch+(t) ???

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 4/39

Page 14:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Why it is difficult?

t ::= B | t×××t | t→→→t | t∨∨∨t | t∧∧∧t | ¬t | 0 | 1

Handling subtyping without combinators is easy:constructors do not mix, e.g.:

s2 ≤ s1 t1 ≤ t2s1 → t1 ≤ s2 → t2

s1 ≤ s2 t1 ≤ t2s1×××t1 ≤ s2×××t2

With combinators is much harder:combinators distribute over constructors, e.g.

(s1∨∨∨s2) → t R (s1 → t)∧∧∧(s2 → t)

Without a clear semantics, subtyping is hard to define, e.g.

ch+(s)∧∧∧ch−(t) ≤ ch−(s)∨∨∨ch+(t) ???

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 4/39

Page 15:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Why it is difficult?

t ::= B | t×××t | t→→→t | t∨∨∨t | t∧∧∧t | ¬t | 0 | 1

Handling subtyping without combinators is easy:constructors do not mix, e.g.:

s2 ≤ s1 t1 ≤ t2s1 → t1 ≤ s2 → t2

s1 ≤ s2 t1 ≤ t2s1×××t1 ≤ s2×××t2

With combinators is much harder:combinators distribute over constructors, e.g.

(s1∨∨∨s2) → t R (s1 → t)∧∧∧(s2 → t)

Without a clear semantics, subtyping is hard to define, e.g.

ch+(s)∧∧∧ch−(t) ≤ ch−(s)∨∨∨ch+(t) ???

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 4/39

Page 16:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Why it is difficult?

t ::= B | t×××t | t→→→t | t∨∨∨t | t∧∧∧t | ¬t | 0 | 1

Handling subtyping without combinators is easy:constructors do not mix, e.g.:

s2 ≤ s1 t1 ≤ t2s1 → t1 ≤ s2 → t2

s1 ≤ s2 t1 ≤ t2s1×××t1 ≤ s2×××t2

With combinators is much harder:combinators distribute over constructors, e.g.

(s1∨∨∨s2) → t R (s1 → t)∧∧∧(s2 → t)

Without a clear semantics, subtyping is hard to define, e.g.

ch+(s)∧∧∧ch−(t) ≤ ch−(s)∨∨∨ch+(t) ???

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 4/39

Page 17:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Why it is difficult?

t ::= B | t×××t | t→→→t | t∨∨∨t | t∧∧∧t | ¬t | 0 | 1

Handling subtyping without combinators is easy:constructors do not mix, e.g.:

s2 ≤ s1 t1 ≤ t2s1 → t1 ≤ s2 → t2

s1 ≤ s2 t1 ≤ t2s1×××t1 ≤ s2×××t2

With combinators is much harder:combinators distribute over constructors, e.g.

(s1∨∨∨s2) → t R (s1 → t)∧∧∧(s2 → t)

Without a clear semantics, subtyping is hard to define, e.g.

ch+(s)∧∧∧ch−(t) ≤ ch−(s)∨∨∨ch+(t) ???

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 4/39

Page 18:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Why it is difficult?

t ::= B | t×××t | t→→→t | t∨∨∨t | t∧∧∧t | ¬t | 0 | 1

Handling subtyping without combinators is easy:constructors do not mix, e.g.:

s2 ≤ s1 t1 ≤ t2s1 → t1 ≤ s2 → t2

s1 ≤ s2 t1 ≤ t2s1×××t1 ≤ s2×××t2

With combinators is much harder:combinators distribute over constructors, e.g.

(s1∨∨∨s2) → t R (s1 → t)∧∧∧(s2 → t)

Without a clear semantics, subtyping is hard to define, e.g.

ch+(s)∧∧∧ch−(t) ≤ ch−(s)∨∨∨ch+(t) ???

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 4/39

Page 19:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Why it is difficult?

t ::= B | t×××t | t→→→t | t∨∨∨t | t∧∧∧t | ¬t | 0 | 1

Handling subtyping without combinators is easy:constructors do not mix, e.g.:

s2 ≤ s1 t1 ≤ t2s1 → t1 ≤ s2 → t2

s1 ≤ s2 t1 ≤ t2s1×××t1 ≤ s2×××t2

With combinators is much harder:combinators distribute over constructors, e.g.

(s1∨∨∨s2) → t R (s1 → t)∧∧∧(s2 → t)

Without a clear semantics, subtyping is hard to define, e.g.

ch+(s)∧∧∧ch−(t) ≤ ch−(s)∨∨∨ch+(t) ???

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 4/39

Page 20:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Why it is difficult?

t ::= B | t×××t | t→→→t | t∨∨∨t | t∧∧∧t | ¬t | 0 | 1

MAIN IDEA

Instead of defining the subtyping relation so that it conforms tothe semantic of types, define the semantics of types and derive thesubtyping relation.

Handling subtyping without combinators is easy:constructors do not mix, e.g.:

s2 ≤ s1 t1 ≤ t2s1 → t1 ≤ s2 → t2

s1 ≤ s2 t1 ≤ t2s1×××t1 ≤ s2×××t2

With combinators is much harder:combinators distribute over constructors, e.g.

(s1∨∨∨s2) → t R (s1 → t)∧∧∧(s2 → t)

Without a clear semantics, subtyping is hard to define, e.g.

ch+(s)∧∧∧ch−(t) ≤ ch−(s)∨∨∨ch+(t) ???

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 4/39

Page 21:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Why it is difficult?

t ::= B | t×××t | t→→→t | t∨∨∨t | t∧∧∧t | ¬t | 0 | 1

MAIN IDEA

Instead of defining the subtyping relation so that it conforms tothe semantic of types, define the semantics of types and derive thesubtyping relation.

Not a particularly new idea. Many attempts(e.g. Aiken&Wimmers, Damm,. . . , Hosoya&Pierce).

None fully satisfactory. (no negation, or no function types,or restrictions on unions and intersections, . . . )

Starting point of what follows: the approach ofHosoya&Pierce.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 4/39

Page 22:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Why it is difficult?

t ::= B | t×××t | t→→→t | t∨∨∨t | t∧∧∧t | ¬t | 0 | 1

MAIN IDEA

Instead of defining the subtyping relation so that it conforms tothe semantic of types, define the semantics of types and derive thesubtyping relation.

Not a particularly new idea. Many attempts(e.g. Aiken&Wimmers, Damm,. . . , Hosoya&Pierce).

None fully satisfactory. (no negation, or no function types,or restrictions on unions and intersections, . . . )

Starting point of what follows: the approach ofHosoya&Pierce.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 4/39

Page 23:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Why it is difficult?

t ::= B | t×××t | t→→→t | t∨∨∨t | t∧∧∧t | ¬t | 0 | 1

MAIN IDEA

Instead of defining the subtyping relation so that it conforms tothe semantic of types, define the semantics of types and derive thesubtyping relation.

Not a particularly new idea. Many attempts(e.g. Aiken&Wimmers, Damm,. . . , Hosoya&Pierce).

None fully satisfactory. (no negation, or no function types,or restrictions on unions and intersections, . . . )

Starting point of what follows: the approach ofHosoya&Pierce.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 4/39

Page 24:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Semantic subtyping

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 5/39

Page 25:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Semantic subtyping

1 Define a set-theoretic semantics of the types:

J K : Types −→ P(D)

2 Define the subtyping relation as follows:

s ≤ tdef⇐⇒ JsK ⊆ JtK

KEY OBSERVATION 1:

The model of types may be independent from a model of terms

Hosoya and Pierce use the model of values:JtKV = {v | ` v : t}

Works because XML documents are the only XDuce values and forthem JtKV can be defined independently from the typing relation

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 6/39

Page 26:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Semantic subtyping

1 Define a set-theoretic semantics of the types:

J K : Types −→ P(D)

2 Define the subtyping relation as follows:

s ≤ tdef⇐⇒ JsK ⊆ JtK

KEY OBSERVATION 1:

The model of types may be independent from a model of terms

Hosoya and Pierce use the model of values:JtKV = {v | ` v : t}

Works because XML documents are the only XDuce values and forthem JtKV can be defined independently from the typing relation

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 6/39

Page 27:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Semantic subtyping

1 Define a set-theoretic semantics of the types:

J K : Types −→ P(D)

2 Define the subtyping relation as follows:

s ≤ tdef⇐⇒ JsK ⊆ JtK

KEY OBSERVATION 1:

The model of types may be independent from a model of terms

Hosoya and Pierce use the model of values:JtKV = {v | ` v : t}

Works because XML documents are the only XDuce values and forthem JtKV can be defined independently from the typing relation

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 6/39

Page 28:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Semantic subtyping

1 Define a set-theoretic semantics of the types:

J K : Types −→ P(D)

2 Define the subtyping relation as follows:

s ≤ tdef⇐⇒ JsK ⊆ JtK

KEY OBSERVATION 1:

The model of types may be independent from a model of terms

Hosoya and Pierce use the model of values:JtKV = {v | ` v : t}

Works because XML documents are the only XDuce values and forthem JtKV can be defined independently from the typing relation

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 6/39

Page 29:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Semantic subtyping

1 Define a set-theoretic semantics of the types:

J K : Types −→ P(D)

2 Define the subtyping relation as follows:

s ≤ tdef⇐⇒ JsK ⊆ JtK

KEY OBSERVATION 1:

The model of types may be independent from a model of terms

Hosoya and Pierce use the model of values:JtKV = {v | ` v : t}

Works because XML documents are the only XDuce values and forthem JtKV can be defined independently from the typing relation

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 6/39

Page 30:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Semantic subtyping

1 Define a set-theoretic semantics of the types:

J K : Types −→ P(D)

2 Define the subtyping relation as follows:

s ≤ tdef⇐⇒ JsK ⊆ JtK

KEY OBSERVATION 1:

The model of types may be independent from a model of terms

Hosoya and Pierce use the model of values:JtKV = {v | ` v : t}

Works because XML documents are the only XDuce values and forthem JtKV can be defined independently from the typing relation

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 6/39

Page 31:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Circularity

Model of values

t ≤ s ⇐⇒ JtKV ⊆ JsKV where JtKV = {v | ` v : t}

For instance, it does not work with arrow types: values areλ-abstractions and need (sub)typing to be defined

JtKD

t ≤ t JtKV

` e : t ` v : t

A similar circularity holds for π-calculus channels, as well

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 7/39

Page 32:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Circularity

Model of values

t ≤ s ⇐⇒ JtKV ⊆ JsKV where JtKV = {v | ` v : t}

For instance, it does not work with arrow types: values areλ-abstractions and need (sub)typing to be defined

JtKD

t ≤ t JtKV

` e : t ` v : t

A similar circularity holds for π-calculus channels, as well

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 7/39

Page 33:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Circularity

Model of values

t ≤ s ⇐⇒ JtKV ⊆ JsKV where JtKV = {v | ` v : t}

For instance, it does not work with arrow types: values areλ-abstractions and need (sub)typing to be defined

JtKD

t ≤ t JtKV

` e : t ` v : t

A similar circularity holds for π-calculus channels, as well

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 7/39

Page 34:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Circularity

Model of values

t ≤ s ⇐⇒ JtKV ⊆ JsKV where JtKV = {v | ` v : t}

For instance, it does not work with arrow types: values areλ-abstractions and need (sub)typing to be defined

JtKD

t ≤ t JtKV

��` e : t ` v : t

A similar circularity holds for π-calculus channels, as well

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 7/39

Page 35:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Circularity

Model of values

t ≤ s ⇐⇒ JtKV ⊆ JsKV where JtKV = {v | ` v : t}

For instance, it does not work with arrow types: values areλ-abstractions and need (sub)typing to be defined

JtKD

t ≤ t JtKV

��` e : t ` v : tgg

A similar circularity holds for π-calculus channels, as well

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 7/39

Page 36:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Circularity

Model of values

t ≤ s ⇐⇒ JtKV ⊆ JsKV where JtKV = {v | ` v : t}

For instance, it does not work with arrow types: values areλ-abstractions and need (sub)typing to be defined

JtKD

t ≤ t JtKV

��` e : t

CC

` v : tgg

A similar circularity holds for π-calculus channels, as well

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 7/39

Page 37:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Circularity

Model of values

t ≤ s ⇐⇒ JtKV ⊆ JsKV where JtKV = {v | ` v : t}

For instance, it does not work with arrow types: values areλ-abstractions and need (sub)typing to be defined

JtKD

t ≤ t((JtKV

��` e : t

CC

` v : tgg

A similar circularity holds for π-calculus channels, as well

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 7/39

Page 38:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Circularity

Model of values

t ≤ s ⇐⇒ JtKV ⊆ JsKV where JtKV = {v | ` v : t}

For instance, it does not work with arrow types: values areλ-abstractions and need (sub)typing to be defined

JtKD

t ≤ t((JtKV

��` e : t ` v : t

XX

A similar circularity holds for π-calculus channels, as well

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 7/39

Page 39:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Bootstrap

Model of values

t ≤ s ⇐⇒ JtKV ⊆ JsKV where JtKV = {v | ` v : t}

For instance, it does not work with arrow types: values areλ-abstractions and need (sub)typing to be defined

JtKD

t ≤ t JtKV

` e : t ` v : t

A similar circularity holds for π-calculus channels, as well

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 7/39

Page 40:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Bootstrap

Model of values

t ≤ s ⇐⇒ JtKV ⊆ JsKV where JtKV = {v | ` v : t}

For instance, it does not work with arrow types: values areλ-abstractions and need (sub)typing to be defined

JtKD

t ≤ t JtKV

` e : t ` v : t

A similar circularity holds for π-calculus channels, as well

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 7/39

Page 41:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Bootstrap

Model of values

t ≤ s ⇐⇒ JtKV ⊆ JsKV where JtKV = {v | ` v : t}

For instance, it does not work with arrow types: values areλ-abstractions and need (sub)typing to be defined

JtKD

t ≤ t JtKV

` e : t ` v : t

A similar circularity holds for π-calculus channels, as well

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 7/39

Page 42:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Bootstrap

Model of values

t ≤ s ⇐⇒ JtKV ⊆ JsKV where JtKV = {v | ` v : t}

For instance, it does not work with arrow types: values areλ-abstractions and need (sub)typing to be defined

JtKD

t ≤ t

,,

JtKV

` e : t ` v : t

A similar circularity holds for π-calculus channels, as well

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 7/39

Page 43:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Bootstrap

Model of values

t ≤ s ⇐⇒ JtKV ⊆ JsKV where JtKV = {v | ` v : t}

For instance, it does not work with arrow types: values areλ-abstractions and need (sub)typing to be defined

JtKD

t ≤ t

,,

JtKV

` e : t

CC

` v : t

A similar circularity holds for π-calculus channels, as well

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 7/39

Page 44:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Bootstrap

Model of values

t ≤ s ⇐⇒ JtKV ⊆ JsKV where JtKV = {v | ` v : t}

For instance, it does not work with arrow types: values areλ-abstractions and need (sub)typing to be defined

JtKD

t ≤ t

,,

JtKV

` e : t

CC

` v : tgg

A similar circularity holds for π-calculus channels, as well

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 7/39

Page 45:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Bootstrap

Model of values

t ≤ s ⇐⇒ JtKV ⊆ JsKV where JtKV = {v | ` v : t}

For instance, it does not work with arrow types: values areλ-abstractions and need (sub)typing to be defined

JtKD

t ≤ t

,,

JtKV

��` e : t

CC

` v : tgg

A similar circularity holds for π-calculus channels, as well

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 7/39

Page 46:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Bootstrap

Model of values

t ≤ s ⇐⇒ JtKV ⊆ JsKV where JtKV = {v | ` v : t}

For instance, it does not work with arrow types: values areλ-abstractions and need (sub)typing to be defined

JtKD

t ≤ t

,,

???((JtKV

��` e : t

CC

` v : tgg

A similar circularity holds for π-calculus channels, as well

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 7/39

Page 47:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Bootstrap

Model of values

t ≤ s ⇐⇒ JtKV ⊆ JsKV where JtKV = {v | ` v : t}

For instance, it does not work with arrow types: values areλ-abstractions and need (sub)typing to be defined

JtKD

���

���

t ≤ t

,,

???((JtKV

��` e : t

CC

` v : tgg

A similar circularity holds for π-calculus channels, as well

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 7/39

Page 48:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Semantic subtyping in five steps:

1 Add boolean combinators: ∨∨∨, ∧∧∧, ¬¬¬to your favourite type constructors (e.g., →, ×, ch( ), . . . )

2 Define a set-theoretic semantics: J KD : Types → P(D)(Js∧∧∧tKD = JsKD ∩ JtKD , Js∨∨∨tKD = JsKD ∪ JtKD , J¬¬¬tKD = D \ JtKD)

s ≤D tdef⇐⇒ JsKD ⊆ JtKD

3 Find a subtyping algorithm by using the set-theoreticproperties of the model [optional but advisable]

4 Define a language and type it by using s ≤D t:Γ `D e : s s ≤D t

Γ `D e : t

5 Close the circle: define the types-as-set-of-values semanticsJtKV = {v ∈ V | `D v : t} and check

s ≤D t ⇐⇒ s ≤V t

The rest of the story is standard: subject reduction, . . .Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 8/39

Page 49:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Semantic subtyping in five steps:

1 Add boolean combinators: ∨∨∨, ∧∧∧, ¬¬¬to your favourite type constructors (e.g., →, ×, ch( ), . . . )

2 Define a set-theoretic semantics: J KD : Types → P(D)(Js∧∧∧tKD = JsKD ∩ JtKD , Js∨∨∨tKD = JsKD ∪ JtKD , J¬¬¬tKD = D \ JtKD)

s ≤D tdef⇐⇒ JsKD ⊆ JtKD

3 Find a subtyping algorithm by using the set-theoreticproperties of the model [optional but advisable]

4 Define a language and type it by using s ≤D t:Γ `D e : s s ≤D t

Γ `D e : t

5 Close the circle: define the types-as-set-of-values semanticsJtKV = {v ∈ V | `D v : t} and check

s ≤D t ⇐⇒ s ≤V t

The rest of the story is standard: subject reduction, . . .Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 8/39

Page 50:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Semantic subtyping in five steps:

1 Add boolean combinators: ∨∨∨, ∧∧∧, ¬¬¬to your favourite type constructors (e.g., →, ×, ch( ), . . . )

2 Define a set-theoretic semantics: J KD : Types → P(D)(Js∧∧∧tKD = JsKD ∩ JtKD , Js∨∨∨tKD = JsKD ∪ JtKD , J¬¬¬tKD = D \ JtKD)

s ≤D tdef⇐⇒ JsKD ⊆ JtKD

3 Find a subtyping algorithm by using the set-theoreticproperties of the model [optional but advisable]

4 Define a language and type it by using s ≤D t:Γ `D e : s s ≤D t

Γ `D e : t

5 Close the circle: define the types-as-set-of-values semanticsJtKV = {v ∈ V | `D v : t} and check

s ≤D t ⇐⇒ s ≤V t

The rest of the story is standard: subject reduction, . . .Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 8/39

Page 51:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Semantic subtyping in five steps:

1 Add boolean combinators: ∨∨∨, ∧∧∧, ¬¬¬to your favourite type constructors (e.g., →, ×, ch( ), . . . )

2 Define a set-theoretic semantics: J KD : Types → P(D)(Js∧∧∧tKD = JsKD ∩ JtKD , Js∨∨∨tKD = JsKD ∪ JtKD , J¬¬¬tKD = D \ JtKD)

s ≤D tdef⇐⇒ JsKD ⊆ JtKD

3 Find a subtyping algorithm by using the set-theoreticproperties of the model [optional but advisable]

4 Define a language and type it by using s ≤D t:Γ `D e : s s ≤D t

Γ `D e : t

5 Close the circle: define the types-as-set-of-values semanticsJtKV = {v ∈ V | `D v : t} and check

s ≤D t ⇐⇒ s ≤V t

The rest of the story is standard: subject reduction, . . .Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 8/39

Page 52:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Semantic subtyping in five steps:

1 Add boolean combinators: ∨∨∨, ∧∧∧, ¬¬¬to your favourite type constructors (e.g., →, ×, ch( ), . . . )

2 Define a set-theoretic semantics: J KD : Types → P(D)(Js∧∧∧tKD = JsKD ∩ JtKD , Js∨∨∨tKD = JsKD ∪ JtKD , J¬¬¬tKD = D \ JtKD)

s ≤D tdef⇐⇒ JsKD ⊆ JtKD

3 Find a subtyping algorithm by using the set-theoreticproperties of the model [optional but advisable]

4 Define a language and type it by using s ≤D t:Γ `D e : s s ≤D t

Γ `D e : t

5 Close the circle: define the types-as-set-of-values semanticsJtKV = {v ∈ V | `D v : t} and check

s ≤D t ⇐⇒ s ≤V t

The rest of the story is standard: subject reduction, . . .Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 8/39

Page 53:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Semantic subtyping in five steps:

1 Add boolean combinators: ∨∨∨, ∧∧∧, ¬¬¬to your favourite type constructors (e.g., →, ×, ch( ), . . . )

2 Define a set-theoretic semantics: J KD : Types → P(D)(Js∧∧∧tKD = JsKD ∩ JtKD , Js∨∨∨tKD = JsKD ∪ JtKD , J¬¬¬tKD = D \ JtKD)

s ≤D tdef⇐⇒ JsKD ⊆ JtKD

3 Find a subtyping algorithm by using the set-theoreticproperties of the model [optional but advisable]

4 Define a language and type it by using s ≤D t:Γ `D e : s s ≤D t

Γ `D e : t

5 Close the circle: define the types-as-set-of-values semanticsJtKV = {v ∈ V | `D v : t} and check

s ≤D t ⇐⇒ s ≤V t

The rest of the story is standard: subject reduction, . . .Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 8/39

Page 54:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Semantic subtyping in five steps:

1 Add boolean combinators: ∨∨∨, ∧∧∧, ¬¬¬to your favourite type constructors (e.g., →, ×, ch( ), . . . )

2 Define a set-theoretic semantics: J KD : Types → P(D)(Js∧∧∧tKD = JsKD ∩ JtKD , Js∨∨∨tKD = JsKD ∪ JtKD , J¬¬¬tKD = D \ JtKD)

s ≤D tdef⇐⇒ JsKD ⊆ JtKD

3 Find a subtyping algorithm by using the set-theoreticproperties of the model [optional but advisable]

4 Define a language and type it by using s ≤D t:Γ `D e : s s ≤D t

Γ `D e : t

5 Close the circle: define the types-as-set-of-values semanticsJtKV = {v ∈ V | `D v : t} and check

s ≤D t ⇐⇒ s ≤V t

The rest of the story is standard: subject reduction, . . .Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 8/39

Page 55:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Semantic subtyping in five steps:

1 Add boolean combinators: ∨∨∨, ∧∧∧, ¬¬¬to your favourite type constructors (e.g., →, ×, ch( ), . . . )

2 Define a set-theoretic semantics: J KD : Types → P(D)(Js∧∧∧tKD = JsKD ∩ JtKD , Js∨∨∨tKD = JsKD ∪ JtKD , J¬¬¬tKD = D \ JtKD)

s ≤D tdef⇐⇒ JsKD ⊆ JtKD

3 Find a subtyping algorithm by using the set-theoreticproperties of the model [optional but advisable]

4 Define a language and type it by using s ≤D t:Γ `D e : s s ≤D t

Γ `D e : t

5 Close the circle: define the types-as-set-of-values semanticsJtKV = {v ∈ V | `D v : t} and check

s ≤D t ⇐⇒ s ≤V t

The rest of the story is standard: subject reduction, . . .Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 8/39

Page 56:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Semantic subtyping in five steps:

1 Add boolean combinators: ∨∨∨, ∧∧∧, ¬¬¬to your favourite type constructors (e.g., →, ×, ch( ), . . . )

2 Define a set-theoretic semantics: J KD : Types → P(D)(Js∧∧∧tKD = JsKD ∩ JtKD , Js∨∨∨tKD = JsKD ∪ JtKD , J¬¬¬tKD = D \ JtKD)

s ≤D tdef⇐⇒ JsKD ⊆ JtKD

3 Find a subtyping algorithm by using the set-theoreticproperties of the model [optional but advisable]

4 Define a language and type it by using s ≤D t:Γ `D e : s s ≤D t

Γ `D e : t

5 Close the circle: define the types-as-set-of-values semanticsJtKV = {v ∈ V | `D v : t} and check

s ≤D t ⇐⇒ s ≤V t

The rest of the story is standard: subject reduction, . . .Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 8/39

Page 57:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Semantic subtyping in five steps:

1 Add boolean combinators: ∨∨∨, ∧∧∧, ¬¬¬to your favourite type constructors (e.g., →, ×, ch( ), . . . )

2 Define a set-theoretic semantics: J KD : Types → P(D)(Js∧∧∧tKD = JsKD ∩ JtKD , Js∨∨∨tKD = JsKD ∪ JtKD , J¬¬¬tKD = D \ JtKD)

s ≤D tdef⇐⇒ JsKD ⊆ JtKD

3 Find a subtyping algorithm by using the set-theoreticproperties of the model [optional but advisable]

4 Define a language and type it by using s ≤D t:Γ `D e : s s ≤D t

Γ `D e : t

5 Close the circle: define the types-as-set-of-values semanticsJtKV = {v ∈ V | `D v : t} and check

s ≤D t ⇐⇒ s ≤V t

The rest of the story is standard: subject reduction, . . .Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 8/39

Page 58:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Semantic subtyping in five steps:

1 Add boolean combinators: ∨∨∨, ∧∧∧, ¬¬¬to your favourite type constructors (e.g., →, ×, ch( ), . . . )

2 Define a set-theoretic semantics: J KD : Types → P(D)(Js∧∧∧tKD = JsKD ∩ JtKD , Js∨∨∨tKD = JsKD ∪ JtKD , J¬¬¬tKD = D \ JtKD)

s ≤D tdef⇐⇒ JsKD ⊆ JtKD

3 Find a subtyping algorithm by using the set-theoreticproperties of the model [optional but advisable]

4 Define a language and type it by using s ≤D t:Γ `D e : s s ≤D t

Γ `D e : t

5 Close the circle: define the types-as-set-of-values semanticsJtKV = {v ∈ V | `D v : t} and check

s ≤D t ⇐⇒ s ≤V t

The rest of the story is standard: subject reduction, . . .Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 8/39

Page 59:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

λ-calculus.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 9/39

Page 60:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 1: types for λ

Types t ::= b basic types| t×××t product type| t→→→t function type

type constructors

| 0 empty type| 1 top type| ¬¬¬t negation type| t∨∨∨t union type| t∧∧∧t intersection type

type combinators

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 10/39

Page 61:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 1: types for λ

Types t ::= b basic types| t×××t product type| t→→→t function type

type constructors

| 0 empty type| 1 top type| ¬¬¬t negation type| t∨∨∨t union type| t∧∧∧t intersection type

type combinators

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 10/39

Page 62:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 1: types for λ

Types t ::= b basic types| t×××t product type| t→→→t function type

type constructors

| 0 empty type| 1 top type| ¬¬¬t negation type| t∨∨∨t union type| t∧∧∧t intersection type

type combinators

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 10/39

Page 63:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

J KD : Types → P(D)

Easy part: Js∧∧∧tKD = JsKD∩ JtKD Js∨∨∨tKD = JsKD∪ JtKD

J¬¬¬tKD = D \ JtKD Js×××tKD = JsKD× JtKD

Impossible since it requires P(D2) ⊆ D

KEY OBSERVATION 2:

We need the model to state how types are related rather thanwhat the types are

Use any J K that behaves w.r.t. ⊆ as if equation (∗) held, namely

Jt1→→→s1K ⊆ Jt2→→→s2K ⇐⇒ P(Jt1K× Js1K) ⊆ P(Jt2K× Js2K)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 11/39

Page 64:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

J KD : Types → P(D)

Easy part: Js∧∧∧tKD = JsKD∩ JtKD Js∨∨∨tKD = JsKD∪ JtKD

J¬¬¬tKD = D \ JtKD Js×××tKD = JsKD× JtKD

Impossible since it requires P(D2) ⊆ D

KEY OBSERVATION 2:

We need the model to state how types are related rather thanwhat the types are

Use any J K that behaves w.r.t. ⊆ as if equation (∗) held, namely

Jt1→→→s1K ⊆ Jt2→→→s2K ⇐⇒ P(Jt1K× Js1K) ⊆ P(Jt2K× Js2K)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 11/39

Page 65:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

J KD : Types → P(D)

Easy part: Js∧∧∧tKD = JsKD∩ JtKD Js∨∨∨tKD = JsKD∪ JtKD

J¬¬¬tKD = D \ JtKD Js×××tKD = JsKD× JtKD

Hard part: Jt→→→sK = ???

Impossible since it requires P(D2) ⊆ D

KEY OBSERVATION 2:

We need the model to state how types are related rather thanwhat the types are

Use any J K that behaves w.r.t. ⊆ as if equation (∗) held, namely

Jt1→→→s1K ⊆ Jt2→→→s2K ⇐⇒ P(Jt1K× Js1K) ⊆ P(Jt2K× Js2K)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 11/39

Page 66:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

J KD : Types → P(D)

Easy part: Js∧∧∧tKD = JsKD∩ JtKD Js∨∨∨tKD = JsKD∪ JtKD

J¬¬¬tKD = D \ JtKD Js×××tKD = JsKD× JtKD

Hard part: Jt→→→sK = {functions from JtK to JsK}

Impossible since it requires P(D2) ⊆ D

KEY OBSERVATION 2:

We need the model to state how types are related rather thanwhat the types are

Use any J K that behaves w.r.t. ⊆ as if equation (∗) held, namely

Jt1→→→s1K ⊆ Jt2→→→s2K ⇐⇒ P(Jt1K× Js1K) ⊆ P(Jt2K× Js2K)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 11/39

Page 67:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

J KD : Types → P(D)

Easy part: Js∧∧∧tKD = JsKD∩ JtKD Js∨∨∨tKD = JsKD∪ JtKD

J¬¬¬tKD = D \ JtKD Js×××tKD = JsKD× JtKD

Hard part: Jt→→→sK = {f ⊆ D2 | ∀(d1, d2)∈ f . d1∈JtK ⇒ d2∈JsK}

Impossible since it requires P(D2) ⊆ D

KEY OBSERVATION 2:

We need the model to state how types are related rather thanwhat the types are

Use any J K that behaves w.r.t. ⊆ as if equation (∗) held, namely

Jt1→→→s1K ⊆ Jt2→→→s2K ⇐⇒ P(Jt1K× Js1K) ⊆ P(Jt2K× Js2K)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 11/39

Page 68:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

J KD : Types → P(D)

Easy part: Js∧∧∧tKD = JsKD∩ JtKD Js∨∨∨tKD = JsKD∪ JtKD

J¬¬¬tKD = D \ JtKD Js×××tKD = JsKD× JtKD

Hard part: Jt→→→sK = P(JtK× JsK) (∗)

Impossible since it requires P(D2) ⊆ D

KEY OBSERVATION 2:

We need the model to state how types are related rather thanwhat the types are

Use any J K that behaves w.r.t. ⊆ as if equation (∗) held, namely

Jt1→→→s1K ⊆ Jt2→→→s2K ⇐⇒ P(Jt1K× Js1K) ⊆ P(Jt2K× Js2K)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 11/39

Page 69:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

J KD : Types → P(D)

Easy part: Js∧∧∧tKD = JsKD∩ JtKD Js∨∨∨tKD = JsKD∪ JtKD

J¬¬¬tKD = D \ JtKD Js×××tKD = JsKD× JtKD

Hard part: Jt→→→sK = P(JtK× JsK) (∗)

Impossible since it requires P(D2) ⊆ D

KEY OBSERVATION 2:

We need the model to state how types are related rather thanwhat the types are

Use any J K that behaves w.r.t. ⊆ as if equation (∗) held, namely

Jt1→→→s1K ⊆ Jt2→→→s2K ⇐⇒ P(Jt1K× Js1K) ⊆ P(Jt2K× Js2K)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 11/39

Page 70:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

J KD : Types → P(D)

Easy part: Js∧∧∧tKD = JsKD∩ JtKD Js∨∨∨tKD = JsKD∪ JtKD

J¬¬¬tKD = D \ JtKD Js×××tKD = JsKD× JtKD

Hard part: Jt→→→sK = P(JtK× JsK) (∗)

Impossible since it requires P(D2) ⊆ D

KEY OBSERVATION 2:

We need the model to state how types are related rather thanwhat the types are

Use any J K that behaves w.r.t. ⊆ as if equation (∗) held, namely

Jt1→→→s1K ⊆ Jt2→→→s2K ⇐⇒ P(Jt1K× Js1K) ⊆ P(Jt2K× Js2K)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 11/39

Page 71:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

J KD : Types → P(D)

Easy part: Js∧∧∧tKD = JsKD∩ JtKD Js∨∨∨tKD = JsKD∪ JtKD

J¬¬¬tKD = D \ JtKD Js×××tKD = JsKD× JtKD

Hard part: Jt→→→sK = P(JtK× JsK) (∗)

Impossible since it requires P(D2) ⊆ D

KEY OBSERVATION 2:

We need the model to state how types are related rather thanwhat the types are

Use any J K that behaves w.r.t. ⊆ as if equation (∗) held, namely

Jt1→→→s1K ⊆ Jt2→→→s2K ⇐⇒ P(Jt1K× Js1K) ⊆ P(Jt2K× Js2K)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 11/39

Page 72:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

J KD : Types → P(D)

Easy part: Js∧∧∧tKD = JsKD∩ JtKD Js∨∨∨tKD = JsKD∪ JtKD

J¬¬¬tKD = D \ JtKD Js×××tKD = JsKD× JtKD

Hard part: Jt→→→sK = P(JtK× JsK) (∗)

Impossible since it requires P(D2) ⊆ D

KEY OBSERVATION 2:

We need the model to state how types are related rather thanwhat the types are

Use any J K that behaves w.r.t. ⊆ as if equation (∗) held, namely

Jt1→→→s1K ⊆ Jt2→→→s2K ⇐⇒ P(Jt1K× Js1K) ⊆ P(Jt2K× Js2K)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 11/39

Page 73:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

Solution: Jt→→→sK = Pf (JtK× JsK) (∗)

Subtyping is completely characterised by type emptiness

Indeed: s ≤ t ⇔ JsK ⊆ JtK ⇔ JsK ∩ JtK = ∅⇔ Js∧∧∧¬¬¬tK = ∅

Pf (X ) = ∅ ⇐⇒ P(X ) = ∅

Therefore, (∗) induces the same subtyping relation subtyping as

Jt→→→sK = P(JtK× JsK)

Bootstrap model

D least solution of X = X 2 + Pf (X2)

J0KD = ∅ J1KD = D Js∨∨∨tKD = JsKD∪ JtKD Js∧∧∧tKD = JsKD∩ JtKD

J¬¬¬tKD = D\JtKD Js×××tKD = JsK× JtK Jt→→→sKD = Pf (JtKD× JsKD)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 12/39

Page 74:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

Solution: Jt→→→sK = Pf (JtK× JsK) (∗)

Subtyping is completely characterised by type emptiness

Indeed: s ≤ t ⇔ JsK ⊆ JtK ⇔ JsK ∩ JtK = ∅⇔ Js∧∧∧¬¬¬tK = ∅

Pf (X ) = ∅ ⇐⇒ P(X ) = ∅

Therefore, (∗) induces the same subtyping relation subtyping as

Jt→→→sK = P(JtK× JsK)

Bootstrap model

D least solution of X = X 2 + Pf (X2)

J0KD = ∅ J1KD = D Js∨∨∨tKD = JsKD∪ JtKD Js∧∧∧tKD = JsKD∩ JtKD

J¬¬¬tKD = D\JtKD Js×××tKD = JsK× JtK Jt→→→sKD = Pf (JtKD× JsKD)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 12/39

Page 75:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

Solution: Jt→→→sK = Pf (JtK× JsK) (∗)

Subtyping is completely characterised by type emptiness

Indeed: s ≤ t ⇔ JsK ⊆ JtK ⇔ JsK ∩ JtK = ∅⇔ Js∧∧∧¬¬¬tK = ∅

Pf (X ) = ∅ ⇐⇒ P(X ) = ∅

Therefore, (∗) induces the same subtyping relation subtyping as

Jt→→→sK = P(JtK× JsK)

Bootstrap model

D least solution of X = X 2 + Pf (X2)

J0KD = ∅ J1KD = D Js∨∨∨tKD = JsKD∪ JtKD Js∧∧∧tKD = JsKD∩ JtKD

J¬¬¬tKD = D\JtKD Js×××tKD = JsK× JtK Jt→→→sKD = Pf (JtKD× JsKD)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 12/39

Page 76:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

Solution: Jt→→→sK = Pf (JtK× JsK) (∗)

Subtyping is completely characterised by type emptiness

Indeed: s ≤ t ⇔ JsK ⊆ JtK ⇔ JsK ∩ JtK = ∅⇔ Js∧∧∧¬¬¬tK = ∅

Pf (X ) = ∅ ⇐⇒ P(X ) = ∅

Therefore, (∗) induces the same subtyping relation subtyping as

Jt→→→sK = P(JtK× JsK)

Bootstrap model

D least solution of X = X 2 + Pf (X2)

J0KD = ∅ J1KD = D Js∨∨∨tKD = JsKD∪ JtKD Js∧∧∧tKD = JsKD∩ JtKD

J¬¬¬tKD = D\JtKD Js×××tKD = JsK× JtK Jt→→→sKD = Pf (JtKD× JsKD)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 12/39

Page 77:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

Solution: Jt→→→sK = Pf (JtK× JsK) (∗)

Subtyping is completely characterised by type emptiness

Indeed: s ≤ t ⇔ JsK ⊆ JtK ⇔ JsK ∩ JtK = ∅⇔ Js∧∧∧¬¬¬tK = ∅

Pf (X ) = ∅ ⇐⇒ P(X ) = ∅

Therefore, (∗) induces the same subtyping relation subtyping as

Jt→→→sK = P(JtK× JsK)

Bootstrap model

D least solution of X = X 2 + Pf (X2)

J0KD = ∅ J1KD = D Js∨∨∨tKD = JsKD∪ JtKD Js∧∧∧tKD = JsKD∩ JtKD

J¬¬¬tKD = D\JtKD Js×××tKD = JsK× JtK Jt→→→sKD = Pf (JtKD× JsKD)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 12/39

Page 78:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

Solution: Jt→→→sK = Pf (JtK× JsK) (∗)

Subtyping is completely characterised by type emptiness

Indeed: s ≤ t ⇔ JsK ⊆ JtK ⇔ JsK ∩ JtK = ∅⇔ Js∧∧∧¬¬¬tK = ∅

Pf (X ) = ∅ ⇐⇒ P(X ) = ∅

Therefore, (∗) induces the same subtyping relation subtyping as

Jt→→→sK = P(JtK× JsK)

Bootstrap model

D least solution of X = X 2 + Pf (X2)

J0KD = ∅ J1KD = D Js∨∨∨tKD = JsKD∪ JtKD Js∧∧∧tKD = JsKD∩ JtKD

J¬¬¬tKD = D\JtKD Js×××tKD = JsK× JtK Jt→→→sKD = Pf (JtKD× JsKD)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 12/39

Page 79:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

Solution: Jt→→→sK = Pf (JtK× JsK) (∗)

Subtyping is completely characterised by type emptiness

Indeed: s ≤ t ⇔ JsK ⊆ JtK ⇔ JsK ∩ JtK = ∅⇔ Js∧∧∧¬¬¬tK = ∅

Pf (X ) = ∅ ⇐⇒ P(X ) = ∅

Therefore, (∗) induces the same subtyping relation subtyping as

Jt→→→sK = P(JtK× JsK)

Bootstrap model

D least solution of X = X 2 + Pf (X2)

J0KD = ∅ J1KD = D Js∨∨∨tKD = JsKD∪ JtKD Js∧∧∧tKD = JsKD∩ JtKD

J¬¬¬tKD = D\JtKD Js×××tKD = JsK× JtK Jt→→→sKD = Pf (JtKD× JsKD)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 12/39

Page 80:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 3: Subtyping algorithm

Define:s ≤ t

def⇐⇒ JsK ⊆ JtK

Use it to deduce some subtyping relations, e.g.

(t1∨∨∨t2)→→→(s1∧∧∧s2) � (t1→→→s1)∧∧∧(t2→→→s2) � (t1∨∨∨t2)→→→(s1∨∨∨s2)

How to decide s ≤ t in general?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 13/39

Page 81:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 3: Subtyping algorithm

Define:s ≤ t

def⇐⇒ JsK ⊆ JtK

Use it to deduce some subtyping relations, e.g.

(t1∨∨∨t2)→→→(s1∧∧∧s2) � (t1→→→s1)∧∧∧(t2→→→s2) � (t1∨∨∨t2)→→→(s1∨∨∨s2)

How to decide s ≤ t in general?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 13/39

Page 82:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 3: Subtyping algorithm

Define:s ≤ t

def⇐⇒ JsK ⊆ JtK

Use it to deduce some subtyping relations, e.g.

(t1∨∨∨t2)→→→(s1∧∧∧s2) � (t1→→→s1)∧∧∧(t2→→→s2) � (t1∨∨∨t2)→→→(s1∨∨∨s2)

How to decide s ≤ t in general?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 13/39

Page 83:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 3: Subtyping algorithm

Some ugly formulae:∧∧∧i∈I

ti×××si ≤∨∨∨i∈J

ti×××si

⇐⇒ ∀J ′ ⊆ J.

(∧∧∧i∈I

ti ≤∨∨∨i∈J′

ti

)or

∧∧∧i∈I

si ≤∨∨∨

i∈J\J′si

∧∧∧i∈I

ti→→→si ≤∨∨∨i∈J

ti→→→si

⇐⇒ ∃j ∈ J.∀I ′ ⊆ I .

(tj ≤

∨∨∨i∈I ′

ti

)or

I ′ 6= I et∧∧∧

i∈I\I ′si ≤ sj

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 14/39

Page 84:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 3: Subtyping algorithm

s ≤ t?

Recall that:

s ≤ t ⇐⇒ JsK ∩ JtK = ∅ ⇐⇒ Js∧∧∧¬¬¬tK = ∅ ⇐⇒ s∧∧∧¬¬¬t = 0

1 Consider s∧∧∧¬¬¬t

2 Put it in canonical form∨∨∨(P,N)∈Π

((∧∧∧

s×××t∈P

s×××t)∧∧∧(∧∧∧

s×××t∈N

¬¬¬(s×××t)))∨∨∨

(P,N)∈Σ

((∧∧∧

s→→→t∈P

s→→→t)∧∧∧(∧∧∧

s→→→t∈N

¬¬¬(s→→→t)))

3 Decide (coinductively) whether the two summands are bothempty by applying the ugly formulae of the previous slide.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 15/39

Page 85:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 3: Subtyping algorithm

s ≤ t?

Recall that:

s ≤ t ⇐⇒ JsK ∩ JtK = ∅ ⇐⇒ Js∧∧∧¬¬¬tK = ∅ ⇐⇒ s∧∧∧¬¬¬t = 0

1 Consider s∧∧∧¬¬¬t

2 Put it in canonical form∨∨∨(P,N)∈Π

((∧∧∧

s×××t∈P

s×××t)∧∧∧(∧∧∧

s×××t∈N

¬¬¬(s×××t)))∨∨∨

(P,N)∈Σ

((∧∧∧

s→→→t∈P

s→→→t)∧∧∧(∧∧∧

s→→→t∈N

¬¬¬(s→→→t)))

3 Decide (coinductively) whether the two summands are bothempty by applying the ugly formulae of the previous slide.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 15/39

Page 86:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 3: Subtyping algorithm

s ≤ t?

Recall that:

s ≤ t ⇐⇒ JsK ∩ JtK = ∅ ⇐⇒ Js∧∧∧¬¬¬tK = ∅ ⇐⇒ s∧∧∧¬¬¬t = 0

1 Consider s∧∧∧¬¬¬t

2 Put it in canonical form∨∨∨(P,N)∈Π

((∧∧∧

s×××t∈P

s×××t)∧∧∧(∧∧∧

s×××t∈N

¬¬¬(s×××t)))∨∨∨

(P,N)∈Σ

((∧∧∧

s→→→t∈P

s→→→t)∧∧∧(∧∧∧

s→→→t∈N

¬¬¬(s→→→t)))

3 Decide (coinductively) whether the two summands are bothempty by applying the ugly formulae of the previous slide.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 15/39

Page 87:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 3: Subtyping algorithm

s ≤ t?

Recall that:

s ≤ t ⇐⇒ JsK ∩ JtK = ∅ ⇐⇒ Js∧∧∧¬¬¬tK = ∅ ⇐⇒ s∧∧∧¬¬¬t = 0

1 Consider s∧∧∧¬¬¬t

2 Put it in canonical form∨∨∨(P,N)∈Π

((∧∧∧

s×××t∈P

s×××t)∧∧∧(∧∧∧

s×××t∈N

¬¬¬(s×××t)))∨∨∨

(P,N)∈Σ

((∧∧∧

s→→→t∈P

s→→→t)∧∧∧(∧∧∧

s→→→t∈N

¬¬¬(s→→→t)))

3 Decide (coinductively) whether the two summands are bothempty by applying the ugly formulae of the previous slide.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 15/39

Page 88:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 3: Subtyping algorithm

s ≤ t?

Recall that:

s ≤ t ⇐⇒ JsK ∩ JtK = ∅ ⇐⇒ Js∧∧∧¬¬¬tK = ∅ ⇐⇒ s∧∧∧¬¬¬t = 0

1 Consider s∧∧∧¬¬¬t

2 Put it in canonical form∨∨∨(P,N)∈Π

((∧∧∧

s×××t∈P

s×××t)∧∧∧(∧∧∧

s×××t∈N

¬¬¬(s×××t)))∨∨∨

(P,N)∈Σ

((∧∧∧

s→→→t∈P

s→→→t)∧∧∧(∧∧∧

s→→→t∈N

¬¬¬(s→→→t)))

3 Decide (coinductively) whether the two summands are bothempty by applying the ugly formulae of the previous slide.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 15/39

Page 89:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 4: The Language

Lambda-abstractions: λ∧∧∧i∈I si→→→tix .e

t≡(VVV

i=1..n si→→→ti )∧∧∧(VVV

j=1..m¬¬¬(s′j→→→t′j )) 6=0

(abstr)(∀i) Γ, x : si `D e : tiΓ `D λ∧∧∧i∈I si→→→tix .e : t

Overloading:

J(t1∨∨∨t2)→→→(s1∧∧∧s2)K J(t1→→→s1)∧∧∧(t2→→→s2)K

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 16/39

Page 90:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 4: The Language

Lambda-abstractions: λ∧∧∧i∈I si→→→tix .e

t≡(VVV

i=1..n si→→→ti )∧∧∧(VVV

j=1..m¬¬¬(s′j→→→t′j )) 6=0

(abstr)(∀i) Γ, x : si `D e : tiΓ `D λ∧∧∧i∈I si→→→tix .e : t

Overloading:

J(t1∨∨∨t2)→→→(s1∧∧∧s2)K J(t1→→→s1)∧∧∧(t2→→→s2)K

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 16/39

Page 91:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 4: The Language

Lambda-abstractions: λ∧∧∧i∈I si→→→tix .e

t≡(VVV

i=1..n si→→→ti )∧∧∧(VVV

j=1..m¬¬¬(s′j→→→t′j )) 6=0

(abstr)(∀i) Γ, x : si `D e : tiΓ `D λ∧∧∧i∈I si→→→tix .e : t

Overloading:

J(t1∨∨∨t2)→→→(s1∧∧∧s2)K J(t1→→→s1)∧∧∧(t2→→→s2)K

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 16/39

Page 92:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 4: The Language

Lambda-abstractions: λ∧∧∧i∈I si→→→tix .e

t≡(VVV

i=1..n si→→→ti )∧∧∧(VVV

j=1..m¬¬¬(s′j→→→t′j )) 6=0

(abstr)(∀i) Γ, x : si `D e : tiΓ `D λ∧∧∧i∈I si→→→tix .e : t

Overloading:

J(t1∨∨∨t2)→→→(s1∧∧∧s2)K J(t1→→→s1)∧∧∧(t2→→→s2)K

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 16/39

Page 93:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 4: The Language

Lambda-abstractions: λ∧∧∧i∈I si→→→tix .e

t≡(VVV

i=1..n si→→→ti )∧∧∧(VVV

j=1..m¬¬¬(s′j→→→t′j )) 6=0

(abstr)(∀i) Γ, x : si `D e : tiΓ `D λ∧∧∧i∈I si→→→tix .e : t

Overloading:

J(t1∨∨∨t2)→→→(s1∧∧∧s2)K J(t1→→→s1)∧∧∧(t2→→→s2)K

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 16/39

Page 94:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 5: Close the circle

Let JtKV = {v ∈ V | `D v : t}, then:

s ≤D t ⇐⇒ s ≤V t (1)

Equation (1) (actually, ⇒) states that the language is quite rich,since there always exists a value to separate two distinct types; i.e.its set of values is a model of types with “enough points”

s 6≤D t =⇒ there exists v such that ` v : s and 6` v : t

In particular, thanks to negative arrows in (abstr) rule, thefollowing two types: ∧∧∧

i=1..k

si→→→ti 6≤ t

are distinguished by λ∧∧∧i=1..ksi→→→ti x .e which inhabits their difference.

For practice try the CDuce programming language (www.cduce.org)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 17/39

Page 95:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 5: Close the circle

Let JtKV = {v ∈ V | `D v : t}, then:

s ≤D t ⇐⇒ s ≤V t (1)

Equation (1) (actually, ⇒) states that the language is quite rich,since there always exists a value to separate two distinct types; i.e.its set of values is a model of types with “enough points”

s 6≤D t =⇒ there exists v such that ` v : s and 6` v : t

In particular, thanks to negative arrows in (abstr) rule, thefollowing two types: ∧∧∧

i=1..k

si→→→ti 6≤ t

are distinguished by λ∧∧∧i=1..ksi→→→ti x .e which inhabits their difference.

For practice try the CDuce programming language (www.cduce.org)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 17/39

Page 96:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 5: Close the circle

Let JtKV = {v ∈ V | `D v : t}, then:

s ≤D t ⇐⇒ s ≤V t (1)

Equation (1) (actually, ⇒) states that the language is quite rich,since there always exists a value to separate two distinct types; i.e.its set of values is a model of types with “enough points”

s 6≤D t =⇒ there exists v such that ` v : s and 6` v : t

In particular, thanks to negative arrows in (abstr) rule, thefollowing two types: ∧∧∧

i=1..k

si→→→ti 6≤ t

are distinguished by λ∧∧∧i=1..ksi→→→ti x .e which inhabits their difference.

For practice try the CDuce programming language (www.cduce.org)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 17/39

Page 97:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 5: Close the circle

Let JtKV = {v ∈ V | `D v : t}, then:

s ≤D t ⇐⇒ s ≤V t (1)

Equation (1) (actually, ⇒) states that the language is quite rich,since there always exists a value to separate two distinct types; i.e.its set of values is a model of types with “enough points”

s 6≤D t =⇒ there exists v such that ` v : s and 6` v : t

In particular, thanks to negative arrows in (abstr) rule, thefollowing two types: ∧∧∧

i=1..k

si→→→ti 6≤ t

are distinguished by λ∧∧∧i=1..ksi→→→ti x .e which inhabits their difference.

For practice try the CDuce programming language (www.cduce.org)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 17/39

Page 98:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

π-calculus.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 18/39

Page 99:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 1: types for π

Types t ::= b basic types| ch+(t) input channel type| ch−(t) output channel type| ch(t) I/O channel type

| 0

| 1

| ¬¬¬t| t∨∨∨t| t∧∧∧t

boolean combinators

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 19/39

Page 100:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 1: types for π

Types t ::= b basic types| ch+(t) input channel type| ch−(t) output channel type| ch(t) I/O channel type

| 0

| 1

| ¬¬¬t| t∨∨∨t| t∧∧∧t

boolean combinators

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 19/39

Page 101:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

A channel is like a box with a particular shapeThe box can contain only objects that fit that shape

A type t denotes the set of objects of type t.

Jch(t)K = {channels whose shape fits objects of type t}

Channels are identified by the objects they transport

Invariance of channel types

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 20/39

Page 102:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

A channel is like a box with a particular shapeThe box can contain only objects that fit that shape

A type t denotes the set of objects of type t.

Jch(t)K = {channels whose shape fits objects of type t}

Channels are identified by the objects they transport

Channels are their shape

Invariance of channel types

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 20/39

Page 103:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

A channel is like a box with a particular shapeThe box can contain only objects that fit that shape

A type t denotes the set of objects of type t.

Jch(t)K = {channels whose shape fits objects of type t}

Channels are identified by the objects they transport

Channels are the set of objects that fit their shape

Invariance of channel types

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 20/39

Page 104:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

A channel is like a box with a particular shapeThe box can contain only objects that fit that shape

A type t denotes the set of objects of type t.

Jch(t)K = {channels whose shape fits objects of type t}

Channels are identified by the objects they transport

Jch(t)K = {set of objects of type t}

Invariance of channel types

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 20/39

Page 105:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

A channel is like a box with a particular shapeThe box can contain only objects that fit that shape

A type t denotes the set of objects of type t.

Jch(t)K = {channels whose shape fits objects of type t}

Channels are identified by the objects they transport

Jch(t)K = {JtK}

Invariance of channel types

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 20/39

Page 106:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set theoretic model

ch+(t) types all channels on which I expect to read a t-message

Jch+(t)K = {Jt ′K | t ′ ≤ t}Covariance of input types

ch−(t) types all channels on which I’m allowed to write at-message

Jch−(t)K = {Jt ′K | t ′ ≥ t}Contravariance of output types

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 21/39

Page 107:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set theoretic model

ch+(t) types all channels on which I expect to read a t-message

Jch+(t)K = {Jt ′K | t ′ ≤ t}Covariance of input types

ch−(t) types all channels on which I’m allowed to write at-message

Jch−(t)K = {Jt ′K | t ′ ≥ t}Contravariance of output types

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 21/39

Page 108:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set theoretic model

ch+(t) types all channels on which I expect to read a t-message

Jch+(t)K = {Jt ′K | Jt ′K ⊆ JtK}Covariance of input types

ch−(t) types all channels on which I’m allowed to write at-message

Jch−(t)K = {Jt ′K | Jt ′K ⊇ JtK}Contravariance of output types

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 21/39

Page 109:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

Define J−K : Types → P(D):

Jt1∨∨∨t2K = Jt1K ∪ Jt2K, Jt1∧∧∧t2K = Jt1K ∩ Jt2K, . . .

Jch+(t)K = {Jt ′K | Jt ′K ⊆ JtK}Jch−(t)K = {Jt ′K | Jt ′K ⊇ JtK}

Some induced equations:

ch−(t)∧∧∧ch+(t) = ch(t)

ch−(s)∧∧∧ch−(t) = ch−(s∨∨∨t)

ch−(s)∨∨∨ch−(t) ≤ ch−(s∧∧∧t)

Can be checked graphicallyGiuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 22/39

Page 110:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

Define J−K : Types → P(D):

Jt1∨∨∨t2K = Jt1K ∪ Jt2K, Jt1∧∧∧t2K = Jt1K ∩ Jt2K, . . .

Jch+(t)K = {Jt ′K | Jt ′K ⊆ JtK}Jch−(t)K = {Jt ′K | Jt ′K ⊇ JtK}

We need that D = B+ JDK (not straightforward)

Some induced equations:

ch−(t)∧∧∧ch+(t) = ch(t)

ch−(s)∧∧∧ch−(t) = ch−(s∨∨∨t)

ch−(s)∨∨∨ch−(t) ≤ ch−(s∧∧∧t)

Can be checked graphicallyGiuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 22/39

Page 111:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

Define J−K : Types → P(D):

Jt1∨∨∨t2K = Jt1K ∪ Jt2K, Jt1∧∧∧t2K = Jt1K ∩ Jt2K, . . .

Jch+(t)K = {Jt ′K | Jt ′K ⊆ JtK}Jch−(t)K = {Jt ′K | Jt ′K ⊇ JtK}

Then definet ≤D t ′ ⇐⇒ JtK ⊆ Jt ′K

Some induced equations:

ch−(t)∧∧∧ch+(t) = ch(t)

ch−(s)∧∧∧ch−(t) = ch−(s∨∨∨t)

ch−(s)∨∨∨ch−(t) ≤ ch−(s∧∧∧t)

Can be checked graphicallyGiuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 22/39

Page 112:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

Define J−K : Types → P(D):

Jt1∨∨∨t2K = Jt1K ∪ Jt2K, Jt1∧∧∧t2K = Jt1K ∩ Jt2K, . . .

Jch+(t)K = {Jt ′K | Jt ′K ⊆ JtK}Jch−(t)K = {Jt ′K | Jt ′K ⊇ JtK}

Then definet ≤D t ′ ⇐⇒ JtK ⊆ Jt ′K

Some induced equations:

ch−(t)∧∧∧ch+(t) = ch(t)

ch−(s)∧∧∧ch−(t) = ch−(s∨∨∨t)

ch−(s)∨∨∨ch−(t) ≤ ch−(s∧∧∧t)

Can be checked graphicallyGiuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 22/39

Page 113:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

Define J−K : Types → P(D):

Jt1∨∨∨t2K = Jt1K ∪ Jt2K, Jt1∧∧∧t2K = Jt1K ∩ Jt2K, . . .

Jch+(t)K = {Jt ′K | Jt ′K ⊆ JtK}Jch−(t)K = {Jt ′K | Jt ′K ⊇ JtK}

Then definet ≤D t ′ ⇐⇒ JtK ⊆ Jt ′K

Some induced equations:

ch−(t)∧∧∧ch+(t) = ch(t)

ch−(s)∧∧∧ch−(t) = ch−(s∨∨∨t)

ch−(s)∨∨∨ch−(t) ≤ ch−(s∧∧∧t)

Can be checked graphicallyGiuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 22/39

Page 114:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 2: set-theoretic model

Define J−K : Types → P(D):

Jt1∨∨∨t2K = Jt1K ∪ Jt2K, Jt1∧∧∧t2K = Jt1K ∩ Jt2K, . . .

Jch+(t)K = {Jt ′K | Jt ′K ⊆ JtK}Jch−(t)K = {Jt ′K | Jt ′K ⊇ JtK}

Then definet ≤D t ′ ⇐⇒ JtK ⊆ Jt ′K

Some induced equations:

ch−(t)∧∧∧ch+(t) = ch(t)

ch−(s)∧∧∧ch−(t) = ch−(s∨∨∨t)

ch−(s)∨∨∨ch−(t) ≤ ch−(s∧∧∧t)

Can be checked graphicallyGiuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 22/39

Page 115:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

ch−(s)∧∧∧ch−(t) = ch−(s∨∨∨t)

s

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 23/39

Page 116:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

ch−(s)∧∧∧ch−(t) = ch−(s∨∨∨t)

s t

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 23/39

Page 117:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

ch−(s)∧∧∧ch−(t) = ch−(s∨∨∨t)

�������������������������������������������������������������������������������������������������������������������������������������������������������������������������

�������������������������������������������������������������������������������������������������������������������������������������������������������������������������

s t

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 23/39

Page 118:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

ch−(s)∧∧∧ch−(t) = ch−(s∨∨∨t)

�������������������������������������������������������������������������������������������������������������������������������������������������������������������������

�������������������������������������������������������������������������������������������������������������������������������������������������������������������������

s∨∨∨t

s t

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 23/39

Page 119:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

ch−(s)∨∨∨ch−(t) � ch−(s∧∧∧t)

s t

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 23/39

Page 120:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

ch−(s)∨∨∨ch−(t) � ch−(s∧∧∧t)

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

s t

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 23/39

Page 121:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

ch−(s)∨∨∨ch−(t) � ch−(s∧∧∧t)

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

s∧∧∧t

s t

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 23/39

Page 122:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 3: Subtyping Algorithm

It is enough to decide emptiness:

s ≤ t ⇐⇒ s∧∧∧¬¬¬t = 0

Put s∧∧∧¬¬¬t in disjunctive normal formA disjunction is empty is all the summands are empty∧∧∧

i∈P

ti∧∧∧∧∧∧j∈N

¬¬¬t ′j = 0?

Equivalently

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 24/39

Page 123:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 3: Subtyping Algorithm

It is enough to decide emptiness:

s ≤ t ⇐⇒ s∧∧∧¬¬¬t = 0

Put s∧∧∧¬¬¬t in disjunctive normal formA disjunction is empty is all the summands are empty∧∧∧

i∈P

ti∧∧∧∧∧∧j∈N

¬¬¬t ′j = 0?

Equivalently

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 24/39

Page 124:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 3: Subtyping Algorithm

It is enough to decide emptiness:

s ≤ t ⇐⇒ s∧∧∧¬¬¬t = 0

Put s∧∧∧¬¬¬t in disjunctive normal formA disjunction is empty is all the summands are empty∧∧∧

i∈P

ti∧∧∧∧∧∧j∈N

¬¬¬t ′j = 0?

Equivalently

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 24/39

Page 125:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 3: Subtyping Algorithm

It is enough to decide emptiness:

s ≤ t ⇐⇒ s∧∧∧¬¬¬t = 0

Put s∧∧∧¬¬¬t in disjunctive normal formA disjunction is empty is all the summands are empty∧∧∧

i∈P

ti∧∧∧∧∧∧j∈N

¬¬¬t ′j = 0?

Equivalently ∧∧∧i∈P

ti ≤∨∨∨j∈N

t ′j ?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 24/39

Page 126:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 3: Subtyping Algorithm

It is enough to decide emptiness:

s ≤ t ⇐⇒ s∧∧∧¬¬¬t = 0

Put s∧∧∧¬¬¬t in disjunctive normal formA disjunction is empty is all the summands are empty∧∧∧

i∈P

ti∧∧∧∧∧∧j∈N

¬¬¬t ′j = 0?

Equivalently∧∧∧i∈I

ch+(t i1)∧∧∧

∧∧∧j∈J

ch−(t j2) ≤

∨∨∨h∈H

ch+(th3 )∨∨∨

∨∨∨k∈K

ch−(tk4 )

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 24/39

Page 127:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 3: Subtyping Algorithm

It is enough to decide emptiness:

s ≤ t ⇐⇒ s∧∧∧¬¬¬t = 0

Put s∧∧∧¬¬¬t in disjunctive normal formA disjunction is empty is all the summands are empty∧∧∧

i∈P

ti∧∧∧∧∧∧j∈N

¬¬¬t ′j = 0?

Equivalently

ch+(t1)∧∧∧ch−(t2) ≤∨∨∨h∈H

ch+(th3 )∨∨∨

∨∨∨k∈K

ch−(tk4 )

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 24/39

Page 128:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

ch+(t1)∧∧∧ch−(t2) ≤∨∨∨h∈H

ch+(th3 )∨∨∨

∨∨∨k∈K

ch−(tk4 )

t1

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 25/39

Page 129:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

ch+(t1)∧∧∧ch−(t2) ≤∨∨∨h∈H

ch+(th3 )∨∨∨

∨∨∨k∈K

ch−(tk4 )

t2

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 25/39

Page 130:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

ch+(t1)∧∧∧ch−(t2) ≤∨∨∨h∈H

ch+(th3 )∨∨∨

∨∨∨k∈K

ch−(tk4 )

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 25/39

Page 131:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

ch+(t1)∧∧∧ch−(t2) ≤∨∨∨h∈H

ch+(th3 )∨∨∨

∨∨∨k∈K

ch−(tk4 )

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 25/39

Page 132:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

ch+(t1)∧∧∧ch−(t2) ≤∨∨∨h∈H

ch+(th3 )∨∨∨

∨∨∨k∈K

ch−(tk4 )

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 25/39

Page 133:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

ch+(t1)∧∧∧ch−(t2) ≤∨∨∨h∈H

ch+(th3 )∨∨∨

∨∨∨k∈K

ch−(tk4 )

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 25/39

Page 134:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

ch+(t1)∧∧∧ch−(t2) ≤∨∨∨h∈H

ch+(th3 )∨∨∨

∨∨∨k∈K

ch−(tk4 )

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 25/39

Page 135:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Atoms

In some cases the condition to check involves atomsTypes with a singleton interpretation

Consider:

two types t1 6= t2

t2 ≤ t1

question: is ch+(t1)∧∧∧ch−(t2) ≤ ch+(t2)∨∨∨ch−(t1)?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 26/39

Page 136:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

ch+(t1)∧∧∧ch−(t2) ≤ ch+(t2)∨∨∨ch−(t1)

���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

t1

t2

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 27/39

Page 137:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

ch+(t1)∧∧∧ch−(t2) ≤ ch+(t2)∨∨∨ch−(t1)

���������������������������������������������������������������������������������

���������������������������������������������������������������������������������

������������������������������������������������������������������������

������������������������������������������������������������������������

t1

t2

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 27/39

Page 138:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

ch+(t1)∧∧∧ch−(t2) ≤ ch+(t2)∨∨∨ch−(t1)

���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

���������������������������������������������������������������������������������

������������������������������������������������������������������������

������������������������������������������������������������������������

t1

t2

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 27/39

Page 139:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

ch+(t1)∧∧∧ch−(t2) ≤ ch+(t2)∨∨∨ch−(t1)

���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

���������������������������������������������������������������������������������

������������������������������������������������������������������������

������������������������������������������������������������������������

t1

t2

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 27/39

Page 140:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

ch+(t1)∧∧∧ch−(t2) ≤ ch+(t2)∨∨∨ch−(t1)

���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

���������������������������������������������������������������������������������

������������������������������������������������������������������������

������������������������������������������������������������������������

t1

t2

The two sets have these two points in common, namely ch(t1) andch(t2).

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 27/39

Page 141:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

ch+(t1)∧∧∧ch−(t2) ≤ ch+(t2)∨∨∨ch−(t1)

���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

���������������������������������������������������������������������������������

������������������������������������������������������������������������

������������������������������������������������������������������������

t1

t2

The disequation holds if there are no other points in the left handside

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 27/39

Page 142:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

ch+(t1)∧∧∧ch−(t2) ≤ ch+(t2)∨∨∨ch−(t1)

���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

���������������������������������������������������������������������������������

������������������������������������������������������������������������

������������������������������������������������������������������������

t1

t2

It depends on whether t1∧∧∧¬¬¬t2 is atomic: that is whether there isnothing between t1 and t2

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 27/39

Page 143:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 4: The Language

Which kind of π-calculus?

Consider again

ch+(t1)∨∨∨ch+(t2) � ch+(t1∨∨∨t2)

Containment is strict, so we want programs that distinguishthese two types

We must be able to dynamically check the type of messagesarriving a channel

Use type-case in read actions.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 28/39

Page 144:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 4: The Language

Which kind of π-calculus?

Consider again

ch+(t1)∨∨∨ch+(t2) � ch+(t1∨∨∨t2)

Containment is strict, so we want programs that distinguishthese two types

We must be able to dynamically check the type of messagesarriving a channel

Use type-case in read actions.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 28/39

Page 145:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 4: The Language

Which kind of π-calculus?

Consider again

ch+(t1)∨∨∨ch+(t2) � ch+(t1∨∨∨t2)

Containment is strict, so we want programs that distinguishthese two types

We must be able to dynamically check the type of messagesarriving a channel

Use type-case in read actions.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 28/39

Page 146:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 4: The Language

Which kind of π-calculus?

Consider again

ch+(t1)∨∨∨ch+(t2) � ch+(t1∨∨∨t2)

Containment is strict, so we want programs that distinguishthese two types

We must be able to dynamically check the type of messagesarriving a channel

Use type-case in read actions.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 28/39

Page 147:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 4: The Language

Which kind of π-calculus?

Consider again

ch+(t1)∨∨∨ch+(t2) � ch+(t1∨∨∨t2)

Containment is strict, so we want programs that distinguishthese two types

We must be able to dynamically check the type of messagesarriving a channel

Use type-case in read actions.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 28/39

Page 148:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 4: The Language Cπ-calculus

Channels α ::= x variables| ct channel constants

Processes P ::= α(α) output|

∑i∈I α(x :ti ).Pi guarded input

| P1‖P2 parallel| (νct)P restriction| !P replication

Reduction

cs1(c

t2) ‖

∑i∈I cs

1(x : ti )Pi → Pj [ct2/x ] if ch(t) ≤ tj

Type case

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 29/39

Page 149:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 4: The Language Cπ-calculus

Channels α ::= x variables| ct channel constants

Processes P ::= α(α) output|

∑i∈I α(x :ti ).Pi guarded input

| P1‖P2 parallel| (νct)P restriction| !P replication

Reduction

cs1(c

t2) ‖

∑i∈I cs

1(x : ti )Pi → Pj [ct2/x ] if ch(t) ≤ tj

Type case

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 29/39

Page 150:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 4: The Language Cπ-calculus

Channels α ::= x variables| ct channel constants

Processes P ::= α(α) output|

∑i∈I α(x :ti ).Pi guarded input

| P1‖P2 parallel| (νct)P restriction| !P replication

Reduction

cs1(c

t2) ‖

∑i∈I cs

1(x : ti )Pi → Pj [ct2/x ] if ch(t) ≤ tj

Type case

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 29/39

Page 151:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 4: The Language Cπ-calculus

Channels α ::= x variables| ct channel constants

Processes P ::= α(α) output|

∑i∈I α(x :ti ).Pi guarded input

| P1‖P2 parallel| (νct)P restriction| !P replication

Reduction

cs1(c

ttt2) ‖

∑i∈I cs

1(x : ti )Pi → Pjjj [ct2/x ] if ch(t)ch(t)ch(t) ≤ tjtjtj

Type case

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 29/39

Page 152:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 4: The Language Cπ-calculus

Channels α ::= x variables| ct channel constants

Processes P ::= α(α) output|

∑i∈I α(x :ti ).Pi guarded input

| P1‖P2 parallel| (νct)P restriction| !P replication

Reduction

cs1(c

t2ct2ct2) ‖

∑i∈I cs

1(x : ti )Pi → Pj [ct2/x ] if ch(t) ≤ tj

Type case call-by-value

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 29/39

Page 153:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 4: The Language Cπ-calculus

Channels α ::= x variables| ctctct channel constants

Processes P ::= α(α) output|

∑i∈I α(x :ti ).Pi guarded input

| P1‖P2 parallel| (νct)P restriction| !P replication

Reduction

cs1(c

t2) ‖

∑i∈I cs

1(x : ti )Pi → Pj [ct2/x ] if ch(t) ≤ tj

Type case call-by-value

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 29/39

Page 154:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 4: The Language (Typing rules)

Γ ` ct : ch(t)(chan)

Γ ` x : Γ(x)(var)

Γ ` α : s ≤D t

Γ ` α : t(subsum)

Γ ` PΓ ` (νct)P

(new) Γ ` PΓ `!P

(repl)Γ ` P1 Γ ` P2

Γ ` P1‖P2(para)

Matching is exhaustive

t ≤WWW

i∈I titi∧ t 6= 0

Γ ` α : ch+(t) Γ, x :ti ` Pi

Γ `∑

i∈I α(x :ti ).Pi(input)

No useless branch

Γ ` β : t Γ ` α : ch−(t)

Γ ` α(β)(output)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 30/39

Page 155:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 4: The Language (Typing rules)

Γ ` ct : ch(t)(chan)

Γ ` x : Γ(x)(var)

Γ ` α : s ≤D t

Γ ` α : t(subsum)

Γ ` PΓ ` (νct)P

(new) Γ ` PΓ `!P

(repl)Γ ` P1 Γ ` P2

Γ ` P1‖P2(para)

Matching is exhaustive

t ≤WWW

i∈I titi∧ t 6= 0

Γ ` α : ch+(t) Γ, x :ti ` Pi

Γ `∑

i∈I α(x :ti ).Pi(input)

No useless branch

Γ ` β : t Γ ` α : ch−(t)

Γ ` α(β)(output)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 30/39

Page 156:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 4: The Language (Typing rules)

Γ ` ct : ch(t)(chan)

Γ ` x : Γ(x)(var)

Γ ` α : s ≤D t

Γ ` α : t(subsum)

Γ ` PΓ ` (νct)P

(new) Γ ` PΓ `!P

(repl)Γ ` P1 Γ ` P2

Γ ` P1‖P2(para)

Matching is exhaustive

t ≤WWW

i∈I titi∧ t 6= 0

Γ ` α : ch+(t) Γ, x :ti ` Pi

Γ `∑

i∈I α(x :ti ).Pi(input)

No useless branch

Γ ` β : t Γ ` α : ch−(t)

Γ ` α(β)(output)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 30/39

Page 157:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 4: The Language (Typing rules)

Γ ` ct : ch(t)(chan)

Γ ` x : Γ(x)(var)

Γ ` α : s ≤D t

Γ ` α : t(subsum)

Γ ` PΓ ` (νct)P

(new) Γ ` PΓ `!P

(repl)Γ ` P1 Γ ` P2

Γ ` P1‖P2(para)

Matching is exhaustive

t ≤WWW

i∈I titi∧ t 6= 0

Γ ` α : ch+(t) Γ, x :ti ` Pi

Γ `∑

i∈I α(x :ti ).Pi(input)

No useless branch

Γ ` β : t Γ ` α : ch−(t)

Γ ` α(β)(output)

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 30/39

Page 158:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 5: Closing the circle

As usual for

JtKV = {v | ` v : t}

One hass ≤D t ⇐⇒ s ≤V t

Note that we did not use negated types in inference rules

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 31/39

Page 159:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

STEP 5: Closing the circle

As usual for

JtKV = {v | ` v : t}

One hass ≤D t ⇐⇒ s ≤V t

Note that we did not use negated types in inference rules

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 31/39

Page 160:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Some Perspectives.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 32/39

Page 161:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Atomic types

In Cπ subtyping check requires atomicity check

The same happens in λ-calculus as soon as we extend it bypolymorphic types:

t1 ≤ t2def⇐⇒ ∀s.Jt1[s/X ]K ⊆ Jt2[s/X ]K

Consider(t × X ) ≤ (t ׬¬¬t)∨∨∨(X × t)

holds true iff t is atomic (ie, for all X , either t ≤ X or t ≤ ¬¬¬X )

Relation between atomicity and semantic subtyping?

Consider systems where atomic types are not denotable?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 33/39

Page 162:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Atomic types

In Cπ subtyping check requires atomicity check

The same happens in λ-calculus as soon as we extend it bypolymorphic types:

t1 ≤ t2def⇐⇒ ∀s.Jt1[s/X ]K ⊆ Jt2[s/X ]K

Consider(t × X ) ≤ (t ׬¬¬t)∨∨∨(X × t)

holds true iff t is atomic (ie, for all X , either t ≤ X or t ≤ ¬¬¬X )

Relation between atomicity and semantic subtyping?

Consider systems where atomic types are not denotable?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 33/39

Page 163:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Atomic types

In Cπ subtyping check requires atomicity check

The same happens in λ-calculus as soon as we extend it bypolymorphic types:

t1 ≤ t2def⇐⇒ ∀s.Jt1[s/X ]K ⊆ Jt2[s/X ]K

Consider(t × X ) ≤ (t ׬¬¬t)∨∨∨(X × t)

holds true iff t is atomic (ie, for all X , either t ≤ X or t ≤ ¬¬¬X )

Relation between atomicity and semantic subtyping?

Consider systems where atomic types are not denotable?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 33/39

Page 164:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Atomic types

In Cπ subtyping check requires atomicity check

The same happens in λ-calculus as soon as we extend it bypolymorphic types:

t1 ≤ t2def⇐⇒ ∀s.Jt1[s/X ]K ⊆ Jt2[s/X ]K

Consider(t × X ) ≤ (t ׬¬¬t)∨∨∨(X × t)

holds true iff t is atomic (ie, for all X , either t ≤ X or t ≤ ¬¬¬X )

Relation between atomicity and semantic subtyping?

Consider systems where atomic types are not denotable?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 33/39

Page 165:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Atomic types

In Cπ subtyping check requires atomicity check

The same happens in λ-calculus as soon as we extend it bypolymorphic types:

t1 ≤ t2def⇐⇒ ∀s.Jt1[s/X ]K ⊆ Jt2[s/X ]K

Consider(t × X ) ≤ (t ׬¬¬t)∨∨∨(X × t)

holds true iff t is atomic (ie, for all X , either t ≤ X or t ≤ ¬¬¬X )

Relation between atomicity and semantic subtyping?

Consider systems where atomic types are not denotable?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 33/39

Page 166:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Atomic types

In Cπ subtyping check requires atomicity check

The same happens in λ-calculus as soon as we extend it bypolymorphic types:

t1 ≤ t2def⇐⇒ ∀s.Jt1[s/X ]K ⊆ Jt2[s/X ]K

Consider(t × X ) ≤ (t ׬¬¬t)∨∨∨(X × t)

holds true iff t is atomic (ie, for all X , either t ≤ X or t ≤ ¬¬¬X )

Relation between atomicity and semantic subtyping?

Consider systems where atomic types are not denotable?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 33/39

Page 167:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Atomic types

In Cπ subtyping check requires atomicity check

The same happens in λ-calculus as soon as we extend it bypolymorphic types:

t1 ≤ t2def⇐⇒ ∀s.Jt1[s/X ]K ⊆ Jt2[s/X ]K

Consider(t × X ) ≤ (t ׬¬¬t)∨∨∨(X × t)

holds true iff t is atomic (ie, for all X , either t ≤ X or t ≤ ¬¬¬X )

Relation between atomicity and semantic subtyping?

Consider systems where atomic types are not denotable?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 33/39

Page 168:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Recursive types and models

In some cases, a set-theoretic model does not exists:

t = int ∨∨∨ (ch(int) ∧∧∧ ch(t))

Is t equal to int?

t = int ⇒ (ch(int) ∧∧∧ ch(t)) = ∅ ⇒ t 6= int

t 6= int ⇒ (ch(int) ∧∧∧ ch(t)) 6= ∅ ⇒ t = int

Same problem in λ-calculus when we add reference types

What the non-existence of a set-theoretic model means?

Mathematical limit or approach’s limit?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 34/39

Page 169:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Recursive types and models

In some cases, a set-theoretic model does not exists:

t = int ∨∨∨ (ch(int) ∧∧∧ ch(t))

Is t equal to int?

t = int ⇒ (ch(int) ∧∧∧ ch(t)) = ∅ ⇒ t 6= int

t 6= int ⇒ (ch(int) ∧∧∧ ch(t)) 6= ∅ ⇒ t = int

Same problem in λ-calculus when we add reference types

What the non-existence of a set-theoretic model means?

Mathematical limit or approach’s limit?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 34/39

Page 170:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Recursive types and models

In some cases, a set-theoretic model does not exists:

t = int ∨∨∨ (ch(int) ∧∧∧ ch(t))

Is t equal to int?

t = int ⇒ (ch(int) ∧∧∧ ch(t)) = ∅ ⇒ t 6= int

t 6= int ⇒ (ch(int) ∧∧∧ ch(t)) 6= ∅ ⇒ t = int

Same problem in λ-calculus when we add reference types

What the non-existence of a set-theoretic model means?

Mathematical limit or approach’s limit?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 34/39

Page 171:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Recursive types and models

In some cases, a set-theoretic model does not exists:

t = int ∨∨∨ (ch(int) ∧∧∧ ch(t))

Is t equal to int?

t = int ⇒ (ch(int) ∧∧∧ ch(t)) = ∅ ⇒ t 6= int

t 6= int ⇒ (ch(int) ∧∧∧ ch(t)) 6= ∅ ⇒ t = int

Same problem in λ-calculus when we add reference types

What the non-existence of a set-theoretic model means?

Mathematical limit or approach’s limit?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 34/39

Page 172:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Recursive types and models

In some cases, a set-theoretic model does not exists:

t = int ∨∨∨ (ch(int) ∧∧∧ ch(t))

Is t equal to int?

t = int ⇒ (ch(int) ∧∧∧ ch(t)) = ∅ ⇒ t 6= int

t 6= int ⇒ (ch(int) ∧∧∧ ch(t)) 6= ∅ ⇒ t = int

Same problem in λ-calculus when we add reference types

What the non-existence of a set-theoretic model means?

Mathematical limit or approach’s limit?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 34/39

Page 173:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Recursive types and models

In some cases, a set-theoretic model does not exists:

t = int ∨∨∨ (ch(int) ∧∧∧ ch(t))

Is t equal to int?

t = int ⇒ (ch(int) ∧∧∧ ch(t)) = ∅ ⇒ t 6= int

t 6= int ⇒ (ch(int) ∧∧∧ ch(t)) 6= ∅ ⇒ t = int

Same problem in λ-calculus when we add reference types

What the non-existence of a set-theoretic model means?

Mathematical limit or approach’s limit?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 34/39

Page 174:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Recursive types and models

In some cases, a set-theoretic model does not exists:

t = int ∨∨∨ (ch(int) ∧∧∧ ch(t))

Is t equal to int?

t = int ⇒ (ch(int) ∧∧∧ ch(t)) = ∅ ⇒ t 6= int

t 6= int ⇒ (ch(int) ∧∧∧ ch(t)) 6= ∅ ⇒ t = int

Same problem in λ-calculus when we add reference types

What the non-existence of a set-theoretic model means?

Mathematical limit or approach’s limit?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 34/39

Page 175:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Recursive types and models

In some cases, a set-theoretic model does not exists:

t = int ∨∨∨ (ch(int) ∧∧∧ ch(t))

Is t equal to int?

t = int ⇒ (ch(int) ∧∧∧ ch(t)) = ∅ ⇒ t 6= int

t 6= int ⇒ (ch(int) ∧∧∧ ch(t)) 6= ∅ ⇒ t = int

Same problem in λ-calculus when we add reference types

What the non-existence of a set-theoretic model means?

Mathematical limit or approach’s limit?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 34/39

Page 176:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Enough points and inference of negation

Full recursion is possible in local version of Cπ.

received channels cannot be used in input

the type ch+() is not needed: we can have full recursion

t ::= b | ch+(t) | ch−(t) | 0 | 1 | ¬¬¬t | t∨∨∨t | t∧∧∧t

α ::= x | ct

P ::= α(α) |∑

i∈I α (x :ti ).Pi | P1‖P2 | (νct)P | !P

known to be expressive enough (encodes λ)

decidability (even with arrow types) is straightforward

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 35/39

Page 177:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Enough points and inference of negation

Full recursion is possible in local version of Cπ.

received channels cannot be used in input

the type ch+() is not needed: we can have full recursion

t ::= b | ch+(t) | ch−(t) | 0 | 1 | ¬¬¬t | t∨∨∨t | t∧∧∧t

α ::= x | ct

P ::= α(α) |∑

i∈I α (x :ti ).Pi | P1‖P2 | (νct)P | !P

known to be expressive enough (encodes λ)

decidability (even with arrow types) is straightforward

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 35/39

Page 178:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Enough points and inference of negation

Full recursion is possible in local version of Cπ.

received channels cannot be used in input

the type ch+() is not needed: we can have full recursion

t ::= b | ch+(t) | ch−(t) | 0 | 1 | ¬¬¬t | t∨∨∨t | t∧∧∧t

α ::= x | ct

P ::= α(α) |∑

i∈I α (x :ti ).Pi | P1‖P2 | (νct)P | !P

known to be expressive enough (encodes λ)

decidability (even with arrow types) is straightforward

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 35/39

Page 179:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Enough points and inference of negation

Full recursion is possible in local version of Cπ.

received channels cannot be used in input

the type ch+() is not needed: we can have full recursion

t ::= b | ch+(t) | ch−(t) | 0 | 1 | ¬¬¬t | t∨∨∨t | t∧∧∧t

α ::= x | ct

P ::= α(α) |∑

i∈I α (x :ti ).Pi | P1‖P2 | (νct)P | !P

known to be expressive enough (encodes λ)

decidability (even with arrow types) is straightforward

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 35/39

Page 180:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Enough points and inference of negation

Full recursion is possible in local version of Cπ.

received channels cannot be used in input

the type ch+() is not needed: we can have full recursion

t ::= b | ch+(t)××× | ch−(t) | 0 | 1 | ¬¬¬t | t∨∨∨t | t∧∧∧t

α ::= x | ct

P ::= α(α) |∑

i∈I α (x :ti ).Pi | P1‖P2 | (νct)P | !P

known to be expressive enough (encodes λ)

decidability (even with arrow types) is straightforward

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 35/39

Page 181:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Enough points and inference of negation

Full recursion is possible in local version of Cπ.

received channels cannot be used in input

the type ch+() is not needed: we can have full recursion

t ::= b | ch+(t)××× | ch−(t) | 0 | 1 | ¬¬¬t | t∨∨∨t | t∧∧∧t

α ::= x | ct

P ::= α(α) |∑

i∈I ct (x :ti ).Pi | P1‖P2 | (νct)P | !P

known to be expressive enough (encodes λ)

decidability (even with arrow types) is straightforward

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 35/39

Page 182:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Enough points and inference of negation

Full recursion is possible in local version of Cπ.

received channels cannot be used in input

the type ch+() is not needed: we can have full recursion

t ::= b | ch+(t)××× | ch−(t) | 0 | 1 | ¬¬¬t | t∨∨∨t | t∧∧∧t

α ::= x | ct

P ::= α(α) |∑

i∈I ct (x :ti ).Pi | P1‖P2 | (νct)P | !P

known to be expressive enough (encodes λ)

decidability (even with arrow types) is straightforward

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 35/39

Page 183:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Enough points and inference of negation

Full recursion is possible in local version of Cπ.

received channels cannot be used in input

the type ch+() is not needed: we can have full recursion

t ::= b | ch+(t)××× | ch−(t) | 0 | 1 | ¬¬¬t | t∨∨∨t | t∧∧∧t

α ::= x | ct

P ::= α(α) |∑

i∈I ct (x :ti ).Pi | P1‖P2 | (νct)P | !P

known to be expressive enough (encodes λ)

decidability (even with arrow types) is straightforward

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 35/39

Page 184:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Enough points and inference of negation

Full recursion is possible in local version of Cπ.

received channels cannot be used in input

the type ch+() is not needed: we can have full recursion

t ::= b | ch+(t)××× | ch−(t) | 0 | 1 | ¬¬¬t | t∨∨∨t | t∧∧∧t

α ::= x | ct

P ::= α(α) |∑

i∈I ct (x :ti ).Pi | P1‖P2 | (νct)P | !P

known to be expressive enough (encodes λ)

decidability (even with arrow types) is straightforward

ch+(t1)∧∧∧ch−(t2) ≤∨∨∨h∈H

ch+(th3 )∨∨∨

∨∨∨k∈K

ch−(tk4 )

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 35/39

Page 185:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Enough points and inference of negation

Full recursion is possible in local version of Cπ.

received channels cannot be used in input

the type ch+() is not needed: we can have full recursion

t ::= b | ch+(t)××× | ch−(t) | 0 | 1 | ¬¬¬t | t∨∨∨t | t∧∧∧t

α ::= x | ct

P ::= α(α) |∑

i∈I ct (x :ti ).Pi | P1‖P2 | (νct)P | !P

known to be expressive enough (encodes λ)

decidability (even with arrow types) is straightforward

ch+(t1)××× ∧∧∧ch−(t2) ≤∨∨∨h∈H

ch+(th3 )××× ∨∨∨

∨∨∨k∈K

ch−(tk4 )

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 35/39

Page 186:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Enough points and inference of negation

Full recursion is possible in local version of Cπ.

received channels cannot be used in input

the type ch+() is not needed: we can have full recursion

t ::= b | ch+(t)××× | ch−(t) | 0 | 1 | ¬¬¬t | t∨∨∨t | t∧∧∧t

α ::= x | ct

P ::= α(α) |∑

i∈I ct (x :ti ).Pi | P1‖P2 | (νct)P | !P

known to be expressive enough (encodes λ)

decidability (even with arrow types) is straightforward

ch−(t) ≤∨∨∨k∈K

ch−(tk) ⇐⇒ ∃k∈K . tk ≤ t

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 35/39

Page 187:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Enough points and inference of negation

Full recursion is possible in local version of Cπ.

received channels cannot be used in input

the type ch+() is not needed: we can have full recursion

t ::= b | ch+(t)××× | ch−(t) | 0 | 1 | ¬¬¬t | t∨∨∨t | t∧∧∧t

α ::= x | ct

P ::= α(α) |∑

i∈I ct (x :ti ).Pi | P1‖P2 | (νct)P | !P

known to be expressive enough (encodes λ)

decidability (even with arrow types) is straightforward

ch−(t) ≤∨∨∨k∈K

ch−(tk) ⇐⇒ ∃k∈K . tk ≤ t

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 35/39

Page 188:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Enough points and inference of negation

Full recursion is possible in local version of Cπ.

received channels cannot be used in input

the type ch+() is not needed: we can have full recursion

t ::= b | ch+(t)××× | ch−(t) | 0 | 1 | ¬¬¬t | t∨∨∨t | t∧∧∧t

α ::= x | ct

P ::= α(α) |∑

i∈I ct (x :ti ).Pi | P1‖P2 | (νct)P | !P

known to be expressive enough (encodes λ)

decidability (even with arrow types) is straightforward

ch−(t) ≤∨∨∨k∈K

ch−(tk) ⇐⇒ ∃k∈K . tk ≤ t

Unfortunately

6` cint : ¬¬¬ch−(bool) (here cint : ch−(int) instead of ch(int))

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 35/39

Page 189:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Enough points and inference of negation

Full recursion is possible in local version of Cπ.

received channels cannot be used in input

the type ch+() is not needed: we can have full recursion

t ::= b | ch+(t)××× | ch−(t) | 0 | 1 | ¬¬¬t | t∨∨∨t | t∧∧∧t

α ::= x | ct

P ::= α(α) |∑

i∈I ct (x :ti ).Pi | P1‖P2 | (νct)P | !P

known to be expressive enough (encodes λ)

decidability (even with arrow types) is straightforward

ch−(t) ≤∨∨∨k∈K

ch−(tk) ⇐⇒ ∃k∈K . tk ≤ t

Unfortunately

6` cint : ¬¬¬ch−(bool) (here cint : ch−(int) instead of ch(int))

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 35/39

Page 190:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Enough points and inference of negation

Solution: use the same techniques as (abstr):

ti 6≤ t

Γ ` ct : ch−(t)∧∧∧¬¬¬ch−(t1)∧∧∧ . . .∧∧∧¬¬¬ch−(tn)(chan)

As for (abstr) the rule (chan) inhabits non-empty types so thatvalues form a set-theoretic model

Such rules are problematic: no intuition and no minimum typingproperty

Avoidable by “schemata” but intuition is not recovered and valuesno longer yield a model

Inference of negations?

Have these rules a mathematical meaning?Is it possible to find for λ a “trick” as local-Cπ?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 36/39

Page 191:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Enough points and inference of negation

Solution: use the same techniques as (abstr):

ti 6≤ t

Γ ` ct : ch−(t)∧∧∧¬¬¬ch−(t1)∧∧∧ . . .∧∧∧¬¬¬ch−(tn)(chan)

As for (abstr) the rule (chan) inhabits non-empty types so thatvalues form a set-theoretic model

Such rules are problematic: no intuition and no minimum typingproperty

Avoidable by “schemata” but intuition is not recovered and valuesno longer yield a model

Inference of negations?

Have these rules a mathematical meaning?Is it possible to find for λ a “trick” as local-Cπ?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 36/39

Page 192:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Enough points and inference of negation

Solution: use the same techniques as (abstr):

ti 6≤ t

Γ ` ct : ch−(t)∧∧∧¬¬¬ch−(t1)∧∧∧ . . .∧∧∧¬¬¬ch−(tn)(chan)

As for (abstr) the rule (chan) inhabits non-empty types so thatvalues form a set-theoretic model

Such rules are problematic: no intuition and no minimum typingproperty

Avoidable by “schemata” but intuition is not recovered and valuesno longer yield a model

Inference of negations?

Have these rules a mathematical meaning?Is it possible to find for λ a “trick” as local-Cπ?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 36/39

Page 193:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Enough points and inference of negation

Solution: use the same techniques as (abstr):

ti 6≤ t

Γ ` ct : ch−(t)∧∧∧¬¬¬ch−(t1)∧∧∧ . . .∧∧∧¬¬¬ch−(tn)(chan)

As for (abstr) the rule (chan) inhabits non-empty types so thatvalues form a set-theoretic model

Such rules are problematic: no intuition and no minimum typingproperty

Avoidable by “schemata” but intuition is not recovered and valuesno longer yield a model

Inference of negations?

Have these rules a mathematical meaning?Is it possible to find for λ a “trick” as local-Cπ?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 36/39

Page 194:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Enough points and inference of negation

Solution: use the same techniques as (abstr):

ti 6≤ t

Γ ` ct : ch−(t)∧∧∧¬¬¬ch−(t1)∧∧∧ . . .∧∧∧¬¬¬ch−(tn)(chan)

As for (abstr) the rule (chan) inhabits non-empty types so thatvalues form a set-theoretic model

Such rules are problematic: no intuition and no minimum typingproperty

Avoidable by “schemata” but intuition is not recovered and valuesno longer yield a model

Inference of negations?

Have these rules a mathematical meaning?Is it possible to find for λ a “trick” as local-Cπ?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 36/39

Page 195:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Enough points and inference of negation

Solution: use the same techniques as (abstr):

ti 6≤ t

Γ ` ct : ch−(t)∧∧∧¬¬¬ch−(t1)∧∧∧ . . .∧∧∧¬¬¬ch−(tn)(chan)

As for (abstr) the rule (chan) inhabits non-empty types so thatvalues form a set-theoretic model

Such rules are problematic: no intuition and no minimum typingproperty

Avoidable by “schemata” but intuition is not recovered and valuesno longer yield a model

Inference of negations?

Have these rules a mathematical meaning?Is it possible to find for λ a “trick” as local-Cπ?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 36/39

Page 196:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Enough points and inference of negation

Solution: use the same techniques as (abstr):

ti 6≤ t

Γ ` ct : ch−(t)∧∧∧¬¬¬ch−(t1)∧∧∧ . . .∧∧∧¬¬¬ch−(tn)(chan)

As for (abstr) the rule (chan) inhabits non-empty types so thatvalues form a set-theoretic model

Such rules are problematic: no intuition and no minimum typingproperty

Avoidable by “schemata” but intuition is not recovered and valuesno longer yield a model

Inference of negations?

Have these rules a mathematical meaning?Is it possible to find for λ a “trick” as local-Cπ?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 36/39

Page 197:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Some further issues

Polymorphic typesA lot of work carried on (implicit/explicit, parametricity,. . . )especially in the field of programming language for XML

Type casesHow much related is semantic subtyping to the presence oftypecases? Not strictly necessary but make things easier (PLviewpoint) of worst (mathematical viewpoint)

Dependent typesAn unexplored country.

Relating semantic-λ and semantic-πFascinating as it goes deep into the relation amongoverloading, sequentiality, and concurrency.

Main question

Is semantic subtyping just a definition technique or something more?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 37/39

Page 198:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Some further issues

Polymorphic typesA lot of work carried on (implicit/explicit, parametricity,. . . )especially in the field of programming language for XML

Type casesHow much related is semantic subtyping to the presence oftypecases? Not strictly necessary but make things easier (PLviewpoint) of worst (mathematical viewpoint)

Dependent typesAn unexplored country.

Relating semantic-λ and semantic-πFascinating as it goes deep into the relation amongoverloading, sequentiality, and concurrency.

Main question

Is semantic subtyping just a definition technique or something more?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 37/39

Page 199:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Some further issues

Polymorphic typesA lot of work carried on (implicit/explicit, parametricity,. . . )especially in the field of programming language for XML

Type casesHow much related is semantic subtyping to the presence oftypecases? Not strictly necessary but make things easier (PLviewpoint) of worst (mathematical viewpoint)

Dependent typesAn unexplored country.

Relating semantic-λ and semantic-πFascinating as it goes deep into the relation amongoverloading, sequentiality, and concurrency.

Main question

Is semantic subtyping just a definition technique or something more?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 37/39

Page 200:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Some further issues

Polymorphic typesA lot of work carried on (implicit/explicit, parametricity,. . . )especially in the field of programming language for XML

Type casesHow much related is semantic subtyping to the presence oftypecases? Not strictly necessary but make things easier (PLviewpoint) of worst (mathematical viewpoint)

Dependent typesAn unexplored country.

Relating semantic-λ and semantic-πFascinating as it goes deep into the relation amongoverloading, sequentiality, and concurrency.

Main question

Is semantic subtyping just a definition technique or something more?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 37/39

Page 201:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Some further issues

Polymorphic typesA lot of work carried on (implicit/explicit, parametricity,. . . )especially in the field of programming language for XML

Type casesHow much related is semantic subtyping to the presence oftypecases? Not strictly necessary but make things easier (PLviewpoint) of worst (mathematical viewpoint)

Dependent typesAn unexplored country.

Relating semantic-λ and semantic-πFascinating as it goes deep into the relation amongoverloading, sequentiality, and concurrency.

Main question

Is semantic subtyping just a definition technique or something more?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 37/39

Page 202:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Some further issues

Polymorphic typesA lot of work carried on (implicit/explicit, parametricity,. . . )especially in the field of programming language for XML

Type casesHow much related is semantic subtyping to the presence oftypecases? Not strictly necessary but make things easier (PLviewpoint) of worst (mathematical viewpoint)

Dependent typesAn unexplored country.

Relating semantic-λ and semantic-πFascinating as it goes deep into the relation amongoverloading, sequentiality, and concurrency.

Main question

Is semantic subtyping just a definition technique or something more?

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 37/39

Page 203:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

Conclusion

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 38/39

Page 204:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

La morale de l’histoire est . . .

If you have a strong semantic intuition of your favourite languageand you want to add set-theoretic ∨∨∨, ∧∧∧, ¬¬¬ types then:

1 Define a set-theoretic interpretation J K for your typeconstructors so that it matches your semantic intuition

[may be not easy/possible]

2 Use the subtyping relation induced by the model to type yourlanguage: if the intuition was right then the set of values isalso a model, otherwise tweak it. [may be not easy/possible]

3 Use the set-theoretic properties of the model to decomposethe emptiness test for your type constructors, and hencederive a subtyping algorithm.

[may be not easy/possible]4 Enjoy.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 39/39

Page 205:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

La morale de l’histoire est . . .

If you have a strong semantic intuition of your favourite languageand you want to add set-theoretic ∨∨∨, ∧∧∧, ¬¬¬ types then:

1 Define a set-theoretic interpretation J K for your typeconstructors so that it matches your semantic intuition

[may be not easy/possible]

2 Use the subtyping relation induced by the model to type yourlanguage: if the intuition was right then the set of values isalso a model, otherwise tweak it. [may be not easy/possible]

3 Use the set-theoretic properties of the model to decomposethe emptiness test for your type constructors, and hencederive a subtyping algorithm.

[may be not easy/possible]4 Enjoy.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 39/39

Page 206:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

La morale de l’histoire est . . .

If you have a strong semantic intuition of your favourite languageand you want to add set-theoretic ∨∨∨, ∧∧∧, ¬¬¬ types then:

1 Define a set-theoretic interpretation J K for your typeconstructors so that it matches your semantic intuition

[may be not easy/possible]

2 Use the subtyping relation induced by the model to type yourlanguage: if the intuition was right then the set of values isalso a model, otherwise tweak it. [may be not easy/possible]

3 Use the set-theoretic properties of the model to decomposethe emptiness test for your type constructors, and hencederive a subtyping algorithm.

[may be not easy/possible]4 Enjoy.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 39/39

Page 207:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

La morale de l’histoire est . . .

If you have a strong semantic intuition of your favourite languageand you want to add set-theoretic ∨∨∨, ∧∧∧, ¬¬¬ types then:

1 Define a set-theoretic interpretation J K for your typeconstructors so that it matches your semantic intuition

[may be not easy/possible]

2 Use the subtyping relation induced by the model to type yourlanguage: if the intuition was right then the set of values isalso a model, otherwise tweak it. [may be not easy/possible]

3 Use the set-theoretic properties of the model to decomposethe emptiness test for your type constructors, and hencederive a subtyping algorithm.

[may be not easy/possible]4 Enjoy.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 39/39

Page 208:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

La morale de l’histoire est . . .

If you have a strong semantic intuition of your favourite languageand you want to add set-theoretic ∨∨∨, ∧∧∧, ¬¬¬ types then:

1 Define a set-theoretic interpretation J K for your typeconstructors so that it matches your semantic intuition

[may be not easy/possible]

2 Use the subtyping relation induced by the model to type yourlanguage: if the intuition was right then the set of values isalso a model, otherwise tweak it. [may be not easy/possible]

3 Use the set-theoretic properties of the model to decomposethe emptiness test for your type constructors, and hencederive a subtyping algorithm.

[may be not easy/possible]4 Enjoy.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 39/39

Page 209:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

La morale de l’histoire est . . .

If you have a strong semantic intuition of your favourite languageand you want to add set-theoretic ∨∨∨, ∧∧∧, ¬¬¬ types then:

1 Define a set-theoretic interpretation J K for your typeconstructors so that it matches your semantic intuition

[may be not easy/possible]

2 Use the subtyping relation induced by the model to type yourlanguage: if the intuition was right then the set of values isalso a model, otherwise tweak it. [may be not easy/possible]

3 Use the set-theoretic properties of the model to decomposethe emptiness test for your type constructors, and hencederive a subtyping algorithm.

[may be not easy/possible]4 Enjoy.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 39/39

Page 210:  · 1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk Goal The goal is to show how to take

1. Motivations – 2. Semantic subtyping – 3. λ-calculus – 4. π-calculus – 5. Perspectives – 6. Conclusion ICTCS ’05 Invited Talk

La morale de l’histoire est . . .

If you have a strong semantic intuition of your favourite languageand you want to add set-theoretic ∨∨∨, ∧∧∧, ¬¬¬ types then:

1 Define a set-theoretic interpretation J K for your typeconstructors so that it matches your semantic intuition

[may be not easy/possible]

2 Use the subtyping relation induced by the model to type yourlanguage: if the intuition was right then the set of values isalso a model, otherwise tweak it. [may be not easy/possible]

3 Use the set-theoretic properties of the model to decomposethe emptiness test for your type constructors, and hencederive a subtyping algorithm.

[may be not easy/possible]4 Enjoy.

Giuseppe Castagna Semantic Subtyping: Challenges, Perspectives, and Open Problems 39/39