Katětov Functors

We develop a theory of Katětov functors which provide a uniform way of constructing Fraïssé limits. Among applications, we present short proofs and improvements of several recent results on the structure of the group of automorphisms and the semigroup of endomorphisms of some Fraïssé limits.


Introduction
The theory of Fraïssé limits has a long history, inspired by Cantor's theorem saying that the set of rational numbers is the unique, up to isomorphisms, countable linearly ordered set without end-points, such that between any two points there is another one. In the fifties of the last century, Roland Fraïssé [12] realized that the ideas behind Cantor's theorem are much more general, thus developing his theory of limits. Namely, given a class A of finitely generated first-order structures with certain natural properties, there exists a unique countably generated structure L (called the Fraïssé limit of A) containing isomorphic copies of all structures from A and having a very strong homogeneity property, namely, every isomorphism between finitely generated substructures of L extends to an automorphism of L. Fraïssé theory can now be called classical and is part of almost every textbook in model theory. Independently of Fraïssé, around thirty years earlier, Urysohn [28] constructed a universal separable complete metric space U which has the same homogeneity property as Fraïssé limits: every finite isometry extends to a bijective isometry of U. Around the eighties of the last century, merely sixty years after Urysohn's work, Katětov [19] found a uniform way of extending metric spaces, leading to a new and simple construction of the Urysohn space U. It turns out that Katětov's construction is functorial, namely, it can be extended to all nonexpansive mappings between metric spaces.
One has to point out that the crucial ideas in Fraïssé theory (including its existing generalizations) are of purely category-theoretic nature. This has been recently demonstrated by the first author [23], subsequently applied by Caramello [7] in topos theory. It seems that the first work presenting category-theoretic approach to Fraïssé limits is by Droste and Göbel [11] (1989), with applications in algebra and theoretical computer science, simply by considering classes of models with certain restrictions on embeddings. Another work, independent of the above, is by Irwin and Solecki [18] (2006), where the authors simply reverse the arrows in the classical Fraïssé theory, replacing embeddings by quotient epimorphisms. They apply their theory (which is in fact an instance of the general category-theoretic Fraïssé theory from [11] or [23]) for proving new properties of the so-called pseudo-arc, a special compact connected 1-dimensional planar set which has been in the scope of interest of geometric topologists throughout the last decades.
We address the question when a functorial way of constructing a Fraïssé limit exists. Namely, we define the concept of a Katětov functor capturing simple extensions of finitely generated structures, whose infinite power gives the Fraïssé limit. The existence of a Katětov functor implies directly that the automorphism group of the Fraïssé limit is universal for the class of all automorphism groups of countably generated structures from the given Fraïssé class. Papers [10] and [4] discuss some of the issues addressed in this note, without realizing that what one deals with are actually functorial constructions.
The authors would like to thank the Editor and the Referee for drawing our attention to the fact that our Katětov construction (presented in Section 3 below) is a special case of Reiterman's functorial construction, published with Koubek [21] in 1979 (see also [1] for more, explanations and details) and for pointing out references [1] and [21]. This paper, therefore, can be thought of as another display of the versatility of Reiterman's important construction.
As we have mentioned above, our principal motivation comes from Katětov's construction of the Urysohn space [19], which we briefly recall here in case of the rational Urysohn space. Let X be a metric space with rational distances. A Katětov function over X is every function α : X → Q such that

|α(x) − α(y)| d(x, y) α(x) + α(y)
for all x, y ∈ X. Let K(X) be the set of all Katětov functions over X. The sup metric turns K(X) into a metric space. There is a natural isometric embedding X → K(X) which takes a ∈ X to d(a, ·) ∈ K(X). Hence we get a chain of embeddings X → K(X) → K 2 (X) → K 3 (X) → · · · whose colimit is easily seen to be the rational Urysohn space.
It was observed by several authors (see, e.g., [3,29]) that the construction K is actually functorial with respect to embeddings. Our principal observation is that more is true: if A is the category of all finite metric spaces with rational distances and nonexpansive mappings, and C is the category of all countable metric spaces with rational distances and nonexpansive mappings, then K can be turned into a functor from A to C. We present the details in the appendix to this note.
Our aim is to introduce and study the concept of a Katětov functor for a Fraïssé class. We have decided to work within the classical framework of model-theoretic Fraïssé theory, although most of our results can be adapted to a more general setting of Fraïssé categories (i.e., classes of objects with abstractly defined embeddings, see [23]).
The paper is organized as follows. Section 2 contains the main concept of a Katětov functor, its basic properties, examples, and a discussion of sufficient conditions for its existence. We prove, in particular, that a Kaětov functor exists if embeddings have pushouts in the category of all homomorphisms. In Section 3 we show how iterations of a Kaětov functor lead to Fraïssé limits. It turns out that the Fraïssé limit can be viewed as a fixed point of the countable infinite power of a Katětov functor and all orbits of this functor "tend" to the Fraïssé limit, resembling the Banach contraction principle. Section 4 deals with the semigroup Bergman property. We prove that in the presence of a Katětov functor, under some mild additional assumptions the endomorphism monoid End(L) of the Fraïssé limit L is strongly distorted and its Sierpiński rank is at most five. Applying a result from [25], we conclude that if End(L) is not finitely generated, then it has the Bergman property. This extends a recent result of Dolinka [8]. The last Section 5 is an appendix containing description of the original Katětov functor on metric spaces with nonexpansive mappings. We finish with a short discussion of possible generalizations of our results in category-theoretic setting.

