simply typed lambda-calculus modulo isomorphisms

86
Type theory modulo isomorphisms Alejandro Díaz-Caro Université Paris-Ouest Nanterre La Défense INRIA Paris-Rocquencourt Joint work with Gilles Dowek LDP Seminar Marseille, April 9th, 2014

Upload: alejandro-diaz-caro

Post on 11-May-2015

4.022 views

Category:

Education


1 download

DESCRIPTION

Slides as presented in TYPES'14. Full manuscript at http://www.diaz-caro.info/stmti.pdf

TRANSCRIPT

Page 1: Simply typed lambda-calculus modulo isomorphisms

Type theory modulo isomorphisms

Alejandro Díaz-CaroUniversité Paris-Ouest Nanterre La Défense

INRIA Paris-Rocquencourt

Joint work with Gilles Dowek

LDP SeminarMarseille, April 9th, 2014

Page 2: Simply typed lambda-calculus modulo isomorphisms

Motivation

Definitionally equivalent“Definitional equality is the equivalence relation generated byabbreviatory definitions” [Martin-Löf, 1980]

e.g. 2 =def s(s(0))

Isomorphism

A ≡ A′ iff ∃f , g s.t.

f g = IdAg f = IdA′

e.g. A ∧ B ≡ B ∧ A

Isomorphism is stronger that “definitionally equivalent”e.g. A ∧ B ≡ B ∧ A but 〈r, s〉 6=def 〈s, r〉

So having r : (A ∧ B)⇒ C and s : B ∧ Ais not enough to derive C

Our goal is to identify isomorphic types

2 / 31

Page 3: Simply typed lambda-calculus modulo isomorphisms

Motivation

Definitionally equivalent“Definitional equality is the equivalence relation generated byabbreviatory definitions” [Martin-Löf, 1980]

e.g. 2 =def s(s(0))

Isomorphism

A ≡ A′ iff ∃f , g s.t.

f g = IdAg f = IdA′

e.g. A ∧ B ≡ B ∧ A

Isomorphism is stronger that “definitionally equivalent”e.g. A ∧ B ≡ B ∧ A but 〈r, s〉 6=def 〈s, r〉

So having r : (A ∧ B)⇒ C and s : B ∧ Ais not enough to derive C

Our goal is to identify isomorphic types

2 / 31

Page 4: Simply typed lambda-calculus modulo isomorphisms

Motivation

Definitionally equivalent“Definitional equality is the equivalence relation generated byabbreviatory definitions” [Martin-Löf, 1980]

e.g. 2 =def s(s(0))

Isomorphism

A ≡ A′ iff ∃f , g s.t.

f g = IdAg f = IdA′

e.g. A ∧ B ≡ B ∧ A

Isomorphism is stronger that “definitionally equivalent”e.g. A ∧ B ≡ B ∧ A but 〈r, s〉 6=def 〈s, r〉

So having r : (A ∧ B)⇒ C and s : B ∧ Ais not enough to derive C

Our goal is to identify isomorphic types

2 / 31

Page 5: Simply typed lambda-calculus modulo isomorphisms

Motivation

Definitionally equivalent“Definitional equality is the equivalence relation generated byabbreviatory definitions” [Martin-Löf, 1980]

e.g. 2 =def s(s(0))

Isomorphism

A ≡ A′ iff ∃f , g s.t.

f g = IdAg f = IdA′

e.g. A ∧ B ≡ B ∧ A

Isomorphism is stronger that “definitionally equivalent”e.g. A ∧ B ≡ B ∧ A but 〈r, s〉 6=def 〈s, r〉

So having r : (A ∧ B)⇒ C and s : B ∧ Ais not enough to derive C

Our goal is to identify isomorphic types

2 / 31

Page 6: Simply typed lambda-calculus modulo isomorphisms

Outline

Part 1: A type-isomorphic lambda-calculusDefining the systemNormalisation

Part 2: The other motivationThe historical motivation, in one slideRelation with probabilistic calculi

Future work: some insights

3 / 31

Page 7: Simply typed lambda-calculus modulo isomorphisms

The basic setting

I Simply types with conjunction and implication

A,B,C ::= τ | A⇒ B | A ∧ B

I An equivalence relation between types (based on the isomorphisms1)1. A ∧ B ≡ B ∧ A (comm)2. A ∧ (B ∧ C) ≡ (A ∧ B) ∧ C (asso)3. (A ∧ B)⇒ C ≡ A⇒ B ⇒ C (curry)4. A⇒ (B ∧ C) ≡ (A⇒ B) ∧ (A⇒ C) (distrib)

If A ≡ B, we want A = B

[A≡B]r : Ar : B

1Bruce, Di Cosmo, Longo, MSCS 2(2), 231–247, 19924 / 31

Page 8: Simply typed lambda-calculus modulo isomorphisms

The basic setting

I Simply types with conjunction and implication

A,B,C ::= τ | A⇒ B | A ∧ B

I An equivalence relation between types (based on the isomorphisms1)1. A ∧ B ≡ B ∧ A (comm)2. A ∧ (B ∧ C) ≡ (A ∧ B) ∧ C (asso)3. (A ∧ B)⇒ C ≡ A⇒ B ⇒ C (curry)4. A⇒ (B ∧ C) ≡ (A⇒ B) ∧ (A⇒ C) (distrib)

If A ≡ B, we want A = B

[A≡B]r : Ar : B

1Bruce, Di Cosmo, Longo, MSCS 2(2), 231–247, 19924 / 31

Page 9: Simply typed lambda-calculus modulo isomorphisms

Associative and commutative conjunction

Γ ` r : A Γ ` s : BΓ ` 〈r, s〉 : A ∧ B

(∧i )

A ∧ B ≡ B ∧ AA ∧ (B ∧ C ) ≡ (A ∧ B) ∧ C

So 〈r, s〉 〈s, r〉〈r, 〈s, t〉 〉 〈 〈r, s〉 , t〉

What about the elimination?

Γ ` 〈r, s〉 : A ∧ B

Γ ` π1 〈r, s〉 : A(∧e)

But A ∧ B = B ∧ A!!Γ ` 〈r, s〉 : B ∧ A

Γ ` π1 〈r, s〉 : B(∧e)

Moreover 〈r, s〉 = 〈s, r〉 so π1 〈r, s〉 = π1 〈s, r〉 !!

Workaround: Church-style – Project w.r.t. a type

If r : A then πA 〈r, s〉 → r

This induces non-determinism

If r : As : A

then πA 〈r, s〉 → rπA 〈r, s〉 → s

We are interested in the proof theory and both r and s are valid proofs of A

5 / 31

Page 10: Simply typed lambda-calculus modulo isomorphisms

Associative and commutative conjunction

Γ ` r : A Γ ` s : BΓ ` 〈r, s〉 : A ∧ B

(∧i )

A ∧ B ≡ B ∧ AA ∧ (B ∧ C ) ≡ (A ∧ B) ∧ C

So 〈r, s〉 〈s, r〉〈r, 〈s, t〉 〉 〈 〈r, s〉 , t〉

What about the elimination?

Γ ` 〈r, s〉 : A ∧ B

Γ ` π1 〈r, s〉 : A(∧e)

