Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic...

255
Non-Idempotent Typing Operators, beyond the λ-Calculus Soutenance de th` ese Pierre VIAL IRIF (Univ. Paris Diderot and CNRS) December 7, 2017 Non-idempotent typing operators P. Vial 0 1 /46

Transcript of Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic...

Page 1: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Non-Idempotent Typing Operators,beyond the λ-Calculus

Soutenance de these

Pierre VIALIRIF (Univ. Paris Diderot and CNRS)

December 7, 2017

Non-idempotent typing operators P. Vial 0 1 /46

Page 2: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Certification and logic in computer science

x = 1

while (x > 0):

x = x + 1

transfer(1 000 000 000 $, calyon, my-account)

print("I’m rich now")

x =

The core of this thesis

Termination or productivity (via source codes)

Paths to terminal states.

For that, using types (data descriptors).

Productivity:O. S.

2, 3, 5, 7,. . . (primes)

Backtracking:

' Classical logic.

Non-idempotent typing operators P. Vial 1 Presentation 2 /46

Page 3: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Certification and logic in computer science

x = 1

while (x > 0):

x = x + 1

transfer(1 000 000 000 $, calyon, my-account)

print("I’m rich now") x = 1

The core of this thesis

Termination or productivity (via source codes)

Paths to terminal states.

For that, using types (data descriptors).

Productivity:O. S.

2, 3, 5, 7,. . . (primes)

Backtracking:

' Classical logic.

Non-idempotent typing operators P. Vial 1 Presentation 2 /46

Page 4: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Certification and logic in computer science

x = 1

while (x > 0):

x = x + 1

transfer(1 000 000 000 $, calyon, my-account)

print("I’m rich now") x = 2

The core of this thesis

Termination or productivity (via source codes)

Paths to terminal states.

For that, using types (data descriptors).

Productivity:O. S.

2, 3, 5, 7,. . . (primes)

Backtracking:

' Classical logic.

Non-idempotent typing operators P. Vial 1 Presentation 2 /46

Page 5: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Certification and logic in computer science

x = 1

while (x > 0):

x = x + 1

transfer(1 000 000 000 $, calyon, my-account)

print("I’m rich now") x = 3

The core of this thesis

Termination or productivity (via source codes)

Paths to terminal states.

For that, using types (data descriptors).

Productivity:O. S.

2, 3, 5, 7,. . . (primes)

Backtracking:

' Classical logic.

Non-idempotent typing operators P. Vial 1 Presentation 2 /46

Page 6: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Certification and logic in computer science

x = 1

while (x > 0):

x = x + 1

transfer(1 000 000 000 $, calyon, my-account)

print("I’m rich now") x = 4

The core of this thesis

Termination or productivity (via source codes)

Paths to terminal states.

For that, using types (data descriptors).

Productivity:O. S.

2, 3, 5, 7,. . . (primes)

Backtracking:

' Classical logic.

Non-idempotent typing operators P. Vial 1 Presentation 2 /46

Page 7: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Certification and logic in computer science

x = 1

while (x > 0):

x = x + 1

transfer(1 000 000 000 $, calyon, my-account)

print("I’m rich now") x = . . .

The core of this thesis

Termination or productivity (via source codes)

Paths to terminal states.

For that, using types (data descriptors).

Productivity:O. S.

2, 3, 5, 7,. . . (primes)

Backtracking:

' Classical logic.

Non-idempotent typing operators P. Vial 1 Presentation 2 /46

Page 8: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Certification and logic in computer science

x = 1

while (x > 0):

x = x + 1

transfer(1 000 000 000 $, calyon, my-account)

print("I’m rich now") x = 100

The core of this thesis

Termination or productivity (via source codes)

Paths to terminal states.

For that, using types (data descriptors).

Productivity:O. S.

2, 3, 5, 7,. . . (primes)

Backtracking:

' Classical logic.

Non-idempotent typing operators P. Vial 1 Presentation 2 /46

Page 9: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Certification and logic in computer science

x = 1

while (x > 0):

x = x + 1

transfer(1 000 000 000 $, calyon, my-account)

print("I’m rich now") x = . . .

The core of this thesis

Termination or productivity (via source codes)

Paths to terminal states.

For that, using types (data descriptors).

Productivity:O. S.

2, 3, 5, 7,. . . (primes)

Backtracking:

' Classical logic.

Non-idempotent typing operators P. Vial 1 Presentation 2 /46

Page 10: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Certification and logic in computer science

x = 1

while (x > 0):

x = x + 1

transfer(1 000 000 000 $, calyon, my-account)

print("I’m rich now") x =

The core of this thesis

Termination or productivity (via source codes)

Paths to terminal states.

For that, using types (data descriptors).

Productivity:O. S.

2, 3, 5, 7,. . . (primes)

Backtracking:

' Classical logic.

Non-idempotent typing operators P. Vial 1 Presentation 2 /46

Page 11: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Certification and logic in computer science

x = 1

while (x > 0):

x = x + 1

transfer(1 000 000 000 $, calyon, my-account)

print("I’m rich now") x =

The core of this thesis

Termination or productivity (via source codes)

Paths to terminal states.

For that, using types (data descriptors).

Productivity:O. S.

2, 3, 5, 7,. . . (primes)

Backtracking:

' Classical logic.

Non-idempotent typing operators P. Vial 1 Presentation 2 /46

Page 12: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Certification and logic in computer science

x = 1

while (x > 0):

x = x + 1

transfer(1 000 000 000 $, calyon, my-account)

print("I’m rich now") x =

The core of this thesis

Termination or productivity (via source codes)

Paths to terminal states.

For that, using types (data descriptors).

Productivity:O. S.

2, 3, 5, 7,. . . (primes)

Backtracking:

' Classical logic.

Non-idempotent typing operators P. Vial 1 Presentation 2 /46

Page 13: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Certification and logic in computer science

x = 1

while (x > 0):

x = x + 1

transfer(1 000 000 000 $, calyon, my-account)

print("I’m rich now") x =

The core of this thesis

Termination or productivity (via source codes)

Paths to terminal states.

For that, using types (data descriptors).

Productivity:O. S.

2, 3, 5, 7,. . . (primes)

Backtracking:

' Classical logic.

Non-idempotent typing operators P. Vial 1 Presentation 2 /46

Page 14: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Formal logic (valar morghulis)

All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

All ringtus are delgo. Vinkri is a ringtu. Therefore, Vinkri is delgo.

∀x, H (x)⇒M (x)

H (S)⇒M (S) H (S)

M (S)

Formalization

Reduce semantic (= meaning) to mechanical/grammatical/syntactic rules.

Non-idempotent typing operators P. Vial 1 Presentation 3 /46

Page 15: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Formal logic (valar morghulis)

All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

All ringtus are delgo. Vinkri is a ringtu. Therefore, Vinkri is delgo.

∀x, H (x)⇒M (x)

H (S)⇒M (S) H (S)

M (S)

Formalization

Reduce semantic (= meaning) to mechanical/grammatical/syntactic rules.

Non-idempotent typing operators P. Vial 1 Presentation 3 /46

Page 16: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Formal logic (valar morghulis)

All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

All ringtus are delgo. Vinkri is a ringtu. Therefore, Vinkri is delgo.

∀x, H (x)⇒M (x)

H (S)⇒M (S) H (S)

M (S)

Formalization

Reduce semantic (= meaning) to mechanical/grammatical/syntactic rules.

Non-idempotent typing operators P. Vial 1 Presentation 3 /46

Page 17: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Formal logic (valar morghulis)

All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

All ringtus are delgo. Vinkri is a ringtu. Therefore, Vinkri is delgo.

∀x, H (x)⇒M (x)

H (S)⇒M (S) H (S)

M (S)

Formalization

Reduce semantic (= meaning) to mechanical/grammatical/syntactic rules.

Non-idempotent typing operators P. Vial 1 Presentation 3 /46

Page 18: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Formal logic (valar morghulis)

All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

All ringtus are delgo. Vinkri is a ringtu. Therefore, Vinkri is delgo.

∀x, H (x)⇒M (x)

H (S)⇒M (S) H (S)

M (S)

Formalization

Reduce semantic (= meaning) to mechanical/grammatical/syntactic rules.

Non-idempotent typing operators P. Vial 1 Presentation 3 /46

Page 19: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Formal logic (valar morghulis)

All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

All ringtus are delgo. Vinkri is a ringtu. Therefore, Vinkri is delgo.

∀x, H (x)⇒M (x)

H (S)⇒M (S) H (S)

M (S)

Formalization

Reduce semantic (= meaning) to mechanical/grammatical/syntactic rules.

Non-idempotent typing operators P. Vial 1 Presentation 3 /46

Page 20: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Formal logic (valar morghulis)

All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

All ringtus are delgo. Vinkri is a ringtu. Therefore, Vinkri is delgo.

∀x, H (x)⇒M (x)

H (S)⇒M (S) H (S)

M (S)

Formalization

Reduce semantic (= meaning) to mechanical/grammatical/syntactic rules.

Non-idempotent typing operators P. Vial 1 Presentation 3 /46

Page 21: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Formal logic (valar morghulis)

All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

All ringtus are delgo. Vinkri is a ringtu. Therefore, Vinkri is delgo.

∀x, H (x)⇒M (x)

H (S)⇒M (S) H (S)

M (S)

Formalization

Reduce semantic (= meaning) to mechanical/grammatical/syntactic rules.

Non-idempotent typing operators P. Vial 1 Presentation 3 /46

Page 22: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Turing and computability

Entscheidung (1928): given a symbolic statement, is there an algorithmicprocedure to decide whether it is true or not?

Godel, 1931:∃ unprovable state-ments

Provable 6= True

primitive recursivefunctions (poor)

Can computationsave mathematics?

What is an algo. ?

What is effectivelycomputable?

Turing machines (1936)

TM are universal

f effectively computableiff f implementable in a TM

A prog. language L is Turing-completeif L has the same computational power as TMs.

Theorem (Turing, 1936)

The Entscheidungsproblem has a negative answer

The halting problem is undecidable: there does not exist a general methoddeciding whether any program terminates or not.

Non-idempotent typing operators P. Vial 1 Presentation 4 /46

Page 23: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Turing and computability

Entscheidung (1928): given a symbolic statement, is there an algorithmicprocedure to decide whether it is true or not?

Godel, 1931:∃ unprovable state-ments

Provable 6= True

primitive recursivefunctions (poor)

Can computationsave mathematics?

What is an algo. ?

What is effectivelycomputable?

Turing machines (1936)

TM are universal

f effectively computableiff f implementable in a TM

A prog. language L is Turing-completeif L has the same computational power as TMs.

Theorem (Turing, 1936)

The Entscheidungsproblem has a negative answer

The halting problem is undecidable: there does not exist a general methoddeciding whether any program terminates or not.

Non-idempotent typing operators P. Vial 1 Presentation 4 /46

Page 24: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Turing and computability

Entscheidung (1928): given a symbolic statement, is there an algorithmicprocedure to decide whether it is true or not?

Godel, 1931:∃ unprovable state-ments

Provable 6= True

primitive recursivefunctions (poor)

Can computationsave mathematics?

What is an algo. ?

What is effectivelycomputable?

Turing machines (1936)

TM are universal

f effectively computableiff f implementable in a TM

A prog. language L is Turing-completeif L has the same computational power as TMs.

Theorem (Turing, 1936)

The Entscheidungsproblem has a negative answer

The halting problem is undecidable: there does not exist a general methoddeciding whether any program terminates or not.

Non-idempotent typing operators P. Vial 1 Presentation 4 /46

Page 25: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Turing and computability

Entscheidung (1928): given a symbolic statement, is there an algorithmicprocedure to decide whether it is true or not?

Godel, 1931:∃ unprovable state-ments

Provable 6= True

primitive recursivefunctions (poor)

Can computationsave mathematics?

What is an algo. ?

What is effectivelycomputable?

Turing machines (1936)

TM are universal

f effectively computableiff f implementable in a TM

A prog. language L is Turing-completeif L has the same computational power as TMs.

Theorem (Turing, 1936)

The Entscheidungsproblem has a negative answer

The halting problem is undecidable: there does not exist a general methoddeciding whether any program terminates or not.

Non-idempotent typing operators P. Vial 1 Presentation 4 /46

Page 26: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Turing and computability

Entscheidung (1928): given a symbolic statement, is there an algorithmicprocedure to decide whether it is true or not?

Godel, 1931:∃ unprovable state-ments

Provable 6= True

primitive recursivefunctions (poor)

Can computationsave mathematics?

What is an algo. ?

What is effectivelycomputable?

Turing machines (1936)

TM are universal

f effectively computableiff f implementable in a TM

A prog. language L is Turing-completeif L has the same computational power as TMs.

Theorem (Turing, 1936)

The Entscheidungsproblem has a negative answer

The halting problem is undecidable: there does not exist a general methoddeciding whether any program terminates or not.

Non-idempotent typing operators P. Vial 1 Presentation 4 /46

Page 27: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Turing and computability

Entscheidung (1928): given a symbolic statement, is there an algorithmicprocedure to decide whether it is true or not?

Godel, 1931:∃ unprovable state-ments

Provable 6= True

primitive recursivefunctions (poor)

Can computationsave mathematics?

What is an algo. ?

What is effectivelycomputable?

Turing machines (1936)

TM are universal

f effectively computableiff f implementable in a TM

A prog. language L is Turing-completeif L has the same computational power as TMs.

Theorem (Turing, 1936)

The Entscheidungsproblem has a negative answer

The halting problem is undecidable: there does not exist a general methoddeciding whether any program terminates or not.

Non-idempotent typing operators P. Vial 1 Presentation 4 /46

Page 28: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Turing and computability

Entscheidung (1928): given a symbolic statement, is there an algorithmicprocedure to decide whether it is true or not?

Godel, 1931:∃ unprovable state-ments

Provable 6= True

primitive recursivefunctions (poor)

Can computationsave mathematics?

What is an algo. ?

What is effectivelycomputable?

Turing machines (1936)

TM are universal

f effectively computableiff f implementable in a TM

A prog. language L is Turing-completeif L has the same computational power as TMs.

Theorem (Turing, 1936)

The Entscheidungsproblem has a negative answer

The halting problem is undecidable: there does not exist a general methoddeciding whether any program terminates or not.

Non-idempotent typing operators P. Vial 1 Presentation 4 /46

Page 29: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Turing and computability

Entscheidung (1928): given a symbolic statement, is there an algorithmicprocedure to decide whether it is true or not?

Godel, 1931:∃ unprovable state-ments

Provable 6= True

primitive recursivefunctions (poor)

Can computationsave mathematics?

What is an algo. ?

What is effectivelycomputable?

Turing machines (1936)

TM are universal

f effectively computableiff f implementable in a TM

A prog. language L is Turing-completeif L has the same computational power as TMs.

Theorem (Turing, 1936)

The Entscheidungsproblem has a negative answer

The halting problem is undecidable: there does not exist a general methoddeciding whether any program terminates or not.

Non-idempotent typing operators P. Vial 1 Presentation 4 /46

Page 30: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Turing and computability

Entscheidung (1928): given a symbolic statement, is there an algorithmicprocedure to decide whether it is true or not?

Godel, 1931:∃ unprovable state-ments

Provable 6= True

primitive recursivefunctions (poor)

Can computationsave mathematics?

What is an algo. ?

What is effectivelycomputable?

Turing machines (1936)

TM are universal

f effectively computableiff f implementable in a TM

A prog. language L is Turing-completeif L has the same computational power as TMs.

Theorem (Turing, 1936)

The Entscheidungsproblem has a negative answer

The halting problem is undecidable: there does not exist a general methoddeciding whether any program terminates or not.

Non-idempotent typing operators P. Vial 1 Presentation 4 /46

Page 31: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Computation as rewriting

The λ-calculus

One primitive.

Functional paradigm.

Turing complete.

Allows to emulate many rewriting systems e.g.:

Example (implementing natural numbers)

O : zero S : successor

Thus: S O ' 1 S S O ' 2 S S S S S O ' 5.

Addition

n+ O→ n (terminal case) n + Sm→ Sn + m (inductive case)

S S S O + S S O → S S S S O + S O → S S S S S O + O → S S S S S O

3 + 2 → 4 + 1 → 5 + 0 → 5

Most structures (tabs, strings, pair of integers) can be implemented in thisfashion or in the λ-calculus.

Non-idempotent typing operators P. Vial 1 Presentation 5 /46

Page 32: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Computation as rewriting

The λ-calculus

One primitive.

Functional paradigm.

Turing complete.

Allows to emulate many rewriting systems e.g.:

Example (implementing natural numbers)

O : zero S : successor

Thus: S O ' 1 S S O ' 2 S S S S S O ' 5.

Addition

n+ O→ n (terminal case) n + Sm→ Sn + m (inductive case)

S S S O + S S O → S S S S O + S O → S S S S S O + O → S S S S S O

3 + 2 → 4 + 1 → 5 + 0 → 5

Most structures (tabs, strings, pair of integers) can be implemented in thisfashion or in the λ-calculus.

Non-idempotent typing operators P. Vial 1 Presentation 5 /46

Page 33: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Computation as rewriting

The λ-calculus

One primitive.

Functional paradigm.

Turing complete.

Allows to emulate many rewriting systems e.g.:

Example (implementing natural numbers)

O : zero S : successor

Thus: S O ' 1 S S O ' 2 S S S S S O ' 5.

Addition

n+ O→ n (terminal case) n + Sm→ Sn + m (inductive case)

S S S O + S S O → S S S S O + S O → S S S S S O + O → S S S S S O

3 + 2 → 4 + 1 → 5 + 0 → 5

Most structures (tabs, strings, pair of integers) can be implemented in thisfashion or in the λ-calculus.

Non-idempotent typing operators P. Vial 1 Presentation 5 /46

Page 34: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Computation as rewriting

The λ-calculus

One primitive.

Functional paradigm.

Turing complete.

Allows to emulate many rewriting systems e.g.:

Example (implementing natural numbers)

O : zero S : successor

Thus: S O ' 1 S S O ' 2 S S S S S O ' 5.

Addition

n+ O→ n (terminal case) n + Sm→ Sn + m (inductive case)

S S S O + S S O → S S S S O + S O → S S S S S O + O → S S S S S O

3 + 2 → 4 + 1 → 5 + 0 → 5

Most structures (tabs, strings, pair of integers) can be implemented in thisfashion or in the λ-calculus.

Non-idempotent typing operators P. Vial 1 Presentation 5 /46

Page 35: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Computation as rewriting

The λ-calculus

One primitive.

Functional paradigm.

Turing complete.

Allows to emulate many rewriting systems e.g.:

Example (implementing natural numbers)

O : zero S : successor

Thus: S O ' 1 S S O ' 2 S S S S S O ' 5.

Addition

n+ O→ n (terminal case) n + Sm→ Sn + m (inductive case)

S S S O + S S O → S S S S O + S O → S S S S S O + O → S S S S S O

3 + 2 → 4 + 1 → 5 + 0 → 5

Most structures (tabs, strings, pair of integers) can be implemented in thisfashion or in the λ-calculus.

Non-idempotent typing operators P. Vial 1 Presentation 5 /46

Page 36: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Computation as rewriting

The λ-calculus

One primitive.

Functional paradigm.

Turing complete.

Allows to emulate many rewriting systems e.g.:

Example (implementing natural numbers)

O : zero S : successor

Thus: S O ' 1 S S O ' 2 S S S S S O ' 5.

Addition

n+ O→ n (terminal case) n + Sm→ Sn + m (inductive case)

S S S O + S S O → S S S S O + S O → S S S S S O + O → S S S S S O

3 + 2 → 4 + 1 → 5 + 0 → 5

Most structures (tabs, strings, pair of integers) can be implemented in thisfashion or in the λ-calculus.

Non-idempotent typing operators P. Vial 1 Presentation 5 /46

Page 37: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Computation as rewriting

The λ-calculus

One primitive.

Functional paradigm.

Turing complete.

Allows to emulate many rewriting systems e.g.:

Example (implementing natural numbers)

O : zero S : successor

Thus: S O ' 1 S S O ' 2 S S S S S O ' 5.

Addition

n+ O→ n (terminal case) n + Sm→ Sn + m (inductive case)

S S S O + S S O → S S S S O + S O → S S S S S O + O → S S S S S O

3 + 2 → 4 + 1 → 5 + 0 → 5

Most structures (tabs, strings, pair of integers) can be implemented in thisfashion or in the λ-calculus.

Non-idempotent typing operators P. Vial 1 Presentation 5 /46

Page 38: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Computation as rewriting

The λ-calculus

One primitive.

Functional paradigm.

Turing complete.

Allows to emulate many rewriting systems e.g.:

Example (implementing natural numbers)

O : zero S : successor

Thus: S O ' 1 S S O ' 2 S S S S S O ' 5.

Addition

n+ O→ n (terminal case) n + Sm→ Sn + m (inductive case)

S S S O + S S O → S S S S O + S O → S S S S S O + O → S S S S S O

3 + 2 → 4 + 1 → 5 + 0 → 5

Most structures (tabs, strings, pair of integers) can be implemented in thisfashion or in the λ-calculus.

Non-idempotent typing operators P. Vial 1 Presentation 5 /46

Page 39: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Computation as rewriting

The λ-calculus

One primitive.

Functional paradigm.

Turing complete.

Allows to emulate many rewriting systems e.g.:

Example (implementing natural numbers)

O : zero S : successor

Thus: S O ' 1 S S O ' 2 S S S S S O ' 5.

Addition

n+ O→ n (terminal case) n + Sm→ Sn + m (inductive case)

S S S O + S S O → S S S S O + S O → S S S S S O + O → S S S S S O

3 + 2 → 4 + 1 → 5 + 0 → 5

Most structures (tabs, strings, pair of integers) can be implemented in thisfashion or in the λ-calculus.

Non-idempotent typing operators P. Vial 1 Presentation 5 /46

Page 40: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

λ-calcul (Church, 1928)

Term construction (inductive grammar)

x

x

Variable

λx

t

λx.t

Abstraction

@

t u

t u

Application

x

x y

@

λy

@

Example: x(λy.x y)

λx

@

r

x

x

x

s

Redex:(λx.r)sReduct:r[s/x]

Redex (reducible expression): computation via substitution

producing a reduct

Non-idempotent typing operators P. Vial 1 Presentation 6 /46

Page 41: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

λ-calcul (Church, 1928)

Term construction (inductive grammar)

x

x

Variable

λx

t

λx.t

Abstraction

@

t u

t u

Application

x

x y

@

λy

@

Example: x(λy.x y)

λx

@

r

x

x

x

s

Redex:(λx.r)sReduct:r[s/x]

Redex (reducible expression): computation via substitution

producing a reduct

Non-idempotent typing operators P. Vial 1 Presentation 6 /46

Page 42: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

λ-calcul (Church, 1928)

Term construction (inductive grammar)

x

x

Variable

λx

t

λx.t

Abstraction

@

t u

t u

Application

x

x y

@

λy

@

Example: x(λy.x y)

λx

@

r

x

x

x

s

Redex:(λx.r)sReduct:r[s/x]

Redex (reducible expression): computation via substitution

producing a reduct

Non-idempotent typing operators P. Vial 1 Presentation 6 /46

Page 43: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

λ-calcul (Church, 1928)

Term construction (inductive grammar)

x

x

Variable

λx

t

λx.t

Abstraction

@

t u

t u

Application

x

x y

@

λy

@

Example: x(λy.x y)

λx

@

r

x

x

x

s

Redex:(λx.r)s

Reduct:r[s/x]

Redex (reducible expression): computation via substitution

producing a reduct

Non-idempotent typing operators P. Vial 1 Presentation 6 /46

Page 44: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

λ-calcul (Church, 1928)

Term construction (inductive grammar)

x

x

Variable

λx

t

λx.t

Abstraction

@

t u

t u

Application

x

x y

@

λy

@

Example: x(λy.x y)

λx

@

rx

x

x

s

Redex:(λx.r)s

Reduct:r[s/x]

Redex (reducible expression): computation via substitution

producing a reduct

Non-idempotent typing operators P. Vial 1 Presentation 6 /46

Page 45: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

λ-calcul (Church, 1928)

Term construction (inductive grammar)

x

x

Variable

λx

t

λx.t

Abstraction

@

t u

t u

Application

x

x y

@

λy

@

Example: x(λy.x y)

λx

@

rx

x

x

s

Redex:(λx.r)sReduct:r[s/x]

Redex (reducible expression): computation via substitution

producing a reduct

Non-idempotent typing operators P. Vial 1 Presentation 6 /46

Page 46: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

λ-calcul (Church, 1928)

Term construction (inductive grammar)

x

x

Variable

λx

t

λx.t

Abstraction

@

t u

t u

Application

x

x y

@

λy

@

Example: x(λy.x y)

λx

@

r

x

x

x

s

ss

s

Redex:(λx.r)s

Reduct:r[s/x]

Redex (reducible expression): computation via substitution

producing a reduct

Non-idempotent typing operators P. Vial 1 Presentation 6 /46

Page 47: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Higher-order functions and their (possible) dangers

Let app2(f, x) := f(f(x)).app2 takes a function f as an argument.app2 is a higher-order function.

Autoapplication is defined by:

autoapp(f)→ f(f)

Auto-autoapplication:

autoapp(autoapp)→

autoapp(autoapp)→ autoapp(autoapp)→ autoapp(autoapp)→ . . . . . . . . . . . . . . . . . . . . .

Remember

Some programs that do not terminate are still meaningful: the streams.

Keep on producing terminated values.

Example: The program printing 2, 3, 5,7, 11, 13. . . (the list of primes).

Contribution:characterizing productive streams.

Non-idempotent typing operators P. Vial 1 Presentation 7 /46

Page 48: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Higher-order functions and their (possible) dangers

Let app2(f, x) := f(f(x)).app2 takes a function f as an argument.app2 is a higher-order function.

Autoapplication is defined by:

autoapp(f)→ f(f)

Auto-autoapplication:

autoapp(autoapp)→

autoapp(autoapp)→ autoapp(autoapp)→ autoapp(autoapp)→ . . . . . . . . . . . . . . . . . . . . .

Remember

Some programs that do not terminate are still meaningful: the streams.

Keep on producing terminated values.

Example: The program printing 2, 3, 5,7, 11, 13. . . (the list of primes).

Contribution:characterizing productive streams.

Non-idempotent typing operators P. Vial 1 Presentation 7 /46

Page 49: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Higher-order functions and their (possible) dangers

Let app2(f, x) := f(f(x)).app2 takes a function f as an argument.app2 is a higher-order function.

Autoapplication is defined by:

autoapp(f)→ f(f)

Auto-autoapplication:

autoapp(autoapp)→

autoapp(autoapp)→ autoapp(autoapp)→ autoapp(autoapp)→ . . . . . . . . . . . . . . . . . . . . .

Remember

Some programs that do not terminate are still meaningful: the streams.

Keep on producing terminated values.

Example: The program printing 2, 3, 5,7, 11, 13. . . (the list of primes).

Contribution:characterizing productive streams.

Non-idempotent typing operators P. Vial 1 Presentation 7 /46

Page 50: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Higher-order functions and their (possible) dangers

Let app2(f, x) := f(f(x)).app2 takes a function f as an argument.app2 is a higher-order function.

Autoapplication is defined by:

autoapp(f)→ f(f)

Auto-autoapplication:

autoapp(autoapp)→

autoapp(autoapp)→ autoapp(autoapp)→ autoapp(autoapp)→ . . . . . . . . . . . . . . . . . . . . .

Remember

Some programs that do not terminate are still meaningful: the streams.

Keep on producing terminated values.

Example: The program printing 2, 3, 5,7, 11, 13. . . (the list of primes).

Contribution:characterizing productive streams.

Non-idempotent typing operators P. Vial 1 Presentation 7 /46

Page 51: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Higher-order functions and their (possible) dangers

Let app2(f, x) := f(f(x)).app2 takes a function f as an argument.app2 is a higher-order function.

Autoapplication is defined by:

autoapp(f)→ f(f)

Auto-autoapplication:

autoapp(autoapp)→ autoapp(autoapp)

→ autoapp(autoapp)→ autoapp(autoapp)→ . . . . . . . . . . . . . . . . . . . . .

Remember

Some programs that do not terminate are still meaningful: the streams.

Keep on producing terminated values.

Example: The program printing 2, 3, 5,7, 11, 13. . . (the list of primes).

Contribution:characterizing productive streams.

Non-idempotent typing operators P. Vial 1 Presentation 7 /46

Page 52: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Higher-order functions and their (possible) dangers

Let app2(f, x) := f(f(x)).app2 takes a function f as an argument.app2 is a higher-order function.

Autoapplication is defined by:

autoapp(f)→ f(f)

Auto-autoapplication:

autoapp(autoapp)→ autoapp(autoapp)→ autoapp(autoapp)

→ autoapp(autoapp)→ . . . . . . . . . . . . . . . . . . . . .

Remember

Some programs that do not terminate are still meaningful: the streams.

Keep on producing terminated values.

Example: The program printing 2, 3, 5,7, 11, 13. . . (the list of primes).

Contribution:characterizing productive streams.

Non-idempotent typing operators P. Vial 1 Presentation 7 /46

Page 53: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Higher-order functions and their (possible) dangers

Let app2(f, x) := f(f(x)).app2 takes a function f as an argument.app2 is a higher-order function.

Autoapplication is defined by:

autoapp(f)→ f(f)

Auto-autoapplication:

autoapp(autoapp)→ autoapp(autoapp)→ autoapp(autoapp)→ autoapp(autoapp)

→ . . . . . . . . . . . . . . . . . . . . .

Remember

Some programs that do not terminate are still meaningful: the streams.

Keep on producing terminated values.

Example: The program printing 2, 3, 5,7, 11, 13. . . (the list of primes).

Contribution:characterizing productive streams.

Non-idempotent typing operators P. Vial 1 Presentation 7 /46

Page 54: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Higher-order functions and their (possible) dangers

Let app2(f, x) := f(f(x)).app2 takes a function f as an argument.app2 is a higher-order function.

Autoapplication is defined by:

autoapp(f)→ f(f)

Auto-autoapplication:

autoapp(autoapp)→ autoapp(autoapp)→ autoapp(autoapp)→ autoapp(autoapp)→ . . . . . . . . . . . . . . . . . . . . .

Remember

Some programs that do not terminate are still meaningful: the streams.

Keep on producing terminated values.

Example: The program printing 2, 3, 5,7, 11, 13. . . (the list of primes).

Contribution:characterizing productive streams.

Non-idempotent typing operators P. Vial 1 Presentation 7 /46

Page 55: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Higher-order functions and their (possible) dangers

Let app2(f, x) := f(f(x)).app2 takes a function f as an argument.app2 is a higher-order function.

Autoapplication is defined by:

autoapp(f)→ f(f)

Auto-autoapplication:

autoapp(autoapp)→ autoapp(autoapp)→ autoapp(autoapp)→ autoapp(autoapp)→ . . . . . . . . . . . . . . . . . . . . .

Remember

Some programs that do not terminate are still meaningful: the streams.

Keep on producing terminated values.

Example: The program printing 2, 3, 5,7, 11, 13. . . (the list of primes).

Contribution:characterizing productive streams.

Non-idempotent typing operators P. Vial 1 Presentation 7 /46

Page 56: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Higher-order functions and their (possible) dangers

Let app2(f, x) := f(f(x)).app2 takes a function f as an argument.app2 is a higher-order function.

Autoapplication is defined by:

autoapp(f)→ f(f)

Auto-autoapplication:

autoapp(autoapp)→ autoapp(autoapp)→ autoapp(autoapp)→ autoapp(autoapp)→ . . . . . . . . . . . . . . . . . . . . .

Remember

Some programs that do not terminate are still meaningful: the streams.

Keep on producing terminated values.

Example: The program printing 2, 3, 5,7, 11, 13. . . (the list of primes).

Contribution:characterizing productive streams.

Non-idempotent typing operators P. Vial 1 Presentation 7 /46

Page 57: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Terminal states and execution/reduction strategies

2 + 3× 5︸ ︷︷ ︸ −→ 2 + 15︸ ︷︷ ︸ −→ 17

Reducible (non-terminal)states

Terminal state

Let f(x) = x× x× x. What is the value of f(3 + 4)?

Kim (smart)

f(3 + 4) → f(7)→ 7× 7× 7→ 49× 7→ 343

Lee (not so)

f(3 + 4) → (3 + 4)× (3 + 4)× (3 + 4)→ 7× (3 + 4)× (3 + 4)→ 7× 7× (3 + 4)→ 7× 7× 7→ 49× 7→ 343

Thurston (don’t be Thurston)

f(3 + 4) → (3 + 4)× (3 + 4)× (3 + 4)→ 3× (3 + 4)× (3 + 4) + 4× (3 + 4)× (3 + 4)→ dozens of computation steps. . . . . . . . . . . . . . . . . . . . .→ 343

Non-idempotent typing operators P. Vial 1 Presentation 8 /46

Page 58: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Terminal states and execution/reduction strategies

2 + 3× 5︸ ︷︷ ︸ −→ 2 + 15︸ ︷︷ ︸ −→ 17

Reducible (non-terminal)states

Terminal state

Let f(x) = x× x× x. What is the value of f(3 + 4)?

Kim (smart)

f(3 + 4) → f(7)→ 7× 7× 7→ 49× 7→ 343

Lee (not so)

f(3 + 4) → (3 + 4)× (3 + 4)× (3 + 4)→ 7× (3 + 4)× (3 + 4)→ 7× 7× (3 + 4)→ 7× 7× 7→ 49× 7→ 343

Thurston (don’t be Thurston)

f(3 + 4) → (3 + 4)× (3 + 4)× (3 + 4)→ 3× (3 + 4)× (3 + 4) + 4× (3 + 4)× (3 + 4)→ dozens of computation steps. . . . . . . . . . . . . . . . . . . . .→ 343

Non-idempotent typing operators P. Vial 1 Presentation 8 /46

Page 59: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Terminal states and execution/reduction strategies

2 + 3× 5︸ ︷︷ ︸ −→ 2 + 15︸ ︷︷ ︸ −→ 17

Reducible (non-terminal)states

Terminal state

Let f(x) = x× x× x. What is the value of f(3 + 4)?

Kim (smart)

f(3 + 4) → f(7)→ 7× 7× 7→ 49× 7→ 343

Lee (not so)

f(3 + 4) → (3 + 4)× (3 + 4)× (3 + 4)→ 7× (3 + 4)× (3 + 4)→ 7× 7× (3 + 4)→ 7× 7× 7→ 49× 7→ 343

Thurston (don’t be Thurston)

f(3 + 4) → (3 + 4)× (3 + 4)× (3 + 4)→ 3× (3 + 4)× (3 + 4) + 4× (3 + 4)× (3 + 4)→ dozens of computation steps. . . . . . . . . . . . . . . . . . . . .→ 343

Non-idempotent typing operators P. Vial 1 Presentation 8 /46

Page 60: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Terminal states and execution/reduction strategies

2 + 3× 5︸ ︷︷ ︸ −→ 2 + 15︸ ︷︷ ︸ −→ 17

Reducible (non-terminal)states

Terminal state

Let f(x) = x× x× x. What is the value of f(3 + 4)?

Kim (smart)

f(3 + 4) → f(7)→ 7× 7× 7→ 49× 7→ 343

Lee (not so)

f(3 + 4) → (3 + 4)× (3 + 4)× (3 + 4)→ 7× (3 + 4)× (3 + 4)→ 7× 7× (3 + 4)→ 7× 7× 7→ 49× 7→ 343

Thurston (don’t be Thurston)

f(3 + 4) → (3 + 4)× (3 + 4)× (3 + 4)→ 3× (3 + 4)× (3 + 4) + 4× (3 + 4)× (3 + 4)→ dozens of computation steps. . . . . . . . . . . . . . . . . . . . .→ 343

Non-idempotent typing operators P. Vial 1 Presentation 8 /46

Page 61: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Terminal states and execution/reduction strategies

Non-idempotent typing operators P. Vial 1 Presentation 8 /46

Page 62: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Terminal states and execution/reduction strategies

Initial state Terminal state

Infinite path(keeps running,

never reaches the terminal state)

Reduction strategy

Choice of a reduction path.

Can be complete

Must be certified.

Non-idempotent typing operators P. Vial 1 Presentation 8 /46

Page 63: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Terminal states and execution/reduction strategies

Initial state Terminal state

Reduction strategy

Infinite path(keeps running,

never reaches the terminal state)

Reduction strategy

Choice of a reduction path.

Can be complete

Must be certified.

Non-idempotent typing operators P. Vial 1 Presentation 8 /46

Page 64: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Types

Principle

Types = data descriptors, following a grammar.

Types provide certifications of correction.

Primitive types:

5: int (integer) ”Leopard”: String (string of characters)

Compound types:

length : String→ int (function)

Example

Let toLetters : int→ String be the program:

toLetters(2) = ”two” toLetters(10) = ”ten”

toLetters(5) toLetters(”Leopard”)

Correct!Returns ”five”

Incorrect!The arg. ”Leopard” is not an int.

toLetters :

int→ String

5 :

int

toLetters(5) :

String

Typing certificate

A→ B A

B

Proof

This analogy goes further!

Curry-Howard correspondence!

Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Page 65: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Types

Principle

Types = data descriptors, following a grammar.

Types provide certifications of correction.

Primitive types:

5: int (integer) ”Leopard”: String (string of characters)

Compound types:

length : String→ int (function)

Example

Let toLetters : int→ String be the program:

toLetters(2) = ”two” toLetters(10) = ”ten”

toLetters(5) toLetters(”Leopard”)

Correct!Returns ”five”

Incorrect!The arg. ”Leopard” is not an int.

toLetters :

int→ String

5 :

int

toLetters(5) :

String

Typing certificate

A→ B A

B

Proof

This analogy goes further!

Curry-Howard correspondence!

Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Page 66: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Types

Principle

Types = data descriptors, following a grammar.

Types provide certifications of correction.

Primitive types:

5: int (integer) ”Leopard”: String (string of characters)

Compound types:

length : String→ int (function)

Example

Let toLetters : int→ String be the program:

toLetters(2) = ”two” toLetters(10) = ”ten”

toLetters(5) toLetters(”Leopard”)

Correct!Returns ”five”

Incorrect!The arg. ”Leopard” is not an int.

toLetters :

int→ String

5 :

int

toLetters(5) :

String

Typing certificate

A→ B A

B

Proof

This analogy goes further!

Curry-Howard correspondence!

Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Page 67: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Types

Principle

Types = data descriptors, following a grammar.

Types provide certifications of correction.

Primitive types:

5: int (integer) ”Leopard”: String (string of characters)

Compound types:

length : String→ int (function)

Example

Let toLetters : int→ String be the program:

toLetters(2) = ”two” toLetters(10) = ”ten”

toLetters(5) toLetters(”Leopard”)

Correct!Returns ”five”

Incorrect!The arg. ”Leopard” is not an int.

toLetters :

int→ String

5 :

int

toLetters(5) :

String

Typing certificate

A→ B A

B

Proof

This analogy goes further!

Curry-Howard correspondence!

Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Page 68: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Types

Principle

Types = data descriptors, following a grammar.

Types provide certifications of correction.

Primitive types:

5: int (integer) ”Leopard”: String (string of characters)

Compound types:

length : String→ int (function)

Example

Let toLetters : int→ String be the program:

toLetters(2) = ”two” toLetters(10) = ”ten”

toLetters(5) toLetters(”Leopard”)

Correct!Returns ”five”

Incorrect!The arg. ”Leopard” is not an int.

toLetters :

int→ String

5 :

int

toLetters(5) :

String

Typing certificate

A→ B A

B

Proof

This analogy goes further!

Curry-Howard correspondence!

Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Page 69: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Types

Principle

Types = data descriptors, following a grammar.

Types provide certifications of correction.

Primitive types:

5: int (integer) ”Leopard”: String (string of characters)

Compound types:

length : String→ int (function)

Example

Let toLetters : int→ String be the program:

toLetters(2) = ”two” toLetters(10) = ”ten”

toLetters(5) toLetters(”Leopard”)

Correct!Returns ”five”

Incorrect!The arg. ”Leopard” is not an int.

toLetters :

int→ String

5 :

int

toLetters(5) :

String

Typing certificate

A→ B A

B

Proof

This analogy goes further!

Curry-Howard correspondence!

Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Page 70: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Types

Principle

Types = data descriptors, following a grammar.

Types provide certifications of correction.

Primitive types:

5: int (integer) ”Leopard”: String (string of characters)

Compound types:

length : String→ int (function)

Example

Let toLetters : int→ String be the program:

toLetters(2) = ”two” toLetters(10) = ”ten”

toLetters(5) toLetters(”Leopard”)

Correct!Returns ”five”

Incorrect!The arg. ”Leopard” is not an int.

toLetters :

int→ String

5 :

int

toLetters(5) :

String

Typing certificate

A→ B A

B

Proof

This analogy goes further!

Curry-Howard correspondence!

Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Page 71: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Types

Principle

Types = data descriptors, following a grammar.

Types provide certifications of correction.

Primitive types:

5: int (integer) ”Leopard”: String (string of characters)

Compound types:

length : String→ int (function)

Example

Let toLetters : int→ String be the program:

toLetters(2) = ”two” toLetters(10) = ”ten”

toLetters(5) toLetters(”Leopard”)

Correct!Returns ”five”

Incorrect!The arg. ”Leopard” is not an int.

toLetters :

int→ String

5 :

int

toLetters(5) :

String

Typing certificate

A→ B A

B

Proof

This analogy goes further!

Curry-Howard correspondence!

Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Page 72: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Types

Principle

Types = data descriptors, following a grammar.

Types provide certifications of correction.

Primitive types:

5: int (integer) ”Leopard”: String (string of characters)

Compound types:

length : String→ int (function)

Example

Let toLetters : int→ String be the program:

toLetters(2) = ”two” toLetters(10) = ”ten”

toLetters(5) toLetters(”Leopard”)

Correct!Returns ”five”

Incorrect!The arg. ”Leopard” is not an int.

toLetters : int→ String 5 : int

toLetters(5) : String

Typing certificate

A→ B A

B

Proof

This analogy goes further!

Curry-Howard correspondence!

Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Page 73: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Types

Principle

Types = data descriptors, following a grammar.

Types provide certifications of correction.

Primitive types:

5: int (integer) ”Leopard”: String (string of characters)

Compound types:

length : String→ int (function)

Example

Let toLetters : int→ String be the program:

toLetters(2) = ”two” toLetters(10) = ”ten”

toLetters(5) toLetters(”Leopard”)

Correct!Returns ”five”

Incorrect!The arg. ”Leopard” is not an int.

toLetters : int→ String 5 : int

toLetters(5) : String

Typing certificate

A→ B A

B

Proof

This analogy goes further!

Curry-Howard correspondence!

Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Page 74: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Types

Principle

Types = data descriptors, following a grammar.

Types provide certifications of correction.

Primitive types:

5: int (integer) ”Leopard”: String (string of characters)

Compound types:

length : String→ int (function)

Example

Let toLetters : int→ String be the program:

toLetters(2) = ”two” toLetters(10) = ”ten”

toLetters(5) toLetters(”Leopard”)

Correct!Returns ”five”

Incorrect!The arg. ”Leopard” is not an int.

toLetters :

int→ String

5 :

int

toLetters(5) :

String

Typing certificate

A→ B A

B

Proof

This analogy goes further!

Curry-Howard correspondence!

Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Page 75: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Types

Principle

Types = data descriptors, following a grammar.

Types provide certifications of correction.

Primitive types:

5: int (integer) ”Leopard”: String (string of characters)

Compound types:

length : String→ int (function)

Example

Let toLetters : int→ String be the program:

toLetters(2) = ”two” toLetters(10) = ”ten”

toLetters(5) toLetters(”Leopard”)

Correct!Returns ”five”

Incorrect!The arg. ”Leopard” is not an int.

toLetters : int→ String 5 : int

toLetters(5) : String

Typing certificate

A→ B A

B

Proof

This analogy goes further!

Curry-Howard correspondence!

Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Page 76: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Types

Principle

Types = data descriptors, following a grammar.

Types provide certifications of correction.

Primitive types:

5: int (integer) ”Leopard”: String (string of characters)

Compound types:

length : String→ int (function)

Example

Let toLetters : int→ String be the program:

toLetters(2) = ”two” toLetters(10) = ”ten”

toLetters(5) toLetters(”Leopard”)

Correct!Returns ”five”

Incorrect!The arg. ”Leopard” is not an int.

toLetters :

int→ String

5 :

int

toLetters(5) :

String

Typing certificate

A→ B A

B

Proof

This analogy goes further!

Curry-Howard correspondence!

Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Page 77: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Curry-Howard (50s)

Programming languages Logic

Type Formula

Simply Typed Program Proof

Reduction Step Cut-Elimination Step

Termination Termination

toLetters : int→ String 5 : int

toLetters(5) : String

A→ B A

B

Simple types λ-calculus

Does not captureclassical logicHarness higher-order comput. in

a limited way.

Many progs. in terminal statenot typable.

Polymorphic Types

Intersection Types

extensions

Intersection Types

Get classical logic withcall−cc (Griffin, 90)

Contribution

Non-idempotent typing operators P. Vial 1 Presentation 10 /46

Page 78: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Curry-Howard (50s)

Programming languages Logic

Type Formula

Simply Typed Program Proof

Reduction Step Cut-Elimination Step

Termination Termination

toLetters : int→ String 5 : int

toLetters(5) : String

A→ B A

B

Simple types

λ-calculus

Does not captureclassical logicHarness higher-order comput. in

a limited way.

Many progs. in terminal statenot typable.

Polymorphic Types

Intersection Types

extensions

Intersection Types

Get classical logic withcall−cc (Griffin, 90)

Contribution

Non-idempotent typing operators P. Vial 1 Presentation 10 /46

Page 79: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Curry-Howard (50s)

Programming languages Logic

Type Formula

Simply Typed Program Proof

Reduction Step Cut-Elimination Step

Termination Termination

toLetters : int→ String 5 : int

toLetters(5) : String

A→ B A

B

Simple types

λ-calculus

Does not captureclassical logic

Harness higher-order comput. ina limited way.

Many progs. in terminal statenot typable.

Polymorphic Types

Intersection Types

extensions

Intersection Types

Get classical logic withcall−cc (Griffin, 90)

Contribution

Non-idempotent typing operators P. Vial 1 Presentation 10 /46

Page 80: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Curry-Howard (50s)

Programming languages Logic

Type Formula

Simply Typed Program Proof

Reduction Step Cut-Elimination Step

Termination Termination

toLetters : int→ String 5 : int

toLetters(5) : String

A→ B A

B

Simple types

λ-calculus

Does not captureclassical logic

Harness higher-order comput. ina limited way.

Many progs. in terminal statenot typable.

Polymorphic Types Intersection Types

extensions

Intersection Types

Get classical logic withcall−cc (Griffin, 90)

Contribution

Non-idempotent typing operators P. Vial 1 Presentation 10 /46

Page 81: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Curry-Howard (50s)

Programming languages Logic

Type Formula

Simply Typed Program Proof

Reduction Step Cut-Elimination Step

Termination Termination

toLetters : int→ String 5 : int

toLetters(5) : String

A→ B A

B

Simple types

λ-calculus

Does not captureclassical logic

Harness higher-order comput. ina limited way.

Many progs. in terminal statenot typable.

Polymorphic Types

Intersection Types

extensions

Intersection Types

Get classical logic withcall−cc (Griffin, 90)

Contribution

Non-idempotent typing operators P. Vial 1 Presentation 10 /46

Page 82: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Curry-Howard (50s)

Programming languages Logic

Type Formula

Simply Typed Program Proof

Reduction Step Cut-Elimination Step

Termination Termination

toLetters : int→ String 5 : int

toLetters(5) : String

A→ B A

B

Simple types λ-calculus

Does not captureclassical logic

Harness higher-order comput. ina limited way.

Many progs. in terminal statenot typable.

Polymorphic Types

Intersection Types

extensions

Intersection Types

Get classical logic withcall−cc (Griffin, 90)

Contribution

Non-idempotent typing operators P. Vial 1 Presentation 10 /46

Page 83: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Curry-Howard (50s)

Programming languages Logic

Type Formula

Simply Typed Program Proof

Reduction Step Cut-Elimination Step

Termination Termination

toLetters : int→ String 5 : int

toLetters(5) : String

A→ B A

B

Simple types λ-calculus

Does not captureclassical logicHarness higher-order comput. in

a limited way.

Many progs. in terminal statenot typable.

Polymorphic Types

Intersection Types

extensions

Intersection Types

Get classical logic withcall−cc (Griffin, 90)

Contribution

Non-idempotent typing operators P. Vial 1 Presentation 10 /46

Page 84: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Curry-Howard (50s)

Programming languages Logic

Type Formula

Simply Typed Program Proof

Reduction Step Cut-Elimination Step

Termination Termination

toLetters : int→ String 5 : int

toLetters(5) : String

A→ B A

B

Simple types λ-calculus

Does not captureclassical logicHarness higher-order comput. in

a limited way.

Many progs. in terminal statenot typable.

Polymorphic Types

Intersection Types

extensions

Intersection Types

Get classical logic withcall−cc (Griffin, 90)

Contribution

Non-idempotent typing operators P. Vial 1 Presentation 10 /46

Page 85: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Curry-Howard (50s)

Programming languages Logic

Type Formula

Simply Typed Program Proof

Reduction Step Cut-Elimination Step

Termination Termination

toLetters : int→ String 5 : int

toLetters(5) : String

A→ B A

B

Simple types λ-calculus

Does not captureclassical logicHarness higher-order comput. in

a limited way.

Many progs. in terminal statenot typable.

Polymorphic Types

Intersection Types

extensions

Intersection Types

Get classical logic withcall−cc (Griffin, 90)

Contribution

Non-idempotent typing operators P. Vial 1 Presentation 10 /46

Page 86: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Cut-Elimination (animation)

Goal: having a one-block proof

Theorem (Gentzen, 1936, Prawitz, 1965)

The cut-elimination procedure terminates (and tells us a lot of things).

ψ

A

A•

A•

Φ

B

Initial proof of F (using two lemmas)

A•

A•

A•A

B•

B•

B•

Π

F

Φψ

ψ

B

ψ

ψ

ψψ

B•

B•

B•

Π

F

After one cut-elim. step (one lemma)

ψ

ψ

ψ ψ

Φψ

ψ

Φψ

ψΦ

ψ

ψ

Π

F

Number of occurrences:

ψ : 1Φ : 1Π : 1

Non-idempotent typing operators P. Vial 1 Presentation 11 /46

Page 87: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Cut-Elimination (animation)

Goal: having a one-block proof

Theorem (Gentzen, 1936, Prawitz, 1965)

The cut-elimination procedure terminates (and tells us a lot of things).

ψ

A

A•

A•

Φ

B

Initial proof of F (using two lemmas)

A•

A•

A•A

B•

B•

B•

Π

F

Φψ

ψ

B

ψ

ψ

ψψ

B•

B•

B•

Π

F

After one cut-elim. step (one lemma)

ψ

ψ

ψ ψ

Φψ

ψ

Φψ

ψΦ

ψ

ψ

Π

F

Number of occurrences:

ψ : 6Φ : 1Π : 1

Non-idempotent typing operators P. Vial 1 Presentation 11 /46

Page 88: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Cut-Elimination (animation)

Goal: having a one-block proof

Theorem (Gentzen, 1936, Prawitz, 1965)

The cut-elimination procedure terminates (and tells us a lot of things).

ψ

A

A•

A•

Φ

B

Initial proof of F (using two lemmas)

A•

A•

A•A

B•

B•

B•

Π

F

Φψ

ψ

B

ψ

ψ

ψψ

B•

B•

B•

Π

F

After one cut-elim. step (one lemma)

ψ

ψ

ψ ψ

Φψ

ψ

Φψ

ψΦ

ψ

ψ

Π

F

Number of occurrences:

ψ : 10Φ : 3Π : 1

Non-idempotent typing operators P. Vial 1 Presentation 11 /46

Page 89: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Cut-Elimination (animation)

Goal: having a one-block proofTheorem (Gentzen, 1936, Prawitz, 1965)

The cut-elimination procedure terminates (and tells us a lot of things).

ψ

A

A•

A•

Φ

B

Initial proof of F (using two lemmas)

A•

A•

A•A

B•

B•

B•

Π

F

Φψ

ψ

B

ψ

ψ

ψψ

B•

B•

B•

Π

F

After one cut-elim. step (one lemma)

ψ

ψ

ψ ψ

Φψ

ψ

Φψ

ψΦ

ψ

ψ

Π

F

After two cut-elim. steps

Number of occurrences:

ψ : 10Φ : 3Π : 1

Non-idempotent typing operators P. Vial 1 Presentation 11 /46

Page 90: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Cut-Elimination (animation)

Goal: having a one-block proof

Theorem (Gentzen, 1936, Prawitz, 1965)

The cut-elimination procedure terminates (and tells us a lot of things).

ψ

A

A•

A•

Φ

B

Initial proof of F (using two lemmas)

A•

A•

A•A

B•

B•

B•

Π

F

Φψ

ψ

B

ψ

ψ

ψψ

B•

B•

B•

Π

F

After one cut-elim. step (one lemma)

ψ

ψ

ψ ψ

Φψ

ψ

Φψ

ψΦ

ψ

ψ

Π

F

Number of occurrences:

ψ : 10Φ : 3Π : 1

Non-idempotent typing operators P. Vial 1 Presentation 11 /46

Page 91: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Intersections types (Coppo, Dezani, 1980)

Goal

Equivalences of the form

“the program t is typable iff it can reach a terminal state”

Idea: several certificates to a same subprogram.

Proof: by the “circular” implications:

Some reduction strategyterminates on t

t can reach aterminal state

t is typable

Intersection types

Perhaps too expressive. . .

. . . but certify reduction strategies!

Non-idempotent typing operators P. Vial 1 Presentation 12 /46

Page 92: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Intersections types (Coppo, Dezani, 1980)

Goal

Equivalences of the form

“the program t is typable iff it can reach a terminal state”

Idea: several certificates to a same subprogram.

Proof: by the “circular” implications:

Some reduction strategyterminates on t

t can reach aterminal state

t is typable

Intersection types

Perhaps too expressive. . .

. . . but certify reduction strategies!

Non-idempotent typing operators P. Vial 1 Presentation 12 /46

Page 93: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Intersections types (Coppo, Dezani, 1980)

Goal

Equivalences of the form

“the program t is typable iff it can reach a terminal state”

Idea: several certificates to a same subprogram.

Proof: by the “circular” implications:

Some reduction strategyterminates on t

t can reach aterminal state

t is typable

Intersection types

Perhaps too expressive. . .

. . . but certify reduction strategies!

Non-idempotent typing operators P. Vial 1 Presentation 12 /46

Page 94: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Non-idempotency

Computation causes duplication.

Non-idempotent intersection types

Disallow duplication for typing certificates.

Possibly many certificates for a subprogram.

Size of certificates decreases.

Initialcertificate

Initial stateof the prog.

STOP(cannot be

reduced more)

Terminalstate reached!!

Execution

Comparative (dis)advantages

Insanely difficult to type a particular program.

Whole type system easier to study!Easier proofs of termination!

Easier proofs of characterization!

Easier to certify a reduction strategy!

Non-idempotent typing operators P. Vial 1 Presentation 13 /46

Page 95: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Non-idempotency

Computation causes duplication.

Non-idempotent intersection types

Disallow duplication for typing certificates.

Possibly many certificates for a subprogram.

Size of certificates decreases.

Initialcertificate

Initial stateof the prog.

STOP(cannot be

reduced more)

Terminalstate reached!!

Execution

Comparative (dis)advantages

Insanely difficult to type a particular program.

Whole type system easier to study!Easier proofs of termination!

Easier proofs of characterization!

Easier to certify a reduction strategy!

Non-idempotent typing operators P. Vial 1 Presentation 13 /46

Page 96: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Non-idempotency

Computation causes duplication.

Non-idempotent intersection types

Disallow duplication for typing certificates.

Possibly many certificates for a subprogram.

Size of certificates decreases.

Initialcertificate

Initial stateof the prog.

STOP(cannot be

reduced more)

Terminalstate reached!!

Execution

Comparative (dis)advantages

Insanely difficult to type a particular program.

Whole type system easier to study!Easier proofs of termination!

Easier proofs of characterization!

Easier to certify a reduction strategy!

Non-idempotent typing operators P. Vial 1 Presentation 13 /46

Page 97: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Non-idempotency

Computation causes duplication.

Non-idempotent intersection types

Disallow duplication for typing certificates.

Possibly many certificates for a subprogram.

Size of certificates decreases.

Initialcertificate

Initial stateof the prog.

STOP(cannot be

reduced more)

Terminalstate reached!!

Execution

Comparative (dis)advantages

Insanely difficult to type a particular program.

Whole type system easier to study!Easier proofs of termination!

Easier proofs of characterization!

Easier to certify a reduction strategy!

Non-idempotent typing operators P. Vial 1 Presentation 13 /46

Page 98: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Non-idempotency

Computation causes duplication.

Non-idempotent intersection types

Disallow duplication for typing certificates.

Possibly many certificates for a subprogram.

Size of certificates decreases.

Initialcertificate

Initial stateof the prog.

STOP(cannot be

reduced more)

Terminalstate reached!!

Execution

Comparative (dis)advantages

Insanely difficult to type a particular program.

Whole type system easier to study!Easier proofs of termination!

Easier proofs of characterization!

Easier to certify a reduction strategy!

Non-idempotent typing operators P. Vial 1 Presentation 13 /46

Page 99: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Non-idempotency

Computation causes duplication.

Non-idempotent intersection types

Disallow duplication for typing certificates.

Possibly many certificates for a subprogram.

Size of certificates decreases.

Initialcertificate

Initial stateof the prog.

STOP(cannot be

reduced more)

Terminalstate reached!!

Execution

Comparative (dis)advantages

Insanely difficult to type a particular program.

Whole type system easier to study!Easier proofs of termination!

Easier proofs of characterization!

Easier to certify a reduction strategy!

Non-idempotent typing operators P. Vial 1 Presentation 13 /46

Page 100: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Non-idempotency

Computation causes duplication.

Non-idempotent intersection types

Disallow duplication for typing certificates.

Possibly many certificates for a subprogram.

Size of certificates decreases.

Initialcertificate

Initial stateof the prog.

STOP(cannot be

reduced more)

Terminalstate reached!!

Execution

Comparative (dis)advantages

Insanely difficult to type a particular program.

Whole type system easier to study!Easier proofs of termination!

Easier proofs of characterization!

Easier to certify a reduction strategy!

Non-idempotent typing operators P. Vial 1 Presentation 13 /46

Page 101: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Non-idempotency

Computation causes duplication.

Non-idempotent intersection types

Disallow duplication for typing certificates.

Possibly many certificates for a subprogram.

Size of certificates decreases.

Initialcertificate

Initial stateof the prog.

STOP(cannot be

reduced more)

Terminalstate reached!!

Execution

Comparative (dis)advantages

Insanely difficult to type a particular program.

Whole type system easier to study!Easier proofs of termination!

Easier proofs of characterization!

Easier to certify a reduction strategy!

Non-idempotent typing operators P. Vial 1 Presentation 13 /46

Page 102: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Non-idempotency

Computation causes duplication.

Non-idempotent intersection types

Disallow duplication for typing certificates.

Possibly many certificates for a subprogram.

Size of certificates decreases.

Initialcertificate

Initial stateof the prog.

STOP(cannot be

reduced more)

Terminalstate reached!!

Execution

Comparative (dis)advantages

Insanely difficult to type a particular program.

Whole type system easier to study!Easier proofs of termination!

Easier proofs of characterization!

Easier to certify a reduction strategy!

Non-idempotent typing operators P. Vial 1 Presentation 13 /46

Page 103: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Non-idempotency

Computation causes duplication.

Non-idempotent intersection types

Disallow duplication for typing certificates.

Possibly many certificates for a subprogram.

Size of certificates decreases.

Initialcertificate

Initial stateof the prog.

STOP(cannot be

reduced more)

Terminalstate reached!!

Execution

Comparative (dis)advantages

Insanely difficult to type a particular program.

Whole type system easier to study!Easier proofs of termination!

Easier proofs of characterization!

Easier to certify a reduction strategy!

Non-idempotent typing operators P. Vial 1 Presentation 13 /46

Page 104: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Contents

Gardner/de Caravalho’s non-idempotent type system.

Contribution 1:

Quantitative types for the λµ-calculus (a classical calculus)

Certificates of reduction strategies.

Contribution 2:

Positive answer to Klop’s Problem.

Certification of an infinitary reduction strategy. Introduction of anew type system: system S (standing for sequences).

Contribution 3:

Around the expressive power of unconstrained infinitaryintersection types.

Non-idempotent typing operators P. Vial 1 Presentation 14 /46

Page 105: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Plan

1 Presentation

2 Non-idempotent intersection types

3 Resources for Classical Logic

4 Infinite types and productive reduction

5 Infinite types and unproductive reduction

6 Conclusion

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 15 /46

Page 106: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Head Normalization (λ)

x

head variable

t1

@ tq

@

λxp

Head Normal Form

r

λxs

@

head redex

t1

@ tq

@

λxp

Head Reducible Term

the head reduction strategyterminates on t

t is HN(∃path from t to a HNF)

obvious

true but not obvious

Intersection types come to help!

t is head normalizing (HN) if ∃ reduction path from t to a HNF.

The head reduction strategy: reducing head redexes while it is possible.

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 16 /46

Page 107: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Head Normalization (λ)

x

head variable

t1

@ tq

@

λxp

Head Normal Form

r

λxs

@

head redex

t1

@ tq

@

λxp

Head Reducible Term

the head reduction strategyterminates on t

t is HN(∃path from t to a HNF)

obvious

true but not obvious

Intersection types come to help!

t is head normalizing (HN) if ∃ reduction path from t to a HNF.

The head reduction strategy: reducing head redexes while it is possible.

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 16 /46

Page 108: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Head Normalization (λ)

x

head variable

t1

@ tq

@

λxp

Head Normal Form

r

λxs

@

head redex

t1

@ tq

@

λxp

Head Reducible Term

the head reduction strategyterminates on t

t is HN(∃path from t to a HNF)

obvious

true but not obvious

Intersection types come to help!

t is head normalizing (HN) if ∃ reduction path from t to a HNF.

The head reduction strategy: reducing head redexes while it is possible.

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 16 /46

Page 109: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Head Normalization (λ)

x

head variable

t1

@ tq

@

λxp

Head Normal Form

r

λxs

@

head redex

t1

@ tq

@

λxp

Head Reducible Term

the head reduction strategyterminates on t

t is HN(∃path from t to a HNF)

obvious

true but not obvious

Intersection types come to help!

t is head normalizing (HN) if ∃ reduction path from t to a HNF.

The head reduction strategy: reducing head redexes while it is possible.

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 16 /46

Page 110: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Head Normalization (λ)

x

head variable

t1

@ tq

@

λxp

Head Normal Form

r

λxs

@

head redex

t1

@ tq

@

λxp

Head Reducible Term

the head reduction strategyterminates on t

t is HN(∃path from t to a HNF)

obvious

true but not obvious

Intersection types come to help!

t is head normalizing (HN) if ∃ reduction path from t to a HNF.

The head reduction strategy: reducing head redexes while it is possible.

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 16 /46

Page 111: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Head Normalization (λ)

x

head variable

t1

@ tq

@

λxp

Head Normal Form

r

λxs

@

head redex

t1

@ tq

@

λxp

Head Reducible Term

the head reduction strategyterminates on t

t is HN(∃path from t to a HNF)

obvious

true but not obvious

Intersection types come to help!

t is head normalizing (HN) if ∃ reduction path from t to a HNF.

The head reduction strategy: reducing head redexes while it is possible.

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 16 /46

Page 112: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Head Normalization (λ)

x

head variable

t1

@ tq

@

λxp

Head Normal Form

r

λxs

@

head redex

t1

@ tq

@

λxp

Head Reducible Term

the head reduction strategyterminates on t

t is HN(∃path from t to a HNF)

obvious

true but not obvious

Intersection types come to help!

t is head normalizing (HN) if ∃ reduction path from t to a HNF.

The head reduction strategy: reducing head redexes while it is possible.

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 16 /46

Page 113: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

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

Some reduction strategyterminates on t

t can reach aterminal state

t is typabletyping theterm. states

+ SE SR + extra arg.

obvious

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 17 /46

Page 114: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

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

Some reduction strategyterminates on t

t can reach aterminal state

t is typabletyping theterm. states

+ SE SR + extra arg.

obvious

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 17 /46

Page 115: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

From Intersection Types to Quantitative Types

Types are built by means of base types, arrow (→) and intersection (∧).

ACI Axioms =

Associativity (A ∧D) ∧ C ∼ A ∧ (D ∧ C)Commutativity A ∧D ∼ D ∧AIdempotence A ∧A ∼ A

Traditional Intersection Types Quantitative TypesCoppo & Dezani 80 Gardner 94 - Kfoury 96

ACI (Idempotent) AC (Non-idempotent)

Types are sets: A ∧A ∧ C is A,C Types are multisets: A ∧A ∧ C is [A,A,C]

Qualitative properties Quantitative properties

Remark (non-idem. case):

[A,A,C] 6= [A,C] i.e. A ∧A ∧ C A ∧ C .

[A,B] + [A] = [A,A,B] i.e. ∧ is multiset sum.

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 18 /46

Page 116: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

From Intersection Types to Quantitative Types

Types are built by means of base types, arrow (→) and intersection (∧).

ACI Axioms =

Associativity (A ∧D) ∧ C ∼ A ∧ (D ∧ C)Commutativity A ∧D ∼ D ∧AIdempotence A ∧A ∼ A

Traditional Intersection Types Quantitative TypesCoppo & Dezani 80 Gardner 94 - Kfoury 96

ACI (Idempotent) AC (Non-idempotent)

Types are sets: A ∧A ∧ C is A,C Types are multisets: A ∧A ∧ C is [A,A,C]

Qualitative properties Quantitative properties

Remark (non-idem. case):

[A,A,C] 6= [A,C] i.e. A ∧A ∧ C A ∧ C .

[A,B] + [A] = [A,A,B] i.e. ∧ is multiset sum.

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 18 /46

Page 117: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Types and Rules (System R0)

(Strict Types) τ, σ := o ∈ O | I → τ(Intersection Types) I := [σi]i∈I

Strict types syntax directed rules:

x : [τ ] ` x : τax