The Setup
where R is a set of relational symbols, F a set of functional symbols, and C a set of constant symbols. We say that is a purely relational language if F = C = 0. For a -structure A and X ⊆ A, by X A we denote the substructure of A generated by X. We say that A is finitely generated if A = X A for some finite X ⊆ A. The fact that A is a substructure of B will be denoted by A B.
Let C be a category of -structures. A chain in C is a sequence of objects and embeddings of the form C 1 → C 2 → C 3 → · · · . Note that although there may be other kinds of morphisms in C, a chain always consists of objects and embeddings. We shall say that L is a standard colimit of the chain C 1 → C 2 → · · · if it is a colimit of this chain in the usual sense and moreover, after forgetting the structure L is still a colimit in the category of sets. In other words, if the embeddings are inclusions, that is, C 1 ≤ C 2 ≤ · · · then a standard colimit is L = n∈N C n with an appropriate -structure making it a colimit in C. We shall say that C has standard colimits of chains if every chain in C has a standard colimit in C. Given C ∈ Ob(C), let Aut(C) denote the permutation group consisting of all automorphisms of C, and let End(C) denote the transformation monoid consisting of all C-morphisms C → C. It may be the case that End(C) consists of all embeddings of C into C (if C consists of embeddings only). We shall sometimes write End C (C) instead of End(C) in order to emphasize that we consider C-morphisms only. We say that C has the joint-embedding property (briefly: (JEP)) if every two structures in C embed into a common structure in C.
Standing Assumption Throughout the paper we assume the following. Let be a first-order language, let C be a category of countably generated -structures and some appropriately chosen class of morphisms that includes all embeddings (and hence all isomorphisms). Let A be the full subcategory of C spanned by all finitely generated structures in C. In particular, A is hereditary in the sense that given A ∈ Ob(A), every finitely generated substructure 1 of A is an object of A.
We assume that the following holds: • C has standard colimits of chains; • every C ∈ Ob(C) is a colimit of some chain A 1 → A 2 → · · · in A; • A has only countably many isomorphism types; and • A has the joint embedding property (JEP).
For an object C ∈ Ob(C) let age(C) denote the class of all finitely generated objects that embed into C. Note that age(C) ⊆ Ob(A) for every C ∈ Ob(C).
We say that C ∈ Ob(C) is a one-point extension of B ∈ Ob(C) if there is an embedding j : B → C and an x ∈ C \ j (B) such that C = j (B) ∪ {x} C . In that case we write j : B˙ → C or simply B˙ → C.
The following lemmas are immediate consequences of the fact that C is a category of -structures and that A is spanned by finitely generated objects in C.
and an embedding f : C → D which is not an isomorphism, there exist C 1 , C 2 . . . ∈ Ob(C) such that is a colimit diagram in C. Lemma 1.2 Let C, D ∈ Ob(C) be structures such that f : C˙ → D and let A 1 → A 2 → . . . be a chain in A whose colimit is C. Then there exists a chain B 1 → B 2 → . . . in A whose colimit is D and the following diagram commutes where the curvy arrows are canonical embeddings into the colimits.
Proof Without loss of generality we can assume that C ≤ D, and that The next lemma is rather obvious, as we assume that colimits are standard.

Lemma 1.3 (Factoring through the colimit of a chain) Let
be a chain in C and let L be its colimit with the canonical embeddings ι k : C k → L. Then for every A ∈ Ob(A) and every morphism f : A → L there is an n ∈ N and a morphism g : A → C n such that f • g = ι n . Moreover, if f is an embedding, then so is g.
Proof Take any C ∈ Ob(C), and let A 1 → A 2 → · · · be a chain in A whose colimit is C. Take any B ∈ age(C). Then B → C, so by Lemma 1.3 there are n ∈ N and an embedding g : B → A n such that Therefore, B → A n ∈ Ob(A), so the assumption that A is hereditary yields B ∈ Ob(A).

Katětov Functors
is an embedding in C; and • there is a natural transformation η 0 : ID → K 0 such that for every one-point extension Theorem 2.2 If there exists a Katětov functor K 0 : A → C then there is a functor K : C → C such that: • K is an extension of K 0 (that is, K and K 0 coincide on A); • there is a natural transformation η : ID → K which is an extension of η 0 (that is, η A = η 0 A whenever A ∈ Ob(A)); • K preserves embeddings.
Proof The obvious candidate for K is the left Kan extension of K 0 along the inclusion functor E : A → C (which acts identically on both objects and morphisms of A). To show that such an extension exists it suffices to show that the diagram (E ↓ C) −→ A K 0 −→ C has a colimit in C for every C ∈ Ob(C), where is the projection functor from the comma category (E ↓ C) to A which takes an object (A, h : A → C) of the comma category to its first coordinate A, and acts on morphisms accordingly [24].
Take any C ∈ Ob(C) and let A C 1 → A C 2 → · · · be a chain in A whose colimit is C. Let ι C n : A C n → C be the canonical embeddings. Recall that for every B ∈ Ob(A) and every morphism f : B → C there is an n and a morphism f n : Then it is easy to show that D is the colimit of the diagram Let us show that K preserves embeddings. Take any embedding f : be a chain in A whose colimit is C and let A D 1 → A D 2 → · · · be a chain in A whose colimit is D. Moreover, let ι C n : A C n → C and ι D n : A D n → D be the corresponding canonical embeddings. By Lemma 1.3, for every k there is an n k and a morphism f k : A C k → A D n k (which is necessarily an embedding) such that Without loss of generality n k 's can be chosen in such a way that n 1 < n 2 < . . .. In the extension we then have whence follows that K(f ) is also an embedding.
Analogous argument provides a construction of the natural transformation η : ID → K which extends η 0 . Consider the diagram: Since C is the colimit of the chain A C 1 → A C 2 → · · · , there is a unique morphism η C : C → K(C) to the tip of the competing compatible cone. The morphism η C is clearly an embedding and it is easy to check that all the morphisms η C constitute a natural transformation η : ID → K.
We also say that K is a Katětov functor and from now on we denote both K and K 0 by K, and both η and η 0 by η. An obvious yet important property of K is that all its powers remain Katětov. Specifically, for n ∈ N define η n : ID → K n as η n C = η K n−1 (C) • . . . • η K(C) • η C : C → K n (C). Then η n is a natural transformation witnessing that K n is a Katětov functor. We shall elaborate this in Section 3. For now, we state the following important property of finite iterations of K. Proof If g is an isomorphism, take n = 1 and h = η A • g −1 . Assume, therefore, that g is not an isomorphism. Then by Lemma 1.1(a) there exist n ∈ N and A 1 , . . . , A n ∈ Ob(A) such that A˙ → A 1˙ → A 2˙ → · · ·˙ → A n = B. It is easy to see that the diagram in Fig. 1 commutes: the triangles commute by the definition of a Katětov functor, while the parallelograms commute because η is a natural transformation. So, take

