Non-Idempotent Typing Operators, beyond the λ-calculus

Similar documents
Categories, Proofs and Programs

Command = Value Context. Hans-Dieter Hiep. 15th of June, /17

Henk Barendregt and Freek Wiedijk assisted by Andrew Polonsky. Radboud University Nijmegen. March 5, 2012

Call-by-value non-determinism in a linear logic type discipline

Decision Problems with TM s. Lecture 31: Halting Problem. Universe of discourse. Semi-decidable. Look at following sets: CSCI 81 Spring, 2012

Kleene realizability and negative translations

Introduction to Intuitionistic Logic

Decidability: Church-Turing Thesis

Introduction to lambda calculus Part 2

A call-by-name lambda-calculus machine

Komponenten- und Service-orientierte Softwarekonstruktion

NICTA Advanced Course. Theorem Proving Principles, Techniques, Applications

Type Systems. Lecture 2 Oct. 27th, 2004 Sebastian Maneth.

Constructive approach to relevant and affine term calculi

Type Systems. Today. 1. What is the Lambda Calculus. 1. What is the Lambda Calculus. Lecture 2 Oct. 27th, 2004 Sebastian Maneth

COMP6463: λ-calculus

Introduction to Turing Machines

Most General computer?

Beyond First-Order Logic

Models. Models of Computation, Turing Machines, and the Limits of Turing Computation. Effective Calculability. Motivation for Models of Computation

Informal Statement Calculus

Type Theory and Constructive Mathematics. Type Theory and Constructive Mathematics Thierry Coquand. University of Gothenburg

3 Propositional Logic

From pre-models to models

V Honors Theory of Computation

Structuring Logic with Sequent Calculus

cis32-ai lecture # 18 mon-3-apr-2006

Rules and derivations in an elementary logic course arxiv: v1 [cs.lo] 7 Jan 2016

Propositional and Predicate Logic. jean/gbooks/logic.html

Lecture 14 Rosser s Theorem, the length of proofs, Robinson s Arithmetic, and Church s theorem. Michael Beeson

Peano Arithmetic. CSC 438F/2404F Notes (S. Cook) Fall, Goals Now

Turing Machines. Lecture 8

On a computational interpretation of sequent calculus for modal logic S4

Consequence Relations and Natural Deduction

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig

CS20a: Turing Machines (Oct 29, 2002)

Completeness and Partial Soundness Results for Intersection & Union Typing for λµ µ

1. each λ-variable is a λρ-term, called atom or atomic term, 2. if M and N are λρ-term then (MN) is a λρ-term called application,

Lazy Strong Normalization

Evaluation Driven Proof-Search in Natural Deduction Calculi for Intuitionistic Propositional Logic

Computability Theory. CS215, Lecture 6,

CS 4110 Programming Languages & Logics. Lecture 16 Programming in the λ-calculus

Gödel s Incompleteness Theorem. Overview. Computability and Logic

Propositional Logic: Syntax

CSCI 490 problem set 6

Safety Analysis versus Type Inference

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Relational Graph Models, Taylor Expansion and Extensionality

Logic. Propositional Logic: Syntax

Propositional Logic Language

Deriving natural deduction rules from truth tables (Extended version)

Part III Logic. Theorems. Based on lectures by T. E. Forster Notes taken by Dexter Chua. Lent 2017

Alonzo Church ( ) Lambda Calculus. λ-calculus : syntax. Grammar for terms : Inductive denition for λ-terms

Grammatical resources: logic, structure and control

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Silvia Ghilezan and Jelena Ivetić

Introduction to λ-calculus

The duality of computation

Programming Language Concepts: Lecture 16

Typed Arithmetic Expressions

Turing Machine Recap

What is logic, the topic of this course? There are at least two answers to that question.

This is logically equivalent to the conjunction of the positive assertion Minimal Arithmetic and Representability

Logic: The Big Picture

Lecture notes on Turing machines

Non deterministic classical logic: the λµ ++ -calculus

Type Systems Winter Semester 2006

Origin in Mathematical Logic

Propositions as Types

Decidable Subsets of CCS

Intersection Synchronous Logic

Handbook of Logic and Proof Techniques for Computer Science

What are the recursion theoretic properties of a set of axioms? Understanding a paper by William Craig Armando B. Matos

Realisability methods of proof and semantics with application to expansion

Static Program Analysis

Consequence Relations and Natural Deduction

The Calculus of Inductive Constructions

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

Review. Principles of Programming Languages. Equality. The Diamond Property. The Church-Rosser Theorem. Corollaries. CSE 230: Winter 2007

Concrete Models for Classical Realizability

Lambda Calculus. Andrés Sicard-Ramírez. Semester Universidad EAFIT

Realizing the axiom of dependent choice

Proving Completeness for Nested Sequent Calculi 1

CS 275 Automata and Formal Language Theory

Računske interpretacije intuicionističke i klasične logike

Cogito ergo sum non machina!

Theory of Computation (IX) Yijia Chen Fudan University

Introduction to Turing Machines. Reading: Chapters 8 & 9

The Lambda Calculus. Stephen A. Edwards. Fall Columbia University

Natural Deduction for Propositional Logic

1.3. BASIC COMPUTER SCIENCE PREREQUISITES 15

Lambda-Calculus (cont): Fixpoints, Naming. Lecture 10 CS 565 2/10/08

CPSC 421: Tutorial #1

Subtyping and Intersection Types Revisited

Predicate Logic - Undecidability

