A Coinductive Confluence Proof for Infinitary Lambda-Calculus

Report 0 Downloads 59 Views
A Coinductive Confluence Proof for Infinitary Lambda-Calculus Łukasz Czajka Institute of Informatics Faculty of Mathematics, Informatics and Mechanics University of Warsaw

14 July 2014

1 / 30

A Coinductive Confluence Proof for Infinitary Lamba-calculus Presentation plan

2 / 30

A Coinductive Confluence Proof for Infinitary Lamba-calculus Presentation plan

1. Coinduction.

2 / 30

A Coinductive Confluence Proof for Infinitary Lamba-calculus Presentation plan

1. Coinduction. 2. Infinitary lambda-calculus.

2 / 30

Coinduction Coinductive definitions

3 / 30

Coinduction Coinductive definitions

T ::= V k A(T) k B(T, T)

3 / 30

Coinduction Coinductive definitions

T ::= V k A(T) k B(T, T) The set T consists of all finite and infinite terms built up from variables and the constructors A and B.

3 / 30

Coinduction Coinductive definitions

T ::= V k A(T) k B(T, T) The set T consists of all finite and infinite terms built up from variables and the constructors A and B. The set of all possibly infinite labelled trees with labels specified by the grammar.

3 / 30

Coinduction Guarded corecursion

For t ∈ T, x ∈ V , substtx : T → T.

4 / 30

Coinduction Guarded corecursion

For t ∈ T, x ∈ V , substtx : T → T. substtx (x) substtx (A(s)) substtx (y ) t substx (B(s1 , s2 ))

= = = =

t A(substtx (s)) y if y 6= x B(substtx (s1 ), substtx (s2 ))

4 / 30

Coinduction Guarded corecursion

For t ∈ T, x ∈ V , substtx : T → T. substtx (x) substtx (A(s)) substtx (y ) t substx (B(s1 , s2 ))

= = = =

t A(substtx (s)) y if y 6= x B(substtx (s1 ), substtx (s2 ))

Each (co)recursive call of substtx occurs directly inside a constructor for T.

4 / 30

Coinduction Coinductive definitions of relations

x → x (1)

t → t0 (2) A(t) → A(t 0 )

s → s0 t → t0 (3) B(s, t) → B(s 0 , t 0 )

t → t0 (4) A(t) → B(t 0 , t 0 )

5 / 30

Coinduction Coinductive definitions of relations

x → x (1)

t → t0 (2) A(t) → A(t 0 )

s → s0 t → t0 (3) B(s, t) → B(s 0 , t 0 )

t → t0 (4) A(t) → B(t 0 , t 0 )

The relation → is the greatest fixpoint νF of a function F : P(T × T) → P(T × T) defined as follows. F (R) = {ht1 , t2 i | (t1 ≡ t2 ≡ x)∨ ∃t, t 0 (t1 ≡ A(t) ∧ t2 ≡ A(t 0 ) ∧ R(t, t 0 )) ∨ ∃s, t, s 0 , t 0 (t1 ≡ B(s, t) ∧ t2 ≡ B(s 0 , t 0 )∧ R(s, s 0 ) ∧ R(t, t 0 ))∨ 0 ∃t, t (t1 ≡ A(t) ∧ t2 ≡ B(t 0 , t 0 ) ∧ R(t, t 0 ))}

5 / 30

Coinduction Coinductive definitions of relations

x → x (1)

t → t0 (2) A(t) → A(t 0 )

s → s0 t → t0 (3) B(s, t) → B(s 0 , t 0 )

t → t0 (4) A(t) → B(t 0 , t 0 )

The relation → is the greatest fixpoint νF of a function F : P(T × T) → P(T × T) defined as follows. F (R) = {ht1 , t2 i | (t1 ≡ t2 ≡ x)∨ ∃t, t 0 (t1 ≡ A(t) ∧ t2 ≡ A(t 0 ) ∧ R(t, t 0 )) ∨ ∃s, t, s 0 , t 0 (t1 ≡ B(s, t) ∧ t2 ≡ B(s 0 , t 0 )∧ R(s, s 0 ) ∧ R(t, t 0 ))∨ 0 ∃t, t (t1 ≡ A(t) ∧ t2 ≡ B(t 0 , t 0 ) ∧ R(t, t 0 ))} F is monotone, i.e., F (R) ⊆ F (S) for R ⊆ S. 5 / 30

Coinduction Sample coinductive proof

We show: for all t ∈ T, t → t.

6 / 30

Coinduction Sample coinductive proof

We show: for all t ∈ T, t → t. If t ≡ x then this follows by rule (1).

6 / 30

Coinduction Sample coinductive proof

We show: for all t ∈ T, t → t. If t ≡ x then this follows by rule (1). If t ≡ A(t 0 ) then t 0 → t 0 by the coinductive hypothesis, so t ≡ A(t 0 ) → A(t 0 ) ≡ t by rule (2).

6 / 30

Coinduction Sample coinductive proof

We show: for all t ∈ T, t → t. If t ≡ x then this follows by rule (1). If t ≡ A(t 0 ) then t 0 → t 0 by the coinductive hypothesis, so t ≡ A(t 0 ) → A(t 0 ) ≡ t by rule (2). If t ≡ B(t1 , t2 ) then t1 → t1 and t2 → t2 by the coinductive hypothesis, so t → t by rule (3).

6 / 30

Coinduction Sample coinductive proof

We show: for all t ∈ T, t → t. If t ≡ x then this follows by rule (1). If t ≡ A(t 0 ) then t 0 → t 0 by the coinductive hypothesis, so t ≡ A(t 0 ) → A(t 0 ) ≡ t by rule (2). If t ≡ B(t1 , t2 ) then t1 → t1 and t2 → t2 by the coinductive hypothesis, so t → t by rule (3). 2

6 / 30

Coinduction Usual coinduction principle

Monotone F : P(A) → P(A) for some set A.

7 / 30

Coinduction Usual coinduction principle

Monotone F : P(A) → P(A) for some set A. By the Knaster-Tarski fixpoint theorem: \ µF = {X ∈ P(A) | F (X ) ⊆ X } νF =

[ {X ∈ P(A) | X ⊆ F (X )}.

7 / 30

Coinduction Usual coinduction principle

Monotone F : P(A) → P(A) for some set A. By the Knaster-Tarski fixpoint theorem: \ µF = {X ∈ P(A) | F (X ) ⊆ X } νF =

[ {X ∈ P(A) | X ⊆ F (X )}.

This yields the following proof principles X ⊆ F (X ) F (X ) ⊆ X (IND) (COIND) µF ⊆ X X ⊆ νF where X ∈ P(A).

7 / 30

Coinduction Alternative characterisation of νF

Monotone F : P(A) → P(A) for some set A.

8 / 30

Coinduction Alternative characterisation of νF

Monotone F : P(A) → P(A) for some set A. I

ν 0 F = A,

I

ν α+1 F = F (ν α F ), T ν α F = β