Examples
Below we collect some examples of Katětov functors. The second one shows in particular that Katětov functors (as well as their powers) do not necessarily have the extension property for embeddings between objects of C. In other words, Lemma 2.3 does not hold for embeddings between C-objects.

Example 2.4 A Katětov functor on the category of finite metric spaces with rational distances and nonexpansive mappings
This is a small modification of the original Katětov functor, in order to fit into Fraïssé theory. The details are explained in Section 5 below.
Let P 2 (X) = {Y ⊆ X : |Y | = 2}, and let P fin (X) denote the set of all finite subsets of X.

Example 2.5 A Katětov functor on the category of graphs and graph homomorphisms. Let
For a graph homomorphism f : Moreover, if f is an embedding, then so is f * . Now let G be an infinite graph. Let H = G ∪ {v}, where v is connected to all the vertices of G. Note that each vertex of K(G) \ G has a finite degree in K(G). Thus, there is no embedding of H extending η G : G → K(G). This shows that K does not have the extension property for embeddings in the bigger category consisting of all countable graphs. The same holds for K n for every n > 1 (and even for its ω-power), because all "new" vertices in K n (G) have finite degrees in G.

Example 2.6 A Katětov functor on the category of K n -free graphs and graph embeddings.
Fix an integer n ≥ 3. Let V , E be a K n -free graph, where E is the set of some 2-element For a graph embedding f :

Example 2.7 A Katětov functor on the category of digraphs and digraph homomorphisms.
For a digraph homomorphism f : Moreover, if f is an embedding, then so is f * .

Example 2.8 A Katětov functor on the category of all finite linear orders and monotone mappings. For a linear order
Then it is easy to see that ≤ * is a linear order on A * . For a monotone map f : Moreover, if f is an embedding, then so is f * .
The description of K( A, ≤ ) in case A, ≤ is a countable linear order is more involved. As an illustration, let us just say that K( Q, ≤ ) is of the form Q 1 ∪ Q 2 , where both Q 1 and Q 2 are dense in K( Q, ≤ ) and Q 1 serves as a copy of Q, ≤ while Q 2 serves as the set of all one-point extensions of finite subsets of Q 1 , ordered in a suitable way.

Example 2.9 A Katětov functor on the category of partially ordered sets and monotone mappings. For a partially ordered set
It is easy to see that ≤ * is a partial order on A * . For a monotone map f : Moreover, if f is an embedding, then so is f * .

Example 2.10 A Katětov functor on the category of tournaments and embeddings.
Recall that a tournament is a digraph V , E such that for every x, y ∈ V exactly one of the possibilities holds: either For a finite set A and a positive integer n let A ≤n be the set of all sequences a 1 , . . . , a k of elements of A where k ∈ {0, 1, . . . , n}. In case of k = 0 we actually have the empty sequence , as we will be careful to distinguish the 1-element sequence a from a ∈ A. For a sequence s ∈ A ≤n let |s| denote the length of s. For a tournament T = V , E , where E ⊆ V 2 , let n = |V | and let T ≤n be the tournament whose set of vertices is V ≤n and whose set of edges is defined lexicographically as follows: • if s and t are sequences such that |s| < |t|, put s → t in T ≤n ; • if s = s 1 , . . . , s k and t = t 1 , . . . , t k are distinct sequences of the same length, find the smallest i such that s i = t i and then put s → t in T ≤n if and only if s i → t i in T .
, v does not appear as an entry ins}.
It is easy to see that V * , E * is a tournament realizing all one-point extensions of V , E .
For an embedding f : Finally, K is a Katětov functor which is witnessed by the obvious natural transformation mapping T = V , E to its copy in K(T ). let K(f )( i, a ) = ({i} × S(a)). This turns K into a functor from the category of finite Boolean algebras into itself which preserves embeddings and such that η : ID → K is a natural transformation.

Example 2.11 A Katětov functor on the category of all Boolean algebras. For a finite set
Let us show that K is indeed a Katětov functor. Let j : ) be the embedding defined on the atoms of B(A ) as follows: and which extends to the rest of B(A ) in the obvious way. Then it is easy to see that

Sufficient Conditions for the Existence of Katětov Functors
Let be a purely relational language, let A be a -structure, and let B 1 , B 2 be -structures such that A is a substructure of both of them and A = B 1 ∩ B 2 . The free amalgam of the B 1 , B 2 over A is the -structure C with universe B 1 ∪ B 2 such that both B 1 , B 2 are substructures of C and for every R ∈ we have that R C = R B 1 ∪ R B 2 (in other words, no tuple which meets B 1 \ A and B 2 \ A satisfies any relation symbol in ). Following [4], we say that A has the free amalgamation property if every triple A, B 1 , B 2 as above has the free amalgam in A. The next result is implicit in [4] (see Definition 3.7 in [4] and the comment that follows). Theorem 2.12 (implicit in [4]) If A has free amalgamations then a Katětov functor K : The following theorem is a strengthening of this as well as of the main result of [10]. We say that A has one-point extension pushouts [resp. mixed pushouts] in C if for every morphism f : A 0 → A 1 in A and a one-point extension [resp. embedding] g : A 0˙ → A 2 in A there exists a B ∈ Ob(A), an embedding p : A 1 → B and a morphism q : A 2 → B such that p • f = q • g and this commuting square is a pushout square in the category C hom of all homomorphisms between C-objects.
Note that free amalgamations are particular examples of pushouts. Note also that typical categories of models with embeddings rarely have pushouts. Namely, recall that a pair of morphisms (p, q) provides the pushout of (f, g) if p • f = q • g and for every other pair (p , q ) satisfying p • f = q • g there exists a unique morphism h such that h • p = p and h • q = q . Now, if f = g and (p , q ) consists of identities then clearly h cannot be an embedding. That is why, in the definition above, we have to consider pushouts in the category of all homomorphisms.