On the Complexity of the Reflected Logic of Proofs

A Note on Turing Machine Design

Syllogistic Logic and its Extensions

An introduction to classical realizability

α-recursion Theory and Ordinal Computability

Transcription:

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

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") Non-idempotent typing operators P. Vial 1 Presentation 2 /46

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 Non-idempotent typing operators P. Vial 1 Presentation 2 /46

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 Non-idempotent typing operators P. Vial 1 Presentation 2 /46

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 Non-idempotent typing operators P. Vial 1 Presentation 2 /46

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 Non-idempotent typing operators P. Vial 1 Presentation 2 /46

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 =... Non-idempotent typing operators P. Vial 1 Presentation 2 /46

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 Non-idempotent typing operators P. Vial 1 Presentation 2 /46

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 =... Non-idempotent typing operators P. Vial 1 Presentation 2 /46

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 = Non-idempotent typing operators P. Vial 1 Presentation 2 /46

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). Non-idempotent typing operators P. Vial 1 Presentation 2 /46

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) Non-idempotent typing operators P. Vial 1 Presentation 2 /46

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

Formal logic (valar morghulis) All men are mortal. Socrates is a man. Therefore, Socrates is mortal. on-idempotent typing operators P. Vial 1 Presentation 3 /46

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. on-idempotent typing operators P. Vial 1 Presentation 3 /46

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. on-idempotent typing operators P. Vial 1 Presentation 3 /46

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) M (S) H (S) on-idempotent typing operators P. Vial 1 Presentation 3 /46

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) M (S) H (S) on-idempotent typing operators P. Vial 1 Presentation 3 /46

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) M (S) H (S) on-idempotent typing operators P. Vial 1 Presentation 3 /46

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) M (S) H (S) on-idempotent typing operators P. Vial 1 Presentation 3 /46

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) M (S) H (S) Formalization Reduce semantic (= meaning) to mechanical/grammatical/syntactic rules. on-idempotent typing operators P. Vial 1 Presentation 3 /46

Turing and computability Entscheidung (1928): given a symbolic statement, is there an algorithmic procedure to decide whether it is true or not? Non-idempotent typing operators P. Vial 1 Presentation 4 /46

Turing and computability Entscheidung (1928): given a symbolic statement, is there an algorithmic procedure to decide whether it is true or not? Gödel, 1931: unprovable statements Non-idempotent typing operators P. Vial 1 Presentation 4 /46

Turing and computability Entscheidung (1928): given a symbolic statement, is there an algorithmic procedure to decide whether it is true or not? Gödel, 1931: unprovable statements Provable True Non-idempotent typing operators P. Vial 1 Presentation 4 /46

Turing and computability Entscheidung (1928): given a symbolic statement, is there an algorithmic procedure to decide whether it is true or not? Gödel, 1931: unprovable statements Provable True primitive recursive functions (poor) Non-idempotent typing operators P. Vial 1 Presentation 4 /46

Turing and computability Entscheidung (1928): given a symbolic statement, is there an algorithmic procedure to decide whether it is true or not? Gödel, 1931: unprovable statements Provable True primitive recursive functions (poor) Can computation save mathematics? Non-idempotent typing operators P. Vial 1 Presentation 4 /46

Turing and computability Entscheidung (1928): given a symbolic statement, is there an algorithmic procedure to decide whether it is true or not? Gödel, 1931: unprovable statements primitive recursive functions (poor) Provable True Can computation save mathematics? What is an algo.? What is effectively computable? Non-idempotent typing operators P. Vial 1 Presentation 4 /46

Turing and computability Entscheidung (1928): given a symbolic statement, is there an algorithmic procedure to decide whether it is true or not? Gödel, 1931: unprovable statements primitive recursive functions (poor) Provable True Can computation save mathematics? What is an algo.? What is effectively computable? Turing machines (1936) TM are universal f effectively computable iff f implementable in a TM A prog. language L is Turing-complete if L has the same computational power as TMs. Non-idempotent typing operators P. Vial 1 Presentation 4 /46

Turing and computability Entscheidung (1928): given a symbolic statement, is there an algorithmic procedure to decide whether it is true or not? Non-idempotent typing operators P. Vial 1 Presentation 4 /46

Turing and computability Entscheidung (1928): given a symbolic statement, is there an algorithmic procedure to decide whether it is true or not? Theorem (Turing, 1936) The Entscheidungsproblem has a negative answer The halting problem is undecidable: there does not exist a general method deciding whether any program terminates or not. Non-idempotent typing operators P. Vial 1 Presentation 4 /46

Computation as rewriting The λ-calculus One primitive. Functional paradigm. Turing complete. Allows to emulate many rewriting systems e.g.: Non-idempotent typing operators P. Vial 1 Presentation 5 /46

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. Non-idempotent typing operators P. Vial 1 Presentation 5 /46

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 + S m S n + m (inductive case) Non-idempotent typing operators P. Vial 1 Presentation 5 /46

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 + S m S n + m (inductive case) Non-idempotent typing operators P. Vial 1 Presentation 5 /46

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 + S m S n + 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 Non-idempotent typing operators P. Vial 1 Presentation 5 /46

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 + S m S n + 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 Non-idempotent typing operators P. Vial 1 Presentation 5 /46

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 + S m S n + 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 Non-idempotent typing operators P. Vial 1 Presentation 5 /46

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 + S m S n + 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 Non-idempotent typing operators P. Vial 1 Presentation 5 /46

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 + S m S n + 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 Most structures (tabs, strings, pair of integers) can be implemented in this fashion or in the λ-calculus. Non-idempotent typing operators P. Vial 1 Presentation 5 /46

