Pure Patterns Type Systems P 2 T S Luigi Liquori joint work with - - PowerPoint PPT Presentation

pure patterns type systems p 2 t s
SMART_READER_LITE
LIVE PREVIEW

Pure Patterns Type Systems P 2 T S Luigi Liquori joint work with - - PowerPoint PPT Presentation

EX & P 4 L T A Index Pure Patterns Type Systems P 2 T S Luigi Liquori joint work with The Rho-Team INRIA & LORIA Luigi Liquori c Rhappy-Days, Nancy, March 22, 2004 1 Index P 2 T S Motivations and Contributions Luigi


slide-1
SLIDE 1

Index

L

A

T EX & P4

Pure Patterns Type Systems P2T S

Luigi Liquori

joint work with

The Rho-Team INRIA & LORIA

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 1

slide-2
SLIDE 2

Index

P2T S Motivations and Contributions

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 2

slide-3
SLIDE 3

Index

From Lambda-calculus to Rewriting-calculus

  • Lambda-calculus builds upon lambda abstraction:

(λX.X) 3

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 3

slide-4
SLIDE 4

Index

From Lambda-calculus to Rewriting-calculus

  • Lambda-calculus builds upon lambda abstraction:

3

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 3

slide-5
SLIDE 5

Index

From Lambda-calculus to Rewriting-calculus

  • Lambda-calculus builds upon lambda abstraction:

3

  • Lambda-calculus with patterns builds upon pattern abstraction:

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 3

slide-6
SLIDE 6

Index

From Lambda-calculus to Rewriting-calculus

  • Lambda-calculus builds upon lambda abstraction:

3

  • Lambda-calculus with patterns builds upon pattern abstraction:

(λf(X), g(Y).X, Y)3, 4

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 3

slide-7
SLIDE 7

Index

From Lambda-calculus to Rewriting-calculus

  • Lambda-calculus builds upon lambda abstraction:

3

  • Lambda-calculus with patterns builds upon pattern abstraction:

(λsqr(X), trl(X).headof(X)) sqr(wood), trl(wood)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 3

slide-8
SLIDE 8

Index

From Lambda-calculus to Rewriting-calculus

  • Lambda-calculus builds upon lambda abstraction:

3

  • Lambda-calculus with patterns builds upon pattern abstraction:

(λsqr(X), trl(X).headof(X)) sqr(wood), trl(wood)

  • Rewriting-calculus builds upon generalised abstraction:

(λ(λP.Q).M) N

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 3

slide-9
SLIDE 9

Index

From Lambda-calculus to Rewriting-calculus

  • Lambda-calculus builds upon lambda abstraction:

3

  • Lambda-calculus with patterns builds upon pattern abstraction:

(λsqr(X), trl(X).headof(X)) sqr(wood), trl(wood)

  • Rewriting-calculus builds upon generalised abstraction:

(λ(λX.Y).Y 3)(λZ.Z)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 3

slide-10
SLIDE 10

Index

PATTERNS We Want More Patterns!

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 4

slide-11
SLIDE 11

Index

The Uncle Pat

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 5

slide-12
SLIDE 12

Index

MATCHING We Want More Matching Power!

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 6

slide-13
SLIDE 13

Index

The Lady Match

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 7

slide-14
SLIDE 14

Index

P

2T S: Tricky !

  • And by the way . . . the below term can have free variables ?

λcons(T X nil(T )).cons(T X cons(T X nil(T )))

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 8

slide-15
SLIDE 15

Index

P

2T S: Tricky !

  • And by the way . . . the below term can have free variables ?

λcons(T X nil(T)).cons(T X cons(T X nil(T)))

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 8

slide-16
SLIDE 16

Index

P

2T S: Tricky !

  • And by the way . . . the below term can have free variables ?

λcons(T X nil(T)).cons(T X cons(T X nil(T)))

  • yes, and we can even abstract the T.

λT.λcons(T X nil(T)).cons(T X cons(T X nil(T)))

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 8

slide-17
SLIDE 17

Index

P

2T S: Tricky !

  • ... we cannot reduce the application of

λcons(T X nil(T)).cons(T X cons(T X nil(T)))

to cons(int 3 nil(int))

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 9

slide-18
SLIDE 18

Index

P

2T S: Tricky !

  • ... we cannot reduce the application of

λcons(T X nil(T)).cons(T X cons(T X nil(T)))

to cons(int 3 nil(int))

  • ... but we can reduce the application of

λT.λcons(T X nil(T)).cons(T X cons(T X nil(T)))

to int and cons(int 3 nil(int))

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 9

slide-19
SLIDE 19

Index

TYPES We Need to Plug Types!

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 10

slide-20
SLIDE 20

Index

Thanks to TAL’s Group (Cornell)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 11

slide-21
SLIDE 21

Index

Typed Rho

  • Our goal is to use the Rewriting-calculus as a foundation for proof assistants

based on Curry-Howard isomorphism ` a la Coq, Twelf, Lego, . . .

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 12

slide-22
SLIDE 22

Index

Typed Rho

  • Our goal is to use the Rewriting-calculus as a foundation for proof assistants

based on Curry-Howard isomorphism ` a la Coq, Twelf, Lego, . . .

  • As an intermediate goal, we develop a dependent type theory for the

Rewriting-calculus

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 12

slide-23
SLIDE 23

Index

Typed Rho

  • Our goal is to use the Rewriting-calculus as a foundation for proof assistants

based on Curry-Howard isomorphism ` a la Coq, Twelf, Lego, . . .

  • As an intermediate goal, we develop a dependent type theory for the

Rewriting-calculus

  • We do so by extending the framework of Pure Type Systems (PTS)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 12

slide-24
SLIDE 24

Index

Typed Rho

  • Our goal is to use the Rewriting-calculus as a foundation for proof assistants

based on Curry-Howard isomorphism ` a la Coq, Twelf, Lego, . . .

  • As an intermediate goal, we develop a dependent type theory for the

Rewriting-calculus

  • We do so by extending the framework of Pure Type Systems (PTS)
  • We develop the basic theory of the resulting framework which we call

Pure Pattern Type Systems (P

2T S) c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 12

slide-25
SLIDE 25

Index

Typed Rho

  • Our goal is to use the Rewriting-calculus as a foundation for proof assistants

based on Curry-Howard isomorphism ` a la Coq, Twelf, Lego, . . .

  • As an intermediate goal, we develop a dependent type theory for the

Rewriting-calculus

  • We do so by extending the framework of Pure Type Systems (PTS)
  • We develop the basic theory of the resulting framework which we call

Pure Pattern Type Systems (P

2T S)

  • This is not as straightforward as one may imagine

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 12

slide-26
SLIDE 26

Index

Typed Rho

  • Our goal is to use the Rewriting-calculus as a foundation for proof assistants

based on Curry-Howard isomorphism ` a la Coq, Twelf, Lego, . . .

  • As an intermediate goal, we develop a dependent type theory for the

Rewriting-calculus

  • We do so by extending the framework of Pure Type Systems (PTS)
  • We develop the basic theory of the resulting framework which we call

Pure Pattern Type Systems (P

2T S)

  • This is not as straightforward as one may imagine :-)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 12

slide-27
SLIDE 27

Index

P

2T S: Some problems

  • Confluence can fails for bad patterns

(λ(X Y).X)((λZ.Z)a) → →

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 13

slide-28
SLIDE 28

Index

P

2T S: Some problems

  • Confluence can fails for bad patterns

(λ(X Y).X)((λZ.Z)a) → → (λZ.Z)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 13

slide-29
SLIDE 29

Index

P

2T S: Some problems

  • Confluence can fails for bad patterns

(λ(X Y).X)((λZ.Z)a) → → (λ(X Y).X)a

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 13

slide-30
SLIDE 30

Index

P

2T S: Some problems

  • Confluence can fails for bad patterns