But A ∧ B = B ∧ A!!Γ ` 〈r, s〉 : B ∧ A

Γ ` π1 〈r, s〉 : B(∧e)

Moreover 〈r, s〉 = 〈s, r〉 so π1 〈r, s〉 = π1 〈s, r〉 !!

Workaround: Church-style – Project w.r.t. a type

If r : A then πA 〈r, s〉 → r

This induces non-determinism

If r : As : A

then πA 〈r, s〉 → rπA 〈r, s〉 → s

We are interested in the proof theory and both r and s are valid proofs of A

5 / 31

Page 11: Simply typed lambda-calculus modulo isomorphisms

Associative and commutative conjunction

Γ ` r : A Γ ` s : BΓ ` 〈r, s〉 : A ∧ B

(∧i )

A ∧ B ≡ B ∧ AA ∧ (B ∧ C ) ≡ (A ∧ B) ∧ C

So 〈r, s〉 〈s, r〉〈r, 〈s, t〉 〉 〈 〈r, s〉 , t〉

What about the elimination?

Γ ` 〈r, s〉 : A ∧ B

Γ ` π1 〈r, s〉 : A(∧e)

But A ∧ B = B ∧ A!!Γ ` 〈r, s〉 : B ∧ A

Γ ` π1 〈r, s〉 : B(∧e)

Moreover 〈r, s〉 = 〈s, r〉 so π1 〈r, s〉 = π1 〈s, r〉 !!

Workaround: Church-style – Project w.r.t. a type

If r : A then πA 〈r, s〉 → r

This induces non-determinism

If r : As : A

then πA 〈r, s〉 → rπA 〈r, s〉 → s

We are interested in the proof theory and both r and s are valid proofs of A

5 / 31

Page 12: Simply typed lambda-calculus modulo isomorphisms

Associative and commutative conjunction

Γ ` r : A Γ ` s : BΓ ` 〈r, s〉 : A ∧ B

(∧i )

A ∧ B ≡ B ∧ AA ∧ (B ∧ C ) ≡ (A ∧ B) ∧ C

So 〈r, s〉 〈s, r〉〈r, 〈s, t〉 〉 〈 〈r, s〉 , t〉

What about the elimination?

Γ ` 〈r, s〉 : A ∧ B

Γ ` π1 〈r, s〉 : A(∧e)

But A ∧ B = B ∧ A!!Γ ` 〈r, s〉 : B ∧ A

Γ ` π1 〈r, s〉 : B(∧e)

Moreover 〈r, s〉 = 〈s, r〉 so π1 〈r, s〉 = π1 〈s, r〉 !!

Workaround: Church-style – Project w.r.t. a type

If r : A then πA 〈r, s〉 → r

This induces non-determinism

If r : As : A

then πA 〈r, s〉 → rπA 〈r, s〉 → s

We are interested in the proof theory and both r and s are valid proofs of A

5 / 31

Page 13: Simply typed lambda-calculus modulo isomorphisms

Associative and commutative conjunction

Γ ` r : A Γ ` s : BΓ ` 〈r, s〉 : A ∧ B

(∧i )

A ∧ B ≡ B ∧ AA ∧ (B ∧ C ) ≡ (A ∧ B) ∧ C

So 〈r, s〉 〈s, r〉〈r, 〈s, t〉 〉 〈 〈r, s〉 , t〉

What about the elimination?

Γ ` 〈r, s〉 : A ∧ B

Γ ` π1 〈r, s〉 : A(∧e)

But A ∧ B = B ∧ A!!Γ ` 〈r, s〉 : B ∧ A

Γ ` π1 〈r, s〉 : B(∧e)

Moreover 〈r, s〉 = 〈s, r〉 so π1 〈r, s〉 = π1 〈s, r〉 !!

Workaround: Church-style – Project w.r.t. a type

If r : A then πA 〈r, s〉 → r

This induces non-determinism

If r : As : A

then πA 〈r, s〉 → rπA 〈r, s〉 → s

We are interested in the proof theory and both r and s are valid proofs of A

5 / 31

Page 14: Simply typed lambda-calculus modulo isomorphisms

Associative and commutative conjunction

Γ ` r : A Γ ` s : BΓ ` 〈r, s〉 : A ∧ B

(∧i )

A ∧ B ≡ B ∧ AA ∧ (B ∧ C ) ≡ (A ∧ B) ∧ C

So 〈r, s〉 〈s, r〉〈r, 〈s, t〉 〉 〈 〈r, s〉 , t〉

What about the elimination?

Γ ` 〈r, s〉 : A ∧ B

Γ ` π1 〈r, s〉 : A(∧e)

But A ∧ B = B ∧ A!!Γ ` 〈r, s〉 : B ∧ A

Γ ` π1 〈r, s〉 : B(∧e)

Moreover 〈r, s〉 = 〈s, r〉 so π1 〈r, s〉 = π1 〈s, r〉 !!

Workaround: Church-style – Project w.r.t. a type

If r : A then πA 〈r, s〉 → r

This induces non-determinism

If r : As : A

then πA 〈r, s〉 → rπA 〈r, s〉 → s

We are interested in the proof theory and both r and s are valid proofs of A

5 / 31

Page 15: Simply typed lambda-calculus modulo isomorphisms

Associative and commutative conjunction

Γ ` r : A Γ ` s : BΓ ` 〈r, s〉 : A ∧ B

(∧i )

A ∧ B ≡ B ∧ AA ∧ (B ∧ C ) ≡ (A ∧ B) ∧ C

So 〈r, s〉 〈s, r〉〈r, 〈s, t〉 〉 〈 〈r, s〉 , t〉

What about the elimination?

Γ ` 〈r, s〉 : A ∧ B

Γ ` π1 〈r, s〉 : A(∧e)

But A ∧ B = B ∧ A!!Γ ` 〈r, s〉 : B ∧ A

Γ ` π1 〈r, s〉 : B(∧e)

Moreover 〈r, s〉 = 〈s, r〉 so π1 〈r, s〉 = π1 〈s, r〉 !!

Workaround: Church-style – Project w.r.t. a type

If r : A then πA 〈r, s〉 → r

This induces non-determinism

If r : As : A

then πA 〈r, s〉 → rπA 〈r, s〉 → s

We are interested in the proof theory and both r and s are valid proofs of A

5 / 31

Page 16: Simply typed lambda-calculus modulo isomorphisms

Associative and commutative conjunction

Γ ` r : A Γ ` s : BΓ ` r + s : A ∧ B

(∧i )

A ∧ B ≡ B ∧ AA ∧ (B ∧ C ) ≡ (A ∧ B) ∧ C

So r + s (s + r)r + (s + t) (r + s) + t

What about the elimination?

Γ ` r + s : A ∧ B

Γ ` π1(r + s) : A(∧e)

But A ∧ B = B ∧ A!!Γ ` r + s : B ∧ A

Γ ` π1(r + s) : B(∧e)

Moreover r + s = s + r so π1(r + s) = π1(s + r) !!

Workaround: Church-style – Project w.r.t. a type

If r : A then πA(r + s)→ r

This induces non-determinism

If r : As : A

then πA(r + s)→ rπA(r + s)→ s

We are interested in the proof theory and both r and s are valid proofs of A

5 / 31

Page 17: Simply typed lambda-calculus modulo isomorphisms