λ-calcul (Church, 1928) Term construction (inductive grammar) t t u x x Variable λx λx.t Abstraction t u Application Non-idempotent typing operators P. Vial 1 Presentation 6 /46

λ-calcul (Church, 1928) Term construction (inductive grammar) t t u x λx x y x Variable λx.t Abstraction t u Application x λy Example: x(λy.x y) Non-idempotent typing operators P. Vial 1 Presentation 6 /46

λ-calcul (Church, 1928) Term construction (inductive grammar) t t u x x Variable λx λx.t Abstraction t u Application Redex (reducible expression): computation via substitution producing a reduct Non-idempotent typing operators P. Vial 1 Presentation 6 /46

λ-calcul (Church, 1928) Redex: (λx.r)s Term construction (inductive grammar) t t u r x λx x Variable λx.t Abstraction t u Application λx s Redex (reducible expression): computation via substitution producing a reduct Non-idempotent typing operators P. Vial 1 Presentation 6 /46

λ-calcul (Church, 1928) Redex: (λx.r)s Term construction (inductive grammar) t t u x r x λx x x x Variable λx.t Abstraction t u Application λx s Redex (reducible expression): computation via substitution producing a reduct Non-idempotent typing operators P. Vial 1 Presentation 6 /46

λ-calcul (Church, 1928) Term construction (inductive grammar) t t u x r x λx x x x Variable λx.t Abstraction t u Application λx s Redex (reducible expression): computation via substitution producing a reduct Non-idempotent typing operators P. Vial 1 Presentation 6 /46

λ-calcul (Church, 1928) Reduct: r[s/x] Term construction (inductive grammar) t t u s s r s x x Variable λx λx.t Abstraction t u Application Redex (reducible expression): computation via substitution producing a reduct Non-idempotent typing operators P. Vial 1 Presentation 6 /46

Higher-order functions and their (possible) dangers Let app 2 (f, x) := f(f(x)). app 2 takes a function f as an argument. app 2 is a higher-order function. on-idempotent typing operators P. Vial 1 Presentation 7 /46

Higher-order functions and their (possible) dangers Let app 2 (f, x) := f(f(x)). app 2 takes a function f as an argument. app 2 is a higher-order function. Autoapplication is defined by: autoapp(f) f(f) on-idempotent typing operators P. Vial 1 Presentation 7 /46

Higher-order functions and their (possible) dangers Let app 2 (f, x) := f(f(x)). app 2 takes a function f as an argument. app 2 is a higher-order function. Autoapplication is defined by: autoapp(f) f(f) on-idempotent typing operators P. Vial 1 Presentation 7 /46

Higher-order functions and their (possible) dangers Let app 2 (f, x) := f(f(x)). app 2 takes a function f as an argument. app 2 is a higher-order function. Autoapplication is defined by: Auto-autoapplication: autoapp(autoapp) autoapp(f) f(f) Non-idempotent typing operators P. Vial 1 Presentation 7 /46

Higher-order functions and their (possible) dangers Let app 2 (f, x) := f(f(x)). app 2 takes a function f as an argument. app 2 is a higher-order function. Autoapplication is defined by: Auto-autoapplication: autoapp(f) f(f) autoapp(autoapp) autoapp(autoapp) Non-idempotent typing operators P. Vial 1 Presentation 7 /46

Higher-order functions and their (possible) dangers Let app 2 (f, x) := f(f(x)). app 2 takes a function f as an argument. app 2 is a higher-order function. Autoapplication is defined by: Auto-autoapplication: autoapp(f) f(f) autoapp(autoapp) autoapp(autoapp) autoapp(autoapp) Non-idempotent typing operators P. Vial 1 Presentation 7 /46

Higher-order functions and their (possible) dangers Let app 2 (f, x) := f(f(x)). app 2 takes a function f as an argument. app 2 is a higher-order function. Autoapplication is defined by: Auto-autoapplication: autoapp(f) f(f) autoapp(autoapp) autoapp(autoapp) autoapp(autoapp) autoapp(autoapp) Non-idempotent typing operators P. Vial 1 Presentation 7 /46

Higher-order functions and their (possible) dangers Let app 2 (f, x) := f(f(x)). app 2 takes a function f as an argument. app 2 is a higher-order function. Autoapplication is defined by: Auto-autoapplication: autoapp(f) f(f) autoapp(autoapp) autoapp(autoapp) autoapp(autoapp) autoapp(autoapp)..................... Non-idempotent typing operators P. Vial 1 Presentation 7 /46

Higher-order functions and their (possible) dangers Let app 2 (f, x) := f(f(x)). app 2 takes a function f as an argument. app 2 is a higher-order function. Autoapplication is defined by: Auto-autoapplication: Remember autoapp(f) f(f) autoapp(autoapp) autoapp(autoapp) autoapp(autoapp) autoapp(autoapp)..................... 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). Non-idempotent typing operators P. Vial 1 Presentation 7 /46

Higher-order functions and their (possible) dangers Let app 2 (f, x) := f(f(x)). app 2 takes a function f as an argument. app 2 is a higher-order function. Autoapplication is defined by: Auto-autoapplication: Remember autoapp(f) f(f) autoapp(autoapp) autoapp(autoapp) autoapp(autoapp) autoapp(autoapp)..................... 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