Γ;x : [σi]i∈I ` t : τ

Γ ` λx.t : [σi]i∈I → τabs

Γ ` t : [σi]i∈I → τ (Γi ` u : σi)i∈I

Γ +i∈I Γi ` t u : τapp

System R0

Remark

Relevant system (no weakening)

In app-rule, pointwise multiset sum e.g.,

(x : [σ]; y : [τ ]) + (x : [σ, τ ]) = x : [σ, σ, τ ]; y : [τ ]

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 19 /46

Page 118: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Properties (R0)

Weighted Subject ReductionReduction preserves types and environments, and. . .. . . head reduction strictly decreases the nodes of the deriv. tree.

Subject ExpansionAnti-reduction preserves types and environments.

Theorem (de Carvalho)

Let t be a λ-term. Then equivalence between:

1 t is typable (in R0)

2 t is HN

3 the head reduction strategy terminates on t ( certification!)

Bonus (quantitative information)

If Π types t, then sizeΠ bounds the number of steps of the head. red. strategy on t.

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 20 /46

Page 119: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Head vs Weak and Strong Normalization

Let t be a λ-term.

Head normalization (HN): there is a path from t to a head normal form.

Weak normalization (WN): there is at least one path from t to normalform (NF).

Strong normalization (SN): there is no infinite path starting at t.

Normalization

SN ⇒ WN ⇒ HN.

Nota Bene: yΩ HNF but not WN (λx.y)Ω WN but not SN

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 21 /46

Page 120: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Head vs Weak and Strong Normalization

Let t be a λ-term.

Head normalization (HN): there is a path from t to a head normal form.

Weak normalization (WN): there is at least one path from t to normalform (NF).

Strong normalization (SN): there is no infinite path starting at t.

Normalization

SN ⇒ WN ⇒ HN.

Nota Bene: yΩ HNF but not WN (λx.y)Ω WN but not SN

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 21 /46

Page 121: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Head vs Weak and Strong Normalization

Let t be a λ-term.

Head normalization (HN): there is a path from t to a head normal form.

Weak normalization (WN): there is at least one path from t to normalform (NF).

Strong normalization (SN): there is no infinite path starting at t.

Normalization

SN ⇒ WN ⇒ HN.

Nota Bene: yΩ HNF but not WN (λx.y)Ω WN but not SN

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 21 /46

Page 122: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Head vs Weak and Strong Normalization

Let t be a λ-term.

Head normalization (HN): there is a path from t to a head normal form.

Weak normalization (WN): there is at least one path from t to normalform (NF).

Strong normalization (SN): there is no infinite path starting at t.

Normalization

SN ⇒ WN ⇒ HN.

Nota Bene: yΩ HNF but not WN (λx.y)Ω WN but not SN

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 21 /46

Page 123: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Characterizing Weak and Strong Normalization

any arg. can be left untyped

non-erasable args must be typed

all args must be typed

HN System R0 sz(Π) bounds the number ofhead reduction steps

WN System R0

+ unforgetfulness criterionsz(Π) bounds the numberof leftmost-outermost red.steps (and more)

SN Modify system R0

with choice operatorsz(Π) bounds the length ofany reduction path

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 22 /46

Page 124: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Subject reduction and expansion in R0

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

axx : [σ1] ` x :σ1