(λ(X Y).X)((λZ.Z)a) → → (λ(X Y).X)a

  • Subject Reduction can fails for bad patterns

⊢ (λ(Xσ1τ

1

Yσ1

1 ). Zσ1τ Yσ1 1 ) (Xσ2τ 2

Yσ2

2 ) : τ

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 13

slide-31
SLIDE 31

Index

P

2T S: Some problems

  • Confluence can fails for bad patterns

(λ(X Y).X)((λZ.Z)a) → → (λ(X Y).X)a

  • Subject Reduction can fails for bad patterns

⊢ Zσ1τ Yσ2

2 : τ

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 13

slide-32
SLIDE 32

Index

P

2T S: Some problems

  • Confluence can fails for bad patterns

(λ(X Y).X)((λZ.Z)a) → → (λ(X Y).X)a

  • Subject Reduction can fails for bad patterns

⊢ Zσ1τ Yσ2

2 : τ

  • Shapes of good patterns must be “xunison-ed” with a sound static type

system!

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 13

slide-33
SLIDE 33

Index

The main contribution of this (ongoing) work are ...

  • to provide adequate notions of patterns, substitutions and syntactic matching

in a typed setting. We introduce delayed matching constraint, and the possibility for patterns in abstractions to evolve (by reduction or substitution) during execution

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 14

slide-34
SLIDE 34

Index

The main contribution of this (ongoing) work are ...

  • to provide adequate notions of patterns, substitutions and syntactic matching

in a typed setting. We introduce delayed matching constraint, and the possibility for patterns in abstractions to evolve (by reduction or substitution) during execution

  • to propose an extension of PTSs supporting abstraction over patterns, and

enjoying ⋆ confluence ⋆ subject reduction ⋆ conservativity over PTSs ⋆ consistency for normalizing P

2T Ss c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 14

slide-35
SLIDE 35

Index

The main contribution of this (ongoing) work are ...

  • to provide adequate notions of patterns, substitutions and syntactic matching

in a typed setting. We introduce delayed matching constraint, and the possibility for patterns in abstractions to evolve (by reduction or substitution) during execution

  • to propose an extension of PTSs supporting abstraction over patterns, and

enjoying ⋆ confluence ⋆ subject reduction ⋆ conservativity over PTSs ⋆ consistency for normalizing P

2T Ss

  • Strong normalization for all P

2T S is an open problem . . . but it is ok for simple

P

2T S-types (see Benjamin Wack SN-paper) and it “seems” ok for

simple+dependent P

2T S-types (❀ Rho gical Framework) c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 14

slide-36
SLIDE 36

Index

P2T S The Syntax

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 15

slide-37
SLIDE 37

Index

P2T S its time to be uniform! λA.B ∼ A → B

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 16

slide-38
SLIDE 38

Index

The Typed Syntax

Γ ::= ∅ | Γ, X:A | Γ, f:A A ::= X | f | A →∆ B | A A | [A ≪∆ B]C | A; B

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 17

slide-39
SLIDE 39

Index

The Typed Syntax

Γ ::= ∅ | Γ, X:A | Γ, f:A A ::= X | f | A →∆ B | A A | [A ≪∆ B]C | A; B

  • 1. Term A →∆ B is an abstraction (resp. product abstraction i.e. ΠA:∆.B)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 17

slide-40
SLIDE 40

Index

The Typed Syntax

Γ ::= ∅ | Γ, X:A | Γ, f:A A ::= X | f | A →∆ B | A A | [A ≪∆ B]C | A; B

  • 1. Term A →∆ B is an abstraction (resp. product abstraction i.e. ΠA:∆.B)
  • 2. Term [A ≪∆ B]C is a delayed matching constraint

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 17

slide-41
SLIDE 41

Index

The Typed Syntax

Γ ::= ∅ | Γ, X:A | Γ, f:A A ::= X | f | A →∆ B | A A | [A ≪∆ B]C | A; B

  • 1. Term A →∆ B is an abstraction (resp. product abstraction i.e. ΠA:∆.B)
  • 2. Term [A ≪∆ B]C is a delayed matching constraint
  • 3. Term of the form A; B is called a structure

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 17

slide-42
SLIDE 42

Index

P2T S Galleria & Glance

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 18

slide-43
SLIDE 43

Index

Galleria I: The Pattern Abstraction A →∆ B

  • Generalisation of the λ-abstraction in PTSs. The rationale is:

X →(X:σ)

A ∼ λX:σ.A

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 19

slide-44
SLIDE 44

Index

Galleria I: The Pattern Abstraction A →∆ B

  • Generalisation of the λ-abstraction in PTSs. The rationale is:

f(X Y) →(X:σ, Y:τ)

A ∼ λf(X Y):(X:σ, Y:τ).A

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 19

slide-45
SLIDE 45

Index

Galleria I: The Pattern Abstraction A →∆ B

  • Generalisation of the λ-abstraction in PTSs. The rationale is:

f(X Y) →(X:σ, Y:τ)

A ∼ λf(X Y):(X:σ, Y:τ).A

  • Instead of simple variables we abstract over sophisticated patterns
  • The free variables of A (bound in B) are declared in the context ∆, i.e.

Fv(A →∆ B)

= (Fv(A) ∪ Fv(B) ∪ Fv(∆)) \ Dom(∆)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 19

slide-46
SLIDE 46

Index

Galleria I: The Pattern Abstraction A →∆ B

  • Generalisation of the λ-abstraction in PTSs. The rationale is:

f(X Y) →(X:σ, Y:τ)

A ∼ λf(X Y):(X:σ, Y:τ).A

  • Instead of simple variables we abstract over sophisticated patterns
  • The free variables of A (bound in B) are declared in the context ∆, i.e.

Fv(A →∆ B)

= (Fv(A) ∪ Fv(B) ∪ Fv(∆)) \ Dom(∆)

  • ∆ discriminates on which Fv(A) will be bound in B and which not

cons(T X nil(T)) →(X:T) cons(T X cons(T X nil(T)))

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 19

slide-47
SLIDE 47

Index

Galleria I: The Pattern Abstraction A →∆ B

  • Generalisation of the λ-abstraction in PTSs. The rationale is:

f(X Y) →(X:σ, Y:τ)

A ∼ λf(X Y):(X:σ, Y:τ).A

  • Instead of simple variables we abstract over sophisticated patterns
  • The free variables of A (bound in B) are declared in the context ∆, i.e.

Fv(A →∆ B)

= (Fv(A) ∪ Fv(B) ∪ Fv(∆)) \ Dom(∆)

  • ∆ discriminates on which Fv(A) will be bound in B and which not

cons(T X nil(T)) →(X:T) cons(T X cons(T X nil(T)))

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 19

slide-48
SLIDE 48

Index

Galleria II: The Matching Constraint [A ≪∆ B]C

  • In the term

[A ≪∆ B]C

the matching equation [A ≪∆ B] is put on the stack, hence constraints and “de facto” blocks the evaluation of C

  • The body C will be evaluated (in case a matching solution exists) or delayed

(in case no solution exists at this stage of the evaluation)

  • If a solution exists, the delayed matching constraint self-evaluates to Cσ,
  • therwise the evaluation is delayed to a later stage
  • The free variables of A declared in ∆ are bound in B but not in C, i.e.

Fv([A ≪∆ B]C)

= Fv((A →∆ C) B)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 20

slide-49
SLIDE 49

Index

P2T S Matching Algorithm

HARD RUN EASY RUN SKIP

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 21

slide-50
SLIDE 50

Index

Less Easy Running

  • X →(X:i) X≺

≺?

∅X →(X:i) X

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 22

slide-51
SLIDE 51

Index

Less Easy Running

  • X →(X:i) X≺

≺?

∅X →(X:i) X X≺

≺?

XX OK!!

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 22

slide-52
SLIDE 52

Index

Less Easy Running

  • X →(X:i) X≺

≺?

∅X →(X:i) X X≺

≺?

XX OK!!

  • X →(X:i) X≺