Terminal states and execution/reduction strategies 2 + 3 5 }{{} 2 + 15 }{{} 17 Reducible (non-terminal) states Terminal state Non-idempotent typing operators P. Vial 1 Presentation 8 /46

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)? on-idempotent typing operators P. Vial 1 Presentation 8 /46

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

Terminal states and execution/reduction strategies 2 + 3 5 }{{} 2 + 15 }{{} 17 Reducible (non-terminal) states Terminal state Non-idempotent typing operators P. Vial 1 Presentation 8 /46

Terminal states and execution/reduction strategies Non-idempotent typing operators P. Vial 1 Presentation 8 /46

Terminal states and execution/reduction strategies Initial state Terminal state Infinite path (keeps running, never reaches the terminal state) on-idempotent typing operators P. Vial 1 Presentation 8 /46

Terminal states and execution/reduction strategies Reduction strategy 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. on-idempotent typing operators P. Vial 1 Presentation 8 /46

Types Principle Types = data descriptors, following a grammar. Types provide certifications of correction. Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Types Principle Types = data descriptors, following a grammar. Types provide certifications of correction. Primitive types: 5: int (integer) Leopard : String (string of characters) Non-idempotent typing operators P. Vial 1 Presentation 9 /46

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) Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Types Principle Types = data descriptors, following a grammar. Types provide certifications of correction. Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Types Principle Types = data descriptors, following a grammar. Types provide certifications of correction. Example Let toletters : int String be the program: toletters(2) = two toletters(10) = ten Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Types Principle Types = data descriptors, following a grammar. Types provide certifications of correction. Example Let toletters : int String be the program: toletters(2) = two toletters(10) = ten toletters(5) toletters( Leopard ) Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Types Principle Types = data descriptors, following a grammar. Types provide certifications of correction. 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. Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Types toletters(5) Correct! Returns five toletters( Leopard ) Incorrect! The arg. Leopard is not an int. Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Types toletters : int String toletters(5) : String Typing certificate 5 : int toletters(5) Correct! Returns five toletters( Leopard ) Incorrect! The arg. Leopard is not an int. Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Types toletters : int String toletters(5) : String 5 : int A B B A Typing certificate Proof toletters(5) Correct! Returns five toletters( Leopard ) Incorrect! The arg. Leopard is not an int. Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Types int String String int A B B A Typing certificate Proof toletters(5) Correct! Returns five toletters( Leopard ) Incorrect! The arg. Leopard is not an int. Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Types toletters : int String toletters(5) : String 5 : int A B B A Typing certificate Proof This analogy goes further! Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Types int String String int A B B A Typing certificate Proof This analogy goes further! Curry-Howard correspondence! Non-idempotent typing operators P. Vial 1 Presentation 9 /46

Curry-Howard (50s) Programming languages Type Simply Typed Program Reduction Step Termination Logic Formula Proof Cut-Elimination Step Termination toletters : int String toletters(5) : String 5 : int A B B A Non-idempotent typing operators P. Vial 1 Presentation 10 /46

Curry-Howard (50s) Programming languages Type Simply Typed Program Reduction Step Termination Logic Formula Proof Cut-Elimination Step Termination Simple types Non-idempotent typing operators P. Vial 1 Presentation 10 /46

Curry-Howard (50s) Programming languages Type Simply Typed Program Reduction Step Termination Logic Formula Proof Cut-Elimination Step Termination Simple types Harness higher-order comput. in a limited way. Many progs. in terminal state not typable. Non-idempotent typing operators P. Vial 1 Presentation 10 /46

Curry-Howard (50s) Programming languages Type Simply Typed Program Reduction Step Termination Logic Formula Proof Cut-Elimination Step Termination Simple types Harness higher-order comput. in a limited way. Many progs. in terminal state not typable. extensions Polymorphic Types Intersection Types Non-idempotent typing operators P. Vial 1 Presentation 10 /46

Curry-Howard (50s) Programming languages Type Simply Typed Program Reduction Step Termination Logic Formula Proof Cut-Elimination Step Termination Simple types Harness higher-order comput. in a limited way. Many progs. in terminal state not typable. extensions Polymorphic Types Intersection Types Non-idempotent typing operators P. Vial 1 Presentation 10 /46

Curry-Howard (50s) Programming languages Type Simply Typed Program Reduction Step Termination Simple types Logic Formula Proof Cut-Elimination Step Termination λ-calculus Harness higher-order comput. in a limited way. Many progs. in terminal state not typable. extensions Polymorphic Types Intersection Types Non-idempotent typing operators P. Vial 1 Presentation 10 /46

Curry-Howard (50s) Programming languages Type Simply Typed Program Reduction Step Termination Simple types Logic Formula Proof Cut-Elimination Step Termination λ-calculus Harness higher-order comput. in a limited way. Many progs. in terminal state not typable. Does not capture classical logic extensions Polymorphic Types Intersection Types Non-idempotent typing operators P. Vial 1 Presentation 10 /46

Curry-Howard (50s) Programming languages Type Simply Typed Program Reduction Step Termination Simple types Logic Formula Proof Cut-Elimination Step Termination λ-calculus Harness higher-order comput. in a limited way. Many progs. in terminal state not typable. extensions Does not capture classical logic Get classical logic with call cc (Griffin, 90) Polymorphic Types Intersection Types Non-idempotent typing operators P. Vial 1 Presentation 10 /46

