• Aucun résultat trouvé

Predicate Transformers, (co)Monads and Resolutions

N/A
N/A
Protected

Academic year: 2021

Partager "Predicate Transformers, (co)Monads and Resolutions"

Copied!
11
0
0

Texte intégral

(1)

HAL Id: hal-00395633

https://hal.archives-ouvertes.fr/hal-00395633

Preprint submitted on 16 Jun 2009

HAL is a multi-disciplinary open access archive for the deposit and dissemination of sci- entific research documents, whether they are pub- lished or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers.

L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.

Pierre Hyvernat

To cite this version:

Pierre Hyvernat. Predicate Transformers, (co)Monads and Resolutions. 2004. �hal-00395633�

(2)

Predicate Transformers, (co)Monads and Resolutions

Pierre Hyvernat

1,2

1

Institut math´ematique de Luminy, Marseille, France

2

Chalmers Institute of Technology, G¨ oteborg, Sweden hyvernat@iml.univ-mrs.fr

Abstract. This short note contains random thoughts about a factoriza- tion theorem for closure/interior operators on a powerset which is remi- niscent to the notion of resolution for a monad/comonad. The question originated from formal topology but is interesting in itself.

The result holds constructively (even if it classically has several varia- tions); but usually not predicatively (in the sense that the interpolant will no be given by a set). For those not familiar with predicativity is- sues, we look at a “classical” version where we bound the size of the interpolant.

Introduction

A very general theorem states that any monotonic operator F : P(X ) → P(Y ) can be factorized in the form P (X) → P (Z ) → P(Y ), where Z is an appropriate set; and the first predicate transformer commutes with arbitrary unions and the second commutes with arbitrary intersections.

We prove similar factorization for interior and closure operators on a power- set; the idea being to “resolve” the operator as is usually done for (co)monad in categories. We then look at the constructive version of those factorizations.

1 Relations and Predicate Transformers

We start by introducing the basic notions:

Definition 1. If X and Y are sets, a (binary) relation between X and Y is a subset of the cartesian product X × Y . The converse of a relation r ⊆ X × Y is the relation r

⊆ Y × X defined as (y, x) ∈ r

≡ (x, y) ∈ r.

A predicate transformer from X to Y is an operator from the powerset P (X ) to the powerset P (Y ).

Since most of our predicate transformers will be monotonic (with respect to

inclusion), we drop the adjective when no confusion is possible.

(3)

Definition 2. Suppose r is a relation between X and Y ; we define two mono- tonic predicate transformers from Y to X :

hri : P(Y ) → P (X)

V 7→ {x ∈ X | (∃y ∈ Y ) (x, y) ∈ r & y ∈ V } and

[r] : P(Y ) → P (X)

V 7→ {x ∈ X | (∀y ∈ Y ) (x, y) ∈ r ⇒ y ∈ V } ; and an antitonic predicate transformer:

⌊r⌉ : P(Y ) → P(X )

V 7→ {x ∈ X | (∀y ∈ V ) (x, y) ∈ r} . Concerning notation:

– hri and [r] are somewhat common in the refinement calculus, even though the main reference ([1]) uses {r} instead of hri. The problem is that this clashes with set theoretic notation.

– In [2], Birkhoff uses V

for ⌊r⌉, but this supposes that r is clear from the context. (The notation V

would then be ⌊r

⌉(U ).)

– The linear logic community would use V

for the same thing, but this also supposes that the relation is called “⊥”.

We will always be in a “typed” context; i.e. subsets will always be subset of some ambient set. We write ¬ for complementation with respect to that ambient set.

Lemma 1. Suppose r is a relation between X and Y ; we have:

1. hri · ¬ = ¬ · [r];

2. h¬ri = ¬ · ⌊r⌉. (where (x, y) ∈ ¬r ≡ (x, y) ∈ / r) A very interesting property is the following Galois connections:

Lemma 2. Suppose r is a relation between X and Y ; then hri ⊢ [r], and ⌊r⌉ is Galois-connected to itself:

1. hri(V ) ⊆ U ⇔ V ⊆ [r

](U );

2. U ⊆ ⌊r⌉(V ) ⇔ V ⊆ ⌊r

⌉(U ).

Those predicate transformers satisfy:

Lemma 3. If r is a relation between X and Y , then

– hri commutes with arbitrary unions; (i.e. it is a sup-lattice morphism

3

) – [r] commutes with arbitrary intersections; (i.e. it is an inf-lattice morphism) – ⌊r⌉ transforms arbitrary unions into intersections.

3

All of our lattices are complete, so we do not bother writing “complete” all the

time...

(4)

3

and moreover:

any sup-lattice morphism from P (Y ) to P(X ) is of the form hri for some r ⊆ X × Y ;

any inf-lattice morphism from P (Y ) to P(Y ) is of the form [r] for some r ⊆ X × Y ;

any predicate transformer from Y to X taking arbitrary unions to intersec- tions is of the form ⌊r⌉ for some r ⊆ X × Y .

Proof. The sup-lattice part is easy; and the rest is an application of Lemma 1.

⊔ Just like it is possible to factorize any relation as the composition of a total function and the inverse of a total function, it is possible to factorize an mono- tonic predicate transformer as the composition of a hri and a [s] (see [3] for a detailed categorical construction).

Proposition 1. Suppose F is a monotonic predicate transformer from X to Y ; then there is an X

and there are relations s ⊆ X

× X and r ⊆ Y × X

such that F = hri · [s].

Proof. Let F be a monotonic predicate transformer, and define X

= P (X ) together with (U, x) ∈ s ≡ x ∈ U and (y, U) ∈ r ≡ y ∈ F (U ). We have:

y ∈ hri · [s](U )

⇔ { definition of hri }

(∃V ∈ X

) (y, V ) ∈ r & V ∈ [s](U )

⇔ { definition of X

and r } (∃V ⊆ X) y ∈ F (V ) & V ∈ [s](U )

⇔ { definition of [s] }

(∃V ⊆ X) y ∈ F (V ) & (∀x) (V, x) ∈ s ⇒ x ∈ U

⇔ { definition of s }

(∃V ⊆ X) y ∈ F (V ) & (∀x) V ⊆ U

⇔ { since F is monotonic } y ∈ F(U )

The result thus holds, but the proof doesn’t bring much information... ⊓ ⊔ And as a direct application of Lemma 1:

Corollary 1. Any monotonic predicate transformer can be factorized as a [r]·hsi or as a ⌊r⌉ · ⌊s⌉.

Similarly, any antitonic predicate transformer can be written has one of ⌊r⌉ · [s],

⌊r⌉ · hsi, hri · ⌊s⌉ or [r] · ⌊s⌉.

(5)

2 Interior and Closure Operators

Definition 3. If (X, ≤) is a partial order, we say that F : X → X is an interior operator if:

– F is monotonic;

– F is contractive: F (x) ≤ x;

– F(x) ≤ F F (x).

We say that it is a closure operator if:

– F is monotonic;

– F is expansive: x ≤ F (x);

– F F (x) ≤ F (x).

It is well known that the composition of two Galois connected operators yield interior/closure operators, so that we have:

Lemma 4. If r is a relation between X and Y , then – hri · [r

] is an interior operator on P(X );

– [r] · hr

i is a closure operator on P (X );

– ⌊r⌉ · ⌊r

is a closure operator on P (X).

Some other consequences of the Galois connection are listed below:

– hri · [r

] · hri = hri;

– [r] · hr

i · [r] = [r];

– ⌊r⌉ · ⌊r

⌉ · ⌊r⌉ = ⌊r⌉.

The problem is now to mimic Proposition 1.

Definition 4. If F is an interior operator on P (X ), a resolution for F is given by a set Y (called the interpolant) together with a relation r ⊆ Y × X such that F = hri · [r

].

Proposition 2. If F is an interior operator on P (X ), then it has a resolution.

The proof relies on the following lemma:

Lemma 5. Let F be an interior operator on a complete sup-lattice (X, ≤, W );

write Fix (F) for the collection of fixed-point for F . We have that ( Fix (F ), ≤, W ) is a complete sup-lattice; and for any x ∈ X

F(x) = _

y ∈ Fix(F) | y ≤ x . Proof. That (Fix(F), ≤, W

) is a complete sup-lattice is left as an easy exercise;

for the second point, let x ∈ X;

– we know that F (x) is a fixed point of F, and that F (x) ≤ x. This implies

that F(x) ∈ {y ∈ Fix(F) | y ≤ x}; and so F (x) ≤ W {y ∈ Fix(F ) | y ≤ x};

(6)

5 – suppose y ∈ Fix(F ) and y ≤ x; this implies that F (y) ≤ F (x), i.e. that

y ≤ F (x). We can conclude that W {y ∈ Fix(F) | y ≤ x} ≤ F(x).

Proof (of proposition 2). Suppose F is an interior operator on P(X ); define Y = Fix(F ) and (U, x) ∈ r ≡ x ∈ U . We have:

x ∈ hri · [r

](U )

⇔ { definition of r }

∃V ∈ Fix(F )

x ∈ V & (∀y) y ∈ V ⇒ y ∈ U

∃V ∈ Fix(F )

x ∈ V & V ⊆ U

x ∈ S {V ∈ Fix(F ) | V ⊆ U }

⇔ { Lemma 5 } x ∈ F (U )

which concludes the proof. ⊓ ⊔

Just like for Proposition 1, the statement of the theorem is interesting, but the proof hardly tells us anything about the structure of F . To gain a little more information about F , we will try to “bound” the size of the interpolant set Y . Definition 5. If (X, ≤, W

) is a complete sup-lattice, we say that a family (x

i

)

i∈I

of element of X is a basis if, for any y ∈ X , we have y = _

{x

i

| x

i

≤ y} .

Corollary 2. Suppose F is an interior operator on P (X ); if Fix (F ), ⊆, S has a basis of cardinality κ, then we can find a resolution of F with an interpolant Y of cardinality κ.

Proof. It is easy to see that in the above proof of Proposition 2, we can replace

Fix(F) by a basis of Fix(F ), ⊆, S . ⊓ ⊔

In particular, if there is a basis of Fix (F) which has cardinality less that the cardinality of X ; we can use X as the interpolant and use a relation r ⊆ X × X to obtain a resolution of F .

We now show that this result is optimal:

Lemma 6. Let F be an interior operator on P(X ); and suppose there are no basis of Fix(F) of cardinality κ; then there is no interpolant of cardinality less than κ.

Proof. To show that, we will construct a basis of Fix(F ) indexed by any inter-

polant for F. Suppose Y and r form a resolution for F . For any y ∈ Y , define

U

y

≡ hri{y}. We will show that (U

y

)

y∈Y

is a basis for Fix(F ).

(7)

Each U

y

is a fixed point for F :

U

y

= hri{y} { definition }

= hri · [r

] · hri{y} { second part of Lemma 4 }

= F · hri{y} { r is a resolution of F }

= F (U

y

) { definition } Let U be a fixed point of F:

U = hri · [r

](U ) { U is a fixed point of F }

= hri S {y} | y ∈ [r

](U ) { basic logic }

= S hri{y} | {y} ⊆ [r

](U ) { hri commutes with unions }

= S hri{y} | hri{y} ⊆ U { Galois connection between hri and [r

] }

= S {U

y

| U

y

⊆ U } { definition }

which concludes the proof that (U

y

)

y∈Y

is a basis for Fix(F). ⊓ ⊔ Let’s look at an example of interior operator on P (X) which cannot be resolved using X as an interpolant. Let X be a countable infinite set (natural numbers for example); and define F : P (X) → P (X) as follows:

F(U ) =

∅ if U is finite U if U is infinite