≺?

∅X →(X:i) Y

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 22

slide-53
SLIDE 53

Index

Less Easy Running

  • X →(X:i) X≺

≺?

∅X →(X:i) X X≺

≺?

XX OK!!

  • X →(X:i) X≺

≺?

∅X →(X:i) Y X≺

≺?

XX ∧ X≺

≺?

XY KO!!

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 22

slide-54
SLIDE 54

Index

Less Easy Running

  • X →(X:i) X≺

≺?

∅X →(X:i) X X≺

≺?

XX OK!!

  • X →(X:i) X≺

≺?

∅X →(X:i) Y X≺

≺?

XX ∧ X≺

≺?

XY KO!!

  • X →(X:i) f(X Y )≺

≺Y

∅ X →(X:i) f(X 3)

  • c

Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 22

slide-55
SLIDE 55

Index

Less Easy Running

  • X →(X:i) X≺

≺?

∅X →(X:i) X X≺

≺?

XX OK!!

  • X →(X:i) X≺

≺?

∅X →(X:i) Y X≺

≺?

XX ∧ X≺

≺?

XY KO!!

  • X →(X:i) f(X Y )≺

≺Y

∅ X →(X:i) f(X 3)

  • X≺

≺Y

XX ∧ f≺

≺Y

Xf ∧ X≺

≺Y

XX ∧ Y ≺

≺Y

X3 OK!!

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 22

slide-56
SLIDE 56

Index

Less Easy Running

  • X →(X:i) X≺

≺?

∅X →(X:i) X X≺

≺?

XX OK!!

  • X →(X:i) X≺

≺?

∅X →(X:i) Y X≺

≺?

XX ∧ X≺

≺?

XY KO!!

  • X →(X:i) f(X Y )≺

≺Y

∅ X →(X:i) f(X 3)

  • X≺

≺Y

XX ∧ f≺

≺Y

Xf ∧ X≺

≺Y

XX ∧ Y ≺

≺Y

X3 OK!!

  • [f(X) ≪(X:i) f(Y )]X≺

≺Y

∅ [f(X) ≪(X:i) f(3)].X

  • c

Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 22

slide-57
SLIDE 57

Index

Less Easy Running

  • X →(X:i) X≺

≺?

∅X →(X:i) X X≺

≺?

XX OK!!

  • X →(X:i) X≺

≺?

∅X →(X:i) Y X≺

≺?

XX ∧ X≺

≺?

XY KO!!

  • X →(X:i) f(X Y )≺

≺Y

∅ X →(X:i) f(X 3)

  • X≺

≺Y

XX ∧ f≺

≺Y

Xf ∧ X≺

≺Y

XX ∧ Y ≺

≺Y

X3 OK!!

  • [f(X) ≪(X:i) f(Y )]X≺

≺Y

∅ [f(X) ≪(X:i) f(3)].X

  • f≺

≺Y

Xf ∧ X≺

≺Y

XX ∧ X≺

≺Y

XX ∧ f≺

≺Y

∅ f ∧ Y ≺

≺Y

∅ 3 OK!!

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 22

slide-58
SLIDE 58

Index

Two Easy Running

  • (cons(T X nil(T)) →(X:i) X) cons(T 3 nil(T))

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 23

slide-59
SLIDE 59

Index

Two Easy Running

  • (cons(T X nil(T)) →(X:i) X) cons(T 3 nil(T))

Solve cons(T X nil(T)) ≺ ≺X

∅ cons(T 3 nil(T))

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 23

slide-60
SLIDE 60

Index

Two Easy Running

  • (cons(T X nil(T)) →(X:i) X) cons(T 3 nil(T))

Solve cons(T X nil(T)) ≺ ≺X

∅ cons(T 3 nil(T))

X ≺ ≺X

∅ 3 ∧ T≺

≺X

∅ T

OK!! with σ = {3/X}

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 23

slide-61
SLIDE 61

Index

Two Easy Running

  • (cons(T X nil(T)) →(X:i) X) cons(T 3 nil(T))

Solve cons(T X nil(T)) ≺ ≺X

∅ cons(T 3 nil(T))

X ≺ ≺X

∅ 3 ∧ T≺

≺X

∅ T

OK!! with σ = {3/X}

  • (cons(T X nil(T)) →(X:i) X) cons(i 3 nil(i))

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 23

slide-62
SLIDE 62

Index

Two Easy Running

  • (cons(T X nil(T)) →(X:i) X) cons(T 3 nil(T))

Solve cons(T X nil(T)) ≺ ≺X

∅ cons(T 3 nil(T))

X ≺ ≺X

∅ 3 ∧ T≺

≺X

∅ T

OK!! with σ = {3/X}

  • (cons(T X nil(T)) →(X:i) X) cons(i 3 nil(i))

Solve cons(T X nil(T)) ≺ ≺X

∅ cons(i 3 nil(i))

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 23

slide-63
SLIDE 63

Index

Two Easy Running

  • (cons(T X nil(T)) →(X:i) X) cons(T 3 nil(T))

Solve cons(T X nil(T)) ≺ ≺X

∅ cons(T 3 nil(T))

X ≺ ≺X

∅ 3 ∧ T≺

≺X

∅ T

OK!! with σ = {3/X}

  • (cons(T X nil(T)) →(X:i) X) cons(i 3 nil(i))

Solve cons(T X nil(T)) ≺ ≺X

∅ cons(i 3 nil(i))

X≺ ≺X

∅ 3 ∧ T≺

≺X

∅ i

KO!!

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 23

slide-64
SLIDE 64

Index

P2T S Type System

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 24

slide-65
SLIDE 65

Index

The Type System I

(s1, s2) ∈ A ∅ ⊢ s1 : s2 (Axioms)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 25

slide-66
SLIDE 66

Index

The Type System I

(s1, s2) ∈ A ∅ ⊢ s1 : s2 (Axioms) Γ ⊢ A : C Γ ⊢ B : C Γ ⊢ A; B : C (Struct)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 25

slide-67
SLIDE 67

Index

The Type System I

(s1, s2) ∈ A ∅ ⊢ s1 : s2 (Axioms) Γ ⊢ A : C Γ ⊢ B : C Γ ⊢ A; B : C (Struct) Γ ⊢ A : s α ∈ Dom(Γ) Γ, α:A ⊢ α : A (Start)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 25

slide-68
SLIDE 68

Index

The Type System I

(s1, s2) ∈ A ∅ ⊢ s1 : s2 (Axioms) Γ ⊢ A : C Γ ⊢ B : C Γ ⊢ A; B : C (Struct) Γ ⊢ A : s α ∈ Dom(Γ) Γ, α:A ⊢ α : A (Start) Γ ⊢ A : B Γ ⊢ C : s α ∈ Dom(Γ) Γ, α:C ⊢ A : B (Weak)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 25

slide-69
SLIDE 69

Index

The Type System I

(s1, s2) ∈ A ∅ ⊢ s1 : s2 (Axioms) Γ ⊢ A : C Γ ⊢ B : C Γ ⊢ A; B : C (Struct) Γ ⊢ A : s α ∈ Dom(Γ) Γ, α:A ⊢ α : A (Start) Γ ⊢ A : B Γ ⊢ C : s α ∈ Dom(Γ) Γ, α:C ⊢ A : B (Weak) Γ ⊢ A : B Γ ⊢ C : D B=

ρ σ δC

Γ ⊢ A : C (Conv)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 25

slide-70
SLIDE 70

Index

The Type System II

Γ, ∆ ⊢ B : C Γ ⊢ ΠA:∆.C : s Γ ⊢ A →∆ B : ΠA:∆.C (Abs)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 26

slide-71
SLIDE 71

Index

The Type System II

Γ, ∆ ⊢ B : C Γ ⊢ ΠA:∆.C : s Γ ⊢ A →∆ B : ΠA:∆.C (Abs) Γ ⊢ C : s1 (s1, s2, s3) ∈ R Γ, ∆ ⊢ A : C Γ, ∆ ⊢ B : s2 Γ ⊢ ΠA:∆.B : s3 (Prod)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 26

