Least and Greatest Fixpoints in Game Semantics

Least and Greatest Fixpoints
in Game Semantics
Pierre Clairambault
PPS – Université Paris 7
FOSSACS 2009
March 23rd, 2009
1
Introduction
2
Game Semantics
3
Loops and Recursive Types
4
Winning and µLJ
5
Conclusion
I. Introduction
Objectives
Give an interactive model of languages with syntactic definitions
for induction/coinduction:
Dependent Type Theories,
λ-calculus,
MALL
Motivations:
Model usual induction in mathematics;
Increase the expressive power of a logic/total language while
escaping:
Impredicative reasoning,
Exponential modalities
µLJ
Formulas are built by the following grammar
S, T ::= S ⇒ T | S + T | S × T | µX .T | νX .T | X | 1 | 0
Rules are those of LJ, plus:
Γ ` T [µX .T /X ]
Γ ` µX .T
T [A/X ] ` A
µr
T [νX .T /X ] ` B
νX .T ` B
µX .T ` A
µl
A ` T [A/X ]
νl
A ` νX .T
νr
Translation of System T
nat? = µX .1 + X
ax
T `T
ax
T `T
ax
T `T
rec? =
T,T ⇒ T
`T
W
W
1, T ⇒ T , T ` T
T,T ⇒ T,T ` T
+l
1 + T,T ⇒ T,T ` T
nat, T ⇒ T , T ` T
This translation satisfies that if M1
⇒l
T
µl
M2 , then M1?
∗
M2? .
µLJ and Lattice µ-calculus.
Formulas of µLJ without ⇒ are µ-terms in Belkhir and
Santocanale’s Lattice µ-calculus:
S, T ::= S + T | S × T | µX .T | νX .T | X | 1 | 0
In their setting, µ-terms are represented by parity games.
Can we generalize this connection to µLJ and game semantics ?
Games for µ-terms.
Definition
An arena A is a directed graph, which is also
Rooted : The roots are the initial moves
Bipartite : Nodes are divided between Player and Opponent.
We equip A with a winning condition on infinite paths.
GA : PathA∞ → {W , L}
Winning Strategies.
Definition
A winning strategy is a set of paths on A, which is
Prefix-closed
Deterministic
Total
Winning
µ-terms can be seen as data types, in which case
winning strategies are data values.
An example : µ(ν)X .1 + (bool × X )
Winning strategies are lists or streams.
II. Game Semantics
Paths with backtrack.
Arenas (graphs) do not change, but paths change.
Paths with backtrack.
Arenas (graphs) do not change, but paths change.
Paths with backtrack.
Arenas (graphs) do not change, but paths change.
Paths with backtrack.
Arenas (graphs) do not change, but paths change.
Paths with backtrack.
Arenas (graphs) do not change, but paths change.
Paths with backtrack.
Arenas (graphs) do not change, but paths change.
Arena Constructions.
Arena Constructions.
Arena games and Innocent strategies.
Theorem (Hyland-Ong-Nickau)
There is a cartesian closed category I which has:
Arenas as objects,
Innocent strategies σ : A ⇒ B as morphisms from A to B.
This contains the familiar Hyland-Ong-Nickau fully abstract model
of PCF
III. Loops and Recursive Types
Recursive Types à la McCusker.
If F : I → I is an endofunctor which is continuous for the
embedding order on arenas, we define:
D=
∞
G
F n (I )
n=0
to get a solution D = F (D).
Theorem (McCusker)
If F is closed and preserves injections and projections, D is a
minimal invariant for F .
Example: Unfolded boolean lists.
Folding recursive types.
We first need to recover McCusker’s model for recursive types by
means of loops. Three main constructions:
Open Arenas: arenas with distinguished moves called holes,
representing second order free variables.
Open Functors: Each open arena A[X1 , . . . , Xn ] with n holes
gives rise to a functor
A[X1 , . . . , Xn ] : (I op × I)n → I
Loops: If A[X ] is an open arena where X is positive and not
initial, we define the loop arena µX .A[X ].
Loop construction.
Recursive Types with Loops.
By relating loops to McCusker’s account of recursive types, we get:
Theorem
If A[X ] is an open functor, then µX .A[X ] is a minimal invariant for
A[X ].
Thus we have an account of recursive types which:
Contains all the functors built out of the basic type
constructors,
Preserves the finiteness of arenas.
IV. Winning and µLJ
Winning and Totality.
Winning is sometimes used in game semantics. Indeed, winning
strategies:
Cannot give rise to infinite interaction (otherwise, one or
other would lose)
Thus, their composition preserves totality (thus we can model
proofs)
First used by Abramsky and Jagadeesan for MLL plus MIX
Relate winning in game semantics to winning in parity games to
get a model for µ and ν.
Win-games.
We extend winning on paths to winning on paths with backtrack in
the natural way.
Definition
A win-game is a pair (A, GA ) where A is an arena and
GA : LA → {W , L} is a winning function such that:
GA (s) = W ⇔ for all thread t of s, GA (t) = W ,
If s is finite, GA (s) = W ⇔ |s| is even-length.
Constructions ×, +, ⇒ extends to win-games as follows:
GA×B (s) = W
⇔ GA (sA ) = W ∧ GB (sB ) = W
GA+B (s) = W
⇔ GA (sA ) = W ∧ GB (sB ) = W
GA⇒B (s) = W
⇔ GA (sA ) = W =⇒ GB (sB ) = W
Win-games.
If s ∈ LA , we say that s ∈ σ if all finite prefixes of s are in σ.
Definition
A strategy σ : A is winning if for all even-length or infinite s ∈ σ,
GA (s) = W .
Definition
A strategy σ : A is total if for all odd-length sa ∈ σ, there is b
such that sab ∈ σ.
Proposition
There is a CCC WG of win-games and total winning strategies,
which is (almost) a full subcategory of I.
We can now interpret (co)inductive types in WG.
Least fixed point.
GµX .A[X ] (s) = W if and only if both these conditions are satisfied :
There is N ∈ N such that no path of s
crosses the external more than N times,
and
GA[X ] (sA ) = W
(µX .A[X ], idµX .A[X ] ) defines an initial algebra for A[X ].
Greatest fixed point.
GνX .A[X ] (s) = W if and only if one of these
conditions are satisfied :
For any bound N ∈ N, there is a path of
s crossing the external loop more than N
times, or
GA[X ] (sA ) = W
(νX .A[X ], idνX .A[X ] ) defines an terminal coalgebra for A[X ].
Interpretation of µLJ
The interpretation of LJ is standard.
JµX .T K = µX .JT K[X ]
JνX .T K = νX .JT K[X ]
Recursion is provided by the initial algebra/ terminal
coalgebra structure.
Theorem
J K is a correct interpretation of µLJ in WG.
Corollary
µLJ is consistent.
V. Conclusion
Contributions.
We gave a natural correct model of µLJ, “justifying” its
consistency,
The tools introduced give a rereading of recursive types in
finite arenas (model checking).
Future work.
Investigate completeness of the system (infinite strategies. . . ),
Extend the model to first order µLJ,
Investigate further the connection with winning conditions on
paths,
Model (co)induction in other settings (λ-calculus, dependent
types,. . . )
Use winning condition for more expressive constructions, such
as Dybjer’s induction/recursion.