Lemma 2.13
Suppose is a pushout square in the category C hom of all homomorphisms. If g is a one-point extension then so is p.
In other words, the square is commutative, where p 1 and q 1 denote the same mappings as p and q, respectively. By the universality of a pushout, there is a unique homomorphism h : It turns out that both variants of the definition above are equivalent. In practice however, it is usually easier to verify the existence of pushouts for one-point extensions.
Proposition 2.14 The following properties are equivalent: (a) A has the one-point extension pushouts in C.

(b) A has mixed pushouts in C.
Proof Only implication (a) =⇒ (b) requires a proof. Fix f : A 0 → A 1 and g : A 0 → A 2 as above and assume that g = g n • · · · • g 1 is the composition of n one-point extensions By Lemma 2.13 we have the following sequence of pushout squares in C hom .
Clearly, the composition of all these squares is a pushout in C hom .

Theorem 2.15
If A has has one-point extension pushouts in C then a Katětov functor K : Proof Let us first show that every countable source (A˙ → B n ) n∈N has a pushout in C, where A, B 1 , B 2 , . . . ∈ Ob(A). Let e n : A˙ → B n be the embeddings in this source. Let P 2 ∈ Ob(A) together with the embeddings f 2 : B 1 → P 2 and g 2 : B 2 → P 2 be the pushout of e 1 and e 2 . Next, let P 3 ∈ Ob(A) together with the embeddings f 3 : P 2 → P 3 and g 3 : B 3 → P 3 be the pushout of f 2 • e 1 and e 3 . Then, let P 4 ∈ Ob(A) together with the embeddings f 4 : P 3 → P 4 and g 4 : B 4 → P 4 be the pushout of f 3 • f 2 • e 1 and e 4 , and so on: It is easy to show that P is the pushout of the source (A˙ →B n ) n∈N .
Let us now construct the Katětov functor as the pushout of all the one-point extensions of an object in A. More precisely, for every A ∈ Ob(A) let us fix embeddings e n : A˙ → B n , where B 1 , B 2 , . . . is the list of all the one-point extensions of A, where every isomorphism type is taken exactly once to keep the list countable. Define K(A) to be the pushout of the source (e n : A˙ → B n ) n . This is how K acts on objects.
Let us show how K acts on morphisms. Take any morphism h : A → A in A. Let (e i : A˙ → B i ) i∈I be the source consisting of all the one-point extensions of A (where every isomorphism type is taken exactly once), and let let (e j : A ˙ → B j ) j ∈J be the source consisting of all the one-point extensions of A (where again, every isomorphism type is taken exactly once). By the assumption, for every i ∈ I there exists an m(i) ∈ J and a morphism h i : B i → B m(i) such that the following is a pushout square in C: Note that the category of graphs and homomorphisms has pushouts, while the category of K n -free graphs has pushouts of embeddings only. On the other hand, categories like tournaments or linear orderings do not have pushouts, even when considering all homomorphisms.

Katětov Construction
Definition 3.1 Let K : C → C be a Katětov functor. A Katětov construction is a chain of the form: where C ∈ Ob(C). We denote the colimit of this chain by K ω (C). An object L ∈ Ob(C) can be obtained by the Katětov construction starting from C if L = K ω (C). We say that L can be obtained by the Katětov construction if L = K ω (C) for some C ∈ Ob(C).
Note that K ω is actually a functor from C into C. Namely, for a morphism f : A → B let K ω (f ) be the unique morphism K ω (A) → K ω (B) from the colimit of the Katětov construction starting from A to the competitive compatible cone with the tip at K ω (B) and morphisms ( → • K n (f )) n∈N : It is clear that K ω preserves embeddings (the colimit of embeddings is an embedding). Moreover, the canonical embeddings η ω A : A → K ω (A) constitute a natural transformation η ω : ID → K ω . Thus, we have: Recall that a countable structure L is ultrahomogeneous if every isomorphism between two finitely generated substructures of L extends to an automorphism of L. More precisely, L is ultrahomogeneous if for all A, B ∈ age(L), embeddings j A : A → L and j B : B → L, and for every isomorphism f : One of the crucial points of the classical Fraïssé theory is the fact that every ultrahomogeneous structure is the Fraïssé limit of its age, and every Fraïssé limit is ultrahomogeneous.
Analogously, we say that a countable structure L is C-morphism-homogeneous, if every C-morphism between two finitely generated substructures of L extends to a Cendomorphism of L. More precisely, L is C-morphism-homogeneous if for all A, B ∈ age(L), embeddings j A : A → L and j B : B → L, and for every C-morphism f : In particular, if C is the category of all countable -structures with all homomorphisms between them, instead of saying that L is C-morphism-homogeneous, we say that L is homomorphism-homogeneous. The study of homomorphism-homogeneity was initiated by Cameron &Nešetřil [6].
The first part of the next result can be viewed as an analogy to Banach's contraction principle: iterating a Katětov functor, starting from an arbitrary object, one always "tends" to the Fraïssé limit, which can be regarded as a "fixed point" of the Katětov functor. Proof Take any C ∈ Ob(C), let (2) be the Katětov construction starting from C, and let L ∈ Ob(C) be the colimit of this chain. Let ι n : K n (C) → L be the canonical embeddings of the colimit diagram.
Let us first show that age(L) = Ob(A). Lemma 1.4 yields age(L) ⊆ Ob(A), so let us show that Ob(A) ⊆ age(L). Take any B ∈ Ob(A) and let A 1 → A 2 → · · · be a chain whose colimit is C. Since A has (JEP) there is a D ∈ Ob(A) such that A 1 → D ← B. Lemma 2.3 then ensures that there is an n ∈ N such that D → K n (A 1 ). On the other hand, A 1 → C implies K n (A 1 ) → K n (C). Therefore, B → D → K n (A 1 ) → K n (C) → L, so B ∈ age(L). This completes the proof that age(L) = Ob(A).
Next, let us show that L realizes all one-point extensions, that is, let us show that for all A, B ∈ Ob(A) such that A˙ → B and every embedding f : A → L there is an embedding g : B → L such that: (3) Take any A, B ∈ Ob(A) such that A˙ → B and let f : A → L be an arbitrary embedding. By Lemma 1.3 there is an n ∈ N and an embedding h : A → K n (C) such that f • h = ι n . Note that the following diagram commutes: (the triangle on the left commutes due to the definition of the Katětov functor, the parallelogram in the middle commutes because η is a natural transformation, while the triangle on the right commutes as part of the colimit diagram for the chain (2)). Let g = ι n+1 •K(h)•j .
Having in mind that f = ι n • h, from the last commuting diagram we immediately get that the diagram (3) commutes for this particular choice of g.
Therefore, L realizes all one-point extensions, so L is an ultrahomogeneous countable structure whose age is Ob(A). Consequently, L is the Fraïssé limit of Ob(A), whence we easily conclude that A is an amalgamation class. Moreover, the Fraïssé limit of A can be obtained by the Katětov construction starting from an arbitrary C ∈ Ob(C).
Finally, let us show that L is C-morphism-homogeneous. Take any A, B ∈ age(L), fix embeddings j A : A → L and j B : B → L, and let f : A → B be an arbitrary morphism. Then (4) Having in mind that K ω (A) and K ω (B) are colimits of Katětov constructions starting from A and B, respectively, we conclude that both K ω (A) and K ω (B) are isomorphic to L. Since L is ultrahomogeneous, there exist isomorphisms s : K ω (A) → L and t : K ω (B) → L such that (5) Putting diagrams (4) and (5) together we obtain Consequently, if the Katětov functor is defined on a category of countable -structures and all homomorphisms between -structures, the Fraïssé limit of A is both ultrahomogeneous and homomorphism-homogeneous.
Example 3.4 Let n ≥ 3 be an integer, let C n be the category of all countable K n -free graphs together with all graph homomorphisms, and let A n be the full subcategory of C n spanned by all finite K n -free graphs. Then there does not exist a Katětov functor K : A n → C n , for if there were one, the Henson graph H n -the Fraïssé limit of A n -would be homomorphismhomogeneous, and we know this is not the case.
(Proof. Since H n is universal for all finite K n -free graphs, it embeds both K n−1 and the star S n , which is the graph where one vertex is adjacent to n − 1 independent vertices. Let f be a partial homomorphism of H n which maps the n − 1 independent vertices of the star S n onto the vertices of K n−1 . If H n were homomorphism-homogeneous, f would extend to an endomorphism f * of H n , so f * applied to the center of the star S n would produce a vertex adjacent to each of the vertices of K n−1 inducing thus a K n in H n , which is not possible).
Note however that there exists a Katětov functor from the category A n of all finite K nfree graphs together with all graph embeddings to the category C n of all countable K n -free graphs together with all graph embeddings (see Example 2.6).