slide-72
SLIDE 72

Index

The Type System II

Γ, ∆ ⊢ B : C Γ ⊢ ΠA:∆.C : s Γ ⊢ A →∆ B : ΠA:∆.C (Abs) Γ ⊢ C : s1 (s1, s2, s3) ∈ R Γ, ∆ ⊢ A : C Γ, ∆ ⊢ B : s2 Γ ⊢ ΠA:∆.B : s3 (Prod) Γ ⊢ A : ΠC:∆.D Γ, ∆ ⊢ C : E Γ ⊢ B : E Γ ⊢ A B : [C ≪∆ B]D (Appl)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 26

slide-73
SLIDE 73

Index

The Type System II

Γ, ∆ ⊢ B : C Γ ⊢ ΠA:∆.C : s Γ ⊢ A →∆ B : ΠA:∆.C (Abs) Γ ⊢ C : s1 (s1, s2, s3) ∈ R Γ, ∆ ⊢ A : C Γ, ∆ ⊢ B : s2 Γ ⊢ ΠA:∆.B : s3 (Prod) Γ ⊢ A : ΠC:∆.D Γ, ∆ ⊢ C : E Γ ⊢ B : E Γ ⊢ A B : [C ≪∆ B]D (Appl) Γ, ∆ ⊢ A : E Γ, ∆ ⊢ C : D Γ ⊢ B : D Γ ⊢ [C ≪∆ B]A : [C ≪∆ B]⊤E (Subst)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 26

slide-74
SLIDE 74

Index

The Type System II

Γ, ∆ ⊢ B : C Γ ⊢ ΠA:∆.C : s Γ ⊢ A →∆ B : ΠA:∆.C (Abs) Γ ⊢ C : s1 (s1, s2, s3) ∈ R Γ, ∆ ⊢ A : C Γ, ∆ ⊢ B : s2 Γ ⊢ ΠA:∆.B : s3 (Prod) Γ ⊢ A : ΠC:∆.D Γ, ∆ ⊢ C : E Γ ⊢ B : E Γ ⊢ A B : [C ≪∆ B]D (Appl) Γ, ∆ ⊢ A : E Γ, ∆ ⊢ C : D Γ ⊢ B : D Γ ⊢ [C ≪∆ B]A : [C ≪∆ B]⊤E (Subst)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 26

slide-75
SLIDE 75

Index

The Type System II

Γ, ∆ ⊢ B : C Γ ⊢ ΠA:∆.C : s Γ ⊢ A →∆ B : ΠA:∆.C (Abs) Γ ⊢ C : s1 (s1, s2, s3) ∈ R Γ, ∆ ⊢ A : C Γ, ∆ ⊢ B : s2 Γ ⊢ ΠA:∆.B : s3 (Prod) Γ ⊢ A : ΠC:∆.D Γ, ∆ ⊢ C : E Γ ⊢ B : E Γ ⊢ A B : [C ≪∆ B]D (Appl) Γ, ∆ ⊢ A : E Γ, ∆ ⊢ C : D Γ ⊢ B : D Γ ⊢ [C ≪∆ B]A : [C ≪∆ B]⊤E (Subst)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 26

slide-76
SLIDE 76

Index

The Type System II

Γ, ∆ ⊢ B : C Γ ⊢ ΠA:∆.C : s Γ ⊢ A →∆ B : ΠA:∆.C (Abs) Γ ⊢ C : s1 (s1, s2, s3) ∈ R Γ, ∆ ⊢ A : C Γ, ∆ ⊢ B : s2 Γ ⊢ ΠA:∆.B : s3 (Prod) Γ ⊢ A : ΠC:∆.D Γ, ∆ ⊢ C : E Γ ⊢ B : E Γ ⊢ A B : [C ≪∆ B]D (Appl) Γ, ∆ ⊢ A : E Γ, ∆ ⊢ C : D Γ ⊢ B : D Γ ⊢ [C ≪∆ B]A : [C ≪∆ B]⊤E (Subst)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 26

slide-77
SLIDE 77

Index

The Type System II

Γ, ∆ ⊢ B : C Γ ⊢ ΠA:∆.C : s Γ ⊢ A →∆ B : ΠA:∆.C (Abs) Γ ⊢ C : s1 (s1, s2, s3) ∈ R Γ, ∆ ⊢ A : C Γ, ∆ ⊢ B : s2 Γ ⊢ ΠA:∆.B : s3 (Prod) Γ ⊢ A : ΠC:∆.D Γ, ∆ ⊢ C : E Γ ⊢ B : E Γ ⊢ A B : [C ≪∆ B]D (Appl) Γ, ∆ ⊢ A : E Γ, ∆ ⊢ C : D Γ ⊢ B : D Γ ⊢ [C ≪∆ B]A : [C ≪∆ B]⊤E (Subst)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 26

slide-78
SLIDE 78

Index

The Type System II

Γ, ∆ ⊢ B : C Γ ⊢ ΠA:∆.C : s Γ ⊢ A →∆ B : ΠA:∆.C (Abs) Γ ⊢ C : s1 (s1, s2, s3) ∈ R Γ, ∆ ⊢ A : C Γ, ∆ ⊢ B : s2 Γ ⊢ ΠA:∆.B : s3 (Prod) Γ ⊢ A : ΠC:∆.D Γ, ∆ ⊢ C : E Γ ⊢ B : E Γ ⊢ A B : [C ≪∆ B]D (Appl) Γ, ∆ ⊢ A : E Γ, ∆ ⊢ C : D Γ ⊢ B : D Γ ⊢ [C ≪∆ B]A : [C ≪∆ B]⊤E (Subst)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 26

slide-79
SLIDE 79

Index

The Type System II

Γ, ∆ ⊢ B : C Γ ⊢ ΠA:∆.C : s Γ ⊢ A →∆ B : ΠA:∆.C (Abs) Γ ⊢ C : s1 (s1, s2, s3) ∈ R Γ, ∆ ⊢ A : C Γ, ∆ ⊢ B : s2 Γ ⊢ ΠA:∆.B : s3 (Prod) Γ ⊢ A : ΠC:∆.D Γ, ∆ ⊢ C : E Γ ⊢ B : E Γ ⊢ A B : [C ≪∆ B]D (Appl) Γ, ∆ ⊢ A : E Γ, ∆ ⊢ C : D Γ ⊢ B : D Γ ⊢ [C ≪∆ B]A : [C ≪∆ B]⊤E (Subst)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 26

slide-80
SLIDE 80

Index

The Type System II

Γ, ∆ ⊢ B : C Γ ⊢ ΠA:∆.C : s Γ ⊢ A →∆ B : ΠA:∆.C (Abs) Γ ⊢ C : s1 (s1, s2, s3) ∈ R Γ, ∆ ⊢ A : C Γ, ∆ ⊢ B : s2 Γ ⊢ ΠA:∆.B : s3 (Prod) Γ ⊢ A : ΠC:∆.D Γ, ∆ ⊢ C : E Γ ⊢ B : E Γ ⊢ A B : [C ≪∆ B]D (Appl) Γ, ∆ ⊢ A : E Γ, ∆ ⊢ C : D Γ ⊢ B : D Γ ⊢ [C ≪∆ B]A : [C ≪∆ B]⊤E (Subst)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 26

slide-81
SLIDE 81

Index

The Type System II

Γ, ∆ ⊢ B : C Γ ⊢ ΠA:∆.C : s Γ ⊢ A →∆ B : ΠA:∆.C (Abs) Γ ⊢ C : s1 (s1, s2, s3) ∈ R Γ, ∆ ⊢ A : C Γ, ∆ ⊢ B : s2 Γ ⊢ ΠA:∆.B : s3 (Prod) Γ ⊢ A : ΠC:∆.D Γ, ∆ ⊢ C : E Γ ⊢ B : E Γ ⊢ A B : [C ≪∆ B]D (Appl) Γ, ∆ ⊢ A : E Γ, ∆ ⊢ C : D Γ ⊢ B : D Γ ⊢ [C ≪∆ B]A : [C ≪∆ B]⊤E (Subst)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 26