axx : [σ1] ` x :σ1∆a

1 `s :σ1

Πa1

∆a1 `s :σ1

Πa1

∆b1`s :σ1

Πb1

Non-determinism of SR

axx : [σ2] ` x :σ2

axx : [σ2] ` x :σ2∆2`s :σ2

Π2

axx : [σ1] ` x :σ1

axx : [σ1] ` x :σ1∆b

1`s :σ1

Πb1

∆b1`s :σ1

Πb1

∆a1 `s :σ1

Πa1

Γ; x : [σ1, σ2, σ1] ` r : τabs

Γ ` λx.r : [σ1, σ2, σ1]→ τapp

Γ + ∆a1 + ∆b

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

∆a1 `s :σ1

Πa1

∆2`s :σ2

Π2

∆b1`s :σ1

Πb1

Γ + ∆a1 + ∆b

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

By relevance and non-idempotence !

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 23 /46

Page 125: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Subject reduction and expansion in R0

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

axx : [σ1] ` x :σ1

axx : [σ1] ` x :σ1∆a

1 `s :σ1

Πa1

∆a1 `s :σ1

Πa1

∆b1`s :σ1

Πb1

Non-determinism of SR

axx : [σ2] ` x :σ2

axx : [σ2] ` x :σ2∆2`s :σ2

Π2

axx : [σ1] ` x :σ1

