Sequence Types for Hereditary Permutators Pierre VIAL Equipe - - PowerPoint PPT Presentation

sequence types for hereditary permutators
SMART_READER_LITE
LIVE PREVIEW

Sequence Types for Hereditary Permutators Pierre VIAL Equipe - - PowerPoint PPT Presentation

Sequence Types for Hereditary Permutators Pierre VIAL Equipe Gallinette Inria - LS2N June 25, 2019 Sequence types for hereditary permutators P. Vial 0 1 /22 In a nutshell TLCA Problem # 20 Characterization of a set of terms with an


slide-1
SLIDE 1

Sequence Types for Hereditary Permutators

Pierre VIAL ´ Equipe Gallinette Inria - LS2N June 25, 2019

Sequence types for hereditary permutators

  • P. Vial

1 /22

slide-2
SLIDE 2

In a nutshell TLCA Problem # 20 Characterization of a set of terms with an intersection type system

Sequence types for hereditary permutators

  • P. Vial

2 /22

slide-3
SLIDE 3

In a nutshell TLCA Problem # 20 Characterization of a set of terms with an intersection type system

more precisely, characterizing this set with a unique type

Sequence types for hereditary permutators

  • P. Vial

2 /22

slide-4
SLIDE 4

In a nutshell TLCA Problem # 20 Characterization of a set of terms with an intersection type system

more precisely, characterizing this set with a unique type

Hereditary permutators (“invertible” terms)

Curry-Feys 58 Dezani 76 Bergstra-Klop 80

Sequence types for hereditary permutators

  • P. Vial

2 /22

slide-5
SLIDE 5

In a nutshell TLCA Problem # 20 Characterization of a set of terms with an intersection type system

more precisely, characterizing this set with a unique type

Hereditary permutators (“invertible” terms)

Curry-Feys 58 Dezani 76 Bergstra-Klop 80

[Tatsuta 08] inductive case: not possible [V. 17] coinductive type system can characterize infinitary semantics

coinductive type grammar

Sequence types for hereditary permutators

  • P. Vial

2 /22

slide-6
SLIDE 6

In a nutshell TLCA Problem # 20 Characterization of a set of terms with an intersection type system

more precisely, characterizing this set with a unique type

Hereditary permutators (“invertible” terms)

Curry-Feys 58 Dezani 76 Bergstra-Klop 80

[Tatsuta 08] inductive case: not possible [V. 17] coinductive type system can characterize infinitary semantics

coinductive type grammar

Today: using a coinductive type system to characterize hereditary permutators

Sequence types for hereditary permutators

  • P. Vial

2 /22

slide-7
SLIDE 7

In a nutshell TLCA Problem # 20 Characterization of a set of terms with an intersection type system

more precisely, characterizing this set with a unique type

Hereditary permutators (“invertible” terms)

Curry-Feys 58 Dezani 76 Bergstra-Klop 80

[Tatsuta 08] inductive case: not possible [V. 17] coinductive type system can characterize infinitary semantics

coinductive type grammar

Today: using a coinductive type system to characterize hereditary permutators

t is a h.p. iff ⊢ t : ptyp

Sequence types for hereditary permutators

  • P. Vial

2 /22

slide-8
SLIDE 8

An old problem. . .

Definition (Hereditary Permutators)

t is a hereditary permutator (h.p.) ⇔ t invertible in Scott’s model ⇔ t invertible for βη-conversion w.r.t. composition (∃u, t ◦ u =βη u ◦ t =βη I)

t ◦ u := λx.t(u x)

Sequence types for hereditary permutators

  • P. Vial

3 /22

slide-9
SLIDE 9

An old problem. . .

Definition (Hereditary Permutators)

t is a hereditary permutator (h.p.) ⇔ t invertible in Scott’s model ⇔ t invertible for βη-conversion w.r.t. composition (∃u, t ◦ u =βη u ◦ t =βη I)

t ◦ u := λx.t(u x)

Characterization with B¨

  • hm trees

For all x ∈ V , the sets HP(x) of x-headed Hereditary Permutators (x-HP) (x ∈ V ) are defined by mutual coinduction:

h1 ∈ HP(x1) . . . hn ∈ HP(xn) (n 0, σ ∈ Sn, xi = x, xi pairwise distinct) and h →∗

h λx1 . . . xn.x hσ(1) . . . hσ(n)

h ∈ HP(x)

t is a (closed) hereditary permutator iff t →∗

h λx.h with h ∈ HP(x) for some x.

See Barendregt, Chapter 21

Sequence types for hereditary permutators

  • P. Vial

3 /22

slide-10
SLIDE 10

An old problem. . .

Sequence types for hereditary permutators

  • P. Vial

3 /22

slide-11
SLIDE 11

An old problem. . .

x hσ(1) ∈ HP(xσ(1)) @ hσ(

n − 1) ∈ HP(xσ( n − 1))

@ hσ(n) ∈ HP(xσ(n)) @

λxn λx1

head normal form of a x-h.p.

Sequence types for hereditary permutators

  • P. Vial

3 /22

slide-12
SLIDE 12

An old problem. . .

x hσ(1) ∈ HP(xσ(1)) @ hσ(

n − 1) ∈ HP(xσ( n − 1))

@ hσ(n) ∈ HP(xσ(n)) @

λxn λx1

head normal form of a x-h.p.

Sequence types for hereditary permutators

  • P. Vial

3 /22

slide-13
SLIDE 13

Plan

1 Intersection types and sequences 2 Characterizing hereditary permutators

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 4 /22

slide-14
SLIDE 14

Intersection types (overview)

Introduced by Coppo-Dezani (78-80) to “interpret more terms”

  • Charac. of Weak Norm. for λI-terms (no erasing β-step).

Extended later for λ-terms, head, weak or strong normalizatiion. . . Filter models

Model-checking