slide-82
SLIDE 82

Index

Fetch Your System

Γ ⊢ C : s1 (s1, s2, s3) ∈ R Γ, ∆ ⊢ A : C Γ, ∆ ⊢ B : s2 Γ ⊢ ΠA:∆.B : s3 (Prod)

System Rules ρ → (∗, ∗, ∗) ρ2 (∗, ∗, ∗) (✷, ∗, ∗) ρω (∗, ∗, ∗) (✷, ✷, ✷) ρω (∗, ∗, ∗) (∗, ✷, ✷) (✷, ✷, ✷) ρLF (∗, ∗, ∗) (∗, ✷, ✷) ρP2 (∗, ∗, ∗) (✷, ∗, ∗) (∗, ✷, ✷) ρPω (∗, ∗, ∗) (∗, ✷, ✷) (✷, ✷, ✷) ρPω (∗, ∗, ∗) (✷, ∗, ∗) (∗, ✷, ✷) (✷, ✷, ✷)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 27

slide-83
SLIDE 83

Index

P2T S Typed Examples

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 28

slide-84
SLIDE 84

Index

Example: Simple Type Derivation

Let Γ

= i:∗, f:ΠZ:Σ.i, 3:i, 4:i, and ∆

= X:i, and Σ

= Z:i,

. . . Γ, ∆ ⊢ (λ3:∅.3) : Π3:∅.i 5 6 Γ, ∆ ⊢ (λ3:∅.3) X : [3 ≪∅ X].i 3 (∗, ∗, ∗) ∈ R Γ ⊢ [Z ≪Σ X].i : ∗ Γ, ∆ ⊢ [3 ≪∅ X].i : ∗ Γ ⊢ Πf(X):∆.[3 ≪∅ X].i : ∗ Γ ⊢ λf(X):∆.(λ3:∅.3)X : Πf(X):∆.[3 ≪∅ X].i 3 4 Γ ⊢ (λf(X):∆.(λ3:∅.3)X) f(3) : [f(X) ≪∆ f(3)].[3 ≪∅ X].i 1 2 Γ ⊢ (λf(X):∆.(λ3:∅.3)X) f(3) : i where 1

= [f(X) ≪∆ f(3)].[3 ≪∅ X].i=

ρ σ δi, and

2

= Γ ⊢ i : ∗, and

3

= Γ, ∆ ⊢ f(X) : [Z ≪Σ X].i, and

4

= Γ ⊢ f(3) : [Z ≪Σ 3].i, and

5

= Γ, ∆ ⊢ X : i, and

6

= Γ, ∆ ⊢ 3 : i.

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 29

slide-85
SLIDE 85

Index

Example: Simple Type Derivation

Let Γ

= i:∗, f:ΠZ:Σ.i, 3:i, 4:i, and ∆

= X:i, and Σ

= Z:i,

. . . Γ, ∆ ⊢ (λ3:∅.3) : Π3:∅.i 5 6 Γ, ∆ ⊢ (λ3:∅.3) X : [3 ≪∅ X].i 3 (∗, ∗, ∗) ∈ R Γ ⊢ [Z ≪Σ X].i : ∗ Γ, ∆ ⊢ [3 ≪∅ X].i : ∗ Γ ⊢ Πf(X):∆.[3 ≪∅ X].i : ∗ Γ ⊢ λf(X):∆.(λ3:∅.3)X : Πf(X):∆.[3 ≪∅ X].i 3 4 Γ ⊢ (λf(X):∆.(λ3:∅.3)X) f(3) : [f(X) ≪∆ f(3)].[3 ≪∅ X].i 1 2 Γ ⊢ (λf(X):∆.(λ3:∅.3)X) f(3) : i where 1

= [f(X) ≪∆ f(3)].[3 ≪∅ X].i=

ρ σ δi, and

2

= Γ ⊢ i : ∗, and

3

= Γ, ∆ ⊢ f(X) : [Z ≪Σ X].i, and

4

= Γ ⊢ f(3) : [Z ≪Σ 3].i, and

5

= Γ, ∆ ⊢ X : i, and

6

= Γ, ∆ ⊢ 3 : i.

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 29

slide-86
SLIDE 86

Index

Playing with the Rho-cube: ρLF

  • Let Γ

= i:∗, f:ΠX:(X:i).∗, 3:i

Γ, X:i ⊢ X : i Γ ⊢ i : ∗ Γ, X:i ⊢ ∗ : ✷ Γ ⊢ ΠX:(X:i).∗ : ✷ Γ ⊢ f : ΠX:(X:i).∗ Γ, X:i ⊢ X : i Γ ⊢ 3 : i Γ ⊢ f(3) : [X ≪(X:i) 3]⊤∗ ≡ ∗

  • Γ ⊢ ΠX:(X:i).∗ : ✷ can be derived thanks to the specific rule (∗, ✷, ✷)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 30

slide-87
SLIDE 87

Index

Playing with the Rho-cube: ρ2

  • In this system the following polymorphic identity with pattern f” can be

derived (where f denotes f X∗→X∗):

⊢ ∗ : ✷ ⊢ X∗ : ∗ ⊢ Y X∗ : X∗ (Conv+Appl) . . . ⊢ f(Y X∗) : X∗ ⊢ ∗ : ✷ ⊢ X∗ : ∗ ⊢ ∗ : ✷ ⊢ X∗ : ∗ X:∗, Y :X ⊢ f(Y X∗) → X : ∗ ⊢ f(Y X∗) → Y X∗ : f(Y X∗) → X∗ ⊢ ∗ : ✷ ⊢ X∗ : ∗ ⊢ ∗ : ✷

  • k!

. . . ⊢ f(Y X∗) → X∗ : ∗ X:∗, Y :X ⊢ X∗ → f(Y X∗) → X : ∗ X:∗, Y :X ⊢ X∗ → f(Y X∗) → Y X∗ : X:∗, Y :X ⊢ X∗ → f(Y X∗) → X : ∗

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 31

slide-88
SLIDE 88

Index

Playing with the Rho-cube: ρ2

  • In this system the following polymorphic identity with pattern f” can be

derived (where f denotes f X∗→X∗):

⊢ ∗ : ✷ ⊢ X∗ : ∗ ⊢ Y X∗ : X∗ (Conv+Appl) . . . ⊢ f(Y X∗) : X∗ ⊢ ∗ : ✷ ⊢ X∗ : ∗ ⊢ ∗ : ✷ ⊢ X∗ : ∗ X:∗, Y :X ⊢ f(Y X∗) → X : ∗ ⊢ f(Y X∗) → Y X∗ : f(Y X∗) → X∗ ⊢ ∗ : ✷ ⊢ X∗ : ∗ ⊢ ∗ : ✷

  • k!

. . . ⊢ f(Y X∗) → X∗ : ∗ X:∗, Y :X ⊢ X∗ → f(Y X∗) → X : ∗ X:∗, Y :X ⊢ X∗ → f(Y X∗) → Y X∗ : X:∗, Y :X ⊢ X∗ → f(Y X∗) → X : ∗

  • X:∗, Y :X ⊢ f(Y X∗) → X : ∗ can be derived thanks to (∗, ∗, ∗)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 31

slide-89
SLIDE 89

Index

Playing with the Rho-cube: ρ2

  • In this system the following polymorphic identity with pattern f” can be

derived (where f denotes f X∗→X∗):

