{'fraction_non_alphanumeric': 0.05756591970860717, 'fraction_numerical': 0.011917016390846465, 'mean_word_length': 3.74971793907484, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
The typical countable algebra

We argue that it makes sense to talk about ``typical'' properties of lattices, and then show that there is, up to isomorphism, a unique countable lattice L* (the Fraisse limit of the class of finite lattices) that has all ``typical'' properties. Among these properties are: L* is simple and locally finite, every order preserving function can be interpolated by a lattice polynomial, and every finite lattice or countable locally finite lattice embeds into L*. The same arguments apply to other classes of algebras assuming they have a Fraisse limit and satisfy the finite embeddability property.

1.1. Lattices. What is a "typical" property of a countably infinite lattice? It seems clear that the typical lattice will not be a chain, and will in fact have arbitrarily large finite antichains. Similarly, a "typical" lattice will contain arbitrarily long finite chains. It can also be argued that a typical lattice should not be distributive, since distributivity is a very special property for a lattice to have.
But why do we consider distributivity as a more special property than nondistributivity? One could argue that distributivity is a positive property, and that all "positive" properties are special; however, distributivity can also be seen as a negative property: neither N 5 nor M 3 embeds (see [Grätzer 1998, II.1, Theorem 1]).
We will define a property as "special" if only few countable lattices possess this property. Hence we need a means of measuring how "large" an infinite family of countable lattices is; as in [Goldstern 1997] we will use the topological notion of "first category" or "meagerness" for this purpose.
(Note that there may be finite algebras in the variety generated by L which are not finite L-algebras, e.g., if L is the class of all countable Boolean algebras.) On the set of all countable algebras in L whose universe is equal to a fixed set N = {0, 1, 2, . . .} we will define a natural topology induced by a complete metric (Proposition 23). By Baire's theorem, no nonempty open set is meager (=of first category). We say that "almost all countable algebras in L have a certain property" if the set of all A in our space having this property is residual (i.e., has meager complement).
Theorem 2. Assume that the finite L-algebras are a Fraïssé class (i.e., they have the amalgamation property (Definition 14) and the joint embedding property (Definition 18,see also Definition 19)). Assume further that L has the finite embeddability property (every partial finite L-algebra embeds into a finite L-algebra, see Definition 10).
Let L * be the Fraïssé limit (Theorem 22) of the finite L-algebras.
Then almost all algebras in L are isomorphic to L * .
Corollary 3. Let L * be as above. Let X be any property of algebras that is invariant under isomorphisms. Then there are two cases: (a) Almost all countable algebras in L (including L * ) have property X. We call such a property "typical". (b) Otherwise; then L * does not have property X, so almost no countable algebra in L has property X.
Hence L * has all "typical" properties. Algebras (and partial algebras) can of course be seen as relational structures (by replacing each n-ary function by the corresponding (n + 1)-ary relation, see 7.7]).
Proofs are often easier if we deal with purely relational structures only: on an abstract level, the set of all countable structures for a relational language, equipped with the natural (Tychonoff) topology, is a compact metric space, whereas the space of all countable algebras (see Proposition 23) is not compact. On a technical level, the Fraïssé limit (see Theorem 22) of a class of relational structures can be constructed as an increasing union of successive one-point extensions; in the algebraic setting this is not possible, unless we are ready to deal with partial algebras. The finite embedding property (see Definition 10) seems to be crucial for algebras, whereas it is irrelevant for relational structures, as relational structures are trivially locally finite.
The purpose of this note is to de-emphasise the role of compactness and to underline the role of the finite embeddability property in the algebraic context.
In Section 2 we explain (or recall) the definitions of a Fraïssé class and Fraïssé limit, and the finite embeddability property. Both notions are exemplified for the case of lattices. Rather than giving full proofs, we sketch proofs and mention the main ideas; the details can be found in textbooks ( [Hodges] for model theoretic notions such as the Fraïssé limit, [Grätzer 1998] for lattice theory).
We prove the theorem in Section 3. Section 4 describes the example of lattices and bounded lattices.