Curry-Howard (50s) Programming languages Type Simply Typed Program Reduction Step Termination Simple types Logic Formula Proof Cut-Elimination Step Termination λ-calculus Harness higher-order comput. in a limited way. Many progs. in terminal state not typable. extensions Does not capture classical logic Get classical logic with call cc (Griffin, 90) Polymorphic Types Intersection Types Contribution Non-idempotent typing operators P. Vial 1 Presentation 10 /46

Cut-Elimination (animation) A A A B B Number of occurrences: ψ A A Φ B Π A ψ : 1 Φ : 1 Π : 1 A B F Initial proof of F (using two lemmas) Goal: having a one-block proof Non-idempotent typing operators P. Vial 1 Presentation 11 /46

Cut-Elimination (animation) ψ ψ ψ B B ψ Φ ψ B Π ψ Number of occurrences: ψ : 6 Φ : 1 Π : 1 B F After one cut-elim. step (one lemma) Goal: having a one-block proof Non-idempotent typing operators P. Vial 1 Presentation 11 /46

Cut-Elimination (animation) ψ ψ ψ Φ ψ ψ Φ Π ψ ψ ψ Φ ψ ψ Number of occurrences: ψ : 10 Φ : 3 Π : 1 F Goal: having a one-block proof Non-idempotent typing operators P. Vial 1 Presentation 11 /46

Cut-Elimination (animation) ψ ψ ψ Φ ψ ψ Φ Π ψ ψ ψ Φ ψ ψ Number of occurrences: ψ : 10 Φ : 3 Π : 1 F After two cut-elim. steps Non-idempotent typing operators P. Vial 1 Presentation 11 /46

Cut-Elimination (animation) ψ ψ ψ Φ ψ ψ Φ Π ψ ψ ψ Φ ψ ψ Number of occurrences: ψ : 10 Φ : 3 Π : 1 F Theorem (Gentzen, 1936, Prawitz, 1965) The cut-elimination procedure terminates (and tells us a lot of things). Non-idempotent typing operators P. Vial 1 Presentation 11 /46

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. on-idempotent typing operators P. Vial 1 Presentation 12 /46

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: t is typable t can reach a terminal state Some reduction strategy terminates on t on-idempotent typing operators P. Vial 1 Presentation 12 /46

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: t is typable t can reach a terminal state Some reduction strategy terminates on t Intersection types Perhaps too expressive...... but certify reduction strategies! Non-idempotent typing operators P. Vial 1 Presentation 12 /46

Non-idempotency Computation causes duplication. Non-idempotent typing operators P. Vial 1 Presentation 13 /46

Non-idempotency Computation causes duplication. Non-idempotent intersection types Disallow duplication for typing certificates. Possibly many certificates for a subprogram. Size of certificates decreases. on-idempotent typing operators P. Vial 1 Presentation 13 /46

Non-idempotency Computation causes duplication. Non-idempotent intersection types Disallow duplication for typing certificates. Possibly many certificates for a subprogram. Size of certificates decreases. Initial certificate Initial state of the prog. Execution on-idempotent typing operators P. Vial 1 Presentation 13 /46

Non-idempotency Computation causes duplication. Non-idempotent intersection types Disallow duplication for typing certificates. Possibly many certificates for a subprogram. Size of certificates decreases. Initial certificate Initial state of the prog. Execution on-idempotent typing operators P. Vial 1 Presentation 13 /46

Non-idempotency Computation causes duplication. Non-idempotent intersection types Disallow duplication for typing certificates. Possibly many certificates for a subprogram. Size of certificates decreases. Initial certificate Initial state of the prog. Execution on-idempotent typing operators P. Vial 1 Presentation 13 /46

Non-idempotency Computation causes duplication. Non-idempotent intersection types Disallow duplication for typing certificates. Possibly many certificates for a subprogram. Size of certificates decreases. Initial certificate Initial state of the prog. Execution on-idempotent typing operators P. Vial 1 Presentation 13 /46

Non-idempotency Computation causes duplication. Non-idempotent intersection types Disallow duplication for typing certificates. Possibly many certificates for a subprogram. Size of certificates decreases. Initial certificate Initial state of the prog. STOP (cannot be reduced more) Execution on-idempotent typing operators P. Vial 1 Presentation 13 /46

Non-idempotency Computation causes duplication. Non-idempotent intersection types Disallow duplication for typing certificates. Possibly many certificates for a subprogram. Size of certificates decreases. Initial certificate Initial state of the prog. STOP (cannot be reduced more) Terminal state reached!! Execution on-idempotent typing operators P. Vial 1 Presentation 13 /46

Non-idempotency Computation causes duplication. Non-idempotent intersection types Disallow duplication for typing certificates. Possibly many certificates for a subprogram. Size of certificates decreases. on-idempotent typing operators P. Vial 1 Presentation 13 /46

Non-idempotency Computation causes duplication. Non-idempotent intersection types Disallow duplication for typing certificates. Possibly many certificates for a subprogram. Size of certificates decreases. 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! on-idempotent typing operators P. Vial 1 Presentation 13 /46

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 a new type system: system S (standing for sequences). Contribution 3: Around the expressive power of unconstrained infinitary intersection types. Non-idempotent typing operators P. Vial 1 Presentation 14 /46

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 on-idempotent typing operators P. Vial 2 Non-idempotent intersection types 15 /46

Head Normalization (λ) r x t 1 λx s t 1 head variable t q head redex t q λxp λxp Head Normal Form Head Reducible Term Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 16 /46