The sup-lattice Fix(F ) is given by the collection of infinite subsets of X ; and this lattice doesn’t have a countable basis. To prove that, it is enough to do it for any particular countable infinite set. Take C to be the set of finite strings over {0, 1}. If α is an infinite string of 0’s and 1’s, define U

α

⊆ C to be the set of finite prefixes of α. Each U

α

is an element of Fix(F ); but no countable family of infinite subsets can “generate” all the U

α

: since α 6= β implies that U

α

∩ U

β

is finite, if V

i

⊆ U

α

and V

j

⊆ U

β

then i 6= j. In other words, a family which generates all the U

α

’s needs to have the cardinality of the collection of the U

α

’s, i.e. uncountable.

Using Lemma 1, we can now extend all what has been done for interior operators for closure operators: if F is a closure operator on P(X ), then ¬ · F · ¬ is an interior operator on P(X ).

Corollary 3. If F is a closure operator on P (X ), then it has a resolution as a composition [r] · hr

i or as ⌊r⌉ · ⌊r

⌉.

As for interior operators, the possible cardinalities of the interpolant are given by the cardinalities of the bases for the inf-lattice Fix(F ).

In particular, for linear logicians, it is not the case that any closure operator can be written as a biorthogonal...

3 Comonad and Monads

It seems that the traditional way to look at monads in a category is to see them as a kind of generalized monoid; at least in my part of the world. Another view

4

4

which has given me a much better understanding of what (co)monads are

(8)

7 is to view them as a generalization of closure operators. This is the view taken in the introduction of [4].

Definition 6. A monad on a category C is a morphism F : C → C together with two natural transformations η : Id

C

→ F and µ : F F → F s.t. some diagram commute.

If one takes the partial order category P (X ), then a monad is an operator on P (X) s.t.:

– it acts on morphisms: if i : U ⊆ V then F

i

: F (U ) ⊆ F (V ); i.e. F is monotonic;

– there is a natural transformation η

U

: U ⊆ F (U );

– there is a natural transformation µ

U

: F F (U ) ⊆ F(U ).

All the “coherence” conditions are trivially satisfied in a partial order category, since every diagram commute! What we’ve just shown is that a monad on P (X ) is nothing more than a closure operator on P(X ); and vice and versa. Similarly, a comonad corresponds to an interior operator.

In categories, a resolution for a monad corresponds to factorizing the func- tor F as the composition of two adjoint functors. Adjointness H ⊢ G between the functors G : D → C and H : C → D in a locally small category means that C[A, G(B)] ≃ D[H (A), B] which, in the case of a partial order category sim- plifies to “U ⊆ G(V ) iff H (U ) ⊆ V ” i.e. is exactly the Galois connection H ⊢ G.

Category theory tells us that there always is a resolution since we have two degenerate resolutions: something like F = Id· F and F = F ·Id. The first one is given by the Eleinberg-Moore category. In the context of order theory, it amounts to taking: interpolant category to partial orders: if F is a closure operator on X , take E(X, F ) to be the the collection of fixed points for F , with the ordering inherited from X .

5

We have F : X → E (X, F ) and Id : E(X, F ) → X which are adjoint: F ⊢ Id.

x ≤ Id(f )

⇒ { F is monotonic } F(x) ≤ F (f )

⇔ { f ∈ E (X, F ), i.e. f is a fixed point for F } F(x) ≤ f

and F (x) ≤ f ⇒ x ≤ f = Id(f ) since x ≤ F (x).

The second resolution (F · Id ) is obtained via the Kleisli categry. In the context of order theory, it amounts to taking the order (X, ⊑) where x ⊑ y iff F (x) ≤ F(y).

What is important to us is that those resolutions are trivial and uninteresting.

More abstract nonsense states that there is a category of resolutions for any given monad; and that those two trivial resolutions are respectively initial/terminal.

5

In a partial order, an algebra for F is just a post fixed point: x ≤ F (x). If F is a

closure, then it is also a fixed point for F .

(9)