Basic notions
2.1. Ideals. Let U be any set, I ⊆ P(U ) a proper ideal.
Definition 5. We say that "almost all" u ∈ U have a property X iff the set {u ∈ U : u does not have property X} is in the ideal I.
For definiteness we should say "I-almost all" rather than just "almost all". However, if the ideal I has a sufficiently natural definition, we may omit mentioning it. (The ideal we will use is the ideal of meager sets on a certain product space, see Proposition 23.) Example 6. Let U = [0, 1]. Let I be the ideal of sets of Lebesgue measure zero.
Then, for example, "almost all x ∈ [0, 1] are irrational", since the set of rational numbers has measure zero; a randomly picked number is unlikely to be rational.
2.2. Setup. Throughout this paper we fix a similarity type (also called signature) of algebras. For notational simplicity only we will assume that this type is (2,2), i.e., we will consider only algebras with two binary operations. We call these two operations ∨ and ∧. Later (see Section 2.5.1) we will restrict our attention to algebras whose universe is a subset of a fixed countable set N.
We will also fix a class L of countable algebras (typically the countable algebras of a variety).
2.3. Partial algebras and the finite embeddability property.
2.3.1. Weak and relative subalgebras. An algebra A is a set univ(A) (called the universe of A) equipped with two binary operations ∨ A and ∧ A . (We allow the universe of an algebra to be empty.) A partial algebra is a set equipped with two (possibly) partial operations. The following definition is from [Grätzer 1979].
Definition 7. Let A be an algebra (or a partial algebra), and let S ⊆ univ(A) be a subset of the universe of A. We write A↾S for the partial algebra that A induces on S, and we call A↾S the relative subalgebra of A determined by S. Thus, a relative subalgebra of A is any partial algebra B whose universe univ(B) is a subset of the universe of A such that is satisfied for all a, b, c ∈ univ(B).
A weak subalgebra of A is any partial algebra B whose universe is a subset of univ(A) and whose operations, whenever defined, agree with the corresponding operations on A. E.g., whenever a, b, c ∈ univ(B) and a ∧ B b = c, then also a ∧ A b is defined and equal to c. (In contrast to the case of relative subalgebras, we allow here that a ∧ B b is undefined even when a ∧ A b is defined and an element of univ(B).) If δ : A → B is a total isomorphism between partial algebras A and B, and C a partial algebra with univ(B) ⊆ univ(C), then we write δ : A ֒→ w C iff B ≤ w C, and we say that δ embeds A weakly into C. The notation A ֒→ w C means that there exists δ with δ : A ֒→ w C. The relations δ : A ֒→ r C and A ֒→ r C are defined similarly.
Remark 8. From the algebraic and model-theoretic point of view, the notion of a relative subalgebra seems to be more natural than the notion of a weak subalgebra. However, from the topological point of view the weak subalgebras THE TYPICAL COUNTABLE ALGEBRA 5 are more practical, since they correspond directly to a natural basis of the relevant topology (see Proposition 28). Lemma 9 shows that the distinction is irrelevant for our purposes.