⊢ ∗ : ✷ ⊢ X∗ : ∗ ⊢ Y X∗ : X∗ (Conv+Appl) . . . ⊢ f(Y X∗) : X∗ ⊢ ∗ : ✷ ⊢ X∗ : ∗ ⊢ ∗ : ✷ ⊢ X∗ : ∗ X:∗, Y :X ⊢ f(Y X∗) → X : ∗ ⊢ f(Y X∗) → Y X∗ : f(Y X∗) → X∗ ⊢ ∗ : ✷ ⊢ X∗ : ∗ ⊢ ∗ : ✷

  • k!

. . . ⊢ f(Y X∗) → X∗ : ∗ X:∗, Y :X ⊢ X∗ → f(Y X∗) → X : ∗ X:∗, Y :X ⊢ X∗ → f(Y X∗) → Y X∗ : X:∗, Y :X ⊢ X∗ → f(Y X∗) → X : ∗

  • X:∗, Y :X ⊢ f(Y X∗) → X : ∗ can be derived thanks to (∗, ∗, ∗)
  • X:∗, Y :X ⊢ X∗ → f(Y X∗) → X : ∗ can be derived thanks to (✷, ∗, ∗)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 31

slide-90
SLIDE 90

Index

P2T S Metatheory

CONCLUSIONS

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 32

slide-91
SLIDE 91

Index

P

2T S: Some Results

  • Confluence The relation →

ρ σ δ is confluent

  • Subject Reduction. If Γ ⊢ A : B, and A →

ρ σ δ C, then Γ ⊢ C : B

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 33

slide-92
SLIDE 92

Index

P

2T S: Some Results

  • Confluence The relation →

ρ σ δ is confluent

  • Subject Reduction. If Γ ⊢ A : B, and A →

ρ σ δ C, then Γ ⊢ C : B

  • Consistency. Any normalizing P

2T S is logically consistent, i.e.

for every sort s ∈ S, X:s ⊢ A : X

  • Conservativity. P

2T Ss are a conservative extension of PTSs:

Γ ⊢PTS A : B ⇐ ⇒ Γ† ⊢P2

T S A† : B†

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 33

slide-93
SLIDE 93

Index

Open Tracks

  • strong normalization, we conjecture that standard model construction

techniques can be used to prove strong normalization of the λ

  • cube; Benj
  • type checking/inference, we conjecture that existing algorithms for PTSs adapt

readily to P

2T Ss; Luigi

  • it would be interesting to study P

2T Ss with a limited form of decidable

higher-order unification, in the style of λ-Prolog; Claude/Gop?

  • encoding dependent case analysis, dependent sum types (records) `

a laCoquand-Pollack-Luo; ?

  • explicit substitutions. The extension is not trivial, because of delayed matching

constraints, but the resulting formalism could serve as the core engine of a little type-checker underneath of a powerful proof assistant; u:Claude-Germain,t:?

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 34

slide-94
SLIDE 94

Index

Challenge ... Extending the Curry-Howard Isomorphism

  • The extension can be considered from the point of view of sequent calculi,

deduction modulo, and natural deduction respectively;

  • From the point of view of sequent calculi, it remains to investigate how P

2T Ss

can be used to extend previous results on term calculi for sequent calculi, and how their extension with matching theories can be used to provide suitable term calculi for deduction modulo;

  • From the point of view of natural deduction, P

2T Ss correspond to an extension

  • f natural deduction where parts of proof trees are discharged instead of

assumptions;

  • To our best knowledge, such an extended form of natural deduction has not

been considered previously, but it seems interesting to investigate whether such an extended natural deduction could find some applications in proof assistants, e.g. for transforming and optimizing proofs. END

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 35

slide-95
SLIDE 95

Index

Logics and Rho ` a la Church

The relation with (intuitionistic) logic through the so-called Curry-Howard isomorphism, or ‘formulae-as-types’ principle, has been profoundly studied for

  • Lambda. However, for Rho `

a laChurch, this relation is less clear, as demonstrated by the authors. The principle could be adapted as follows: Given a typed term A, if we can derive for A a type τ in the typed system Rho, with a derivation DerT, then the term A can be seen as the coding

  • f a logical proof, proving the formula ϕ that can be interpreted as the

type τ assigned to A.

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 36

slide-96
SLIDE 96

Index

Curry from Church

For those systems, if DerT is a typed derivation, and − is the above meant erasing function, then by applying − to the “subject” of every judgment in DerT, we obtain a valid type assignment derivation DerU with the same structure

  • f the typed one. Vice versa, every type assignment derivation can be viewed as

the result of an application of − to a typed one. In particular, the erasing function − induces an isomorphism between every typed system and the corresponding type assignment system.

f

=

f X

=

X A τ

=

A [P ≪∆ A].B

=

[P ≪ A ]. B P →∆ A

=

P → A A B

=

A B A; B

=

A ; B

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 37

slide-97
SLIDE 97

Index

Logics and Rho ` a la Curry

For the type assignment system Rho the relation with logic is less clear even for the corresponding type assignments for the Lambda. The ‘formulae-as-types’ principle of Curry and Howard could be extended to the above type assignment systems as follows: Given an untyped term U, if we can assign a type τ in the type assignment system Rho, with a derivation DerU, then:

  • DerU can be interpreted as the coding of a proof for the logic formulas

ϕ which corresponds to the interpretation of the type τ assigned to U;

  • U can be interpreted as the coding of a “logical proof schema”, whose

instances (of the schema) prove, respectively, all the logic formulas ϕi’s that can be interpreted as the types τi’s that can be assigned to U.

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 38

slide-98
SLIDE 98

Index

Typed and Untyped Judgments and Derivations

DerT DerU DerU −1 Γ ⊢U A : τ Γ ⊢T A : τ

·

· −1 Der

✛ ✲ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞ ☞

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 39

slide-99
SLIDE 99

Index

Thanks for youρ attention ...

λ

✻ ✲ ✚✚✚✚ ✚ ❃λ

ω

✻ ✲

λ

≪2

✲ ✚✚✚✚ ✚ ❃λ

ω

λ

P

✚✚✚✚ ✚ ❃ ✻

λ

λ

P2

✚✚✚✚ ✚ ❃

λ

PROP

✻ ✲ ✚✚✚✚ ✚ ❃

PROPω

✻ ✲

PROP2

✲ ✚✚✚✚ ✚ ❃

PROPω

PRED

✚✚✚✚ ✚ ❃ ✻

PREDω

PRED2

✚✚✚✚ ✚ ❃

PREDω

PROP proposition logic PRED predicate logic PROP2 second-order PROP PRED2 second-order PRED PROPω weakly higher-order PROP PREDω weakly higher-order PRED PROPω higher-order PROP PREDω higher-order PRED

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 40

slide-100
SLIDE 100

Index

Thanks for youρ attention ...

λ

✻ ✲ ✚✚✚✚ ✚ ❃λ

ω

✻ ✲

λ

≪2

✲ ✚✚✚✚ ✚ ❃λ

ω

λ

P

✚✚✚✚ ✚ ❃ ✻

λ

λ

P2

✚✚✚✚ ✚ ❃

λ

PROP

✻ ✲ ✚✚✚✚ ✚ ❃

PROPω

✻ ✲

PROP2

✲ ✚✚✚✚ ✚ ❃

PROPω

PRED

✚✚✚✚ ✚ ❃ ✻

PREDω

PRED2

✚✚✚✚ ✚ ❃

PREDω

PROP proposition logic PRED predicate logic PROP2 second-order PROP PRED2 second-order PRED PROPω weakly higher-order PROP PREDω weakly higher-order PRED PROPω higher-order PROP PREDω higher-order PRED

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 40

slide-101
SLIDE 101

Index

Thanks for youρ attention ...

λ

✻ ✲ ✚✚✚✚ ✚ ❃λ

ω

✻ ✲

λ

≪2

✲ ✚✚✚✚ ✚ ❃λ

ω

λ

P

✚✚✚✚ ✚ ❃ ✻

λ

λ

P2

✚✚✚✚ ✚ ❃

λ

PROP

✻ ✲ ✚✚✚✚ ✚ ❃