axx : [σ1] ` x :σ1∆b

1`s :σ1

Πb1

∆b1`s :σ1

Πb1

∆a1 `s :σ1

Πa1

Γ; x : [σ1, σ2, σ1] ` r : τabs

Γ ` λx.r : [σ1, σ2, σ1]→ τapp

Γ + ∆a1 + ∆b

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

∆a1 `s :σ1

Πa1

∆2`s :σ2

Π2

∆b1`s :σ1

Πb1

Γ + ∆a1 + ∆b

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

By relevance and non-idempotence !

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 23 /46

Page 126: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Subject reduction and expansion in R0

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

axx : [σ1] ` x :σ1

axx : [σ1] ` x :σ1∆a

1 `s :σ1

Πa1

∆a1 `s :σ1

Πa1

∆b1`s :σ1

Πb1

Non-determinism of SR

axx : [σ2] ` x :σ2

axx : [σ2] ` x :σ2∆2`s :σ2

Π2

axx : [σ1] ` x :σ1

axx : [σ1] ` x :σ1∆b

1`s :σ1

Πb1

∆b1`s :σ1

Πb1

∆a1 `s :σ1

Πa1

Γ; x : [σ1, σ2, σ1] ` r : τabs

Γ ` λx.r : [σ1, σ2, σ1]→ τapp

Γ + ∆a1 + ∆b

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

∆a1 `s :σ1

Πa1

∆2`s :σ2

Π2

∆b1`s :σ1

Πb1

Γ + ∆a1 + ∆b

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

By relevance and non-idempotence !

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 23 /46

Page 127: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Subject reduction and expansion in R0

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

axx : [σ1] ` x :σ1

axx : [σ1] ` x :σ1∆a

1 `s :σ1

Πa1

∆a1 `s :σ1

Πa1

∆b1`s :σ1

Πb1

Non-determinism of SR

axx : [σ2] ` x :σ2

axx : [σ2] ` x :σ2∆2`s :σ2

Π2

axx : [σ1] ` x :σ1

axx : [σ1] ` x :σ1∆b

1`s :σ1

Πb1

∆b1`s :σ1

Πb1

∆a1 `s :σ1

Πa1

Γ; x : [σ1, σ2, σ1] ` r : τabs

Γ ` λx.r : [σ1, σ2, σ1]→ τapp

Γ + ∆a1 + ∆b

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

∆a1 `s :σ1

Πa1

∆2`s :σ2

Π2

∆b1`s :σ1

Πb1

Γ + ∆a1 + ∆b

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

By relevance and non-idempotence !

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 23 /46

Page 128: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Subject reduction and expansion in R0

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

axx : [σ1] ` x :σ1

axx : [σ1] ` x :σ1

∆a1 `s :σ1

Πa1

∆a1 `s :σ1

Πa1

∆b1`s :σ1

Πb1

Non-determinism of SR

axx : [σ2] ` x :σ2

axx : [σ2] ` x :σ2

∆2`s :σ2

Π2

axx : [σ1] ` x :σ1

axx : [σ1] ` x :σ1

∆b1`s :σ1

Πb1

∆b1`s :σ1

Πb1

∆a1 `s :σ1

Πa1

Γ; x : [σ1, σ2, σ1] ` r : τabs

Γ ` λx.r : [σ1, σ2, σ1]→ τapp

Γ + ∆a1 + ∆b

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

∆a1 `s :σ1

Πa1

∆2`s :σ2

Π2

∆b1`s :σ1

Πb1

Γ + ∆a1 + ∆b

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

By relevance and non-idempotence !

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 23 /46

Page 129: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Subject reduction and expansion in R0

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

axx : [σ1] ` x :σ1