Characterizations of the existence of a Katětov functor
The following theorem gives a necessary and sufficient condition for a Katětov functor to exist. It depends on a condition that resembles the Herwig-Lascar-Solecki property (see [17,27]). A, f, B where A, B ≤ C are finitely generated and f : A → B is a C-morphism. We say that C ∈ Ob(C) has the morphism extension property in C if for any choice f 1 , f 2 , . . . of partial morphisms of C there exist D ∈ Ob(C) and m 1 , m 2 , . . . ∈ End(D) such that C is a substructure of D, m i is an extension of f i for all i, and the following coherence conditions are satisfied for all i, j and k:

Definition 3.5 A partial morphism of C ∈ Ob(C) is a triple
We say that C has the morphism extension property if every C ∈ Ob(C) has the morphism extension property in C. (2) A has (AP) and C has the morphism extension property; (

3) A has (AP) and the Fraïssé limit of A has the morphism extension property in C.
Proof (1) ⇒ (2): From Theorem 3.3 we know that A is an amalgamation class, it has a Fraïssé limit L in C, and L can be obtained by the Katětov construction starting from an arbitrary C ∈ Ob(C). Now, take any C ∈ Ob(C) and let us show that C has the morphism extension property in C. Since L is universal for Ob(C), without loss of generality we can assume that C ≤ L. For every finitely generated A ≤ C fix an isomorphism j A : K ω (A) → L such that (such an isomorphism exists because L is ultrahomogeneous). Now, for any family A i , f i , B i , i ∈ I , of partial morphisms of C it is easy to see that L together with its endo-

is an extension of C and its partial morphisms
The coherence requirements are satisfied since K ω is a functor which preserves embeddings.
(2) ⇒ (3): Trivial. Let us now show that the set of arrows η A = e • j A constitutes a natural transformation η : ID → K. Take any A-morphism f : A is a partial morphism of L whose extension is m i . This is why the following diagram commutes (where the dashed arrow indicates a partial morphism): Finally, let us show that K(A) embeds all one-point extensions of A. Let A˙ → B. Then there is an h : B → L such that since L is the Fraïssé limit of A. Therefore, which concludes the proof.
Note that the Henson graph H n , n ≥ 3, does not have the morphism extension property with respect to all graph homomorphisms (for otherwise there would be a Katětov functor defined on the category of all finite K n -free graphs and all graph homomorphisms, and we know that such a functor cannot exist).
The following theorem shows that the existence of a Katětov functor for varieties of algebras understood as categories whose objects are the algebras of the variety and morphisms are embeddings is equivalent to the amalgamation property for the category of finitely generated algebras of the variety.

Theorem 3.7 Let
be an algebraic language and let V be a variety of -algebras understood as a category whose objects are -algebras and morphisms are embeddings. Let A be the full subcategory of V spanned by all finitely generated algebras in V and let C be the full subcategory of V spanned by all countably generated algebras in V.

Assume additionally that there are only countably many isomorphism types in A. Then there exists a Katětov functor K : A → C if and only if A is an amalgamation class.
Proof (⇒) Immediately from Theorem 3.3.
(⇐) The category of all -algebras has pushouts [13, §28] and a pushout of finitely generated algebras is finitely generated. Thus if A is an amalgamation class then it has mixed pushouts in C. The statement now follows from Proposition 2.14 and Theorem 2.15.

