{'fraction_non_alphanumeric': 0.053528793811479326, 'fraction_numerical': 0.008117658294336739, 'mean_word_length': 4.17622343054869, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
On classes of structures axiomatizable by universal d-Horn sentences and universal positive disjunctions

We provide universal algebraic characterizations (in the sense of not involving any “logical notion”) of some elementary classes of structures whose definitions involve universal d-Horn sentences and universally closed disjunctions of atomic formulas. These include, in particular, the classes of fields, of non-trivial rings, and of directed graphs without loops where every two elements are adjacent. The classical example of this kind of characterization result is the HSP theorem, but there are myriad other examples (e.g., the characterization of elementary classes using isomorphic images, ultraproducts and ultrapowers due to Keisler and Shelah).


Introduction
Consider an infinitary language L ∞∞ , where L is the signature of non-logical symbols, admitting arbitrarily long conjunctions, disjunctions and quantifications. As usual, by a positive literal we shall mean an atomic formula of this language, and by a negative literal we shall mean a negated atomic formula. Disjunctions of literals will be called disjunctive clauses, and conjunctions of literals will be called conjunctive clauses. A clause will be dubbed entirely positive when it contains only positive literals, and entirely negative when it contains only negative literals. Also as customary, sentences are closed formulas (i.e., formulas that do not contain free variables); we will call universal any clause obtained by closing a given clause under universal quantification. We use the symbol '=' for equality; given a formula φ or a set of formulas Δ, we shall call it =-based if it contains no relation symbols but equality, and shall call it =-free if it contains only relation symbols distinct from equality. Moreover, a formula is elementary if it is first order (in the sense that only finitary quantifications, conjunctions and disjunctions are involved).
Using the above terminology, an equation may be defined as a universal entirely positive conjunctive =-based clause (or, equivalently, as a conjunction of universal positive =-based literals), and an anti-equation may be defined as a universal entirely negative disjunctive =-based clause. (In the literature, (anti-)equations are sometimes called '(anti-)identities'; we find it wiser though to reserve the latter terminology to the model-theoretic interpretation of the syntactical equations.) A variety of algebras is a class of structures defined by equations; an antivariety of algebras is a class of structures defined by antiequations. In [9,10], a theorem analogous to Birkhoff's HSP theorem (cf. [3]) was obtained for antivarieties by replacing closure under direct products by closure under ultraproducts and replacing closure under homomorphic images by closure under homomorphic pre-images (plus in [11] some applications were offered in graph theory). Note that closure under substructures was not strictly necessary for that characterization (indeed, if a class is closed under homomorphic pre-images then it is, a fortiori, closed under substructures). Antivarieties may be used to present, for instance, the constraint satisfaction problem over a given finite structure A (cf. [12]). Indeed, given an existential positive formula φ expressing a constraint, deciding whether φ holds at CSP(A) amounts to deciding whether A belongs to the antivariety Mod(¬φ). Hence, two structures belonging to the same antivarieties share the same constraint satisfaction problem. Also, once we recall that any equational class has a trivial model (namely, a model containing a single object in its carrier), we see that it might be useful to upgrade its axiomatization by the addition of an anti-equation that constrains the corresponding interpretations to structures whose carriers contain more than one object. For an example, the 'zero ring' would be excluded from the variety of rings by the addition of an obvious anti-equation enforcing the failure of the identification between the denotations of the additive and the multiplicative neutral elements.
A basic Horn formula is a disjunctive clause containing at most one positive literal; so, they are of the form i∈I θ i , where I is some possibly infinite index set and the θ i s are literals, and where at most one of the literals θ i is positive while the remaining ones are negative. Universal Horn sentences are built from basic Horn formulas using conjunction and the universal quantifier. It is well-known how universal Horn formulas have been of tremendous significance in both algebra and computer science. The case of algebra is well covered in, say, [9]. In Prolog, Horn formulas are in general called rules; these are called facts when no negative literals are present, and are called queries when no positive literals are present. Clearly, anti-equations are particular cases of queries.
In [1,Definition 6], the so-called 'd-Horn formulas' were investigated. We introduce an infinitary version of the definition from that paper: where either (i) at most one =-based literal is positive and all =-free literals are positive, or (ii) all =-based literals are negative and at most one =-free literal is negative. A universal d-Horn sentence is the universal closure of a formula j∈J φ j where each φ j is basic d-Horn.
In addition, it will also be useful in what follows to consider universal positive disjunctions, namely, universally closed entirely positive disjunctive clauses. In [2, p.99] it is pointed out how theories containing only this kind of formulas axiomatize exactly those classes of structures of the same signature closed under the formation of ultraproducts, subalgebras and homomorphic images. Note, in particular, that universal positive =-free disjunctions are universal d-Horn sentences; however, if all the literals in a universal positive disjunction are =-based, the corresponding sentences are in general not d-Horn.
The goal of the present paper is to further the study of the model theory of these formulas. In particular, as it will be clarified below, we are interested in obtaining universal algebraic characterizations of certain classes of structures definable by universal d-Horn sentences and universal positive disjunctions. This is related to the problem of axiomatizing context-free grammars discussed in [1] (p. 13). In all cases we assume that a specific signature has been fixed in advance.
One way to motivate our work here is to consider the class of fields (cf. [14]). These are algebraic systems of type (2, 2, 1, 1, 0, 0) of the form (F, +, ·, −, −1 , 0, 1) where F is some domain of objects and the operations defined on F are such that: (i) multiplication distributes over addition; (ii) both addition and multiplication are commutative and associative; (iii) ∀x(x + 0 = x), ∀x(x·1 = x) and 0 = 1; (iv) ∀x(x+(−x) = 0) and ∀x(x = 0 → x·x −1 = 1). We know that these algebras do not form a variety. This can be seen by noting that the degenerate one-element algebra is a homomorphic image of any algebra of the type of fields, but since 0 = 1 in fields, we have that the class of fields is not closed under homomorphic images, and hence, by the Birkhoff HSP theorem, is not a variety. However, fields are axiomatizable by a collection of anti-equations and universal positive =-based disjunctions. Indeed, on the one hand, clearly 0 = 1 is an anti-equation, and on the other hand all formulas of the form ∀x(t(x) = s(x)) are equations (as well as particular cases of universal positive disjunctions). Finally, ∀x(x = 0 → x · x −1 = 1) is equivalent to ∀x(x = 0 ∨ x · x −1 = 1), which is a universal positive disjunction.
Another motivating example in a purely relational setting of a class of structures defined in this way is given by directed graphs without loops where every two elements are adjacent, which are axiomatized (where R is the relation corresponding to the edges) as follows: (i) R is irreflexive; (ii) not Rxy or not Ryx; (iii) Rxy or Ryx. Note that in this case we are dealing with two universal negative =-free disjunctions and one universal positive =-free disjunction.
Our first results below are concerned with algebraic structures and =based languages. The following results deal with relational structures and =free formulas.

Background from universal algebra
Given a class of structures K over a fixed signature, the class (H, Similarly, S(K), P (K), P r (K) and P u (K) denote the smallest classes containing K closed under subalgebras, products, reduced products and ultraproducts, respectively. In particular, for a given structure A, we denote (H, The construction of dual reduced products is introduced in [1, Def. 9] to characterize a formula being equivalent to a d-Horn formula (cf. [1, Theo. 9 and Prop. 10]). The dual reduced product d F A i for a sequence of structures (A i ) i∈I and a proper filter F on I is defined as follows: (1) The domain is the same as in the reduced product F A i .
(2) The interpretation of an arbitrary n-ary relation R is defined by declaring Functions and constants of the language are interpreted as in the usual reduced product. The class operator P d r will be used to denote closure under dual reduced products. Given a sequence of structures (A i ) i∈I , we define the dual direct product, d i∈I A i , of this sequence to be the structure which is exactly like i∈I A i except that for any n, the extension of the n-ary relation R i∈I Ai in i∈I A i is given by the collection of all n-tuples f 1 , . . . , f n of i∈I A i such that, for some i ∈ I, R Ai (f 1 (i), . . . , f n (i)) holds. The only difference from the direct product construction is, then, that in the place where a universal quantifier is used to define the relations in the direct product, in the new structure for the dual direct product we have used an existential quantifier. We shall denote by P d the operator that closes a class of structures under this construction. Analogously to the case of direct products, we can now introduce 0 as the dual direct product of an empty family of structures: this will be taken by definition to be the structure whose carrier contains a single arbitrarily chosen object a and a collection of empty relations (hence all positive literals fail in 0). Obviously, a class of structures is to be called 'closed under 0' if it contains 0.
The class operator H −1 s will denote closure under strict homomorphisms, i.e., homomorphisms preserving relations in both directions (see [7, p.1164]). In view of our Definition 1.1, we may define, for an equality-free language, a strict d-Horn sentence as a formula of the form ∀x(ψ → Φ), where Φ∪{ψ} is a set of positive literals. (Note that, if one compares this to the usual definition of a strict Horn formula [13, p.416], namely, a quasi equation, one might be tempted to say that strict d-Horn formulas are 'd-quasi equations'; this could however be confusing given that we are not necessarily dealing here with =based formulas.) We will call a class of structures axiomatized by collections of elementary strict d-Horn formulas an elementary strict d-Horn class.
To establish the axiomatizability of a given class of structures, it is often useful to employ some compactness property. Generalizing the model-theoretic notion of 'weak atomic compactness' (cf. [8]), we shall say that a structure A is weakly literal-compact if every set of literals finitely satisfiable in A is also satisfiable in A.
We briefly recall here the construction of diagram languages for a given structure, which we will often be making use of, in what follows. Fixed a language L, and given a structure A, let C be a collection of constants with the same cardinality as the carrier of A. The positive diagram of A in the constants C, hereinafter to be referred to as Diag + C (A), will be the collection of all positive literals P (t 0 , . . . , t n ) (where t 0 , . . . , t n are terms in the language obtained by just adding C to L and P is any n-ary predicate of such languages, including equality if it is present) that hold in A when each object in A is the denotation of some element of C. Similarly, the negative diagram of A in C, to be referred to as Diag − C (A) will be the collection of all negative literals, in the appropriately extended language, containing atomic formulas that are not satisfied in A. Given the positive diagram of a structure Diag + C (A), its complement Diag

Equality-based languages
In this section we provide characterizations of the classes of structures that can be axiomatized by a theory formed by a combination of anti-equations and of universal positive disjunctions (or simply equations).
One thing to observe about the proof of following result is that, in contrast to the proof of the HSP theorem, we cannot use free algebras, as the latter are in general not available in this setting. For instance, in the case of fields, it is well-known that there is no free field because there is no homomorphism between fields of different characteristic. Similarly, the assumption that no B ∈ K * can be expanded to satisfy D − 0 leads to a contradiction using universal positive disjunctions.
Since our class K is closed under ultraproducts, we have a compactness result with respect to K for theories formed by literals, and so we can find algebras D + , D − ∈ K such that D + can be expanded to a model of Diag On the other hand, let D be the subalgebra of D + generated by the denotations of constants from C, and extend h in the obvious way to a homomorphism assigning to any such denotation the corresponding denotation in A. Since we have D − ∈ K, by closure under subalgebras, we conclude that A ∈ K.
In the above result we cannot replace closure under ultraproducts by closure under reduced products, unfortunately, for universal positive disjunctions are not preserved under the latter (it takes a prime filter to preserve disjunctions, cf. [13, Theo. 9.43]).

Example 3.2.
As briefly discussed in §2, fields provide an example of a class K as described in Theorem 3.1.
We look next at how to characterize theories in which the positive disjunctions involved amount more simply to equations (so, =-based positive literals). The following structures sit indeed at the intersection of varieties and antivarieties. Suppose that A ∈ Mod(Th(K * )) and construct Diag + C (A) and Diag − C (A) as in the preceding proof. If we consider a finite D + 0 ⊆ Diag + C (A), and suppose that no B ∈ K * can be expanded to satisfy D + 0 , we get a contradiction just like before. Now, on the one hand, since our class of structures K is closed under reduced products, we have a compactness result with respect to K for theories formed by equations, so we can find some algebra D ∈ K such that D can be expanded to a model of Diag + C (A) and we can define a homomorphism h : A −→ D. On the other hand, products are a special case of reduced products ([3, Lemma 2.22(a)]). Then we know by [3,Theo. 10.12 and Cor. 10.11] that there is an algebra D ∈ SP r (K * ) such that A is a homomorphic image of D .
Example 3.4. Non-trivial rings (i.e., rings where1 =0) provide an example of a class K as described in Theorem 3.3.
Example 3.5. Another example of a class K as described in Theorem 3.3 is the class of non-idempotent De Morgan lattices (cf. [15]), a.k.a. intensionally complemented distributive lattices. In these algebras, non-indempotency is axiomatized as ∀x(∼x = x), where ∼ is the De Morgan involution.

Proposition 3.6. [K A] is first-order axiomatizable iff A is weakly literalcompact.
Proof. Let [K A] be axiomatizable. That every set of positive literals that is finitely satisfiable in A is also satisfiable in A is shown as in [10,Prop. 2.2]. We now argue that, moreover, every set of negated literals that is finitely satisfiable in A is also satisfiable in A. Take Δ to be such a set. Then, by compactness of first-order logic, we know that there is a structure B ∈ [K A] where Δ is satisfied. But in that case there is h : A onto − −− → B, with A ⊆ A, and, hence, Δ must also be satisfiable in A , and hence in A (due to the structure of Δ and to the surjectivity of h).
For the converse direction, assume that A is weakly literal-compact. By Theorem 3.3, it suffices to show that [K A] is closed under reduced products. Let (A i ) i∈I be a sequence of structures in [K A], and consider an A j , for j ∈ I, such that there are h i1 : Let F be any proper filter on I. That there is h : i∈I A i /F −→ A follows essentially as in the proof of [10, Prop. 2.2] (observe that reduced products suffice for this argument to go through according to [13,Lemma 9.4.2]). Now, consider the reduced power A I /F . We may take (A I /F ) ⊆ A I /F to be the substructure containing exactly those elements To that effect, expanding our language by adding a large enough collection C of new constants symbols, it suffices to show that Diag + C ((A I /F ) ) is satisfied in A. Now, each finite fragment of Diag + C ((A I /F ) ) is satisfied in A, since it is satisfied in A I /F and ∃x φ(x, y) (where φ is a conjunction of negative literals) is satisfied in A I /F . As A is weakly literal-compact, it follows that Diag + C ((A I /F ) ) is satisfied in A.

Equality-free languages
We will now focus on relational structures. The results below deal with =free languages. They may be partly seen as generalizations of results from the previous section. The model theory of languages without equality and related problems having to do with Horn-formulas, among other topics, have been explored in [6,5,4]. , where φ(x) is a negative literal, holding in all the elements of K * . Suppose that A ∈ Mod(Th(K * )). Add to our language a collection of constants C with the same cardinality as the carrier of A, and construct Diag + C (A) as usual (note that it will not contain any literal involving equality). Now, since A ∈ Mod(Th(K * )), we know that the universal negative literals holding in all structures in K * also hold in A. So, contrapositively, for each φ(c a1 , . . . , c an ) ∈ Diag + C (A), we can find a structure B φ(ca 1 ,...,ca n ) and a sequence of elements e φ c1 , . . . , e φ cn in this new structure such that B φ(ca 1   (ii) =⇒ (i): Again, this is the only direction that concerns us. Let Th(K * ) be the collection of all formulas ∀x φ(x) where φ(x) is a literal holding in all the elements of K * . Suppose that A ∈ Mod(Th(K * )). Then, arguing as in the proof of (a) to (c) in [13,Cor. 9.2.8] (which is Birkhoff's HSP theorem for the more general case where we have relations in the signature), we see that A ∈ HSP (K * ). Now, using the second half of the proof of Proposition 4.1 above, we may conclude that A ∈ H −1 P d (K * ). Recall that in an =-free context both universal positive disjunctions and universal negative literals are special cases of d-Horn sentences. (ii) =⇒ (i): As usual, we only need to verify this direction. Let Th(K * ) be the collection of all universal positive =-free disjunctions and sentences ∀x φ(x), where φ(x) is a negative literal, holding in all the elements of K * . Suppose that A ∈ Mod(Th(K * )). Note that a dual direct product is a special case of a dual reduced product where the filter is {I} and I is the set indexing the collection of structures we want to build a dual direct product of. This is because, in fact, the principal filter generated by any element i ∈ I is going to extend the trivial filter {I}. Using the second half of the proof of Proposition 4.1 above, we see that there is B ∈ P d r (K * ) such that A is a homomorphic pre-image of B. For the remainder of the argument, proceed as in Theorem 3.1 except that now one may substitute the use of ultraproducts by dual reduced products.  Finally, say that Mod(U ) = K for some first-order theory U . Then any formula ∀x(ψ → Φ) ∈ T is reducible to a first-order formula. Indeed, since U ∪ {ψ, ¬( Φ)} has no model, then, by compactness, there is some finite Φ 0 ⊆ Φ such that U ∪ {ψ, ¬( Φ 0 )} has no model. Hence, U |= ∀x(ψ → Φ 0 ) and, obviously, U |= ∀x(ψ → Φ 0 ) ↔ ∀x(ψ → Φ).
An immediate consequence of the above is a characterization of elementary strict d-Horn classes.

Corollary 4.8. K is an elementary strict d-Horn class iff K is closed under strict homomorphic pre-images, dual direct products and is first-order axiomatizable.
Example 4.9. An example of a class as described in Corollary 4.8 is the collection of all undirected graphs (irreflexive and symmetric binary relations) where if an edge exists between two vertices v 1 and v 2 , then for any vertex v 3 an edge exists between either v 1 and v 3 or v 2 and v 3 , which can be axiomatized by, say, ∀x Rxx → ∅ ∪ {∀x, y(Rxy → Ryx)} ∪ {∀x, y, z(Rxy → (Rxz ∨ Ryz))}.
A class K shall be called d-quasicompact if whenever a strict d-Horn formula ∀x(ψ → Φ) holds in the entirety of K, then ∀x(ψ → Φ 0 ) also holds in all members of K for some finite Φ 0 ⊆ Φ.