PROPω

✻ ✲

PROP2

✲ ✚✚✚✚ ✚ ❃

PROPω

PRED

✚✚✚✚ ✚ ❃ ✻

PREDω

PRED2

✚✚✚✚ ✚ ❃

PREDω

PROP proposition logic PRED predicate logic PROP2 second-order PROP PRED2 second-order PRED PROPω weakly higher-order PROP PREDω weakly higher-order PRED PROPω higher-order PROP PREDω higher-order PRED

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 40

slide-102
SLIDE 102

Index

The Uncle Pat and the Lady Match

+ = P2T S

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 41

slide-103
SLIDE 103

Index

P2T S ALL THE ZOOMS BELOW!

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 42

slide-104
SLIDE 104

Index

Lambda Calculi ` a la Church and Logics

  • Lambda abstractions are decorated with types, e.g. λx:σ.M
  • Type Systems λi vs. Logic Systems Li via the well-known Curry-Howard

Isomorphism ”proofs-as-(λ)-terms & propositions-as-types”

  • Each logical system Li correspond to a type system λi, and for every formula φ

⊢Li φ = ⇒ ∃M. Γ ⊢λi M : [ [φ] ]

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 43

slide-105
SLIDE 105

Index

Lambda Calculi ` a la Church and Logics

  • Lambda abstractions are decorated with types, e.g. λx:σ.M
  • Type Systems λi vs. Logic Systems Li via the well-known Curry-Howard

Isomorphism ”proofs-as-(λ)-terms & propositions-as-types”

  • Each logical system Li correspond to a type system λi, and for every formula φ

⊢Li φ = ⇒ ∃M. Γ ⊢λi M : [ [φ] ]

  • Γ contains the types of the free variables of M, and [

[φ] ] is a canonical interpretation of φ in λi

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 43

slide-106
SLIDE 106

Index

Lambda Calculi ` a la Church and Logics

  • Lambda abstractions are decorated with types, e.g. λx:σ.M
  • Type Systems λi vs. Logic Systems Li via the well-known Curry-Howard

Isomorphism ”proofs-as-(λ)-terms & propositions-as-types”

  • Each logical system Li correspond to a type system λi, and for every formula φ

⊢Li φ = ⇒ ∃M. Γ ⊢λi M : [ [φ] ]

  • Γ contains the types of the free variables of M, and [

[φ] ] is a canonical interpretation of φ in λi

  • β-reduction (λx:σ.M) N →β M{N/x} in λi as cut-elimination in Li

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 43

slide-107
SLIDE 107

Index

Lambda Calculi ` a la Church and Logics

  • Lambda abstractions are decorated with types, e.g. λx:σ.M
  • Type Systems λi vs. Logic Systems Li via the well-known Curry-Howard

Isomorphism ”proofs-as-(λ)-terms & propositions-as-types”

  • Each logical system Li correspond to a type system λi, and for every formula φ

⊢Li φ = ⇒ ∃M. Γ ⊢λi M : [ [φ] ]

  • Γ contains the types of the free variables of M, and [

[φ] ] is a canonical interpretation of φ in λi

  • β-reduction (λx:σ.M) N →β M{N/x} in λi as cut-elimination in Li
  • Subject Reduction Theorem as a correction criterion for cut-elimination BACK

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 43

slide-108
SLIDE 108

Index

The Famous Barendregt’s λ-cube and its 8 logic systems

λ→

✻ ✲ ✚✚✚✚ ✚ ❃λω ✻ ✲

λ2

✲ ✚✚✚✚ ✚ ❃λω ✲

λP

✚✚✚✚ ✚ ❃ ✻

λPω

λP2

✚✚✚✚ ✚ ❃

λPω

PROP

✻ ✲ ✚✚✚✚ ✚ ❃

PROPω

✻ ✲

PROP2

✲ ✚✚✚✚ ✚ ❃

PROPω

PRED

✚✚✚✚ ✚ ❃ ✻

PREDω

PRED2

✚✚✚✚ ✚ ❃

PREDω

PROP proposition logic PRED predicate logic PROP2 second-order PROP PRED2 second-order PRED PROPω weakly higher-order PROP PREDω weakly higher-order PRED PROPω higher-order PROP PREDω higher-order PRED

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 44

slide-109
SLIDE 109

Index

The Famous Barendregt’s λ-cube and its 8 logic systems

λ→

✻ ✲ ✚✚✚✚ ✚ ❃λω ✻ ✲

λ2

✲ ✚✚✚✚ ✚ ❃λω ✲

λP

✚✚✚✚ ✚ ❃ ✻

λPω

λP2

✚✚✚✚ ✚ ❃

λPω

PROP

✻ ✲ ✚✚✚✚ ✚ ❃

PROPω

✻ ✲

PROP2

✲ ✚✚✚✚ ✚ ❃

PROPω

PRED

✚✚✚✚ ✚ ❃ ✻

PREDω

PRED2

✚✚✚✚ ✚ ❃

PREDω

PROP proposition logic PRED predicate logic PROP2 second-order PROP PRED2 second-order PRED PROPω weakly higher-order PROP PREDω weakly higher-order PRED PROPω higher-order PROP PREDω higher-order PRED

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 44

slide-110
SLIDE 110

Index

The Famous Barendregt’s λ-cube and its 8 logic systems

λ→

✻ ✲ ✚✚✚✚ ✚ ❃λω ✻ ✲

λ2

✲ ✚✚✚✚ ✚ ❃λω ✲

λP

✚✚✚✚ ✚ ❃ ✻

λPω

λP2

✚✚✚✚ ✚ ❃

λPω

PROP

✻ ✲ ✚✚✚✚ ✚ ❃

PROPω

✻ ✲

PROP2

✲ ✚✚✚✚ ✚ ❃

PROPω

PRED

✚✚✚✚ ✚ ❃ ✻

PREDω

PRED2

✚✚✚✚ ✚ ❃

PREDω

PROP proposition logic PRED predicate logic PROP2 second-order PROP PRED2 second-order PRED PROPω weakly higher-order PROP PREDω weakly higher-order PRED PROPω higher-order PROP PREDω higher-order PRED

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 44

slide-111
SLIDE 111

Index

From Barendregt’s λ-cube to Pure Type Systems (PTSs)

  • Further generalization of various type systems invented independently by

Berardi and Terlouw in ’89 BACK

  • Many systems of typed λ-calculus `

a la Church can be seen as PTSs

  • One of the success of PTSs is concerned with logics: the 8 logical systems can

be described/generalised as a simple unique PTS

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 45

slide-112
SLIDE 112

Index

From Barendregt’s λ-cube to Pure Type Systems (PTSs)

  • Further generalization of various type systems invented independently by

Berardi and Terlouw in ’89 BACK

  • Many systems of typed λ-calculus `

a la Church can be seen as PTSs

  • One of the success of PTSs is concerned with logics: the 8 logical systems can

be described/generalised as a simple unique PTS

  • Another one is the compactness of the notation of PTSs which greatly allows to

factorise and simplify proofs in metatheory, in the style “one theorem fits all!”

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 45

slide-113
SLIDE 113

Index

From Barendregt’s λ-cube to Pure Type Systems (PTSs)

  • Further generalization of various type systems invented independently by