Automorphism Groups and Endomorphism Monoids
The existence of a Katětov functor enables us to quickly conclude that the automorphism group of the corresponding Fraïssé limit is universal, as is the monoid of C-endomorphisms. As an immediate consequence of Theorem 3.3 we have: Corollary 3.9 Let K : A → C be a Katětov functor and let L be the Fraïssé limit of A (which exists by Theorem 3.3). Then for every C ∈ Ob(C): Recall that End C (X) may be just the set of all embeddings of X into itself, in case other homomorphisms are not in C. This is the case, for example, in the class of K n -free graphs, where there is no Katětov functor acting on all homomorphisms.

Corollary 3.10 For the following Fraïssé limits L we have that Aut(L) embeds all permutation groups on a countable set:
• the random graph (proved originally in [16]), • Henson graphs (proved originally in [16]), • the random digraph, • the rational Urysohn space (follows also from [29]), • the random poset, • the countable atomless Boolean algebra, • the random semilattice, • the random lattice, For the following Fraïssé limits L we have that End(L) embeds all transformation monoids on a countable set: • the random graph (proved originally in [5]), • the random digraph, • the rational Urysohn space, • the random poset (proved originally in [9]), • the countable atomless Boolean algebra.
Proof Having in mind Corollary 3.9, in each case it suffices to show that the corresponding category C contains a countable structure whose automorphism group embeds Sym(N) and whose endomorphism monoid embeds N N considered as a transformation monoid. For example, in case of the rational Urysohn space it suffices to consider the metric space (N, d) where d(m, n) = 1 for all m, n ∈ N, while in the case of the random Boolean algebra it suffices to consider the free Boolean algebra on ℵ 0 generators.
For some applications it is important to know whether the embeddings mentioned in Corollary 3.9 above are topological embeddings, when Aut(X) and End(X) are endowed with the pointwise topology, that is, the topology inherited from the power X X , where X carries the discrete topology. This natural topology makes the composition operation (and the inverse, in case of Aut(X)) continuous. Note that Aut(X) ⊆ End(X) are closed in X X (not being a homomorphism is witnessed by a finite set). In case where X is countable, X X is the well-known Baire space, a canonical Polish space, and Aut(X) is isomorphic to a closed subgroup of the countable infinite symmetric group S ∞ . The importance of such groups is demonstrated in the pioneering work [20] connecting Fraïssé theory with general Ramsey theory and topological dynamics. As we shall see in a moment, every Katětov functor embeds hom-sets preserving their pointwise topology.
Given C-objects X, Y , denote by C(X, Y ) the set of all C-morphisms from X to Y , endowed with the pointwise topology, that is, the topology inherited from the product X Y with X discrete. Note that a sequence f n ∈ C(X, Y ) converges to f ∈ C(X, Y ) if and only if for every finite set S ⊆ X there is n 0 such that f n S = f S for every n ≥ n 0 .

Proposition 3.11
Let K : C → C be a Katětov functor. Then for every C-objects X, Y , the mapping is a topological embedding.
Proof From the definition of a Katětov functor, we know that the mapping above (which we also denote by K) is one-to-one, as K(f ) can be viewed as an extension of f (the natural transformation η consists of embeddings). Let f n be a sequence in C(X, Y ). If K(f n ) → K(f ) pointwise, then f n → f pointwise, due to the remark above. Now suppose f n → f pointwise and fix a ∈ K(X). Choose a finite S ⊆ X such that the structure A = S generated by S has the property that a ∈ K(A), after identifying K(A) with a suitable substructure of K(X) (recall that K(X) is the standard colimit of K(F ), where F runs over all finitely generated substructures of X). There is n 0 such that f n S = f S whenever n ≥ n 0 . Then also f n A = f A for every n ≥ n 0 . Hence K(f n ) K(A) = K(f ) K(A) whenever n ≥ n 0 , showing that f n (a) → f (a) in the discrete topology. Finally, note that the topology on C(X, Y ) is always metrizable (and therefore determined by sequences), because X is countably generated and C(X, Y ) is homeomorphic (via the restriction operator) to a subspace of Y G , where G is a countable set generating X.

Corollary 3.12
The embeddings appearing in Corollary 3.9 are topological with respect to the pointwise topology.

Semigroup Bergman property
Semigroup-theoretic investigations of endomorphism monoids of Fraïssé limits have recently gained a significant momentum. In this section we generalize one of those results (see [8]) to demonstrate the power of the Katětov construction. We prove that in the presence of a Katětov functor, additional mild assumptions ensure that the endomorphism monoid End(L) of the Fraïssé limit L is strongly distorted and its Sierpiński rank is at most five. Applying a result from [25], we conclude that if End(L) is not finitely generated, then it has the Bergman property. The constructions we present here are rather technical, and the reader might find it helpful to get acquainted with the constructions from [8] before going on.
Following [25], we say that a semigroup S is semigroup Cayley bounded with respect to a generating set U if S = U ∪ U 2 ∪ . . . ∪ U n for some n ∈ N. We say that a semigroup S has the semigroup Bergman property if it is semigroup Cayley bounded with respect to every generating set.
A semigroup S has Sierpiński rank n if n is the least positive integer such that for any countable T ⊆ S there exist s 1 , . . . , s n ∈ S such that T ⊆ s 1 , . . . , s n . If no such n exists, the Sierpiński rank of S is said to be infinite. A semigroup S is strongly distorted if there exists a sequence of natural numbers l 1 , l 2 , l 3 , . . . and an N ∈ N such that for any sequence a 1 , a 2 , a 3 , . . . ∈ S there exist s 1 , . . . , s N ∈ S and a sequence of words w 1 , w 2 , w 3 , . . . over  the alphabet {x 1 , x 2 , . . . , x N } such that |w n | ≤ l n and a n = w n (s 1 , . . . , s N ) for all n.