What we have done with Proposition 2 and Corollary 3 corresponds to finding a non-trivial resolution for the monad corresponding to the interior/closure oper- ator. It is even more than a resolution, since the interpolant is itself a complete and cocomplete category (and one of the functors preserves limits while the other one preserves colimits; but this is a general fact about adjoints). The feeling is that this resolution lies “exactly in the middle” between the initial and terminal resolutions. I don’t know if this kind of “strong” resolution has been considered in category theory.

6

The resolution constructed here is quite different from the Eleinberg-Moore resolution (even though it uses the fixed-points as a basis). We do not construct functors from P (X) to E(X, F ) and back; but from P(X ) to P E(X, F )

and back. In particular, as noted above, the interpolant is complete and cocomplete;

7

which is not the case for the Eleinberg-Moore category: fixed points for an in- terior are closed under unions but not under intersections; and conversely for closure operators.

4 Revisiting Section 2 in a Constructive Setting

4.1 Impredicative

In the previous section we used Lemma 1 to generalize results on interior to closures. It is thus natural to ask whether (1) we can make the original proof constructive; (2) we can avoid using this lemma and prove the result for closure constructively. I will not into the details but just provide some hints about that.

– Galois connections from Lemma 2 are constructive.

– Lemma 3: the first part is trivial. The second part is easy: if F commutes with unions, take (x, y) ∈ r iff y ∈ F {x}; if F commutes with intersections, take (x, y) ∈ r iff (∀U ) y ∈ F (U ) ⇒ x ∈ U ; and if F transforms unions into intersections, take (x, y) ∈ r iff y ∈ F {x}.

– Proposition 1: the proof is constructive.

– Lemma 3 is constructive.

– Lemma 5 and the corresponding lemma for closure operator are constructive.

– Proposition 2 is constructive.

– we can mimic the proof of Proposition 2 to obtain a resolution of a closure operator as F = ⌊r⌉ · ⌊r

⌉, but not to obtain a resolution as F = [r] · hr

i.

– I doubt we can constructively obtain a resolution of a closure operator as F = [r] · hr

i.

– all of the lemmas about the size of interpolant are constructive at least if we read then as “if B is a basis for Fix(F) then we can use B as an interpolant”.

As a proof of concept, all this (except the last point) has been proved in the proof assistant COQ.

8

6

i.e. if C is a complete and cocomplete category and F is a monad on C, a “strong resolution” is a resolution with a complete and cocomplete interpolant. Any reference to something similar in the literature would be most welcome.

7

i.e. is a complete lattice since we deal with partial orders

8

proof scripts available from http://iml.univ-mrs.fr/~hyvernat/academics.html

(10)

9

4.2 Predicative

In a predicative setting like Martin-L¨ of type theory (see [5]) or CZF (constructive ZF, see [6]) set theory, many of the results are not provable. The reason being that we do not allow quantification on a power-set. The main result about resolution would become something like:

Proposition 3. Suppose Fix(F) (proper type) has a set-indexed basis, then F as a resolution as hri·[r

] (if F is an interior) or as ⌊r⌉·⌊r

(if F is a closure).

If F as a resolution, then Fix(F ) as a set-index basis.

Note that having a set-indexed basis is equivalent to being “set presented” in the terminology of P. Aczel ([6,7]). Note that in the case of an interior operator, this implies that the predicate transformer is “set-based” (in the sense that it has a factorization as in Proposition 1, where the interpolant X

is a set). It doesn’t seem that the existence of a resolution for a closure operator implies that the original predicate transformer is itself set-presented.

Conclusion

Nothing revolutionary has really been done, but the statement of Propositions 1 and 2 is, in an abstract setting, quite neat. However, as the proofs show, this is mostly abstract nonsense. The best example is probably Proposition 1, where y ∈ F (U ) is factorized as “there is a V such that s ∈ F(V ) and V ⊆ U ”. The proof of Proposition 2 is slightly subtler, but is hardly interesting. In the end, the most interesting and informative thing is probably Lemma 6, in its “positive”

version: if F has Y as an interpolant, then Fix(F) has a basis indexed by Y , which is hardly a breakthrough in mathematics...