Berardi and Terlouw in ’89 BACK

  • Many systems of typed λ-calculus `

a la Church can be seen as PTSs

  • One of the success of PTSs is concerned with logics: the 8 logical systems can

be described/generalised as a simple unique PTS

  • Another one is the compactness of the notation of PTSs which greatly allows to

factorise and simplify proofs in metatheory, in the style “one theorem fits all!”

  • Examples of well-known PTSs are λHOL, λPRED, λCC (a.k.a. the λ-cube)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 45

slide-114
SLIDE 114

Index

More Pragmatically ...

  • Almost all proof assistants and relating metalanguages based on the

proposition-as-type principle, have a firm theoretical basis in logics represented via PTSs

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 46

slide-115
SLIDE 115

Index

More Pragmatically ...

  • Almost all proof assistants and relating metalanguages based on the

proposition-as-type principle, have a firm theoretical basis in logics represented via PTSs

  • AUTOMATH, NUPRL, HOL, LEGO, (TW)ELF, AGDA, ISABELLE, COQ,

MIZAR, ACL2, PVS ...

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 46

slide-116
SLIDE 116

Index

More Pragmatically ...

  • Almost all proof assistants and relating metalanguages based on the

proposition-as-type principle, have a firm theoretical basis in logics represented via PTSs

  • AUTOMATH, NUPRL, HOL, LEGO, (TW)ELF, AGDA, ISABELLE, COQ,

MIZAR, ACL2, PVS ...

  • The degree of automatization of such proof assistants depends also on the

capability of simplifying terms

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 46

slide-117
SLIDE 117

Index

More Pragmatically ...

  • Almost all proof assistants and relating metalanguages based on the

proposition-as-type principle, have a firm theoretical basis in logics represented via PTSs

  • AUTOMATH, NUPRL, HOL, LEGO, (TW)ELF, AGDA, ISABELLE, COQ,

MIZAR, ACL2, PVS ...

  • The degree of automatization of such proof assistants depends also on the

capability of simplifying terms

  • The Poincar´

e principle can be (βιδ)-reductions, structural well-founded recursion, provable equality, or some arbitrary notion of reduction

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 46

slide-118
SLIDE 118

Index

More Pragmatically ...

  • Almost all proof assistants and relating metalanguages based on the

proposition-as-type principle, have a firm theoretical basis in logics represented via PTSs

  • AUTOMATH, NUPRL, HOL, LEGO, (TW)ELF, AGDA, ISABELLE, COQ,

MIZAR, ACL2, PVS ...

  • The degree of automatization of such proof assistants depends also on the

capability of simplifying terms

  • The Poincar´

e principle can be (βιδ)-reductions, structural well-founded recursion, provable equality, or some arbitrary notion of reduction

  • The more reductions principles you have in the metalanguage, the more

“powerful” the proof assistant is ... BACK

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 46

slide-119
SLIDE 119

Index

P

2T S: One-step, Many-steps, Congruence

Let Ctx[−] be any term T with a “single hole” inside, and let Ctx[A] be the result

  • f filling the hole with the term A;
  • 1. the one-step evaluation → is defined by the following inference rule, where

ρ σ δ≡→ρ ∪ →σ ∪ →δ:

A →

ρ σ δ B

Ctx[A] →

ρ σ δ Ctx[B] (Ctx[−])

  • 2. the many-step evaluation →

ρ σ δ and congruence relation = ρ σ δ are respectively

defined as the reflexive-transitive and reflexive-symmetric-transitive closure of →

ρ σ δ

BACK

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 47

slide-120
SLIDE 120

Index

Abbreviations and Priorities

A(B1 · · · Bn)

= A • B1 • · · · •Bn function-application

(Ai)i=1...n

= A1; · · · ; An

structure/object A.B

= A • B • A

Kamin’s self-application

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 48

slide-121
SLIDE 121

Index

Abbreviations and Priorities

A(B1 · · · Bn)

= A • B1 • · · · •Bn function-application

(Ai)i=1...n

= A1; · · · ; An

structure/object A.B

= A • B • A

Kamin’s self-application Operator Associate Priority ; Right >

: .

Right > [ ≪ ]. Right >

  • Left

>

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 48

slide-122
SLIDE 122

Index

... still substitutions

  • We let

Dom(σ) = {X1, . . . , Xm}

and

CoDom(∆) = ∪

i=1...mFv(Ai)

  • A substitution σ is independent from ∆, written σ∢ ∆ if

Dom(σ) ∩ Dom(∆) = ∅

and

CoDom(σ) ∩ Dom(∆) = ∅

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 49

slide-123
SLIDE 123

Index

The Algorithm Alg

(Lbd/Prod) ( A1:∆.B1)≺ ≺Σ

Γ(

A2:∆.B2)

A1≺

≺Σ

Γ,∆A2 ∧ B1≺

≺Σ

Γ,∆B2

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 50

slide-124
SLIDE 124

Index

The Algorithm Alg

(Lbd/Prod) ( A1:∆.B1)≺ ≺Σ

Γ(

A2:∆.B2)

A1≺

≺Σ

Γ,∆A2 ∧ B1≺

≺Σ

Γ,∆B2

(Delay) [A1 ≪∆ C1].B1≺ ≺Σ

Γ[A2 ≪∆ C2].B2

A1≺

≺Σ

Γ,∆A2 ∧ B1≺

≺Σ

Γ,∆B2 ∧ C1≺

≺Σ

ΓC2

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 50

slide-125
SLIDE 125

Index

The Algorithm Alg

(Lbd/Prod) ( A1:∆.B1)≺ ≺Σ

Γ(

A2:∆.B2)

A1≺

≺Σ

Γ,∆A2 ∧ B1≺

≺Σ

Γ,∆B2

(Delay) [A1 ≪∆ C1].B1≺ ≺Σ

Γ[A2 ≪∆ C2].B2

A1≺

≺Σ

Γ,∆A2 ∧ B1≺

≺Σ

Γ,∆B2 ∧ C1≺

≺Σ

ΓC2

(Appl/Struct) (A1; B1)≺ ≺Σ

Γ(A2; B2)

A1≺

≺Σ

ΓA2 ∧ B1≺

≺Σ

ΓB2

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 50

slide-126
SLIDE 126

Index

The Algorithm Alg

(Lbd/Prod) ( A1:∆.B1)≺ ≺Σ

Γ(

A2:∆.B2)

A1≺

≺Σ

Γ,∆A2 ∧ B1≺

≺Σ

Γ,∆B2

(Delay) [A1 ≪∆ C1].B1≺ ≺Σ

Γ[A2 ≪∆ C2].B2

A1≺

≺Σ

Γ,∆A2 ∧ B1≺

≺Σ

Γ,∆B2 ∧ C1≺

≺Σ

ΓC2

(Appl/Struct) (A1; B1)≺ ≺Σ

Γ(A2; B2)

A1≺

≺Σ

ΓA2 ∧ B1≺

≺Σ

ΓB2

[A ≪Θ C].B →σ Bσ(A≺ ≺Θ

∅ C)

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 50

slide-127
SLIDE 127

Index

Termination of Alg

  • The relation

is defined as the reflexive, transitive and compatible closure of

  • If T

T′, with T′ a matching system in solved form then, we say that the matching algorithm Alg (taking as input the system T) succeeds

  • The matching algorithm is clearly terminating (since all rules decrease the size
  • f terms) and deterministic (no critical pairs), and of course, it works modulo

α-conversion and Barendregt’s hygiene-convention

  • Starting form a given solved matching system of the form

T

=

i=0...n Xi≺

≺Σ

∆iAi

j=0...m aj≺

≺Σ

∆jaj

the corresponding substitution {A1/X1 · · · An/Xn} is exhibited.

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 51

slide-128
SLIDE 128

Index

Functional P

2T S

We require all specifications to be functional, i.e. for every s1, s2, s′

2, s3, s′ 3 ∈ S,

the following holds: (s1, s2) ∈ A and (s1, s′

2) ∈ A

implies s2 ≡ s′

2

(s1, s2, s3) ∈ R and (s1, s2, s′

3) ∈ R

implies s3 ≡ s′

3.

Furthermore, we let S⊤ denote the set of topsorts, i.e. S⊤ = {s ∈ S | ∀s′ ∈ S. (s, s′) ∈ A} and define a variant of delayed matching constraint as follows: [A ≪∆ C]⊤.B =

  • B

if B ∈ S⊤ [A ≪∆ C].B

  • therwise

BACK

c Luigi Liquori Rhappy-Days, Nancy, March 22, 2004 52