Head Normalization (λ) r x t 1 λx s t 1 head variable t q head redex t q λxp λxp Head Normal Form Head Reducible Term t is head normalizing (HN) if reduction path from t to a HNF. Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 16 /46

Head Normalization (λ) r x t 1 λx s t 1 head variable t q head redex t q λxp λxp Head Normal Form Head Reducible Term 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

Head Normalization (λ) 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

Head Normalization (λ) obvious the head reduction strategy terminates on t t is HN ( path from t to a HNF) true but not obvious 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

Head Normalization (λ) obvious the head reduction strategy terminates on t t is HN ( path from t to a HNF) true but not obvious The head reduction strategy: reducing head redexes while it is possible. Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 16 /46

Head Normalization (λ) obvious the head reduction strategy terminates on t t is HN ( path from t to a HNF) true but not obvious Intersection types come to help! The head reduction strategy: reducing head redexes while it is possible. Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 16 /46

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 antireduction. SE is usually not verified by simple or polymorphic type systems on-idempotent typing operators P. Vial 2 Non-idempotent intersection types 17 /46

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 antireduction. SE is usually not verified by simple or polymorphic type systems typing the term. states + SE t is typable SR + extra arg. t can reach a terminal state Some reduction strategy terminates on t obvious on-idempotent typing operators P. Vial 2 Non-idempotent intersection types 17 /46

From Intersection Types to Quantitative Types Types are built by means of base types, arrow ( ) and intersection ( ). Associativity (A D) C A (D C) ACI Axioms = Commutativity A D D A Idempotence A A A on-idempotent typing operators P. Vial 2 Non-idempotent intersection types 18 /46

From Intersection Types to Quantitative Types Types are built by means of base types, arrow ( ) and intersection ( ). Associativity (A D) C A (D C) ACI Axioms = Commutativity A D D A Idempotence A A A Traditional Intersection Types Quantitative Types Coppo & 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] [A, C] i.e. A A C A C. [A, B] + [A] = [A, A, B] i.e. is multiset sum. on-idempotent typing operators P. Vial 2 Non-idempotent intersection types 18 /46