Lemma 4.1 ([25]) If S is a strongly distorted semigroup which is not finitely generated, then S has the semigroup Bergman property.
It was shown in [26] that End(R), the endomorphism monoid of the random graph, is strongly distorted and hence has the semigroup Bergman property since it is not finitely generated. The idea from [26] was later directly generalized to classes of structures with coproducts in [8]. Here, we present a general treatment in the context of classes for which a Katětov functor exists, and where the (JEP) can be carried out constructively in the sense of the following definition. We also say that F is a natural (JEP) functor for C.
A category C has retractive natural (JEP) if C has natural (JEP) and the functor F has the following additional property: for every C ∈ Ob(C) there exist morphisms ρ * C , λ * C :

Remark 4.3
Note that since F is a covariant functor, the following also holds: • for all f 1 : f 2 ), and • Example 4.4 Any category with coproducts (such as the category of graphs, posets, digraphs) has retractive natural (JEP): just take F (C, D) to be the coproduct of C and D. On the other hand, it is easy to show that the category of all countable metric spaces with distances in Q and nonexpansive mappings does not have natural (JEP). Suppose, to the contrary, that there exists a functor F which realizes the natural (JEP) in this category, let U be the rational Urysohn space and let W = F (U, U). Let a 0 , b 0 ∈ U be arbitrary but fixed, and let δ = d W (λ U (a 0 ), ρ U (b 0 )). Take any a, b ∈ U , let c a : U → U : x → a and c b : U → U : x → b be the constant maps and put = F (c a , c b ).
Example 4.6 Let be the language consisting of function symbols and constant symbols only so that -structures are actually -algebras, and assume that contains a constant symbol 1. Then the category of -algebras has retractive natural (JEP): take F (C, D) to be Our aim in this section is to prove the following theorem: The proof of the theorem requires some technical prerequisites. Let us denote the functor which realizes (JEP) in C by (·, ·) so that (C, D) denotes its action on objects, and (f, g) its action on morphisms. For objects C 1 , C 2 , C 3 , . . . , C n and morphisms f, g, f 1 , f 2 , f 3 , . . . , f n of C let Let C denote the colimit of the following chain in C with the canonical embeddings denoted by ι n : Let L be the Fraïssé limit of A, which exists by Theorem 3.3. We know that K ω (C) ∼ = L, so let us fix an isomorphism The following diagram commutes because (·, ·) is a natural (JEP) functor: so the following diagram also commutes: Therefore, there is a compatible cone with the tip at L and the morphisms id L , λ * L , λ * . . over the chain L 1 → L 2 → L 3 → · · · . Since C is a colimit of the chain, there is a unique β : C → L such that In particular, As the next step in the construction, note that the following diagram commutes (again due to the fact that (·, ·) is a natural (JEP) functor): Therefore, there is a compatible cone with the tip at C and the morphisms over the chain L 1 → L 2 → L 3 → · · · . Since C is a colimit of the chain, there is a unique σ : C → C such that or, explicitly, An easy induction on n then suffices to show that Also, there is a compatible cone with the tip at C and the morphisms . . over the chain L 2 → L 3 → L 4 → · · · , so there is a unique τ : C → C such that or, explicitly, τ • ι n+1 = ι n • [ρ * L , id L ] n−1 , for alln ≥ 1. Another easy induction on n suffices to show that Let f = (f 1 , f 2 , . . .) be a sequence of C-endomorphisms of L. As the final step, we shall now construct an endomorphism φ(f ) : C → C which encodes the sequence f . Using once more the fact that (·, ·) is a natural (JEP) functor, we immediately get that the following diagram commutes: . . , f n ], for all n ≥ 1.

Lemma 4.8 (a) φ(f )
Proof (a) This is immediate from the construction of φ(f ).
(b) It suffices to note that the diagram below commutes. The square on the left commutes because (·, ·) is natural, while the square on the right commutes by the construction of φ(f ).
(c) This follows by induction on n. Just to illustrate the main ideas (which are straightforward, anyhow) we show the case n = 4. The following diagram commutes: The leftmost square commutes because (·, ·) is natural, while the rightmost square commutes by the construction of φ(f ). To see that the second square in this row commutes, just apply the functor (·, ·) to the following two commutative squares (see Remark 4.3): The same argument suffices to show that the third square in the row commutes too.
Proof In order to make it easier to follow the calculations we underline the expression that is to be reduced in the following step. Lemma 4.8 and (6).
We are now ready to prove Theorem 4.7.
Since η is natural, the diagram on the left below commutes, so by taking β 1 = r • K(β) we have that the diagram on the right also commutes: Analogously, the following diagrams also commute where β 2 = r • K(β 1 ): And so on. We get a sequence of morphisms β n : K n (C) → L such that Since K ω (C) is the colimit of the chain there is a unique mediating morphism β ω : K ω (C) → L such that This shows that every f n belongs to the semigroup generated byα,β,σ ,τ andφ, and we uniformly have that the length of the word representing f n is 2n+1. Therefore, End(K ω (C)) is strongly distorted and the Sierpiński rank of End(K ω (C)) is at most 5. Lemma 4.1 now yields that End(L) has the Bergman property if it is not finitely generated. Proof It is easy to see that each of the categories involved has retractive natural (JEP). In the first four cases the existence of a retraction r : K(L) → L such that r • η L = id L where L is the corresponding Fraïssé limit follows from the explicit construction of the Katětov functor (Section 2.1).
Let (U, ) denote the Urysohn sphere. Note that each p ∈ K(U ) is determined by a finite set F ⊆ U in the sense that (see Section 5 for more details, in particular, formula (10)). Note also that enlarging the set F , the equation above remains true, because of the triangle inequality. Suppose that U ⊆ X 0 ⊆ K(U ) is such that X 0 \U is finite and a nonexpansive retraction r : X 0 → U has already been defined. Fix p ∈ K(U )\ X 0 . Choose a finite set F containing r[X 0 \U ], such that (9) holds. Let A = (X 0 \U)∪F . Then r A : A → U is a nonexpansive mapping (which is identity on F ) therefore by [22,Thm. 3.18] it extends to a nonexpansive mapping onr : A ∪ {p} → U . Let q =r(p) and let r =r ∪ id U . We claim that r : Fix u ∈ U \ F . Using (9), we have (p, u) = (p, s) + (s, u) for some s ∈ F . Thus Since K(L) is the colimit of the bottom chain, there is a unique mapping r L : K(L) → L such that the diagram commutes. In particular, r L • η L = id L .