I do nevertheless hope that it might interest some people, since while Propo- sition 1 is known to many (especially the refinement calculus people), it seems that Proposition 2 isn’t stated anywhere. I also hope the link between monad and closure operator (together with the Eleinberg-Moore category being the partial order of fixed points) will gain in popularity, as I see it as a much better way of seeing monads, at least as far as intuition is concerned.

A final word about the motivation for this: the starting point was the question about whether it is possible to represent any “basic topology” (see the forth- coming [8]) as the formal side of a basic pair, impredicatively speaking. A basic topology is a structure (X, A, J ) where X is a set, and A and J are closure and interior operators on P (X ) such that A(U ))(J (V ) ⇒ U )((J (V ).

9

The answer is obviously no since the A and J arising from a formal pair are classically dual (i.e. A · ¬ = ¬ · J ) and there are basic topologies which are provably not dual.

The question then turned into: “can any interior operator be written as the for- mal interior of a basic pair?” and similar for closure operators. The answers are yes (Proposition 2) and I don’t know (the constructive resolution of a closure is of the form ⌊r⌉ · ⌊r

⌉, and not of the form [r] · hr

i.)

9

U ))(V is the constructive version of U ∩ V 6= ∅.

(11)

References

1. Back, R.J., von Wright, J.: Refinement Calculus: a systematic introduction. Grad- uate texts in computer science. Springer-Verlag, New York (1998)

2. Birkhoff, G.: Lattice theory. Third edition. American Mathematical Society Col- loquium Publications, Vol. XXV. American Mathematical Society, Providence, R.I.

(1967)

3. Gardiner, P.H.B., Martin, C.E., de Moor, O.: An algebraic construction of predicate transformers. Science of Computer Programming 22 (1994) 21–44

4. Lambek, J., Scott, P.J.: Introduction to higher order categorical logic. Volume 7 of Cambridge Studies in Advanced Mathematics. Cambridge University Press, Cam- bridge (1988) Reprint of the 1986 original.

5. Martin-L¨ of, P.: Intuitionistic type theory. Bibliopolis, Naples (1984) Notes by Giovanni Sambin.

6. Aczel, P., Rathjen, M.: Notes on constructive set theory. Technical Report 40, Mittag-Leffler Institut, Stockholm (2000/2001)

7. Aczel, P.: An introduction to inductive definitions. In: Handbook of mathemati- cal logic, Amsterdam, North-Holland Publishing Co. (1977) 739–782 Edited by Jon Barwise, With the cooperation of H. Jerome Keisler, Kenneth Kunen, Yiannis Niko- las Moschovakis and Anne Sjerp Troelstra, Studies in Logic and the Foundations of Mathematics, Vol. 90.

8. Sambin, G.: Basic topologies, formal topologies, formal spaces (the Basic Picture,

III) (2002) Draft.

Références

Documents relatifs

However, we obtain equicontinuity by either putting an additional condition on the maps or by assuming that the spaces are

The notion of a weakly quasisymmetric embed- ding was introduced by Tukia and Våiisälä [TV]... Thefunction n*u(n')

The second property of the capacity metric that we derive is an interpretation of this metric in terms of the reduced modulus of a path family of cycles homologous

Vous allez programmer une feuille de calcul permettant de déterminer les solutions d'un système de deux équations à deux inconnues, en vous aidant des

COMPLETELY INTEGRABLE DIFFERENTIAL EOUATIONS IN ABSTRACT SPACES. FRI~;CrtET, Annales So. A Banaeh space is briefly a complete normed vector space closed under multi-

Note: This examination consists of ten questions on one page. a) Considering two arbitrary vectors a and b in three-dimensional Cartesian space, how can the angle between

No calculators are to be used on this exam. Note: This examination consists of ten questions on one page. Give the first three terms only. a) What is an orthogonal matrix?

Note: This examination consists of ten questions on one page. a) For a rectangular matrix B, what is its singular value decomposition? Illustrate with a simple example. b)