Types and Rules (System R 0 ) (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 app Γ + i I Γ i t u : τ System R 0 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

Properties (R 0 ) Weighted Subject Reduction Reduction preserves types and environments, and...... head reduction strictly decreases the nodes of the deriv. tree. Subject Expansion Anti-reduction preserves types and environments. Theorem (de Carvalho) Let t be a λ-term. Then equivalence between: 1 t is typable (in R 0) 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. on-idempotent typing operators P. Vial 2 Non-idempotent intersection types 20 /46

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. Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 21 /46

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 normal form (NF). Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 21 /46

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 normal form (NF). Strong normalization (SN): there is no infinite path starting at t. on-idempotent typing operators P. Vial 2 Non-idempotent intersection types 21 /46

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 normal form (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 on-idempotent typing operators P. Vial 2 Non-idempotent intersection types 21 /46

Characterizing Weak and Strong Normalization HN System R 0 sz(π) bounds the number of any arg. can be left untyped head reduction steps WN System R 0 + unforgetfulness criterion non-erasable args must be typed sz(π) bounds the number of leftmost-outermost red. steps (and more) SN Modify system R 0 with choice operator all args must be typed sz(π) bounds the length of any reduction path Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 22 /46

Subject reduction and expansion in R 0 From a typing of (λx.r)s... to a typing of r[s/x] ax x:[σ 1] x:σ 1 ax x:[σ 1] x:σ 1 ax x:[σ 2] x:σ 2 Π a 1 Π 2 Π b 1 Γ; x :[σ 1, σ 2, σ 1] r : τ abs Γ λx.r : [σ 1, σ 2, σ 1] τ a 1 s:σ 1 2 s:σ 2 Γ + a 1 + b 1 + 2 (λx.r)s : τ b 1 s:σ 1 app Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 23 /46

Subject reduction and expansion in R 0 From a typing of (λx.r)s... to a typing of r[s/x] ax x:[σ 1] x:σ 1 ax x:[σ 1] x:σ 1 ax x:[σ 2] x:σ 2 Π a 1 Π 2 Π b 1 Γ; x :[σ 1, σ 2, σ 1] r : τ abs Γ λx.r : [σ 1, σ 2, σ 1] τ a 1 s:σ 1 2 s:σ 2 Γ + a 1 + b 1 + 2 (λx.r)s : τ b 1 s:σ 1 app Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 23 /46

Subject reduction and expansion in R 0 From a typing of (λx.r)s... to a typing of r[s/x] ax x:[σ 1] x:σ 1 ax x:[σ 1] x:σ 1 ax x:[σ 2] x:σ 2 Π a 1 Π 2 Π b 1 Γ; x :[σ 1, σ 2, σ 1] r : τ abs Γ λx.r : [σ 1, σ 2, σ 1] τ a 1 s:σ 1 2 s:σ 2 Γ + a 1 + b 1 + 2 (λx.r)s : τ b 1 s:σ 1 app Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 23 /46

Subject reduction and expansion in R 0 From a typing of (λx.r)s... to a typing of r[s/x] ax x:[σ 1] x:σ 1 ax x:[σ 1] x:σ 1 ax x:[σ 2] x:σ 2 Π a 1 Π 2 Π b 1 Γ; x :[σ 1, σ 2, σ 1] r : τ abs Γ λx.r : [σ 1, σ 2, σ 1] τ a 1 s:σ 1 2 s:σ 2 Γ + a 1 + b 1 + 2 (λx.r)s : τ b 1 s:σ 1 app Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 23 /46

Subject reduction and expansion in R 0 From a typing of (λx.r)s... to a typing of r[s/x] ax x:[σ 1] x:σ 1 ax x:[σ 1] x:σ 1 By relevance and non-idempotence! ax x:[σ 2] x:σ 2 Π a 1 Π 2 Π b 1 Γ; x :[σ 1, σ 2, σ 1] r : τ abs Γ λx.r : [σ 1, σ 2, σ 1] τ a 1 s:σ 1 2 s:σ 2 Γ + a 1 + b 1 + 2 (λx.r)s : τ b 1 s:σ 1 app Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 23 /46

Subject reduction and expansion in R 0 From a typing of (λx.r)s... to a typing of r[s/x] ax x:[σ 1] x:σ 1 ax x:[σ 1] x:σ 1 ax x:[σ 2] x:σ 2 Π a 1 Π 2 Π b 1 Γ; x :[σ 1, σ 2, σ 1] r : τ abs Γ λx.r : [σ 1, σ 2, σ 1] τ a 1 s:σ 1 2 s:σ 2 Γ + a 1 + b 1 + 2 (λx.r)s : τ b 1 s:σ 1 app Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 23 /46

Subject reduction and expansion in R 0 From a typing of (λx.r)s... to a typing of r[s/x] ax x:[σ 1] x:σ 1 ax x:[σ 1] x:σ 1 ax x:[σ 2] x:σ 2 Π a 1 Π 2 Π b 1 Γ; x :[σ 1, σ 2, σ 1] r : τ abs Γ λx.r : [σ 1, σ 2, σ 1] τ a 1 s:σ 1 2 s:σ 2 Γ + a 1 + b 1 + 2 (λx.r)s : τ b 1 s:σ 1 app Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 23 /46

Subject reduction and expansion in R 0 From a typing of (λx.r)s... to a typing of r[s/x] Π a 1 Π b 1 a 1 s:σ 1 Π 2 b 1 s:σ 1 2 s:σ 2 Γ + a 1 + b 1 + 2 r[s/x] : τ Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 23 /46

Subject reduction and expansion in R 0 From a typing of (λx.r)s... to a typing of r[s/x] Π a 1 Π b 1 a 1 s:σ 1 Π 2 b 1 s:σ 1 Non-determinism of SR 2 s:σ 2 Γ + a 1 + b 1 + 2 r[s/x] : τ Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 23 /46

Subject reduction and expansion in R 0 From a typing of (λx.r)s... to a typing of r[s/x] Π b 1 Π a 1 b 1 s:σ 1 Π 2 a 1 s:σ 1 Non-determinism of SR 2 s:σ 2 Γ + a 1 + b 1 + 2 r[s/x] : τ Non-idempotent typing operators P. Vial 2 Non-idempotent intersection types 23 /46

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 on-idempotent typing operators P. Vial 3 Resources for Classical Logic 24 /46

The Lambda-Mu Calculus Intuit. logic + Peirce s Law ((A B) A) A gives classical logic. on-idempotent typing operators P. Vial 3 Resources for Classical Logic 25 /46

The Lambda-Mu Calculus Intuit. logic + Peirce s Law ((A B) A) A gives 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 on-idempotent typing operators P. Vial 3 Resources for Classical Logic 25 /46

The Lambda-Mu Calculus Intuit. logic + Peirce s Law ((A B) A) A gives 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 natural deduction (e.g., vs. λµ µ). on-idempotent typing operators P. Vial 3 Resources for Classical Logic 25 /46

The Lambda-Mu Calculus Intuit. logic + Peirce s Law ((A B) A) A gives 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 natural deduction (e.g., vs. λµ µ). Captures continuations on-idempotent typing operators P. Vial 3 Resources for Classical Logic 25 /46

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.) c{u /α} replaces every occurrence of [α]v inside t by [α]v u. on-idempotent typing operators P. Vial 3 Resources for Classical Logic 26 /46

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.) c{u /α} replaces every occurrence of [α]v inside t by [α]v u. Example: [α](x (µγ.[α]x)){u /α} = Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 26 /46

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.) c{u /α} replaces every occurrence of [α]v inside t by [α]v u. Example: [α](x (µγ.[α]x)){u /α} = Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 26 /46

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.) c{u /α} replaces every occurrence of [α]v inside t by [α]v u. Example: [α](x (µγ.[α]x)){u /α} = Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 26 /46

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.) c{u /α} replaces every occurrence of [α]v inside t by [α]v u. Example: [α](x (µγ.[α]x)){u /α} = [α](x (µγ.[α]x u))u Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 26 /46

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.) c{u /α} replaces every occurrence of [α]v inside t by [α]v u. Example: [α](x (µγ.[α]x)){u /α} = [α](x (µγ.[α]x u))u call cc := λy.µα.[α]y(λx.µβ.[α]x) Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 26 /46

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.) c{u /α} replaces every occurrence of [α]v inside t by [α]v u. Example: [α](x (µγ.[α]x)){u /α} = [α](x (µγ.[α]x u))u call cc := λy.µα.[α]y(λx.µβ.[α]x) : ((A B) A) A (simple typing) on-idempotent typing operators P. Vial 3 Resources for Classical Logic 26 /46

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.) c{u /α} replaces every occurrence of [α]v inside t by [α]v u. Example: [α](x (µγ.[α]x)){u /α} = [α](x (µγ.[α]x u))u call cc := λy.µα.[α]y(λx.µβ.[α]x) : ((A B) A) A (simple typing) Operational Semantics: (λx.t)u β t[u/x] substitution (µα.c)u µ µα.c{u /α} replacement on-idempotent typing operators P. Vial 3 Resources for Classical Logic 26 /46