Finite embeddability.
Lemma 9. Let L be a class of algebras which is closed under finite products and under isomorphic images. Then the following are equivalent: (r,r) Every finite relative subalgebra of some algebra in L is a relative subalgebra of some finite algebra in L. (r,w) Every finite relative subalgebra of some algebra in L is a weak subalgebra of some finite algebra in L. (w,w) Every finite weak subalgebra of some algebra in L is a weak subalgebra of some finite algebra in L.
Proof. Trivially, the property (r,r) implies (r,w), as does the property (w,w).
It is also easy to see that (r,w) implies (w,w): Let A ≤ w B ∈ L. Then we can find an algebra A ′ with the same universe as We now prove that (w,w) implies (r,r). Let A ≤ r B ∈ L. As L is closed under isomorphism, it is enough to find a finite algebra E with A ֒→ r E ∈ L. Let I := {a ∧ a ′ , a ∨ a ′ : a, a ′ ∈ univ(A)} \ univ(A). Note that I ⊆ univ(B) \ univ(A). We may assume that I = ∅. [If I = ∅, then A is a total algebra, so A ≤ w E trivially implies A ≤ r E for any finite E ∈ L.] For each i ∈ I we define a partial algebra A i with universe univ(A) ∪ {i} such that A ≤ r A i ≤ w B; the only operations which are defined in A i but not in A are those operations which map pairs of elements of A to i. For each i ∈ I we can (using (w,w)) find a finite algebra Let δ : univ(A) → univ(E) be the natural embedding, defined by δ(a) = (a, . . . , a). Clearly δ : A ֒→ w E, but we claim that even δ : A ֒→ r E holds.
So let a, a ′ ∈ univ(A) and assume that (wlog) a ∧ A a ′ is undefined. We have to check that δ(a) ∧ E δ(a ′ ) / ∈ δ(univ(A)).
Definition 10. Let L be a class of algebras which is closed under isomorphic images and under finite products. Following [Lindner-Evans] we say that L has the finite embeddability property (f.e.p.) iff every finite weak subalgebra of some algebra in L is a weak subalgebra of some finite algebra in L. (Or equivalently, iff every finite relative subalgebra of some algebra in L is a relative subalgebra of some finite algebra in L.) Examples 11. Every locally finite variety has the f.e.p. We will see below that also the variety of lattices has the finite embeddability property.
I am grateful to Péter P. Pálfy for pointing out the following example: Let G be the finitely presented group a, b | b 2 a = ab 3 . This group is non-Hopfian [Baumslag-Solitar], hence not residually finite [Robinson,6.1.11]. So there is an element g ∈ univ(G) which is contained in every normal subgroup of finite index. Let B be a finite partial subgroup of G which is generated by a and b and contains g, such that b 2 a = ab 3 can be computed within B. If δ : B → E is a homomorphism onto a finite group E, then E would be generated by δ(a) and δ(b) and satisfy δ(b) 2 δ(a) = δ(a)δ(b) 3 , so E would have to be a homomorphic image of G, and hence satisfy δ(g) = 1. This shows that the variety of groups does not have the f.e.p.
The following is an ad hoc example of an (admittedly artificial) variety where the failure of the f.e.p. is more obvious: We have a binary operation * and three unary operations p, q and F . The equations of the variety say that on the range of F , * is a bijection with inverses p and q: Then all finite algebras of the variety satisfy F x ≈ F y. So the 2-element partial algebra {a, b} with F a = a, F b = b (and p, q, * undefined) is not a relative partial subalgebra of any finite algebra of the variety, although it is a relative partial subalgebra of some infinite algebra of the variety.

2.3.3.
Funayama's theorem. [Funayama] (see also [Grätzer 1998, I.5, Theorem 20]) characterized the partial lattices (i.e., the partial algebras which are relative subalgebras of lattices) as those structures on which there is a wellbehaved notion of "ideal" and shows that on each partial lattice P the map x → (x] (which sends each x to the principal ideal generated by x) maps P isomorphically onto a relative sublattice of the lattice of ideals on P .
If P is finite then also the ideal lattice over P is finite, so as a corollary to Funayama's theorem we get: Proposition 13. The variety of lattices has the f.e.p. That is: Whenever P = (univ(P ), ∨ P , ∧ P ) is a finite relative subalgebra of a lattice, then P is a relative subalgebra of a finite lattice.