Curryfication

(A ∧ B)⇒ C ≡ A⇒ B ⇒ C

induces

r(s + t) rst

If s : A,

(λxA.r)s → r[s/x ]

6 / 31

Page 18: Simply typed lambda-calculus modulo isomorphisms

Curryfication

(A ∧ B)⇒ C ≡ A⇒ B ⇒ C

induces

r(s + t) rst

If s : A,

(λxA.r)s → r[s/x ]

6 / 31

Page 19: Simply typed lambda-calculus modulo isomorphisms

Curryfication

(A ∧ B)⇒ C ≡ A⇒ B ⇒ C

induces

r(s + t) rst

If s : A, (λxA.r)s → r[s/x ]

6 / 31

Page 20: Simply typed lambda-calculus modulo isomorphisms

Distributivity of implication over conjunction

A⇒ (B ∧ C ) ≡ (A⇒ B) ∧ (A⇒ C )

induces

λxA.(r + s) λxA.r + λxA.s

and λxA.πB(r) πA⇒B(λxA.r)

Example

` λxA∧B .x : (A ∧ B)⇒ (A ∧ B)

` λxA∧B .x : ((A ∧ B)⇒ A) ∧ ((A ∧ B)⇒ B)(≡)

` π(A∧B)⇒A(λxA∧B .x) : (A ∧ B)⇒ A(∧e)

π(A∧B)⇒A(λxA∧B .x) λxA∧B .πA(x)

7 / 31

Page 21: Simply typed lambda-calculus modulo isomorphisms

Distributivity of implication over conjunction

A⇒ (B ∧ C ) ≡ (A⇒ B) ∧ (A⇒ C )

induces

λxA.(r + s) λxA.r + λxA.s and λxA.πB(r) πA⇒B(λxA.r)

Example

` λxA∧B .x : (A ∧ B)⇒ (A ∧ B)

` λxA∧B .x : ((A ∧ B)⇒ A) ∧ ((A ∧ B)⇒ B)(≡)

` π(A∧B)⇒A(λxA∧B .x) : (A ∧ B)⇒ A(∧e)

π(A∧B)⇒A(λxA∧B .x) λxA∧B .πA(x)

7 / 31

Page 22: Simply typed lambda-calculus modulo isomorphisms

Distributivity of implication over conjunction

A⇒ (B ∧ C ) ≡ (A⇒ B) ∧ (A⇒ C )

induces

λxA.(r + s) λxA.r + λxA.s and λxA.πB(r) πA⇒B(λxA.r)

Example

` λxA∧B .x : (A ∧ B)⇒ (A ∧ B)

` λxA∧B .x : ((A ∧ B)⇒ A) ∧ ((A ∧ B)⇒ B)(≡)

` π(A∧B)⇒A(λxA∧B .x) : (A ∧ B)⇒ A(∧e)

π(A∧B)⇒A(λxA∧B .x) λxA∧B .πA(x)

7 / 31

Page 23: Simply typed lambda-calculus modulo isomorphisms

Distributivity of implication over conjunctionMultiple choices

A⇒ (B ∧ C ) ≡ (A⇒ B) ∧ (A⇒ C )

λxA.(r + s) λxA.r + λxA.s ⇒i ,∧i ∧i ,⇒i

λxA.πB(r) πA⇒B(λxA.r) ⇒i ,∧e ∧e ,⇒i

(r + s)t rt + st ⇒e ,∧i ∧i ,⇒e

πA⇒B(r)s πB(rs) ∗ ⇒e ,∧e ∧e ,⇒e

∗ if r : A ⇒ (B ∧ C)

8 / 31

Page 24: Simply typed lambda-calculus modulo isomorphisms

Distributivity of implication over conjunctionMultiple choices

A⇒ (B ∧ C ) ≡ (A⇒ B) ∧ (A⇒ C )

λxA.(r + s) λxA.r + λxA.s ⇒i ,∧i ∧i ,⇒i

λxA.πB(r) πA⇒B(λxA.r) ⇒i ,∧e ∧e ,⇒i

(r + s)t rt + st ⇒e ,∧i ∧i ,⇒e

πA⇒B(r)s πB(rs) ∗ ⇒e ,∧e ∧e ,⇒e

∗ if r : A ⇒ (B ∧ C)

8 / 31

Page 25: Simply typed lambda-calculus modulo isomorphisms

Distributivity of implication over conjunctionOne rule to rule them all. . . if we accept to direct the others

πA⇒B(r)s πB(rs) suffices . . . plus η and δ (surjective pairing)

πA⇒B(λxA.r)

→η λxA.(πA⇒B(λxA.r)x)

λxA.(πB((λxA.r)x))

→β λxA.πB(r)

(r + s)t→δ πA((r + s)t) + πB((r + s)t) πC⇒A(r + s)t + πC⇒B(r + s)t→π rt + st

λxA.(r + s)

→δ πA⇒B(λxA.(r + s)) + πA⇒C (λxA.(r + s))

→1 λxA.πB(r + s) + λxA.πC (r + s)

→π λxA.r + λxA.s

Moreover, at the equational level, any of the four rules sufficeswith η, β, π and surjective pairing equivalences

9 / 31

Page 26: Simply typed lambda-calculus modulo isomorphisms

Distributivity of implication over conjunctionOne rule to rule them all. . . if we accept to direct the others

πA⇒B(r)s πB(rs) suffices . . . plus η and δ (surjective pairing)

πA⇒B(λxA.r)

→η λxA.(πA⇒B(λxA.r)x)

λxA.(πB((λxA.r)x))

→β λxA.πB(r)

(r + s)t→δ πA((r + s)t) + πB((r + s)t) πC⇒A(r + s)t + πC⇒B(r + s)t→π rt + st

λxA.(r + s)

→δ πA⇒B(λxA.(r + s)) + πA⇒C (λxA.(r + s))

→1 λxA.πB(r + s) + λxA.πC (r + s)

→π λxA.r + λxA.s

Moreover, at the equational level, any of the four rules sufficeswith η, β, π and surjective pairing equivalences

9 / 31

Page 27: Simply typed lambda-calculus modulo isomorphisms

Distributivity of implication over conjunctionOne rule to rule them all. . . if we accept to direct the others

πA⇒B(r)s πB(rs) suffices . . . plus η and δ (surjective pairing)

πA⇒B(λxA.r)

→η λxA.(πA⇒B(λxA.r)x)

λxA.(πB((λxA.r)x))

→β λxA.πB(r)

(r + s)t→δ πA((r + s)t) + πB((r + s)t) πC⇒A(r + s)t + πC⇒B(r + s)t→π rt + st

λxA.(r + s)

→δ πA⇒B(λxA.(r + s)) + πA⇒C (λxA.(r + s))

→1 λxA.πB(r + s) + λxA.πC (r + s)

→π λxA.r + λxA.s

Moreover, at the equational level, any of the four rules sufficeswith η, β, π and surjective pairing equivalences

9 / 31

Page 28: Simply typed lambda-calculus modulo isomorphisms

Distributivity of implication over conjunctionOne rule to rule them all. . . if we accept to direct the others

πA⇒B(r)s πB(rs) suffices . . . plus η and δ (surjective pairing)

πA⇒B(λxA.r)

→η λxA.(πA⇒B(λxA.r)x)

λxA.(πB((λxA.r)x))

→β λxA.πB(r)

(r + s)t→δ πA((r + s)t) + πB((r + s)t) πC⇒A(r + s)t + πC⇒B(r + s)t→π rt + st

λxA.(r + s)

→δ πA⇒B(λxA.(r + s)) + πA⇒C (λxA.(r + s))

→1 λxA.πB(r + s) + λxA.πC (r + s)

→π λxA.r + λxA.s

Moreover, at the equational level, any of the four rules sufficeswith η, β, π and surjective pairing equivalences

9 / 31

Page 29: Simply typed lambda-calculus modulo isomorphisms

Distributivity of implication over conjunctionOne rule to rule them all. . . if we accept to direct the others

πA⇒B(r)s πB(rs) suffices . . . plus η and δ (surjective pairing)

πA⇒B(λxA.r)

→η λxA.(πA⇒B(λxA.r)x)

λxA.(πB((λxA.r)x))

→β λxA.πB(r)

(r + s)t→δ πA((r + s)t) + πB((r + s)t) πC⇒A(r + s)t + πC⇒B(r + s)t→π rt + st

λxA.(r + s)

→δ πA⇒B(λxA.(r + s)) + πA⇒C (λxA.(r + s))

→1 λxA.πB(r + s) + λxA.πC (r + s)

→π λxA.r + λxA.s

Moreover, at the equational level, any of the four rules sufficeswith η, β, π and surjective pairing equivalences

9 / 31

Page 30: Simply typed lambda-calculus modulo isomorphisms

α-equivalence

RulesI If A ≡ B, r r[A/B]

I If r =α r′, r r′

Example

Let A ≡ B

A⇒(C1∧C2)︷ ︸︸ ︷λxA.r + λyB .s

∗ λxA.r + λxA.s[x/y ][A/B]

λxA.(r + s[x/y ][A/B])

10 / 31

Page 31: Simply typed lambda-calculus modulo isomorphisms

α-equivalence

RulesI If A ≡ B, r r[A/B]

I If r =α r′, r r′

Example

Let A ≡ B

A⇒(C1∧C2)︷ ︸︸ ︷λxA.r + λyB .s ∗ λxA.r + λxA.s[x/y ][A/B]

λxA.(r + s[x/y ][A/B])

10 / 31

Page 32: Simply typed lambda-calculus modulo isomorphisms

The full operational semantics

Symmetric relation:

r + s s + r (comm)

(r + s) + t r + (s + t) (asso)

rst r(s + t) (curry)

If r : A⇒ C , πA⇒B(r)s πB(rs) (dist)

If A ≡ B, r r[A/B] (α–Types)

If r =α s, r s (α–Terms)

If r s, then K [r] K [s] for any context K [·]

Reductions:

If s : A, (λxA.r)s r[s/x ] (β)

If r : A, πA(r + s) r (πn)

If r : A, πA(r) r (π1)

If

x /∈ FV (r),r : A⇒ B,r 6∗ λyA.r′

, r λxA.rx (η)

If

r : A ∧ B,r 6∗ r1 + r2with r1 : A, r2 : B

, r πA(r) + πB(r) (δ)

r sr → s

r → sλxA.r → λxA.s

r → str → ts

r¬η→ s

rt → str → s

t + r → t + sr¬δ→ s

πA(r) → πA(s)

where¬R→ stands for a → step that is not given by a R step

11 / 31

Page 33: Simply typed lambda-calculus modulo isomorphisms

Normalisation

r is in normal form, if it can only continue reducing by relation

Normal form

Red(r) = s | r ∗ r′ → s′ ∗ s

r in normal form if Red(r) = ∅

Theorem (Strong normalisation)If Γ ` r : A then r strongly normalising