Appendix: The Original Katětov Construction
For the sake of completeness we present the details of Katětov's construction in the case of finite spaces. Actually, we were unable to find any source were Katětov's extensions of metric spaces are explicitly treated as a functor acting on nonexpansive mappings. We remark that all the considerations below are valid in the case of rational metric spaces; the main difference is that the values of the Katětov functor are countable rational metric spaces, instead of complete separable metric spaces.
Given a metric space X we shall denote its metric either by or by X . Fix a finite metric space X and denote by K(X) the set of all functions ϕX → [0, +∞) satisfying for every x 0 , x 1 ∈ X. Elements of K(X) are called Katětov functions on X. Given a ∈ X, the function a(x) = (x, a) is Katětov therefore it is natural to define η X : It is easy to see that η X is an isometric embedding. Note that K(X) is a Polish space, being a closed subspace of R X .
We now fix a nonexpansive map f : X → Y between finite metric spaces.
Proof Fix y 0 , y 1 ∈ Y and assume φ f (y i ) = Y (y i , f (x i )) + φ(x i ) for i = 0, 1. Then Similarly, φ f (y 1 ) ≤ Y (y 0 , y 1 ) + φ f (y 0 ). Furthermore, using the fact that f is nonexpansive and φ is Katětov, we get This shows that φ f is a Katětov function. Inequality φ f (f (x)) ≤ φ(x) is trivial. Finally, suppose f is an isometric embedding and fix x ∈ X. Choose because φ is Katětov. This completes the proof.

Lemma 5.3
Given nonexpansive mappings f : X → Y , g : Y → Z between finite metric spaces, it holds that φ g•f = (φ f ) g for every φ ∈ K(X).
On the other hand, using Lemma 5.1, we get It is obvious that φ id X = φ, therefore defining we obtain a covariant functor K from the category of finite metric spaces into the category of Polish metric spaces, both considered with nonexpansive mappings. Furthermore, K preserves isometric embeddings (by the second part of Lemma 52). On the other hand, ( x) f (y) ≤ (y, f (x)) + (x, x) = (y, f (x)) = f (x)(y).
The lemma above says that η is a natural transformation from the identity functor into K. The last fact just says that K is a Katětov functor.

Proposition 5.5
Let e : X → Y be an isometric embedding such that X is finite and |Y \X| = 1. Then there exists an isometric embedding g : Y → K(X) such that g • e = η X .
Proof We may assume that Y = X ∪ {s} and e is the inclusion. Let φ(x) = Y (x, s). Then φ is a Katětov function on X and hence, setting g(s) = φ and g(x) = x for x ∈ X, we obtained the required embedding.
As we have already mentioned, exactly the same arguments show the existence of a Katětov functor for finite metric spaces with rational distances, leading to the rational Urysohn space. Finally, one can restrict the set of distances to the unit interval [0, 1] obtaining a Katětov functor leading to the Urysohn sphere (or its rational variant). On the other hand, knowing that the category of finite metric spaces has one-point extension pushouts, Theorem 2.15 provides another Katětov functor on the category of finite rational metric spaces. The original Katětov functor is better in the sense that, when working in the category of all finite metric spaces, its values are complete separable metric spaces, which can be viewed as "minimal" spaces realizing all one-point extensions.

Conclusion
As we have seen above, the original Katětov construction deals with complete metric spaces, therefore it is formally out of the scope of our model-theoretic approach. The same applies to the recent Ben Yaacov's construction [3] of a Katětov functor on separable Banach spaces, leading to the so-called Gurariȋ space, the unique universal separable Banach space that is almost homogeneous, namely, isometries between finite-dimensional subspaces can be approximated by bijective isometries of the entire space. Both examples can be presented in the framework of continuous model theory [2]. In the definition of a Katětov functor one would need to relax the extension property, as the Gurariȋ space satisfies only its approximate variant.
With some effort, one can adapt most of our arguments to categories of continuous models, obtaining in particular the universality result of Uspenskij [29] as well as its counterpart concerning monoids of nonexpansive mappings. We have decided to present the theory of Katětov functors in discrete model-theoretic setting in order to make it more clear and accessible.
It is possible to provide a purely category-theoretic framework for Katětov functors. Actually, the only problem is to formulate the extension property properly, as it involves one-point extensions. Taking into account that every embedding of finitely generated structures is a finite composition of one-point extensions, in general one could consider a fixed family of morphisms generating the given category in this sense. Furthermore, if one wants to generalize homomorphisms of models, then the necessary structure should be a pair consisting of a fixed category K and its subcategory K 0 with the same objects as K, such that the arrows of K 0 correspond to embeddings. Furthermore, one has to fix a family S generating K 0 . Within this setup, a functor K defined on K is declared to be Katětov if there is a natural transformation η from the identity to K such that, among others, the following condition is satisfied: For every K-object a, for every f ∈ S with f : a → b, there is g ∈ K 0 such that g • f = η a , where η a : a → K(a). As one can see, there is a need to consider a bigger category σ K containing K and such that countable chains in K 0 have colimits in σ K, serving as the range of the functor K and allowing iterations of K. Summarizing, purely categorytheoretic generalization of the theory of Katětov functors is possible, yet seems to be much more technical than the theory presented in this work. On the other hand, we believe that such a generalization, (in particular, capturing continuous model theory) definitely deserves developing. Finally, another direction of further research is studying uncountable iterations of Katětov functors, obtaining models of arbitrarily high cardinality that are homogeneous with respect to their finitely generated substructures. This will be done elsewhere.
The results of Section 2 motivate the following natural Conjecture 6.1 Every Fraïssé limit has the morphism extension property with respect to embeddings.
It turns out that this conjecture is false. Namely, recently Grebí k [14] has found a relational Fraïssé class (with countable infinite relational language) without a Katětov functor for embeddings. It remains open whether there exists a Fraïssé class with a finite language, which is a counterexample to the above conjecture. A particular example for which we do not know the answer is the class of finite groups, where the amalgamation property is not trivial (its Fraïssé limit is Hall's group [15]).