Ong 06: monadic second order (MSO) logic is decidable for higher-order recursion schemes (HORS) Kobayashi-Ong 09: MSO is decidable for higher-order programs + using intersection types to simplify Ong’s algorithm. Refined by Grellois-Melli` es 14-15

Complexity analysis:

Upper bounds for reduction sequences (Gardner 94, de Carvalho 07) or exact bounds (Bernadet-Lengrand 11, Accattoli-Lengrand-Kesner, ICFP’18). Terui 06: upper bounds for terms in a red. sequence De Benedetti-Ronchi della Roccha 16: characterization of FPTIME

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 5 /22

slide-15
SLIDE 15

Plan

Goal: Characterizing the set of h.p. with a unique type

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 6 /22

slide-16
SLIDE 16

Plan

Goal: Characterizing the set of h.p. with a unique type Problem: Impossible with an inductive inter. type system [Tatsuta, LiCS’08]

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 6 /22

slide-17
SLIDE 17

Plan

Goal: Characterizing the set of h.p. with a unique type Problem: Impossible with an inductive inter. type system [Tatsuta, LiCS’08] Solution? coinductive type system may characterize sets of terms with an infinitary behavior [V.,17]

e.g., the set of infinitary WN terms (system S, sequential intersection)

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 6 /22

slide-18
SLIDE 18

Plan

Goal: Characterizing the set of h.p. with a unique type Problem: Impossible with an inductive inter. type system [Tatsuta, LiCS’08] Solution? coinductive type system may characterize sets of terms with an infinitary behavior [V.,17]

e.g., the set of infinitary WN terms (system S, sequential intersection)

Step 1: characterize the set of h.p. in system S

find a set of types P s.t. t typable with P ∈ P iff t is a h.p.

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 6 /22

slide-19
SLIDE 19

Plan

Goal: Characterizing the set of h.p. with a unique type Problem: Impossible with an inductive inter. type system [Tatsuta, LiCS’08] Solution? coinductive type system may characterize sets of terms with an infinitary behavior [V.,17]

e.g., the set of infinitary WN terms (system S, sequential intersection)

Step 1: characterize the set of h.p. in system S

find a set of types P s.t. t typable with P ∈ P iff t is a h.p.

Step 2: give the set of h.p. a unique type

quotient P and verify everything is right

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 6 /22

slide-20
SLIDE 20

Why intersections types? (Coppo, Dezani, 1980)

Characterization in an intersection type system

Usually, equivalences of the form “the program t is typable iff t is normalizing” Idea: several certificates to a same subprogram (next slide).

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 7 /22

slide-21
SLIDE 21

Why intersections types? (Coppo, Dezani, 1980)

Characterization in an intersection type system

Usually, equivalences of the form “the program t is typable iff t is normalizing” Idea: several certificates to a same subprogram (next slide).

  • Proof. Charac. obtained by by the “circular” proof scheme:

Some reduction strategy normalizes t t can reach a terminal state t is typable

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 7 /22

slide-22
SLIDE 22

Why intersections types? (Coppo, Dezani, 1980)

Characterization in an intersection type system

Usually, equivalences of the form “the program t is typable iff t is normalizing” Idea: several certificates to a same subprogram (next slide).

  • Proof. Charac. obtained by by the “circular” proof scheme:

Some reduction strategy normalizes t

e.g., the leftmost-o. strat.

t can reach a terminal state

e.g., ∃ red. path to a β-NF (Weak Normalization)

t is typable

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 7 /22

slide-23
SLIDE 23

Intuitions (syntax)

Naively, A ∧ B stands for A ∩ B: t is of type A ∧ B if t can be typed with A as well as B. I : A → A I : (A → B) → (A → B) I : (A → A) ∧ ((A → B) → (A → B)) ∧ −intro

(with I = λx.x)

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 8 /22

slide-24
SLIDE 24

Intuitions (syntax)

Naively, A ∧ B stands for A ∩ B: t is of type A ∧ B if t can be typed with A as well as B. I : A → A I : (A → B) → (A → B) I : (A → A) ∧ ((A → B) → (A → B)) ∧ −intro

(with I = λx.x)

Intersection = kind of finite polymorphism. (A → A) ∧ ((A → B) → (A → B)) = double instance of ∀X.X → X

(with X = A and X = A → B)

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 8 /22

slide-25
SLIDE 25

Intuitions (syntax)

Naively, A ∧ B stands for A ∩ B: t is of type A ∧ B if t can be typed with A as well as B. I : A → A I : (A → B) → (A → B) I : (A → A) ∧ ((A → B) → (A → B)) ∧ −intro

(with I = λx.x)

Intersection = kind of finite polymorphism. (A → A) ∧ ((A → B) → (A → B)) = double instance of ∀X.X → X

(with X = A and X = A → B)

But less constrained: assigning x : o ∧ (o → o′) ∧ (o → o) → o is legal.

(not an instance of a polymorphic type except ∀X.X := False!)

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 8 /22

slide-26
SLIDE 26

Subject Reduction and Subject Expansion

A good intersection type system should enjoy: Subject Reduction (SR): Typing is stable under reduction. Subject Expansion (SE): Typing is stable under anti- reduction.

SE is usually not verified by simple or polymorphic type systems

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 9 /22

slide-27
SLIDE 27

Subject Reduction and Subject Expansion

A good intersection type system should enjoy: Subject Reduction (SR): Typing is stable under reduction. Subject Expansion (SE): Typing is stable under anti- reduction.

SE is usually not verified by simple or polymorphic type systems

t is typable Some reduction strategy normalizes t SR + extra arg.

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 9 /22

slide-28
SLIDE 28

Subject Reduction and Subject Expansion

A good intersection type system should enjoy: Subject Reduction (SR): Typing is stable under reduction. Subject Expansion (SE): Typing is stable under anti- reduction.

SE is usually not verified by simple or polymorphic type systems

t is typable Some reduction strategy normalizes t t can reach a normal form SR + extra arg.

  • bvious

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 9 /22

slide-29
SLIDE 29

Subject Reduction and Subject Expansion

A good intersection type system should enjoy: Subject Reduction (SR): Typing is stable under reduction. Subject Expansion (SE): Typing is stable under anti- reduction.

SE is usually not verified by simple or polymorphic type systems

t is typable Some reduction strategy normalizes t t can reach a normal form SR + extra arg.

  • bvious

typing the NF + SE

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 9 /22

slide-30
SLIDE 30

Subject Reduction and Subject Expansion

A good intersection type system should enjoy: Subject Reduction (SR): Typing is stable under reduction. Subject Expansion (SE): Typing is stable under anti- reduction.

SE is usually not verified by simple or polymorphic type systems

t is typable Some reduction strategy normalizes t t can reach a normal form SR + extra arg.

  • bvious

typing the NF + SE

reducibility cand. non-trivial well-founded order. non-idem. inter types: trivial

size of derivation decreases during red.

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 9 /22

slide-31
SLIDE 31

Intersection types (Coppo-Dezani 80)

Type constructors: o ∈ O, → and ∧ (intersection).

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 10 /22

slide-32
SLIDE 32

Intersection types (Coppo-Dezani 80)

Type constructors: o ∈ O, → and ∧ (intersection). Strict types: no inter. on the right h.s. of →, e.g., (A ∧ B) → A, not A → (B ∧ C)

no intro/elim. rules for ∧

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 10 /22

slide-33
SLIDE 33

Intersection types (Coppo-Dezani 80)

Type constructors: o ∈ O, → and ∧ (intersection). Strict types: no inter. on the right h.s. of →, e.g., (A ∧ B) → A, not A → (B ∧ C)

no intro/elim. rules for ∧

Assoc.: (A ∧ B) ∧ C ∼ A ∧ (B ∧ C)

i.e. Γ ⊢ t : (A∧B)∧C iff Γ ⊢ t : A∧(B∧C)

Comm.: A ∧ B ∼ B ∧ A

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 10 /22

slide-34
SLIDE 34

Intersection types (Coppo-Dezani 80)

Type constructors: o ∈ O, → and ∧ (intersection). Strict types: no inter. on the right h.s. of →, e.g., (A ∧ B) → A, not A → (B ∧ C)

no intro/elim. rules for ∧

Assoc.: (A ∧ B) ∧ C ∼ A ∧ (B ∧ C)

i.e. Γ ⊢ t : (A∧B)∧C iff Γ ⊢ t : A∧(B∧C)

Comm.: A ∧ B ∼ B ∧ A Idempotency? A ∧ A ∼ A

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 10 /22

slide-35
SLIDE 35

Intersection types (Coppo-Dezani 80)

Type constructors: o ∈ O, → and ∧ (intersection). Strict types: no inter. on the right h.s. of →, e.g., (A ∧ B) → A, not A → (B ∧ C)

no intro/elim. rules for ∧

Assoc.: (A ∧ B) ∧ C ∼ A ∧ (B ∧ C)

i.e. Γ ⊢ t : (A∧B)∧C iff Γ ⊢ t : A∧(B∧C)

Comm.: A ∧ B ∼ B ∧ A Idempotency? A ∧ A ∼ A Typing= qualitative info. Typing= quantitative info.

Coppo-Dezani 80 Gardner 94 - de Carvalho 07

Yes No

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 10 /22

slide-36
SLIDE 36

Intersection types (Coppo-Dezani 80)

Type constructors: o ∈ O, → and ∧ (intersection). Strict types: no inter. on the right h.s. of →, e.g., (A ∧ B) → A, not A → (B ∧ C)

no intro/elim. rules for ∧

Assoc.: (A ∧ B) ∧ C ∼ A ∧ (B ∧ C)

i.e. Γ ⊢ t : (A∧B)∧C iff Γ ⊢ t : A∧(B∧C)

Comm.: A ∧ B ∼ B ∧ A Idempotency? A ∧ A ∼ A Typing= qualitative info. Typing= quantitative info.

Coppo-Dezani 80 Gardner 94 - de Carvalho 07

Yes No Collapsing A ∧ B ∧ C into [A, B, C] (multiset) no need for perm rules etc.

A ∧ B ∧ A := [A, B, A] = [A, A, B] = [A, B] [A, B, A] = [A, B] + [A]

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 10 /22

slide-37
SLIDE 37

System R0 (Gardner 94-de Carvalho 07)

Types: τ, σ ::=

  • |

[σi]i∈I → τ

intersection = multiset of types [σi]i∈I

  • nly on the left-h.s of → (strictness)

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 11 /22

slide-38
SLIDE 38

System R0 (Gardner 94-de Carvalho 07)

Types: τ, σ ::=

  • |

[σi]i∈I → τ

intersection = multiset of types [σi]i∈I

  • nly on the left-h.s of → (strictness)

ax x : [τ] ⊢ x : τ Γ; x : [σi]i∈I ⊢ t : τ abs Γ ⊢ λx.t : [σi]i∈I → τ Γ ⊢ t : [σi]i∈I → τ (Γi ⊢ u : σi)i∈I app Γ +i∈I Γi ⊢ t u : τ

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 11 /22

slide-39
SLIDE 39

System R0 (Gardner 94-de Carvalho 07)

Types: τ, σ ::=

  • |

[σi]i∈I → τ

intersection = multiset of types [σi]i∈I

  • nly on the left-h.s of → (strictness)

ax x : [τ] ⊢ x : τ Γ; x : [σi]i∈I ⊢ t : τ abs Γ ⊢ λx.t : [σi]i∈I → τ Γ ⊢ t : [σi]i∈I → τ (Γi ⊢ u : σi)i∈I app Γ +i∈I Γi ⊢ t u : τ Remark Relevant system (no weakening, cf. ax-rule)

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 11 /22

slide-40
SLIDE 40

System R0 (Gardner 94-de Carvalho 07)

Types: τ, σ ::=

  • |

[σi]i∈I → τ

intersection = multiset of types [σi]i∈I

  • nly on the left-h.s of → (strictness)

ax x : [τ] ⊢ x : τ Γ; x : [σi]i∈I ⊢ t : τ abs Γ ⊢ λx.t : [σi]i∈I → τ Γ ⊢ t : [σi]i∈I → τ (Γi ⊢ u : σi)i∈I app Γ +i∈I Γi ⊢ t u : τ Remark Relevant system (no weakening, cf. ax-rule) Non-idempotency (σ ∧ σ = σ): in app-rule, pointwise multiset sum e.g., (x : [σ]; y : [τ]) + (x : [σ, τ]) = x : [σ, σ, τ]; y : [τ]

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 11 /22

slide-41
SLIDE 41

System R0 (Gardner 94-de Carvalho 07)

Types: τ, σ ::=

  • |

[σi]i∈I → τ

intersection = multiset of types [σi]i∈I

  • nly on the left-h.s of → (strictness)

ax x : [τ] ⊢ x : τ Γ; x : [σi]i∈I ⊢ t : τ abs Γ ⊢ λx.t : [σi]i∈I → τ Γ ⊢ t : [σi]i∈I → τ (Γi ⊢ u : σi)i∈I app Γ +i∈I Γi ⊢ t u : τ Example

ax

f : [o] → o

ax

x : o

app

f x : o

ax

f : [o] → o

app

f(f x) : o

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 11 /22

slide-42
SLIDE 42

System R0 (Gardner 94-de Carvalho 07)

Types: τ, σ ::=

  • |

[σi]i∈I → τ

intersection = multiset of types [σi]i∈I

  • nly on the left-h.s of → (strictness)

ax x : [τ] ⊢ x : τ Γ; x : [σi]i∈I ⊢ t : τ abs Γ ⊢ λx.t : [σi]i∈I → τ Γ ⊢ t : [σi]i∈I → τ (Γi ⊢ u : σi)i∈I app Γ +i∈I Γi ⊢ t u : τ Example

ax

f : [o] → o

ax

x : o

app

f x : o

ax

f : [o] → o

app

f : [[o] → o, [o] → o], x : [o] ⊢ f(f x) : o

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 11 /22

slide-43
SLIDE 43

System R0 (Gardner 94-de Carvalho 07)

Types: τ, σ ::=

  • |

[σi]i∈I → τ

intersection = multiset of types [σi]i∈I

  • nly on the left-h.s of → (strictness)

ax x : [τ] ⊢ x : τ Γ; x : [σi]i∈I ⊢ t : τ abs Γ ⊢ λx.t : [σi]i∈I → τ Γ ⊢ t : [σi]i∈I → τ (Γi ⊢ u : σi)i∈I app Γ +i∈I Γi ⊢ t u : τ

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 11 /22

slide-44
SLIDE 44

System R0 (Gardner 94-de Carvalho 07)

Types: τ, σ ::=

  • |

[σi]i∈I → τ

intersection = multiset of types [σi]i∈I

  • nly on the left-h.s of → (strictness)

ax x : [τ] ⊢ x : τ Γ; x : [σi]i∈I ⊢ t : τ abs Γ ⊢ λx.t : [σi]i∈I → τ Γ ⊢ t : [σi]i∈I → τ (Γi ⊢ u : σi)i∈I app Γ +i∈I Γi ⊢ t u : τ Head redexes always typed!

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 11 /22

slide-45
SLIDE 45

System R0 (Gardner 94-de Carvalho 07)

Types: τ, σ ::=

  • |

[σi]i∈I → τ

intersection = multiset of types [σi]i∈I

  • nly on the left-h.s of → (strictness)

ax x : [τ] ⊢ x : τ Γ; x : [σi]i∈I ⊢ t : τ abs Γ ⊢ λx.t : [σi]i∈I → τ Γ ⊢ t : [σi]i∈I → τ (Γi ⊢ u : σi)i∈I app Γ +i∈I Γi ⊢ t u : τ Head redexes always typed!

but an arg. may be typed 0 time

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 11 /22

slide-46
SLIDE 46

Subject reduction and expansion in R0

From a typing of (λx.r)s . . . to a typing of r[s/x]

ax x:[σ1] ⊢ x:σ1 ax x:[σ2] ⊢ x:σ2 ax x:[σ1] ⊢ x:σ1 Γ; x :[σ1, σ2, σ1] ⊢ r : τ abs Γ ⊢ λx.r : [σ1, σ2, σ1] → τ app Γ + ∆a

1 + ∆b 1 + ∆2 ⊢ (λx.r)s : τ

∆a

1 ⊢s:σ1

Πa

1

∆2 ⊢s:σ2 Π2 ∆b

1 ⊢s:σ1

Πb

1

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 12 /22

slide-47
SLIDE 47

Subject reduction and expansion in R0

From a typing of (λx.r)s . . . to a typing of r[s/x]

ax x:[σ1] ⊢ x:σ1 ax x:[σ2] ⊢ x:σ2 ax x:[σ1] ⊢ x:σ1 Γ; x :[σ1, σ2, σ1] ⊢ r : τ abs Γ ⊢ λx.r : [σ1, σ2, σ1] → τ app Γ + ∆a

1 + ∆b 1 + ∆2 ⊢ (λx.r)s : τ

∆a

1 ⊢s:σ1

Πa

1

∆2 ⊢s:σ2 Π2 ∆b

1 ⊢s:σ1

Πb

1

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 12 /22

slide-48
SLIDE 48

Subject reduction and expansion in R0

From a typing of (λx.r)s . . . to a typing of r[s/x]

ax x:[σ1] ⊢ x:σ1 ax x:[σ2] ⊢ x:σ2 ax x:[σ1] ⊢ x:σ1 Γ; x :[σ1, σ2, σ1] ⊢ r : τ abs Γ ⊢ λx.r : [σ1, σ2, σ1] → τ app Γ + ∆a

1 + ∆b 1 + ∆2 ⊢ (λx.r)s : τ

∆a

1 ⊢s:σ1

Πa

1

∆2 ⊢s:σ2 Π2 ∆b

1 ⊢s:σ1

Πb

1

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 12 /22

slide-49
SLIDE 49

Subject reduction and expansion in R0

From a typing of (λx.r)s . . . to a typing of r[s/x]

ax x:[σ1] ⊢ x:σ1 ax x:[σ2] ⊢ x:σ2 ax x:[σ1] ⊢ x:σ1 Γ; x :[σ1, σ2, σ1] ⊢ r : τ abs Γ ⊢ λx.r : [σ1, σ2, σ1] → τ app Γ + ∆a

1 + ∆b 1 + ∆2 ⊢ (λx.r)s : τ

∆a

1 ⊢s:σ1

Πa

1

∆2 ⊢s:σ2 Π2 ∆b

1 ⊢s:σ1

Πb

1

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 12 /22

slide-50
SLIDE 50

Subject reduction and expansion in R0

From a typing of (λx.r)s . . . to a typing of r[s/x]

ax x:[σ1] ⊢ x:σ1 ax x:[σ2] ⊢ x:σ2 ax x:[σ1] ⊢ x:σ1 Γ; x :[σ1, σ2, σ1] ⊢ r : τ abs Γ ⊢ λx.r : [σ1, σ2, σ1] → τ app Γ + ∆a

1 + ∆b 1 + ∆2 ⊢ (λx.r)s : τ

∆a

1 ⊢s:σ1

Πa

1

∆2 ⊢s:σ2 Π2 ∆b

1 ⊢s:σ1

Πb

1

By relevance and non-idempotency!

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 12 /22

slide-51
SLIDE 51

Subject reduction and expansion in R0

From a typing of (λx.r)s . . . to a typing of r[s/x]

ax x:[σ1] ⊢ x:σ1 ax x:[σ2] ⊢ x:σ2 ax x:[σ1] ⊢ x:σ1 Γ; x :[σ1, σ2, σ1] ⊢ r : τ abs Γ ⊢ λx.r : [σ1, σ2, σ1] → τ app Γ + ∆a

1 + ∆b 1 + ∆2 ⊢ (λx.r)s : τ

∆a

1 ⊢s:σ1

Πa

1

∆2 ⊢s:σ2 Π2 ∆b

1 ⊢s:σ1

Πb

1

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 12 /22

slide-52
SLIDE 52

Subject reduction and expansion in R0

From a typing of (λx.r)s . . . to a typing of r[s/x]

ax x:[σ1] ⊢ x:σ1 ax x:[σ2] ⊢ x:σ2 ax x:[σ1] ⊢ x:σ1 Γ; x :[σ1, σ2, σ1] ⊢ r : τ abs Γ ⊢ λx.r : [σ1, σ2, σ1] → τ app Γ + ∆a

1 + ∆b 1 + ∆2 ⊢ (λx.r)s : τ

∆a

1 ⊢s:σ1

Πa

1

∆2 ⊢s:σ2 Π2 ∆b

1 ⊢s:σ1

Πb

1

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 12 /22

slide-53
SLIDE 53

Subject reduction and expansion in R0

From a typing of (λx.r)s . . . to a typing of r[s/x]

∆a

1 ⊢s:σ1

Πa

1

∆2 ⊢s:σ2 Π2 ∆b

1 ⊢s:σ1

Πb

1

Γ + ∆a

1 + ∆b 1 + ∆2 ⊢ r[s/x] : τ

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 12 /22

slide-54
SLIDE 54

Subject reduction and expansion in R0

From a typing of (λx.r)s . . . to a typing of r[s/x]

∆a

1 ⊢s:σ1

Πa

1

Non-determinism of SR ∆2 ⊢s:σ2 Π2 ∆b

1 ⊢s:σ1

Πb

1

Γ + ∆a

1 + ∆b 1 + ∆2 ⊢ r[s/x] : τ

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 12 /22

slide-55
SLIDE 55

Subject reduction and expansion in R0

From a typing of (λx.r)s . . . to a typing of r[s/x]

∆b

1 ⊢s:σ1

Πb

1

Non-determinism of SR ∆2 ⊢s:σ2 Π2 ∆a

1 ⊢s:σ1

Πa

1

Γ + ∆a

1 + ∆b 1 + ∆2 ⊢ r[s/x] : τ

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 12 /22

slide-56
SLIDE 56

System S and sequence types [V., Lics’17]

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 13 /22

slide-57
SLIDE 57

System S and sequence types [V., Lics’17] System S

  • coinductive type grammar
  • replace [σi]i∈I with (k·σk)k∈K

sequence type (new intersection)

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 13 /22

slide-58
SLIDE 58

System S and sequence types [V., Lics’17] System S

  • coinductive type grammar
  • replace [σi]i∈I with (k·σk)k∈K

sequence type (new intersection) (3 · σ, 5 · τ, 9 · σ) vs. [σ, τ, σ]

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 13 /22

slide-59
SLIDE 59

System S and sequence types [V., Lics’17] System S

  • coinductive type grammar
  • replace [σi]i∈I with (k·σk)k∈K

sequence type (new intersection) Tracking: (3 · σ, 5 · τ, 9 · σ) = (3 · σ, 5 · τ) ⊎ (9 · σ)

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 13 /22

slide-60
SLIDE 60

System S and sequence types [V., Lics’17] System S

  • coinductive type grammar
  • replace [σi]i∈I with (k·σk)k∈K

sequence type (new intersection) Tracking: (3 · σ, 5 · τ, 9 · σ) = (3 · σ, 5 · τ) ⊎ (9 · σ)

  • vs. [σ, τ, σ] = [σ

?, τ] + [σ ?]

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 13 /22

slide-61
SLIDE 61

System S and sequence types [V., Lics’17] System S

  • coinductive type grammar
  • replace [σi]i∈I with (k·σk)k∈K

sequence type (new intersection) Tracking: (3 · σ, 5 · τ, 9 · σ) = (3 · σ, 5 · τ) ⊎ (9 · σ)

  • vs. [σ, τ, σ] = [σ

?, τ] + [σ ?]

Why system S?

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 13 /22

slide-62
SLIDE 62

System S and sequence types [V., Lics’17] System S

  • coinductive type grammar
  • replace [σi]i∈I with (k·σk)k∈K

sequence type (new intersection) Tracking: (3 · σ, 5 · τ, 9 · σ) = (3 · σ, 5 · τ) ⊎ (9 · σ)

  • vs. [σ, τ, σ] = [σ

?, τ] + [σ ?]

Why system S?

Coinduction necessary to fully type infinite NF

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 13 /22

slide-63
SLIDE 63

System S and sequence types [V., Lics’17] System S

  • coinductive type grammar
  • replace [σi]i∈I with (k·σk)k∈K

sequence type (new intersection) Tracking: (3 · σ, 5 · τ, 9 · σ) = (3 · σ, 5 · τ) ⊎ (9 · σ)

  • vs. [σ, τ, σ] = [σ

?, τ] + [σ ?]

Why system S?

Coinduction necessary to fully type infinite NF Coinductive type grammar Ω is typable (unsoundness)

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 13 /22

slide-64
SLIDE 64

System S and sequence types [V., Lics’17] System S

  • coinductive type grammar
  • replace [σi]i∈I with (k·σk)k∈K

sequence type (new intersection) Tracking: (3 · σ, 5 · τ, 9 · σ) = (3 · σ, 5 · τ) ⊎ (9 · σ)

  • vs. [σ, τ, σ] = [σ

?, τ] + [σ ?]

Why system S?

Coinduction necessary to fully type infinite NF Coinductive type grammar Ω is typable (unsoundness) Tracking necessary to recover soundness approximability (= validity criterion, next slide)

System S allows characterizing infinitary weak normalization

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 13 /22

slide-65
SLIDE 65

Approximability (intuitions)

Order on the set derivations based on truncation x : [[ ] → o] ⊢ x : [ ] → o x : [[o] → o] ⊢ x y : o

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 14 /22

slide-66
SLIDE 66

Approximability (intuitions)

Order on the set derivations based on truncation x : [[o] → o] ⊢ x : [o] → o y : [o] ⊢ y : o x : [[o] → o]; y : [o] ⊢ x y : o

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 14 /22

slide-67
SLIDE 67

Approximability (intuitions)

Order on the set derivations based on truncation (black black+red) x : [[o] → o] ⊢ x : [o] → o y : [o] ⊢ y : o x : [[o] → o]; y : [o] ⊢ x y : o

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 14 /22

slide-68
SLIDE 68

Approximability (intuitions)

Order on the set derivations based on truncation (black black+red) x : [[o] → o] ⊢ x : [o] → o y : [o] ⊢ y : o x : [[o] → o]; y : [o] ⊢ x y : o P1 P2 P1 approximates P2

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 14 /22

slide-69
SLIDE 69

Approximability (intuitions)

Order on the set derivations based on truncation (black black+red) x : [[o] → o] ⊢ x : [o] → o y : [o] ⊢ y : o x : [[o] → o]; y : [o] ⊢ x y : o P1 P2 P1 approximates P2 Approximability (def.): a S-derivation P is approximable if it is the supremum of its finite approximations

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 14 /22

slide-70
SLIDE 70

Approximability (intuitions)

Order on the set derivations based on truncation (black black+red) x : [[o] → o] ⊢ x : [o] → o y : [o] ⊢ y : o x : [[o] → o]; y : [o] ⊢ x y : o P1 P2 P1 approximates P2 Approximability (def.): a S-derivation P is approximable if it is the supremum of its finite approximations

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 14 /22

slide-71
SLIDE 71

Approximability (intuitions)

Order on the set derivations based on truncation (black black+red) x : [[o] → o] ⊢ x : [o] → o y : [o] ⊢ y : o x : [[o] → o]; y : [o] ⊢ x y : o P1 P2 P1 approximates P2 Approximability (def.): a S-derivation P is approximable if it is the supremum of its finite approximations

Some derivations do not have finite approximations (e.g., typings of Ω)

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 14 /22

slide-72
SLIDE 72

Properties of system S

Sequence types for hereditary permutators

  • P. Vial

1 Intersection types and sequences 15 /22

slide-73
SLIDE 73

Plan

1 Intersection types and sequences 2 Characterizing hereditary permutators

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 16 /22

slide-74
SLIDE 74

Typing normal h.p. with permutator pairs

Goal: Finding a set of pairs of types (S, T) s.t. x : S ⊢ h : T when h is x-h.p.

Tracks are ignored above! (ok for NF)

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 17 /22

slide-75
SLIDE 75

Typing normal h.p. with permutator pairs

Goal: Finding a set of pairs of types (S, T) s.t. x : S ⊢ h : T when h is x-h.p.

Tracks are ignored above! (ok for NF)

h = λx1 . . . xn.x hσ(1) . . . hσ(n)

h1, . . . , hn headed by x1, . . . , xn

x hσ(1) @ hσ(

n − 1)

@ hσ(n) @ : o

λxn λx1

h

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 17 /22

slide-76
SLIDE 76

Typing normal h.p. with permutator pairs

Goal: Finding a set of pairs of types (S, T) s.t. x : S ⊢ h : T when h is x-h.p.

Tracks are ignored above! (ok for NF)

h = λx1 . . . xn.x hσ(1) . . . hσ(n)

h1, . . . , hn headed by x1, . . . , xn

we want x : S ⊢ h : T and x1 : S1 ⊢ h1 : T1,. . . , xn : Sn ⊢ hn Tn

x hσ(1) @ hσ(

n − 1)

@ hσ(n) @ : o

λxn λx1

h

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 17 /22

slide-77
SLIDE 77

Typing normal h.p. with permutator pairs

Goal: Finding a set of pairs of types (S, T) s.t. x : S ⊢ h : T when h is x-h.p.

Tracks are ignored above! (ok for NF)

h = λx1 . . . xn.x hσ(1) . . . hσ(n)

h1, . . . , hn headed by x1, . . . , xn

we want x : S ⊢ h : T and x1 : S1 ⊢ h1 : T1,. . . , xn : Sn ⊢ hn Tn

x S hσ(1) : Tσ(1) @ hσ(

n − 1): T σ( n − 1)

@ hσ(n) : Tσ(n) @ : o

λxn λx1

h : T

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 17 /22

slide-78
SLIDE 78

Typing normal h.p. with permutator pairs

Goal: Finding a set of pairs of types (S, T) s.t. x : S ⊢ h : T when h is x-h.p.

Tracks are ignored above! (ok for NF)

h = λx1 . . . xn.x hσ(1) . . . hσ(n)

h1, . . . , hn headed by x1, . . . , xn

we want x : S ⊢ h : T and x1 : S1 ⊢ h1 : T1,. . . , xn : Sn ⊢ hn Tn

x S hσ(1) : Tσ(1) @ hσ(

n − 1): T σ( n − 1)

@ hσ(n) : Tσ(n) @ : o

λxn Sn→o λx1

h : T

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 17 /22

slide-79
SLIDE 79

Typing normal h.p. with permutator pairs

Goal: Finding a set of pairs of types (S, T) s.t. x : S ⊢ h : T when h is x-h.p.

Tracks are ignored above! (ok for NF)

h = λx1 . . . xn.x hσ(1) . . . hσ(n)

h1, . . . , hn headed by x1, . . . , xn

we want x : S ⊢ h : T and x1 : S1 ⊢ h1 : T1,. . . , xn : Sn ⊢ hn Tn

x S hσ(1) : Tσ(1) @ hσ(

n − 1): T σ( n − 1)

@ hσ(n) : Tσ(n) @ : o

λxn Sn→o λx1

h : T = S1→ . . . →Sn→o

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 17 /22

slide-80
SLIDE 80

Typing normal h.p. with permutator pairs

Goal: Finding a set of pairs of types (S, T) s.t. x : S ⊢ h : T when h is x-h.p.

Tracks are ignored above! (ok for NF)

h = λx1 . . . xn.x hσ(1) . . . hσ(n)

h1, . . . , hn headed by x1, . . . , xn

we want x : S ⊢ h : T and x1 : S1 ⊢ h1 : T1,. . . , xn : Sn ⊢ hn Tn

x S = Tσ(1)→ . . . →Tσ(n)→o hσ(1) : Tσ(1) @ hσ(

n − 1): T σ( n − 1)

@ hσ(n) : Tσ(n) @ : o

λxn Sn→o λx1

h : T = S1→ . . . →Sn→o

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 17 /22

slide-81
SLIDE 81

Typing normal h.p. with permutator pairs

Goal: Finding a set of pairs of types (S, T) s.t. x : S ⊢ h : T when h is x-h.p.

Tracks are ignored above! (ok for NF)

h = λx1 . . . xn.x hσ(1) . . . hσ(n)

h1, . . . , hn headed by x1, . . . , xn

we want x : S ⊢ h : T and x1 : S1 ⊢ h1 : T1,. . . , xn : Sn ⊢ hn Tn We obtain: S = Tσ(1)→ . . . →Tσ(n)→o and T = S1→ . . . →Sn→o

x S = Tσ(1)→ . . . →Tσ(n)→o hσ(1) : Tσ(1) @ hσ(

n − 1): T σ( n − 1)

@ hσ(n) : Tσ(n) @ : o

λxn Sn→o λx1

h : T = S1→ . . . →Sn→o

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 17 /22

slide-82
SLIDE 82

Typing normal h.p. with permutator pairs

We obtain: S = Tσ(1)→ . . . →Tσ(n)→o and T = S1→ . . . →Sn→o

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 17 /22

slide-83
SLIDE 83

Typing normal h.p. with permutator pairs

We obtain: S = Tσ(1)→ . . . →Tσ(n)→o and T = S1→ . . . →Sn→o

Permutator pairs

When o ranges over O (the set of type atoms), the set PP(o) of

  • -permutator pairs (S, T), where S and T are S-types, is

defined by mutual coinduction:

(S1, T1) ∈ PP(o1), . . . , (Sn, Tn) ∈ PP(on) σ ∈ Sn ((2 · Tσ(1)) → . . . → (2 · Tσ(n)) → o, (2 · S1) → . . . (2 · Sn) → o) ∈ PP(o)

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 17 /22

slide-84
SLIDE 84

Typing normal h.p. with permutator pairs

Permutator pairs

When o ranges over O (the set of type atoms), the set PP(o) of

  • -permutator pairs (S, T), where S and T are S-types, is

defined by mutual coinduction:

(S1, T1) ∈ PP(o1), . . . , (Sn, Tn) ∈ PP(on) σ ∈ Sn ((2 · Tσ(1)) → . . . → (2 · Tσ(n)) → o, (2 · S1) → . . . (2 · Sn) → o) ∈ PP(o)

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 17 /22

slide-85
SLIDE 85

Typing normal h.p. with permutator pairs

Permutator pairs

When o ranges over O (the set of type atoms), the set PP(o) of

  • -permutator pairs (S, T), where S and T are S-types, is

defined by mutual coinduction:

(S1, T1) ∈ PP(o1), . . . , (Sn, Tn) ∈ PP(on) σ ∈ Sn ((2 · Tσ(1)) → . . . → (2 · Tσ(n)) → o, (2 · S1) → . . . (2 · Sn) → o) ∈ PP(o)

A pair (S, T) ∈ PP(o) is said to be proper, if, for all o′ ∈ O, o′

  • ccurs at most once in S and in T. The set of proper
  • -permutator pairs is denoted PPP(o).

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 17 /22

slide-86
SLIDE 86

Typing normal h.p. with permutator pairs

Permutator pairs

When o ranges over O (the set of type atoms), the set PP(o) of

  • -permutator pairs (S, T), where S and T are S-types, is

defined by mutual coinduction:

(S1, T1) ∈ PP(o1), . . . , (Sn, Tn) ∈ PP(on) σ ∈ Sn ((2 · Tσ(1)) → . . . → (2 · Tσ(n)) → o, (2 · S1) → . . . (2 · Sn) → o) ∈ PP(o)

A pair (S, T) ∈ PP(o) is said to be proper, if, for all o′ ∈ O, o′

  • ccurs at most once in S and in T. The set of proper
  • -permutator pairs is denoted PPP(o).

Characterization of h.p. in system S

t is a x-h.p. iff x : (2·S) ⊢ t : T for some (S, T) ∈ PPP t is a h.p. iff ⊢ t : (2 · S) → T for some (S, T) ∈ PPP.

  • For ∞-NF: ⇒ (animation)

⇐: use properness

  • non-NF: use ∞-subj. reduction and expansion

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 17 /22

slide-87
SLIDE 87

Towards quotienting

Characterization in system S

  • t is a x-h.p. iff x : (2·S) ⊢ t : T (with (S, T) perm. pair)
  • t is a h.p. iff ⊢ t : (2·S) → T

Proof. NF case: previous slide Use infinitary subject reduction and expansion

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 18 /22

slide-88
SLIDE 88

Towards quotienting

Characterization in system S

  • t is a x-h.p. iff x : (2·S) ⊢ t : T (with (S, T) perm. pair)
  • t is a h.p. iff ⊢ t : (2·S) → T

Proof. NF case: previous slide Use infinitary subject reduction and expansion Question: how to give a unique type to all h.p.?

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 18 /22

slide-89
SLIDE 89

Towards quotienting

Characterization in system S

  • t is a x-h.p. iff x : (2·S) ⊢ t : T (with (S, T) perm. pair)
  • t is a h.p. iff ⊢ t : (2·S) → T

Proof. NF case: previous slide Use infinitary subject reduction and expansion Question: how to give a unique type to all h.p.? Idea: “collapse” the (2·S) → T

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 18 /22

slide-90
SLIDE 90

Towards quotienting

Characterization in system S

  • t is a x-h.p. iff x : (2·S) ⊢ t : T (with (S, T) perm. pair)
  • t is a h.p. iff ⊢ t : (2·S) → T

Proof. NF case: previous slide Use infinitary subject reduction and expansion Question: how to give a unique type to all h.p.? Idea: “collapse” the (2·S) → T

Does this preserve type soundness/completeness?

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 18 /22

slide-91
SLIDE 91

Truncation

Permutator schemes of degree d

Let d ∈ N. A x-permutator scheme of degree d is a term t whose B¨

  • hm tree is

equal to that of a x-h.p. for applicative depth < d.

Applicative depth: number of nestings inside arguments.

Any term t is a 0-p.s. h = λx x1x2.(x (λx1,1x1,2.x2 t1 t2))(λx2,1.x1 t3) is a 2-p.s. (t1,2,3:terms)

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 19 /22

slide-92
SLIDE 92

Truncation

Permutator schemes of degree d

Let d ∈ N. A x-permutator scheme of degree d is a term t whose B¨

  • hm tree is

equal to that of a x-h.p. for applicative depth < d.

Applicative depth: number of nestings inside arguments.

Any term t is a 0-p.s. h = λx x1x2.(x (λx1,1x1,2.x2 t1 t2))(λx2,1.x1 t3) is a 2-p.s. (t1,2,3:terms)

Proper permutator pairs of degree d

PPPd: truncations ((S)d, (T)d) of a proper permutator pair at domain depth < d (finite types!)

Domain depth: number of nestings inside left-hand sides of arrows

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 19 /22

slide-93
SLIDE 93

Truncation

Permutator schemes of degree d

Let d ∈ N. A x-permutator scheme of degree d is a term t whose B¨

  • hm tree is

equal to that of a x-h.p. for applicative depth < d.

Applicative depth: number of nestings inside arguments.

Any term t is a 0-p.s. h = λx x1x2.(x (λx1,1x1,2.x2 t1 t2))(λx2,1.x1 t3) is a 2-p.s. (t1,2,3:terms)

Proper permutator pairs of degree d

PPPd: truncations ((S)d, (T)d) of a proper permutator pair at domain depth < d (finite types!)

Domain depth: number of nestings inside left-hand sides of arrows

Characterization in system S

t is a d-p.s. headed by x iff x : (2·S) ⊢ t : T (with (S, T) ∈ PPPd)

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 19 /22

slide-94
SLIDE 94

Truncation

Permutator schemes of degree d

Let d ∈ N. A x-permutator scheme of degree d is a term t whose B¨

  • hm tree is

equal to that of a x-h.p. for applicative depth < d.

Applicative depth: number of nestings inside arguments.

Any term t is a 0-p.s. h = λx x1x2.(x (λx1,1x1,2.x2 t1 t2))(λx2,1.x1 t3) is a 2-p.s. (t1,2,3:terms)

Proper permutator pairs of degree d

PPPd: truncations ((S)d, (T)d) of a proper permutator pair at domain depth < d (finite types!)

Domain depth: number of nestings inside left-hand sides of arrows

Characterization in system S

t is a d-p.s. headed by x iff x : (2·S) ⊢ t : T (with (S, T) ∈ PPPd)

Compatible truncation

x : (2·S) ⊢ t : T iff, for all d ∈ N, x : (2·(S)d) ⊢ t : (T)d

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 19 /22

slide-95
SLIDE 95

System Shp

System Shp = System S + “Finitary” rule (level d for all d): x : (2 · S) ⊢ t : T (S, T) ∈ PPPd hpd ⊢ λx.t : ptypd “Infinitary rule”: x : (2 · S) ⊢ t : T (S, T) ∈ PPP hp ⊢ λx.t : ptyp

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 20 /22

slide-96
SLIDE 96

System Shp

System Shp = System S + “Finitary” rule (level d for all d): x : (2 · S) ⊢ t : T (S, T) ∈ PPPd hpd ⊢ λx.t : ptypd “Infinitary rule”: x : (2 · S) ⊢ t : T (S, T) ∈ PPP hp ⊢ λx.t : ptyp Approximability extended with the rule ptypd ptyp for all d

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 20 /22

slide-97
SLIDE 97

System Shp

System Shp = System S + “Finitary” rule (level d for all d): x : (2 · S) ⊢ t : T (S, T) ∈ PPPd hpd ⊢ λx.t : ptypd “Infinitary rule”: x : (2 · S) ⊢ t : T (S, T) ∈ PPP hp ⊢ λx.t : ptyp Approximability extended with the rule ptypd ptyp for all d

Lemma (inversion for normal forms)

Let t be a (finite or not) normal form. Then ⊢ t : ptyp iff t is a hereditary permutator.

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 20 /22

slide-98
SLIDE 98

System Shp

System Shp = System S + “Finitary” rule (level d for all d): x : (2 · S) ⊢ t : T (S, T) ∈ PPPd hpd ⊢ λx.t : ptypd “Infinitary rule”: x : (2 · S) ⊢ t : T (S, T) ∈ PPP hp ⊢ λx.t : ptyp Approximability extended with the rule ptypd ptyp for all d

Lemma (inversion for normal forms)

Let t be a (finite or not) normal form. Then ⊢ t : ptyp iff t is a hereditary permutator.

Lemma (compatible truncation in Shp)

Let t be a (finite or not) normal form. Then ⊢ t : ptyp iff t ⊢ t : ptypd.

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 20 /22

slide-99
SLIDE 99

Dynamic properties and final characterization

Finitary soundness

If P proves C ⊢ t : T in Shp and P is finite, then t is HN.

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 21 /22

slide-100
SLIDE 100

Dynamic properties and final characterization

Finitary soundness

If P proves C ⊢ t : T in Shp and P is finite, then t is HN.

Infinitary subject reduction in Shp

If t →∞ t′ and C ⊢ t : T then C ⊢ t′ : T.

t→∞t′: ∞-productive reduction path, possibly computing the B¨

  • hm tree of t

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 21 /22

slide-101
SLIDE 101

Dynamic properties and final characterization

Finitary soundness

If P proves C ⊢ t : T in Shp and P is finite, then t is HN.

Infinitary subject reduction in Shp

If t →∞ t′ and C ⊢ t : T then C ⊢ t′ : T.

t→∞t′: ∞-productive reduction path, possibly computing the B¨

  • hm tree of t

Infinitary subject expansion in Shp

If t →∞ t′ and C ⊢ t′ : T, then C ⊢ t : T.

Approximability is crucial for ∞-subj. exp.!

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 21 /22

slide-102
SLIDE 102

Dynamic properties and final characterization

Finitary soundness

If P proves C ⊢ t : T in Shp and P is finite, then t is HN.

Infinitary subject reduction in Shp

If t →∞ t′ and C ⊢ t : T then C ⊢ t′ : T.

t→∞t′: ∞-productive reduction path, possibly computing the B¨

  • hm tree of t

Infinitary subject expansion in Shp

If t →∞ t′ and C ⊢ t′ : T, then C ⊢ t : T.

Approximability is crucial for ∞-subj. exp.!

From ∞-s.r. and s.e. + inversion for NF + truncation:

A unique type for hereditary permutators

For all terms t, t is a h.p. iff ⊢ t : ptyp in system Shp.

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 21 /22

slide-103
SLIDE 103

Summary and future work

Contribution: characterizing hereditary permutators with a unique type

Not possible in the inductive case (not r.e.) System S: coinductive variant of non-idempotent intersection types: elements of multisets annotated with tracks allows recovering soundness w. approximability (=validity criterion). In system S, h.p. characterized with proper permutator pairs. System Shp: “collapsing” proper permutator pairs using constant ptyp.

ptyp approximated by ptypd approximability extends to Shp.

Truncation lemma for t NF:

⊢ t : ptyp approximated by ⊢ t : ptypd (for all d ∈ N)

Shp: infinitary subject reduction and expansion

retrieving methods of finitary intersection type systems

Soundness and completeness w.r.t. h.p.: t is a h.p. iff ⊢ t : ptyp in Shp

Future work: Other sets of terms with infinitary behaviors

  • inc. normalization in other ∞-calculi

Sequence types for hereditary permutators

  • P. Vial

2 Characterizing hereditary permutators 22 /22