The Typing System Principles Extend non-idempotent types to classical logic. Problem 1: finding quantitative descriptors suitable to classical logic Problem 2: guaranteeing a decrease in measure (weighted s.r.) on-idempotent typing operators P. Vial 3 Resources for Classical Logic 27 /46

The Typing System Principles Extend non-idempotent types to classical logic. Problem 1: finding quantitative descriptors suitable to classical logic resort to non-idempotent union types (below right) Problem 2: guaranteeing a decrease in measure (weighted s.r.) Not obvious! The number of nodes does not work (see later). on-idempotent typing operators P. Vial 3 Resources for Classical Logic 27 /46

The Typing System Principles Extend non-idempotent types to classical logic. Problem 1: finding quantitative descriptors suitable to classical logic resort to non-idempotent union types (below right) Problem 2: guaranteeing a decrease in measure (weighted s.r.) Not obvious! The number of nodes does not work (see later). Intersection: I, J := [U k ] k K U, V =: σ k k K : Union on-idempotent typing operators P. Vial 3 Resources for Classical Logic 27 /46

The Typing System Principles Extend non-idempotent types to classical logic. Problem 1: finding quantitative descriptors suitable to classical logic resort to non-idempotent union types (below right) Problem 2: guaranteeing a decrease in measure (weighted s.r.) Not obvious! The number of nodes does not work (see later). Intersection: I, J := [U k ] k K U, V =: σ k k K : Union x : [U 1, U 2]; y : [V] t : U α : σ 1, σ 2, β : τ 1, τ 2, τ 3 on-idempotent typing operators P. Vial 3 Resources for Classical Logic 27 /46

The Typing System Principles Extend non-idempotent types to classical logic. Problem 1: finding quantitative descriptors suitable to classical logic resort to non-idempotent union types (below right) Problem 2: guaranteeing a decrease in measure (weighted s.r.) Not obvious! The number of nodes does not work (see later). Intersection: I, J := [U k ] k K U, V =: σ k k K : Union x : [U 1, U 2]; y : [V] t : U α : σ 1, σ 2, β : τ 1, τ 2, τ 3 A, C and non-i e.g., σ 1, σ 2 σ 1 = σ 1, σ 2, σ 1 on-idempotent typing operators P. Vial 3 Resources for Classical Logic 27 /46

Some Typing Rules (System H λµ ) Features Syntax-direction, relevance, multiplicative rules accumulation of typing information. app-rule based upon the admissible rule of ND: A 1 B 1... A k B k A 1... A k B 1... B k ( vs. A B B A ) Non-idempotent typing operators P. Vial 3 Resources for Classical Logic 28 /46

Some Typing Rules (System H λµ ) Features Syntax-direction, relevance, multiplicative rules accumulation of typing information. app-rule based upon the admissible rule of ND: A 1 B 1... A k B k A 1... A k B 1... B k ( vs. A B B A ) Two new rules (manipulation on the right-h.s.): Γ t : U Γ [α]t : # {α : U} save Γ c : # Γ µα.c : (α) \\ α restore on-idempotent typing operators P. Vial 3 Resources for Classical Logic 28 /46

Some Typing Rules (System H λµ ) Features Syntax-direction, relevance, multiplicative rules accumulation of typing information. app-rule based upon the admissible rule of ND: A 1 B 1... A k B k A 1... A k B 1... B k ( vs. A B B A ) Two new rules (manipulation on the right-h.s.): Γ t : U Γ [α]t : # {α : U} save Γ c : # Γ µα.c : (α) \\ α restore on-idempotent typing operators P. Vial 3 Resources for Classical Logic 28 /46

Some Typing Rules (System H λµ ) Features Syntax-direction, relevance, multiplicative rules accumulation of typing information. app-rule based upon the admissible rule of ND: A 1 B 1... A k B k A 1... A k B 1... B k ( vs. A B B A ) Two new rules (manipulation on the right-h.s.): Γ t : U Γ [α]t : # {α : U} save Γ c : # Γ µα.c : (α) \\ α restore on-idempotent typing operators P. Vial 3 Resources for Classical Logic 28 /46

Some Typing Rules (System H λµ ) Features Syntax-direction, relevance, multiplicative rules accumulation of typing information. app-rule based upon the admissible rule of ND: A 1 B 1... A k B k A 1... A k B 1... B k ( vs. A B B A ) Two new rules (manipulation on the right-h.s.): Γ t : U Γ [α]t : # {α : U} save Γ c : # Γ µα.c : (α) \\ α restore on-idempotent typing operators P. Vial 3 Resources for Classical Logic 28 /46

Some Typing Rules (System H λµ ) Features Syntax-direction, relevance, multiplicative rules accumulation of typing information. app-rule based upon the admissible rule of ND: A 1 B 1... A k B k A 1... A k B 1... B k ( vs. A B B A ) Two new rules (manipulation on the right-h.s.): Γ t : U Γ [α]t : # {α : U} save Γ c : # Γ µα.c : (α) \\ α restore where = choice operator. on-idempotent typing operators P. Vial 3 Resources for Classical Logic 28 /46