Fraïssé classes.
2.4.1. Amalgamation and joint embedding. We will need the following notation: If A, B, B ′ are algebras with A ≤ B and A ≤ B ′ , we write B ≃ A B ′ ("B is isomorphic to B ′ over A") iff there exists an isomorphism g : B → B ′ which is the identity map on A.
We say that D is an amalgamation of B 1 and B 2 over A if there are 1-1 homomorphisms g 1 : Figure 1.) (More precisely we say that (D, g 1 , g 2 ) is an amalgamation of B 1 and B 2 over A, or over f 1 , f 2 . Intuitively it means that B 1 and B 2 are glued together, identifying f 1 (A) with f 2 (A).) The following fact was noted in [Jónsson]: Proposition 15. The family of all lattices has the amalgamation property, that is: Whenever f 1 : A → B 1 and f 2 : A → B 2 are 1-1 homomorphisms between lattices, then there exists a lattice D which amalgamates B 1 and B 2 over A.
This can be proved using Funayama's characterization: We may assume that f 1 and f 2 are inclusion maps, and that A = B 1 ∩ B 2 . The set univ(B 1 ) ∪ univ(B 2 ) is naturally partially ordered by the transitive closure of the union of the orders ≤ B 1 and ≤ B 2 ; by Proposition 12, the partial operations sup(x, y) and inf(x, y) make this poset into a partial lattice B 1 ∪ B 2 , so that the amalgamation of B 1 and B 2 over A can be taken to be the set of ideals of B 1 ∪ B 2 . (See [Grätzer 1998, Section V.4] for a detailed version of this proof.) Combining this fact with the finite embeddability property we easily see: Proposition 16. The amalgamation of two finite lattices is (or: can be chosen to be) finite. In other words: The class of finite lattices has the amalgamation property. Figure 1. Amalgamation of B 1 and B 2 over A If f 1 and f 2 are the identity embeddings, then we can also identify B 1 with g 1 (f 1 (B 1 )) = g 1 (B 1 ) and get the following convenient reformulation: Proposition 17. Let L be a class of algebras with the amalgamation property which is closed under isomorphism. Let A ≤ B 1 , A ≤ B 2 , and A, B 1 , B 2 be algebras in L.
Then we can find algebras B ′ 2 and D in L with (see Figure 2): Definition 18. We say that a family L of structures has the joint embedding property if for any structures A, B ∈ L there is a structure C ∈ L which contains isomorphic copies of both A and B. If L contains the empty structure (or more generally: has an initial element), then the amalgamation property of L implies the joint embedding property for L.

