Coinduction All the Way Up

Transcription

Coinduction All the Way Up
Coinduction All the Way Up
Damien Pous
Plume group, CNRS, ENS Lyon
Gallium, Paris, 12.o9.2o16
Program Equivalence
Through equational reasoning
!a. a = !(a | a)
= !a | !a
= !a
(a. a = a | a)
(!(P | Q) = !P | !Q)
(!P | !P = !P)
(Axiomatic, syntax-based, inductive)
Damien Pous, CNRS, ENS Lyon
2/11
Program Equivalence
Through bisimulations
R , {hP | Q, Q | Pi | ∀P, Q}
(Behavioural, LTS-based, coinductive)
Damien Pous, CNRS, ENS Lyon
3/11
Program Equivalence
Through bisimulations
R , {hP | Q, Q | Pi | ∀P, Q}
P|Q
τ
(νa)(P 0 | Q 0 )
Damien Pous, CNRS, ENS Lyon
R
R
/
Q|P
τ
(νa)(Q 0 | P 0 )
3/11
Program Equivalence
Through bisimulations
R , {h(ν ã)(P | Q), (ν ã)(Q | P) | ∀ã, P, Qi}
P|Q
τ
(νa)(P 0 | Q 0 )
Damien Pous, CNRS, ENS Lyon
R
R
Q|P
τ
(νa)(Q 0 | P 0 )
3/11
Program Equivalence
Through bisimulations up-to
R , {hP | Q, Q | Pi | ∀P, Q}
P|Q
τ
(νa)(P 0 | Q 0 )
R
R
/
Q|P
τ
(νa)(Q 0 | P 0 )
(νa)(R)
Damien Pous, CNRS, ENS Lyon
3/11
Program Equivalence
Through bisimulations up-to
R , {h!(P | Q), !P | !Qi}
Damien Pous, CNRS, ENS Lyon
4/11
Program Equivalence
Through bisimulations up-to
R , {h!(P | Q), !P | !Qi}
!(P | Q)
α
!(P | Q) |
Damien Pous, CNRS, ENS Lyon
(P 0
R
| Q) R
/
!P | !Q
α
(!P | P 0 ) | !Q
4/11
Program Equivalence
Through bisimulations up-to
R , {h!(P | Q), !P | !Qi}
!(P | Q)
α
!(P | Q) |
(P 0
R
| Q) R
/
!P | !Q
α
(!P | P 0 ) | !Q
∼
(!P | P 0 ) | (!Q | Q)
Damien Pous, CNRS, ENS Lyon
4/11
Program Equivalence
Through bisimulations up-to
R , {h!(P | Q), !P | !Qi}
!(P | Q)
α
!(P | Q) |
(P 0
R
| Q) R
/
!P | !Q
α
(!P | P 0 ) | !Q
∼
(!P | P 0 ) | (!Q | Q)
∼
(!P | !Q) | (P 0 | Q)
Damien Pous, CNRS, ENS Lyon
4/11
Program Equivalence
Through bisimulations up-to
R , {h!(P | Q), !P | !Qi}
!(P | Q)
α
!(P | Q) |
(P 0
R
/
| Q) R
!P | !Q
α
(!P | P 0 ) | !Q
∼
C(R)
Damien Pous, CNRS, ENS Lyon
(!P | P 0 ) | (!Q | Q)
∼
(!P | !Q) | (P 0 | Q)
4/11
Program Equivalence
Through bisimulations up-to
R , {h!(P | Q), !P | !Qi}
!(P | Q)
α
!(P | Q) |
(P 0
R
/
| Q) R
!P | !Q
α
(!P | P 0 ) | !Q
∼
C(R)
(!P | P 0 ) | (!Q | Q)
∼
(!P | !Q) | (P 0 | Q)
A mix of
•
behavioural, LTS-based, coinductive
•
axiomatic, syntax-based, inductive
Damien Pous, CNRS, ENS Lyon
4/11
Abstract coinduction
Let b a monotone function on a complete lattice
•
bisimulation
candidate
Coinduction
x ≤ y ≤ b(y )
law to be
proved
Damien Pous, CNRS, ENS Lyon
x ≤ νb
program
equivalence
5/11
Abstract coinduction
Let b a monotone function on a complete lattice
•
bisimulation
candidate
Coinduction
x ≤ y ≤ b(y )
law to be
proved
•
x ≤ νb
program
equivalence
an up-to
technique
Coinduction up to
x ≤ y ≤ b( f (y ))
x ≤ νb
Damien Pous, CNRS, ENS Lyon
5/11
Up-to techniques
bisimulation
candidate
up-to
technique
x ≤ y ≤ b( f (y ))
law to be
proved
x ≤ νb
program
equivalence
The function f can be
•
sound: it just makes the rule valid
•
respectful: f ◦ (b ∩ id) ≤ b ◦ f
•
compatible: f ◦ b ≤ b ◦ f
[Sangiorgi’94]
[me’07]
The latter two classes are closed under union and composition
Damien Pous, CNRS, ENS Lyon
6/11
The companion
Let t be the largest compatible function
•
We have
1.
2.
3.
4.
5.
id ≤ t and t ◦ t ≤ t, i.e., t is a closure
νb = t(⊥)
νb = t(νb)
νb = ν(b ◦ t)
t coincides with the largest respectful
•
Intuitively t(x) is “what can be deduced assuming x”
•
Leads to a new presentation of parameterized coinduction
Damien Pous, CNRS, ENS Lyon
7/11
Parameterized Coinduction (Up-to)
y ≤ t(⊥)
y ≤ νb
Init
y≤ x
y ≤ t(x)
f ≤t
y ≤ t(x)
program
equivalence
law to be
proved
y ≤ f (t(x))
Up to f
reason inductively, using
some valid up-to technique
y ≤ b(t( y ∪ x))
Done
use coinduction
hypotheses
Damien Pous, CNRS, ENS Lyon
y ≤ t(x)
CoInd
assume y by
coinduction
8/11
Second order techniques
The companion is itself a coinductive object
t = νB
(for some B : (X → X ) → (X → X ) whose post-fixpoints are the
compatible functions)
Damien Pous, CNRS, ENS Lyon
9/11
Second order techniques
The companion is itself a coinductive object
t = νB
(for some B : (X → X ) → (X → X ) whose post-fixpoints are the
compatible functions)
We can apply the previous results
potential
generalisation
companion of B
f ≤ g ≤ B( T (g ))
up-to technique
to be proved valid
Damien Pous, CNRS, ENS Lyon
f ≤ t
companion of b
9/11
Back to process algebra
[Standard approach] The following function is respectful:
C : R 7→ {hC [P̃], C [Q̃]i | P̃ R Q̃}
Damien Pous, CNRS, ENS Lyon
10/11
Back to process algebra
[Standard approach] The following function is respectful:
C : R 7→ {hC [P̃], C [Q̃]i | P̃ R Q̃}
[New approach] The following functions are below t:
c(νa) : R 7→ {h(νa)P, (νa)Qi | P R Q}
c| : R 7→ {hP1 | P2 , Q1 | Q2 i | Pi R Qi }
c! : R 7→ {h!P, !Qi | P R Q}
...
(A routine check in each case, thanks to the second order
companion)
Damien Pous, CNRS, ENS Lyon
10/11
Back to process algebra
[Standard approach] The following function is respectful:
C : R 7→ {hC [P̃], C [Q̃]i | P̃ R Q̃}
[New approach] The following functions are below t:
c(νa) : R 7→ {h(νa)P, (νa)Qi | P R Q}
c| : R 7→ {hP1 | P2 , Q1 | Q2 i | Pi R Qi }
c! : R 7→ {h!P, !Qi | P R Q}
...
(A routine check in each case, thanks to the second order
companion)
Damien Pous, CNRS, ENS Lyon
10/11
Summary
Huge simplification of the theory of up-to techniques. . .
. . . just by focusing on the largest one
•
parameterized coinduction through the companion
•
second order techniques for the companion
•
straightforward formalisation in Coq
In progress: categorical account
Damien Pous, CNRS, ENS Lyon
11/11

Documents pareils