Proof. Reducibility method

12 / 31

Page 34: Simply typed lambda-calculus modulo isomorphisms

Normalisation

r is in normal form, if it can only continue reducing by relation

Normal form

Red(r) = s | r ∗ r′ → s′ ∗ s

r in normal form if Red(r) = ∅

Theorem (Strong normalisation)If Γ ` r : A then r strongly normalising

Proof. Reducibility method

12 / 31

Page 35: Simply typed lambda-calculus modulo isomorphisms

Finding an interpretationThe standard interpretation does not work

JA ∧ BK = r | πA(r) ∈ JAK and πB(r) ∈ JBKCounter-example: r = xA + yB + Ω ∈ JA ∧ BK

JA ∧ BK = r : A ∧ B | πA(r) ∈ JAK and πB(r) ∈ JBKHow to prove that r ∈ JAK and s ∈ JBK implies r + s ∈ JA ∧ BK?

πA(r + s)→rπB(r + s)→s but. . .

let

A = A1 ∧ A2B = A2 ∧ B2

πA1∧A2(r1 + r2︸ ︷︷ ︸A1∧A2

+ s1 + s2︸ ︷︷ ︸A2∧B2

)→ r1 + s1

We need something more subtle

13 / 31

Page 36: Simply typed lambda-calculus modulo isomorphisms

Finding an interpretationThe standard interpretation does not work

JA ∧ BK = r | πA(r) ∈ JAK and πB(r) ∈ JBKCounter-example: r = xA + yB + Ω ∈ JA ∧ BK

JA ∧ BK = r : A ∧ B | πA(r) ∈ JAK and πB(r) ∈ JBK

How to prove that r ∈ JAK and s ∈ JBK implies r + s ∈ JA ∧ BK?

πA(r + s)→rπB(r + s)→s but. . .

let

A = A1 ∧ A2B = A2 ∧ B2

πA1∧A2(r1 + r2︸ ︷︷ ︸A1∧A2

+ s1 + s2︸ ︷︷ ︸A2∧B2

)→ r1 + s1

We need something more subtle

13 / 31

Page 37: Simply typed lambda-calculus modulo isomorphisms

Finding an interpretationThe standard interpretation does not work

JA ∧ BK = r | πA(r) ∈ JAK and πB(r) ∈ JBKCounter-example: r = xA + yB + Ω ∈ JA ∧ BK

JA ∧ BK = r : A ∧ B | πA(r) ∈ JAK and πB(r) ∈ JBKHow to prove that r ∈ JAK and s ∈ JBK implies r + s ∈ JA ∧ BK?

πA(r + s)→rπB(r + s)→s but. . .

let

A = A1 ∧ A2B = A2 ∧ B2

πA1∧A2(r1 + r2︸ ︷︷ ︸A1∧A2

+ s1 + s2︸ ︷︷ ︸A2∧B2

)→ r1 + s1

We need something more subtle

13 / 31

Page 38: Simply typed lambda-calculus modulo isomorphisms

Finding an interpretationThe standard interpretation does not work

JA ∧ BK = r | πA(r) ∈ JAK and πB(r) ∈ JBKCounter-example: r = xA + yB + Ω ∈ JA ∧ BK

JA ∧ BK = r : A ∧ B | πA(r) ∈ JAK and πB(r) ∈ JBKHow to prove that r ∈ JAK and s ∈ JBK implies r + s ∈ JA ∧ BK?

πA(r + s)→rπB(r + s)→s

but. . .let

A = A1 ∧ A2B = A2 ∧ B2

πA1∧A2(r1 + r2︸ ︷︷ ︸A1∧A2

+ s1 + s2︸ ︷︷ ︸A2∧B2

)→ r1 + s1

We need something more subtle

13 / 31

Page 39: Simply typed lambda-calculus modulo isomorphisms

Finding an interpretationThe standard interpretation does not work

JA ∧ BK = r | πA(r) ∈ JAK and πB(r) ∈ JBKCounter-example: r = xA + yB + Ω ∈ JA ∧ BK

JA ∧ BK = r : A ∧ B | πA(r) ∈ JAK and πB(r) ∈ JBKHow to prove that r ∈ JAK and s ∈ JBK implies r + s ∈ JA ∧ BK?

πA(r + s)→rπB(r + s)→s but. . .

let

A = A1 ∧ A2B = A2 ∧ B2

πA1∧A2(r1 + r2︸ ︷︷ ︸A1∧A2

+ s1 + s2︸ ︷︷ ︸A2∧B2

)→ r1 + s1

We need something more subtle

13 / 31

Page 40: Simply typed lambda-calculus modulo isomorphisms

Finding an interpretationCanonical types

Not-conj. type S ,R ::= τ | S ⇒ R

Canonical formof a type

can(τ) = τcan(A ∧ B) = can(A) ∧ can(B)can(A⇒ B) = let

∧ni=1 Si = can(A) in

let∧m

j=1 Rj = can(B) in∧mj=1 S1 ⇒ · · · ⇒ Sn ⇒ Rj

Lemma

∀A, can(A) =m∧i=1

Si1 ⇒ · · · ⇒ Sini ⇒ τ

Intuition first let: (A ∧ B)⇒ C ≡ A⇒ B ⇒ Csecond let: A⇒ (B ∧ C ) ≡ (A⇒ B) ∧ (A⇒ C )

14 / 31

Page 41: Simply typed lambda-calculus modulo isomorphisms

Finding an interpretationCanonical types

Not-conj. type S ,R ::= τ | S ⇒ R

Canonical formof a type

can(τ) = τcan(A ∧ B) = can(A) ∧ can(B)can(A⇒ B) = let

∧ni=1 Si = can(A) in

let∧m

j=1 Rj = can(B) in∧mj=1 S1 ⇒ · · · ⇒ Sn ⇒ Rj

Lemma

∀A, can(A) =m∧i=1

Si1 ⇒ · · · ⇒ Sini ⇒ τ

Intuition first let: (A ∧ B)⇒ C ≡ A⇒ B ⇒ Csecond let: A⇒ (B ∧ C ) ≡ (A⇒ B) ∧ (A⇒ C )

14 / 31

Page 42: Simply typed lambda-calculus modulo isomorphisms

Finding an interpretationCanonical types

Not-conj. type S ,R ::= τ | S ⇒ R

Canonical formof a type

can(τ) = τcan(A ∧ B) = can(A) ∧ can(B)can(A⇒ B) = let

∧ni=1 Si = can(A) in

let∧m

j=1 Rj = can(B) in∧mj=1 S1 ⇒ · · · ⇒ Sn ⇒ Rj

Lemma

∀A, can(A) =m∧i=1

Si1 ⇒ · · · ⇒ Sini ⇒ τ

Intuition first let: (A ∧ B)⇒ C ≡ A⇒ B ⇒ Csecond let: A⇒ (B ∧ C ) ≡ (A⇒ B) ∧ (A⇒ C )

14 / 31

Page 43: Simply typed lambda-calculus modulo isomorphisms

Finding an interpretationInterpreting canonical types

tn∧

i=1

((Sij)

mi

j=1 ⇒ τ)|

=

r | ∀i ,

[sij ∈ JSijKj = 1, . . . ,mi

implies π(Sij )mij=1⇒τ

(r)~si ∈ SN]

with n ≥ 1, and m ≥ 0

Example

J(S ⇒ τ) ∧ τK =

r

∣∣∣∣∣∣ s ∈ JSK implies πS⇒τ (r)s ∈ SNand πτ (r) ∈ SN

Lemma

If r : A then r ∈ JAK

CorollaryIf r : A then r ∈ SN

15 / 31

Page 44: Simply typed lambda-calculus modulo isomorphisms

Finding an interpretationInterpreting canonical types

tn∧

i=1

((Sij)

mi

j=1 ⇒ τ)|

=

r | ∀i ,

[sij ∈ JSijKj = 1, . . . ,mi

implies π(Sij )mij=1⇒τ

(r)~si ∈ SN]

with n ≥ 1, and m ≥ 0

Example

J(S ⇒ τ) ∧ τK =

r

∣∣∣∣∣∣ s ∈ JSK implies πS⇒τ (r)s ∈ SNand πτ (r) ∈ SN

LemmaIf r : A then r ∈ JAK

CorollaryIf r : A then r ∈ SN

15 / 31

Page 45: Simply typed lambda-calculus modulo isomorphisms

Finding an interpretationInterpreting canonical types

tn∧

i=1

((Sij)

mi

j=1 ⇒ τ)|

=

r | ∀i ,

[sij ∈ JSijKj = 1, . . . ,mi

implies π(Sij )mij=1⇒τ

(r)~si ∈ SN]

with n ≥ 1, and m ≥ 0

Example

J(S ⇒ τ) ∧ τK =

r

∣∣∣∣∣∣ s ∈ JSK implies πS⇒τ (r)s ∈ SNand πτ (r) ∈ SN

Lemma

If r : A then r ∈ JAK

CorollaryIf r : A then r ∈ SN

15 / 31

Page 46: Simply typed lambda-calculus modulo isomorphisms

Up to hereWhat have we done?

I We introduced a new calculus where isomorphicpropositions have the same proofs

I We provided a proof of strong normalisation for simplytypes

Why?I A BA ∧ B

and B AB ∧ A

are the same!

I In general:If A ≡ B , a proof of A in a library must not be

distinguishable from a proof of B

I But there is also an historical motivation 6= to this one:quantum computing

16 / 31

Page 47: Simply typed lambda-calculus modulo isomorphisms

Up to hereWhat have we done?

I We introduced a new calculus where isomorphicpropositions have the same proofs

I We provided a proof of strong normalisation for simplytypes

Why?I A BA ∧ B

and B AB ∧ A

are the same!

I In general:If A ≡ B , a proof of A in a library must not be

distinguishable from a proof of B

I But there is also an historical motivation 6= to this one:quantum computing

16 / 31

Page 48: Simply typed lambda-calculus modulo isomorphisms

Up to hereWhat have we done?

I We introduced a new calculus where isomorphicpropositions have the same proofs

I We provided a proof of strong normalisation for simplytypes

Why?I A BA ∧ B

and B AB ∧ A

are the same!

I In general:If A ≡ B , a proof of A in a library must not be

distinguishable from a proof of B

I But there is also an historical motivation 6= to this one:quantum computing

16 / 31

Page 49: Simply typed lambda-calculus modulo isomorphisms

Up to hereWhat have we done?

I We introduced a new calculus where isomorphicpropositions have the same proofs

I We provided a proof of strong normalisation for simplytypes

Why?I A BA ∧ B

and B AB ∧ A

are the same!

I In general:If A ≡ B , a proof of A in a library must not be

distinguishable from a proof of B

I But there is also an historical motivation 6= to this one:quantum computing

16 / 31

Page 50: Simply typed lambda-calculus modulo isomorphisms

Outline

Part 1: A type-isomorphic lambda-calculusDefining the systemNormalisation

Part 2: The other motivationThe historical motivation, in one slideRelation with probabilistic calculi

Future work: some insights

17 / 31

Page 51: Simply typed lambda-calculus modulo isomorphisms

The historical motivationi.e. the real motivation. . . in one slide

The superpositionprinciple

A system can be in state A, or Bor A AND B at the same time.

AND = ∧

I Superposition of A and B = Superposition of B and A

I Lineal[Arrighi,Dowek RTA’08] can be encoded in our calculus[Díaz-Caro,Dowek DCM’13]

I Projection of A ∧ A ∼ Projective measurementNon-determinism ∼ quantum measurement

I Is non-determinism enough to encode quantum computing?

Probably not. . . but it is enough to encode probabilities!

18 / 31

Page 52: Simply typed lambda-calculus modulo isomorphisms

The historical motivationi.e. the real motivation. . . in one slide

The superpositionprinciple

A system can be in state A, or Bor A AND B at the same time.

AND = ∧

I Superposition of A and B = Superposition of B and A

I Lineal[Arrighi,Dowek RTA’08] can be encoded in our calculus[Díaz-Caro,Dowek DCM’13]

I Projection of A ∧ A ∼ Projective measurementNon-determinism ∼ quantum measurement

I Is non-determinism enough to encode quantum computing?

Probably not. . . but it is enough to encode probabilities!

18 / 31

Page 53: Simply typed lambda-calculus modulo isomorphisms

The historical motivationi.e. the real motivation. . . in one slide

The superpositionprinciple

A system can be in state A, or Bor A AND B at the same time.

AND = ∧

I Superposition of A and B = Superposition of B and A

I Lineal[Arrighi,Dowek RTA’08] can be encoded in our calculus[Díaz-Caro,Dowek DCM’13]

I Projection of A ∧ A ∼ Projective measurementNon-determinism ∼ quantum measurement

I Is non-determinism enough to encode quantum computing?

Probably not. . . but it is enough to encode probabilities!

18 / 31

Page 54: Simply typed lambda-calculus modulo isomorphisms

The historical motivationi.e. the real motivation. . . in one slide

The superpositionprinciple

A system can be in state A, or Bor A AND B at the same time.

AND = ∧

I Superposition of A and B = Superposition of B and A

I Lineal[Arrighi,Dowek RTA’08] can be encoded in our calculus[Díaz-Caro,Dowek DCM’13]

I Projection of A ∧ A ∼ Projective measurementNon-determinism ∼ quantum measurement

I Is non-determinism enough to encode quantum computing?

Probably not. . . but it is enough to encode probabilities!

18 / 31

Page 55: Simply typed lambda-calculus modulo isomorphisms

The historical motivationi.e. the real motivation. . . in one slide

The superpositionprinciple

A system can be in state A, or Bor A AND B at the same time.

AND = ∧

I Superposition of A and B = Superposition of B and A

I Lineal[Arrighi,Dowek RTA’08] can be encoded in our calculus[Díaz-Caro,Dowek DCM’13]

I Projection of A ∧ A ∼ Projective measurementNon-determinism ∼ quantum measurement

I Is non-determinism enough to encode quantum computing?

Probably not. . . but it is enough to encode probabilities!

18 / 31

Page 56: Simply typed lambda-calculus modulo isomorphisms

IntuitionFrom non-determinism to probabilities

π(r + π(s + t) + t)

π(s + t)

''r s t

7→

π(r + π(s + t) + t)

13

13

13

π(s + t)12

12

''r s t

∼ 13.r +

16.s +

12.t

An easier way. . .

π(r + r + s + t + t + t)

r tt16

r zz16

s16

t 16

t$$16

t**16

19 / 31

Page 57: Simply typed lambda-calculus modulo isomorphisms

IntuitionFrom non-determinism to probabilities

π(r + π(s + t) + t)

π(s + t)

''r s t

7→

π(r + π(s + t) + t)

13

13

13

π(s + t)12

12

''r s t

∼ 13.r +

16.s +

12.t

An easier way. . .

π(r + r + s + t + t + t)

r tt16

r zz16

s16

t 16

t$$16

t**16

19 / 31

Page 58: Simply typed lambda-calculus modulo isomorphisms

IntuitionFrom non-determinism to probabilities

π(r + π(s + t) + t)

π(s + t)

''r s t

7→

π(r + π(s + t) + t)

13

13

13

π(s + t)12

12

''r s t

∼ 13.r +

16.s +

12.t

An easier way. . .

π(r + r + s + t + t + t)

r tt16

r zz16

s16

t 16

t$$16

t**16

19 / 31

Page 59: Simply typed lambda-calculus modulo isomorphisms

IntuitionGeneralising the problem to abstract rewrite systems

Idea: to define a variant of a Lebesgue measure for sets of realnumbers, on the space of traces

1st Define an intuitive measure on single rewrites

d

b

12 7712 // e

e.g. If a

13 <<

13 //13

""

cthen p(a→ c) = 1

3 + 13 and

p(a→ b;b→ d) = 13 ×

12 = 1

6

c

2nd Generalise it to arbitrary sets of rewrites taking the minimal cover withsets of single rewrites

20 / 31

Page 60: Simply typed lambda-calculus modulo isomorphisms

IntuitionGeneralising the problem to abstract rewrite systems

Idea: to define a variant of a Lebesgue measure for sets of realnumbers, on the space of traces

1st Define an intuitive measure on single rewrites

d

b

12 7712 // e

e.g. If a

13 <<

13 //13

""

cthen p(a→ c) = 1

3 + 13 and

p(a→ b;b→ d) = 13 ×

12 = 1

6

c

2nd Generalise it to arbitrary sets of rewrites taking the minimal cover withsets of single rewrites

20 / 31

Page 61: Simply typed lambda-calculus modulo isomorphisms

IntuitionGeneralising the problem to abstract rewrite systems

Idea: to define a variant of a Lebesgue measure for sets of realnumbers, on the space of traces

1st Define an intuitive measure on single rewrites

d

b

12 7712 // e

e.g. If a

13 <<

13 //13

""

cthen p(a→ c) = 1

3 + 13 and

p(a→ b;b→ d) = 13 ×

12 = 1

6

c

2nd Generalise it to arbitrary sets of rewrites taking the minimal cover withsets of single rewrites

20 / 31

Page 62: Simply typed lambda-calculus modulo isomorphisms

IntuitionGeneralising the problem to abstract rewrite systems

Idea: to define a variant of a Lebesgue measure for sets of realnumbers, on the space of traces

1st Define an intuitive measure on single rewrites

d

b

12 7712 // e

e.g. If a

13 <<

13 //13

""

cthen p(a→ c) = 1

3 + 13 and

p(a→ b;b→ d) = 13 ×

12 = 1

6

c

2nd Generalise it to arbitrary sets of rewrites taking the minimal cover withsets of single rewrites

20 / 31

Page 63: Simply typed lambda-calculus modulo isomorphisms

FormalisationStrategies

Λ: set of objects →: Λ× Λ→ N a→ b notation for → (a,b) 6= 0.

Degree

ρ(a) =∑

b

→ (a,b)e.g.

b

a

77

//

''b

c

ρ(a) = 3

Strategyf (a) = b implies a→ b Ω = set of all the strategies

e.g. Rewrite system

a

b c

d e

Ω = f , g , h, i, with

f (a) = b g(a) = bf (c) = d g(c) = e

h(a) = c i(a) = ch(c) = d i(c) = e

21 / 31

Page 64: Simply typed lambda-calculus modulo isomorphisms

FormalisationStrategies

Λ: set of objects →: Λ× Λ→ N a→ b notation for → (a,b) 6= 0.

Degree

ρ(a) =∑

b

→ (a,b)e.g.

b

a

77

//

''b

c

ρ(a) = 3

Strategyf (a) = b implies a→ b Ω = set of all the strategies

e.g. Rewrite system

a

b c

d e

Ω = f , g , h, i, with

f (a) = b g(a) = bf (c) = d g(c) = e

h(a) = c i(a) = ch(c) = d i(c) = e

21 / 31

Page 65: Simply typed lambda-calculus modulo isomorphisms

FormalisationStrategies

Λ: set of objects →: Λ× Λ→ N a→ b notation for → (a,b) 6= 0.

Degree

ρ(a) =∑

b

→ (a,b)e.g.

b

a

77

//

''b

c

ρ(a) = 3

Strategyf (a) = b implies a→ b Ω = set of all the strategies

e.g. Rewrite system

a

b c

d e

Ω = f , g , h, i, with

f (a) = b g(a) = bf (c) = d g(c) = e

h(a) = c i(a) = ch(c) = d i(c) = e

21 / 31

Page 66: Simply typed lambda-calculus modulo isomorphisms

FormalisationBoxes

BoxB ⊆ Ω of the form

B = f | f (a1) = b1, . . . , f (an) = bn

e.g. Rewrite system:

a

b c

d e

f1 =

a

b c

d

; f2 =

a

b c

e

=

Boxa

b

f1; f2 = f | f (a) = b

22 / 31

Page 67: Simply typed lambda-calculus modulo isomorphisms

FormalisationMeasure on boxes

Measure on boxesIf B = f | f (a1) = b1, . . . , f (an) = bn then

p(B) =n∏

i=1

→ (ai ,bi )ρ(ai )

→ (ai , bi )

ways to arrive to bi from aiρ(ai )

nb. of rewrites from ai

e.g.

B =

f1 =

a

b c

d

; f2 =

a

b c

e

=

Boxa

b

f | f(a)=b

p(B) =→ (a,b)

ρ(a)=

12

23 / 31

Page 68: Simply typed lambda-calculus modulo isomorphisms

FormalisationMeasure on boxes

Measure on boxesIf B = f | f (a1) = b1, . . . , f (an) = bn then

p(B) =n∏

i=1

→ (ai ,bi )ρ(ai )

→ (ai , bi )

ways to arrive to bi from aiρ(ai )

nb. of rewrites from ai

e.g.

B =

f1 =

a

b c

d

; f2 =

a

b c

e

=

Boxa

b

f | f(a)=b

p(B) =→ (a,b)

ρ(a)=

12

23 / 31

Page 69: Simply typed lambda-calculus modulo isomorphisms

IntuitionGeneralising the problem to abstract rewrite systems

Idea: to define a variant of a Lebesgue measure for sets of realnumbers, on the space of traces

1st Define an intuitive measure on boxesd

b

12 7712 // e

e.g. If a

13 <<

13 //13

""

cthen p(a→ c) = 1

3 + 13 and

p(a→ b;b→ d) = 13 ×

12 = 1

6

c

2nd Generalise it to arbitrary sets of rewrites taking the minimal cover withboxes

24 / 31

Page 70: Simply typed lambda-calculus modulo isomorphisms

IntuitionGeneralising the problem to abstract rewrite systems

Idea: to define a variant of a Lebesgue measure for sets of realnumbers, on the space of traces

1st Define an intuitive measure on boxesd

b

12 7712 // e

e.g. If a

13 <<

13 //13

""

cthen p(a→ c) = 1

3 + 13 and

p(a→ b;b→ d) = 13 ×

12 = 1

6

c

2nd Generalise it to arbitrary sets of rewrites taking the minimal cover withboxes

24 / 31

Page 71: Simply typed lambda-calculus modulo isomorphisms

FormalisationProbability function

Probability functionLet S ∈ P(Ω), S 6= ∅

P(∅) = 0

P(S) = inf

∑B∈C

p(B) | C is a countable family of boxes s.t. S ⊆⋃B∈C

B

e.g.

S =

f1 =

a

b c

d

; f2 =

a

c

e

= f1︸︷︷︸

B1

∪ f2︸︷︷︸B2

P(S) = p(B1) + p(B2) =12× 1

2+

12× 1

2=

12

25 / 31

Page 72: Simply typed lambda-calculus modulo isomorphisms

FormalisationProbability function

Probability functionLet S ∈ P(Ω), S 6= ∅

P(∅) = 0

P(S) = inf

∑B∈C

p(B) | C is a countable family of boxes s.t. S ⊆⋃B∈C

B

e.g.

S =

f1 =

a

b c

d

; f2 =

a

c

e

= f1︸︷︷︸

B1

∪ f2︸︷︷︸B2

P(S) = p(B1) + p(B2) =12× 1

2+

12× 1

2=

12

25 / 31

Page 73: Simply typed lambda-calculus modulo isomorphisms

FormalisationLebesgue measure and probability space

Lebesgue measurableA is Lebesgue measurable if ∀S ∈ P(Ω)

P(S) = P(S ∩ A) + P(S ∩ A∼)

A = A ⊆ Ω | A is Lebesgue measurable

Theorem(Ω,A, P) is a probability space

I Ω is the set of all possible strategiesI A is the set of eventsI P is the probability function

Proof.We show that it satisfies the Kolmogorov axioms.

26 / 31

Page 74: Simply typed lambda-calculus modulo isomorphisms

FormalisationLebesgue measure and probability space

Lebesgue measurableA is Lebesgue measurable if ∀S ∈ P(Ω)

P(S) = P(S ∩ A) + P(S ∩ A∼)

A = A ⊆ Ω | A is Lebesgue measurable

Theorem(Ω,A, P) is a probability space

I Ω is the set of all possible strategiesI A is the set of eventsI P is the probability function

Proof.We show that it satisfies the Kolmogorov axioms.

26 / 31

Page 75: Simply typed lambda-calculus modulo isomorphisms

From non-determinism to probabilitiesTransforming our calculus in a probabilistic calculus

ARS λ↓+

I Closed normal terms of λ+ are objects of λ↓+I If r1, . . . , rn are objects, then πA(r1 + · · ·+ rn) is an object

The rewrite rules have multiplicities: e.g.πA(r + r)→ r with multiplicity 2

Theorem(Ω,A, P): probability space over λ↓+Bri = f | f (πA(

∑nj=1mj .rj)) = ri: a box

P(Bri ) = mi∑nj=1 mj

Probabilistic calculus λp+

Replace rule “If r : A, then πA(r + s)→ r” byπA(∑n

i=1mi .ri + s)→ rj with probability mj∑ni=1 mi

27 / 31

Page 76: Simply typed lambda-calculus modulo isomorphisms

From non-determinism to probabilitiesTransforming our calculus in a probabilistic calculus

ARS λ↓+

I Closed normal terms of λ+ are objects of λ↓+I If r1, . . . , rn are objects, then πA(r1 + · · ·+ rn) is an object

The rewrite rules have multiplicities: e.g.πA(r + r)→ r with multiplicity 2

Theorem(Ω,A, P): probability space over λ↓+Bri = f | f (πA(

∑nj=1mj .rj)) = ri: a box

P(Bri ) = mi∑nj=1 mj

Probabilistic calculus λp+

Replace rule “If r : A, then πA(r + s)→ r” byπA(∑n

i=1mi .ri + s)→ rj with probability mj∑ni=1 mi

27 / 31

Page 77: Simply typed lambda-calculus modulo isomorphisms

From non-determinism to probabilitiesTransforming our calculus in a probabilistic calculus

ARS λ↓+

I Closed normal terms of λ+ are objects of λ↓+I If r1, . . . , rn are objects, then πA(r1 + · · ·+ rn) is an object

The rewrite rules have multiplicities: e.g.πA(r + r)→ r with multiplicity 2

Theorem(Ω,A, P): probability space over λ↓+Bri = f | f (πA(

∑nj=1mj .rj)) = ri: a box

P(Bri ) = mi∑nj=1 mj

Probabilistic calculus λp+

Replace rule “If r : A, then πA(r + s)→ r” byπA(∑n

i=1mi .ri + s)→ rj with probability mj∑ni=1 mi

27 / 31

Page 78: Simply typed lambda-calculus modulo isomorphisms

Outline

Part 1: A type-isomorphic lambda-calculusDefining the systemNormalisation

Part 2: The other motivationThe historical motivation, in one slideRelation with probabilistic calculi

Future work: some insights

28 / 31

Page 79: Simply typed lambda-calculus modulo isomorphisms

Future workI Moving to System F

Not trivial: this interpretation is not stable under substitution

WiP:I small modifications to make it stableI adding isomorphisms on forall

I Programming language for Computable Functions (PCF)

πInt(3, 4)→ 3 and πInt(3, 4)→ 4

We need better

I Idea 1: encode of classical pairs:Standard Encoding〈r, s〉 : A ∧ A λx1.r + λx2.s : 1⇒ A ∧ 2⇒ A

π1〈r, s〉 π1⇒A(λx1.r + λx2.s)y1

I Idea 2: dependant types: πInt(3)(3, 4)→ 3

29 / 31

Page 80: Simply typed lambda-calculus modulo isomorphisms

Future workI Moving to System F

Not trivial: this interpretation is not stable under substitution

WiP:I small modifications to make it stableI adding isomorphisms on forall

I Programming language for Computable Functions (PCF)

πInt(3, 4)→ 3 and πInt(3, 4)→ 4

We need better

I Idea 1: encode of classical pairs:Standard Encoding〈r, s〉 : A ∧ A λx1.r + λx2.s : 1⇒ A ∧ 2⇒ A

π1〈r, s〉 π1⇒A(λx1.r + λx2.s)y1

I Idea 2: dependant types: πInt(3)(3, 4)→ 3

29 / 31

Page 81: Simply typed lambda-calculus modulo isomorphisms

Future workI Moving to System F

Not trivial: this interpretation is not stable under substitution

WiP:I small modifications to make it stableI adding isomorphisms on forall

I Programming language for Computable Functions (PCF)

πInt(3, 4)→ 3 and πInt(3, 4)→ 4

We need better

I Idea 1: encode of classical pairs:Standard Encoding〈r, s〉 : A ∧ A λx1.r + λx2.s : 1⇒ A ∧ 2⇒ A

π1〈r, s〉 π1⇒A(λx1.r + λx2.s)y1

I Idea 2: dependant types: πInt(3)(3, 4)→ 3

29 / 31

Page 82: Simply typed lambda-calculus modulo isomorphisms

Future workI Moving to System F

Not trivial: this interpretation is not stable under substitution

WiP:I small modifications to make it stableI adding isomorphisms on forall

I Programming language for Computable Functions (PCF)

πInt(3, 4)→ 3 and πInt(3, 4)→ 4

We need better

I Idea 1: encode of classical pairs:Standard Encoding〈r, s〉 : A ∧ A λx1.r + λx2.s : 1⇒ A ∧ 2⇒ A

π1〈r, s〉 π1⇒A(λx1.r + λx2.s)y1

I Idea 2: dependant types: πInt(3)(3, 4)→ 3

29 / 31

Page 83: Simply typed lambda-calculus modulo isomorphisms

Future work (cont.)\beginspeculation

Is there any connection of this work with HoTT?

FactsI The univalence axiom: A ≡ B ∼ A = B

I Our calculus: reasoning modulo ≡(of course we need to move to DTT first!)

Maybe some ideas are be connectedOne of its declared open problems seems to point this!

“[. . . ] there are many paths that are equal to reflexivity, but not judgmen-tally equal to it. While this homotopy-invariance has advantages, these“meaningless” identity terms do introduce needless complications into ar-guments and constructions, so it would be convenient to have a systematicway of eliminating or collapsing them”. – HoTT Book, page 12.

\endspeculation

30 / 31

Page 84: Simply typed lambda-calculus modulo isomorphisms

Future work (cont.)\beginspeculation

Is there any connection of this work with HoTT?

FactsI The univalence axiom: A ≡ B ∼ A = B

I Our calculus: reasoning modulo ≡(of course we need to move to DTT first!)

Maybe some ideas are be connectedOne of its declared open problems seems to point this!

“[. . . ] there are many paths that are equal to reflexivity, but not judgmen-tally equal to it. While this homotopy-invariance has advantages, these“meaningless” identity terms do introduce needless complications into ar-guments and constructions, so it would be convenient to have a systematicway of eliminating or collapsing them”. – HoTT Book, page 12.

\endspeculation

30 / 31

Page 85: Simply typed lambda-calculus modulo isomorphisms

Future work (cont.)\beginspeculation

Is there any connection of this work with HoTT?

FactsI The univalence axiom: A ≡ B ∼ A = B

I Our calculus: reasoning modulo ≡(of course we need to move to DTT first!)

Maybe some ideas are be connectedOne of its declared open problems seems to point this!

“[. . . ] there are many paths that are equal to reflexivity, but not judgmen-tally equal to it. While this homotopy-invariance has advantages, these“meaningless” identity terms do introduce needless complications into ar-guments and constructions, so it would be convenient to have a systematicway of eliminating or collapsing them”. – HoTT Book, page 12.

\endspeculation

30 / 31

Page 86: Simply typed lambda-calculus modulo isomorphisms

SumarisingWhat is already done

I We introduced a new calculus where isomorphicpropositions have the same proofs

I We provided a proof of strong normalisation for simplytypes

I We showed how to transform a non-deterministic calculusinto a probabilistic one

Future workI Introduce polymorphismI Move to dependant types for PCFI Connections with HoTT?I Study the projector as a quantum measurement

31 / 31