axx : [σ1] ` x :σ1∆a

1 `s :σ1

Πa1

∆a1 `s :σ1

Πa1

∆b1`s :σ1

Πb1

Non-determinism of SR

axx : [σ2] ` x :σ2

axx : [σ2] ` x :σ2∆2`s :σ2

Π2

axx : [σ1] ` x :σ1

axx : [σ1] ` x :σ1∆b

1`s :σ1

Πb1

∆b1`s :σ1

Πb1

∆a1 `s :σ1

Πa1

Γ; x : [σ1, σ2, σ1] ` r : τabs

Γ ` λx.r : [σ1, σ2, σ1]→ τapp

Γ + ∆a1 + ∆b

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

∆a1 `s :σ1

Πa1

∆2`s :σ2

Π2

∆b1`s :σ1

Πb1

Γ + ∆a1 + ∆b

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

By relevance and non-idempotence !

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 23 /46

Page 130: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Subject reduction and expansion in R0

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

axx : [σ1] ` x :σ1

axx : [σ1] ` x :σ1∆a

1 `s :σ1

Πa1

∆a1 `s :σ1

Πa1

∆b1`s :σ1

Πb1

Non-determinism of SR

axx : [σ2] ` x :σ2

axx : [σ2] ` x :σ2∆2`s :σ2

Π2

axx : [σ1] ` x :σ1

axx : [σ1] ` x :σ1∆b

1`s :σ1

Πb1

∆b1`s :σ1

Πb1

∆a1 `s :σ1

Πa1

Γ; x : [σ1, σ2, σ1] ` r : τabs

Γ ` λx.r : [σ1, σ2, σ1]→ τapp

Γ + ∆a1 + ∆b

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

∆a1 `s :σ1

Πa1

∆2`s :σ2

Π2

∆b1`s :σ1

Πb1

Γ + ∆a1 + ∆b

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

By relevance and non-idempotence !

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 23 /46

Page 131: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Subject reduction and expansion in R0

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

axx : [σ1] ` x :σ1

axx : [σ1] ` x :σ1

∆a1 `s :σ1

Πa1

∆a1 `s :σ1

Πa1

∆b1`s :σ1

Πb1

Non-determinism of SR

axx : [σ2] ` x :σ2

axx : [σ2] ` x :σ2

∆2`s :σ2

Π2

axx : [σ1] ` x :σ1

axx : [σ1] ` x :σ1

∆b1`s :σ1

Πb1

∆b1`s :σ1

Πb1

∆a1 `s :σ1

Πa1

Γ; x : ` r : τabs

Γ ` λx.r : [σ1, σ2, σ1]→ τapp

Γ + ∆a1 + ∆b

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

Γ + ∆a1 + ∆b

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

By relevance and non-idempotence !

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 23 /46

Page 132: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Subject reduction and expansion in R0

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

axx : [σ1] ` x :σ1

axx : [σ1] ` x :σ1∆a

1 `s :σ1

Πa1

∆a1 `s :σ1

Πa1

∆b1`s :σ1

Πb1

Non-determinism of SR

axx : [σ2] ` x :σ2

axx : [σ2] ` x :σ2

∆2`s :σ2

Π2

axx : [σ1] ` x :σ1

axx : [σ1] ` x :σ1∆b

1`s :σ1

Πb1

∆b1`s :σ1

Πb1

∆a1 `s :σ1

Πa1

Γ; x : ` r : τabs

Γ ` λx.r : [σ1, σ2, σ1]→ τapp

Γ + ∆a1 + ∆b

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

Γ + ∆a1 + ∆b

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

By relevance and non-idempotence !

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 23 /46

Page 133: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Subject reduction and expansion in R0

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

axx : [σ1] ` x :σ1

axx : [σ1] ` x :σ1∆a

1 `s :σ1

Πa1

∆a1 `s :σ1

Πa1

∆b1`s :σ1

Πb1

Non-determinism of SR

axx : [σ2] ` x :σ2

axx : [σ2] ` x :σ2

∆2`s :σ2

Π2

axx : [σ1] ` x :σ1

axx : [σ1] ` x :σ1∆b

1`s :σ1

Πb1

∆b1`s :σ1

Πb1

∆a1 `s :σ1

Πa1

Γ; x : ` r : τabs

Γ ` λx.r : [σ1, σ2, σ1]→ τapp

Γ + ∆a1 + ∆b

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

Γ + ∆a1 + ∆b

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

By relevance and non-idempotence !

Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 23 /46

Page 134: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Plan

1 Presentation

2 Non-idempotent intersection types

3 Resources for Classical Logic

4 Infinite types and productive reduction

5 Infinite types and unproductive reduction

6 Conclusion

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 24 /46

Page 135: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

The Lambda-Mu Calculus

Intuit. logic + Peirce’s Law ((A→ B)→ A)→ Agives classical logic.

Griffin 90: call−cc and Felleisen’s C-operator typable with Peirce’s Law((A→ B)→ A)→ A

the Curry-Howard iso extends to classical logic

Parigot 92: λµ-calculus = computational interpretation of classical naturaldeduction (e.g., vs. λµµ).

Captures continuations

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 25 /46

Page 136: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

The Lambda-Mu Calculus

Intuit. logic + Peirce’s Law ((A→ B)→ A)→ Agives classical logic.

Griffin 90: call−cc and Felleisen’s C-operator typable with Peirce’s Law((A→ B)→ A)→ A

the Curry-Howard iso extends to classical logic

Parigot 92: λµ-calculus = computational interpretation of classical naturaldeduction (e.g., vs. λµµ).

Captures continuations

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 25 /46

Page 137: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

The Lambda-Mu Calculus

Intuit. logic + Peirce’s Law ((A→ B)→ A)→ Agives classical logic.

Griffin 90: call−cc and Felleisen’s C-operator typable with Peirce’s Law((A→ B)→ A)→ A

the Curry-Howard iso extends to classical logic

Parigot 92: λµ-calculus = computational interpretation of classical naturaldeduction (e.g., vs. λµµ).

Captures continuations

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 25 /46

Page 138: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

The Lambda-Mu Calculus

Intuit. logic + Peirce’s Law ((A→ B)→ A)→ Agives classical logic.

Griffin 90: call−cc and Felleisen’s C-operator typable with Peirce’s Law((A→ B)→ A)→ A

the Curry-Howard iso extends to classical logic

Parigot 92: λµ-calculus = computational interpretation of classical naturaldeduction (e.g., vs. λµµ).

Captures continuations

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 25 /46

Page 139: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

The λµ-calculus

Syntax: Variables x and names α

(Objects) o ::= t | c(Terms) t, u ::= x | λx.t | tu | µα.c(Commands) c ::= [α]t

Basic Meta-Operations:

t[u/x] (subst.)

cu//α replaces every occurrence of [α]v inside t by [α]v u.

Example:

[α](x (µγ.[α]x))u//α =

call−cc := λy.µα.[α]y(λx.µβ.[α]x)

: ((A→ B)→ A)→ A (simple typing)

Operational Semantics:

(λx.t)u →β t[u/x] substitution(µα.c)u →µ µα.cu//α replacement

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 26 /46

Page 140: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

The λµ-calculus

Syntax: Variables x and names α

(Objects) o ::= t | c(Terms) t, u ::= x | λx.t | tu | µα.c(Commands) c ::= [α]t

Basic Meta-Operations:

t[u/x] (subst.)

cu//α replaces every occurrence of [α]v inside t by [α]v u.

Example:

[α](x (µγ.[α]x))u//α =

call−cc := λy.µα.[α]y(λx.µβ.[α]x)

: ((A→ B)→ A)→ A (simple typing)

Operational Semantics:

(λx.t)u →β t[u/x] substitution(µα.c)u →µ µα.cu//α replacement

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 26 /46

Page 141: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

The λµ-calculus

Syntax: Variables x and names α

(Objects) o ::= t | c(Terms) t, u ::= x | λx.t | tu | µα.c(Commands) c ::= [α]t

Basic Meta-Operations:

t[u/x] (subst.)

cu//α replaces every occurrence of [α]v inside t by [α]v u.

Example:

[α](x (µγ.[α]x))u//α =

call−cc := λy.µα.[α]y(λx.µβ.[α]x)

: ((A→ B)→ A)→ A (simple typing)

Operational Semantics:

(λx.t)u →β t[u/x] substitution(µα.c)u →µ µα.cu//α replacement

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 26 /46

Page 142: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

The λµ-calculus

Syntax: Variables x and names α

(Objects) o ::= t | c(Terms) t, u ::= x | λx.t | tu | µα.c(Commands) c ::= [α]t

Basic Meta-Operations:

t[u/x] (subst.)

cu//α replaces every occurrence of [α]v inside t by [α]v u.

Example:

[α](x (µγ.[α]x))u//α =

call−cc := λy.µα.[α]y(λx.µβ.[α]x)

: ((A→ B)→ A)→ A (simple typing)

Operational Semantics:

(λx.t)u →β t[u/x] substitution(µα.c)u →µ µα.cu//α replacement

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 26 /46

Page 143: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

The λµ-calculus

Syntax: Variables x and names α

(Objects) o ::= t | c(Terms) t, u ::= x | λx.t | tu | µα.c(Commands) c ::= [α]t

Basic Meta-Operations:

t[u/x] (subst.)

cu//α replaces every occurrence of [α]v inside t by [α]v u.

Example:

[α](x (µγ.[α]x))u//α = [α](x (µγ.[α]xu))u

call−cc := λy.µα.[α]y(λx.µβ.[α]x)

: ((A→ B)→ A)→ A (simple typing)

Operational Semantics:

(λx.t)u →β t[u/x] substitution(µα.c)u →µ µα.cu//α replacement

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 26 /46

Page 144: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

The λµ-calculus

Syntax: Variables x and names α

(Objects) o ::= t | c(Terms) t, u ::= x | λx.t | tu | µα.c(Commands) c ::= [α]t

Basic Meta-Operations:

t[u/x] (subst.)

cu//α replaces every occurrence of [α]v inside t by [α]v u.

Example:

[α](x (µγ.[α]x))u//α = [α](x (µγ.[α]xu))u

call−cc := λy.µα.[α]y(λx.µβ.[α]x)

: ((A→ B)→ A)→ A (simple typing)

Operational Semantics:

(λx.t)u →β t[u/x] substitution(µα.c)u →µ µα.cu//α replacement

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 26 /46

Page 145: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

The λµ-calculus

Syntax: Variables x and names α

(Objects) o ::= t | c(Terms) t, u ::= x | λx.t | tu | µα.c(Commands) c ::= [α]t

Basic Meta-Operations:

t[u/x] (subst.)

cu//α replaces every occurrence of [α]v inside t by [α]v u.

Example:

[α](x (µγ.[α]x))u//α = [α](x (µγ.[α]xu))u

call−cc := λy.µα.[α]y(λx.µβ.[α]x) : ((A→ B)→ A)→ A (simple typing)

Operational Semantics:

(λx.t)u →β t[u/x] substitution(µα.c)u →µ µα.cu//α replacement

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 26 /46

Page 146: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

The λµ-calculus

Syntax: Variables x and names α

(Objects) o ::= t | c(Terms) t, u ::= x | λx.t | tu | µα.c(Commands) c ::= [α]t

Basic Meta-Operations:

t[u/x] (subst.)

cu//α replaces every occurrence of [α]v inside t by [α]v u.

Example:

[α](x (µγ.[α]x))u//α = [α](x (µγ.[α]xu))u

call−cc := λy.µα.[α]y(λx.µβ.[α]x) : ((A→ B)→ A)→ A (simple typing)

Operational Semantics:

(λx.t)u →β t[u/x] substitution(µα.c)u →µ µα.cu//α replacement

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 26 /46

Page 147: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

The Typing System

Principles

Extend non-idempotent types to classical logic.

Problem 1:finding quantitative descriptorssuitable to classical logic

Problem 2:guaranteeing a decrease inmeasure (weighted s.r.)

resort to non-idempotentunion types (below right)

Not obvious! The number ofnodes does not work (see later).

Intersection: I,J := [Uk]k∈K U ,V =: 〈σk〉k∈K : Union

x : [U1,U2]; y : [V] ` t : U | α : 〈σ1, σ2〉, β : 〈τ1, τ2, τ3〉

A, C and non-I e.g., 〈σ1, σ2〉 ∨ 〈σ1〉 = 〈σ1, σ2, σ1〉

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 27 /46

Page 148: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

The Typing System

Principles

Extend non-idempotent types to classical logic.

Problem 1:finding quantitative descriptorssuitable to classical logic

Problem 2:guaranteeing a decrease inmeasure (weighted s.r.)

resort to non-idempotentunion types (below right)

Not obvious! The number ofnodes does not work (see later).

Intersection: I,J := [Uk]k∈K U ,V =: 〈σk〉k∈K : Union

x : [U1,U2]; y : [V] ` t : U | α : 〈σ1, σ2〉, β : 〈τ1, τ2, τ3〉

A, C and non-I e.g., 〈σ1, σ2〉 ∨ 〈σ1〉 = 〈σ1, σ2, σ1〉

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 27 /46

Page 149: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

The Typing System

Principles

Extend non-idempotent types to classical logic.

Problem 1:finding quantitative descriptorssuitable to classical logic

Problem 2:guaranteeing a decrease inmeasure (weighted s.r.)

resort to non-idempotentunion types (below right)

Not obvious! The number ofnodes does not work (see later).

Intersection: I,J := [Uk]k∈K U ,V =: 〈σk〉k∈K : Union

x : [U1,U2]; y : [V] ` t : U | α : 〈σ1, σ2〉, β : 〈τ1, τ2, τ3〉

A, C and non-I e.g., 〈σ1, σ2〉 ∨ 〈σ1〉 = 〈σ1, σ2, σ1〉

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 27 /46

Page 150: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

The Typing System

Principles

Extend non-idempotent types to classical logic.

Problem 1:finding quantitative descriptorssuitable to classical logic

Problem 2:guaranteeing a decrease inmeasure (weighted s.r.)

resort to non-idempotentunion types (below right)

Not obvious! The number ofnodes does not work (see later).

Intersection: I,J := [Uk]k∈K U ,V =: 〈σk〉k∈K : Union

x : [U1,U2]; y : [V] ` t : U | α : 〈σ1, σ2〉, β : 〈τ1, τ2, τ3〉

A, C and non-I e.g., 〈σ1, σ2〉 ∨ 〈σ1〉 = 〈σ1, σ2, σ1〉

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 27 /46

Page 151: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

The Typing System

Principles

Extend non-idempotent types to classical logic.

Problem 1:finding quantitative descriptorssuitable to classical logic

Problem 2:guaranteeing a decrease inmeasure (weighted s.r.)

resort to non-idempotentunion types (below right)

Not obvious! The number ofnodes does not work (see later).

Intersection: I,J := [Uk]k∈K U ,V =: 〈σk〉k∈K : Union

x : [U1,U2]; y : [V] ` t : U | α : 〈σ1, σ2〉, β : 〈τ1, τ2, τ3〉

A, C and non-I e.g., 〈σ1, σ2〉 ∨ 〈σ1〉 = 〈σ1, σ2, σ1〉

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 27 /46

Page 152: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Some Typing Rules (System Hλµ)

Features

Syntax-direction, relevance, multiplicative rules accumulation of typinginformation.

app-rule based upon the admissible rule of ND:

A1 → B1 ∨ . . . ∨Ak → Bk A1 ∧ . . . ∧AkB1 ∨ . . . ∨Bk

(vs.

A → B A

B

)

Two new rules (manipulation on the right-h.s.):

Γ ` t : U | ∆Γ ` [α]t : # | ∆ ∨ α : U

saveΓ ` c : # | ∆

Γ ` µα.c : ∆(α)∗ | ∆ \\αrestore

where ∗ = choice operator.

call−cc : [[[A]→B]→A]→ 〈A,A〉 vs. ((A→ B)→ A)→ A

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 28 /46

Page 153: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Some Typing Rules (System Hλµ)

Features

Syntax-direction, relevance, multiplicative rules accumulation of typinginformation.

app-rule based upon the admissible rule of ND:

A1 → B1 ∨ . . . ∨Ak → Bk A1 ∧ . . . ∧AkB1 ∨ . . . ∨Bk

(vs.

A → B A

B

)

Two new rules (manipulation on the right-h.s.):

Γ ` t : U | ∆Γ ` [α]t : # | ∆ ∨ α : U

saveΓ ` c : # | ∆

Γ ` µα.c : ∆(α)∗ | ∆ \\αrestore

where ∗ = choice operator.

call−cc : [[[A]→B]→A]→ 〈A,A〉 vs. ((A→ B)→ A)→ A

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 28 /46

Page 154: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Some Typing Rules (System Hλµ)

Features

Syntax-direction, relevance, multiplicative rules accumulation of typinginformation.

app-rule based upon the admissible rule of ND:

A1 → B1 ∨ . . . ∨Ak → Bk A1 ∧ . . . ∧AkB1 ∨ . . . ∨Bk

(vs.

A → B A

B

)

Two new rules (manipulation on the right-h.s.):

Γ ` t : U | ∆Γ ` [α]t : # | ∆ ∨ α : U

saveΓ ` c : # | ∆

Γ ` µα.c : ∆(α)∗ | ∆ \\αrestore

where ∗ = choice operator.

call−cc : [[[A]→B]→A]→ 〈A,A〉 vs. ((A→ B)→ A)→ A

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 28 /46

Page 155: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Some Typing Rules (System Hλµ)

Features

Syntax-direction, relevance, multiplicative rules accumulation of typinginformation.

app-rule based upon the admissible rule of ND:

A1 → B1 ∨ . . . ∨Ak → Bk A1 ∧ . . . ∧AkB1 ∨ . . . ∨Bk

(vs.

A → B A

B

)

Two new rules (manipulation on the right-h.s.):

Γ ` t : U | ∆Γ ` [α]t : # | ∆ ∨ α : U

saveΓ ` c : # | ∆

Γ ` µα.c : ∆(α)∗ | ∆ \\αrestore

where ∗ = choice operator.

call−cc : [[[A]→B]→A]→ 〈A,A〉 vs. ((A→ B)→ A)→ A

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 28 /46

Page 156: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Some Typing Rules (System Hλµ)

Features

Syntax-direction, relevance, multiplicative rules accumulation of typinginformation.

app-rule based upon the admissible rule of ND:

A1 → B1 ∨ . . . ∨Ak → Bk A1 ∧ . . . ∧AkB1 ∨ . . . ∨Bk

(vs.

A → B A

B

)

Two new rules (manipulation on the right-h.s.):

Γ ` t : U | ∆Γ ` [α]t : # | ∆ ∨ α : U

saveΓ ` c : # | ∆