Ultrahomogeneity and the Fraïssé limit.
Definition 21. Let K be a class of finite algebras, and let L be a countable algebra. We say that L is a Fraïssé structure for K if (We call this property "ultrahomogeneity"; note that this word is often used for the following related notion, see (This is sometimes written as "L is universal". If K contains the empty algebra or more generally has an initial element, then this property follows from U1.) (U3) All finite substructures of L are in K .
If K is a Fraïssé class of finite algebras, then we can inductively build a countable Fraïssé structure for K . We construct an increasing sequence (C n : n = 1, 2, . . .) of finite algebras such that • for all A, B ∈ K and all n we have: if A ≤ B and A ≤ C n , then there is n ′ > n and The result of such a construction is called the Fraïssé limit of K . It is unique up to isomorphism: Theorem 22 ( [Fraïssé], see also [Hodges,Chapter 6.1]). Let K be a Fraïssé class of finite algebras. Then: (a) There is a unique locally finite countable structure L * which is a Fraïssé structure for K . (b) Moreover, if L 1 and L 2 are both locally finite Fraïssé structures for K , then every partial isomorphism between finite subalgebras of L 1 and L 2 can be extended to an isomorphism from L 1 onto L 2 . (c) Every countable locally finite algebra is isomorphic to a subalgebra of L * , assuming that all its finite subalgebras are in K .
2.5. Topology. Let X be a complete metric space. A subset M ⊆ X is called "nowhere dense" if there is no open set contained in the topological closure of M , and M is called meager (or: "of first category"), if M can be covered by countably many nowhere dense (or: nowhere dense closed) sets. Clearly, the family of meager sets forms an ideal. Since X is a complete metric space, Baire's theorem tells us that this ideal is proper: X itself is not meager. (In fact, no nonempty open set is meager.) 2.5.1. A metric space of algebras. Recall that for notational simplicity we only consider algebras with 2 binary operations.
We now consider all algebras (with two binary operations) whose underlying set is the set N of natural numbers. A binary operation on N is just a map from N×N into N, i.e., an element of N N 2 . Identifying each algebra A = (N, ∨ A , ∧ A ) with the pair (∨ A , ∧ A ) ∈ N N 2 × N N 2 , we see that our set of algebras is really the set N N 2 × N N 2 , which we abbreviate as N .
The space N in the next proposition is sometimes called "Baire space"; it is homeomorphic to the set of irrational real numbers.
Proposition 23. Using the discrete topology on N, and the Tychonoff topology (product topology) on N N 2 and N = N N 2 × N N 2 , the space N is a perfect Polish space (i.e., separable and completely metrizable).
An example of a complete metric on N is given by d((f, g), (f ′ , g ′ )) = 2 −n , where n is minimal such that there exist i, j ≤ n with f (i, j) = f ′ (i, j) or g(i, j) = g ′ (i, j).
Proposition 24. Let L be a variety. Then L ∩ N is a closed subset of N , hence also a Polish space.

Definition 25.
• N := N N 2 × N N 2 is the set of all algebras on the fixed countable set N.
• We write L ↾N , locfin for the locally finite algebras in L ↾N .
• We write L ↾N , fin for the class of all finite algebras whose universe is a subset of N. • We write L ↾N , w for the class of all finite partial algebras which are weak subalgebras of an algebra in L ↾N .
Definition 26. "Almost all countable algebras in L have property X" will mean: The set {L ∈ L ↾N : L does not have property X} is meager (in the complete metric space L ↾N ).
Definition 27. For any finite partial algebra P ∈ L ↾N , w we let If P is a total algebra, we write [P ] instead of [P ] w .
Note that for each a, b, c ∈ univ(P ) the sets {L ∈ L ↾N : a ∧ L b = c} and {L ∈ L ↾N : a ∨ L b = c} are clopen, by the definition of the product topology in L ↾N ; hence [P ] w is clopen, as a finite intersection of clopen sets. A closer inspection of the open sets in the product topology yields the following proposition: Proposition 28. The family {[P ] w : P ∈ L ↾N , w } is a clopen basis for the topology on L ↾N . In other words: For all L ∈ L ↾N , every open neighborhood of L contains a neighborhood of the form [P ] w , for some P ∈ L ↾N , w , P ≤ w L. (Here, P is a finite partial algebra.) For locally finite L we can ignore partial algebras altogether: If L ∈ L ↾N , locfin , then every open neighborhood of L contains a neighborhood of the form [A], for some A ∈ L ↾N , fin , A ≤ L. (Here, A is a finite total algebra.)

The typical countable algebra
Throughout this section the class L will be the class of countable algebras of some fixed variety.
We write L ↾N for the set of all algebras in L whose carrier set is the set N of natural numbers. At various points we will assume that L has several properties, in particular: the finite embeddability property, the amalgamation property and the joint embedding property. If we take L to be the class of countable lattices, then L has all these properties.
3.1. Two residual subsets of L ↾N . Our first lemma shows that the f.e.p. allows us to restrict our attention to locally finite algebras; thus the neighborhoods in our topological space are generated already by the finite total algebras and we may ignore partial algebras. Proof. We can write U as U = U 1 ∩ U 2 , where for ℓ = 1, 2 the set U ℓ is the set of all L ∈ L ↾N satisfying property Uℓ in Definition 21. We will show that U 1 is residual, leaving the case of U 2 to the reader.
We have We now check that each set U ¬A ∪ U A,B is dense.
So let [C] be a basic open set in L ↾N , locfin , C ∈ L ↾N , fin . We may assume that univ(A) ⊆ univ(C). If A ≤ C, then [C] ⊆ U ¬A , so we are done.
So assume A ≤ C. As also A ≤ B, we can find a finite algebra D and a subalgebra B ′ such that B ≃ A B ′ (using Proposition 17). Wlog univ(D) ⊆ N. In particular, taking L = the class of all countable lattices, we get: There is a ("typical" or "generic") countable lattice L * such that almost all countable lattices are isomorphic to L * .

Examples
Assume that L has the finite embeddability property, the amalgamation property and the joint embedding property. Let L * be the Fraïssé limit of the finite algebras in L.
We have already seen that L * is locally finite and contains copies of all finite L-algebras, and (by Theorem 22(c)) even all locally finite countable Lalgebras. The finite embeddability property implies that L * satisfies no law that does not hold in all L-algebras; in other words, L * generates L.
Since every finite automorphism between subalgebras (even partial subalgebras) extends to an automorphism of L * , L * has a very rich automorphism group.
The typical countable Boolean algebra is the (unique) atomless countable Boolean algebra; the typical distributive lattice and its automorphism group have been investigated in [Droste-Macpherson].
We now consider two special cases which are not locally finite: lattices and bounded lattices. 4.1. Lattices. Let L * be the typical countable lattice.
As remarked in the introduction, L * is certainly not distributive (it contains N 5 ), and in fact satisfies no law that is not implied by laws defining the variety of lattices. Since L * contains all countable locally finite lattices, L * contains, for example, a chain isomorphic to the rational numbers, and also an infinite antichain.
Note that L * is very different from the random order R, i.e., the Fraïssé limit of the class of finite partial orders: in R there are no no elements x = y which have a smallest upper bound.
Proposition 32. For every monotone function f : (L * ) n → L * and every finite sublattice A ≤ L * there is a lattice polynomial p(x 1 , . . . , x n ) which induces the function f on A. (We say that L * has the monotone interpolation property.) This implies that L * is simple (i.e., has no nontrivial congruence relations).
Proof. By [Goldstern 1996], we can find a finite lattice B, A ≤ B and a polynomial p with coefficients in B which interpolates f on univ(A), i.e., p( a) = f ( a) for all a ∈ A n . We can use the ultrahomogeneity of L * to find B ′ ≤ L * , B ≃ A B ′ . The isomorphism between B and B ′ translates p to a polynomial p ′ with coefficients in B ′ which still interpolates f on A.
The fact that the monotone interpolation property implies that there are no nontrivial congruence relations is well known: for any nontrivial congruence relation ∼ we can find a 1 < a 2 and b 1 < b 2 such that a 1 ∼ a 2 , b 1 ∼ b 2 . There is a monotone total function mapping a i to b i ; as such a function does not respect ∼, such a function cannot be a polynomial.
Proposition 33. Any two nontrivial intervals in the typical lattice are isomorphic to each other. (In fact, the isomorphism can be taken to be the restriction of an automorphism of L * .) Proof. By Theorem 22(b). 4.2. {0, 1}-lattices. We now consider a language where we have two constant symbols 0, 1 in addition to the two operations ∧ and ∨. We will consider the variety of {0, 1}-lattices (i.e., lattices in which 0 and 1 are the greatest and smallest element).
The same construction as in Proposition 15 (after the necessary change of notation, taking into account the new constants) shows the following: Proof. Let A be a partial finite {0, 1}-lattice. Wlog we may assume that 0 and 1 are defined in A. The natural embedding of A into the lattice of nonempty ideals preserves 0 and 1 (since 0 is mapped to the smallest nonempty ideal {0}).
It is now easy to see that the {0, 1}-lattices are a Fraïssé class with the f.e.p. Hence there is a "typical" countable {0, 1}-lattice K * . Note that 1 is typically not join-irreducible (i.e., there are lattices, even finite ones, where 1 = x ∨ y for some x, y < 1), so 1 is also not join-irreducible in K * .
Let L * be the typical lattice, and let a, b ∈ L * , a < b. Consider the interval [a, b] as a {0, 1}-lattice with a = 0, b = 1.
The ultrahomogeneity/universality of L * (with respect to the class of finite lattices) easily implies that [a, b] is ultrahomogeneous/universal (with respect to the class of finite {0, 1}-lattices). Hence we get: Proposition 36. Every nontrivial interval in the typical lattice L * is isomorphic to every nontrivial interval in the typical {0, 1}-lattice K * , in particular to K * itself.
This again implies that K * is simple.

Acknowledgements
I am grateful to Manfred Droste for pointing out several papers on ubiquitous structures, to Michael Pinsker for a conversation that led to Lemma 9, to Günther Eigenthaler for his careful proofreading, and to both referees for their constructive criticism.