Γ ` µα.c : ∆(α)∗ | ∆ \\αrestore

where ∗ = choice operator.

call−cc : [[[A]→B]→A]→ 〈A,A〉 vs. ((A→ B)→ A)→ A

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 28 /46

Page 157: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Some Typing Rules (System Hλµ)

Features

Syntax-direction, relevance, multiplicative rules accumulation of typinginformation.

app-rule based upon the admissible rule of ND:

A1 → B1 ∨ . . . ∨Ak → Bk A1 ∧ . . . ∧AkB1 ∨ . . . ∨Bk

(vs.

A → B A

B

)

Two new rules (manipulation on the right-h.s.):

Γ ` t : U | ∆Γ ` [α]t : # | ∆ ∨ α : U

saveΓ ` c : # | ∆

Γ ` µα.c : ∆(α)∗ | ∆ \\αrestore

where ∗ = choice operator.

call−cc : [[[A]→B]→A]→ 〈A,A〉 vs. ((A→ B)→ A)→ A

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 28 /46

Page 158: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Some Typing Rules (System Hλµ)

Features

Syntax-direction, relevance, multiplicative rules accumulation of typinginformation.

app-rule based upon the admissible rule of ND:

A1 → B1 ∨ . . . ∨Ak → Bk A1 ∧ . . . ∧AkB1 ∨ . . . ∨Bk

(vs.

A → B A

B

)

Two new rules (manipulation on the right-h.s.):

Γ ` t : U | ∆Γ ` [α]t : # | ∆ ∨ α : U

saveΓ ` c : # | ∆

Γ ` µα.c : ∆(α)∗ | ∆ \\αrestore

where ∗ = choice operator.

call−cc : [[[A]→B]→A]→ 〈A,A〉 vs. ((A→ B)→ A)→ A

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 28 /46

Page 159: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Properties and contributions (1)

Weighted Subject Reduction

with size(Π) =

number of nodes of Π +size of the type arities of all the names of commands +multiplicities of arguments in all the app. nodes of Π.

Subject Expansion

Theorem (Kesner, Vial, FSCD17)

Let t be a λµ-term. Then equivalence between:

1 t is typable (in Hλµ)

2 t is HN

3 the head reduction strategy terminates on t (thus, h.r.strat. certified!).

Bonus (quantitative information)

size(Π) bounds the number of steps of the head. red. strategy on t.

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 29 /46

Page 160: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Contributions (2)

Theorem (Kesner,Vial, FSCD17)

System Sλµ characterizing SN for the λµ-calculus.

sz(Π) bounds the length of any reduction sequence starting at t.

Extension (small-step operational semantics for the λµ-calculus)

Processing substitution and replacement one occurrence at a time.In λ: (x y x x)[s/x] s y s s (1 big step)In λex (x y x x)[s/x] s y x x s y x s s y s s (3 small-steps)

Characterization of SN (extension of Sλµ).

Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 30 /46

Page 161: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Plan

1 Presentation

2 Non-idempotent intersection types

3 Resources for Classical Logic

4 Infinite types and productive reduction

5 Infinite types and unproductive reduction

6 Conclusion

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 31 /46

Page 162: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Klop’s Problem

HN, WN, SN,. . . have been statically characterized by various ITS.

Klop’s Problem: can the set of ∞-WN terms be characterized by an ITS ?Def: t is ∞-WN iff its Bohm tree does not contain ⊥

Tatsuta [07]: an inductive ITS cannot do it.

Can a coinductive ITS characterize the set of ∞-WNterms?

YES, with ITS = sequential + validity criterion.

But. . . what is infinitary normalization?

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 32 /46

Page 163: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Klop’s Problem

HN, WN, SN,. . . have been statically characterized by various ITS.

Klop’s Problem: can the set of ∞-WN terms be characterized by an ITS ?Def: t is ∞-WN iff its Bohm tree does not contain ⊥

Tatsuta [07]: an inductive ITS cannot do it.

Can a coinductive ITS characterize the set of ∞-WNterms?

YES, with ITS = sequential + validity criterion.

But. . . what is infinitary normalization?

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 32 /46

Page 164: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Klop’s Problem

HN, WN, SN,. . . have been statically characterized by various ITS.

Klop’s Problem: can the set of ∞-WN terms be characterized by an ITS ?Def: t is ∞-WN iff its Bohm tree does not contain ⊥

Tatsuta [07]: an inductive ITS cannot do it.

Can a coinductive ITS characterize the set of ∞-WNterms?

YES, with ITS = sequential + validity criterion.

But. . . what is infinitary normalization?

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 32 /46

Page 165: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Productive vs. Unproductive Reduction

Productive reduction: ∆f := λx.f(xx) Yf := ∆f∆f ”Curry f”

→ → → → → . . .→ fn(Yf )→ . . .→∞ fω

Unproductive reduction: ∆ = λx.x x, Ω = ∆ ∆ (i.e. autoapp(autoapp))

Ω→ Ω→ Ω→ Ω→ Ω→ Ω→ . . .

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 33 /46

Page 166: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Productive vs. Unproductive Reduction

Productive reduction: ∆f := λx.f(xx) Yf := ∆f∆f ”Curry f”

Yf → f(Yf )→ f2(Yf )→ f3(Yf )→ f4(Yf )→ . . .→ fn(Yf )→ . . .→∞ fω

Yf

Unproductive reduction: ∆ = λx.x x, Ω = ∆ ∆ (i.e. autoapp(autoapp))

Ω→ Ω→ Ω→ Ω→ Ω→ Ω→ . . .

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 33 /46

Page 167: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Productive vs. Unproductive Reduction

Productive reduction: ∆f := λx.f(xx) Yf := ∆f∆f ”Curry f”

Yf → f(Yf )→ f2(Yf )→ f3(Yf )→ f4(Yf )→ . . .→ fn(Yf )→ . . .→∞ fω

Yf

f

@

Unproductive reduction: ∆ = λx.x x, Ω = ∆ ∆ (i.e. autoapp(autoapp))

Ω→ Ω→ Ω→ Ω→ Ω→ Ω→ . . .

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 33 /46

Page 168: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Productive vs. Unproductive Reduction

Productive reduction: ∆f := λx.f(xx) Yf := ∆f∆f ”Curry f”

Yf → f(Yf )→ f2(Yf )→ f3(Yf )→ f4(Yf )→ . . .→ fn(Yf )→ . . .→∞ fω

Yf

f

@f

@

Unproductive reduction: ∆ = λx.x x, Ω = ∆ ∆ (i.e. autoapp(autoapp))

Ω→ Ω→ Ω→ Ω→ Ω→ Ω→ . . .

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 33 /46

Page 169: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Productive vs. Unproductive Reduction

Productive reduction: ∆f := λx.f(xx) Yf := ∆f∆f ”Curry f”

Yf → f(Yf )→ f2(Yf )→ f3(Yf )→ f4(Yf )→ . . .→ fn(Yf )→ . . .→∞ fω

Yf

f

@f

@f

@

Unproductive reduction: ∆ = λx.x x, Ω = ∆ ∆ (i.e. autoapp(autoapp))

Ω→ Ω→ Ω→ Ω→ Ω→ Ω→ . . .

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 33 /46

Page 170: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Productive vs. Unproductive Reduction

Productive reduction: ∆f := λx.f(xx) Yf := ∆f∆f ”Curry f”

Yf → f(Yf )→ f2(Yf )→ f3(Yf )→ f4(Yf )→ . . .→ fn(Yf )→ . . .→∞ fω

Yf

f

@f

@f

@f

@

Unproductive reduction: ∆ = λx.x x, Ω = ∆ ∆ (i.e. autoapp(autoapp))

Ω→ Ω→ Ω→ Ω→ Ω→ Ω→ . . .

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 33 /46

Page 171: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Productive vs. Unproductive Reduction

Productive reduction: ∆f := λx.f(xx) Yf := ∆f∆f ”Curry f”

Yf → f(Yf )→ f2(Yf )→ f3(Yf )→ f4(Yf )→ . . .→ fn(Yf )→ . . .→∞ fω

f

@f

@f

@f

@f

@

Unproductive reduction: ∆ = λx.x x, Ω = ∆ ∆ (i.e. autoapp(autoapp))

Ω→ Ω→ Ω→ Ω→ Ω→ Ω→ . . .

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 33 /46

Page 172: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Productive vs. Unproductive Reduction

Productive reduction: ∆f := λx.f(xx) Yf := ∆f∆f ”Curry f”

Yf → f(Yf )→ f2(Yf )→ f3(Yf )→ f4(Yf )→ . . .→ fn(Yf )→ . . .→∞ fω

f

@f

@f

@f

@f

@

Unproductive reduction: ∆ = λx.x x, Ω = ∆ ∆ (i.e. autoapp(autoapp))

Ω→ Ω→ Ω→ Ω→ Ω→ Ω→ . . .

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 33 /46

Page 173: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Productive vs. Unproductive Reduction

Productive reduction: ∆f := λx.f(xx) Yf := ∆f∆f ”Curry f”

Yf → f(Yf )→ f2(Yf )→ f3(Yf )→ f4(Yf )→ . . .→ fn(Yf )→ . . .→∞ fω

f

@f

@f

@f

@f

@

Yf not WN

Yf is ∞-WN

∞-NF: fω = f(fω)

Unproductive reduction: ∆ = λx.x x, Ω = ∆ ∆ (i.e. autoapp(autoapp))

Ω→ Ω→ Ω→ Ω→ Ω→ Ω→ . . .

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 33 /46

Page 174: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Productive vs. Unproductive Reduction

Productive reduction: ∆f := λx.f(xx) Yf := ∆f∆f ”Curry f”

Yf → f(Yf )→ f2(Yf )→ f3(Yf )→ f4(Yf )→ . . .→ fn(Yf )→ . . .→∞ fω

f

@f

@f

@f

@f

@

Yf not WN

Yf is ∞-WN

∞-NF: fω = f(fω)

Unproductive reduction: ∆ = λx.x x, Ω = ∆ ∆ (i.e. autoapp(autoapp))

Ω→ Ω→ Ω→ Ω→ Ω→ Ω→ . . .

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 33 /46

Page 175: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Infinite Terms

Infinite λ-terms.

Infinite NF e.g., fω.

Productive reduction sequence of infinite length (strongly convergingreduction sequence)

Yf → f(Yf ) . . . ok not Ω→ Ω . . .

A term t is ∞-WN if ∃ a reduction path to an ∞-NF.

Hereditary head reduction strategy:from lower (root) to upper levers.

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 34 /46

Page 176: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Towards Infinitary Typing

Idea

To characterize ∞-WN, let us unforgetfully type infinite normal forms no part of an ∞-NF must be left untyped. . .

Need to consider infinite derivations with a coinductive type grammar(R0 R).

Problem 1: how do we per-form infinite subject reduc-tion/expansion?

Actually, this is difficult only for SE

(extra-slide available)

Problem 2: the coinductivetype grammar allows to defineρ = [ρ]ω → o.

Using ρ, we may type Ω with o(unsound derivations)

Solution (for both problems): resort to a validity criterion calledapproximability.

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 35 /46

Page 177: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Towards Infinitary Typing

Idea

To characterize ∞-WN, let us unforgetfully type infinite normal forms no part of an ∞-NF must be left untyped. . .

Need to consider infinite derivations with a coinductive type grammar(R0 R).

Problem 1: how do we per-form infinite subject reduc-tion/expansion?

Actually, this is difficult only for SE

(extra-slide available)

Problem 2: the coinductivetype grammar allows to defineρ = [ρ]ω → o.

Using ρ, we may type Ω with o(unsound derivations)

Solution (for both problems): resort to a validity criterion calledapproximability.

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 35 /46

Page 178: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Towards Infinitary Typing

Idea

To characterize ∞-WN, let us unforgetfully type infinite normal forms no part of an ∞-NF must be left untyped. . .

Need to consider infinite derivations with a coinductive type grammar(R0 R).

Problem 1: how do we per-form infinite subject reduc-tion/expansion?

Actually, this is difficult only for SE

(extra-slide available)

Problem 2: the coinductivetype grammar allows to defineρ = [ρ]ω → o.

Using ρ, we may type Ω with o(unsound derivations)

Solution (for both problems): resort to a validity criterion calledapproximability.

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 35 /46

Page 179: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Approximability (intuitions)

A derivation is a set of symbols, that satisfies some grammar.

Some derivations are included in others

(black ⊆ black+red)

x : [[

o

]→ o] ` x : [

o

]→ o

x : [[o]→ o]

; y : [o]

` x y : o

Informal Definition [Vial, LICS17]: a derivation Π is approximable if, forall finite selection of symbols B0, there is a finite derivation Πf included in Πand containing B0.

Π

Problem 3: Approximabilitycannot be expressed withmultisets.

(no tracking with multisets)

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 36 /46

Page 180: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Approximability (intuitions)

A derivation is a set of symbols, that satisfies some grammar.

Some derivations are included in others

(black ⊆ black+red)

x : [[o]→ o] ` x : [o]→ o y : [o] ` y : o

x : [[o]→ o]; y : [o] ` x y : o

Informal Definition [Vial, LICS17]: a derivation Π is approximable if, forall finite selection of symbols B0, there is a finite derivation Πf included in Πand containing B0.

Π

Problem 3: Approximabilitycannot be expressed withmultisets.

(no tracking with multisets)

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 36 /46

Page 181: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Approximability (intuitions)

A derivation is a set of symbols, that satisfies some grammar.

Some derivations are included in others (black ⊆ black+red)

x : [[o]→ o] ` x : [o]→ o y : [o] ` y : o

x : [[o]→ o]; y : [o] ` x y : o

Informal Definition [Vial, LICS17]: a derivation Π is approximable if, forall finite selection of symbols B0, there is a finite derivation Πf included in Πand containing B0.

Π

Problem 3: Approximabilitycannot be expressed withmultisets.

(no tracking with multisets)

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 36 /46

Page 182: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Approximability (intuitions)

A derivation is a set of symbols, that satisfies some grammar.

Some derivations are included in others (black ⊆ black+red)

x : [[o]→ o] ` x : [o]→ o y : [o] ` y : o

x : [[o]→ o]; y : [o] ` x y : o

Informal Definition [Vial, LICS17]: a derivation Π is approximable if, forall finite selection of symbols B0, there is a finite derivation Πf included in Πand containing B0.

Π

••

•••

Problem 3: Approximabilitycannot be expressed withmultisets.

(no tracking with multisets)

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 36 /46

Page 183: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Approximability (intuitions)

A derivation is a set of symbols, that satisfies some grammar.

Some derivations are included in others (black ⊆ black+red)

x : [[o]→ o] ` x : [o]→ o y : [o] ` y : o

x : [[o]→ o]; y : [o] ` x y : o

Informal Definition [Vial, LICS17]: a derivation Π is approximable if, forall finite selection of symbols B0, there is a finite derivation Πf included in Πand containing B0.

Π

••

•••

• Πf

Problem 3: Approximabilitycannot be expressed withmultisets.

(no tracking with multisets)

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 36 /46

Page 184: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Approximability (intuitions)

A derivation is a set of symbols, that satisfies some grammar.

Some derivations are included in others (black ⊆ black+red)

x : [[o]→ o] ` x : [o]→ o y : [o] ` y : o

x : [[o]→ o]; y : [o] ` x y : o

Informal Definition [Vial, LICS17]: a derivation Π is approximable if, forall finite selection of symbols B0, there is a finite derivation Πf included in Πand containing B0.

Π

••

•••

• Πf

Problem 3: Approximabilitycannot be expressed withmultisets.

(no tracking with multisets)

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 36 /46

Page 185: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Sequential intersection

Solution

Resorting to sequential intersection ! ( approximability becomes definable)

Strict Types:Sk, T ::= o ∈ O | (k · Sk)k∈K → T

Sequence Types (k · Sk)k∈K

Example: (7 · o1, 3 · o2, 2 · o1)→ o

o

1

o1

2

o2

3

o1

7

7, 3, 2, 1 = “tracks”

Tracking: (3 · σ, 5 · τ, 9 · σ) = (3 · σ, 5 · τ) ] (9 · τ)vs. [σ, τ, σ] = [σ

?

, τ ] + [σ

?

]

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 37 /46

Page 186: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Sequential intersection

Solution

Resorting to sequential intersection ! ( approximability becomes definable)

Strict Types:Sk, T ::= o ∈ O | (k · Sk)k∈K → T

Sequence Types (k · Sk)k∈K

Example: (7 · o1, 3 · o2, 2 · o1)→ o

o

1

o1

2

o2

3

o1

7

7, 3, 2, 1 = “tracks”

Tracking: (3 · σ, 5 · τ, 9 · σ) = (3 · σ, 5 · τ) ] (9 · τ)vs. [σ, τ, σ] = [σ

?

, τ ] + [σ

?

]

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 37 /46

Page 187: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Sequential intersection

Solution

Resorting to sequential intersection ! ( approximability becomes definable)

Strict Types:Sk, T ::= o ∈ O | (k · Sk)k∈K → T

Sequence Types (k · Sk)k∈K

Example: (7 · o1, 3 · o2, 2 · o1)→ o

o

1

o1

2

o2

3

o1

7

7, 3, 2, 1 = “tracks”

Tracking: (3 · σ, 5 · τ, 9 · σ) = (3 · σ, 5 · τ) ] (9 · τ)vs. [σ, τ, σ] = [σ

?

, τ ] + [σ

?

]

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 37 /46

Page 188: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Sequential intersection

Solution

Resorting to sequential intersection ! ( approximability becomes definable)

Strict Types:Sk, T ::= o ∈ O | (k · Sk)k∈K → T

Sequence Types (k · Sk)k∈K

Example: (7 · o1, 3 · o2, 2 · o1)→ o

o

1

o1

2

o2

3

o1

7

7, 3, 2, 1 = “tracks”

Tracking: (3 · σ, 5 · τ, 9 · σ) = (3 · σ, 5 · τ) ] (9 · τ)vs. [σ, τ, σ] = [σ

?

, τ ] + [σ

?

]

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 37 /46

Page 189: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Sequential intersection

Solution

Resorting to sequential intersection ! ( approximability becomes definable)

Strict Types:Sk, T ::= o ∈ O | (k · Sk)k∈K → T

Sequence Types (k · Sk)k∈K

Example: (7 · o1, 3 · o2, 2 · o1)→ o

o

1

o1

2

o2

3

o1

7

7, 3, 2, 1 = “tracks”

Tracking: (3 · σ, 5 · τ, 9 · σ) = (3 · σ, 5 · τ) ] (9 · τ)vs. [σ, τ, σ] = [σ

?, τ ] + [σ

?]

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 37 /46

Page 190: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Derivations of S

x : (k · T ) ` x : Tax

C; x : (Sk)k∈K ` t : T

C ` λx.t : (Sk)k∈K → Tabs

C ` t : (Sk)k∈K → T (Dk ` u : Sk)k∈K

C ] (]k∈KDk) ` t u : Tapp

System S features pointers (called bipositions).

Approximability is definable in S

Problem 3 solved!

Every S-derivation collapses on a R-derivation.

Theorem

Given t, the set of the S-derivations typing t is a complete partial order (c.p.o.).

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 38 /46

Page 191: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Characterization of infinitary WN

Proposition (Vial, LICS17)

In System S:

SR: typing is stable by productive ∞-reduction.

SE: approximable typing stable by productive ∞-expansion.

Theorem (Vial, LICS17)

A ∞-term t is ∞-WN iff t is unforgetfully typable by means of an approximablederivation Klop’s Problem solved

The hereditary head reduction strategy is complete for infinitary weaknormalization.

Last bonus (positive answer to TLCA Problem #20)

System S also provides a type-theoretic characterization of the hereditarypermutations (not possible in the inductive case, Tatsuta [LICS07]).

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 39 /46

Page 192: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Characterization of infinitary WN

Proposition (Vial, LICS17)

In System S:

SR: typing is stable by productive ∞-reduction.

SE: approximable typing stable by productive ∞-expansion.

Theorem (Vial, LICS17)

A ∞-term t is ∞-WN iff t is unforgetfully typable by means of an approximablederivation Klop’s Problem solved

The hereditary head reduction strategy is complete for infinitary weaknormalization.

Last bonus (positive answer to TLCA Problem #20)

System S also provides a type-theoretic characterization of the hereditarypermutations (not possible in the inductive case, Tatsuta [LICS07]).

Non-idempotent typing operators P. Vial 4 Infinite types and productive reduction 39 /46

Page 193: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Plan

1 Presentation

2 Non-idempotent intersection types

3 Resources for Classical Logic

4 Infinite types and productive reduction

5 Infinite types and unproductive reduction

6 Conclusion

Non-idempotent typing operators P. Vial 5 Infinite types and unproductive reduction 40 /46

Page 194: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Two questions arising from Klop’s problem

Question 1 (the set of typable terms)

What is the set of typable terms in system R and S? (without approximabilitycondition)

Theorem (Vial)

Every term is typable in systems R and S (non-trivial).

One can extract from R-typing the order (arity) of any λ-term.

In the infinitary relational model, no term has an empty denotation.

Question 2 (relation between S and R)

Every S-derivation collapses on a R-derivation.But is the converse true?

Theorem (Vial)

Every R-derivation is the collapse of a S-derivation.

One can encode any reduction choice in system R b.m.o. a S-derivation.

Non-idempotent typing operators P. Vial 5 Infinite types and unproductive reduction 41 /46

Page 195: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Two questions arising from Klop’s problem

Question 1 (the set of typable terms)

What is the set of typable terms in system R and S? (without approximabilitycondition)

Theorem (Vial)

Every term is typable in systems R and S (non-trivial).

One can extract from R-typing the order (arity) of any λ-term.

In the infinitary relational model, no term has an empty denotation.

Question 2 (relation between S and R)

Every S-derivation collapses on a R-derivation.But is the converse true?

Theorem (Vial)

Every R-derivation is the collapse of a S-derivation.

One can encode any reduction choice in system R b.m.o. a S-derivation.

Non-idempotent typing operators P. Vial 5 Infinite types and unproductive reduction 41 /46

Page 196: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Two questions arising from Klop’s problem

Question 1 (the set of typable terms)

What is the set of typable terms in system R and S? (without approximabilitycondition)

Theorem (Vial)

Every term is typable in systems R and S (non-trivial).

One can extract from R-typing the order (arity) of any λ-term.

In the infinitary relational model, no term has an empty denotation.

Question 2 (relation between S and R)

Every S-derivation collapses on a R-derivation.But is the converse true?

Theorem (Vial)

Every R-derivation is the collapse of a S-derivation.

One can encode any reduction choice in system R b.m.o. a S-derivation.

Non-idempotent typing operators P. Vial 5 Infinite types and unproductive reduction 41 /46

Page 197: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Difficulties

In the productive cases(HN,WN,SN,∞-WN), in i.t.s., onetypes the normal forms and usessubject expansion.

normalizing terms ⊆ typable terms

Here, no form ofproductivity/stabilization.

We develop a corpus of methodsinspired by first order modeltheory (last part of the dissertation).

x

[ ]→ . . .→ [ ]→ o

t1

@ tq

@

o λxp

. . .→ . . .→ . . .→ o

λx1

Non-idempotent typing operators P. Vial 5 Infinite types and unproductive reduction 42 /46

Page 198: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Plan

1 Presentation

2 Non-idempotent intersection types

3 Resources for Classical Logic

4 Infinite types and productive reduction

5 Infinite types and unproductive reduction

6 Conclusion

Non-idempotent typing operators P. Vial 6 Conclusion 43 /46

Page 199: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Beyond this thesis

Intersection types via Grothendieck construction[Mazza,Pellissier,Vial, POPL2018]

Categorical generalization of ITS. a la Mellies-Zeilberger.

Type systems = 2-operads (see below).

Type systems as 2-operads

Level 1: Γ ` t : B t = multimorphism from Γ to B.

Level 2: if Γ ` t : BSR Γ ` t′ : B,

t t′ = 2-morphism from t to t′.

Construction of an i.t.s. via a Grothendieck construction (pullbacks).

Modularity: retrieving automaticallye.g., e.g., Coppo-Dezani, Gardner, R0, call-by-value + Hλµ (use cyclic

2-operads)

Non-idempotent typing operators P. Vial 6 Conclusion 44 /46

Page 200: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

What we did and what we shall do

The λµ-calculus:Characterization of HN and SN with non-idempotent/quantitativemethods (extension of R0).

Certification of reduction strategies.

Upper bounds on normalizing strategies.

Small-step operational semantics and SN (extension).

Perspectives

Exact bounds on normalizing strategies (a la Bernadet-Lengrand).

Quantitative types for other classical calculi (e.g., Curien-Herbelin’sλµµ).

Studying the model underlying Hλµ.

Klop’s Problem and Infinitary Normalization

Characterizing infinitary weak normalization.

Certifying an infinitary reduction strategy (HHN).

Positive answer to TLCA Problem # 20.

Introduction of system S (sequential intersection, non-idem. flavor).

Introduction of a validity criterion (approximability).

Perspectives

Other forms of ∞-normalization (other calculi, ∞-SN)

Relations between system S and ludics, GoI, indexed LL. . .

Relations with Grellois-Mellies infinitary model of LL.

Non-idempotent typing operators P. Vial 6 Conclusion 45 /46

Page 201: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

What we did and what we shall do

The λµ-calculus:Characterization of HN and SN with non-idempotent/quantitativemethods (extension of R0).

Certification of reduction strategies.

Upper bounds on normalizing strategies.

Small-step operational semantics and SN (extension).

Perspectives

Exact bounds on normalizing strategies (a la Bernadet-Lengrand).

Quantitative types for other classical calculi (e.g., Curien-Herbelin’sλµµ).

Studying the model underlying Hλµ.

Klop’s Problem and Infinitary Normalization

Characterizing infinitary weak normalization.

Certifying an infinitary reduction strategy (HHN).

Positive answer to TLCA Problem # 20.

Introduction of system S (sequential intersection, non-idem. flavor).

Introduction of a validity criterion (approximability).

Perspectives

Other forms of ∞-normalization (other calculi, ∞-SN)

Relations between system S and ludics, GoI, indexed LL. . .

Relations with Grellois-Mellies infinitary model of LL.

Non-idempotent typing operators P. Vial 6 Conclusion 45 /46

Page 202: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

What we did and what we shall do

The λµ-calculus:Characterization of HN and SN with non-idempotent/quantitativemethods (extension of R0).

Certification of reduction strategies.

Upper bounds on normalizing strategies.

Small-step operational semantics and SN (extension).

Perspectives

Exact bounds on normalizing strategies (a la Bernadet-Lengrand).

Quantitative types for other classical calculi (e.g., Curien-Herbelin’sλµµ).

Studying the model underlying Hλµ.

Klop’s Problem and Infinitary Normalization

Characterizing infinitary weak normalization.

Certifying an infinitary reduction strategy (HHN).

Positive answer to TLCA Problem # 20.

Introduction of system S (sequential intersection, non-idem. flavor).

Introduction of a validity criterion (approximability).

Perspectives

Other forms of ∞-normalization (other calculi, ∞-SN)

Relations between system S and ludics, GoI, indexed LL. . .

Relations with Grellois-Mellies infinitary model of LL.

Non-idempotent typing operators P. Vial 6 Conclusion 45 /46

Page 203: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

What we did and what we shall do

The λµ-calculus:Characterization of HN and SN with non-idempotent/quantitativemethods (extension of R0).

Certification of reduction strategies.

Upper bounds on normalizing strategies.

Small-step operational semantics and SN (extension).

Perspectives

Exact bounds on normalizing strategies (a la Bernadet-Lengrand).

Quantitative types for other classical calculi (e.g., Curien-Herbelin’sλµµ).

Studying the model underlying Hλµ.

Klop’s Problem and Infinitary Normalization

Characterizing infinitary weak normalization.

Certifying an infinitary reduction strategy (HHN).

Positive answer to TLCA Problem # 20.

Introduction of system S (sequential intersection, non-idem. flavor).

Introduction of a validity criterion (approximability).

Perspectives

Other forms of ∞-normalization (other calculi, ∞-SN)

Relations between system S and ludics, GoI, indexed LL. . .

Relations with Grellois-Mellies infinitary model of LL.

Non-idempotent typing operators P. Vial 6 Conclusion 45 /46

Page 204: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

What we did and what we shall do

The λµ-calculus:Characterization of HN and SN with non-idempotent/quantitativemethods (extension of R0).

Certification of reduction strategies.

Upper bounds on normalizing strategies.

Small-step operational semantics and SN (extension).

Perspectives

Exact bounds on normalizing strategies (a la Bernadet-Lengrand).

Quantitative types for other classical calculi (e.g., Curien-Herbelin’sλµµ).

Studying the model underlying Hλµ.

Klop’s Problem and Infinitary Normalization

Characterizing infinitary weak normalization.

Certifying an infinitary reduction strategy (HHN).

Positive answer to TLCA Problem # 20.

Introduction of system S (sequential intersection, non-idem. flavor).

Introduction of a validity criterion (approximability).

Perspectives

Other forms of ∞-normalization (other calculi, ∞-SN)

Relations between system S and ludics, GoI, indexed LL. . .

Relations with Grellois-Mellies infinitary model of LL.

Non-idempotent typing operators P. Vial 6 Conclusion 45 /46

Page 205: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Thank you

Thank you for your attention!

Non-idempotent typing operators P. Vial 6 Conclusion 46 /46

Page 206: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Peirce’s Law in Classical Natural Deduction

(A→ B)→ A ` (A→ B)→ A

A ` A,B` A→ B,A

(A→ B)→ A ` A,A(A→ B)→ A ` A

` ((A→ B)→ A)→ A

Standard Style

(A→ B)→ A ` (A→ B)→ A |

A ` A | BA ` B | A

act

` A→ B | A(A→ B)→ A ` A | A(A→ B)→ A ` A |

contrac

` ((A→ B)→ A)→ A |Focussed Style

Non-idempotent typing operators P. Vial 6 Conclusion 47 /46

Page 207: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Peirce’s Law in Classical Natural Deduction

(A→ B)→ A ` (A→ B)→ A

A ` A,B` A→ B,A

(A→ B)→ A ` A,A(A→ B)→ A ` A

` ((A→ B)→ A)→ A

Standard Style

(A→ B)→ A ` (A→ B)→ A |

A ` A | BA ` B | A

act

` A→ B | A(A→ B)→ A ` A | A(A→ B)→ A ` A |

contrac

` ((A→ B)→ A)→ A |Focussed Style

Non-idempotent typing operators P. Vial 6 Conclusion 47 /46

Page 208: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Peirce’s Law in Classical Natural Deduction

(A→ B)→ A ` (A→ B)→ A

A ` A,B` A→ B,A

(A→ B)→ A ` A,A(A→ B)→ A ` A

` ((A→ B)→ A)→ A

Standard Style

(A→ B)→ A ` (A→ B)→ A |

A ` A | BA ` B | A

act

` A→ B | A(A→ B)→ A ` A | A(A→ B)→ A ` A |

contrac

` ((A→ B)→ A)→ A |Focussed Style

Non-idempotent typing operators P. Vial 6 Conclusion 47 /46

Page 209: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Peirce’s Law in Classical Natural Deduction

(A→ B)→ A ` (A→ B)→ A

A ` A,B` A→ B,A

(A→ B)→ A ` A,A(A→ B)→ A ` A

` ((A→ B)→ A)→ A

Standard Style

(A→ B)→ A ` (A→ B)→ A |

A ` A | BA ` B | A

act

` A→ B | A(A→ B)→ A ` A | A(A→ B)→ A ` A |

contrac

` ((A→ B)→ A)→ A |Focussed Style

Non-idempotent typing operators P. Vial 6 Conclusion 47 /46

Page 210: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Peirce’s Law in Classical Natural Deduction

(A→ B)→ A ` (A→ B)→ A

A ` A,B` A→ B,A

(A→ B)→ A ` A,A(A→ B)→ A ` A

` ((A→ B)→ A)→ A

Standard Style

(A→ B)→ A ` (A→ B)→ A |

A ` A | BA ` B | A

act

` A→ B | A(A→ B)→ A ` A | A(A→ B)→ A ` A |

contrac

` ((A→ B)→ A)→ A |Focussed Style

Non-idempotent typing operators P. Vial 6 Conclusion 47 /46

Page 211: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Peirce’s Law in Classical Natural Deduction

(A→ B)→ A ` (A→ B)→ A

A ` A,B` A→ B,A

(A→ B)→ A ` A,A(A→ B)→ A ` A

` ((A→ B)→ A)→ A

Standard Style

(A→ B)→ A ` (A→ B)→ A |

A ` A | BA ` B | A

act

` A→ B | A(A→ B)→ A ` A | A(A→ B)→ A ` A |

contrac

` ((A→ B)→ A)→ A |Focussed Style

Non-idempotent typing operators P. Vial 6 Conclusion 47 /46

Page 212: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Peirce’s Law in Classical Natural Deduction

(A→ B)→ A ` (A→ B)→ A

A ` A,B` A→ B,A

(A→ B)→ A ` A,A(A→ B)→ A ` A

` ((A→ B)→ A)→ A

Standard Style

(A→ B)→ A ` (A→ B)→ A |

A ` A | BA ` B | A

act

` A→ B | A(A→ B)→ A ` A | A(A→ B)→ A ` A |

contrac

` ((A→ B)→ A)→ A |Focussed Style

Non-idempotent typing operators P. Vial 6 Conclusion 47 /46

Page 213: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Typing call−cc in Hλµ

y : [[[A]→B]→A] ` y : [[A]→B]→A |

x : [A] ` x : A |x : [A] ` [α]x : # | α : A

x : [A] ` µβ.[α]x : B | α : A

` λx.µβ.[α]x : [A]→ B | α : A

λx.µβ.[α]x : [[A]→B] | α : A

y : [[[A]→B]→A] ` y(λx.µβ.[α]x) : A | α : A

y : [[[A]→B]→A] ` [α]y(λx.µβ.[α]x) : # | α : 〈A,A〉y : [[[A]→B]→A] ` µα.[α]y(λx.µβ.[α]x) : 〈A,A〉 |` λy.µα.[α]y(λx.µβ.[α]x) : [[[A]→B]→A]→ 〈A,A〉 |

Non-idempotent typing operators P. Vial 6 Conclusion 48 /46

Page 214: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Typing call−cc in Hλµ

y : [[[A]→B]→A] ` y : [[A]→B]→A |

x : [A] ` x : A |x : [A] ` [α]x : # | α : A

x : [A] ` µβ.[α]x : B | α : A

` λx.µβ.[α]x : [A]→ B | α : A

λx.µβ.[α]x : [[A]→B] | α : A

y : [[[A]→B]→A] ` y(λx.µβ.[α]x) : A | α : A

y : [[[A]→B]→A] ` [α]y(λx.µβ.[α]x) : # | α : 〈A,A〉y : [[[A]→B]→A] ` µα.[α]y(λx.µβ.[α]x) : 〈A,A〉 |` λy.µα.[α]y(λx.µβ.[α]x) : [[[A]→B]→A]→ 〈A,A〉 |

Non-idempotent typing operators P. Vial 6 Conclusion 48 /46

Page 215: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Infinite formulas are unsound

Let A be any formula.We then set RA := (((. . .)→ A)→ A)→ A i.e. RA = RA → A.

x :

RA `

x :

RA

i.e. RA → A x :

RA `

x :

RA

x :

RA `

xx :

A

`

λx.x x :

RA → A

i.e. RA

RA ` RA RA ` RARA ` A

`

λx.x x :

RA

`

Ω :

A

Non-idempotent typing operators P. Vial 6 Conclusion 49 /46

Page 216: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Infinite formulas are unsound

Let A be any formula.We then set RA := (((. . .)→ A)→ A)→ A i.e. RA = RA → A.

x :

RA `

x :

RA i.e. RA → A

x :

RA `

x :

RA

x :

RA `

xx :

A

`

λx.x x :

RA → A i.e. RA

RA ` RA RA ` RARA ` A

`

λx.x x :

RA

`

Ω :

A

Non-idempotent typing operators P. Vial 6 Conclusion 49 /46

Page 217: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Infinite formulas are unsound

Let A be any formula.We then set RA := (((. . .)→ A)→ A)→ A i.e. RA = RA → A.

x :

RA `

x :

RA

i.e. RA → A x :

RA `

x :

RA

x :

RA `

xx :

A

`

λx.x x :

RA → A

i.e. RA

RA ` RA RA ` RARA ` A

`

λx.x x :

RA

`

Ω :

A

Non-idempotent typing operators P. Vial 6 Conclusion 49 /46

Page 218: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Infinite formulas are unsound

Let A be any formula.We then set RA := (((. . .)→ A)→ A)→ A i.e. RA = RA → A.

x :RA ` x :RA

i.e. RA → A

x :RA ` x :RA

x :RA ` xx :A

` λx.x x :RA → A

i.e. RA

RA ` RA RA ` RARA ` A

` λx.x x :RA

` Ω :A

Non-idempotent typing operators P. Vial 6 Conclusion 49 /46

Page 219: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Truncation (Figures)

Γ = f : [[o]→ o]ω (infinite multiplicity)

Π′ B Γ ` fω : o

Every Variableis Typed

[o]→ o

o

[o]→ o[ ]→ o

o

[o]→ o

o

[o]→ o

o

[o]→ o

o

f

@f

@f

@f

@f

@

Non-idempotent typing operators P. Vial 6 Conclusion 50 /46

Page 220: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Truncation (Figures)

Π′ B f : [[o]→ o]ω ` fω : o can be truncated into Π′4[o]→ o

o

[o]→ o

o

[o]→ o

o

[o]→ o

o

[o]→ o

o

f

@f

@f

@f

@f

@

Non-idempotent typing operators P. Vial 6 Conclusion 50 /46

Page 221: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Truncation (Figures)

Π′ B f : [[o]→ o]ω ` fω : o can be truncated into Π′4[o]→ o

o

[o]→ o

o

[o]→ o

o

[o]→ o

o

[o]→ o

o

f

@f

@f

@f

@f

@

Non-idempotent typing operators P. Vial 6 Conclusion 50 /46

Page 222: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Truncation (Figures)

Π′ B f : [[o]→ o]ω ` fω : o can be truncated into Π′4

[ ]→ o

o

[o]→ o

o

[o]→ o

o

[o]→ o

o

f

@f

@f

@f

@f

@

Non-idempotent typing operators P. Vial 6 Conclusion 50 /46

Page 223: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Truncation (Figures)

Π′ B f : [[o]→ o]ω ` fω : o can be truncated into Π′3

[ ]→ o

oo

[o]→ o

o

[o]→ o

o

[o]→ o

o

f

@f

@f

@f

@f

@

Non-idempotent typing operators P. Vial 6 Conclusion 50 /46

Page 224: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Truncation (Figures)

Π′ B f : [[o]→ o]ω ` fω : o can be truncated into Π′3

[ ]→ o

o

[o]→ o

o

[o]→ o

o

f

@f

@f

@f

@f

@

Non-idempotent typing operators P. Vial 6 Conclusion 50 /46

Page 225: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Truncation (Figures)

fω may be replaced by f3(∆f∆f ) in Π′3,yielding Π3

3 :

[ ]→ o

o

[o]→ o

o

[o]→ o

o

f

@f

@f

@f

@f

@

Non-idempotent typing operators P. Vial 6 Conclusion 50 /46

Page 226: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Truncation (Figures)

fω may be replaced by f3(∆f∆f ) in Π′3,yielding Π3

3 :

[ ]→ o

o

[o]→ o

o

[o]→ o

o

∆f∆f

f

@f

@f

@

Non-idempotent typing operators P. Vial 6 Conclusion 50 /46

Page 227: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Truncation (Figures)

Π33 may be expanded 3 times,

yielding Π3 B∆f∆f :

[ ]→ o

o

[o]→ o

o

[o]→ o

o

∆f∆f

f

@f

@f

@

Non-idempotent typing operators P. Vial 6 Conclusion 50 /46

Page 228: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Truncation (Figures)

Back to Π′4, level 4 truncation of Π′ :

[ ]→ o

o

[o]→ o

o

[o]→ o

o

[o]→ o

o

f

@f

@f

@f

@f

@

Non-idempotent typing operators P. Vial 6 Conclusion 50 /46

Page 229: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Truncation (Figures)

fω may be replaced by f4(∆f∆f ) in Π′3,yielding Π4

4 :

[ ]→ o

o

[o]→ o

o

[o]→ o

o

[o]→ o

o

f

@f

@f

@f

@f

@

Non-idempotent typing operators P. Vial 6 Conclusion 50 /46

Page 230: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Truncation (Figures)

fω may be replaced by f4(∆f∆f ) in Π′3,yielding Π4

4 :

[ ]→ o

o

[o]→ o

o

[o]→ o

o

[o]→ o

o

∆f∆f

f

@f

@f

@f

@

Non-idempotent typing operators P. Vial 6 Conclusion 50 /46

Page 231: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Truncation (Figures)

Π44 may be expanded 4 times,

yielding Π4 B∆f∆f :

[ ]→ o

o

[o]→ o

o

[o]→ o

o

[o]→ o

o

∆f∆f

f

@f

@f

@f

@

Non-idempotent typing operators P. Vial 6 Conclusion 50 /46

Page 232: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Truncation (Figures)

Initial derivation (inf. term, inf.deriv.)

Truncation (inf t., f. deriv.)

Subject subst. (fin. t., fin. d.)

Expansion ( Yf is typed)

Take the join for all trunc.

[o]→ o

o

[o]→ o

o

[o]→ o

o

[o]→ o

o

[o]→ o

o

f

@f

@f

@f

@f

@

Non-idempotent typing operators P. Vial 6 Conclusion 50 /46

Page 233: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Truncation (Figures)

Initial derivation (inf. term, inf.deriv.)

Truncation (inf t., f. deriv.)

Subject subst. (fin. t., fin. d.)

Expansion ( Yf is typed)

Take the join for all trunc.

[ ]→ o

o

[o]→ o

o

[o]→ o

o

f

@f

@f

@f

@f

@

Non-idempotent typing operators P. Vial 6 Conclusion 50 /46

Page 234: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Truncation (Figures)

Initial derivation (inf. term, inf.deriv.)

Truncation (inf t., f. deriv.)

Subject subst. (fin. t., fin. d.)

Expansion ( Yf is typed)

Take the join for all trunc.

[ ]→ o

o

[o]→ o

o

[o]→ o

o

∆f∆f

f

@f

@f

@

Non-idempotent typing operators P. Vial 6 Conclusion 50 /46

Page 235: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Truncation (Figures)

Initial derivation (inf. term, inf.deriv.)

Truncation (inf t., f. deriv.)

Subject subst. (fin. t., fin. d.)

Expansion ( Yf is typed)

Take the join for all trunc.

[ ]→ o

o

[o]→ o

o

[o]→ o

o

∆f∆f

f

@f

@f

@

Non-idempotent typing operators P. Vial 6 Conclusion 50 /46

Page 236: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Truncation (Figures)

Initial derivation (inf. term, inf.deriv.)

Truncation (inf t., f. deriv.)

Subject subst. (fin. t., fin. d.)

Expansion ( Yf is typed)

Take the join for all trunc.

[ ]→ o

o

[o]→ o

o

[o]→ o

o

∆f∆f

f

@f

@f

@

Non-idempotent typing operators P. Vial 6 Conclusion 50 /46

Page 237: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Support candidates

What is a correct type ?

14

138

Support:ε, 1, 4, 4·1, 4·3, 4·8

14

3

Support:ε, 1, 4, 4·3

Support candidate: a set of positions that is the support of a type

c·k→t1 c (a candidate supp is a tree)

c·k→t2 c·1 (if a node does not have a 1-child, it is a leaf)

Lemma: Let C ⊆ N∗. Then ∃T type, C = supp(T ) iff C 6= ∅ and Cstable under→t1,→t2.

Non-idempotent typing operators P. Vial 6 Conclusion 51 /46

Page 238: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Support candidates

What is a correct type ?

o1

o1

4

→ 1

→3

o1o3

8

Wrong Labels

Support:ε, 1, 4, 4·1, 4·3, 4·8

o1

o1

4

→3

o1

Support:ε, 1, 4, 4·3

Support candidate: a set of positions that is the support of a type

c·k→t1 c (a candidate supp is a tree)

c·k→t2 c·1 (if a node does not have a 1-child, it is a leaf)

Lemma: Let C ⊆ N∗. Then ∃T type, C = supp(T ) iff C 6= ∅ and Cstable under→t1,→t2.

Non-idempotent typing operators P. Vial 6 Conclusion 51 /46

Page 239: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Support candidates

What is a correct type ?

→ 1

o1

4

→ 1

o2

3

o1o3

8

Correct Labels

Support:ε, 1, 4, 4·1, 4·3, 4·8

Type: (4 · (8·o3, 3·o1)→ o2)→ o1

→ 1

o1

4

→3

o1

Support:ε, 1, 4, 4·3

Support candidate: a set of positions that is the support of a type

c·k→t1 c (a candidate supp is a tree)

c·k→t2 c·1 (if a node does not have a 1-child, it is a leaf)

Lemma: Let C ⊆ N∗. Then ∃T type, C = supp(T ) iff C 6= ∅ and Cstable under→t1,→t2.

Non-idempotent typing operators P. Vial 6 Conclusion 51 /46

Page 240: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Support candidates

What is a correct type ?

14

138

Support:ε, 1, 4, 4·1, 4·3, 4·8

14

3

Support:ε, 1, 4, 4·3

Support candidate: a set of positions that is the support of a type

c·k→t1 c (a candidate supp is a tree)

c·k→t2 c·1 (if a node does not have a 1-child, it is a leaf)

Lemma: Let C ⊆ N∗. Then ∃T type, C = supp(T ) iff C 6= ∅ and Cstable under→t1,→t2.

Non-idempotent typing operators P. Vial 6 Conclusion 51 /46

Page 241: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Support candidates

What is a correct type ?

14

138

Support:ε, 1, 4, 4·1, 4·3, 4·8

14

3

Wrong Support

Support:ε, 1, 4, 4·3

Support candidate: a set of positions that is the support of a type

c·k→t1 c (a candidate supp is a tree)

c·k→t2 c·1 (if a node does not have a 1-child, it is a leaf)

Lemma: Let C ⊆ N∗. Then ∃T type, C = supp(T ) iff C 6= ∅ and Cstable under→t1,→t2.

Non-idempotent typing operators P. Vial 6 Conclusion 51 /46

Page 242: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Support candidates

What is a correct type ?

14

138

Support:ε, 1, 4, 4·1, 4·3, 4·8

14

3

Support:ε, 1, 4, 4·3

Support candidate: a set of positions that is the support of a type

c·k→t1 c (a candidate supp is a tree)

c·k→t2 c·1 (if a node does not have a 1-child, it is a leaf)

Lemma: Let C ⊆ N∗. Then ∃T type, C = supp(T ) iff C 6= ∅ and Cstable under→t1,→t2.

Non-idempotent typing operators P. Vial 6 Conclusion 51 /46

Page 243: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Support candidates

What is a correct type ?

14

138

Support:ε, 1, 4, 4·1, 4·3, 4·8

14

3

Support:ε, 1, 4, 4·3

Support candidate: a set of positions that is the support of a type

c·k→t1 c (a candidate supp is a tree)

c·k→t2 c·1 (if a node does not have a 1-child, it is a leaf)

Lemma: Let C ⊆ N∗. Then ∃T type, C = supp(T ) iff C 6= ∅ and Cstable under→t1,→t2.

Non-idempotent typing operators P. Vial 6 Conclusion 51 /46

Page 244: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Bisupport Candidates

We want to show that every term t is typable in S.

Idea: we try to capture the notion of bisupport candidate: a set of pointersthat is the bisupport of a S-derivation typing t and have a proposition of theform:

Proposition: let t be a term and B a set of bipositions. Then,∃P derivation, B = bisupp(P ) iff B 6= ∅ and B stable under →1, →2, →3,. . . [see

Prop. 12.3, p. 260]

We must find suitable stability conditions.

Then, we show that there is actually a non-empty set that satisfies them.

Non-idempotent typing operators P. Vial 6 Conclusion 52 /46

Page 245: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Bisupport Candidates

We want to show that every term t is typable in S.

Idea: we try to capture the notion of bisupport candidate: a set of pointersthat is the bisupport of a S-derivation typing t and have a proposition of theform:

Proposition: let t be a term and B a set of bipositions. Then,∃P derivation, B = bisupp(P ) iff B 6= ∅ and B stable under →1, →2, →3,. . . [see

Prop. 12.3, p. 260]

We must find suitable stability conditions.

Then, we show that there is actually a non-empty set that satisfies them.

Non-idempotent typing operators P. Vial 6 Conclusion 52 /46

Page 246: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Bisupport Candidates

We want to show that every term t is typable in S.

Idea: we try to capture the notion of bisupport candidate: a set of pointersthat is the bisupport of a S-derivation typing t and have a proposition of theform:

Proposition: let t be a term and B a set of bipositions. Then,∃P derivation, B = bisupp(P ) iff B 6= ∅ and B stable under →1, →2, →3,. . . [see

Prop. 12.3, p. 260]

We must find suitable stability conditions.

Then, we show that there is actually a non-empty set that satisfies them.

Non-idempotent typing operators P. Vial 6 Conclusion 52 /46

Page 247: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Bisupport Candidates

We want to show that every term t is typable in S.

Idea: we try to capture the notion of bisupport candidate: a set of pointersthat is the bisupport of a S-derivation typing t and have a proposition of theform:

Proposition: let t be a term and B a set of bipositions. Then,∃P derivation, B = bisupp(P ) iff B 6= ∅ and B stable under →1, →2, →3,. . . [see

Prop. 12.3, p. 260]

We must find suitable stability conditions.

Then, we show that there is actually a non-empty set that satisfies them.

Non-idempotent typing operators P. Vial 6 Conclusion 52 /46

Page 248: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Guidelines of the proof

Reduce the problem (“every term is S-typable”) to a parametrized first ordertheory Tt (t ∈ Λ).

Establish a “completeness-like” property:

Prop.: let t ∈ Λ. Then t is S-typable iff Tt is consistent.

How do we prove that Tt cannot be contradictory?

1 Assume ad absurdum that Tt is contradictory for some t. Then, there is a finiteproof C (standing for chain) that Tt is contradictory.

2 If C “visits” redexes, C is not decypherable. But we cannot eliminate redexes in allgenerality (e.g., in mute terms). What can we do?

3 Fundamental idea: There is a finite reduction strategy (called the collapsingstrategy) t→ t′ such that C can be residuated into a chain C′ of t′ that does notinteract with redex (C′ is called a normal chain).

4 We prove that C′ cannot exist. So C does not either i.e. there is not proof ofcontradiction.

5 Thus, Tt is consistent!

Remark: works for the infinitary λ-calculus!

Non-idempotent typing operators P. Vial 6 Conclusion 53 /46

Page 249: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Guidelines of the proof

Reduce the problem (“every term is S-typable”) to a parametrized first ordertheory Tt (t ∈ Λ).

Establish a “completeness-like” property:

Prop.: let t ∈ Λ. Then t is S-typable iff Tt is consistent.

How do we prove that Tt cannot be contradictory?1 Assume ad absurdum that Tt is contradictory for some t. Then, there is a finite

proof C (standing for chain) that Tt is contradictory.

2 If C “visits” redexes, C is not decypherable. But we cannot eliminate redexes in allgenerality (e.g., in mute terms). What can we do?

3 Fundamental idea: There is a finite reduction strategy (called the collapsingstrategy) t→ t′ such that C can be residuated into a chain C′ of t′ that does notinteract with redex (C′ is called a normal chain).

4 We prove that C′ cannot exist. So C does not either i.e. there is not proof ofcontradiction.

5 Thus, Tt is consistent!

Remark: works for the infinitary λ-calculus!

Non-idempotent typing operators P. Vial 6 Conclusion 53 /46

Page 250: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Guidelines of the proof

Reduce the problem (“every term is S-typable”) to a parametrized first ordertheory Tt (t ∈ Λ).

Establish a “completeness-like” property:

Prop.: let t ∈ Λ. Then t is S-typable iff Tt is consistent.

How do we prove that Tt cannot be contradictory?1 Assume ad absurdum that Tt is contradictory for some t. Then, there is a finite

proof C (standing for chain) that Tt is contradictory.

2 If C “visits” redexes, C is not decypherable. But we cannot eliminate redexes in allgenerality (e.g., in mute terms). What can we do?

3 Fundamental idea: There is a finite reduction strategy (called the collapsingstrategy) t→ t′ such that C can be residuated into a chain C′ of t′ that does notinteract with redex (C′ is called a normal chain).

4 We prove that C′ cannot exist. So C does not either i.e. there is not proof ofcontradiction.

5 Thus, Tt is consistent!

Remark: works for the infinitary λ-calculus!

Non-idempotent typing operators P. Vial 6 Conclusion 53 /46

Page 251: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Guidelines of the proof

Reduce the problem (“every term is S-typable”) to a parametrized first ordertheory Tt (t ∈ Λ).

Establish a “completeness-like” property:

Prop.: let t ∈ Λ. Then t is S-typable iff Tt is consistent.

How do we prove that Tt cannot be contradictory?1 Assume ad absurdum that Tt is contradictory for some t. Then, there is a finite

proof C (standing for chain) that Tt is contradictory.

2 If C “visits” redexes, C is not decypherable. But we cannot eliminate redexes in allgenerality (e.g., in mute terms). What can we do?

3 Fundamental idea: There is a finite reduction strategy (called the collapsingstrategy) t→ t′ such that C can be residuated into a chain C′ of t′ that does notinteract with redex (C′ is called a normal chain).

4 We prove that C′ cannot exist. So C does not either i.e. there is not proof ofcontradiction.

5 Thus, Tt is consistent!

Remark: works for the infinitary λ-calculus!

Non-idempotent typing operators P. Vial 6 Conclusion 53 /46

Page 252: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Order

Theorem (complete unsoundness): in R, every term is typable.[Th 12.1, p. 276]

Theorem: if t is a zero-term, then, t is typable with o.[Th 12.2, p. 276]

Definition (relational model): For all closed λ-term t, we set

[[t]] = τ | ` t : τ is derivable

Corollary: This yields a non-sensible model that discriminates terms according totheir order:

if t and u are two terms of different orders, then [[t]] 6= [[u]].

First model to do this!

Non-idempotent typing operators P. Vial 6 Conclusion 54 /46

Page 253: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Order

Theorem (complete unsoundness): in R, every term is typable.[Th 12.1, p. 276]

Theorem: if t is a zero-term, then, t is typable with o.[Th 12.2, p. 276]

Definition (relational model): For all closed λ-term t, we set

[[t]] = τ | ` t : τ is derivable

Corollary: This yields a non-sensible model that discriminates terms according totheir order:

if t and u are two terms of different orders, then [[t]] 6= [[u]].

First model to do this!

Non-idempotent typing operators P. Vial 6 Conclusion 54 /46

Page 254: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Order

Theorem (complete unsoundness): in R, every term is typable.[Th 12.1, p. 276]

Theorem: if t is a zero-term, then, t is typable with o.[Th 12.2, p. 276]

Definition (relational model): For all closed λ-term t, we set

[[t]] = τ | ` t : τ is derivable

Corollary: This yields a non-sensible model that discriminates terms according totheir order:

if t and u are two terms of different orders, then [[t]] 6= [[u]].

First model to do this!

Non-idempotent typing operators P. Vial 6 Conclusion 54 /46

Page 255: Non-Idempotent Typing Operators, beyond the -Calculus ...pvial/phd-def-vial.pdf · Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal.

Order

Theorem (complete unsoundness): in R, every term is typable.[Th 12.1, p. 276]

Theorem: if t is a zero-term, then, t is typable with o.[Th 12.2, p. 276]

Definition (relational model): For all closed λ-term t, we set

[[t]] = τ | ` t : τ is derivable

Corollary: This yields a non-sensible model that discriminates terms according totheir order:

if t and u are two terms of different orders, then [[t]] 6= [[u]].

First model to do this!

Non-idempotent typing operators P. Vial 6 Conclusion 54 /46